void ComboBox::MouseEventProc(MOUSE_EVENT_RECORD mer) { if (displayList) { if (checkPosition(mer) && mer.dwButtonState == FROM_LEFT_1ST_BUTTON_PRESSED) { CloseList(); return; } string prevChose = optionsList->GetValue(); optionsList->MouseEventProc(mer); string chose = optionsList->GetValue(); if (prevChose != chose) { CloseList(); } chosenText->CleanLabel(); if (chose != "no choose") { chose[0] = '+'; chose[1] = ' '; chose[2] = ' '; } else { chose = "+ "; } chosenText->SwitchContent(chose); } else { if (checkPosition(mer) && mer.dwButtonState == FROM_LEFT_1ST_BUTTON_PRESSED) { OpenList(); } } }
void ComboBox::KeyEventProc(KEY_EVENT_RECORD ker) { if (displayList) { if (ker.wVirtualKeyCode == VK_ESCAPE) { CloseList(); return; } string prevChose = optionsList->GetValue(); optionsList->KeyEventProc(ker); string chose = optionsList->GetValue(); if (prevChose != chose) { CloseList(); } chosenText->CleanLabel(); if (chose != "no choose") { chose[0] = '-'; chose[1] = ' '; chose[2] = ' '; } else { chose = "- "; } chosenText->SwitchContent(chose); } else { if (ker.wVirtualKeyCode == VK_RETURN && displayList) { OpenList(); } } }
int main(int argc, char* argv[]) { char buf[MAX_PATH]; int base_encoding; /* added */ char* p; char* logo = "SjASMPlus Z80 Cross-Assembler v1.08 (build 07-04-2016)"; int i = 1; if (argc == 1) { _COUT logo _ENDL; _COUT "based on code of SjASM by Sjoerd Mastijn / http://www.xl2s.tk /" _ENDL; _COUT "Copyright 2004-2008 by Aprisobal / http://sjasmplus.sf.net / [email protected] /" _ENDL; _COUT "Modified 2016 AntonioVillena" _ENDL; _COUT "\nUsage:\nsjasmplus [options] sourcefile(s)" _ENDL; _COUT "\nOption flags as follows:" _ENDL; _COUT " --help Help information (you see it)" _ENDL; _COUT " -i<path> or -I<path> or --inc=<path>" _ENDL; _COUT " Include path" _ENDL; _COUT " --lst=<filename> Save listing to <filename>" _ENDL; _COUT " --lstlab Enable label table in listing" _ENDL; _COUT " --sym=<filename> Save symbols list to <filename>" _ENDL; _COUT " --exp=<filename> Save exports to <filename> (see EXPORT pseudo-op)" _ENDL; _COUT " --raw=<filename> Save all output to <filename> ignoring OUTPUT pseudo-ops" _ENDL; _COUT " Logging:" _ENDL; _COUT " --nologo Do not show startup message" _ENDL; _COUT " --msg=error Show only error messages" _ENDL; _COUT " --msg=all Show all messages (by default)" _ENDL; _COUT " --fullpath Show full path to error file" _ENDL; _COUT " Other:" _ENDL; _COUT " --reversepop Enable reverse POP order (as in base SjASM version)" _ENDL; _COUT " --dirbol Enable processing directives from the beginning of line" _ENDL; _COUT " --dos866 Encode from Windows codepage to DOS 866 (Cyrillic)" _ENDL; exit(1); } // init vars Options::DestionationFName[0] = 0; Options::ListingFName[0] = 0; Options::UnrealLabelListFName[0] = 0; Options::SymbolListFName[0] = 0; Options::ExportFName[0] = 0; Options::RAWFName[0] = 0; Options::NoDestinationFile = true; // not *.out files by default // start counter long dwStart; dwStart = GetTickCount(); // get current directory GetCurrentDirectory(MAX_PATH, buf); CurrentDirectory = buf; // get arguments Options::IncludeDirsList = new CStringsList(".", Options::IncludeDirsList); while (argv[i]) { Options::GetOptions(argv, i); if (argv[i]) { STRCPY(SourceFNames[SourceFNamesCount++], LINEMAX, argv[i++]); } } if (!Options::HideLogo) { _COUT logo _ENDL; } if (!SourceFNames[0][0]) { _COUT "No inputfile(s)" _ENDL; exit(1); } if (!Options::DestionationFName[0]) { STRCPY(Options::DestionationFName, LINEMAX, SourceFNames[0]); if (!(p = strchr(Options::DestionationFName, '.'))) { p = Options::DestionationFName; } else { *p = 0; } STRCAT(p, LINEMAX-(p-Options::DestionationFName), ".out"); } // init some vars InitCPU(); // if memory type != none base_encoding = ConvertEncoding; // init first pass InitPass(1); // open lists OpenList(); // open source filenames for (i = 0; i < SourceFNamesCount; i++) { OpenFile(SourceFNames[i]); } _COUT "Pass 1 complete (" _CMDL ErrorCount _CMDL " errors)" _ENDL; ConvertEncoding = base_encoding; do { pass++; InitPass(pass); if (pass == LASTPASS) { OpenDest(); } for (i = 0; i < SourceFNamesCount; i++) { OpenFile(SourceFNames[i]); } if (PseudoORG) { CurAddress = adrdisp; PseudoORG = 0; } if (pass != LASTPASS) { _COUT "Pass " _CMDL pass _CMDL " complete (" _CMDL ErrorCount _CMDL " errors)" _ENDL; } else { _COUT "Pass 3 complete" _ENDL; } } while (pass < 3);//MAXPASSES); pass = 9999; /* added for detect end of compiling */ if (Options::AddLabelListing) { LabelTable.Dump(); } Close(); if (Options::UnrealLabelListFName[0]) { LabelTable.DumpForUnreal(); } if (Options::SymbolListFName[0]) { LabelTable.DumpSymbols(); } _COUT "Errors: " _CMDL ErrorCount _CMDL ", warnings: " _CMDL WarningCount _CMDL ", compiled: " _CMDL CompiledCurrentLine _CMDL " lines" _END; double dwCount; dwCount = GetTickCount() - dwStart; if (dwCount < 0) { dwCount = 0; } printf(", work time: %.3f seconds", dwCount / 1000); _COUT "" _ENDL; cout << flush; // free RAM if (Devices) { delete Devices; } return (ErrorCount != 0); }
pair<Cost, Cost> Solver::russianDollSearch(Cluster* c, Cost cub) { TreeDecomposition* td = wcsp->getTreeDec(); pair<Cost, Cost> res = make_pair(MIN_COST, cub); TClusters::iterator it = c->beginSortedEdges(); while (it != c->endSortedEdges()) { russianDollSearch(*it, cub); ++it; } try { Store::store(); Cost nogoodlb = MIN_COST; Cost nogoodub = MAX_COST; if (c != td->getRoot()) { c->deconnectSep(); c->nogoodGet(nogoodlb, nogoodub, &c->open); // update c->open and c->ub // if (nogoodlb == bestub) { // assert(bestub <= cub); // Store::restore(); // return make_pair(bestub,bestub); // } assert(c->getLbRec() == MIN_COST); c->setLb(MIN_COST); wcsp->setLb(MIN_COST); td->setCurrentCluster(td->getRoot()); Cost lbroot = td->getLbRecRDS(); td->setCurrentCluster(c); Cost lbc = td->getLbRecRDS(); cub = cub - lbroot + lbc; cub = MIN(cub, nogoodub); } wcsp->setUb(cub); td->setCurrentCluster(c); td->setRootRDS(c); lastConflictVar = -1; if (ToulBar2::verbose >= 0) cout << "--- Solving cluster subtree " << c->getId() << " ..." << endl; // if(c == td->getRoot()) wcsp->propagate(); // needed if there are connected components enforceUb(); wcsp->propagate(); Cost bestlb = td->getLbRecRDS(); bestlb = MAX(bestlb, nogoodlb); if (bestlb >= cub) THROWCONTRADICTION; res = hybridSolve(c, bestlb, cub); assert(res.first >= bestlb); c->setLbRDS(res.first); // if (c->sepSize() == 0) { c->nogoodRec(res.first, ((res.second < cub) ? res.second : MAX_COST), &c->open); // } if (ToulBar2::debug || ToulBar2::verbose >= 1) c->printStatsRec(); if (ToulBar2::verbose >= 0) cout << "--- done cost = [" << res.first << "," << res.second << "] (" << nbBacktracks << " backtracks, " << nbNodes << " nodes, depth " << Store::getDepth() << ")" << endl << endl; } catch (Contradiction) { wcsp->whenContradiction(); res.first = res.second; c->setLbRDS(cub); // if (c->sepSize() == 0) { c->nogoodRec(cub, MAX_COST, &c->open); // } } Store::restore(); if (c == td->getRoot()) { c->resetLbRec(); } else { if (c->open) *(c->open) = OpenList(); // clear current open list c->resetUbRec(c); } return res; }
void CapASM::Compile(const char * filename) { std::cout << "&Compilation of " << string(filename).c_str() << endl ; char buf[MAX_PATH]; int base_encoding; /* added */ char* p; int i = 1; CleanUP(); // init LUA LUA = lua_open(); lua_atpanic(LUA, (lua_CFunction)LuaFatalError); luaL_openlibs(LUA); luaopen_pack(LUA); tolua_sjasm_open(LUA); // init vars Options::DestionationFName[0] = 0; STRCPY( Options::ListingFName, LINEMAX, "/tmp/caprice.lst"); //TODO generate file name Options::UnrealLabelListFName[0] = 0; STRCPY( Options::SymbolListFName, LINEMAX, "/tmp/caprice.sym"); Options::ExportFName[0] = 0; Options::RAWFName[0] = 0; Options::NoDestinationFile = true; // not *.out files by default // start counter long dwStart; dwStart = GetTickCount(); // get current directory GetCurrentDirectory(MAX_PATH, buf); CurrentDirectory = buf; STRCPY(SourceFNames[SourceFNamesCount++], LINEMAX, filename); if (!SourceFNames[0][0]) { _COUT "No inputfile(s)" _ENDL; return; } if (!Options::DestionationFName[0]) { STRCPY(Options::DestionationFName, LINEMAX, SourceFNames[0]); if (!(p = strchr(Options::DestionationFName, '.'))) { p = Options::DestionationFName; } else { *p = 0; } STRCAT(p, LINEMAX-(p-Options::DestionationFName), ".out"); } // init some vars InitCPU(); // if memory type != none base_encoding = ConvertEncoding; // init first pass InitPass(1); // open lists OpenList(); // open source filenames for (i = 0; i < SourceFNamesCount; i++) { OpenFile(SourceFNames[i]); } _COUT "Pass 1 complete (" _CMDL ErrorCount _CMDL " errors)" _ENDL; ConvertEncoding = base_encoding; do { pass++; InitPass(pass); if (pass == LASTPASS) { OpenDest(); } for (i = 0; i < SourceFNamesCount; i++) { OpenFile(SourceFNames[i]); } if (PseudoORG) { CurAddress = adrdisp; PseudoORG = 0; } if (pass != LASTPASS) { _COUT "Pass " _CMDL pass _CMDL " complete (" _CMDL ErrorCount _CMDL " errors)" _ENDL; } else { _COUT "Pass 3 complete" _ENDL; } } while (pass < 3);//MAXPASSES); pass = 9999; /* added for detect end of compiling */ if (Options::AddLabelListing) { LabelTable.Dump(); } Close(); if (Options::UnrealLabelListFName[0]) { LabelTable.DumpForUnreal(); } if (Options::SymbolListFName[0]) { LabelTable.DumpSymbols(); } _COUT "Errors: " _CMDL ErrorCount _CMDL ", warnings: " _CMDL WarningCount _CMDL ", compiled: " _CMDL CompiledCurrentLine _CMDL " lines" _END; double dwCount; dwCount = GetTickCount() - dwStart; if (dwCount < 0) { dwCount = 0; } printf(", work time: %.3f seconds", dwCount / 1000); _COUT "" _ENDL; #ifndef UNDER_CE cout << flush; #endif // free RAM delete Devices; Devices = 0; // close Lua lua_close(LUA); //return (ErrorCount != 0); }