void SplitTree::printShaderFunction( const NodeList& inOutputs, std::ostream& inStream ) const { unsigned long startPrint = getTime(); SplitArgumentTraversal printArguments(inStream,_outputPositionInterpolant); SplitStatementTraversal printStatements(inStream,_outputPositionInterpolant); for( size_t i = 0; i < _dagOrderNodeList.size(); i++ ) _dagOrderNodeList[i]->unmarkAsOutput(); _outputPositionInterpolant->unmarkAsOutput(); for( NodeList::const_iterator j = inOutputs.begin(); j != inOutputs.end(); ++j ) (*j)->markAsOutput(); // create the wrapper for the function inStream << "void main(" << std::endl; unmark( SplitNode::kMarkBit_SubPrinted ); printArguments( inOutputs ); inStream << " ) {" << std::endl; unmark( SplitNode::kMarkBit_SubPrinted ); printStatements( inOutputs ); inStream << "}" << std::endl; unsigned long stopPrint = getTime(); timePrintingCounter += stopPrint - startPrint; }
/* * Runs the machine and returns true or false if the machine accepts * the input. * * The token read is saved on token, so it expects that the size is * bigger enough to put the token. (this is not safe, and must be * refactored) */ bool fa_run(FiniteAutomata *m, char *token, BufferedInputStream *in) { state_t state = m->initial_state; int c, j = 0;; mark(in); while (true) { c = read(in); //printf("%c", c); switch (m->actions[state][c]) { case ERROR: //printf(" -> ERROR\n"); token[j++] = c; token[j] = '\0'; reverse1(token); while (j > 0) {/* pushback token consumed */ unread(token[--j], in); token[j] = '\0'; /* cleaning token */ } unmark(in); return false; case MOVEAPPEND: //printf(" -> MOVEAPPEND\n"); state = m->transitions[state][c]; token[j++] = c; break; case MOVENOAPPEND: //printf(" -> MOVENOAPPEND\n"); state = m->transitions[state][c]; break; case HALTAPPEND: //printf(" -> HALTAPPEND\n"); token[j++] = c; token[j] = '\0'; unmark(in); return true; case HALTNOAPPEND: //printf(" -> HALTNOAPPEND\n"); token[j] = '\0'; unmark(in); return true; case HALTREUSE: //printf(" -> HALTREUSE\n"); unread(c, in); token[j] = '\0'; unmark(in); return true; } } }
void FIDir::toggleMark() { if (m_iNumMarkedFiles < m_iNumFiles) mark(); else unmark(); }
void Concat::reset_marks() const { if( marked() ) { unmark(); left->reset_marks(); right->reset_marks(); } }
static void marktmu (GCState *st) { GCObject *u; for (u = st->g->tmudata; u; u = u->gch.next) { unmark(u); /* may be marked, if left from previous GC */ reallymarkobject(st, u); } }
// // Rewind the input stream back to anIndex and force a : prior to resuming input. // void CxxLexer::rewind_colon(size_t anIndex, const CxxToken *aToken) { remark(anIndex); unmark(); primed_tokens[0] = CxxToken::colonToken; primed_tokens[1] = static_cast<CxxParser::semantic_type*>(_yylval)->token; }
void unmark_all () { logger.info() << "unmarking all obs" |0; for (Ob::sparse_iterator i=Ob::sbegin(), end=Ob::send(); i!=end; ++i) { unmark(*i); } }
void SplitTree::printArgumentAnnotations( const NodeList& inOutputs, std::ostream& inStream ) const { SplitAnnotationTraversal printAnnotations(inStream,_outputPositionInterpolant); unmark( SplitNode::kMarkBit_SubPrinted ); printAnnotations( inOutputs ); }
// Unmarks data from current elliptic point and returns result. lnum epoint::unmark(void) const { if (is_inf()) eccRoutines::op_err(pE_INF); lnum res = lnum::create_nullmodule(); unmark(res); return res; }
void check_assumption_list(void){ calllistptr tempin,in=assumption_list_gl; call2listptr marked_ptr; callnodeptr c; while(in){ tempin=in->next; marked_ptr=in->item2; c=marked_ptr->item; if(c->outcount>0){ delete_callnode(marked_ptr); SM_DeallocateStruct(smCall2List,marked_ptr); #ifdef INCR_DEBUG1 printf("in check assumption ");printcall(c);printf("\n"); #endif if(c->deleted) unmark(c); } SM_DeallocateStruct(smCallList, in); in=tempin; } assumption_list_gl=NULL; return; }
void SplitTree::accumulateParentSplits( SplitNode* inSplit ) { unmark( SplitNode::kMarkBit_Ancestor ); inSplit->_parentSplits.clear(); size_t parentCount = inSplit->getGraphParentCount(); for( size_t i = 0; i < parentCount; i++ ) accumulateParentSplitsRec( inSplit, inSplit->getIndexedGraphParent(i) ); }
void SplitTree::accumulateChildSplits( SplitNode* inSplit ) { unmark( SplitNode::kMarkBit_Descendent ); inSplit->_childSplits.clear(); size_t childCount = inSplit->getGraphChildCount(); for( size_t i = 0; i < childCount; i++ ) accumulateChildSplitsRec( inSplit, inSplit->getIndexedGraphChild(i) ); }
int StoneField::mark(int x,int y,bool force) { int index=map(x,y); if (index<0) { unmark(); return 0; } if (field[index].marked) return -1; unmark(); mark(index,field[index].color); if (marked==1&&!force) { field[index].marked=false; marked=0; } return marked; }
void Union::reset_marks() const { if( marked() ) { unmark(); std::list< regex_t >::const_iterator it = children.begin(); for( ; it != children.end(); it++ ) { regex_t child = *it; child->reset_marks(); } } }
void resetmsg(HWND hwnd) { if (infomsg[0] && edp) upd=1; infomsg[0]=0; if (infoflg) infoflg=0, KillTimer(hwnd,2); if (lmf&&--lmf==0) unmark(); }
int gc_num_live_objects() { mark(); int n = 0; void *p = start_of_heap; while (p >= start_of_heap && p < alloc_bump_ptr) { if (((heap_object *)p)->marked) { n++; } p = p + ((heap_object *)p)->size; } unmark(); return n; }
int ucopy(BW *bw) { if (markv(1) && !square) { B *b = bcpy(markb, markk); yankdel(markb->byte, b); brm(b); if (lightoff) unmark(bw); return 0; } else { msgnw(bw->parent, joe_gettext(_("No block"))); return -1; } }
void VarCode::reduceAll(Deque<VarCode> *vcl) { unmark(); phase = 1; reduce(); for (Deque<VarCode>::iterator i = vcl->begin(); i != vcl->end(); i++) (*i).reduce(); unmark(); for (Deque<VarCode>::iterator i = vcl->begin(); i != vcl->end(); i++) (*i).unmark(); codeTable->clearSCTable(); #ifdef ENABLE_AND phase = 2; reduce(); for (Deque<VarCode>::iterator i = vcl->begin(); i != vcl->end(); i++) (*i).reduce(); unmark(); for (Deque<VarCode>::iterator i = vcl->begin(); i != vcl->end(); i++) (*i).unmark(); #endif }
static int sweeplist (lua_State *L, GCObject **p, int limit) { GCObject *curr; int count = 0; /* number of collected items */ while ((curr = *p) != NULL) { if (curr->gch.marked > limit) { unmark(curr); p = &curr->gch.next; } else { count++; *p = curr->gch.next; freeobj(L, curr); } } return count; }
int ufmtblk(BW *bw) { if (markv(1) && bw->cursor->byte >= markb->byte && bw->cursor->byte <= markk->byte) { markk->end = 1; utomarkk(bw); within = 1; do { ubop(bw), uformat(bw); } while (bw->cursor->byte > markb->byte); within = 0; markk->end = 0; if (lightoff) unmark(bw); return 0; } else return uformat(bw); }
void luaC_callGCTM (lua_State *L) { lu_byte oldah = L->allowhook; L->allowhook = 0; /* stop debug hooks during GC tag methods */ L->top++; /* reserve space to keep udata while runs its gc method */ while (G(L)->tmudata != NULL) { GCObject *o = G(L)->tmudata; Udata *udata = gcotou(o); G(L)->tmudata = udata->uv.next; /* remove udata from `tmudata' */ udata->uv.next = G(L)->rootudata; /* return it to `root' list */ G(L)->rootudata = o; setuvalue(L->top - 1, udata); /* keep a reference to it */ unmark(o); markfinalized(udata); do1gcTM(L, udata); } L->top--; L->allowhook = oldah; /* restore hooks */ }
void unmark(callnodeptr c){ callnodeptr c1; calllistptr in=c->inedges; #ifdef INCR_DEBUG1 printf("unmarking ");printcall(c);printf("\n"); #endif c->deleted=0; while(IsNonNULL(in)){ c1=in->inedge_node->callnode; c1->outcount++; if(c1->deleted) unmark(c1); in=in->next; } return; }
void SplitTree::rdsMerge( SplitNode* n, SplitShaderHeuristics& outHeuristics ) { assert( n ); // dumpFile << "MERGE " << (void*)n << std::endl << " "; // n->dump( dumpFile ); // dumpFile << std::endl; // unvisit nodes unmark( SplitNode::kMarkBit_Merged ); size_t childCount = n->getGraphChildCount(); for( size_t i = 0; i < childCount; i++ ) { SplitNode* child = n->getIndexedGraphChild(i); rdsMergeRec( child ); } rdsTryMerge( n, outHeuristics ); }
static bool remove(WFVector *vec, int pos, void *p){// TO BOUND RECURSIVE assert(controlWord); if ( rDepth > vec->vector_nThreads*2 || controlWord->load() ){ return false; } rDepth++; assert(isHelper(p)); Helper *helper= unmark(p); assert(helper->type < dt_unknown); bool success=helper->complete(vec, pos); rDepth--; return success; }
static int sweeplist (lua_State *L, GCObject **p, GCObject *tail, int limit) { #if 0 GCObject **start = p; #endif 0 GCObject *curr; int count = 0; /* number of collected items */ while ((curr = *p) != tail) { if (curr->gch.marked > limit) { unmark(curr); p = &curr->gch.next; } else { count++; *p = curr->gch.next; #if LUA_REFCOUNT if (curr->gch.prev) { Unlink(curr); curr->gch.next->gch.prev = (GCObject*)p; } #endif LUA_REFCOUNT freeobj(L, curr); } } #if 0 while (1) { curr = *p; if (curr == NULL) break; if (curr->gch.next) lua_assert(!curr->gch.next->gch.prev || curr->gch.next->gch.prev == curr); if (curr->gch.prev) lua_assert(curr->gch.prev->gch.next == curr); start = &curr->gch.next; } #endif 0 return count; }
int markall(char buf[], int f) { char **np; int i; struct message *mp; char *namelist[NMLSIZE], *bufp; int tok, beg, mc, star, other, valdot, colmod, colresult; valdot = dot - &message[0] + 1; colmod = 0; for (i = 1; i <= msgCount; i++) unmark(i); bufp = buf; mc = 0; np = &namelist[0]; scaninit(); tok = scan(&bufp); star = 0; other = 0; beg = 0; while (tok != TEOL) { switch (tok) { case TNUMBER: number: if (star) { printf("No numbers mixed with *\n"); return (-1); } mc++; other++; if (beg != 0) { if (check(lexnumber, f)) return (-1); for (i = beg; i <= lexnumber; i++) if (f == MDELETED || (message[i - 1].m_flag & MDELETED) == 0) mark(i); beg = 0; break; } beg = lexnumber; if (check(beg, f)) return (-1); tok = scan(&bufp); regret(tok); if (tok != TDASH) { mark(beg); beg = 0; } break; case TPLUS: if (beg != 0) { printf("Non-numeric second argument\n"); return (-1); } i = valdot; do { i++; if (i > msgCount) { printf("Referencing beyond EOF\n"); return (-1); } } while ((message[i - 1].m_flag & MDELETED) != f); mark(i); break; case TDASH: if (beg == 0) { i = valdot; do { i--; if (i <= 0) { printf("Referencing before 1\n"); return (-1); } } while ((message[i - 1].m_flag & MDELETED) != f); mark(i); } break; case TSTRING: if (beg != 0) { printf("Non-numeric second argument\n"); return (-1); } other++; if (lexstring[0] == ':') { colresult = evalcol(lexstring[1]); if (colresult == 0) { printf("Unknown colon modifier \"%s\"\n", lexstring); return (-1); } colmod |= colresult; } else *np++ = savestr(lexstring); break; case TDOLLAR: case TUP: case TDOT: lexnumber = metamess(lexstring[0], f); if (lexnumber == -1) return (-1); goto number; case TSTAR: if (other) { printf("Can't mix \"*\" with anything\n"); return (-1); } star++; break; case TERROR: return (-1); } tok = scan(&bufp); } lastcolmod = colmod; *np = NULL; mc = 0; if (star) { for (i = 0; i < msgCount; i++) if ((message[i].m_flag & MDELETED) == f) { mark(i+1); mc++; } if (mc == 0) { printf("No applicable messages.\n"); return (-1); } return (0); } /* * If no numbers were given, mark all of the messages, * so that we can unmark any whose sender was not selected * if any user names were given. */ if ((np > namelist || colmod != 0) && mc == 0) for (i = 1; i <= msgCount; i++) if ((message[i-1].m_flag & MDELETED) == f) mark(i); /* * If any names were given, go through and eliminate any * messages whose senders were not requested. */ if (np > namelist) { for (i = 1; i <= msgCount; i++) { for (mc = 0, np = &namelist[0]; *np != NULL; np++) if (**np == '/') { if (matchfield(*np, i)) { mc++; break; } } else { if (matchsender(*np, i)) { mc++; break; } } if (mc == 0) unmark(i); } /* * Make sure we got some decent messages. */ mc = 0; for (i = 1; i <= msgCount; i++) if (message[i-1].m_flag & MMARK) { mc++; break; } if (mc == 0) { printf("No applicable messages from {%s", namelist[0]); for (np = &namelist[1]; *np != NULL; np++) printf(", %s", *np); printf("}\n"); return (-1); } } /* * If any colon modifiers were given, go through and * unmark any messages which do not satisfy the modifiers. */ if (colmod != 0) { for (i = 1; i <= msgCount; i++) { struct coltab *colp; mp = &message[i - 1]; for (colp = &coltab[0]; colp->co_char != '\0'; colp++) if (colp->co_bit & colmod) if ((mp->m_flag & colp->co_mask) != colp->co_equal) unmark(i); } for (mp = &message[0]; mp < &message[msgCount]; mp++) if (mp->m_flag & MMARK) break; if (mp >= &message[msgCount]) { struct coltab *colp; printf("No messages satisfy"); for (colp = &coltab[0]; colp->co_char != '\0'; colp++) if (colp->co_bit & colmod) printf(" :%c", colp->co_char); printf("\n"); return (-1); } } return (0); }
// // Complete a search, releasing the search context object and popping a mark off the stack. // void CxxLexer::end_search(CxxToken *aToken) { CxxSearchContext::release(); unmark(aToken); }
CGEventRef processEvent(CGEventType type, CGEventRef event) { CGKeyCode keycode = (CGKeyCode) CGEventGetIntegerValueField(event, kCGKeyboardEventKeycode); CGKeyCode autorepeat = (CGKeyCode) CGEventGetIntegerValueField(event, kCGKeyboardEventAutorepeat); if (outsideMirror) { // Outside mirror... if (type == kCGEventKeyDown) { if (autorepeat) { if (marked(outside, keycode)) { return passEvent(event); } else { return remapEvent(event); } } else { if (keycode == 49) { // space goInside(event); spaceDown = CGEventCreateCopy(event); return swallowEvent(event); } else { mark(outside, keycode); return passEvent(event); } } } else if (type == kCGEventKeyUp) { if (marked(outside, keycode)) { unmark(outside, keycode); return passEvent(event); } else { unmark(inside, keycode); return remapEvent(event); } } } else { // Inside mirror if (type == kCGEventKeyDown) { if (autorepeat) { if (keycode == 49) { // space return swallowEvent(event); } else { if (marked(inside, keycode)) { return remapEvent(event); } else { return passEvent(event); } } } else { mark(inside, keycode); mirrorCount++; return remapEvent(event); } } else if (type == kCGEventKeyUp) { if (keycode == 49) { // space goOutside(); if (burst(event)) { return emitSpace(event); } else { return swallowEvent(event); } } else { if (marked(inside, keycode)) { unmark(inside, keycode); return remapEvent(event); } else { return passEvent(event); } } } } printf("Leaking events?!\n"); return event; }
void luaC_callGCTM (lua_State *L) { lu_byte oldah = L->allowhook; L->allowhook = 0; /* stop debug hooks during GC tag methods */ L->top++; /* reserve space to keep udata while runs its gc method */ #if LUA_REFCOUNT while (G(L)->tmudata_head.next != (GCObject*)&G(L)->tmudata_tail) { GCObject *o = G(L)->tmudata_head.next; Udata *udata = gcotou(o); G(L)->tmudata_head.next = udata->uv.next; /* remove udata from `tmudata' */ udata->uv.prev = (GCObject*)&G(L)->rootudata_head; udata->uv.next = G(L)->rootudata_head.next; if (udata->uv.next) udata->uv.next->uv.prev = o; G(L)->rootudata_head.next = o; #else !LUA_REFCOUNT while (G(L)->tmudata != NULL) { GCObject *o = G(L)->tmudata; Udata *udata = gcotou(o); G(L)->tmudata = udata->uv.next; /* remove udata from `tmudata' */ udata->uv.next = G(L)->rootudata; /* return it to `root' list */ G(L)->rootudata = o; #endif LUA_REFCOUNT setuvalue(L->top - 1, udata); /* keep a reference to it */ unmark(o); markfinalized(udata); do1gcTM(L, udata); } L->top--; L->allowhook = oldah; /* restore hooks */ } void luaC_sweep (lua_State *L, int all) { if (all) all = 256; /* larger than any mark */ #if LUA_REFCOUNT sweeplist(L, &G(L)->rootudata_head.next, (GCObject*)&G(L)->rootudata_tail, all); #else !LUA_REFCOUNT sweeplist(L, &G(L)->rootudata, NULL, all); #endif LUA_REFCOUNT sweepstrings(L, all); #if LUA_REFCOUNT sweeplist(L, &G(L)->rootgc_head.next, (GCObject*)&G(L)->rootgc_tail, all); #else !LUA_REFCOUNT sweeplist(L, &G(L)->rootgc, NULL, all); #endif LUA_REFCOUNT } /* mark root set */ static void markroot (GCState *st, lua_State *L) { int i; global_State *g = st->g; markobject(st, defaultmeta(L)); for (i = 0; i < LUA_NTYPES; i++) { markobject(st, defaultmetatypes(L, i)); } markobject(st, registry(L)); traversestack(st, g->mainthread); if (L != g->mainthread) /* another thread is running? */ markvalue(st, L); /* cannot collect it */ if (G(L)->userGCFunction) { st->L = g->mainthread; G(L)->userGCFunction(st); } }
static void marktmu (GCState *st) { GCObject *u; #if LUA_REFCOUNT for (u = st->g->tmudata_head.next; u != (GCObject*)&st->g->tmudata_tail; u = u->gch.next) { #else !LUA_REFCOUNT for (u = st->g->tmudata; u; u = u->gch.next) { #endif LUA_REFCOUNT unmark(u); /* may be marked, if left from previous GC */ reallymarkobject(st, u); } } /* move `dead' udata that need finalization to list `tmudata' */ size_t luaC_separateudata (lua_State *L) { size_t deadmem = 0; #if LUA_REFCOUNT GCObject **p = &G(L)->rootudata_head.next; #else !LUA_REFCOUNT GCObject **p = &G(L)->rootudata; #endif LUA_REFCOUNT GCObject *curr; GCObject *collected = NULL; /* to collect udata with gc event */ #if !LUA_REFCOUNT GCObject **lastcollected = &collected; while ((curr = *p) != NULL) { lua_assert(curr->gch.tt == LUA_TUSERDATA); #else LUA_REFCOUNT while ((curr = *p) != (GCObject*)&G(L)->rootudata_tail) { #endif LUA_REFCOUNT if (ismarked(curr) || isfinalized(gcotou(curr))) p = &curr->gch.next; /* don't bother with them */ else if (fasttm(L, gcotou(curr)->uv.metatable, TM_GC) == NULL) { markfinalized(gcotou(curr)); /* don't need finalization */ p = &curr->gch.next; } else { /* must call its gc method */ deadmem += sizeudata(gcotou(curr)->uv.len); *p = curr->gch.next; #if LUA_REFCOUNT Unlink(curr); curr->gch.next = (GCObject*)&G(L)->tmudata_tail; /* link `curr' at the end of `collected' list */ curr->gch.prev = G(L)->tmudata_tail.prev; G(L)->tmudata_tail.prev->gch.next = curr; G(L)->tmudata_tail.prev = curr; #else !LUA_REFCOUNT curr->gch.next = NULL; /* link `curr' at the end of `collected' list */ *lastcollected = curr; lastcollected = &curr->gch.next; #endif LUA_REFCOUNT } } /* insert collected udata with gc event into `tmudata' list */ #if LUA_REFCOUNT // *lastcollected = G(L)->tmudata_head.next; // G(L)->tmudata_head.next = collected; #else !LUA_REFCOUNT *lastcollected = G(L)->tmudata; G(L)->tmudata = collected; #endif LUA_REFCOUNT return deadmem; } static void removekey (lua_State *L, Node *n) { (void)L; setnilvalue(gval(n)); /* remove corresponding value ... */ if (iscollectable(gkey(n))) setttype(gkey(n), LUA_TNONE); /* dead key; remove it */ }