diff --git a/pub/src/axis.cpp b/pub/src/axis.cpp index fc8d13e4d01f9cc931f20511988014197ac1aaa6..b7c93f4212ae7cbd6d28ae1772e69c97ba296f80 100644 --- a/pub/src/axis.cpp +++ b/pub/src/axis.cpp @@ -74,7 +74,7 @@ void CAxis::ask_and_set( const string& quest ) return; } else if ( resp1 == "\\EOL" ) { inf_in = inf; - } else if( mystd::any2dbl(resp1,&inf_in) ) { + } else if( triv::any2dbl(resp1,&inf_in) ) { ; // ok } else { cout << "required input: plot axis range\n" @@ -97,7 +97,7 @@ void CAxis::ask_and_set( const string& quest ) throw "user escape to main menu"; } else if ( resp2 == "" || resp2 == "\\EOL" ) { sup_in = sup; - } else if( mystd::any2dbl(resp2,&sup_in) ) { + } else if( triv::any2dbl(resp2,&sup_in) ) { ; // ok } else { cout << "invalid upper bound; use '?' for help\n"; @@ -164,8 +164,8 @@ void CAxis::setRoundedLimits( string axnam, double _inf, double _sup ) double margin = relmargin * (sup - inf); do { if (mydigits>=8.5) return; // do not round - sup2 = mystd::round_decimal( sup+margin, mydigits ); - inf2 = mystd::round_decimal( inf-margin, mydigits ); + sup2 = triv::round_decimal( sup+margin, mydigits ); + inf2 = triv::round_decimal( inf-margin, mydigits ); if(sup<0 && sup2>0) sup2 = 0; if(inf2<0 && inf>0) inf2 = 0; mydigits += 0.5; @@ -175,8 +175,8 @@ void CAxis::setRoundedLimits( string axnam, double _inf, double _sup ) double margin = exp( relmargin*log(ratio) ); do { if (mydigits>=8.5) return; // do not round - sup2 = mystd::round_decimal( sup*margin, mydigits ); - inf2 = mystd::round_decimal( inf/margin, mydigits ); + sup2 = triv::round_decimal( sup*margin, mydigits ); + inf2 = triv::round_decimal( inf/margin, mydigits ); mydigits += 0.5; } while ( !((inf2<inf) && (sup<sup2)) ); } diff --git a/pub/src/commands.cpp b/pub/src/commands.cpp index 1e467f77f171abbf0c35a9305d6f190c69915ca7..fce884fbb5f2909cd62949e90fc1aa311055f210 100644 --- a/pub/src/commands.cpp +++ b/pub/src/commands.cpp @@ -533,7 +533,7 @@ bool fridaCommand( string cmd ) } else if (cmd == "!") { string sh_cmd; sh_cmd = sask("shell command"); - mystd::system( sh_cmd ); + triv::system( sh_cmd ); } else if (cmd == "_") { diff --git a/pub/src/curve.cpp b/pub/src/curve.cpp index 1d475526aedabd014602cfff636d5045071abb17..c77212a164a5651f82ea829ff6b220c8be5ae6b6 100644 --- a/pub/src/curve.cpp +++ b/pub/src/curve.cpp @@ -185,10 +185,10 @@ void COlc::curve_val_vec( vector<double>* ret, const vector<double>& vt, string par_fifonam = string("/tmp/par-") + getenv( "LOGNAME" ); string ret_fifonam = string("/tmp/ret-") + getenv( "LOGNAME" ); - // TODO: choose name as: mystd::next_tmp_file( "/tmp/frida.%d" ); + // TODO: choose name as: triv::next_tmp_file( "/tmp/frida.%d" ); - mystd::system( "rm -f "+par_fifonam ); - mystd::system( "rm -f "+ret_fifonam ); + triv::system( "rm -f "+par_fifonam ); + triv::system( "rm -f "+ret_fifonam ); if ( mkfifo( par_fifonam.c_str(), 0666 ) ) throw "SYSTEM ERROR cannot make " + par_fifonam; if ( mkfifo( ret_fifonam.c_str(), 0666 ) ) @@ -1064,8 +1064,8 @@ double NCurveFile::NumericIntegral( data.k = k; data.j = j; - return my_integrate( &myeval, &data, low, hig, - numint_mode, numint_epsabs, numint_epsrel ); + return triv::integrate( &myeval, &data, low, hig, + numint_mode, numint_epsabs, numint_epsrel ); } diff --git a/pub/src/dualplot.cpp b/pub/src/dualplot.cpp index 5f648d4f7c4bf81e3666dc4da10b09a2f1b541dc..d205ab74d3d369f702164a1fa1fb12bf0ec4dcdc 100644 --- a/pub/src/dualplot.cpp +++ b/pub/src/dualplot.cpp @@ -38,13 +38,13 @@ CPlot::CPlot( uint _iPlot, bool _logx, bool _logy ) : // Create a named pipe (FIFO) that will transmit our commands to Gnuplot. string fn_fifo = string("/tmp/gnuplot-") + getenv( "LOGNAME" ); - mystd::system( "rm -f "+fn_fifo ); + triv::system( "rm -f "+fn_fifo ); if (mkfifo( fn_fifo.c_str(), 0666 )) throw "SYSTEM ERROR cannot make fifo " + fn_fifo + ": will not be able to print"; // Start a Gnuplot that will read from our pipe. - mystd::system( "gnuplot -title " + strg(iPlot) + " -noraise" + + triv::system( "gnuplot -title " + strg(iPlot) + " -noraise" + " < " + fn_fifo + " &" ); // Open our pipe so that we can write commands to it @@ -316,10 +316,10 @@ void CPlot::writePostscript( string ps_outdir, string ps_head, string ps_dict ) while(1) { if (ps_fnum>=999) throw "graph file number overflow"; - outf = mystd::wordexp_unique( + outf = triv::wordexp_unique( ps_outdir + str( format( "l%d" ) % ++ps_fnum ) + "." + ( ps_dict=="" ? "psa" : "ps" ) ); - if( !mystd::file_exists( outf.c_str() ) ) + if( !triv::file_exists( outf.c_str() ) ) break; // legal exit } cout << "save plot in " << outf << "\n"; @@ -329,7 +329,7 @@ void CPlot::writePostscript( string ps_outdir, string ps_head, string ps_dict ) ps_dict + " " + // ps_dict may be "" ps_head + " > " + outf + "\n"; - mystd::system( cmd ); + triv::system( cmd ); // append specific output to output file: if ( !(pssav = fopen( outf.c_str(), "a+" )) ) diff --git a/pub/src/edif.cpp b/pub/src/edif.cpp index a1713df03ea59da190e923bd9620cb120595cdf4..0dbbe6c7e533b3700ed40457746bfa05d798d743 100644 --- a/pub/src/edif.cpp +++ b/pub/src/edif.cpp @@ -273,7 +273,7 @@ void NEdif::EditDoc() POlo f; // obtain unused tmp file name: - string fname = mystd::next_tmp_file( "/tmp/frida.%d" ); + string fname = triv::next_tmp_file( "/tmp/frida.%d" ); // transfer to tmp file: ofstream Fo( fname.c_str() ); @@ -293,19 +293,19 @@ void NEdif::EditDoc() if( !(Fi = fopen( fname.c_str(), "r" )) ) throw "cannot read back from tmp file"; string line; - while ( mystd::freadln(Fi, &line)>=0 ){ + while ( triv::freadln(Fi, &line)>=0 ){ if ( line.substr(0,3)=="###" ) { f = fiter(); if ( line.substr(3,6)!=" FILE " ) throw "invalid change in ### line: 'FILE' not found"; string aux; - mystd::string_extract_word( line.substr(9), &aux, &line ); + triv::string_extract_word( line.substr(9), &aux, &line ); uint kin; - if ( !mystd::any2uint( aux, &kin ) ) + if ( !triv::any2uint( aux, &kin ) ) throw "invalid change in ### line: file number not found"; if ( kin!=fiter.k() ) throw "invalid change in ### line: wrong file number"; - mystd::string_extract_word( line, &aux, &line ); + triv::string_extract_word( line, &aux, &line ); if ( aux!=f->name ) throw "invalid change in ### line: wrong file name"; f->lDoc.clear(); @@ -479,7 +479,7 @@ void NEdif::ReadIn() case 1: line = sask("Enter z value", ""); // cout << "DEBUG: line [" << line << "]\n"; - if (!mystd::str2vec(line, &linv, 2) < 0) { + if (!triv::str2vec(line, &linv, 2) < 0) { cout << "-> invalid line [" << line << "]\n"; goto store; } @@ -493,7 +493,7 @@ void NEdif::ReadIn() break; case 2: line = sask("Enter header line with z values", ""); - if (!mystd::str2vec(line, &linv, imcy+1)) { + if (!triv::str2vec(line, &linv, imcy+1)) { cout << "-> bad input\n"; goto store; } @@ -532,7 +532,7 @@ void NEdif::ReadIn() quest = "[" + strg(n) + "] "; line = sask(quest.c_str(), ""); if (line==string("")) break; - if (!mystd::str2vec(line, &linv, imcm+1)) { + if (!triv::str2vec(line, &linv, imcm+1)) { printf( " could not extract value no. %u" " from string [%s]\n", imcm, line.c_str()); @@ -589,7 +589,7 @@ void NEdif::ReadIn() strg(S->x[i]) + " -> "; while (1) { line = sask(quest.c_str()); - if (!mystd::str2vec(line, &linv, imcy+1)) { + if (!triv::str2vec(line, &linv, imcy+1)) { printf( " could not extract y value no. %u" " from string [%s]\n", imcy, line.c_str()); @@ -650,10 +650,10 @@ void NEdif::ReadTab( string qualif ) if( fromscript ){ inFiles.push_back( "/ram/tab" ); script = sask("Script (writing to "+inFiles[0]+")", script); - mystd::system( script ); + triv::system( script ); } else { string fnames = sask( "Read tab from file(s)" ); - mystd::glob_file_list( fnames, "", &inFiles ); + triv::glob_file_list( fnames, "", &inFiles ); } if( choosecol ){ @@ -673,7 +673,7 @@ void NEdif::ReadTab( string qualif ) fout->lDoc.push_back( "ft"+qualif+" " + script ); fout->name = script; } else { - mystd::fname_divide( inFiles[iF], &fdir, &fshort, &fext); + triv::fname_divide( inFiles[iF], &fdir, &fshort, &fext); fout->lDoc.push_back( "ft"+qualif+" " + inFiles[iF] ); fout->name = fshort; if( choosecol ){ @@ -701,11 +701,11 @@ void NEdif::ReadTab( string qualif ) int nzdat = 0; double val; PSpec S; - while( mystd::freadln(fd, &lin)>-1 ) { + while( triv::freadln(fd, &lin)>-1 ) { ++n_in; if( lin.substr(0,4)=="#rpa" ){ - mystd::string_extract_word( lin.substr(4), &s1, &s2 ); - if( !mystd::any2dbl( s2, &val ) ) + triv::string_extract_word( lin.substr(4), &s1, &s2 ); + if( !triv::any2dbl( s2, &val ) ) printf( "invalid parameter line [%s]\n", lin.c_str() ); else fout->RPar.push_back( CParam( s2, "", val) ); @@ -718,7 +718,7 @@ void NEdif::ReadTab( string qualif ) if( !horizontal && nblock!=0 && S && S->size()>0 ) fout->V.push_back(S); if ( multiblock ) { - if( !mystd::str2vec(lin, &zdat, 0, false) ) + if( !triv::str2vec(lin, &zdat, 0, false) ) throw "invalid header line [" + lin + "] (or legitimate break ?)"; if( nblock==0 ){ // first header @@ -755,7 +755,7 @@ void NEdif::ReadTab( string qualif ) } // regular data line - if( !mystd::str2vec(lin, &dat, 0, false) ) + if( !triv::str2vec(lin, &dat, 0, false) ) throw "cannot parse line "+strg(nline)+" in block "+ strg(nblock)+" ["+lin+"]"; if(dat.size()==0) diff --git a/pub/src/expr.cpp b/pub/src/expr.cpp index 44797bc7d14e24254244c6ff14f45ea7cd7a12d6..63431b0b0d8f9387ef08ac693a8c4889848aa953 100644 --- a/pub/src/expr.cpp +++ b/pub/src/expr.cpp @@ -64,7 +64,7 @@ void CContext::request_VT( const vector<double> *_vt ) dim = _VT; nv = _vt->size(); vt = _vt; - if( !mystd::is_equidist( &vt_step, *vt ) || vt_step<0 ) + if( !triv::is_equidist( &vt_step, *vt ) || vt_step<0 ) vt_step = 0; } diff --git a/pub/src/file_in.cpp b/pub/src/file_in.cpp index 24d81a257d17fea7510608463f6c4cd8245da7ae..dcd6cdaa7a03803d9ce09f5f55474783b93514f9 100644 --- a/pub/src/file_in.cpp +++ b/pub/src/file_in.cpp @@ -43,7 +43,7 @@ void NFileIn::Load(void) { string fnames = sask( "Load file(s)" ); vector<string> vflong; // unix names - mystd::glob_file_list( fnames, "y08", &vflong ); + triv::glob_file_list( fnames, "y08", &vflong ); FILE *F_in; // cout << "DEBUG: size " << vflong.size() << "\n"; for( uint i=0; i<vflong.size(); ++i ) { @@ -52,7 +52,7 @@ void NFileIn::Load(void) try{ cout << ".. loading file " << vflong[i] << "\n"; string fdir, fshort, fext; - mystd::fname_divide( vflong[i], &fdir, &fshort, &fext); + triv::fname_divide( vflong[i], &fdir, &fshort, &fext); if ( fext=="y08" ) { ifstream FS (vflong[i].c_str(), ios_base::in); @@ -94,7 +94,7 @@ void NFileIn::Load_08( ifstream& FS, string flong ) bool isdata; CCoord co; - mystd::fname_divide( flong, &fdir, &fshort, &fext); + triv::fname_divide( flong, &fdir, &fshort, &fext); YAML::Parser parser(FS); YAML::Node doc; @@ -184,7 +184,7 @@ void NFileIn::Load_08( ifstream& FS, string flong ) doc["Param"][iParam]["name"] >> co.name; doc["Param"][iParam]["unit"] >> co.unit; doc["Param"][iParam]["value"] >> val; - if( !mystd::any2dbl( val, &num ) ) + if( !triv::any2dbl( val, &num ) ) throw "param(" + co.name + "): invalid value " + val; fout->RPar.push_back( CParam( co, num ) ); } @@ -215,7 +215,7 @@ void NFileIn::Load_08( ifstream& FS, string flong ) vector<double> z; for(iz=0; iz<fout->ZCo.size(); ++iz ){ doc["Tables"][iTable]["z" + strg(iz)] >> val; - if( !mystd::any2dbl( val, &num ) ) + if( !triv::any2dbl( val, &num ) ) throw "z" + strg(iz) + ": invalid value " + val; z.push_back( num ); } @@ -229,7 +229,7 @@ void NFileIn::Load_08( ifstream& FS, string flong ) if ( xytag == "xy" ){ itxy.second() >> val; while( val != "" ) { - mystd::string_extract_line( val, &lin, &res ); + triv::string_extract_line( val, &lin, &res ); if( sscanf( lin.c_str(), "%lg %lg\n", &vx, &vy )!=2 ) throw "xy: bad data line: " + lin; sout->push_xy( vx, vy ); @@ -238,7 +238,7 @@ void NFileIn::Load_08( ifstream& FS, string flong ) }else if ( xytag == "xyd" ){ itxy.second() >> val; while( val != "" ) { - mystd::string_extract_line( val, &lin, &res ); + triv::string_extract_line( val, &lin, &res ); if( sscanf( lin.c_str(), "%lg %lg %lg\n",&vx, &vy, &dy )!=3 ) throw "xyd: bad data line: " + lin; @@ -253,7 +253,7 @@ void NFileIn::Load_08( ifstream& FS, string flong ) cout->z = z; for( uint ip=0; ip<fc->nPar(); ++ip ){ doc["Tables"][iTable]["p" + strg(ip)] >> val; - if( !mystd::any2dbl( val, &num ) ) + if( !triv::any2dbl( val, &num ) ) throw "p" + strg(ip) + ": invalid value " + val; cout->P.push_back( num ); cout->fixed.push_back( false ); @@ -277,14 +277,14 @@ void NFileIn::Load_01( FILE *F_in, string flong ) CCoord co; POld fout( new COld ); - mystd::fname_divide( flong, &fdir, &fshort, &fext); + triv::fname_divide( flong, &fdir, &fshort, &fext); - if ( mystd::freadln(F_in, &lin)<=0 ) + if ( triv::freadln(F_in, &lin)<=0 ) throw "file empty or starting with empty line"; if ( lin!=string("ASCII-01 JWu") ) throw ".a01 file starts with illegal header [" + lin + "]"; - if ( mystd::freadln(F_in, &lin)<=0 || lin.length()<5 || + if ( triv::freadln(F_in, &lin)<=0 || lin.length()<5 || lin.substr(0,4)!=string("typ ") ) throw "no valid typ line"; if ( lin.substr(4)=="D" ) { @@ -297,7 +297,7 @@ void NFileIn::Load_01( FILE *F_in, string flong ) while (1) { // loop over input lines - if ( mystd::freadln(F_in, &lin)<0 ) + if ( triv::freadln(F_in, &lin)<0 ) throw "unexpected end-of-file"; // regular exit when "eof" is reached: @@ -336,7 +336,7 @@ void NFileIn::Load_01( FILE *F_in, string flong ) string in = lin.substr(4); int ji = in.find_first_not_of(" \t"); double dval; - if( ji>=20 || !mystd::any2dbl( in.substr(ji,20), &dval ) ) + if( ji>=20 || !triv::any2dbl( in.substr(ji,20), &dval ) ) throw "invalid rpa line\n"; fout->RPar.push_back( CParam( CCoord(), dval ) ); throw "a01 file contains rpa section. Check the source code preceeding this error message. It is possibly broken. If not, remove this exception."; @@ -408,61 +408,61 @@ void NFileIn::Load_96( FILE *F_in, string flong ) CCoord co; PSpec sout; - mystd::fname_divide( flong, &fdir, &fshort, &fext); + triv::fname_divide( flong, &fdir, &fshort, &fext); fout->name = fshort; - if ( mystd::freadln(F_in, &lin)<=0 ) + if ( triv::freadln(F_in, &lin)<=0 ) throw "file empty or starting with empty line"; if ( lin!=string("ASCII-96") ) throw ".i96 file starts with illegal header [" + lin + "]"; - if ( mystd::freadln(F_in, &lin)<=0 || lin.length()<9 || + if ( triv::freadln(F_in, &lin)<=0 || lin.length()<9 || lin.substr(0,9)!=string("(a24,a56)") ) throw "no valid intro to block 2"; - if ( mystd::freadln(F_in, &lin)<=0 || lin.length()<24 || + if ( triv::freadln(F_in, &lin)<=0 || lin.length()<24 || lin.substr(0,3)!=string("fil") ) throw "tag 'fil' not found in block 2"; - if ( mystd::strip(lin.substr(24))!=fshort ) { + if ( triv::strip(lin.substr(24))!=fshort ) { cout << "warning: i96 file '" << fshort << "' renamed from '" << lin.substr(24) << "'\n"; } - if ( mystd::freadln(F_in, &lin)<=0 || lin.length()<24 || + if ( triv::freadln(F_in, &lin)<=0 || lin.length()<24 || lin.substr(0,3)!=string("tit") ) throw "tag 'tit' not found in block 2"; - fout->lDoc.push_back( mystd::strip(lin.substr(24)) ); + fout->lDoc.push_back( triv::strip(lin.substr(24)) ); - while( mystd::freadln(F_in, &lin)>0 && lin.length()>=24 && + while( triv::freadln(F_in, &lin)>0 && lin.length()>=24 && lin.substr(0,3)==string("doc") ) - fout->lDoc.push_back( mystd::strip(lin.substr(24)) ); + 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 ( mystd::freadln(F_in, &lin)>0 && + while ( triv::freadln(F_in, &lin)>0 && !( lin.length()>=6 && lin.substr(0,6)==string("&eob 2") ) ) ; - if ( mystd::freadln(F_in, &lin)<=0 ) + if ( triv::freadln(F_in, &lin)<=0 ) throw "missed &eob 3"; if( lin.length()<9 || lin.substr(0,9)!=string("(a24,i16)") ) throw "no valid intro to block 3"; - while ( mystd::freadln(F_in, &lin)>0 && + while ( triv::freadln(F_in, &lin)>0 && !( lin.length()>=6 && lin.substr(0,6)==string("&eob 3") ) ) ; - if ( mystd::freadln(F_in, &lin)<=0 ) + if ( triv::freadln(F_in, &lin)<=0 ) 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 ( mystd::freadln(F_in, &lin)>0 && lin.length()>=48 && + while ( triv::freadln(F_in, &lin)>0 && 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"; @@ -473,48 +473,48 @@ void NFileIn::Load_96( FILE *F_in, string flong ) if( lin.substr(0,6)!=string("&eob 4") ) throw "no valid eob 4"; - if ( mystd::freadln(F_in, &lin)<=0 || lin.length()<9 || + if ( triv::freadln(F_in, &lin)<=0 || lin.length()<9 || lin.substr(0,12)!=string("(a4,a24,a24)") ) throw "no valid intro to block 5"; - if ( mystd::freadln(F_in, &lin)<=0 || lin.length()<28 || + if ( triv::freadln(F_in, &lin)<=0 || lin.length()<28 || lin.substr(0,1)!=string("x") ) throw "no x coordinate"; - fout->xco = CCoord( mystd::strip(lin.substr(4,24)), - mystd::strip(lin.substr(28,24)) ); + fout->xco = CCoord( triv::strip(lin.substr(4,24)), + triv::strip(lin.substr(28,24)) ); - if ( mystd::freadln(F_in, &lin)<=0 || lin.length()<28 || + if ( triv::freadln(F_in, &lin)<=0 || lin.length()<28 || lin.substr(0,1)!=string("y") ) throw "no y coordinate"; - fout->yco = CCoord( mystd::strip(lin.substr(4,24)), - mystd::strip(lin.substr(28,24)) ); + fout->yco = CCoord( triv::strip(lin.substr(4,24)), + triv::strip(lin.substr(28,24)) ); - if ( mystd::freadln(F_in, &lin)<=0 || lin.length()<28 || + if ( triv::freadln(F_in, &lin)<=0 || lin.length()<28 || lin.substr(0,1)!=string("z") ) throw "no z coordinate"; - fout->ZCo.push_back( CCoord( mystd::strip(lin.substr(4,24)), - mystd::strip(lin.substr(28,24)) ) ); + fout->ZCo.push_back( CCoord( triv::strip(lin.substr(4,24)), + triv::strip(lin.substr(28,24)) ) ); - if ( mystd::freadln(F_in, &lin)<=0 || lin.length()<6 || + if ( triv::freadln(F_in, &lin)<=0 || lin.length()<6 || lin.substr(0,6)!=string("&eob 5") ) throw "no valid eob 5"; - if ( mystd::freadln(F_in, &lin)<=0 || lin.length()<5 || + if ( triv::freadln(F_in, &lin)<=0 || lin.length()<5 || lin.substr(0,5)!=string("(a80)") ) throw "no valid intro to block 6"; - while ( mystd::freadln(F_in, &lin)>0 && + while ( triv::freadln(F_in, &lin)>0 && !( lin.length()>=6 && lin.substr(0,6)==string("&eob 6") ) ) fout->lDoc.push_back( lin ); - if ( mystd::freadln(F_in, &lin)<=0 ) + if ( triv::freadln(F_in, &lin)<=0 ) throw "missed &eob 6"; for( int i=1; i<3; ++i ) - if ( mystd::freadln(F_in, &lin)<=0 ) + if ( triv::freadln(F_in, &lin)<=0 ) throw "no valid intro to block 7"; - if ( mystd::freadln(F_in, &lin)<=0 || + if ( triv::freadln(F_in, &lin)<=0 || sscanf( lin.c_str(), "%i %i", &nspec, &ival )!=2 ) throw "no nspec or 2nd arg in intro to block 7"; @@ -522,20 +522,20 @@ void NFileIn::Load_96( FILE *F_in, string flong ) sout = PSpec( new CSpec ); - if ( mystd::freadln(F_in, &lin)<=0 || lin.length()<10 || + if ( triv::freadln(F_in, &lin)<=0 || 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 ( mystd::freadln(F_in, &lin)<0 || + if ( triv::freadln(F_in, &lin)<0 || sscanf( lin.c_str(), "%i %lg", &n, &r0 )!=2 ) throw "no valid header in spectrum"; sout->z.push_back( r0 ); for( uint i=0; i<n; ++i ){ - if ( !F_in || mystd::freadln(F_in, &lin)<=0 ) + if ( !F_in || triv::freadln(F_in, &lin)<=0 ) throw "i96: failed to read data line " + strg(i) + " of " + strg(n); if ( sscanf( lin.c_str(), "%lg %lg %lg", &r0, &r1, &r2 )!=3 ) diff --git a/pub/src/file_out.cpp b/pub/src/file_out.cpp index 691929652ecf9ce10194bb0319a558ae6c8157b8..db72bfe89b38b02fe5fa335744fc97602b2c2671 100644 --- a/pub/src/file_out.cpp +++ b/pub/src/file_out.cpp @@ -46,7 +46,7 @@ void NFileOut::Save( string fmt, bool allow_overwrite ) outfnam += "."+fmt; // document file save f->lDoc.push_back( "fs " + outfnam + " # " + - mystd::myasctime(mystd::justnow(),0) ); + triv::time_string( time(0) ) ); // prevent unintended overwriting if( !allow_overwrite ){ if ( (file = fopen(outfnam.c_str(), "r")) ) { @@ -87,24 +87,24 @@ void NFileOut::Save_y08( FILE *file, POlo f ) fprintf( file, "History:\n" ); for ( uint i=0; i<f->lDoc.size(); i++ ) - fprintf( file, "- %s\n", yaml(f->lDoc[i]).c_str() ); + fprintf( file, "- %s\n", triv::yaml(f->lDoc[i]).c_str() ); fprintf( file, "Coord:\n" ); fprintf( file, " x:\n name: %s\n unit: %s\n", - yaml(f->xco.name).c_str(), yaml(f->xco.unit).c_str() ); + triv::yaml(f->xco.name).c_str(), triv::yaml(f->xco.unit).c_str() ); fprintf( file, " y:\n name: %s\n unit: %s\n", - yaml(f->yco.name).c_str(), yaml(f->yco.unit).c_str() ); + triv::yaml(f->yco.name).c_str(), triv::yaml(f->yco.unit).c_str() ); for ( uint i=0; i<f->ZCo.size(); i++ ) fprintf( file, " z%u:\n name: %s\n unit: %s\n", - i, yaml(f->ZCo[i].name).c_str(), - yaml(f->ZCo[i].unit).c_str() ); + i, triv::yaml(f->ZCo[i].name).c_str(), + triv::yaml(f->ZCo[i].unit).c_str() ); fprintf( file, "Param:\n" ); for ( uint i=0; i<f->RPar.size(); i++ ) fprintf( file, " -\n name: %s\n unit: %s\n value: %20.15g\n", - yaml(f->RPar[i].Co.name).c_str(), - yaml(f->RPar[i].Co.unit).c_str(), + triv::yaml(f->RPar[i].Co.name).c_str(), + triv::yaml(f->RPar[i].Co.unit).c_str(), f->RPar[i].val ); if( fc ) { diff --git a/pub/src/manip.cpp b/pub/src/manip.cpp index a2889ecdd903041a9ceb6d8aabdea06c4b619fce..6ce65607f9aa0a4ae9f67cf9279e62c7d1ff286d 100644 --- a/pub/src/manip.cpp +++ b/pub/src/manip.cpp @@ -370,10 +370,10 @@ void NManip::PtsSymmetrize() PSpec sin = fin->VS(j); PSpec sout( new CSpec ); sout->copy_z_base( sin ); - if( mystd::sorted( sin->x )!=1 ) + if( triv::sorted( sin->x )!=1 ) throw "not sorted"; double step; - if( !mystd::is_equidist( &step, sin->x ) ) + if( !triv::is_equidist( &step, sin->x ) ) throw "not equidistant"; double centre; T->tree_point_val( ¢re, 0, k, j ); @@ -671,7 +671,7 @@ void NManip::ScaExch() for ( uint i=0; i<fin->VS(j)->size(); ++i ) xcommon.push_back( fin->VS(j)->x[i] ); sort( xcommon.begin(), xcommon.end() ); - mystd::unique(&xcommon, 1e-180, 1e-20); + triv::unique(&xcommon, 1e-180, 1e-20); printf("group of spectra %u .. %u has %zu different x\n", ji, jf-1, xcommon.size()); diff --git a/pub/src/rssm.cpp b/pub/src/rssm.cpp index 9720553a34bb4c0ef397ca26b8c55e8973c43f70..2162fcd3efef7e3881750c029bc9c62d470ae87e 100644 --- a/pub/src/rssm.cpp +++ b/pub/src/rssm.cpp @@ -101,11 +101,11 @@ void CRawfileSpheres::RdRawYam( ifstream& F_in ) strptime( date_string, "%F %A %H:%M:%S", &date_broken ); measured_until = mktime( &date_broken ); } else if ( key=="ndet" ){ - if( !mystd::any2uint( val, &ndet ) ) + if( !triv::any2uint( val, &ndet ) ) throw "DATA BUG: invalid ndet"; } else if ( key=="daq_time_step" ){ - mystd::string_extract_word( val, &bla, &blub ); - mystd::any2dbl( bla, &daq_time_step ); + triv::string_extract_word( val, &bla, &blub ); + triv::any2dbl( bla, &daq_time_step ); } } if( !daq_time_step ) @@ -127,7 +127,7 @@ void CRawfileSpheres::RdRawYam( ifstream& F_in ) throw "DATA BUG: EnergyHistogram[" + strg(iEne) + "] is not a SEQUENCE"; doc["EnergyHistograms"][iEne][0] >> val; - if( !mystd::any2dbl( val, &num ) ) + if( !triv::any2dbl( val, &num ) ) throw "E-Hist: invalid x-value " + val; for( int i=0; i<4; ++i ) rawdata[i].push_back( num ); @@ -138,7 +138,7 @@ void CRawfileSpheres::RdRawYam( ifstream& F_in ) strg(i+1) + "] is not a SEQUENCE"; for( int j=0; j<ndet; ++j ) { (*arr)[j] >> val; - if( !mystd::any2dbl( val, &num ) ) + if( !triv::any2dbl( val, &num ) ) throw "E-Hist: invalid count " + val; rawdata[i].push_back( num ); } @@ -150,7 +150,7 @@ void CRawfileSpheres::RdRawYam( ifstream& F_in ) strg(i+1+4) + "] is not a SEQUENCE"; for( int j=0; j<ndet; ++j ) { (*arr)[j] >> val; - if( !mystd::any2dbl( val, &num ) ) + if( !triv::any2dbl( val, &num ) ) throw "E-Hist: invalid tstep " + val; rawdata[i].push_back( num ); } @@ -173,7 +173,7 @@ void CRawfileSpheres::RdRawYam( ifstream& F_in ) throw "DATA BUG: ChopperHistograms " + strg(iCho) + " is not a SEQUENCE"; doc["ChopperHistograms"][iCho][0] >> val; - if( !mystd::any2dbl( val, &num ) ) + if( !triv::any2dbl( val, &num ) ) throw "DATA BUG: C-Hist: invalid x-value " + val; for( int i=4; i<6; ++i ) rawdata[i].push_back( num ); @@ -184,7 +184,7 @@ void CRawfileSpheres::RdRawYam( ifstream& F_in ) strg(i-4+1) + "] is not a SEQUENCE"; for( int j=0; j<ndet; ++j ) { (*arr)[j] >> val; - if( !mystd::any2dbl( val, &num ) ) + if( !triv::any2dbl( val, &num ) ) throw "E-Hist: invalid count " + val; rawdata[i].push_back( num ); } @@ -196,7 +196,7 @@ void CRawfileSpheres::RdRawYam( ifstream& F_in ) strg(i-4+1+2) + "] is not a SEQUENCE"; for( int j=0; j<ndet; ++j ) { (*arr)[j] >> val; - if( !mystd::any2dbl( val, &num ) ) + if( !triv::any2dbl( val, &num ) ) throw "E-Hist: invalid count " + val; rawdata[i].push_back( num ); } @@ -242,7 +242,7 @@ void NRSSM::ReadSpec( int flag ) olf[iolf]->yco = CCoord( "cts", "sec-1" ); olf[iolf]->ZCo.push_back( CCoord( "det", "") ); } - mystd::fname_divide( file_f, 0, &name, 0 ); + triv::fname_divide( file_f, 0, &name, 0 ); olf[0]->name = name+"left"; olf[1]->name = name+"right"; olf[2]->name = name+"open_left"; @@ -433,7 +433,7 @@ void NRSSM::ReadSeries( int flag ) olf[iolf]->ZCo.push_back( CCoord( "#sub", "") ); olf[iolf]->ZCo.push_back( CCoord( "det", "") ); } - mystd::fname_divide( fser, 0, &name, 0 ); + triv::fname_divide( fser, 0, &name, 0 ); olf[0]->name = name; olf[1]->name = name+"open"; olf[0]->lDoc.push_back( "refl, average over both halfspaces" ); diff --git a/pub/src/var.cpp b/pub/src/var.cpp index 7c15e5b5b64c8735e4ce53e692a79943570e215a..b1123f71e636eda7557ea7b93157e8fe3008653c 100644 --- a/pub/src/var.cpp +++ b/pub/src/var.cpp @@ -27,7 +27,7 @@ int CVar::requestNum( string s, int pos ) if ( s.size()<=pos ) throw "missing parameter number in '" + s + "'"; int ret; - if ( !mystd::any2int( s.substr(pos), &ret ) ) + if ( !triv::any2int( s.substr(pos), &ret ) ) throw "invalid parameter number in '" + s + "'"; return ret; } diff --git a/test/test1-fit.inp b/test/t1.inp similarity index 100% rename from test/test1-fit.inp rename to test/t1.inp diff --git a/test/h b/test/t3.inp similarity index 100% rename from test/h rename to test/t3.inp diff --git a/test/debug b/test/t4.inp similarity index 100% rename from test/debug rename to test/t4.inp