void Ide::BuildAndDebug0(const String& srcfile) { if(Build()) { One<Host> h = CreateHostRunDir(); h->ChDir(GetFileFolder(target)); VectorMap<String, String> bm = GetMethodVars(method); String dbg = bm.Get("DEBUGGER", Null); if(IsNull(dbg)) { if(bm.Get("BUILDER", Null) == "MSC71") { String sln = ForceExt(target, ".sln"); if(GetFileLength(sln) > 0) h->Launch("devenv \"" + h->GetHostPath(sln) + "\" " // + "\"" + h->GetHostPath(srcfile) + "\"" //TRC, 2011/09/26: wrong devenv argument ); else h->Launch("devenv \"" + h->GetHostPath(target) //+ "\" \"" + h->GetHostPath(srcfile) //TRC, 2011/09/26: wrong devenv argument + "\" /debugexe " ); return; } dbg = "gdb"; } else h->Launch('\"' + dbg + "\" \"" // + h->GetHostPath(srcfile) + ' ' + h->GetHostPath(target) + "\"", true); } }
One<Builder> MakeBuild::CreateBuilder(Host *host) { SetupDefaultMethod(); VectorMap<String, String> bm = GetMethodVars(method); String builder = bm.Get("BUILDER", "GCC"); int q = BuilderMap().Find(builder); if(q < 0) { PutConsole("Invalid builder " + builder); ConsoleShow(); return NULL; } One<Builder> b = (*BuilderMap().Get(builder))(); b->host = host; b->compiler = bm.Get("COMPILER", ""); b->include = SplitDirs(GetVar("UPP") + ';' + bm.Get("INCLUDE", "") + ';' + add_includes); const Workspace& wspc = GetIdeWorkspace(); for(int i = 0; i < wspc.GetCount(); i++) { const Package& pkg = wspc.GetPackage(i); for(int j = 0; j < pkg.include.GetCount(); j++) b->include.Add(SourcePath(wspc[i], pkg.include[j].text)); } b->libpath = SplitDirs(bm.Get("LIB", "")); b->debug_options = bm.Get("DEBUG_OPTIONS", ""); b->release_options = bm.Get("RELEASE_OPTIONS", ""); b->release_size_options = bm.Get("RELEASE_SIZE_OPTIONS", ""); b->debug_link = bm.Get("DEBUG_LINK", ""); b->release_link = bm.Get("RELEASE_LINK", ""); b->script = bm.Get("SCRIPT", ""); b->main_conf = !!main_conf.GetCount(); return b; }
void defList::Load(String filePath) { Clear() ; path = filePath ; name = GetFileTitle(path) ; VectorMap<String,String> ini = LoadIniFile(path) ; fields = Split(ini.Get("fields", ""), ',' ) ; CSVParser csv ; for( int i=0; true; i++) { String s = ini.Get("data_" + AsString(i), "") ; if (s.IsEmpty()) break ; data.Add(csv.ParseLine(s, fields.GetCount()) ) ; } for (int i=0; true; i++) { String s = ini.Get("error_" + AsString(i), "") ; if (s.IsEmpty()) break ; errors.Add(s) ; } // guardamos este como último cargado theCfg.lastList = path ; theCfg.Save() ; }
void OutMode::Preset() { int q = ide.recent_buildmode.Find(~method); SyncLock(); if(q < 0) { VectorMap<String, String> map = GetMethodVars(~method); debug.linkmode = atoi(map.Get("DEBUG_LINKMODE", "0")); debug.debug = atoi(map.Get("DEBUG_INFO", "0")); debug.blitz = MapFlag(map, "DEBUG_BLITZ"); release.linkmode = atoi(map.Get("RELEASE_LINKMODE", "0")); release.debug <<= 0; release.blitz = MapFlag(map, "RELEASE_BLITZ"); } else { StringStream ss(ide.recent_buildmode[q]); TargetMode x; String dummy; int m; ss / m; ss % dummy; ss / m; mode = !!m; ss % x; debug.Load(x); ss % x; release.Load(x); } }
void defMsg::Load( String filePath ) { Clear() ; path = filePath ; name = GetFileTitle(path) ; VectorMap<String,String> ini = LoadIniFile(path) ; from = ini.Get("from") ; subject = ini.Get("subject") ; String s ; for (int i = 0; true; i++) { s = ini.Get("body" + AsString(i), "") ; if (s.IsEmpty()) break ; qtfBody += s + "\r\n" ; } // guardamos este como último cargado theCfg.lastMsg = path ; theCfg.Save() ; }
Index<String> MakeBuild::PackageConfig(const Workspace& wspc, int package, const VectorMap<String, String>& bm, String mainparam, Host& host, Builder& b, String *target) { String packagepath = PackagePath(wspc[package]); const Package& pkg = wspc.package[package]; Index<String> cfg; mainparam << ' ' << bm.Get(targetmode ? "RELEASE_FLAGS" : "DEBUG_FLAGS", NULL); cfg = SplitFlags(mainparam, package == 0, wspc.GetAllAccepts(package)); cfg.FindAdd(bm.Get("BUILDER", "GCC")); const TargetMode& m = GetTargetMode(); if(targetmode == 0) cfg.FindAdd("DEBUG"); switch(m.linkmode) { case 2: cfg.FindAdd("SO"); case 1: cfg.FindAdd("SHARED"); } if(targetmode == 2) cfg.FindAdd("FORCE_SPEED"); if(targetmode == 3) cfg.FindAdd("FORCE_SIZE"); int q = m.package.Find(wspc[package]); if(q >= 0) { const PackageMode& p = m.package[q]; switch(p.debug >= 0 ? p.debug : m.def.debug) { case 1: cfg.FindAdd("DEBUG_MINIMAL"); break; case 2: cfg.FindAdd("DEBUG_FULL"); break; } if(!pkg.noblitz && (p.blitz >= 0 ? p.blitz : m.def.blitz)) cfg.FindAdd("BLITZ"); } else { switch(m.def.debug) { case 1: cfg.FindAdd("DEBUG_MINIMAL"); break; case 2: cfg.FindAdd("DEBUG_FULL"); break; } if(!pkg.noblitz && m.def.blitz) cfg.FindAdd("BLITZ"); } host.AddFlags(cfg); b.AddFlags(cfg); for(int i = 0; i < pkg.flag.GetCount(); i++) { if(MatchWhen(pkg.flag[i].when, cfg.GetKeys())) cfg.Add(pkg.flag[i].text); } if(target) *target = Gather(pkg.target, cfg.GetKeys(), true); return cfg; }
void benchmark_VectorMap(const Vector<T>& key, const Vector<T>& fkey, int count) { StopTime(); cout << count << " items\n"; { int i; VectorMap<T, int> map; StopTime(); for(i = 0; i < count; i++) map.Add(key[i], i); cout << "Adding done in " << StopTime() << " s\n"; for(int j = 0; j < 2; j++) { for(i = 0; i < count; i++) if(map.Get(fkey[i]) != i) { cout << "ERROR !\n"; abort(); } cout << "Search done in " << StopTime() << " s\n"; } for(i = 0; i < count; i++) map.UnlinkKey(key[i]); cout << "Unlinking done in " << StopTime() << " s\n"; for(i = 0; i < count; i++) map.Put(key[i], i); cout << "Putting done in " << StopTime() << " s\n"; } }
String MakeBuild::OutDir(const Index<String>& cfg, const String& package, const VectorMap<String, String>& bm, bool use_target) { Index<String> excl; excl.Add(bm.Get("BUILDER", "GCC")); excl.Add("MSC"); LocalHost().AddFlags(excl); Vector<String> x; bool dbg = cfg.Find("DEBUG_FULL") >= 0 || cfg.Find("DEBUG_MINIMAL") >= 0; if(cfg.Find("DEBUG") >= 0) { excl.Add("BLITZ"); if(cfg.Find("BLITZ") < 0) x.Add("NOBLITZ"); } else if(dbg) x.Add("RELEASE"); if(use_target) excl.Add("MAIN"); for(int i = 0; i < cfg.GetCount(); i++) if(excl.Find(cfg[i]) < 0) x.Add(cfg[i]); Sort(x); for(int i = 0; i < x.GetCount(); i++) x[i] = InitCaps(x[i]); String outdir = GetVar("OUTPUT"); if(output_per_assembly) outdir = AppendFileName(outdir, GetVarsName()); if(!use_target) outdir = AppendFileName(outdir, package); outdir = AppendFileName(outdir, GetFileTitle(method) + "." + Join(x, ".")); outdir = Filter(outdir, CharFilterSlash); return outdir; }
// do setup work here Options::Options() { CtrlLayout(*this,"Options"); Icon(OptionsImg::Options()); // set callback for the save button btnSave <<= THISBACK(onbtnSave); // get the values from the config file VectorMap<String, String> cfg = LoadIniFile(cfgfile); int dontsplash = ScanInt(cfg.Get("Splash", Null)); int savewinpos = ScanInt(cfg.Get("SaveWinPos", Null)); // set option controls with current value from config file optSplash = dontsplash; optSaveWinPos = savewinpos; }
void Ide::BuildAndDebug(bool runto) { VectorMap<String, String> bm = GetMethodVars(method); String builder = bm.Get("BUILDER", ""); if(!Build()) return; if(!FileExists(target)) return; if(designer) EditAsText(); One<Host> host = CreateHostRunDir(); host->ChDir(Nvl(rundir, GetFileFolder(target))); HideBottom(); editor.Disable(); #ifdef COMPILER_MSC if(builder == "GCC") if(gdbSelector) debugger = Gdb_MI2Create(host, target, runarg); else debugger = GdbCreate(host, target, runarg); else debugger = PdbCreate(host, target, runarg); #else if(gdbSelector) debugger = Gdb_MI2Create(host, target, runarg); else debugger = GdbCreate(host, target, runarg); #endif if(!debugger) return; debuglock = 0; const Workspace& wspc = IdeWorkspace(); for(int i = 0; i < wspc.GetCount(); i++) { const Package& pk = wspc.GetPackage(i); String n = wspc[i]; for(int i = 0; i < pk.file.GetCount(); i++) { String file = SourcePath(n, pk.file[i]); LineInfo& ln = Filedata(file).lineinfo; for(int i = 0; i < ln.GetCount(); i++) { LineInfoRecord& lr = ln[i]; if(!lr.breakpoint.IsEmpty()) if(!debugger->SetBreakpoint(file, lr.lineno, lr.breakpoint)) { lr.breakpoint = "\xe"; if(PathIsEqual(file, editfile)) editor.SetBreakpoint(lr.lineno, "\xe"); } } } } SetBar(); editor.Enable(); if(runto) { if(!debugger->RunTo()) IdeEndDebug(); } else debugger->Run(); }
void Ide::SetupDefaultMethod() { if(IsNull(method)) { SetMethod(GetDefaultMethod()); if(IsNull(method)) { FindFile ff(ConfigFile("*.bm")); if(!ff) return; SetMethod(GetFileTitle(ff.GetName())); } VectorMap<String, String> map = GetMethodVars(method); debug.linkmode = atoi(map.Get("DEBUG_LINKMODE", "0")); debug.def.debug = atoi(map.Get("DEBUG_INFO", "0")); debug.def.blitz = MapFlag(map, "DEBUG_BLITZ"); release.linkmode = atoi(map.Get("RELEASE_LINKMODE", "0")); release.def.debug <<= 0; release.def.blitz = MapFlag(map, "RELEASE_BLITZ"); } }
void GoogleTranslatorDemo::MenuSetLanguageTo(Bar& currentBar, VectorMap<String, String> &cur_parameter) { bool need_translate = (cur_parameter.Get("NeedTranslate") == "TRUE"); String language_from = cur_parameter.Get("LanguageFrom"); String lang_to = outputwindow.tolanguagectrl.GetKey(outputwindow.tolanguagectrl.GetIndex()); String cur_lang_key; for(int i = 0; i < languageslist.GetCount(); ++i) { cur_lang_key = languageslist.GetKey(i); if(cur_lang_key != language_from) { if(cur_lang_key == lang_to) currentBar.Add(languageslist[i], GoogleTranslatorDemoImg::CurrentLang(), THISBACK3(SetLanguageFromToPos, language_from, cur_lang_key, need_translate)); else if (cur_lang_key == languageto) currentBar.Add(languageslist[i], GoogleTranslatorDemoImg::CurrentTranslatedLang(), THISBACK3(SetLanguageFromToPos, language_from, cur_lang_key, need_translate)); else currentBar.Add(languageslist[i], THISBACK3(SetLanguageFromToPos, language_from, cur_lang_key, need_translate)); } } }
G_obj *Get(G_obj *(*widget)()) { static VectorMap<uintptr_t, G_obj *> wmap; G_obj *w = wmap.Get((uintptr_t)widget, NULL); if(!w) { w = (*widget)(); if(GTK().gtk_widget_get_parent(w) == NULL) Setup(w); wmap.Add((uintptr_t)widget, w); } return w; }
void ForceSchemaUpdate(SqlId table, Fields nf, Fields of, SqlId key, const Value& keyval, Sql& cursor) { String tbl; VectorMap<Id, Value> nmap = GetValueMap(nf, &tbl); VectorMap<Id, Value> omap = GetValueMap(of); SqlUpdate update(SqlId(SchemaTableName(Nvl(~table, tbl)))); for(int i = 0; i < nmap.GetCount(); i++) if(nmap[i] != omap.Get(nmap.GetKey(i), Value())) update(SqlId(nmap.GetKey(i)), nmap[i]); if(update) update.Where(key == keyval).Force(cursor); }
void bigMailerCfg::Load() { VectorMap<String, String> ini = LoadIniFile(ConfigFile("bigmailer.ini")) ; lastList = ini.Get("lastList", "") ; lastMsg = ini.Get("lastMsg", "" ) ; smtpServer = ini.Get("smtpServer", "" ) ; user = ini.Get("user", "" ) ; pass = ini.Get("pass", "" ) ; String s ; blackList.Clear() ; for (int i = 0; true; i++) { s = ini.Get("blacklist_" + AsString(i), Null) ; if (s.IsEmpty()) break ; blackList.Add(s) ; } }
Atom XAtom(const char *name) { GuiLock __; Atom x; INTERLOCKED { static VectorMap<String, int> atoms; int q = atoms.Get(name, Null); if(IsNull(q)) { q = XAtomRaw(name); atoms.Add(name, q); } x = q; } return x; }
Vector<String> Cuprep(const String& m, const VectorMap<String, String>& mac, const Vector<String>& inc) { String r; String q = Filter(m, CasFilter); const char *s = q; while(*s) if(*s == '$') { String v; s++; if(*s == '$') { r.Cat('$'); s++; } else if(*s == '(') { s++; bool pinc = false; if(*s == '!') { pinc = true; s++; } for(;;) { if(*s == ')') { s++; break; } if(*s == '\0') break; v.Cat(*s++); } if(pinc) for(int i = 0; i < inc.GetCount(); i++) if(inc[i].Find(' ')) r << v << '"' << inc[i] << "\" "; else r << v << inc[i] << ' '; else r.Cat(mac.Get(v, Null)); } else r.Cat('$'); } else r.Cat(*s++); return Split(r, CharFilterEol); }
virtual bool operator()(int pos, const RichPara& para) { for(int i = 0; i < para.GetCount(); i++) { String l = para[i].format.link; if(!IsNull(l)) { if(l[0] == ':') { int q = reflink->Find(l); int w = q; if(q < 0) q = reflink->Find(l + "::class"); if(q < 0) q = reflink->Find(l + "::struct"); if(q < 0) q = reflink->Find(l + "::union"); if(q >= 0) l = (*reflink)[q]; } link.FindAdd(Nvl(reflink->Get(l, Null), l)); } } return false; }
void Ide::DoDirDiff() { Index<String> dir; Vector<String> d = GetUppDirs(); for(int i = 0; i < d.GetCount(); i++) dir.FindAdd(d[i]); FindFile ff(ConfigFile("*.bm")); while(ff) { VectorMap<String, String> var; LoadVarFile(ff.GetPath(), var); Vector<String> p = Split(var.Get("UPP", String()), ';'); for(int i = 0; i < p.GetCount(); i++) dir.FindAdd(p[i]); ff.Next(); } String n = GetFileFolder(editfile); if(n.GetCount()) dir.FindAdd(n); SortIndex(dir); static DirDiffDlg dlg; dlg.diff.WhenLeftLine = THISBACK1(GotoDirDiffLeft, &dlg); dlg.diff.WhenRightLine = THISBACK1(GotoDirDiffRight, &dlg); for(int i = 0; i < dir.GetCount(); i++) { dlg.Dir1AddList(dir[i]); dlg.Dir2AddList(dir[i]); } if(d.GetCount()) dlg.Dir1(d[0]); if(!dlg.IsOpen()) { dlg.SetFont(veditorfont); dlg.Maximize(); dlg.Title("Compare directories"); dlg.OpenMain(); } else dlg.SetFocus(); }
One<Host> MakeBuild::CreateHost(bool sync_files) { SetupDefaultMethod(); VectorMap<String, String> bm = GetMethodVars(method); One<Host> outhost; { One<LocalHost> host = new LocalHost; VectorMap<String, String> env(Environment(), 1); host->exedirs = SplitDirs(bm.Get("PATH", "") + ';' + env.Get("PATH", "")); env.GetAdd("PATH") = Join(host->exedirs, ";"); env.GetAdd("UPP_MAIN__") = GetFileDirectory(PackagePath(GetMain())); env.GetAdd("UPP_ASSEMBLY__") = GetVar("UPP"); for(int i = 0; i < env.GetCount(); i++) { LDUMP(env.GetKey(i)); LDUMP(env[i]); host->environment << env.GetKey(i) << '=' << env[i] << '\0'; } host->environment.Cat(0); host->cmdout = &cmdout; outhost = -host; } return outhost; }
void bigmailer::onSend() { const String enter = "\r\n" ; if (messagePage.editor.IsModified()) messagePage.Save() ; // mapa de los campos VectorMap<String, int> fldMap ; for (int i = 0; i < theDefList.fields.GetCount(); i++) fldMap.Add(theDefList.fields[i], i) ; String outHTML ; Index<String> css ; VectorMap<String, String> links ; String path = "./" ; String html = EncodeHtml(messagePage.editor.Get(), css, links, path ) ; outHTML << "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\r\n" "<html>\r\n" "<head>\r\n" "<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">\r\n" "<style>\r\n" << AsCss( css ) << "\r\n" << "</style>\r\n" "</head>\r\n" "<body>\r\n" << html << "\r\n" << "</body>\r\n" "</html>\r\n" ; Progress prog ; prog.Set(0, theDefList.data.GetCount()) ; prog.Show() ; theDefList.errors.Clear() ; String theHtml ; for (int row = 0; row < theDefList.data.GetCount(); row++) { String addrTo = theDefList.data[row][1] ; if (addrTo.IsEmpty()) { theDefList.errors.Add(t_("dirección incorrecta")) ; continue ; } if (prog.Canceled()) break ; theHtml = outHTML ; String s = AsString(row+1) + " / " + AsString( theDefList.data.GetCount() ) ; prog.SetText(s) ; for (int i = 0; i < theDefList.fields.GetCount(); i++) { String toFind = "[%" + theDefList.fields[i] + "%]" ; int from = 0 ; while( (from = theHtml.Find(toFind, from )) != -1) { theHtml.Remove( from, toFind.GetCount() ) ; theHtml.Insert( from, theDefList.data[row][ fldMap.Get(theDefList.fields[i])] ) ; } } prog.SetPos(row+1) ; SmtpMailEx mail ; mail.Host( theCfg.smtpServer ) .User( theCfg.user ) .Password( theCfg.pass ) .From( theMsg.from ) .ReplyTo( theMsg.from ) .To( addrTo ) .Subject( theMsg.subject ) .Text( "" ) .Attach("MENSAJE", theHtml, "text/html; charset=utf-8") ; if ( ! mail.Send() ) theDefList.errors.Add(mail.GetError()) ; else theDefList.errors.Add("OK") ; } theDefList.Save() ; }
void MakeBuild::SaveMakeFile(const String& fn, bool exporting) { BeginBuilding(false, true); VectorMap<String, String> bm = GetMethodVars(method); One<Host> host = CreateHost(false); One<Builder> b = CreateBuilder(~host); if(!b) return; const TargetMode& tm = GetTargetMode(); String makefile; Vector<String> uppdirs = GetUppDirs(); String uppout = exporting ? host->GetHostPath(GetVar("OUTPUT")) : "_out/"; String inclist; Index<String> allconfig = PackageConfig(GetIdeWorkspace(), 0, bm, mainconfigparam, *host, *b); bool win32 = allconfig.Find("WIN32") >= 0; Workspace wspc; wspc.Scan(GetMain(), allconfig.GetKeys()); for(int i = 1; i < wspc.GetCount(); i++) { Index<String> modconfig = PackageConfig(wspc, i, bm, mainconfigparam, *host, *b); for(int a = allconfig.GetCount(); --a >= 0;) if(modconfig.Find(allconfig[a]) < 0) allconfig.Remove(a); } if(!exporting) for(int i = 0; i < uppdirs.GetCount(); i++) { String srcdir = GetMakePath(AdjustMakePath(host->GetHostPath(AppendFileName(uppdirs[i], ""))), win32); makefile << "UPPDIR" << (i + 1) << " = " << srcdir << "\n"; inclist << " -I$(UPPDIR" << (i + 1) << ")"; } else inclist << "-I./"; Vector<String> includes = SplitDirs(bm.Get("INCLUDE","")); for(int i = 0; i < includes.GetCount(); i++) inclist << " -I" << includes[i]; makefile << "\n" "UPPOUT = " << (exporting ? "_out/" : GetMakePath(AdjustMakePath(host->GetHostPath(AppendFileName(uppout, ""))), win32)) << "\n" "CINC = " << inclist << "\n" "Macro = "; for(int i = 0; i < allconfig.GetCount(); i++) makefile << " -Dflag" << allconfig[i]; makefile << "\n"; String output, config, install, rules, linkdep, linkfiles, linkfileend; for(int i = 0; i < wspc.GetCount(); i++) { b->config = PackageConfig(wspc, i, bm, mainconfigparam, *host, *b); b->version = tm.version; b->method = method; MakeFile mf; b->AddMakeFile(mf, wspc[i], GetAllUses(wspc, i), GetAllLibraries(wspc, i, bm, mainconfigparam, *host, *b), allconfig, exporting); if(!i) { String tdir = mf.outdir; String trg; if(tm.target_override) { trg = GetMakePath(AdjustMakePath(tm.target), win32); if(!trg.IsEmpty() && *trg.Last() == (win32 ? '\\' : '/')) trg << mf.outfile; else if(trg.Find(win32 ? '\\' : '/') < 0) trg.Insert(0, "$(OutDir)"); } output = Nvl(trg, mf.output); if(exporting) output = wspc[i] + ".out"; install << "\n" "OutDir = " << tdir << "\n" "OutFile = " << output << "\n" "\n" ".PHONY: all\n" "all: prepare $(OutFile)\n" "\n" ".PHONY: prepare\n" "prepare:\n"; } config << mf.config; install << mf.install; rules << mf.rules; linkdep << mf.linkdep; linkfiles << mf.linkfiles; linkfileend << mf.linkfileend; } makefile << config << install << "\n" "$(OutFile): " << linkdep << "\n\t" << linkfiles << linkfileend << " -Wl,--end-group\n\n" << rules << ".PHONY: clean\n" << "clean:\n" << "\tif [ -d $(UPPOUT) ]; then rm -rf $(UPPOUT); fi;\n"; bool sv = ::SaveFile(fn, makefile); if(!exporting) if(sv) PutConsole(NFormat("%s(1): makefile generation complete", fn)); else PutConsole(NFormat("%s: error writing makefile", fn)); EndBuilding(true); }
NAMESPACE_UPP #include "SvgInternal.h" Color SvgParser::GetTextColor(const String& color) { struct Svg_color { const char *name; byte r, g, b; } colors[] = { {"aliceblue", 240, 248, 255}, {"antiquewhite", 250, 235, 215}, {"aqua", 0, 255, 255}, {"aquamarine", 127, 255, 212}, {"azure", 240, 255, 255}, {"beige", 245, 245, 220}, {"bisque", 255, 228, 196}, {"black", 0, 0, 0}, {"blanchedalmond", 255, 235, 205}, {"blue", 0, 0, 255}, {"blueviolet", 138, 43, 226}, {"brown", 165, 42, 42}, {"burlywood", 222, 184, 135}, {"cadetblue", 95, 158, 160}, {"chartreuse", 127, 255, 0}, {"chocolate", 210, 105, 30}, {"coral", 255, 127, 80}, {"cornflowerblue", 100, 149, 237}, {"cornsilk", 255, 248, 220}, {"crimson", 237, 164, 61}, {"cyan", 0, 255, 255}, {"darkblue", 0, 0, 139}, {"darkcyan", 0, 139, 139}, {"darkgoldenrod", 184, 134, 11}, {"darkgray", 169, 169, 169}, {"darkgreen", 0, 100, 0}, {"darkkhaki", 189, 183, 107}, {"darkmagenta", 139, 0, 139}, {"darkolivegreen", 85, 107, 47}, {"darkorange", 255, 140, 0}, {"darkorchid", 153, 50, 204}, {"darkred", 139, 0, 0}, {"darksalmon", 233, 150, 122}, {"darkseagreen", 143, 188, 143}, {"darkslateblue", 72, 61, 139}, {"darkslategray", 47, 79, 79}, {"darkturquoise", 0, 206, 209}, {"darkviolet", 148, 0, 211}, {"deeppink", 255, 20, 147}, {"deepskyblue", 0, 191, 255}, {"dimgray", 105, 105, 105}, {"dodgerblue", 30, 144, 255}, {"firebrick", 178, 34, 34}, {"floralwhite", 255, 250, 240}, {"forestgreen", 34, 139, 34}, {"fuchsia", 255, 0, 255}, {"gainsboro", 220, 220, 220}, {"ghostwhite", 248, 248, 255}, {"gold", 255, 215, 0}, {"goldenrod", 218, 165, 32}, {"gray", 128, 128, 128}, {"green", 0, 128, 0}, {"greenyellow", 173, 255, 47}, {"honeydew", 240, 255, 240}, {"hotpink", 255, 105, 180}, {"indianred", 205, 92, 92}, {"indigo", 75, 0, 130}, {"ivory", 255, 255, 240}, {"khaki", 240, 230, 140}, {"lavender", 230, 230, 250}, {"lavenderblush", 255, 240, 245}, {"lawngreen", 124, 252, 0}, {"lemonchiffon", 255, 250, 205}, {"lightblue", 173, 216, 230}, {"lightcoral", 240, 128, 128}, {"lightcyan", 224, 255, 255}, {"lightgoldenrodyellow", 250, 250, 210}, {"lightgrey", 211, 211, 211}, {"lightgreen", 144, 238, 144}, {"lightpink", 255, 182, 193}, {"lightsalmon", 255, 160, 122}, {"lightseagreen", 32, 178, 170}, {"lightskyblue", 135, 206, 250}, {"lightslategray", 119, 136, 153}, {"lightsteelblue", 176, 196, 222}, {"lightyellow", 255, 255, 224}, {"lime", 0, 255, 0}, {"limegreen", 50, 205, 50}, {"linen", 250, 240, 230}, {"magenta", 255, 0, 255}, {"maroon", 128, 0, 0}, {"mediumaquamarine", 102, 205, 170}, {"mediumblue", 0, 0, 205}, {"mediumorchid", 186, 85, 211}, {"mediumpurple", 147, 112, 219}, {"mediumseagreen", 60, 179, 113}, {"mediumslateblue", 123, 104, 238}, {"mediumspringgreen", 0, 250, 154}, {"mediumturquoise", 72, 209, 204}, {"mediumvioletred", 199, 21, 133}, {"midnightblue", 25, 25, 112}, {"mintcream", 245, 255, 250}, {"mistyrose", 255, 228, 225}, {"moccasin", 255, 228, 181}, {"navajowhite", 255, 222, 173}, {"navy", 0, 0, 128}, {"oldlace", 253, 245, 230}, {"olive", 128, 128, 0}, {"olivedrab", 107, 142, 35}, {"orange", 255, 165, 0}, {"orangered", 255, 69, 0}, {"orchid", 218, 112, 214}, {"palegoldenrod", 238, 232, 170}, {"palegreen", 152, 251, 152}, {"paleturquoise", 175, 238, 238}, {"palevioletred", 219, 112, 147}, {"papayawhip", 255, 239, 213}, {"peachpuff", 255, 218, 185}, {"peru", 205, 133, 63}, {"pink", 255, 192, 203}, {"plum", 221, 160, 221}, {"powderblue", 176, 224, 230}, {"purple", 128, 0, 128}, {"red", 255, 0, 0}, {"rosybrown", 188, 143, 143}, {"royalblue", 65, 105, 225}, {"saddlebrown", 139, 69, 19}, {"salmon", 250, 128, 114}, {"sandybrown", 244, 164, 96}, {"seagreen", 46, 139, 87}, {"seashell", 255, 245, 238}, {"sienna", 160, 82, 45}, {"silver", 192, 192, 192}, {"skyblue", 135, 206, 235}, {"slateblue", 106, 90, 205}, {"slategray", 112, 128, 144}, {"snow", 255, 250, 250}, {"springgreen", 0, 255, 127}, {"steelblue", 70, 130, 180}, {"tan", 210, 180, 140}, {"teal", 0, 128, 128}, {"thistle", 216, 191, 216}, {"tomato", 255, 99, 71}, {"turquoise", 64, 224, 208}, {"violet", 238, 130, 238}, {"wheat", 245, 222, 179}, {"white", 255, 255, 255}, {"whitesmoke", 245, 245, 245}, {"yellow", 255, 255, 0}, {"yellowgreen", 154, 205, 50}, }; static VectorMap<String, Color> map; ONCELOCK { for(int i = 0; i < __countof(colors); i++) map.Add(colors[i].name, Color(colors[i].r, colors[i].g, colors[i].b)); } return map.Get(color, map.Get(ToLower(color), Null)); }
bool MapFlag(const VectorMap<String, String>& map, const char *key) { return map.Get(key, "0") == "1"; }