diff --git a/pub/src/mystd.cpp b/pub/src/mystd.cpp index ee8ae0694fa5356f4c2318dbdf44f27261bf880d..904b343e42e6450df597878c9b6ded7c47bded60 100644 --- a/pub/src/mystd.cpp +++ b/pub/src/mystd.cpp @@ -11,9 +11,11 @@ #include <sys/time.h> #include <glob.h> #include <iostream> +#include <boost/format.hpp> #include "mystd.h" +using boost::format; //! declare auxiliary functions. @@ -34,47 +36,39 @@ const double mystd::PI = 3.1415926535897931; //* convert to string *// //**************************************************************************// -string strg(const string& val) +string strg( const string& val ) { return val; } -string strg(const bool& val) { +string strg( bool val) { if (val) return "y"; else return "n"; } -string strg(const double& val) +string strg( double val ) { - char s[40]; - sprintf(s, "%g", val); - return s; + return str( format( "%g" ) % val ); } -string strg(const int& val) +string strg( int val ) { - char s[40]; - sprintf(s, "%d", val); - return s; + return str( format( "%d" ) % val ) } -string strg(const uint& val) +string strg( uint val ) { - char s[40]; - sprintf(s, "%u", val); - return s; + return str( format( "%u" ) % val ) } -string strg(const unsigned long& val) +string strg( unsigned long val) { - char s[40]; - sprintf(s, "%lu", val); - return s; + return str( format( "%lu" ) % val ) } -string strg(const char& val) +string strg( char val ) { return string(1, val); } @@ -173,7 +167,7 @@ bool mystd::str2vec( string inp, vector<double> *V, uint nmax, bool force ) return true; } -bool mystd::any2dbl( const string inp, double *val ) +bool mystd::any2dbl( const string& inp, double *val ) { if(!inp.size()) { cout << "expecting double, found empty input\n"; @@ -203,7 +197,7 @@ bool mystd::any2dbl( const string inp, double *val ) return false; } -bool mystd::any2int(const string inp, int *val) +bool mystd::any2int( const string& inp, int *val ) { if(!inp.size()) { cout << "expecting integer, found empty input\n"; @@ -219,7 +213,7 @@ bool mystd::any2int(const string inp, int *val) return false; } -bool mystd::any2uint(const string inp, uint *val) +bool mystd::any2uint( const string& inp, uint *val ) { if(!inp.size()) { cout << "expecting integer, found empty input\n"; @@ -235,7 +229,7 @@ bool mystd::any2uint(const string inp, uint *val) return false; } -void mystd::string_extract_word( const string in, string *out1, string *out2 ) +void mystd::string_extract_word( const string& in, string *out1, string *out2 ) { // one word (*out1) is extracted; leading " \t" are retained. // in the tail (*out2) leading " \t" are deleted. @@ -274,7 +268,7 @@ void mystd::string_extract_word( const string in, string *out1, string *out2 ) //cout << "from ["<<in<<"] word ["<<*out1<<"] and tail ["<<*out2<<"]\n"; } -void mystd::string_extract_line(const string in, string *out1, string *out2) +void mystd::string_extract_line( const string& in, string *out1, string *out2 ) { string line; string::size_type i = in.find('\n'); @@ -306,7 +300,7 @@ void mystd::system( string cmd ) //! Seconds since the epoch. Return them as double (WHY??) // only used for calls to myasctime => OBSOLETE -double mystd::justnow(void) +double mystd::justnow() { struct timeval exactlynow; gettimeofday(&exactlynow, NULL); @@ -316,7 +310,7 @@ double mystd::justnow(void) //! Return time as string in ctime/asctime standard format. // OBSOLETE: better use strftime -string mystd::myasctime(double time, int offs) +string mystd::myasctime( double time, int offs ) { long timin = (long) time; char buf[40]; @@ -331,7 +325,7 @@ string mystd::myasctime(double time, int offs) //! Round given value to given number of digits. -double mystd::round_decimal(double val, double digits) +double mystd::round_decimal( double val, double digits ) { if (val==0 || digits<=0) return 0; double v = fabs(val); @@ -349,7 +343,7 @@ double mystd::round_decimal(double val, double digits) //! insert val into vector *V, presuming the latter is sorted -void mystd::merge(vector<double> *V, double val) +void mystd::merge( vector<double> *V, double val ) { for (uint i=0; i<V->size(); ++i) { if (val>(*V)[i]) continue; @@ -374,7 +368,7 @@ bool mystd::get_const(vector<double> *V, double *val) } */ -void mystd::unique(vector<double> *V, double tolabs, double tolrel) +void mystd::unique( vector<double> *V, double tolabs, double tolrel ) { // tolrel z.Zt. nicht benutzt vector<double> aux; @@ -435,7 +429,7 @@ double mystd::sum( const vector<double>& V ) //* file names, globbing, file read *// //**************************************************************************// -void mystd::fname_divide( const string fname, +void mystd::fname_divide( const string& fname, string *fdir, string *fshort, string *fext ) // divide "dir/short.ext" into "dir", "short", "ext" // if some of the three return values are not needed, the user may supply 0 @@ -454,8 +448,8 @@ void mystd::fname_divide( const string fname, } } -int mystd::glob_file_list( const string text, - const string pre, const string ext, +int mystd::glob_file_list( const string& text, + const string& pre, const string& ext, vector<string> *flong, vector<string> *fshort ) // input: // text: bash-like file list @@ -494,8 +488,8 @@ int mystd::glob_file_list( const string text, return flong->size(); } -int mystd::glob_one_file(const string text, const string pre, const string ext, - string *fname) +int mystd::glob_one_file( const string& text, const string& pre, + const string& ext, string *fname) { vector<string> flong, fshort; int ret = glob_file_list(text, pre, ext, &flong, &fshort); @@ -503,8 +497,8 @@ int mystd::glob_one_file(const string text, const string pre, const string ext, return ret; } -FILE* mystd::glob_fopen(const string text, const string pre, const string ext, - const char* mod, string *fname) +FILE* mystd::glob_fopen( const string& text, const string& pre, + const string& ext, const char* mod, string *fname) { string flong; if (glob_one_file(text, pre, ext, &flong)!=1) return 0; @@ -537,9 +531,9 @@ int mystd::freadln( FILE *fd, string *s ) #include <gsl/gsl_integration.h> double mystd::Integrate( double (*func_) (double, void*), void *data_, - const double low, const double hig, - const uint mode, const double epsabs, - const double epsrel ) + double low, double hig, + uint mode, double epsabs, + double epsrel ) { gsl_function F; F.function = func_; diff --git a/pub/src/mystd.h b/pub/src/mystd.h index f49d0a9f549b360dad6c2ebab8d336221a20a49c..1439e600d548e9f6d26cec5dfde6b5db93f6bf7d 100644 --- a/pub/src/mystd.h +++ b/pub/src/mystd.h @@ -9,13 +9,13 @@ using namespace std; //! convert to string -string strg(const string& val); -string strg(const bool& val); -string strg(const int& val); -string strg(const uint& val); -string strg(const ulong& val); -string strg(const char& val); -string strg(const double& val); +string strg( const string& val ); +string strg( bool val ); +string strg( int val ); +string strg( uint val ); +string strg( ulong val ); +string strg( char val ); +string strg( double val ); //! yaml string yaml( const string ); @@ -28,14 +28,14 @@ namespace mystd { //! convert from string bool str2vec( string inp, vector<double> *V, uint nmax=0, bool force=true ); - bool any2dbl( const string inp, double *val ); - bool any2int( const string inp, int *val ); - bool any2uint( const string inp, uint *val ); - void string_extract_word( const string in, string *out1, string *out2 ); - void string_extract_line( const string in, string *out1, string *out2 ); + bool any2dbl( const string& inp, double *val ); + bool any2int( const string& inp, int *val ); + bool any2uint( const string& inp, uint *val ); + void string_extract_word( const string& in, string *out1, string *out2 ); + void string_extract_line( const string& in, string *out1, string *out2 ); //! string operations - string strip( string const& str, char const* sepSet=" \n" ); + string strip( const string& str, const char* sepSet=" \n" ); //! improved libc calls void system( string cmd ); @@ -57,19 +57,20 @@ namespace mystd { double sum( const vector<double>& V ); // file names, globbing, file read - void fname_divide( const string fname, string *fdir, string *fshort, string *fext); - int glob_file_list(const string text, - const string pre, const string ext, + void fname_divide( const string& fname, string *fdir, + string *fshort, string *fext); + int glob_file_list(const string& text, + const string& pre, const string& ext, vector<string> *flong, vector<string> *fshort=0); - int glob_one_file(const string text, - const string pre, const string ext, string *fname); - FILE* glob_fopen(const string text, const string pre, const string ext, + int glob_one_file(const string& text, + const string& pre, const string& ext, string *fname); + FILE* glob_fopen(const string& text, const string& pre, const string& ext, const char* mod, string *fname=0); int freadln( FILE *fd, string *s ); // integration double Integrate( double (*func_) (double, void*), void *data_, - const double low, const double hig, - const uint mode, const double epsabs, - const double epsrel ); + double low, double hig, + uint mode, double epsabs, + double epsrel ); } diff --git a/pub/yaml-cpp/src/.libs/libyaml4frida.a b/pub/yaml-cpp/src/.libs/libyaml4frida.a deleted file mode 100644 index 8b277f0dd5dcdcb9c4b6c0b7a32153664f111266..0000000000000000000000000000000000000000 --- a/pub/yaml-cpp/src/.libs/libyaml4frida.a +++ /dev/null @@ -1 +0,0 @@ -!<arch> diff --git a/pub/yaml-cpp/src/.libs/libyaml4frida.so b/pub/yaml-cpp/src/.libs/libyaml4frida.so deleted file mode 120000 index e7b066e90c7a6365421e845e978f9498e10113b1..0000000000000000000000000000000000000000 --- a/pub/yaml-cpp/src/.libs/libyaml4frida.so +++ /dev/null @@ -1 +0,0 @@ -libyaml4frida.so.0.0.0 \ No newline at end of file diff --git a/pub/yaml-cpp/src/.libs/libyaml4frida.so.0 b/pub/yaml-cpp/src/.libs/libyaml4frida.so.0 deleted file mode 120000 index e7b066e90c7a6365421e845e978f9498e10113b1..0000000000000000000000000000000000000000 --- a/pub/yaml-cpp/src/.libs/libyaml4frida.so.0 +++ /dev/null @@ -1 +0,0 @@ -libyaml4frida.so.0.0.0 \ No newline at end of file diff --git a/pub/yaml-cpp/src/.libs/libyaml4frida.so.0.0.0 b/pub/yaml-cpp/src/.libs/libyaml4frida.so.0.0.0 deleted file mode 100755 index 2c461719b9a42a5978acebacb26092fddb0bc389..0000000000000000000000000000000000000000 Binary files a/pub/yaml-cpp/src/.libs/libyaml4frida.so.0.0.0 and /dev/null differ