Skip to content
Snippets Groups Projects
Commit 935790b0 authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

maintainer clean, autoreconfig'ed

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