00001
00021 #ifndef __UTIL_HACK_H__
00022 #define __UTIL_HACK_H__
00023
00024 #ifdef __cplusplus
00025 extern "C" {
00026 #endif
00027
00028 #include <stdio.h>
00029 #include <stdlib.h>
00030 #include <string.h>
00031 #include <assert.h>
00032 #include <time.h>
00033 #include <math.h>
00034
00035 #define EXTERN extern
00036 #define NIL(type) ((type *) 0)
00037 #define random rand
00038 #define srandom srand
00039
00040 #define util_cpu_time Extra_CpuTime
00041 #define getSoftDataLimit Extra_GetSoftDataLimit
00042 #define util_getopt_reset Extra_UtilGetoptReset
00043 #define util_getopt Extra_UtilGetopt
00044 #define util_print_time Extra_UtilPrintTime
00045 #define util_strsav Extra_UtilStrsav
00046 #define util_tilde_expand Extra_UtilTildeExpand
00047 #define util_file_search Extra_UtilFileSearch
00048 #define MMoutOfMemory Extra_UtilMMoutOfMemory
00049
00050 #define util_optarg globalUtilOptarg
00051 #define util_optind globalUtilOptind
00052
00053 #ifndef ARGS
00054 # ifdef __STDC__
00055 # define ARGS(args) args
00056 # else
00057 # define ARGS(args) ()
00058 # endif
00059 #endif
00060
00061 #ifndef ABS
00062 # define ABS(a) ((a) < 0 ? -(a) : (a))
00063 #endif
00064
00065 #ifndef MAX
00066 # define MAX(a,b) ((a) > (b) ? (a) : (b))
00067 #endif
00068
00069 #ifndef MIN
00070 # define MIN(a,b) ((a) < (b) ? (a) : (b))
00071 #endif
00072
00073 #define ALLOC(type, num) ((type *) malloc(sizeof(type) * (num)))
00074 #define FREE(obj) ((obj) ? (free((char *) (obj)), (obj) = 0) : 0)
00075 #define REALLOC(type, obj, num) \
00076 ((obj) ? ((type *) realloc((char *)(obj), sizeof(type) * (num))) : \
00077 ((type *) malloc(sizeof(type) * (num))))
00078
00079 extern long Extra_CpuTime();
00080 extern int Extra_GetSoftDataLimit();
00081 extern void Extra_UtilGetoptReset();
00082 extern int Extra_UtilGetopt( int argc, char *argv[], char *optstring );
00083 extern char * Extra_UtilPrintTime( long t );
00084 extern char * Extra_UtilStrsav( char *s );
00085 extern char * Extra_UtilTildeExpand( char *fname );
00086 extern char * Extra_UtilFileSearch( char *file, char *path, char *mode );
00087
00088 extern char * globalUtilOptarg;
00089 extern int globalUtilOptind;
00090
00091 #ifdef __cplusplus
00092 }
00093 #endif
00094
00095 #endif