bool Socket::Data::OpenServer(int port, bool nodelay, int listen_count, bool block, bool reuse) { if(!Open(block)) return false; if(nodelay) NoDelay(); sockaddr_in sin; Zero(sin); sin.sin_family = AF_INET; sin.sin_port = htons(port); sin.sin_addr.s_addr = htonl(INADDR_ANY); if(reuse) { int optval = 1; setsockopt(socket, SOL_SOCKET, SO_REUSEADDR, (const char *)&optval, sizeof(optval)); } if(bind(socket, (const sockaddr *)&sin, sizeof(sin))) { SetSockError(NFormat("bind(port=%d)", port)); return false; } if(listen(socket, listen_count)) { SetSockError(NFormat("listen(port=%d, count=%d)", port, listen_count)); return false; } return true; }
void VfkStream::Open(const VectorMap<int, String>& fns) { Close(); charset = CHARSET_ISO8859_2; file_groups <<= fns; streams.SetCount(file_groups.GetCount()); for(int i = 0; i < streams.GetCount(); i++) if(!streams[i].Open(file_groups[i])) throw Exc(NFormat("cannot open file '%s'", file_groups[i])); indexfilename = GetTempFileName("vfk"); if(!indexfile.Open(indexfilename, FileStream::CREATE)) throw Exc(NFormat("cannot create indexfile '%s'", indexfilename)); String hdrname = "X_HEADER"; Table& hdr = tables.Add(hdrname); hdr.name = hdr.rawname = hdrname; hdr.header = true; hdr.row_count = 0; ASSERT(hdr.columns.GetCount() == HDR_ID); hdr.AddColumn(Column("ID", STRING_V, 30)); ASSERT(hdr.columns.GetCount() == HDR_ORD); hdr.AddColumn(Column("ORD", INT_V)); ASSERT(hdr.columns.GetCount() == HDR_STR); hdr.AddColumn(Column("STR", STRING_V, 1000)); ASSERT(hdr.columns.GetCount() == HDR_NUM); hdr.AddColumn(Column("NUM", DOUBLE_V)); ASSERT(hdr.columns.GetCount() == HDR_DTM); hdr.AddColumn(Column("DTM", TIME_V)); ASSERT(hdr.columns.GetCount() == HDR_COUNT); Scan(); }
void MapEditor::OnLevelMapCalc(Level& level, int number) { if (level.GetMapBG().IsEmpty()) { Exclamation(NFormat(t_("Please, select the image for level: %s"), level.GetName())); return; } String fp = AppendFileName( AppendFileName( GetFileDirectory(GetExeFilePath()), "Maps"), level.GetMapBG()); if (!FileExists(fp)) { Exclamation(NFormat(t_("Image file not exist: %s"), fp)); return; } String name = level.GetName(); double zx = level.GetZoomDX(); Size pz = level.GetPageSize(); Size sz = level.GetCellSize(); FileIn in(fp); One<StreamRaster> r = StreamRaster::OpenAny(in); if (!r) { Exclamation(NFormat(t_("Error while loading image file: %s"), fp)); return; } Image img = r->GetImage(); Calculate(sz.cx, sz.cy, pz.cx, pz.cy, zx, NFormat("%s-%d", _map.GetName(), number + 1), img); }
bool BaseSetupDlg::Run(String& vars) { upp <<= GetVar("UPP"); output <<= GetVar("OUTPUT"); base <<= vars; new_base = IsNull(vars); while(TopWindow::Run() == IDOK) { String varname = ~base; String varfile = VarFilePath(varname); if(varname != vars) { if(FileExists(varfile) && !PromptOKCancel(NFormat("Overwrite existing assembly [* \1%s\1]?", varfile))) continue; if(!SaveVars(varname)) { Exclamation(NFormat("Error writing assmbly [* \1%s\1].", VarFilePath(varname))); continue; } } SetVar("UPP", ~upp); SetVar("OUTPUT", ~output); Vector<String> paths = SplitDirs(upp.GetText().ToString()); for(int i = 0; i < paths.GetCount(); i++) RealizeDirectory(paths[i]); RealizeDirectory(output); vars = varname; return true; } return false; }
void Console::CheckEndGroup() { for(int g = groups.GetCount(); --g >= 0;) { String gname = groups.GetKey(g); Group& group = groups[g]; if(!IsNull(gname) && group.finished) { int p = processes.GetCount(); while(--p >= 0 && !(!!processes[p].process && processes[p].group == gname)) ; if(p < 0) { if(group.count > 0) { int duration = msecs(group.start_time); String msg = NFormat("%s: %d file(s) built in %s, %d msecs / file, duration = %d msecs", gname, group.count, PrintTime(group.msecs), group.msecs / group.count, duration); if(processes.GetCount() > 1) { int k = 100 * processes.GetCount() / (processes.GetCount() - 1); msg << NFormat(", parallelization %d%%", minmax(k - group.msecs * k / max(group.raw_msecs, 1), 0, 100)); } msg << '\n'; spooled_output.Cat(msg); if(console_lock < 0) { Append(spooled_output); spooled_output = Null; } } groups.Remove(g); } } } }
void VfkStream::ScanHeader(const char *b, Table& table) { int colid = 0; while(*b && *b != '\n') { if(IsAlpha(*b)) { const char *id = b; while(IsIdent(*++b)) ; Column col; col.name = String(id, b); try { while(*b == ' ') b++; col.vtype = ERROR_V; col.width = Null; switch(*b++) { case 'N': { col.vtype = DOUBLE_V; break; } case 'T': { col.vtype = STRING_V; if(!IsDigit(*b)) throw Exc("missing string width"); col.width = ScanInt(b, &b); break; } case 'D': { col.vtype = TIME_V; break; } default: { throw Exc(NFormat("invalid data type '%c'", *--b)); } } if(colid < table.columns.GetCount()) { const Column& old = table.columns[colid]; if(old.name != col.name) throw Exc(NFormat("column name mismatch (%s / %s)", old.name, col.name)); if(old.vtype != col.vtype) throw Exc(NFormat("column type mismatch (%d / %d)", old.vtype, col.vtype)); if(old.width != col.width) throw Exc(NFormat("column width mismatch (%~d / %~d)", old.width, col.width)); } else table.AddColumn(col); colid++; } catch(Exc e) { throw Exc(NFormat("column '%s': %s", colid, e)); } } else b++; } }
int DlgCompareDir::Refresh(String rel_path, int parent) { FindFile ff; VectorMap<String, FileInfo> afile, bfile; VectorMap<String, String> adir, bdir; String arel = AppendFileName(pa, rel_path); String brel = AppendFileName(pb, rel_path); int done = 0; if(!FetchDir(arel, afile, adir)) done |= 2; if(!FetchDir(brel, bfile, bdir)) done |= 1; Index<String> dir_index; dir_index <<= adir.GetIndex(); FindAppend(dir_index, bdir.GetKeys()); Vector<String> dirs(dir_index.PickKeys()); Sort(dirs, GetLanguageInfo()); for(int i = 0; i < dirs.GetCount(); i++) { int fa = adir.Find(dirs[i]), fb = bdir.Find(dirs[i]); String dn = (fb >= 0 ? bdir[fb] : adir[fa]); int dirpar = tree.Add(parent, CtrlImg::Dir(), dn); int dirdone = Refresh(AppendFileName(rel_path, dirs[i]), dirpar); done |= dirdone; switch(dirdone) { case 0: tree.Remove(dirpar); break; case 1: tree.SetNode(dirpar, TreeCtrl::Node().SetImage(CompDirImg::a_dir()).Set(dn)); break; case 2: tree.SetNode(dirpar, TreeCtrl::Node().SetImage(CompDirImg::b_dir()).Set(dn)); break; case 3: tree.SetNode(dirpar, TreeCtrl::Node().SetImage(CompDirImg::ab_dir()).Set(dn)); break; } } Index<String> name_index; name_index <<= afile.GetIndex(); FindAppend(name_index, bfile.GetKeys()); Vector<String> names(name_index.PickKeys()); Sort(names, GetLanguageInfo()); for(int i = 0; i < names.GetCount(); i++) { int fa = afile.Find(names[i]), fb = bfile.Find(names[i]); if(fa < 0) { tree.Add(parent, CompDirImg::b_file(), NFormat("%s: B (%`, %0n)", bfile[fb].name, bfile[fb].time, bfile[fb].size)); done |= 2; } else if(fb < 0) { tree.Add(parent, CompDirImg::a_file(), NFormat("%s: A (%`, %0n)", afile[fa].name, afile[fa].time, afile[fa].size)); done |= 1; } else if(afile[fa].size != bfile[fb].size || LoadFile(AppendFileName(arel, names[i])) != LoadFile(AppendFileName(brel, names[i]))) { tree.Add(parent, CompDirImg::ab_file(), NFormat("%s: A (%`, %0n), B (%`, %0n)", bfile[fb].name, afile[fa].time, afile[fa].size, bfile[fb].time, bfile[fb].size)); done |= 3; } } return done; }
String FormatElapsedTime(double run) { String rtime; double hrs = floor(run / 3600); if(hrs > 0) rtime << NFormat("%0n hours, ", hrs); int minsec = fround(run - 3600 * hrs); int min = minsec / 60, sec = minsec % 60; if(min || hrs) rtime << NFormat("%d min, ", min); rtime << NFormat("%d sec", sec); return rtime; }
bool MapBG::Load(const char* fp) { if (!FileExists(fp)) { LOG(NFormat("MapBG: File not exists, \"%s\"", fp)); return false; } if (!LoadFromXMLFile(_levels, fp)) { LOG("MapBG: Error while loading map from XML-file!"); return false; } _mapDir = AppendFileName(GetFileDirectory(fp), GetFileTitle(fp)); _currLevel = _levels.GetCount() > 0 ? 0 : -1; if (_currLevel < 0) { LOG("MapBG: No zoom levels found in map!"); return false; } _recalc = true; return true; }
/** * parse a server response. it parses a xml response sent by a server and returns the value or * error it contains. * @param s the received data * @return the value described by data * @see ParseMethodCall() */ Value XmlRpcParser::ParseMethodResponse(String s){ XmlParser p(s); Value v; String error; try{ while(!p.Tag("methodResponse")) p.Skip(); if(p.Tag("fault")) { ValueMap vm(Parse(p)); error << vm["faultString"] <<" ("<<vm["faultCode"]<<")"; p.PassEnd(); //fault p.PassEnd(); //methodResponse return ErrorValue(error); } p.PassTag("params"); p.PassTag("param"); v=Parse(p); p.PassEnd(); //param p.PassEnd(); //params p.PassEnd(); //methodResponse } catch(Exc e) { return ErrorValue(NFormat("EXCEPTION: %s",e)); } return Value(v); }
bool UninstallService(String name, String& status) { ServiceHandle scm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); if(!scm) { status = "Cannot open service manager"; return false; } ServiceHandle me = OpenService(scm, name, SC_MANAGER_ALL_ACCESS); if(!me) { status = "Cannot open service."; return false; } SERVICE_STATUS srvstat; if(ControlService(me, SERVICE_CONTROL_STOP, &srvstat)) { int start = msecs(); while(QueryServiceStatus(me, &srvstat) && srvstat.dwCurrentState != SERVICE_STOPPED && msecs(start) < 10000) Sleep(100); } if(!DeleteService(me)) { status = NFormat("Error deleting service: %s", GetLastErrorMessage()); return false; } return true; }
void SelectPackageDlg::OnBaseRemove() { int c = base.GetCursor(); if(c < 0) return; String next; if(c + 1 < base.GetCount()) next = base.Get(c + 1); else if(c > 0) next = base.Get(c - 1); String vars = base.Get(0); String varpath = VarFilePath(vars); if(PromptOKCancel(NFormat("Remove base file [* \1%s\1]?", varpath)) && !FileDelete(varpath)) Exclamation(NFormat("Error deleting file [* \1%s\1].", varpath)); SyncBase(next); }
String COFFMachineName(int code) { for(const MachineInfo *mi = COFFMachineList(); mi->name; mi++) if(mi->code == code) return mi->name; return NFormat("UNKNOWN(%04x)", code); }
void EscapeHtml(StringBuffer& out, const String& txt) { const char *s = txt; const char *e = txt.End(); while(s != e) { if(*s == 31) out.Cat(" "); else if(*s == '<') out.Cat("<"); else if(*s == '>') out.Cat(">"); else if(*s == '&') out.Cat("&"); else if(*s == '\"') out.Cat("""); else if((byte)*s < ' ') out.Cat(NFormat("&#%d;", (byte)*s)); else out.Cat(*s); s++; } }
void VegaTab2::ShowPairingCB() { int i, npair, code; int idw, idb, res; arrp.Clear(); if (TD.IS_SWISS) npair = TD.pairing[0][TD.currentRound]; else npair = TD.pairingRR[0][TD.currentRound]; for (i=1; i<=npair; i++) { if (TD.IS_SWISS) code = TD.pairing[i][TD.currentRound]; else code = TD.pairingRR[i][TD.currentRound]; TD.DecodeResult(code, &idw, &idb, &res); arrp.Add( AsString(i), NFormat("%-25.25s (%4.1f)", player[idw].name, 0.), NFormat("%-25.25s (%4.1f)", player[idb].name, 0.), NFormat("%3d - %3d", idw, idb)); arrp.GoEnd(); } }
void WorkspaceWork::RemovePackage(String from_package) { String active = UnixPath(GetActivePackage()); if(IsNull(from_package) && !PromptYesNo(NFormat( "Remove package [* \1%s\1] from uses sections of all current packages ?", active))) return; PackageOp(GetActivePackage(), from_package, Null); }
bool Ide::SearchInFile(const String& fn, const String& pattern, bool wholeword, bool ignorecase, int& n, RegExp *regexp) { FileIn in(fn); if(!in) return true; int ln = 1; bool wb = wholeword ? iscid(*pattern) : false; bool we = wholeword ? iscid(*pattern.Last()) : false; int infile = 0; while(!in.IsEof()) { String line = in.GetLine(); bool bw = true; int count; if(regexp) { if(regexp->Match(line)) AddFoundFile(fn, ln, line, regexp->GetOffset(), regexp->GetLength()); } else for(const char *s = line; *s; s++) { if(bw && Match(pattern, s, we, ignorecase, count)) { AddFoundFile(fn, ln, line, int(s - line), count); infile++; n++; break; } if(wb) bw = !iscid(*s); } ln++; } in.Close(); int ffs = ~ff.style; if(infile && ffs != STYLE_NO_REPLACE) { EditFile(fn); bool doit = true; if(ffs == STYLE_CONFIRM_REPLACE) { editor.SetCursor(0); editor.Find(false, true); switch(PromptYesNoCancel(NFormat("Replace %d lines in [* \1%s\1]?", infile, fn))) { case 1: break; case 0: doit = false; break; case -1: return false; } } if(doit) { editor.SelectAll(); editor.BlockReplace(); SaveFile(); ffound.Add(fn, Null, AsString(infile) + " replacements made"); ffound.Sync(); } } return true; }
bool XmlParser::End() { if(IsEof()) throw XmlError("Unexpected end of file"); if(IsEnd()) { LLOG("EndTag " << text); if(stack.IsEmpty()) throw XmlError(NFormat("Unexpected end-tag: </%s>", tagtext)); if(stack.Top().tag != tagtext && !relaxed) { LLOG("Tag/end-tag mismatch: <" << stack.Top().tag << "> </" << tagtext << ">"); throw XmlError(NFormat("Tag/end-tag mismatch: <%s> </%s>", stack.Top().tag, tagtext)); } stack.Drop(); npreserve = (!stack.IsEmpty() && stack.Top().preserve_blanks); Next(); return true; } return false; }
void MakeBuild::CleanPackage(const Workspace& wspc, int package) { PutConsole(NFormat("Cleaning %s", wspc[package])); One<Host> host = CreateHost(false); One<Builder> builder = CreateBuilder(~host); if(!builder) return; host->DeleteFolderDeep(OutDir(PackageConfig(wspc, package, GetMethodVars(method), mainconfigparam, *host, *builder), wspc[package], GetMethodVars(method))); }
void Ide::CleanUppOut() { String out = GetVar("OUTPUT"); if(!PromptYesNo(NFormat("Erase the whole output directory [* \1%s\1]?", out))) return; console.Clear(); PutConsole("UPPOUT cleanup..."); DeleteFolderDeep(out); PutConsole("(done)"); HideBottom(); }
void VfkStream::Dump() { puts(NFormat("Index file: %s", indexfilename)); puts(NFormat("%d file group(s):", file_groups.GetCount())); for(int i = 0; i < file_groups.GetCount(); i++) puts(NFormat("\t[%d] = %d / %s (%n B)", i, file_groups.GetKey(i), file_groups[i], streams[i].IsOpen() ? streams[i].GetSize() : 0)); puts("Tables:"); for(int t = 0; t < tables.GetCount(); t++) { const Table& tbl = tables[t]; puts(NFormat("\tTable(%d, %s (%s)) sections:\n", t, tbl.name, tbl.rawname)); for(int s = 0; s < tbl.file_index.GetCount(); s++) puts(NFormat("\t\t[%d]: file index [%d], range %n .. %n, %n bytes, %n rows", s, tbl.file_index[s], tbl.begin_offset[s], tbl.end_offset[s], tbl.end_offset[s] - tbl.begin_offset[s], tbl.row_count)); /* for(int c = 0; c < tbl.columns.GetCount(); c++) { const Column& col = tbl.columns[c]; puts(NFormat("\t\t(%d, %s): %s %~d", c, col.name, GetVTypeName(col.vtype), col.width)); } */ Data data = GetData(tbl.name); puts(NFormat("%d row(s):", data.GetCount())); for(int i = 0; i < 10 && i < data.GetCount(); i++) { const Vector<Value>& row = data[i]; String out; for(int v = 0; v < row.GetCount(); v++) out << (v ? ";" : "") << StdFormat(row[v]); puts(out); } } }
void LayoutDesigner::Execute() { // frame.SetRect(100, 100, 700, 500); #ifndef flagIDERW LoadFromFile(*this); #endif OpenWindow(); frame.Run(); #ifndef flagIDERW StoreToFile(*this); #endif if(!alias_map.Save(alias_map_file)) Exclamation(NFormat("Error updating alias file [* \1%s\1].", alias_map_file)); }
static void ReadMacro(CParser& p) { IdeMacro macro; if(p.IsString()) { macro.menu = p.ReadString(); if(p.Char(':')) macro.submenu = p.ReadString(); } if(!p.IsChar('{')) macro.hotkey = ParseKeyDesc(p); EscLambda& l = macro.code.CreateLambda(); const char *t = p.GetPtr(); l.filename = p.GetFileName(); l.line = p.GetLine(); if(!p.Char('{')) p.ThrowError("missing '{'"); SkipBlock(p); l.code = String(t, p.GetPtr()); Array<IdeMacro>& mlist = UscMacros(); if(macro.hotkey) { int f = FindFieldIndex(mlist, &IdeMacro::hotkey, macro.hotkey); if(f >= 0) { PutConsole(NFormat("%s(%d): duplicate macro hotkey %s\n", l.filename, l.line, GetKeyDesc(macro.hotkey))); const EscLambda& lambda = UscMacros()[f].code.GetLambda(); PutConsole(NFormat("%s(%d): previously defined here\n", lambda.filename, lambda.line)); } } if(!IsNull(macro.menu)) { for(int i = 0; i < mlist.GetCount(); i++) if(mlist[i].menu == macro.menu && mlist[i].submenu == macro.submenu) { PutConsole(NFormat("%s(%d): duplicate macro menu item (%s:%s)\n", l.filename, l.line, macro.menu, macro.submenu)); const EscLambda& lambda = UscMacros()[i].code.GetLambda(); PutConsole(NFormat("%s(%d): previously defined here\n", lambda.filename, lambda.line)); break; } } mlist.Add(macro); }
void MapEditor::OnLoadMap() { WithMapLoadLayout<TopWindow> dlg; CtrlLayoutOKCancel(dlg, t_("Load Map...")); String dir = AppendFileName( GetFileDirectory(GetExeFilePath()), "Mipmaps"); Vector<String> files = GetDirectoryFiles(dir, "*.map"); Sort(files); if (files.GetCount() <= 0) { Exclamation(t_("No any file to load!")); return; } for (int i = 0; i < files.GetCount(); ++i) dlg.MapList.Add(files[i], files[i]); dlg.MapList.SetIndex(0); if (dlg.Execute() != IDOK) return; String fp = AppendFileName(dir, (~dlg.MapList).ToString()); if (!FileExists(fp)) { Exclamation(NFormat(t_("File not found: %s"), fp)); return; } if (!LoadFromXMLFile(_map, fp)) { Exclamation(NFormat(t_("Error while loading map from file: %s"), fp)); return; } UpdateLevelList(); UpdateEditorCtrls(); }
void RemoteSlaveProcess::Open(const char *host, int port, const char *cmdline, const char *envptr, int to) { SVRLOG("RemoteSlaveProcess(" << host << ":" << port << ")=" << cmdline); Kill(); timeout = to; Socket::Init(); String localhost; if(host == 0 || *host == 0) { localhost = Socket::GetHostName(); host = localhost; } if(port == 0) port = DEFAULT_PORT; terminated = false; current_part = 0; output[0] = output[1] = output[2] = Null; if(!ClientSocket(socket, host, port, true, NULL, REQUEST_TIMEOUT)) throw Exc(NFormat(t_("Opening host '%s' / port %d failed, error = %s"), host, port, Socket::GetErrorText())); int len = (int)strlen(cmdline); if(envptr && *envptr) { const char *e = envptr; while(*e) e = e + strlen(e) + 1; socket.Write(":"); socket.Write(ASCII85Encode(String(envptr, e + 1))); socket.Write("\n"); } socket.Write("="); socket.Write(cmdline, len + 1); // send terminating 0 as well Recv(0, timeout); if(output[0][0] == '-') throw Exc(NFormat(t_("Error running process: %s\nCommand: %s"), output[0].Begin() + 1, cmdline)); if(output[0] != "+") throw Exc(NFormat(t_("Communication error; process = %s"), cmdline)); }
bool InstallService(String name, String display_name, String& cmdline, String& status) { ServiceHandle scm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); if(!scm) { status = "Cannot open service manager"; return false; } ServiceHandle me = OpenService(scm, name, SC_MANAGER_ALL_ACCESS); if(me) { SERVICE_STATUS srvstat; if(ControlService(me, SERVICE_CONTROL_STOP, &srvstat)) { int start = msecs(); while(QueryServiceStatus(me, &srvstat) && srvstat.dwCurrentState != SERVICE_STOPPED && msecs(start) < 10000) Sleep(100); } if(!DeleteService(me)) { status = NFormat("Error deleting existing service: %s", GetLastErrorMessage()); return false; } me.Close(); } me = CreateService(scm, name, display_name, SERVICE_ALL_ACCESS, SERVICE_WIN32_OWN_PROCESS, SERVICE_AUTO_START, SERVICE_ERROR_NORMAL, cmdline, 0, 0, 0, 0, 0); if(!me) { status = NFormat("Error creating service: %s", GetLastErrorMessage()); return false; } if(!StartService(me, 0, NULL)) { status = NFormat("Error starting service: %s", GetLastErrorMessage()); return false; } return true; }
void WorkspaceWork::RemovePackageMenu(Bar& bar) { if(bar.IsScanKeys() || bar.IsScanHelp() || !bar.IsMenuBar()) return; String active = UnixPath(GetActivePackage()); int usecnt = 0; for(int i = 0; i < package.GetCount(); i++) { String pn = UnixPath(package[i].name); Package prj; String pp = PackagePath(pn); prj.Load(pp); for(int i = 0; i < prj.uses.GetCount(); i++) if(UnixPath(prj.uses[i].text) == active) { usecnt++; bar.Add("Remove from '" + pn + '\'', THISBACK1(RemovePackage, pn)) .Help(NFormat("Remove package '%s' from uses section in '%s'", active, pp)); } } if(usecnt > 1) { bar.MenuSeparator(); bar.Add("Remove all uses", THISBACK1(RemovePackage, String(Null))) .Help(NFormat("Remove package '%s' from all uses in active project and its submodules", active)); } }
void MapEditor::OnAddLevel() { int row = LevelList.GetRowCount(); Level level; level.SetName(NFormat(t_("Level #%d"), _map.GetLevels().GetCount() + 1)); level.WhenMapList = THISBACK(OnLevelMapList); level.WhenCalculate = THISBACK1(OnLevelMapCalc, row); if (level.OpenProperties() != IDOK) return; _map.GetLevels().Add(level); UpdateLevelList(); }
void DlgCalc::CmdStore() { WithCalcStoreLayout<TopWindow> stdlg; CtrlLayoutOKCancel(stdlg, NFormat("Store %vt", result_val)); stdlg.var.SetFilter(CharFilterCalcIdent); stdlg.list.AddColumn("Variable"); stdlg.list.AddColumn("Value"); const CalcSymbols& tos = calc_context->stack.Top(); Vector<int> order = GetSortOrder(tos.var_index); for(int i = 0; i < order.GetCount(); i++) { int o = order[i]; stdlg.list.Add(tos.var_index[o], tos.var_value[o]); } if(stdlg.Run() == IDOK) calc_context->Set(~stdlg.var, result_val, true); }
void VfkStream::SpeedTest() { for(int i = 0; i < tables.GetCount(); i++) { int begin = msecs(); Data data = GetData(tables[i].name); int get = msecs(); if(data.GetCount() > 0) data[0]; int first = msecs(); for(int r = 1; r < data.GetCount(); r++) data[r]; int nth = msecs(); puts(NFormat("%s: get(%d), first(%d), nth(%2v)", tables[i].name, get - begin, first - get, (nth - first) / max<double>((double)data.GetCount() - 1, 1))); } }