2 /********************************/
3 #ifndef _MOMUSYS_H_ /* TO AVOID REENTERING CODE */
4 /********************************/
5 /********************************/
6 # define _MOMUSYS_H_ /* NOW IMPOSSIBLE TO REENTER */
7 /********************************/
9 /********************************/
10 # if defined(C_ANSI) || defined(__STDC__) /* IF C ANSI MODE IS SUPPORTED */
11 # define C_IS_ANSI /********************************/
15 /********************************/
16 # include <stdio.h> /* SURE ALL Def. ARE DEFINED ! */
17 # include <stdlib.h> /* SURE ALL Def. ARE DEFINED ! */
18 # include <math.h> /********************************/
21 /********************************/
22 # if defined (SYSV) || defined (__STDC__)
23 # include <string.h> /********************************/
24 # define bzero(s1, length) memset(s1, '\0', length)
25 # define bcopy(s1, s2, length) memcpy(s1, s2 , length)
26 # define bcmp(s1, s2, length) memcmp(s1, s2, length)
27 # define memzero(s1, length) memset(s1, '\0', length)
28 # define index(s1, c) strchr(s1, c)
29 # define rindex(s1, c) strrchr(s1, c)
32 # define strchr(s1, c) index(s1, c)
33 # define strrchr(s1, c) rindex(s1, c)
34 # define memcpy(s1, s2 , length) bcopy(s1, s2, length)
35 # define memzero(s1, length) bzero(s1, length)
36 # define memcmp(s1, s2, length) bcmp(s1, s2, length)
40 /********************************/
41 # if !defined(FALSE) || ((FALSE)!= 0) /* TO AVOID MULTIPLE DEFINE */
42 # define FALSE 0 /* AND BE SURE FALSE = 0 */
43 # endif /********************************/
44 # if !defined(TRUE) || ((TRUE) != 1) /* TO AVOID MULTIPLE DEFINE */
45 # define TRUE 1 /* AND BE SURE TRUE = 1 */
46 # endif /********************************/
52 /**************************************/
53 /**** GENERAL TYPES DEFINITIONS *******/
54 /**************************************/
60 typedef const char C_Char
;
62 typedef unsigned char Byte
;
63 typedef Const Byte C_Byte
;
64 typedef unsigned char UChar
;
65 typedef Const UChar C_UChar
;
67 typedef short int Short
;
68 typedef short int SInt
;
69 typedef unsigned short UShort
;
70 typedef unsigned short USInt
;
71 typedef Const
short C_Short
;
72 typedef Const
short C_SInt
;
73 typedef Const UShort C_UShort
;
74 typedef Const UShort C_USInt
;
77 typedef long int LInt
;
78 typedef Const
int C_Int
;
79 typedef unsigned int U_Int
;
81 typedef unsigned int UInt
;
82 typedef unsigned long int ULInt
;
83 typedef Const UInt C_UInt
;
86 typedef Const
float C_Float
;
88 typedef double Double
;
89 typedef Const
double C_Double
;
93 /* Alternatibe type redefinition */
99 typedef unsigned int UINT32
;
100 typedef unsigned short UINT16
;
101 typedef unsigned char UINT8
;
105 typedef signed char INT8
;
110 typedef unsigned long BITS32
;
111 typedef unsigned short BITS16
;
112 typedef unsigned char BYTE
;
114 typedef unsigned char BOOL
;
118 /**************************************/
119 /**** GENERAL MACRO DEFINITIONS *******/
120 /**************************************/
122 # define MAX(a,b) (((a) > (b)) ? (a) : (b))
126 # define MIN(a,b) (((a) < (b)) ? (a) : (b))
129 # define CLIP(a,i,s) (((a) > (s)) ? (s) : MAX(a,i))
130 # define INT(a) ((Int) (floor((Double) a)))
131 # define MNINT(a) ((a) < 0 ? (Int)(a - 0.5) : (Int)(a + 0.5))
132 # define MAX3(x,y,z) MAX(MAX(x,y),z)
133 # define MIN3(x,y,z) MIN(MIN(x,y),z)
134 # define MEDIAN(x,y,z) ((x)+(y)+(z)-MAX3(x,y,z)-MIN3(x,y,z))
136 # define POW2(a) ((a)*(a))
137 # define SQUARE(a) ((a)*(a))
138 # define POW3(a) ((a)*(a)*(a))
139 # define CUBE(a) ((a)*(a)*(a))
141 # define ABS(x) (((x) < 0) ? -(x) : (x))
142 # define SIGN(x) (((x) < 0) ? -1 : 1)
143 # define EVEN(a) ((a) % 2) == 0)
144 # define ODD(a) ((a) % 2) == 1)
146 # define STRLEN(P_string) ((P_string==NULL) ? strlen(P_string) : -1)
147 # define TYPE_MALLOC(type,nb) ((type *) malloc(sizeof(type)*nb))
148 # define NEW(type) ((type *) malloc(sizeof(type) ))
150 #define MOMCHECK(a) if ((a) == 0) fprintf(stdout, "MOMCHECK failed in file %s, line %i\n", __FILE__, __LINE__)
152 /********************************/
153 # ifdef C_IS_ANSI /* IF C ANSI MODE IS SUPPORTED */
154 /********************************/
155 # define _ANSI_ARGS_(argv) argv /* MACRO FOR PROTOTYPING */
156 # define _P_(argv) argv /* <=> _ANSI_ARGS, BUT SHORTER! */
157 /********************************/
158 # else /* IF C ANSI IS NOT SUPPORTED */
159 /********************************/
160 # define _ANSI_ARGS_(argv) () /* MACRO FOR PROTOTYPING */
161 # define _P_(argv) () /* <=> _ANSI_ARGS, BUT SHORTER! */
162 /********************************/
165 #include "mom_structs.h"
167 #endif /* _MOMUSYS_H_ */ /* End _MOMUSYS_H_ */
168 /********************************/