int EList::ExecCommand(int Command, ExState &State) { int W = 1; int H = 1; if (View && View->MView && View->MView->Win) { View->MView->ConQuerySize(&W, &H); H--; } FixPos(); switch (Command) { case ExMoveLeft: return MoveLeft(); case ExMoveRight: return MoveRight(); case ExMoveUp: return MoveUp(); case ExMoveDown: return MoveDown(); case ExMovePageUp: return MovePageUp(); case ExMovePageDown: return MovePageDown(); case ExScrollLeft: return ScrollLeft(8); case ExScrollRight: return ScrollRight(8); case ExMovePageStart: return MovePageStart(); case ExMovePageEnd: return MovePageEnd(); case ExMoveFileStart: return MoveFileStart(); case ExMoveFileEnd: return MoveFileEnd(); case ExMoveLineStart: return MoveLineStart(); case ExMoveLineEnd: return MoveLineEnd(); case ExRescan: RescanList(); return ErOK; case ExActivate: return Activate(); case ExListMark: return Mark(); case ExListUnmark: return Unmark(); case ExListToggleMark: return ToggleMark(); case ExListMarkAll: return MarkAll(); case ExListUnmarkAll: return UnmarkAll(); case ExListToggleMarkAll: return ToggleMarkAll(); } return EModel::ExecCommand(Command, State); }
void Registry::GarbageCollect() { // unmark all objects MarkAll(false); // mark everything that is reachable from the root Mark(root, true); // everything that is not now marked is not reachable and can be deleted deathrow.clear(); foreach (Instances::value_type const &val, instances) { StorageBase const *base = val.second; if (!base->IsMarked()) { //OM_TRACE_1(4, base->GetHandle().value) << " adding to deathrow"; deathrow.push_back(base->GetHandle()); } }
void CollectGarbage(VM* vm) { if(vm->debug) printf("collecting garbage...\n"); int numObjects = vm->numObjects; MarkAll(vm); if(vm->debug) printf("marked all objects\n"); Sweep(vm); if(vm->debug) printf("cleaned objects\n"); vm->maxObjectsUntilGc = vm->numObjects * 2 + vm->numGlobals; if(vm->debug) { printf("objects before collection: %i\n" "objects after collection: %i\n", numObjects, vm->numObjects); } }
void Registry::MarkAll(StorageBase &root, bool marked) { MarkObject(root, marked); const Dictionary &dict = root.GetDictionary(); Dictionary::const_iterator C = dict.begin(), D = dict.end(); for (; C != D; ++C) { Object const &child = C->second; StorageBase *base = GetStorageBase(child.GetHandle()); if (base == 0) continue; if (base->IsManaged()) MarkObject(*base, marked); if (base->GetSwitches() & IObject::NoRecurse) continue; MarkAll(*base, marked); } }
/* enlist the current directory. */ F FEnlDir( register AD *pad ) { F fOk; CheckForBreak(); if (!FLoadStatus(pad, lckAll, flsExtraEd)) { Warn("not yet enlisted in %&P/C, enlist again later\n", pad); return fTrue; /* keep trying other dirs */ } if (pad->iedCur != iedNil) { Warn("directory %!&/U/Q already enlisted in %&P/C\n", pad, pad); FlushStatus(pad); return fTrue; } OpenLog(pad, fTrue); AddCurEd(pad, (pad->flags&flagGhost) != 0); FUpdateIedCache(pad->iedCur, pad); if (pad->flags&flagSyncFiles) MarkAll(pad); else MarkAllDirOnly(pad); fOk = FSyncMarked(pad, NULL); CloseLog(); FlushStatus(pad); return fOk; }
void Registry::Mark(Object root) { // now mark everything that is reachable from the given object root if (root.Exists()) MarkAll(root.GetStorageBase(), true); }