HOT PyrObject *PyrGC::NewFrame(size_t inNumBytes, long inFlags, long inFormat, bool inAccount) { PyrObject *obj = NULL; #ifdef GC_SANITYCHECK SanityCheck(); #endif // obtain size info int32 alignedSize = (inNumBytes + kAlignMask) & ~kAlignMask; // 16 byte align int32 numSlots = alignedSize / sizeof(PyrSlot); numSlots = numSlots < 1 ? 1 : numSlots; int32 sizeclass = LOG2CEIL(numSlots); sizeclass = sc_min(sizeclass, kNumGCSizeClasses-1); int32 credit = 1L << sizeclass; mAllocTotal += credit; mNumAllocs++; mNumToScan += credit; obj = Allocate(inNumBytes, sizeclass, inAccount); obj->obj_format = inFormat; obj->obj_flags = inFlags; obj->size = 0; obj->classptr = class_frame; obj->gc_color = mWhiteColor; #ifdef GC_SANITYCHECK SanityCheck(); #endif return obj; }
PyrObject *PyrGC::NewFrame(size_t inNumBytes, long inFlags, long inFormat, bool inAccount) { PyrObject *obj = NULL; #if SANITYCHECK SanityCheck(); #endif // obtain size info int32 alignedSize = (inNumBytes + kAlignMask) & ~kAlignMask; // 16 byte align int32 numSlots = alignedSize / sizeof(PyrSlot); numSlots = numSlots < 1 ? 1 : numSlots; int32 sizeclass = LOG2CEIL(numSlots); sizeclass = sc_min(sizeclass, kNumGCSizeClasses-1); int32 credit = 1L << sizeclass; mAllocTotal += credit; mNumAllocs++; if (inAccount) { mNumToScan += credit; if (mNumToScan >= kScanThreshold) { Collect(); } } GCSet *gcs = mSets + sizeclass; obj = (PyrObject*)gcs->mFree; if (!IsMarker(obj)) { // from free list gcs->mFree = obj->next; } else { if (sizeclass > kMaxPoolSet) { SweepBigObjects(); int32 allocSize = sizeof(PyrObjectHdr) + (sizeof(PyrSlot) << sizeclass); obj = (PyrObject*)mPool->Alloc(allocSize); } else { int32 allocSize = sizeof(PyrObjectHdr) + (sizeof(PyrSlot) << sizeclass); obj = (PyrObject*)mNewPool.Alloc(allocSize); } if (!obj) { post("Frame alloc failed. size = %d\n", inNumBytes); MEMFAILED; } DLInsertAfter(&gcs->mWhite, obj); } obj->obj_sizeclass = sizeclass; obj->obj_format = inFormat; obj->obj_flags = inFlags; obj->size = 0; obj->classptr = class_frame; obj->gc_color = mWhiteColor; #if SANITYCHECK SanityCheck(); #endif return obj; }
// Each different input train configuration to Separate is handled similarly void SeparateTestHelper(TrainCar* &train1, const std::string &which_test) { // UNCOMMENT THIS FUNCTION WHEN YOU'RE READY TO TEST SEPARATE std::cout << "============================================================================" << std::endl; std::cout << "SEPARATE TRAINS " << which_test << std::endl; SanityCheck(train1); // record the original IDs for later comparison and statistics calculation std::vector<int> original = RecordIDs(train1); PrintTrain(train1); float speed_original = CalculateSpeed(train1); TrainCar* train2; TrainCar* train3; Separate(train1, train2, train3); assert (train1 == NULL); SanityCheck(train2); SanityCheck(train3); // record the IDs after separation std::vector<int> left = RecordIDs(train2); std::vector<int> right = RecordIDs(train3); // calculate the number of links, unlinks, and train shifts // (all of these counts should be kept small to minimize train yard costs int num_unlinks, num_links, num_shifts; SeparateStatistics(original, left, right, num_unlinks, num_links, num_shifts); std::cout << "Separate Statistics: num unlinks = " << num_unlinks; std::cout << ", num links = " << num_links; std::cout << ", num shifts = " << num_shifts; std::cout << " Total Cost: " << num_unlinks+num_links+num_shifts << std::endl; float speed_left = CalculateSpeed(train2); float speed_right = CalculateSpeed(train3); float left_percent = 100.0 * (speed_original-speed_left) / speed_original; float right_percent = 100.0 * (speed_original-speed_right) / speed_original; if (speed_left < 0.99*speed_original) { assert (speed_right > speed_original); std::cout << "left train is " << std::setprecision(1) << std::fixed << left_percent << "% slower than the original and the right train is " << std::setprecision(1) << std::fixed << -right_percent << "% faster than the original." << std::endl; } else if (speed_right < 0.99*speed_original) { assert (speed_left > speed_original); std::cout << "right train is " << std::setprecision(1) << std::fixed << right_percent << "% slower than the original and the left train is " << std::setprecision(1) << std::fixed << -left_percent << "% faster than the original." << std::endl; } else { std::cout << " left and right train speeds are equal to the original." << std::endl; } PrintTrain(train2); PrintTrain(train3); // cleanup memory usage DeleteAllCars(train2); DeleteAllCars(train3); }
PyrObject *PyrGC::NewFinalizer(ObjFuncPtr finalizeFunc, PyrObject *inObject, bool inCollect) { PyrObject *obj = NULL; #ifdef GC_SANITYCHECK SanityCheck(); #endif // obtain size info int32 sizeclass = 1; int32 credit = 1L << sizeclass; mNumToScan += credit; mAllocTotal += credit; mNumAllocs++; if (inCollect && mNumToScan >= kScanThreshold) { Collect(); } GCSet *gcs = mSets + kFinalizerSet; obj = (PyrObject*)gcs->mFree; if (!IsMarker(obj)) { // from free list gcs->mFree = obj->next; } else { if (sizeclass > kMaxPoolSet) { SweepBigObjects(); int32 allocSize = sizeof(PyrObjectHdr) + (sizeof(PyrSlot) << sizeclass); obj = (PyrObject*)mPool->Alloc(allocSize); } else { int32 allocSize = sizeof(PyrObjectHdr) + (sizeof(PyrSlot) << sizeclass); obj = (PyrObject*)mNewPool.Alloc(allocSize); } if (!obj) { post("Finalizer alloc failed.\n"); MEMFAILED; } DLInsertAfter(&gcs->mWhite, obj); } obj->obj_sizeclass = sizeclass; obj->obj_format = obj_slot; obj->obj_flags = 0; obj->size = 2; obj->classptr = class_finalizer; obj->gc_color = mWhiteColor; SetPtr(obj->slots+0, (void*)finalizeFunc); SetObject(obj->slots+1, inObject); #ifdef GC_SANITYCHECK SanityCheck(); #endif return obj; }
// This function takes a random number generator to create variety in // the freight car weights void ShipFreightHelper(MTRand_int32 &mtrand, int num_engines, int num_cars, int min_speed, int max_cars_per_train) { // UNCOMMENT THIS FUNCTION WHEN YOU'RE READY TO TEST SHIP FREIGHT // create a chain with specified # of engines engines TrainCar* all_engines = NULL; for (int i = 0; i < num_engines; i++) { PushBack(all_engines, TrainCar::MakeEngine()); } // create a chain with specified # of freight cars TrainCar* all_freight = NULL; for (int i = 0; i < num_cars; i++) { // the weight for each car is randomly generated in the range of 30->100 tons int weight = 30 + (mtrand()%15)*5; PushBack(all_freight, TrainCar::MakeFreightCar(weight)); } // rearrange the two structures into a collection of trains // with the specified minimum speed & specified maximum length 12 cars std::vector<TrainCar*> trains = ShipFreight(all_engines, all_freight, min_speed, max_cars_per_train); // when finished, we have either used up all of the engines, or // shipped all the freight (or both!) assert (all_engines == NULL || all_freight == NULL); // print the remaining engines or freight cars if (all_engines != NULL) { std::cout << "Remaining Unused Engines:" << std::endl; SanityCheck(all_engines); PrintTrain(all_engines); } if (all_freight != NULL) { std::cout << "Remaining UnShipped Freight:" << std::endl; SanityCheck(all_freight); PrintTrain(all_freight); } // print the trains std::cout << "Prepared Trains for Shipment:" << std::endl; for (unsigned int i = 0; i < trains.size(); i++) { SanityCheck(trains[i]); PrintTrain(trains[i]); // check that the speed and length rules are followed int total_weight,num_engines,num_freight_cars,num_passenger_cars,num_dining_cars,num_sleeping_cars; TotalWeightAndCountCars(trains[i],total_weight,num_engines,num_freight_cars,num_passenger_cars,num_dining_cars,num_sleeping_cars); int total_cars = num_engines+num_freight_cars+num_passenger_cars+num_dining_cars+num_sleeping_cars; float speed = CalculateSpeed(trains[i]); assert (total_cars <= max_cars_per_train); assert (speed >= min_speed); } // fully delete all TrainCar nodes to prevent memory leaks DeleteAllCars(all_engines); DeleteAllCars(all_freight); for (unsigned int i = 0; i < trains.size(); i++) { DeleteAllCars(trains[i]); } }
void LocalWorkspace::GetParserMacros(wxString& macros) { if(!SanityCheck()) return; macros.Clear(); if(!SanityCheck()) return; wxXmlNode* optsNode = XmlUtils::FindFirstByTagName(m_doc.GetRoot(), wxT("WorkspaceParserMacros")); if(optsNode) { macros = optsNode->GetNodeContent(); macros.Trim().Trim(false); } }
// _Defragment void BlockAllocator::Area::_Defragment() { D(SanityCheck()); //PRINT(("BlockAllocator::Area::_Defragment()\n")); // A trivial strategy for now: Keep the last free block and move the // others so that they can be joined with it. This is done iteratively // by moving the first free block to adjoin to the second one and // coalescing them. A free block is moved by moving the data blocks in // between. TFreeBlock *nextFree = NULL; while (fFirstFree && (nextFree = fFirstFree->GetNextFreeBlock()) != NULL) { Block *prevBlock = fFirstFree->GetPreviousBlock(); Block *nextBlock = fFirstFree->GetNextBlock(); size_t size = fFirstFree->GetSize(); // Used blocks are relatively position independed. We can move them // en bloc and only need to adjust the previous pointer of the first // one. if (!nextBlock->IsFree()) { // move the used blocks size_t chunkSize = (char*)nextFree - (char*)nextBlock; Block *nextFreePrev = nextFree->GetPreviousBlock(); Block *movedBlock = fFirstFree; memmove(movedBlock, nextBlock, chunkSize); movedBlock->SetPreviousBlock(prevBlock); // init the first free block Block *movedNextFreePrev = (Block*)((char*)nextFreePrev - size); fFirstFree = _MakeFreeBlock(movedBlock, chunkSize, movedNextFreePrev, size, true, NULL, nextFree); nextFree->SetPreviousFreeBlock(fFirstFree); // fix the references of the moved blocks for (Block *block = movedBlock; block != fFirstFree; block = block->GetNextBlock()) { block->FixReference(); } } else { // uncoalesced adjoining free block: That should never happen, // since we always coalesce as early as possible. INFORM(("Warning: Found uncoalesced adjoining free blocks!\n")); } // coalesce the first two blocks D(SanityCheck()); _CoalesceWithNext(fFirstFree); D(SanityCheck()); } //D(SanityCheck()); //PRINT(("BlockAllocator::Area::_Defragment() done\n")); }
void OfferAnswer() { CreateOffer(); CreateAnswer(); Negotiate(); SanityCheck(); }
void AppConfig::GSWindowOptions::LoadSave( IniInterface& ini ) { ScopedIniGroup path( ini, L"GSWindow" ); IniEntry( CloseOnEsc ); IniEntry( DefaultToFullscreen ); IniEntry( AlwaysHideMouse ); IniEntry( DisableResizeBorders ); IniEntry( DisableScreenSaver ); IniEntry( WindowSize ); IniEntry( WindowPos ); IniEntry( IsMaximized ); IniEntry( IsFullscreen ); IniEntry( IsToggleFullscreenOnDoubleClick ); static const wxChar* AspectRatioNames[] = { L"Stretch", L"4:3", L"16:9", // WARNING: array must be NULL terminated to compute it size NULL }; ini.EnumEntry( L"AspectRatio", AspectRatio, AspectRatioNames, AspectRatio ); IniEntry( Zoom ); if( ini.IsLoading() ) SanityCheck(); }
PyrGC::PyrGC(VMGlobals *g, AllocPool *inPool, PyrClass *mainProcessClass, long poolSize) { mVMGlobals = g; mPool = inPool; //mCurSet = 0; mNumToScan = 0; mFlips = 0; mCollects = 0; mAllocTotal = 0; mNumAllocs = 0; mScans = 0; mStackScans = 0; mNumPartialScans = 0; mSlotsScanned = 0; mGreyColor = 3<<2; mBlackColor = 2<<2; mWhiteColor = 1<<2; mFreeColor = 0; mRunning = false; mCanSweep = false; mPartialScanObj = NULL; mPartialScanSlot = 0; mGrey.classptr = NULL; mGrey.obj_sizeclass = 0; mGrey.size = 0; mGrey.gc_color = obj_gcmarker; mGrey.prev = &mGrey; mGrey.next = &mGrey; mNumGrey = 0; mNewPool.Init(mPool, poolSize, poolSize, 9000); // initialize treadmills for (int i=0; i<kNumGCSets; ++i) { mSets[i].Init(i); } mProcess = newPyrProcess(g, mainProcessClass); mStack = mProcess->mainThread.uot->stack.uo; ToBlack(mStack); SetNil(&mProcess->mainThread.uot->stack); mNumGrey = 0; ToGrey2(mProcess); g->sp = mStack->slots - 1; g->process = mProcess; mRunning = true; SanityCheck(); //assert(SanityCheck()); }
bool LocalWorkspace::SetFolderColours(const FolderColour::Map_t& vdColours) { // Stored as: // <VirtualFoldersColours> // <VirtualFolder Path=".." Colour=".."/> // ... // </VirtualFoldersColours> if(!SanityCheck()) { return false; } wxXmlNode* root = m_doc.GetRoot(); wxXmlNode* oldOptions = XmlUtils::FindFirstByTagName(root, wxT("VirtualFoldersColours")); if(oldOptions) { root->RemoveChild(oldOptions); wxDELETE(oldOptions); } wxXmlNode* coloursNode = new wxXmlNode(root, wxXML_ELEMENT_NODE, wxT("VirtualFoldersColours")); root->AddChild(coloursNode); FolderColour::List_t coloursList; FolderColour::SortToList(vdColours, coloursList); std::for_each(coloursList.begin(), coloursList.end(), [&](const FolderColour& vdc) { wxXmlNode* folderNode = new wxXmlNode(NULL, wxXML_ELEMENT_NODE, wxT("VirtualFolder")); folderNode->AddAttribute("Path", vdc.GetPath()); folderNode->AddAttribute("Colour", vdc.GetColour().GetAsString(wxC2S_HTML_SYNTAX)); coloursNode->AddChild(folderNode); }); return SaveXmlFile(); }
void dgCollisionDeformableMesh::ImproveTotalFitness() { dgInt32 count = m_nodesCount - m_trianglesCount; dgInt32 maxPasses = 2 * dgExp2 (count) + 1; dgDeformableNode* const nodes = &m_nodesMemory[m_trianglesCount]; dgFloat64 newCost = dgFloat32 (1.0e20f); dgFloat64 prevCost = newCost; do { prevCost = newCost; for (dgInt32 i = 0; i < count; i ++) { dgDeformableNode* const node = &nodes[i]; ImproveNodeFitness (node); } newCost = dgFloat32 (0.0f); for (dgInt32 i = 0; i < count; i ++) { const dgDeformableNode* const node = &nodes[i]; newCost += node->m_surfaceArea; } maxPasses --; } while (maxPasses && (newCost < (prevCost * dgFloat32 (0.9f)))); dgAssert (SanityCheck()); }
size_t LocalWorkspace::GetParserFlags() { if(!SanityCheck()) return 0; wxXmlNode* node = XmlUtils::FindFirstByTagName(m_doc.GetRoot(), wxT("WorkspaceParserFlags")); if(node) { return XmlUtils::ReadLong(node, "flags", 0); } return 0; }
wxString LocalWorkspace::GetActiveEnvironmentSet() { if(!SanityCheck()) return wxT(""); wxXmlNode* envNode = XmlUtils::FindFirstByTagName(m_doc.GetRoot(), wxT("Environment")); wxString setName; if(envNode) { setName = envNode->GetPropVal(wxT("Name"), wxT("")); } return setName; }
void LocalWorkspace::SetParserFlags(size_t flags) { if(!SanityCheck()) return; wxXmlNode* node = XmlUtils::FindFirstByTagName(m_doc.GetRoot(), wxT("WorkspaceParserFlags")); if(!node) { node = new wxXmlNode(m_doc.GetRoot(), wxXML_ELEMENT_NODE, wxT("WorkspaceParserFlags")); } XmlUtils::UpdateProperty(node, "flags", wxString() << flags); SaveXmlFile(); }
void PyrGC::Flip() { #ifdef GC_SANITYCHECK SanityCheck(); #endif ScanFinalizers(); GCSet *gcs = mSets; if ((mFlips & 3) == 0) { // major flip for (int i=0; i<kNumGCSets; ++i, ++gcs) { gcs->MajorFlip(); } // advance colors mBlackColor += 4; mWhiteColor += 4; mGreyColor += 4; mFreeColor += 4; } else { // minor flip for (int i=0; i<kNumGCSets; ++i, ++gcs) { gcs->MinorFlip(); } } // move root to grey area mNumGrey = 0; ToGrey2(mProcess); ToBlack(mStack); // reset counts mNumToScan = 0; mCanSweep = true; mFlips++; //post("flips %d collects %d nalloc %d alloc %d grey %d\n", mFlips, mCollects, mNumAllocs, mAllocTotal, mNumGrey); #ifdef GC_SANITYCHECK SanityCheck(); #endif }
void LocalWorkspace::GetSearchInFilesMask(wxString& findInFileMask, const wxString& defaultValue) { findInFileMask.Clear(); findInFileMask = defaultValue; if(!SanityCheck()) return; wxXmlNode* optsNode = XmlUtils::FindFirstByTagName(m_doc.GetRoot(), wxT("FindInFilesMask")); if(optsNode) { findInFileMask = optsNode->GetNodeContent(); findInFileMask.Trim().Trim(false); } }
wxString LocalWorkspace::GetCustomData(const wxString& name) { if(!SanityCheck()) return wxEmptyString; wxXmlNode* customNode = XmlUtils::FindFirstByTagName(m_doc.GetRoot(), name); if(customNode) { wxString data = customNode->GetNodeContent(); data.Trim().Trim(false); return data; } return wxEmptyString; }
void MxHeap::update(MxHeapable *t, float v) { SanityCheck( t->is_in_heap() ); t->heap_key(v); unsigned int i = t->get_heap_pos(); if( i>0 && v>ref(parent(i))->heap_key() ) upheap(i); else downheap(i); }
void LocalWorkspace::SetActiveEnvironmentSet(const wxString& setName) { if(!SanityCheck()) return; wxXmlNode* envNode = XmlUtils::FindFirstByTagName(m_doc.GetRoot(), wxT("Environment")); if(envNode) { m_doc.GetRoot()->RemoveChild(envNode); delete envNode; } envNode = new wxXmlNode(m_doc.GetRoot(), wxXML_ELEMENT_NODE, wxT("Environment")); envNode->AddProperty(wxT("Name"), setName); SaveXmlFile(); }
void LocalWorkspace::SetSearchInFilesMask(const wxString& findInFileMask) { if(!SanityCheck()) return; wxXmlNode* optsNode = XmlUtils::FindFirstByTagName(m_doc.GetRoot(), wxT("FindInFilesMask")); if(optsNode) { m_doc.GetRoot()->RemoveChild(optsNode); wxDELETE(optsNode); } optsNode = new wxXmlNode(NULL, wxXML_ELEMENT_NODE, wxT("FindInFilesMask")); m_doc.GetRoot()->AddChild(optsNode); SetCDATANodeContent(optsNode, findInFileMask); }
void LocalWorkspace::SetCustomData(const wxString& name, const wxString& value) { if(!SanityCheck()) return; wxXmlNode* customNode = XmlUtils::FindFirstByTagName(m_doc.GetRoot(), name); if(customNode) { m_doc.GetRoot()->RemoveChild(customNode); delete customNode; } customNode = new wxXmlNode(NULL, wxXML_ELEMENT_NODE, name); m_doc.GetRoot()->AddChild(customNode); SetCDATANodeContent(customNode, value); }
void LocalWorkspace::SetParserMacros(const wxString& macros) { if(!SanityCheck()) return; wxXmlNode* optsNode = XmlUtils::FindFirstByTagName(m_doc.GetRoot(), wxT("WorkspaceParserMacros")); if(optsNode) { m_doc.GetRoot()->RemoveChild(optsNode); delete optsNode; } optsNode = new wxXmlNode(NULL, wxXML_ELEMENT_NODE, wxT("WorkspaceParserMacros")); m_doc.GetRoot()->AddChild(optsNode); SetCDATANodeContent(optsNode, macros); }
// FreeBlock void BlockAllocator::Area::FreeBlock(Block *block, bool dontDefragment) { if (block) { // mark the block free and insert it into the free list block->SetFree(true); TFreeBlock *freeBlock = (TFreeBlock*)block; _InsertFreeBlock(freeBlock); fUsedBlockCount--; if (fFreeBlockCount == 1) fFreeBytes += freeBlock->GetUsableSize(); else fFreeBytes += freeBlock->GetSize(); // try coalescing with the next and the previous free block D(SanityCheck()); _CoalesceWithNext(freeBlock); D(SanityCheck()); _CoalesceWithNext(freeBlock->GetPreviousFreeBlock()); // defragment, if sensible if (!dontDefragment && _DefragmentingRecommended()) _Defragment(); D(SanityCheck()); } }
size_t LocalWorkspace::GetPinnedProjects(wxArrayString& projects) { projects.clear(); if(!SanityCheck()) { return 0; } wxXmlNode* node = XmlUtils::FindFirstByTagName(m_doc.GetRoot(), "PinnedProjects"); if(!node) return 0; // Read all projects wxXmlNode* child = node->GetChildren(); while(child) { if(child->GetName() == "Project") { projects.Add(child->GetAttribute("Name")); } child = child->GetNext(); } return projects.size(); }
void LocalWorkspace::GetOptions(OptionsConfigPtr options, const wxString& projectname) { // First, a SanityCheck(). This protects against a change of workspace, and calls Create() if needed if(!SanityCheck()) { return; } // Get any workspace-wide preferences, then any project ones wxXmlNode* lwsnode = GetLocalWorkspaceOptionsNode(); if(lwsnode) { // Any local workspace options will replace the global ones inside 'options' LocalOptionsConfig wsOC(options, lwsnode); } wxXmlNode* lpnode = GetLocalProjectOptionsNode(projectname); if(lpnode) { LocalOptionsConfig pOC(options, lpnode); } // This space intentionally left blank :p Maybe, one day there'll be individual-editor options too }
bool LocalWorkspace::SetWorkspaceOptions(LocalOptionsConfigPtr opts) { // Stored as: // <Workspace> // <LocalWorkspaceOptions something="on" something_else="off"/> // </Workspace> if(!SanityCheck()) { return false; } wxXmlNode* oldOptions = GetLocalWorkspaceOptionsNode(); if(oldOptions) { m_doc.GetRoot()->RemoveChild(oldOptions); delete oldOptions; } m_doc.GetRoot()->AddChild(opts->ToXml(NULL, wxT("LocalWorkspaceOptions"))); return SaveXmlFile(); }
HOT void PyrGC::Collect() { BEGINPAUSE bool stackScanned = false; mCollects++; #ifdef GC_SANITYCHECK SanityCheck(); #endif if (mNumToScan > 0) { //post("->Collect ns %d ng %d s %d\n", mNumToScan, mNumGrey, mScans); //DumpInfo(); mNumToScan += mNumToScan >> 3; //post("->Collect2 ns %d ng %d s %d\n", mNumToScan, mNumGrey, mScans); //mCurSet = 0; while (mNumToScan > 0) { while (mNumToScan > 0 && (mNumGrey > 0 || mPartialScanObj)) { if (mPartialScanObj) { DoPartialScan(ScanSize(mPartialScanObj)); } else { if (!ScanOneObj()) break; } } if (mNumGrey == 0 && mPartialScanObj == NULL) { if (!stackScanned) { stackScanned = true; mStackScans++; ScanStack(); ScanFrames(); } if (mNumGrey == 0 && mPartialScanObj == NULL && stackScanned) { Flip(); break; } } } //post("<-Collect ns %d ng %d s %d\n", mNumToScan, mNumGrey, mScans); //DumpInfo(); //post("size9:\n"); //TraceAnyPathToObjsOfSize(9); //post("greys:\n"); //TraceAnyPathToAllGrey(); }
int main( int argc, char *argv[] ) { test_handle_args( argc, argv ); test_init(); /* Setup. */ FILEMAN->Mount( "TEST", ".", "/test" ); SanityCheck(); IniTest(); MsdTest(); CryptoTest(); test_deinit(); exit(0); }
bool LocalWorkspace::SetPinnedProjects(const wxArrayString& projects) { if(!SanityCheck()) { return false; } wxXmlNode* root = m_doc.GetRoot(); wxXmlNode* node = XmlUtils::FindFirstByTagName(root, wxT("PinnedProjects")); if(node) { root->RemoveChild(node); wxDELETE(node); } node = new wxXmlNode(root, wxXML_ELEMENT_NODE, wxT("PinnedProjects")); root->AddChild(node); for(const wxString& project : projects) { wxXmlNode* p = new wxXmlNode(NULL, wxXML_ELEMENT_NODE, wxT("Project")); p->AddAttribute("Name", project); node->AddChild(p); } return SaveXmlFile(); }