diff --git a/TODO b/TODO index 0e607aecfaaf7f92032cb2fd3f9c9b849b64a1f2..4646230b575932ee1debd399ff426b8da051b8ea 100644 --- a/TODO +++ b/TODO @@ -49,12 +49,8 @@ refactor func+op registration so that registered object can be const Terminology: "file" -> "workspace" -boost::format -> cppformat - lmfit call-back within class, thanks to std::functional -read-plus Interface in EINEN namespace ask:: stecken ?? - Documentation: - Universal help/doc associated with - environment variables like psdir diff --git a/pub/CMakeLists.txt b/pub/CMakeLists.txt index 83e571269df95624fac343345767e078f546fe24..538d95b79125eabeb0f05b12f8a4fb0d5794fc19 100644 --- a/pub/CMakeLists.txt +++ b/pub/CMakeLists.txt @@ -8,7 +8,7 @@ set(CMAKE_DISABLE_IN_SOURCE_BUILD ON) project(Frida) -set(Frida_VERSION 2.4.0c) +set(Frida_VERSION post-2.4.0c) include(CTest) # equivalent to "enable_testing() ??? add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND}) # => 'make check' is an alias for 'ctest' diff --git a/pub/lib/commands.cpp b/pub/lib/commands.cpp index 96032ff539b7931f2148b085fc31b3d17eedbe69..73003815cc8cb668f6afadb131697201a8ebbc4e 100644 --- a/pub/lib/commands.cpp +++ b/pub/lib/commands.cpp @@ -397,7 +397,11 @@ bool frida_command(string cmd) SPloWin::instance()->current()->gp_write(cmd); } } else if (cmd == "gsym") { - system(("gv " + CNode::eval("psgsym")->to_s() + "&").c_str()); + string viewer = CNode::eval("ps_viewer")->to_s(); + string fname = CNode::eval("plot_symbol_legend")->to_s(); + if (!triv::file_exists(fname)) + throw "File "+fname+" not found"; + system((viewer + " " + fname + "&").c_str()); } else if (cmd == "p") { NPlot::plot(SPloWin::instance()->current(), false); } else if (cmd == "pr") { @@ -576,7 +580,7 @@ bool frida_command(string cmd) " oixyd choose three columns, save them as x, y, dy\n"; } else if (cmd == "op") { - throw S("use op<n> to modify one parameter, or op* to modify all"); + throw "use op<n> to modify one parameter, or op* to modify all"; } else if (cmd == "op*") { NCurveFile::pars_query(); } else if (cmd == "opa") { diff --git a/pub/lib/coord.cpp b/pub/lib/coord.cpp index 32a70c84df15727ebf55faa27bc0421361cb282c..13161e190b621bf4552ffd4044a770deee5f7184 100644 --- a/pub/lib/coord.cpp +++ b/pub/lib/coord.cpp @@ -7,12 +7,13 @@ //! \file coord.cpp //! \brief Coordinates CCoord, numeric parameters CParam. -#include "defs.hpp" - #include <cstring> #include "../readplus/macro.hpp" +#include "../trivia/string_ops.hpp" +#include "../trivia/vector_ops.hpp" +#include "defs.hpp" #include "coord.hpp" //************************************************************************************************** @@ -101,6 +102,26 @@ void CCoord::ask_and_set(const string& quest) } +//! Merge in another coord. + +void CCoord::merge(const CCoord other) +{ + if (name=="") + name = other.name; + else { + vector<string> names = triv::split(name, ", "); + if (!triv::contains(names, other.name)) + name += ", " + other.name; + } + if (unit=="") + unit = other.unit; + else { + vector<string> units = triv::split(unit, ", "); + if (!triv::contains(units, other.unit)) + unit += ", " + other.unit; + } +} + //! Standard string. string CCoord::str_std() const { return name + " (" + unit + ")"; } diff --git a/pub/lib/coord.hpp b/pub/lib/coord.hpp index 42249cbcaa55a1f553fc6420bbf7aaf8fef7199c..6c483b71095408c561bff7a37e1c434c5e66a2d2 100644 --- a/pub/lib/coord.hpp +++ b/pub/lib/coord.hpp @@ -25,6 +25,7 @@ public: CCoord(const string in); void ask_and_set(const string& quest); + void merge(const CCoord other); friend std::ostream& operator<<(std::ostream& s, CCoord C); string str_std() const; @@ -32,7 +33,6 @@ public: string str_ps() const; string to_a01() const; string load_a01(string); - //! Has this instance nonvoid contents? bool defined() { return name != ""; } //! Are two instances equal? diff --git a/pub/lib/expr.cpp b/pub/lib/expr.cpp index f9005b551cdbb37e958983ba042b20adfe49594c..a2061f1eabcc215971ce5dd1f72c813f2a82fe43 100644 --- a/pub/lib/expr.cpp +++ b/pub/lib/expr.cpp @@ -266,9 +266,12 @@ void CNode::tree_vec_val(vector<double>* ret, vector<double>* dret, int k, int j RObj val = tree_val(ctx); if (RObjNum pr = PCAST<const CObjNum>(val)) { ret->assign(nret, pr->to_r()); - if (dret && pr->has_err()) - dret->assign(nret, pr->to_dr()); - + if (dret) { + if (pr->has_err()) + dret->assign(nret, pr->to_dr()); + else + dret->clear(); + } } else if (RObjVecInt pv = PCAST<const CObjVecInt>(val)) { for (int i = 0; i < nret; ++i) (*ret)[i] = pv->to_r(i); diff --git a/pub/lib/file_in.cpp b/pub/lib/file_in.cpp index 2c356c38b2f394bc51c94a1c5d076a7b403d67c4..19639e0209de9952b364e7088c6798db050101cd 100644 --- a/pub/lib/file_in.cpp +++ b/pub/lib/file_in.cpp @@ -496,105 +496,111 @@ void NFileIn::Load_96(FILE* F_in, string fshort) fout->name = fshort; + // Read block 1 = format tag. if (!triv::freadln(F_in, &lin)) throw "file empty or starting with empty line"; - if (lin != string("ASCII-96")) + if (lin != "ASCII-96") throw ".i96 file starts with illegal header [" + lin + "]"; - if (!triv::freadln(F_in, &lin) || lin.length() < 9 || lin.substr(0, 9) != string("(a24,a56)")) + // Read block 2: string parameters. + if (!triv::freadln(F_in, &lin) || lin.length() < 9 || lin.substr(0, 9) != "(a24,a56)") throw "no valid intro to block 2"; - - if (!triv::freadln(F_in, &lin) || lin.length() < 24 || lin.substr(0, 3) != string("fil")) + if (!triv::freadln(F_in, &lin) || lin.length() < 24 || lin.substr(0, 3) != "fil") throw "tag 'fil' not found in block 2"; if (triv::strip(lin.substr(24)) != fshort) { cout << "warning: i96 file '" << fshort << "' renamed from '" << lin.substr(24) << "'\n"; } - - if (!triv::freadln(F_in, &lin) || lin.length() < 24 || lin.substr(0, 3) != string("tit")) + if (!triv::freadln(F_in, &lin) || lin.length() < 24 || lin.substr(0, 3) != "tit") throw "tag 'tit' not found in block 2"; fout->lDoc.push_back(triv::strip(lin.substr(24))); - - while (!triv::freadln(F_in, &lin) && lin.length() >= 24 && lin.substr(0, 3) == string("doc")) - fout->lDoc.push_back(triv::strip(lin.substr(24))); - - if (lin.substr(0, 3) != string("dir")) - throw "tag 'dir' not found in block 2"; - + while (triv::freadln(F_in, &lin) && lin.length() >= 3 && lin.substr(0, 3) == "doc") + if (lin.length() >= 24) + fout->lDoc.push_back(triv::strip(lin.substr(24))); + if (lin.substr(0, 3) != "dir") + throw "tag 'dir' not found in block 2, line '" + lin + "'"; while (triv::freadln(F_in, &lin) - && !(lin.length() >= 6 && lin.substr(0, 6) == string("&eob 2"))) + && !(lin.length() >= 6 && lin.substr(0, 6) == "&eob 2")) ; + // Read block 3: integer parameters. if (!triv::freadln(F_in, &lin)) - throw "missed &eob 3"; - - if (lin.length() < 9 || lin.substr(0, 9) != string("(a24,i16)")) + throw "missed &eob 2"; + if (lin.length() < 9 || lin.substr(0, 9) != "(a24,i16)") throw "no valid intro to block 3"; - - while (!triv::freadln(F_in, &lin) - && !(lin.length() >= 6 && lin.substr(0, 6) == string("&eob 3"))) + while (triv::freadln(F_in, &lin) + && !(lin.length() >= 6 && lin.substr(0, 6) == "&eob 3")) ; + // Read block 4: floating-point parameters. if (!triv::freadln(F_in, &lin)) throw "missed &eob 3"; - - if (lin.length() < 16 || lin.substr(0, 16) != string("(a24,a24,g20.10)")) - throw "no valid intro to block 4"; - - while (!triv::freadln(F_in, &lin) && lin.length() >= 48 && lin.substr(0, 4) != string("&eob")) { - if (sscanf(lin.substr(48).c_str(), "%lg", &r0) != 1) - throw "no real value in rpar line"; - fout->RPar.push_back(CParam(lin.substr(0, 24), lin.substr(24, 24), r0)); + if (lin.length() < 16 || lin.substr(0, 16) != "(a24,a24,g20.10)") + throw "Intro to block 4 is invalid :'" + lin + "'"; + while (triv::freadln(F_in, &lin) && !(lin.length() >= 4 && lin.substr(0, 4)=="&eob")) { + if (lin.length()<=48 || sscanf(lin.substr(48).c_str(), "%lg", &r0) != 1) + cout << "warning: file " << fshort << " has empty rpar " << lin.substr(0, 16) << "\n"; + else + fout->RPar.push_back(CParam(lin.substr(0, 24), lin.substr(24, 24), r0)); } - if (lin.substr(0, 6) != string("&eob 4")) + // Read block 5: coordinate names and units. + if (lin.substr(0, 6) != "&eob 4") throw "no valid eob 4"; - if (!triv::freadln(F_in, &lin) || lin.length() < 9 - || lin.substr(0, 12) != string("(a4,a24,a24)")) + || lin.substr(0, 12) != "(a4,a24,a24)") throw "no valid intro to block 5"; - - if (!triv::freadln(F_in, &lin) || lin.length() < 28 || lin.substr(0, 1) != string("x")) + if (!triv::freadln(F_in, &lin) || lin.length() < 5 || lin.substr(0, 1) != "x") throw "no x coordinate"; - fout->xco = CCoord(triv::strip(lin.substr(4, 24)), triv::strip(lin.substr(28, 24))); - - if (!triv::freadln(F_in, &lin) || lin.length() < 28 || lin.substr(0, 1) != string("y")) + fout->xco = CCoord(triv::strip(lin.substr(4, 24)), + lin.length()>28 ? triv::strip(lin.substr(28, 24)) : ""); + if (!triv::freadln(F_in, &lin) || lin.length() < 5 || lin.substr(0, 1) != "y") throw "no y coordinate"; - fout->yco = CCoord(triv::strip(lin.substr(4, 24)), triv::strip(lin.substr(28, 24))); - - if (!triv::freadln(F_in, &lin) || lin.length() < 28 || lin.substr(0, 1) != string("z")) - throw "no z coordinate"; - fout->ZCo.push_back(CCoord(triv::strip(lin.substr(4, 24)), triv::strip(lin.substr(28, 24)))); + fout->yco = CCoord(triv::strip(lin.substr(4, 24)), + lin.length()>28 ? triv::strip(lin.substr(28, 24)) : ""); + while (triv::freadln(F_in, &lin) && !(lin.length() >= 4 && lin.substr(0, 4)=="&eob")) { + if (lin.length()<=4 || lin.substr(0, 1) != "z") + throw "no z coordinate in line '"+lin+"'"; + fout->ZCo.push_back(CCoord(triv::strip(lin.substr(4, 24)), + lin.length()>28 ? triv::strip(lin.substr(28, 24)) : "")); + } - if (!triv::freadln(F_in, &lin) || lin.length() < 6 || lin.substr(0, 6) != string("&eob 5")) + // Read block 6: history. + if (lin.length() < 6 || lin.substr(0, 6) != "&eob 5") throw "no valid eob 5"; - - if (!triv::freadln(F_in, &lin) || lin.length() < 5 || lin.substr(0, 5) != string("(a80)")) + if (!triv::freadln(F_in, &lin) || lin.length() < 5 || lin.substr(0, 5) != "(a80)") throw "no valid intro to block 6"; - while (triv::freadln(F_in, &lin) > 0 - && !(lin.length() >= 6 && lin.substr(0, 6) == string("&eob 6"))) + && !(lin.length() >= 6 && lin.substr(0, 6) == "&eob 6")) fout->lDoc.push_back(lin); + // Read block 7 = spectra. if (!triv::freadln(F_in, &lin)) throw "missed &eob 6"; for (int i = 1; i < 3; ++i) if (!triv::freadln(F_in, &lin)) throw "no valid intro to block 7"; - if (!triv::freadln(F_in, &lin) || sscanf(lin.c_str(), "%i %i", &nspec, &ival) != 2) throw "no nspec or 2nd arg in intro to block 7"; - for (int j = 0; j < nspec; ++j) { sout = PSpec(new CSpec); - if (!triv::freadln(F_in, &lin) || lin.length() < 10 - || lin.substr(0, 9) != string("&spectrum") - || sscanf(lin.substr(10).c_str(), "%i", &ival) != 1 || ival != j + 1) - throw "no valid intro to spectrum"; - - if (!triv::freadln(F_in, &lin) || sscanf(lin.c_str(), "%i %lg", &n, &r0) != 2) + if (!triv::freadln(F_in, &lin) || lin.length() < 10 || lin.substr(0, 9) != "&spectrum") + throw "no valid tag for spectrum "+S(j)+" in line '"+lin+"'"; + if (sscanf(lin.substr(10).c_str(), "%i", &ival) != 1) + throw "no spectrum number in line '"+lin+"'"; + if (ival != j + 1) + cout << "warning: file " << fshort << " has spectrum " << j+1 + << " incorrectly numbered " << ival << "\n"; + if (!triv::freadln(F_in, &lin) || sscanf(lin.substr(0,16).c_str(), "%i", &n) != 1) throw "no valid header in spectrum"; - sout->z.push_back(PObjDbl(new CObjDbl(r0))); - + for (int iz=0; iz<fout->ZCo.size(); ++iz) { + if (iz>=4) + throw "i96 file with 4 or more z coordinates currently not supported"; + // (these files have an extra header line with format 5g16.8) + if (lin.length()<=iz*16 || sscanf(lin.substr((iz+1)*16,16).c_str(), "%lg", &r0) != 1) + throw "file "+fshort+", spectrum "+S(j+1)+": no entry z"+S(iz) + +" in line '"+lin+"'"; + sout->z.push_back(PObjDbl(new CObjDbl(r0))); + } for (int i = 0; i < n; ++i) { if (!F_in || !triv::freadln(F_in, &lin)) throw "i96: failed to read data line " + S(i) + " of " + S(n); @@ -602,7 +608,6 @@ void NFileIn::Load_96(FILE* F_in, string fshort) throw "i96: bad data line: '" + lin + "'"; sout->push_xy(r0, r1); } - fout->V.push_back(move(sout)); } diff --git a/pub/lib/import.cpp b/pub/lib/import.cpp index 57bd224d88b0f6b07675ce95bc16cf419eaaaa97..0c1432615ddbff4464170d5740c9c4d203829d35 100644 --- a/pub/lib/import.cpp +++ b/pub/lib/import.cpp @@ -249,10 +249,9 @@ void NImport::make_grid() s->x[0] = 0; } else { for (int i = 0; i < ni; ++i) - s->x[i] = ((double)i) / (ni-1); + s->x[i] = i / (ni-1.); } - s->y.clear(); - s->y.resize(ni, 0.); + s->y.assign(ni, 0.); if (nj > 1) s->z.push_back(RObjInt(new CObjInt(j))); diff --git a/pub/lib/obj.hpp b/pub/lib/obj.hpp index 616c831ce25353cb1c967021167fc2009a02acf3..b8698dd91d36f348cc173554872fe7b5ade090eb 100644 --- a/pub/lib/obj.hpp +++ b/pub/lib/obj.hpp @@ -47,8 +47,8 @@ class CObjNum : public CObj public: CObjNum() : CObj() {} bool is_vec() const { return false; } - virtual double to_dr() const { return 0.; } - virtual double to_dr(int i) const { return 0.; } +// virtual double to_dr() const { return 0.; } +// virtual double to_dr(int i) const { return 0.; } virtual RObjVecNum to_vec(int repetitions) const = 0; }; diff --git a/pub/lib/plot.cpp b/pub/lib/plot.cpp index 318c7e2ccce8a52092e769f907b89d1ed57bfb29..d96fd4b7445573ad3acb12da9c2a1905ac93c986 100644 --- a/pub/lib/plot.cpp +++ b/pub/lib/plot.cpp @@ -435,8 +435,9 @@ namespace { static vector<int> JSel; static int pstyle = 1, cstyle = 1; - static string jSel = ""; + static CCoord xCo, yCo; + // Get J selection. if (mode == "ask") { JSelAsk("Plot which spectra", JSel); } else { @@ -451,24 +452,28 @@ namespace { cout << "plotting spectra " << triv::indices_to_s(JSel) << "\n"; } - if (!add) { // prepare frame (ranges, labels) + // Prepare frame (ranges, labels). + if (!add) { pstyle = 1; cstyle = 1; if (!plot->X.finite()) determine_Xrange(plot, JSel); if (!plot->Y.finite()) determine_Yrange(plot, JSel); - - // build label: (zur Zeit nur vom ersten File; definiere +=) - CCoord xCo = SFSel::instance()->sel_first()->xco; - CCoord yCo = SFSel::instance()->sel_first()->yco; - - // draw new frame: + xCo = CCoord(); + yCo = CCoord(); + } + while (const COlo* f = fiter.next()) { + xCo.merge(f->xco); + yCo.merge(f->yco); + } + if (!add) { plot->start_frame1D("Frida version " VERSION, xCo.str_ps(), yCo.str_ps()); } else - plot->reopen_frame1D(); + plot->reopen_frame1D("Frida version " VERSION, xCo.str_ps(), yCo.str_ps()); - // plot: + // Plot slices. + fiter.reset(); while (const COlo* f = fiter.next()) { int k = fiter.k(); const COld* fd = dynamic_cast<const COld*>(f); @@ -590,9 +595,8 @@ namespace { plot->write_postscript( triv::wordexp_unique(fname), "overwrite", true, SVariRegistry::instance()->to_sMap()); cout << "Plotted to " << fname << "\n"; - PObj pViewer = SVariRegistry::instance()->find("ps_viewer"); - if (pViewer) - system((pViewer->to_s()+" "+fname+"&").c_str()); + string viewer = CNode::eval("ps_viewer")->to_s(); + system((viewer+" "+fname+"&").c_str()); } } // anonymous namespace diff --git a/pub/lib/toplevel.cpp b/pub/lib/toplevel.cpp index 350192fbf93eeaacb3277cc311689de6f3f05e92..da48a2f06cf1094efd50fe2ec455eb9b25ba8990 100644 --- a/pub/lib/toplevel.cpp +++ b/pub/lib/toplevel.cpp @@ -187,7 +187,7 @@ void CFrida::interactive() cout << "'" << cmdline << "' failed:\n " << ex << "\n"; NMacro::clear(); } catch (const char* ex) { - cout << "BUG: '" << cmdline << "' failed with unforeseen message:\n " << ex << "\n"; + cout << "'" << cmdline << "' failed:\n " << ex << "\n"; NMacro::clear(); } catch (std::exception& ex) { cout << "BUG: '" << cmdline << "' failed with unforeseen std exception:\n " @@ -222,6 +222,13 @@ void CFrida::execute_file(const string& fnam, bool batchMode) exit(1); } throw msg; + } catch (const char* ex) { + string msg = "'" + cmdline + "':\n " + ex; + if (batchMode) { + std::cerr << msg << "\n"; + exit(1); + } + throw msg; } catch (...) { string msg = "'" + cmdline + "':\n unforeseen exception type"; if (batchMode) { diff --git a/pub/plot/dualplot.cpp b/pub/plot/dualplot.cpp index b4ec369a678a66a6167e3991ac0f396eccb35dc4..ae7f057d66f061fb384079eb3fcb7688e0d04a9b 100644 --- a/pub/plot/dualplot.cpp +++ b/pub/plot/dualplot.cpp @@ -118,16 +118,18 @@ void CPlot::set_aux(const string& cmd) void CPlot::start_frame1D(const string& caller, const string& xlabel, const string& ylabel) { gnuPlotter->start_frame(X, Y); - ps_Plotter->start_frame1D(caller, X, Y, xlabel, ylabel); + ps_Plotter->start_frame1D(caller, X, Y); + ps_Plotter->set_labels(xlabel, ylabel); open1D = true; } //! Start adding to plot. -void CPlot::reopen_frame1D() +void CPlot::reopen_frame1D(const string& caller, const string& xlabel, const string& ylabel) { if (!open1D) throw S("plot frame is not open for adding"); + ps_Plotter->set_labels(xlabel, ylabel); } //! Clear 2D plot canvas, and print coordinate ranges diff --git a/pub/plot/dualplot.hpp b/pub/plot/dualplot.hpp index ea79c7afb80e7b8c8710861db01fe494c9f24d66..4c0729a390c8fe8ae7b79d85d2ebb18ca82a4a1a 100644 --- a/pub/plot/dualplot.hpp +++ b/pub/plot/dualplot.hpp @@ -40,7 +40,8 @@ public: void gp_write(const std::string& in); void start_frame1D( const std::string& caller, const std::string& xlabel, const std::string& ylabel); - void reopen_frame1D(); + void reopen_frame1D( + const std::string& caller, const std::string& xlabel, const std::string& ylabel); void start_frame2D(const std::string& caller); void close_frame2D( const std::string& xlabel, const std::string& zlabel, const std::string& ylabel); diff --git a/pub/plot/gnuplotter.cpp b/pub/plot/gnuplotter.cpp index 346942b05650da619c5f4cb7a225aec112e2fa2d..762fe6e3631f315b0d79f7f136ac9d7d88b8d0f7 100644 --- a/pub/plot/gnuplotter.cpp +++ b/pub/plot/gnuplotter.cpp @@ -86,8 +86,9 @@ void CGnuPlotter::add_spec( const vector<string>& zentries, const string& xco, const string& yco, const string& info) { - static const int mColor = 6; - static int color[mColor] = { 0x880000, 0x008800, 0x000088, 0x006666, 0x660066, 0x666600 }; + static vector<int> ccolor = { 0x880000, 0x008800, 0x000088, 0x006666, 0x660066, 0x666600 }; + static vector<int> pcolor = { 0x5050ff, 0xff0000, 0x00a000, 0xff00ff, 0x00a0c0, 0xa0522d, + 0xffa500, 0xff7f50, 0x40d020 }; // Checks: int np = xp.size(); if (!np) @@ -99,11 +100,16 @@ void CGnuPlotter::add_spec( string gp_fnam = str(format("/tmp/%s-%i-%03i.gnu") % getenv("LOGNAME") % iPlot % gp_fno++); if (gp_fnames != "") gp_fnames += ", "; - gp_fnames += string("\"") + gp_fnam + "\" notitle"; + gp_fnames += "\"" + gp_fnam + "\" notitle"; if (as_line) - gp_fnames += str(format(" with lines lt 1 lc rgb \"#%6x\"") % color[style_no % mColor]); - else if (plot_errorbars && dyp.size()) - gp_fnames += " with errorbars"; + gp_fnames += str(format(" with lines lt 1 lc rgb \"#%6x\"") + % ccolor[(style_no-1) % ccolor.size()]); + else { + gp_fnames += str(format(" with points pt %i lc rgb \"#%6x\" lw 2") + % style_no % pcolor[(style_no-1) % pcolor.size()]); + if (plot_errorbars && dyp.size()) + gp_fnames += " with errorbars"; + } FILE* gp_fd; if (!(gp_fd = fopen(gp_fnam.c_str(), "w"))) throw "cannot save gnuplot data to " + gp_fnam; @@ -111,12 +117,11 @@ void CGnuPlotter::add_spec( try { for (int i = 0; i < np; i++) { if (std::isinf(xp[i]) || std::isinf(yp[i])) - throw "Data point number " + S(i) + " is invalid: x=" + S(xp[i]) + ", y=" - + S(yp[i]); + throw "Data point number "+S(i)+" is invalid: x="+S(xp[i])+", y="+S(yp[i]); if (xp[i] < X->inf || xp[i] > X->sup) - throw "CPlot::addSpec: x[" + S(i) + "]=" + S(xp[i]) + " out of range"; + throw "CPlot::addSpec: x["+S(i)+"]="+S(xp[i])+" out of range"; if (yp[i] < Y->inf || yp[i] > Y->sup) - throw "CPlot::addSpec: y[" + S(i) + "]=" + S(yp[i]) + " out of range"; + throw "CPlot::addSpec: y["+S(i)+"]="+S(yp[i])+" out of range"; if (plot_errorbars && dyp.size()) fprintf(gp_fd, "%20.13g %20.13g %20.13g\n", xp[i], yp[i], dyp[i]); else diff --git a/pub/plot/ps_plotter.cpp b/pub/plot/ps_plotter.cpp index 1e63ea0ecd605644059d2aa233a7ec95f7820d92..ba3892a00bfafc49eaf89f3fbbb9535f646c64f8 100644 --- a/pub/plot/ps_plotter.cpp +++ b/pub/plot/ps_plotter.cpp @@ -39,34 +39,32 @@ namespace { const string& fname, const string& doc_lines); } -void CPS_Plotter::start_frame1D( - const string& caller, const CAxis& _X, const CAxis& _Y, - const string& xlabel, const string& ylabel) +void CPS_Plotter::start_frame1D(const string& _caller, const CAxis& _X, const CAxis& _Y) { p2D = false; + caller = _caller; X = &_X; Y = &_Y; ps_snum = 0; ps_Doc = ""; - ps_accu = "\n%% output created by " + caller + "\n\n"; - ps_accu += ps_coord(X); - ps_accu += ps_coord(Y); - ps_accu += "\n"; - ps_accu += ps_axis(X) + ps_horiz(xlabel); - ps_accu += ps_axis(Y) + ps_verti(ylabel); - ps_accu += "\n"; +} + +void CPS_Plotter::set_labels(const std::string& _xlabel, const std::string& _ylabel) +{ + xlabel = _xlabel; + ylabel = _ylabel; } void CPS_Plotter::start_frame2D( - const std::string& caller, const CAxis& _X, const CAxis& _Z, const CAxis& _Y) + const std::string& _caller, const CAxis& _X, const CAxis& _Z, const CAxis& _Y) { p2D = true; + caller = _caller; X = &_X; Z = &_Z; Y = &_Y; ps_snum = 0; ps_Doc = ""; - ps_accu = "\n%% output created by " + caller + "\n\n"; ps_accu += ps_coord(X); ps_accu += ps_coord(Z); ps_accu += ps_coord(Y); @@ -144,6 +142,15 @@ void CPS_Plotter::write_data(const string& fname) if (!triv::file_exists(fname)) throw "BUG: after copying headers, graphic output file " + fname + " still doesn't exist"; std::fstream fs(fname, std::fstream::out | std::fstream::app); + fs << "\n%% output created by " << caller << "\n\n"; + if (!p2D) { + fs << ps_coord(X); + fs << ps_coord(Y); + fs << "\n"; + fs << ps_axis(X) + ps_horiz(xlabel); + fs << ps_axis(Y) + ps_verti(ylabel); + fs << "\n"; + } fs << ps_accu; fs << ps_footer(fname, ps_Doc); fs.close(); diff --git a/pub/plot/ps_plotter.hpp b/pub/plot/ps_plotter.hpp index edc39be074064a123d01d459ee919fbc58bb92a2..d874f1b892a45f495fc806fa9699a77e1b99d5dc 100644 --- a/pub/plot/ps_plotter.hpp +++ b/pub/plot/ps_plotter.hpp @@ -18,9 +18,8 @@ public: CPS_Plotter() {} CPS_Plotter(CPS_Plotter const&) = delete; CPS_Plotter& operator=(CPS_Plotter const&) = delete; - void start_frame1D( - const std::string& caller, const CAxis& _X, const CAxis& _Y, - const std::string& xlabel, const std::string& ylabel); + void start_frame1D(const std::string& caller, const CAxis& _X, const CAxis& _Y); + void set_labels(const std::string& _xlabel, const std::string& _ylabel); void start_frame2D( const std::string& caller, const CAxis& _X, const CAxis& _Z, const CAxis& _Y); void close_frame2D( @@ -43,6 +42,8 @@ private: const CAxis* Y; const CAxis* Z; int ps_snum; //!< Slice number in Postscript file. + std::string caller; + std::string xlabel, ylabel; std::string ps_accu; //!< Main Postscript cache. std::string ps_Doc; //!< Special Postscript cache for doc lines ?. }; diff --git a/pub/readplus/macro.hpp b/pub/readplus/macro.hpp index 79d1268c647f8254814652630bac8d18b9761774..fe6567d2d129c0b7c2ba44b14ac1107578de05b6 100644 --- a/pub/readplus/macro.hpp +++ b/pub/readplus/macro.hpp @@ -5,6 +5,8 @@ //* http://apps.jcns.fz-juelich.de //************************************************************************************************** +#include <string> + //! Outer readline wrapper, input stack, macro engine. namespace NMacro diff --git a/pub/share/CMakeLists.txt b/pub/share/CMakeLists.txt index 6868d3575fdb3f87a3b2bc1630071fde1327c462..2470ee348de4755697659c99afee521a47750707 100644 --- a/pub/share/CMakeLists.txt +++ b/pub/share/CMakeLists.txt @@ -5,6 +5,6 @@ set(share_files setup1D.ps setup2D.ps continuation.ps - gnuplot-default-symbols.eps + plot_symbol_legend.ps ) install(FILES ${share_files} DESTINATION ${CMAKE_INSTALL_PREFIX}/share/frida) diff --git a/pub/share/frida.ini.in b/pub/share/frida.ini.in index 7981537aafecc16aaf6833deaf9ccddec4695275..dc42ea8c8d49fb86ce642235541118d27d91ec3d 100644 --- a/pub/share/frida.ini.in +++ b/pub/share/frida.ini.in @@ -4,7 +4,7 @@ ps_setup1D="${CMAKE_INSTALL_PREFIX}/share/frida/setup1D.ps" ps_setup2D="${CMAKE_INSTALL_PREFIX}/share/frida/setup2D.ps" ps_continuation="${CMAKE_INSTALL_PREFIX}/share/frida/continuation.ps" ps_definitions="${CMAKE_INSTALL_PREFIX}/share/frida/wups17a.ps" -psgsym="${CMAKE_INSTALL_PREFIX}/share/frida/gnuplot-default-symbols.eps" +plot_symbol_legend="${CMAKE_INSTALL_PREFIX}/share/frida/plot_symbol_legend.ps" ps_viewer="evince" FK01="pv" FK02="pn" diff --git a/pub/share/gnuplot-default-symbols.eps b/pub/share/plot_symbol_legend.ps similarity index 92% rename from pub/share/gnuplot-default-symbols.eps rename to pub/share/plot_symbol_legend.ps index beb27722486b9dbb74745563aa3087a2cafe1840..7659564aed47a29d65a2a66d901a163333ae9ae3 100644 --- a/pub/share/gnuplot-default-symbols.eps +++ b/pub/share/plot_symbol_legend.ps @@ -26,7 +26,7 @@ %% Framework: % For interleaving applications, isolate what follows in a dictionary -/WuGdict11a 400 dict def +/WuGdict11a 400 dict def WuGdict11a begin @@ -80,13 +80,13 @@ WuGdict11a begin % upper left corner. Therefore we need a vertical translation, % depending on the paper size. A4 is 210x297 mm^2. By this occasion, % we also provide a border of 7 mm. -/cmtranslate { % x y cmtranslate | - +/cmtranslate { % x y cmtranslate | - cm x cm x translate } bind def /originUpperLeft_A4{ .7 28.3 cmtranslate } bind def /EdgeLeftDIN{ originUpperLeft_A4 } bind def % OBSOLETE since 11a % set absolute global scale and relative symbol size -/defsiz { % size(cm) symbolsize(rel) | - +/defsiz { % size(cm) symbolsize(rel) | - /ftot x def cm 10 div dup scale % within 'size', coordinates run from 0 to 10 } def @@ -108,14 +108,14 @@ WuGdict11a begin /geld {0.759836 mul} bind def /Geld {0.759836 div} bind def % sqrt(sqrt(3)) /gald {0.817765 mul} bind def /Gald {0.817765 div} bind def % sqrt sqrt sqrt 5 -% define frame coordinates +% define frame coordinates /defred { % x_reduction y_reduction label_reduction | - - /fmm x ftot mul def - /ymm x def + /fmm x ftot mul def + /ymm x def /xmm x def % conversion frame_coordinate -> global_coord - /xm {xmm mul} bind def + /xm {xmm mul} bind def /ym {ymm mul} bind def /fm {fmm mul} bind def /xym {ym x xm x} bind def @@ -228,7 +228,7 @@ WuGdict11a begin } def /iCol3 { % i i_max | - : siemens div /icnow x def - 165 1 icnow sub mul + 165 1 icnow sub mul 102 icnow mul 33 120 icnow mul add setRGBcolor } def @@ -249,7 +249,7 @@ WuGdict11a begin 0 max aCol length 1 sub min % offset safe_idx dup 1 add aCol length 1 sub min % offset i i+1 aCol x get exec - 4 3 roll aCol x get exec colormix setRGBcolor + 4 3 roll aCol x get exec colormix setRGBcolor } def @@ -294,15 +294,15 @@ WuGdict11a begin { 30 30 130 } % 20 ] def /aCol3 [ % siemenscolors - { 221 102 102 } % siemenspink - { 165 0 33 } % siemensred - { 255 153 0 } % siemensorange - { 255 221 0 } % siemensyellow - { 33 153 102 } % siemensgreen - { 0 102 153 } % siemensblue - { 0 51 102 } % siemenstext - { 102 102 102 } % siemensdark - { 221 221 221 } % siemensgrey + { 221 102 102 } % siemenspink + { 165 0 33 } % siemensred + { 255 153 0 } % siemensorange + { 255 221 0 } % siemensyellow + { 33 153 102 } % siemensgreen + { 0 102 153 } % siemensblue + { 0 51 102 } % siemenstext + { 102 102 102 } % siemensdark + { 221 221 221 } % siemensgrey ] def /aCol4 [ % green-blue-brown { 120 160 60 } @@ -327,15 +327,16 @@ WuGdict11a begin { 120 80 30 } { 100 60 20 } ] def -/aCol5 [ % gnuplot default (see man gnuplot and rgb.txt) +/aCol7 [ % default colors, modified from old gnuplot version + { 80 80 255 } % blue { 255 0 0 } % red - { 0 255 0 } % green - { 0 0 255 } % blue + { 0 160 0 } % dark green { 255 0 255 } % magenta - { 0 255 255 } % cyan + { 0 160 192 } % dark cyan { 160 82 45 } % sienna { 255 165 0 } % orange - { 255 127 80 } % coral + { 255 127 80 } % coral + { 64 224 32 } % light greenish ] def @@ -370,7 +371,7 @@ WuGdict11a begin %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Fonts and Text Blocks %% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%Gn%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Prepare standard fonts: @@ -397,8 +398,8 @@ WuGdict11a begin %% Preset standard styles: % scale and set font; define fontsize, fontheight -/setfontandsize { % font size | - - dup 0 le { pop 100 } if % fontsize <= 0 not allowed ! +/setfontandsize { % font size | - + dup 0 le { pop 100 } if % fontsize <= 0 not allowed ! /fontnonnil true def pt fm dup /fontsize x def x findfont @@ -477,12 +478,12 @@ WuGdict11a begin /gbuild { % string xrel yrel obj | - : plot obj above/below string /obj x def /yrelbui x def /xrelbui x def /Symbol findfont fontsize scalefont setfont - dup showif + dup showif prepare { pop regularfont setfont } { stringwidth pop xrelbui neg mul fontheight yrelbui mul % relpos for obj currentpoint 4 2 roll % save position after string - regularfont setfont + regularfont setfont rm obj pop % obj must end with () that will be pop'ed mv % back to saved position } @@ -496,11 +497,11 @@ WuGdict11a begin x showif .8 .65 {(\136) show ()} gbuild } def -/tilde { +/tilde { x showif 1. .6 {(~) show ()} build } def -/gtilde { +/gtilde { x showif 1. .6 {(~) show ()} gbuild } def @@ -510,26 +511,26 @@ WuGdict11a begin % the following macros use the symbol/curve plotting mechanism /pins { % string symins - ; symbol must be selected by pset - showif + showif ( ) showif ( ) .5 .5 { currentxy 0 p black ()} build ( ) showif } def /clenins { % string len clenins - ; curve must be selected by cset x showif % I suppose that pins is preceeded by 8 spaces - dup ( ) stringwidth pop mul 2 add /xstrich x xmm div def - % length of inserted curve : + dup ( ) stringwidth pop mul 2 add /xstrich x xmm div def + % length of inserted curve : % -1 space : curve begins and ends in middle of ( ) % +3 spaces: pins requires 3 times ( ) - ( ) 0 .5 { currentxy currentxy 0 ci x xstrich add x 0 cf () } build + ( ) 0 .5 { currentxy currentxy 0 ci x xstrich add x 0 cf () } build 2 add {( ) showif} repeat } def /cins { % string symins - ; curve must be selected by cset showif 8 % I suppose that pins is preceeded by 8 spaces dup ( ) stringwidth pop mul 2 add /xstrich x xmm div 10 div def % nov03, ohne zu verstehen, "10 div" eingefuegt - % length of inserted curve : + % length of inserted curve : % -1 space : curve begins and ends in middle of ( ) % +3 spaces: pins requires 3 times ( ) - ( ) 0 .5 { currentxy currentxy 0 ci x xstrich add x 0 cf () } build + ( ) 0 .5 { currentxy currentxy 0 ci x xstrich add x 0 cf () } build 2 add {( ) showif} repeat } def @@ -541,10 +542,10 @@ WuGdict11a begin blabla endall % first pass : determine xwidth boxif { /boxwidth xwidth (M) stringwidth pop boxxr mul 2 mul add def /boxheight fontheight 1 boxyr 2 mul add mul def - np xpos xwidth xrel mul sub boxwidth xwidth sub 2 div sub - ypos fontheight .5 boxyr add mul sub mv + np xpos xwidth xrel mul sub boxwidth xwidth sub 2 div sub + ypos fontheight .5 boxyr add mul sub mv boxwidth 0 rl 0 boxheight rl boxwidth neg 0 rl cp - boxproc + boxproc } if xpos xwidth xrel mul sub ypos fontheight yrel mul sub mv /prepare false def @@ -574,7 +575,7 @@ WuGdict11a begin xwidth % has been determined } def /textw { % obj textW y : dito, in 0..10-units - textW xmm div + textW xmm div } def % horizontal text: x y ob | - @@ -618,8 +619,8 @@ WuGdict11a begin %% Layout presets: -/xyTicLen {0.10 fm} def -/xyTacLen {0.20 fm} def +/xyTicLen {0.10 fm} def +/xyTacLen {0.20 fm} def /txllen {0.20 fm} def /tyllen {0.20 fm} def /linsetAxx {black 0.7 setline} def @@ -647,9 +648,9 @@ WuGdict11a begin %% Some more presets for g3.ps: -/zValues { pop pop } def +/zValues { pop pop } def /plotafter {} def -/whiteframe { 1 0 0 10 10 graybox } def +/whiteframe { 1 0 0 10 10 graybox } def /plotframes { xPlotFrame yPlotFrame } def /plotbefore { plotframes } def @@ -663,21 +664,21 @@ WuGdict11a begin % set tick array - internal macros /tiputs { % rel_pos_of_tick | pos_of_tick : innermost routine for /taproc - tastep mul taloop add - } def + tastep mul taloop add + } def /taproclin { % (#tick/tack) | - : define /taproc for use in SetVec 1 x div /tistep x def /taproc { 0 tistep .999 { tiputs } for } def } def /taproclog { % (#ticks/tacks) | - : define /taproc for use in SetVec - dup 3 gt { pop /taproc { 1 1 9 { log tiputs } for } def - }{ dup 1 gt { pop /taproc { 0 tiputs 2 log tiputs 5 log tiputs } def - }{ dup 0 gt { pop /taproc { 0 tiputs } def - }{ neg taproclin + dup 3 gt { pop /taproc { 1 1 9 { log tiputs } for } def + }{ dup 1 gt { pop /taproc { 0 tiputs 2 log tiputs 5 log tiputs } def + }{ dup 0 gt { pop /taproc { 0 tiputs } def + }{ neg taproclin } ifelse } ifelse } ifelse } def /SetVec { % tafro tatoo nta /vector | - : set /vector - 4 1 roll + 4 1 roll /nta x def /tatoo x def /tafro x def /tastep tatoo tafro sub nta 1 sub div def [ @@ -688,8 +689,8 @@ WuGdict11a begin ] def } def % set tick array - user commands -/SetTicVecLin { taproclin /TicVec SetVec } def -/SetTicVecLog { taproclog /TicVec SetVec } def +/SetTicVecLin { taproclin /TicVec SetVec } def +/SetTicVecLog { taproclog /TicVec SetVec } def % set tack-and-number array /SetTacVec { % [ pos {label} pos {label} ... ] | - @@ -700,7 +701,7 @@ WuGdict11a begin % note on angles : 0 = x-axis, 90 = y-axis /OneAxx { % fro to xpos ypos aang tang | - : presets for Axx, Tic, Tac, Num % store arguments - /tAng x def /aAng x def + /tAng x def /aAng x def /yPos x def /xPos x def /aTo x def /aFro x def % set constants @@ -755,7 +756,7 @@ WuGdict11a begin } def /TicProc { % aPos | - : default procedure to plot one tick np - xPos yPos xym mv + xPos yPos xym mv dup xAng mul x yAng mul xym rm % eat argument, go to start pos. xTicLen yTicLen rl st } def @@ -774,7 +775,7 @@ WuGdict11a begin linsetGri TicVec { 3 copy dup 5 -1 roll aFro lt x aTo gt or {pop pop pop} { - dup % x1 x2 y y + dup % x1 x2 y y 4 -1 roll x xym np mv % x2 y xym li st } ifelse @@ -801,7 +802,7 @@ WuGdict11a begin } def /Tac { linsetTac - { pop xPos yPos xym mv + { pop xPos yPos xym mv aPos dup xAng mul x yAng mul xym rm xTacLen yTacLen rl st } TacExe @@ -834,7 +835,7 @@ WuGdict11a begin setnum fontheight ymm div yDisRel mul tAng sin mul /yDist x def { dup textW xDisRel mul tAng cos mul /xDist x def - xPos aPos xAng mul add xDist sub + xPos aPos xAng mul add xDist sub yPos aPos yAng mul add yDist sub 3 2 roll textCM } TacExe } def /setnumDisRel { % xDisRel yDisRel | - : adjust just a little bit @@ -842,19 +843,19 @@ WuGdict11a begin } def 1.2 1.2 setnumDisRel % default setting % explicit Num routines for rectangular case -/xNumL { % : numbers on low x axis +/xNumL { % : numbers on low x axis setnum { fontheight ymm div % conversion -> user_scale dup /xNumHeightL x def -.6 mul yPos add aPos x 3 2 roll textCT } TacExe } def -/xNumH { % : numbers on high x axis +/xNumH { % : numbers on high x axis setnum { fontheight ymm div % conversion -> user_scale dup /xNumHeightH x def .6 mul yPos add aPos x 3 2 roll textCB } TacExe } def -/yNumL { % : numbers on low y axis +/yNumL { % : numbers on low y axis setnum { fontsize -.3 mul xmm div xPos add aPos 3 2 roll textRM xwidth dup yNumLengthL gt {/yNumLengthL x def} {pop} ifelse @@ -869,7 +870,7 @@ WuGdict11a begin setnum textW dup yNumLengthL gt {/yNumLengthL x def} {pop} ifelse } def -/yNumH { % : numbers on high y axis +/yNumH { % : numbers on high y axis setnum { fontsize .3 mul xmm div xPos add aPos 3 2 roll textLM xwidth dup yNumLengthH gt {/yNumLengthH x def} {pop} ifelse @@ -927,7 +928,7 @@ WuGdict11a begin grestore } def - + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Data Plotting (Symbols and Curves) %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -946,7 +947,7 @@ WuGdict11a begin /serrglo x def % plot error bars? 0=never, 1=always, 2=as_given_in_pset /slinglo x def % symbol linewidth multiplier /sradglo x def % symbol size multiplier - } def + } def %% Retrieve presets from style array: @@ -958,7 +959,7 @@ WuGdict11a begin 3 2 roll % A n i dup 0 le { pop pop pop ostyle % chosen_number<=0 means: don't plot - } { + } { 1 sub x % A i-1 n mod get % A(i-1) exec @@ -970,7 +971,7 @@ WuGdict11a begin /pset { % styp sfill serr srad slin | - % arg -> symbol linewidth - /slin x slinglo mul def + /slin x slinglo mul def % arg -> symbol size /srad x fm 0.16 mul sradglo mul def % arg -> plot error bar? @@ -979,7 +980,7 @@ WuGdict11a begin % arg -> fill the symbol? (0=open, 1=full, 2=colored_with_black_border) /sfill x def % adjust srad: it's the _outer_ radius - % TROUBLE sfill 1 ne {/srad srad slin fm pt sub def} if + % TROUBLE sfill 1 ne {/srad srad slin fm pt sub def} if % arg -> symbol type /ps {pop pop} def % default: don't plot (maybe we only want an error bar) dup 1 eq {/ps {ps_square} def} if @@ -996,9 +997,9 @@ WuGdict11a begin dup 12 eq {/ps {ps_cross} def} if dup 13 eq {/ps {ps_star} def} if pop - % + % /t { % x y d[- d+] | - : plot a symbol and eventually an error bar. - err_asy not { dup } if + err_asy not { dup } if 4 copy pop pop plot_symbol plot_errorbar } bind def @@ -1031,7 +1032,7 @@ WuGdict11a begin /ti { nopoint } def /t { nopoint } def /tf { nopoint } def -} def +} def /nopoint { % x y d[- d+] | - pop pop pop err_asy { pop } if } def @@ -1152,7 +1153,7 @@ WuGdict11a begin .7 dup 120 pol2xy np mv 300 pol2xy li st .7 dup 240 pol2xy np mv 60 pol2xy li st } bind def - + %% Set column plotting (use this instead of pset) - BROKEN in 11a or earlier @@ -1190,7 +1191,7 @@ WuGdict11a begin fontheight ymm div nl_advance mul mul /nl_yins x nl_yins x sub def } def } def -/newlist { 1.65 NewList } def +/newlist { 1.65 NewList } def /TxLine { % text TxLine - nl_xins nl_yins 3 -1 roll textLM newline } bind def @@ -1207,50 +1208,50 @@ WuGdict11a begin newline } bind def /PtPtCvTxLine { % pstyle pstyle cstyle text | - - 4 3 roll pstyle nl_xins nl_yins 0 t - 3 2 roll pstyle nl_xins nl_xshift add nl_yins 0 t + 4 3 roll pstyle nl_xins nl_yins 0 t + 3 2 roll pstyle nl_xins nl_xshift add nl_yins 0 t x cstyle - nl_xins nl_xshift 2 mul add - dup dup nl_xshift nl_xrline mul sub nl_yins 0 ti + nl_xins nl_xshift 2 mul add + dup dup nl_xshift nl_xrline mul sub nl_yins 0 ti nl_xshift nl_xrline mul add nl_yins 0 tf nl_xshift add nl_yins 3 2 roll black textLM newline } bind def /PtCvTxLine { % pstyle cstyle text | - - 3 2 roll pstyle nl_xins nl_yins 0 t + 3 2 roll pstyle nl_xins nl_yins 0 t x cstyle - nl_xins nl_xshift 1 mul add - dup dup nl_xshift -.33 mul add nl_yins 0 ti + nl_xins nl_xshift 1 mul add + dup dup nl_xshift -.33 mul add nl_yins 0 ti nl_xshift 0.33 mul add nl_yins 0 tf nl_xshift add nl_yins 3 2 roll black textLM newline } bind def /PtPtTxLine { % pstyle pstyle text | - - 3 2 roll pstyle nl_xins nl_yins 0 t + 3 2 roll pstyle nl_xins nl_yins 0 t x pstyle nl_xins nl_xshift add nl_yins 0 t black nl_xins nl_xshift 2 mul add nl_yins 3 2 roll textLM newline } bind def /CvTxLine { % cstyle text | - - x cstyle - nl_xins fontsize xmm div nl_xrline mul 0 mul sub nl_yins 0 ti - nl_xins fontsize xmm div nl_xrline mul 3 mul add nl_yins 0 tf + x cstyle + nl_xins fontsize xmm div nl_xrline mul 0 mul sub nl_yins 0 ti + nl_xins fontsize xmm div nl_xrline mul 3 mul add nl_yins 0 tf black nl_xins nl_xshift 1.5 mul add nl_yins 3 2 roll textLM newline } bind def /Cv2TxLine { % cstyle text | - - x cstyle - nl_xins fontsize xmm div nl_xrline mul sub nl_yins 0 ti - nl_xins fontsize xmm div nl_xrline mul add nl_xshift add nl_yins 0 tf + x cstyle + nl_xins fontsize xmm div nl_xrline mul sub nl_yins 0 ti + nl_xins fontsize xmm div nl_xrline mul add nl_xshift add nl_yins 0 tf black nl_xins nl_xshift 2 mul add nl_yins 3 2 roll textLM newline } bind def /PCTxLine { % pstyle(with plset) text | - - x pstyle - nl_xins fontsize xmm div nl_xrline 2 mul mul sub nl_yins 0 ci - nl_xins fontsize xmm div nl_xrline 2 mul mul add nl_yins 0 cf + x pstyle + nl_xins fontsize xmm div nl_xrline 2 mul mul sub nl_yins 0 ci + nl_xins fontsize xmm div nl_xrline 2 mul mul add nl_yins 0 cf nl_xins yins 0 t - black nl_xins + black nl_xins fontsize xmm div 1.9 mul % instead of xshift add nl_yins 3 2 roll textLM newline @@ -1284,7 +1285,7 @@ WuGdict11a begin neg 0 x rl % line down } def /execOval { % xl yl dx dy dr { proc } | - % works only in quadratic grid - x 6 2 roll + x 6 2 roll 4 2 roll % proc dr dx dy xl yl gsave xym translate @@ -1392,24 +1393,24 @@ WuGdict11a begin 0 0 np mv 0 li st grestore } def - -/knautschy { % x0 y0 y_knau y_tot knautschy - : insert an S in dived y-axis + +/knautschy { % x0 y0 y_knau y_tot knautschy - : insert an S in dived y-axis % the total height of the generated object is y_tot % of which y_knau(.le. y_tot) is for the real knautsch, % the remainder is for vertical prolongations. - x ym 4 div dup /tmpy x def 5 sqrt mul /tmpx x def + x ym 4 div dup /tmpy x def 5 sqrt mul /tmpx x def /tmpa x ym tmpy 4 mul sub 2 div def - np ym x xm x mv 0 tmpa rl tmpx tmpy rl tmpx -2 mul tmpy 2 mul rl + np ym x xm x mv 0 tmpa rl tmpx tmpy rl tmpx -2 mul tmpy 2 mul rl tmpx tmpy rl 0 tmpa rl st } def -/separy { % x0 y0 sep lng ang lin - : insert an // in dived y-axis +/separy { % x0 y0 sep lng ang lin - : insert an // in dived y-axis setline - /spang x def + /spang x def /splng x def /spsep x def - 2 copy spsep sub gsave offset spang rotate + 2 copy spsep sub gsave offset spang rotate splng -.5 mul fm 0 np mv splng fm 0 rl st grestore - spsep add gsave offset spang rotate + spsep add gsave offset spang rotate splng -.5 mul fm 0 np mv splng fm 0 rl st grestore } def @@ -1433,7 +1434,7 @@ WuGdict11a begin 4 1 roll 0 3 2 roll bmszRT x rtextCM % hlw dx/2 dup 2 mul 3 1 roll x sub dup % dx len len 0 0 180 4 -1 roll bmszSZ bmszTH arrow % dx len - x 0 0 4 -1 roll bmszSZ bmszTH arrow + x 0 0 4 -1 roll bmszSZ bmszTH arrow grestore } def @@ -1469,7 +1470,7 @@ WuGdict11a begin /ueV{ grec (m) endgr (eV) showif} bind def /inueV { showif (\() grec (m) endgr (eV\)) showif } bind def /inmeVr { showif (\(meV) supsc (-1) endsc (\)) showif } bind def -/inueVr { showif (\() grec (m) endgr (eV) +/inueVr { showif (\() grec (m) endgr (eV) supsc (-1) endsc (\)) showif } bind def /inGHzr { showif (\(GHz) (-1) sp (\)) showif } def @@ -1510,7 +1511,7 @@ WuGdict11a begin %% Position and scale: -originUpperLeft_A4 +originUpperLeft_A4 10 dup autolabel defsiz 1 dup geld stdred 2. -11 offset @@ -1519,7 +1520,7 @@ originUpperLeft_A4 1 1 language 0 0 InfSet % plot fnam, info -1 dup 2 SymGSet % srad slin serr(2=from pset) : graph symbols, global preset +1 2 2 SymGSet % srad slin serr(2=from pset) : graph symbols, global preset % /setboxbackgroundcolor { 0.93 setgray } def % default is white 2 8 24 abcset % usage: {(text)} abc /EndFrame { showpage end } def @@ -1527,7 +1528,7 @@ originUpperLeft_A4 %% Symbols and curve styles: F /pcol x def % black&white on/off -{ 8 aCol5 iColA } /ipCol x bind def % number of colours and colour style +{ 9 aCol7 iColA } /ipCol x bind def % number of colours and colour style /pStyles [ { pcol { 1 1 0 1. 1. pset } { 11 0 0 1. 1. pset 0 ipCol } ifelse } { pcol { 1 0 0 1. 1. pset } { 12 1 0 1. 1. pset 1 ipCol } ifelse } @@ -1538,12 +1539,12 @@ F /pcol x def % black&white on/off { pcol { 3 0 0 1. 1. pset } { 3 0 0 1. 1. pset 5 ipCol } ifelse } { pcol { 4 1 0 1. 1. pset } { 3 1 0 .7 1. pset 6 ipCol } ifelse } { pcol { 4 0 0 1. 1. pset } { 4 0 0 1. 1. pset 7 ipCol } ifelse } -{ pcol { 5 1 0 1. 1. pset } { 4 1 0 .7 1. pset 0 ipCol } ifelse } -{ pcol { 5 0 0 1. 1. pset } { 5 0 0 1. 1. pset 1 ipCol } ifelse } +{ pcol { 5 1 0 1. 1. pset } { 4 1 0 .7 1. pset 8 ipCol } ifelse } +{ pcol { 5 0 0 1. 1. pset } { 5 0 0 1. 1. pset 0 ipCol } ifelse } -{ pcol { 5 0 0 1. 1. pset } { 5 1 0 .7 1. pset 2 ipCol } ifelse } -{ pcol { 3 0 0 1. 1. pset } { 2 0 0 1. 1. pset 3 ipCol } ifelse } -{ pcol { 4 1 0 1. 1. pset } { 2 1 0 .7 1. pset 4 ipCol } ifelse } +{ pcol { 5 0 0 1. 1. pset } { 5 1 0 .7 1. pset 1 ipCol } ifelse } +{ pcol { 3 0 0 1. 1. pset } { 2 0 0 1. 1. pset 2 ipCol } ifelse } +{ pcol { 4 1 0 1. 1. pset } { 2 1 0 .7 1. pset 3 ipCol } ifelse } ] def T /ccol x def % black&white on/off @@ -1565,7 +1566,7 @@ BoxBackground %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 24 setown --.16 1.6 {(Gnuplot Default Symbols as Used in Frida)} textLM +-.16 1.6 {(Frida plot symbols:)} textLM 21 setown /next{ .9 0 offset } def diff --git a/pub/share/setup1D.ps b/pub/share/setup1D.ps index de913f620ed9569e910bc1c477f0050b55b46b6e..988011d4e89c3816e1547269ac1e39dedb25e525 100644 --- a/pub/share/setup1D.ps +++ b/pub/share/setup1D.ps @@ -14,25 +14,28 @@ WuGdict17a begin 1 1 language 1 infSet % plot info block? -1 dup 2 SymGSet % srad slin serr(2=from pset) : graph symbols, global preset +.8 1.2 2 SymGSet % srad slin serr(2=from pset) : graph symbols, global preset % /setboxbackgroundcolor { 0.93 setgray } def % default is white % setPalatino -{ 7 aCol5 iColA } /ipCol x bind def % number of colours and colour style +{ 9 aCol7 iColA } /ipCol x bind def % number of colours and colour style /pStyles [ { 11 0 0 1. 1. pset 0 ipCol } { 12 1 0 1. 1. pset 1 ipCol } { 13 1 0 1. 1. pset 2 ipCol } - { 1 0 0 1. 1. pset 3 ipCol } - { 1 1 0 .7 1. pset 4 ipCol } - { 3 0 0 1. 1. pset 5 ipCol } - { 3 1 0 .7 1. pset 6 ipCol } - { 4 0 0 1. 1. pset 7 ipCol } - { 4 1 0 .7 1. pset 0 ipCol } - { 5 0 0 1. 1. pset 1 ipCol } - { 5 1 0 .7 1. pset 2 ipCol } - { 2 0 0 1. 1. pset 3 ipCol } - { 2 1 0 .7 1. pset 4 ipCol } + { 1 0 0 .9 1. pset 3 ipCol } + { 1 1 0 .8 1. pset 4 ipCol } + { 3 0 0 .9 1. pset 5 ipCol } + { 3 1 0 .8 1. pset 6 ipCol } + { 4 0 0 .9 1. pset 7 ipCol } + { 4 1 0 .8 1. pset 8 ipCol } + { 5 0 0 .9 1. pset 0 ipCol } + { 5 1 0 .8 1. pset 1 ipCol } + { 2 0 0 .9 1. pset 2 ipCol } + { 2 1 0 .8 1. pset 3 ipCol } + { 11 0 0 1. 1. pset 4 ipCol } + { 12 1 0 1. 1. pset 5 ipCol } + { 13 1 0 1. 1. pset 6 ipCol } ] def { 8 aCol2 iColA } /icCol x bind def % number of colours and colour style diff --git a/pub/share/wups17a.ps b/pub/share/wups17a.ps index 4336be936504ad6d02248761e1b5e79c38554d64..0c7e062956b41ed0300ac2a8ad73590debf1995e 100644 --- a/pub/share/wups17a.ps +++ b/pub/share/wups17a.ps @@ -405,6 +405,17 @@ WuGdict17a begin { 255 125 0 } % orange { 255 0 0 } % red ] def +/aCol7 [ % [fixed size: max_i=8] default colors, modified from old gnuplot + { 80 80 255 } % blue + { 255 0 0 } % red + { 0 160 0 } % dark green + { 255 0 255 } % magenta + { 0 160 192 } % dark cyan + { 160 82 45 } % sienna + { 255 165 0 } % orange + { 255 127 80 } % coral + { 64 224 32 } % light greenish + ] def %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Fonts diff --git a/testdata/van_10AA_Sqw.i96 b/testdata/van_10AA_Sqw.i96 new file mode 100644 index 0000000000000000000000000000000000000000..537bf5cac95c37eebe6f9f7b64df08f828d71e03 Binary files /dev/null and b/testdata/van_10AA_Sqw.i96 differ