Jump to content
Go to the documentation of this file.
85 #define PRIVATE static
90 #if !defined(TRUE) || ((TRUE) != 1)
93 #if !defined(FALSE) || ((FALSE) != 0)
97 #define S_FILE_FOUND -3
98 #define S_FILE_NOT_FOUND -2
101 #define S_END_OF_FILE 1
106 #define PRINTF printf("(%s,%d) ",__FILE__,__LINE__); printf
107 #define FPRINTF fprintf(stderr,"(%s,%d) ",__FILE__,__LINE__); fprintf
110 #define PRINTF if (!NOPRINT) printf
111 #define FPRINTF if (!NOPRINT) fprintf
120 #define CHKPRT1(FMT,ARG) PRINTF("%s="# FMT,# ARG,ARG)
121 #define CHKPRT2(FMT,ARG1,ARG2) PRINTF("%s="# FMT,# ARG1 #ARG2,ARG1,ARG2)
122 #define CHKIPRT(EX) PRINTF("%s=%d\n", # EX ,EX)
123 #define CHKFPRT(EX) PRINTF("%s=%f\n", # EX ,EX)
124 #define CHKSPRT(EX) PRINTF("%s=%s\n", # EX ,EX)
126 #define CHKPRT1(FMT,ARG) PRINTF("%s="FMT,"ARG",ARG)
127 #define CHKPRT2(FMT,ARG1,ARG2) PRINTF("%s="FMT,"ARG1,ARG2",ARG1,ARG2)
128 #define CHKIPRT(EX) PRINTF("%s=%d\n","EX",EX)
129 #define CHKFPRT(EX) PRINTF("%s=%f\n","EX",EX)
130 #define CHKSPRT(EX) PRINTF("%s=%s\n","EX",EX)
133 #define MAXV(a,b) (((a) > (b)) ? (a) : (b))
134 #define MINV(a,b) (((a) > (b)) ? (b) : (a))
135 #define MODV(a,b) ((a) - ((a)/(b))*(b))
137 #define AX_PLUS_B(X,A,B) (A) * (X) + (B)
138 #define R_AX_PLUS_B(Y,A,B) ((Y) - (B)) / (A)
139 #define INRANGE(v,lo,hi) (((v - lo) >= 0) && ((hi - v) >= 0))
141 #ifdef CHECK_DUPLICATE_FREE
144 static void *mm_ptr = (
void *) 0x01;
146 #define free(x) if ((x != NULL) && (x != mm_ptr)) { free(x) ; x = mm_ptr;} else {fprintf(stderr,"%s %d: '%s' already free'd\n",__FILE__,__LINE__,#x);}
152 #include <sys/time.h>
154 static struct timeval stime_struct;
155 static struct timeval etime_struct;
156 static clock_t sclock;
157 static clock_t eclock;
159 #define ON_TIME() gettimeofday(&stime_struct);sclock=clock();fprintf(stderr,"%s : ON : %ld.%ld %ld\n",FUNC,stime_struct.tv_sec,stime_struct.tv_usec,sclock)
160 #define OFF_TIME() gettimeofday(&etime_struct);eclock=clock();fprintf(stderr,"%s : OFF : %ld.%ld %f %ld %ld\n",FUNC,etime_struct.tv_sec,etime_struct.tv_usec,(etime_struct.tv_sec - stime_struct.tv_sec)+(etime_struct.tv_usec - stime_struct.tv_usec)/1.0E6,eclock,(eclock - sclock))
184 #define byte unsigned char
190 #define SC sizeof(char)
191 #define SB sizeof(byte)
192 #define SS sizeof(short int)
193 #define SI sizeof(int)
194 #define SL sizeof(int32_t int)
195 #define SF sizeof(float)
196 #define SD sizeof(double)
226 #define OPTIONS_OFF 0
228 #define OPTIONS OPTIONS_OFF
230 #define OPTIONS_START(); if (OPTIONS) {
231 #define OPTIONS_STOP(); }
233 #define MSEC2SEC(x) ((x + 500)/1000)
234 #define SEC2MSEC(x) (x * 1000)