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