void GrMouseSetCursor(GrCursor *C) { if (!MOUINFO->displayed && C && (C != MSCURSOR) && COMPATIBLE(C)) { GrCursor *oldcursor = MSCURSOR; if (C->displayed) GrEraseCursor(C); MOUINFO->cursor = C; if (MOUINFO->owncursor) GrDestroyCursor(oldcursor); MOUINFO->owncursor = FALSE; } }
/** * grx_cursor_move: * @cursor: the cursor * @x: the new x coordinate * @y: the new y coordinate * * Move the cursor to a new position. */ void grx_cursor_move(GrxCursor *C,int x,int y) { int xpos,ypos; int xsiz,ysiz; if(!C || ((C->xcord == x) && (C->ycord == y))) return; C->xcord = x; C->ycord = y; if(!C->displayed || !COMPATIBLE(C)) return; xpos = x - C->xoffs - C->xwpos; ypos = y - C->yoffs - C->ywpos; xsiz = C->xsize; ysiz = C->ysize; if((xpos >= 0) && ((xpos + xsiz) <= C->xwork) && (ypos >= 0) && ((ypos + ysiz) <= C->ywork)) { mouse_block(SCRN, C->xwpos, C->ywpos, (C->xwpos + C->xwork - 1),(C->ywpos + C->ywork - 1) ); (*C->work.gc_driver->bitblt)( WORKCXT(C,0,0), SAVECXT(C,0,0), C->xwork,C->ywork, GRX_COLOR_MODE_WRITE ); (*C->work.gc_driver->bitblt)( WORKCXT(C,xpos,ypos), ANDMASK(C,0,0), xsiz,ysiz, GRX_COLOR_MODE_AND ); (*C->work.gc_driver->bitblt)( WORKCXT(C,xpos,ypos), XORMASK(C,0,0), xsiz,ysiz, GRX_COLOR_MODE_XOR ); (*SDRV->bltr2v)( &SCRN->frame,C->xwpos,C->ywpos, WORKCXT(C,0,0), C->xwork,C->ywork, GRX_COLOR_MODE_WRITE ); mouse_unblock(); return; } grx_cursor_hide(C); grx_cursor_show(C); }
/** * grx_cursor_hide: * @cursor: the cursor * * Erase the cursor. The saved data is restored. */ void grx_cursor_hide(GrxCursor *C) { if(C && COMPATIBLE(C) && C->displayed) { mouse_block(SCRN, C->xwpos, C->ywpos, (C->xwpos + C->xwork - 1),(C->ywpos + C->ywork - 1) ); (*SDRV->bltr2v)( &SCRN->frame,C->xwpos,C->ywpos, SAVECXT(C,0,0), C->xwork,C->ywork, GRX_COLOR_MODE_WRITE ); C->displayed = FALSE; mouse_unblock(); } }
void _GrInitMouseCursor(void) { if (MSCURSOR && !COMPATIBLE(MSCURSOR)) { if (MOUINFO->owncursor) { GrCursor *obsolete = MSCURSOR; MOUINFO->cursor = NULL; MOUINFO->owncursor = FALSE; GrDestroyCursor(obsolete); } MOUINFO->cursor = NULL; } if (MSCURSOR == NULL) { GrMouseSetInternalCursor(GR_MCUR_TYPE_ARROW, GrAllocColor(255, 0, 0), GrBlack()); } if (MSCURSOR && MSCURSOR->displayed) { GrEraseCursor(MSCURSOR); } MOUINFO->cursmode = GR_M_CUR_NORMAL; MOUINFO->displayed = FALSE; MOUINFO->blockflag = 0; MOUINFO->docheck = FALSE; MOUINFO->block = block; MOUINFO->unblock = unblock; }
int PGBuildLR1::TRANSITION (int sym) { uint probe; LRKERNEL temp; int compatible = 1; int fk, lk, nk, ni, fi, i, j, k, x, y, p; // PRT_LRSTA (n_states); fk = f_lrkernel[n_states]; lk = l_lrkernel[n_states]; nk = lk - fk; fi = 0; x = n_states; #ifdef PG_DEBUG PRT_LRSTA (x); #endif if (optn[PG_CLR_PARSER]) { if (nk > 1) { LR1_SORT (lrkernel, fk, lk); } probe = hash_no % max_hashes; while ((y = hash_vector[probe]) != -1) // Get state y with same hash cell. { if (l_lrkernel[y] - f_lrkernel[y] == nk) // Same number of kernels? { for (i = f_lrkernel[x], j = f_lrkernel[y]; i < l_lrkernel[x]; i++, j++) { if (lrkernel[i].item != lrkernel[j].item) goto Next1; if (lrkernel[i].LA != lrkernel[j].LA ) goto Next1; } n_lrkernels = fk; // Reset this. return (y); // Return old state number. } Next1: probe = (hash_no *= 65549) / hash_div; } } else // PG_LR_PARSER or PG_LALR_PARSER { ni = LR0_SORT (lrkernel, fk, lk); if (ni == 1) // Number of lrkernel items is 1 or 0? { i = lrkernel[fk].item; // Get item # if (item[i].symb == -32767) { if (optn[PG_LALR_PARSER]) { p = item [i].prod; // Get production. reduce_state[p] = 1; // Mark production for reduce-state creation. return (-p); // Return production number. } fi = i; // Save the final item. } } probe = hash_no % max_hashes; while ((y = hash_vector[probe]) != -1) // Get state y with same hash cell. { #ifdef PG_DEBUG PRINT ("Comparing to:\n\n"); PRT_LRSTA (y); #endif int n = 0, m = 0; memset (item_added, 0, n_items); for (i = f_lrkernel[x]; i < l_lrkernel[x]; i++) { if (item_added[lrkernel[i].item] == 0) // Item not added yet? { n++; item_added [lrkernel[i].item] = 1; // Add it. } } for (i = f_lrkernel[y]; i < l_lrkernel[y]; i++) { if (item_added[lrkernel[i].item] == 0) goto Next2; // Missmatch! if (item_added[lrkernel[i].item] == 1) // Match!? { m++; item_added [lrkernel[i].item] = 2; } } if (n == m) // LALR(1) satisfied? { if (!optn[PG_LALR_PARSER]) { if (!COMPATIBLE (x, y)) { compatible = 0; goto Next2; } } #ifdef PG_DEBUG PRINT ("Got a match!\n"); #endif n_lrkernels = fk; // Reset this, not a new state. if (fi) // If final item defined? { p = item [fi].prod; // Get production. reduce_state[p] = 1; // Mark production for reduce-state creation. return (-p); // Return production number. } return (y); // Return old state number. } Next2: probe = (hash_no *= 65549) / hash_div; } } if (!compatible) extra_states++; if (fi) // If final item defined by LR or LALR? { #ifdef PG_DEBUG PRINT ("Reduce-ony state!\n"); #endif p = item [fi].prod; // Get production. reduce_state[p] = 1; // Mark production for reduce-state creation. return (-p); // Return production number. } // NEW STATE ... #ifdef PG_DEBUG PRINT ("New state %d\n", n_states); #endif accessor [n_states] = sym; hash_vector [probe] = n_states; DO_CLOSURE (n_states); if (n_states % 50000 == 0) prt_log (" %7d states\n", n_states); if (n_states >= max_states) MemCrash ("Number of states", max_states); return (n_states++); }
/** * grx_cursor_show: * @cursor: the cursor * * Draws the cursor at it's current position. */ void grx_cursor_show(GrxCursor *C) { int xpos,ypos; int xwrk,ywrk; int xsiz,ysiz; if(!C || !COMPATIBLE(C) || C->displayed) return; C->displayed = TRUE; xpos = C->xcord - C->xoffs; ypos = C->ycord - C->yoffs; xsiz = C->xwork; ysiz = C->ywork; xwrk = xpos & ~7; ywrk = ypos & ~7; if(xwrk < 0) xwrk = 0; if(ywrk < 0) ywrk = 0; if(xwrk > (grx_get_virtual_width() - xsiz)) xwrk = grx_get_virtual_width() - xsiz; if(ywrk > (grx_get_virtual_height() - ysiz)) ywrk = grx_get_virtual_height() - ysiz; C->xwpos = xwrk; C->ywpos = ywrk; mouse_block(SCRN,xwrk,ywrk,(xwrk + xsiz - 1),(ywrk + ysiz - 1)); (*SDRV->bltv2r)( SAVECXT(C,0,0), &SCRN->frame,xwrk,ywrk, xsiz,ysiz, GRX_COLOR_MODE_WRITE ); (*C->work.gc_driver->bitblt)( WORKCXT(C,0,0), SAVECXT(C,0,0), xsiz,ysiz, GRX_COLOR_MODE_WRITE ); xpos -= xwrk; ypos -= ywrk; xsiz = C->xsize; ysiz = C->ysize; xwrk = ywrk = 0; if(xpos < 0) { xwrk -= xpos; xsiz += xpos; xpos = 0; } if(ypos < 0) { ywrk -= ypos; ysiz += ypos; ypos = 0; } if(xsiz > (C->xwork - xpos)) xsiz = C->xwork - xpos; if(ysiz > (C->ywork - ypos)) ysiz = C->ywork - ypos; if((xsiz <= 0) || (ysiz <= 0)) return; (*C->work.gc_driver->bitblt)( WORKCXT(C,xpos,ypos), ANDMASK(C,xwrk,ywrk), xsiz,ysiz, GRX_COLOR_MODE_AND ); (*C->work.gc_driver->bitblt)( WORKCXT(C,xpos,ypos), XORMASK(C,xwrk,ywrk), xsiz,ysiz, GRX_COLOR_MODE_XOR ); (*SDRV->bltr2v)( &SCRN->frame,C->xwpos,C->ywpos, WORKCXT(C,0,0), C->xwork,C->ywork, GRX_COLOR_MODE_WRITE ); mouse_unblock(); }