00001
00002
00003 #ifndef _MOMUSYS_H_
00004
00005
00006 # define _MOMUSYS_H_
00007
00008 # include "non_unix.h"
00009
00010 # if defined(C_ANSI) || defined(__STDC__)
00011 # define C_IS_ANSI
00012 # define _C_ANSI_
00013 # endif
00014
00015
00016 # include <stdio.h>
00017 # include <stdlib.h>
00018 # include <math.h>
00019
00020
00021
00022 # if defined (SYSV) || defined (__STDC__)
00023 # include <string.h>
00024 # define bzero(s1, length) memset(s1, '\0', length)
00025 # define bcopy(s1, s2, length) memcpy(s1, s2 , length)
00026 # define bcmp(s1, s2, length) memcmp(s1, s2, length)
00027 # define memzero(s1, length) memset(s1, '\0', length)
00028 # define index(s1, c) strchr(s1, c)
00029 # define rindex(s1, c) strrchr(s1, c)
00030 # else
00031 # include <strings.h>
00032 # define strchr(s1, c) index(s1, c)
00033 # define strrchr(s1, c) rindex(s1, c)
00034 # define memcpy(s1, s2 , length) bcopy(s1, s2, length)
00035 # define memzero(s1, length) bzero(s1, length)
00036 # define memcmp(s1, s2, length) bcmp(s1, s2, length)
00037 # endif
00038
00039
00040
00041 # if !defined(FALSE) || ((FALSE)!= 0)
00042 # define FALSE 0
00043 # endif
00044 # if !defined(TRUE) || ((TRUE) != 1)
00045 # define TRUE 1
00046 # endif
00047
00048 # ifndef NULL
00049 # define NULL 0
00050 # endif
00051
00052
00053
00054
00055 #define Const const
00056
00057 typedef void Void ;
00058
00059 typedef char Char ;
00060 typedef const char C_Char ;
00061
00062 typedef unsigned char Byte ;
00063 typedef Const Byte C_Byte ;
00064 typedef unsigned char UChar ;
00065 typedef Const UChar C_UChar ;
00066
00067 typedef short int Short ;
00068 typedef short int SInt ;
00069 typedef unsigned short UShort ;
00070 typedef unsigned short USInt ;
00071 typedef Const short C_Short ;
00072 typedef Const short C_SInt ;
00073 typedef Const UShort C_UShort ;
00074 typedef Const UShort C_USInt ;
00075
00076 typedef int Int ;
00077 typedef long int LInt ;
00078 typedef Const int C_Int ;
00079 typedef unsigned int U_Int ;
00080
00081 typedef unsigned int UInt ;
00082 typedef unsigned long int ULInt ;
00083 typedef Const UInt C_UInt ;
00084
00085 typedef float Float ;
00086 typedef Const float C_Float ;
00087
00088 typedef double Double ;
00089 typedef Const double C_Double ;
00090
00091 typedef FILE File ;
00092
00093
00094 #if 0
00095 typedef long INT32;
00096 typedef int INT32;
00097 typedef short INT16;
00098 typedef char INT8;
00099 typedef unsigned int UINT32;
00100 typedef unsigned short UINT16;
00101 typedef unsigned char UINT8;
00102
00103
00104 # if __STDC__
00105 typedef signed char INT8;
00106 # else
00107 typedef char INT8;
00108 # endif
00109
00110 typedef unsigned long BITS32;
00111 typedef unsigned short BITS16;
00112 typedef unsigned char BYTE;
00113
00114 typedef unsigned char BOOL;
00115 #endif
00116
00117
00118
00119
00120
00121 # ifndef MAX
00122 # define MAX(a,b) (((a) > (b)) ? (a) : (b))
00123 # endif
00124
00125 # ifndef MIN
00126 # define MIN(a,b) (((a) < (b)) ? (a) : (b))
00127 # endif
00128
00129 # define CLIP(a,i,s) (((a) > (s)) ? (s) : MAX(a,i))
00130 # define INT(a) ((Int) (floor((Double) a)))
00131 # define MNINT(a) ((a) < 0 ? (Int)(a - 0.5) : (Int)(a + 0.5))
00132 # define MAX3(x,y,z) MAX(MAX(x,y),z)
00133 # define MIN3(x,y,z) MIN(MIN(x,y),z)
00134 # define MEDIAN(x,y,z) ((x)+(y)+(z)-MAX3(x,y,z)-MIN3(x,y,z))
00135
00136 # define POW2(a) ((a)*(a))
00137 # define SQUARE(a) ((a)*(a))
00138 # define POW3(a) ((a)*(a)*(a))
00139 # define CUBE(a) ((a)*(a)*(a))
00140
00141 # define ABS(x) (((x) < 0) ? -(x) : (x))
00142 # define SIGN(x) (((x) < 0) ? -1 : 1)
00143 # define EVEN(a) ((a) % 2) == 0)
00144 # define ODD(a) ((a) % 2) == 1)
00145
00146 # define STRLEN(P_string) ((P_string==NULL) ? strlen(P_string) : -1)
00147 # define TYPE_MALLOC(type,nb) ((type *) malloc(sizeof(type)*nb))
00148 # define NEW(type) ((type *) malloc(sizeof(type) ))
00149
00150 #define MOMCHECK(a) if ((a) == 0) fprintf(stdout, "MOMCHECK failed in file %s, line %i\n", __FILE__, __LINE__)
00151
00152
00153 # ifdef C_IS_ANSI
00154
00155 # define _ANSI_ARGS_(argv) argv
00156 # define _P_(argv) argv
00157
00158 # else
00159
00160 # define _ANSI_ARGS_(argv) ()
00161 # define _P_(argv) ()
00162
00163 # endif
00164
00165 #include "mom_structs.h"
00166
00167 #endif
00168
00169
00170