jplus-0.4.5
|
00001 #ifndef UTIL_H 00002 #define UTIL_H 00003 00004 #include <complex> 00005 #include <string> 00006 #include "sha1.h" 00007 00008 // the base type is "double" (64 bits on x86/x87) 00009 typedef double Real; 00010 typedef std::complex<double> Cmplx; 00011 typedef long double lReal; 00012 #define fftw(name) fftw_ ## name 00013 #define TYPE_STR "" 00014 00015 #ifndef _WIN32 00016 #define _stdcall 00017 #endif 00018 00019 // parses string as a positive integer, reporting errors 00020 // to stderr and returning 1 in case of failure, 0 if success. 00021 int parseint(char *str, int& res); 00022 00023 // additionally error is signalled if the number is <0 00024 int parsepositiveint(char *str, int& res); 00025 00026 // parses string as a positive double, reporting errors 00027 // to stderr and returning 1 in case of failure, 0 if success. 00028 int parsedouble(char *str, double& res); 00029 00030 // additionally error is signalled if the number is <0 00031 int parsepositivedouble(char *str, double& res); 00032 00034 std::string sha1tostring(SHA1 &sha1); 00035 00037 bool tol_eq(double a, double b); 00038 00039 #endif