00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef __GNUC__
00010 #pragma once
00011 #endif
00012 #ifndef _myenv_h
00013 #define _myenv_h
00014
00015 #ifdef __GNUC__
00016 #pragma interface
00017 #endif
00018
00019 #include <stdio.h>
00020
00021
00022 namespace linalg
00023 {
00024 using namespace linalg;
00025
00026
00027
00028
00029
00030 #if 0 // uncomment if the compiler sucks...
00031 typedef int bool;
00032 #define false 0
00033 #define true (!false)
00034
00035 #endif
00036
00037
00038
00039 char * xstrncpy(char * dest, const char * src, const int len);
00040
00041 inline long int sqr(const int x) { return x*x; }
00042
00043 double pow(double, long);
00044 double pow(long, long);
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057 const char * xgetenv(const char * name, const char * default_value);
00058
00059
00060
00061
00062 bool does_start_with_ci(const char * s1, const char * s2);
00063
00064
00065
00066
00067
00068
00069
00070 extern struct GFS_Default { virtual size_t operator () (const char * file_name); }
00071 GFS_default;
00072 size_t get_file_size(const char * file_name,
00073 GFS_Default& on_error = GFS_default);
00074
00075
00076
00077
00078
00079
00080 #if !defined(__GNUC__) || ((__GNUC__ == 2) && (__GNUC_MINOR__ > 7))
00081 double start_timer(void);
00082 double return_elapsed_time(const double Last_Time);
00083 #endif
00084
00085
00086
00087
00088
00089
00090
00091 void _error(const char * message,...);
00092
00093
00094
00095
00096 void message(const char * message,...);
00097
00098 #ifndef assert
00099 #define assert(ex) \
00100 (void)((ex) ? 1 : \
00101 (_error("Failed assertion " #ex " at line %d of `%s'.\n", \
00102 __LINE__, __FILE__), 0))
00103 #define assertval(ex) assert(ex)
00104 #endif
00105
00106 #define assure(expr,message) \
00107 if (expr) {;} \
00108 else _error("%s\n at line %d of '%s'.",message,__LINE__, __FILE__)
00109
00110
00111
00112
00113
00114 extern const char _Minuses [];
00115 extern const char _Asteriscs [];
00116 extern const char _Equals [];
00117
00118 }
00119 #endif
00120