3 #ifndef INCLUDED_H_DEFINE_H
4 #define INCLUDED_H_DEFINE_H
7 * Define some simple constants
16 # define NULL ((void*)0)
18 # define NULL ((char*)0)
19 # endif /* __STDC__ */
24 * Hack -- assist "main-acn.c" XXX XXX XXX
34 * Hack -- force definitions -- see fd_seek()
47 * Hack -- force definitions -- see fd_lock() XXX XXX XXX
61 * The constants "TRUE" and "FALSE"
73 /**** Simple "Macros" ****/
76 #define lbtokg(x) ((int)(((x)*4536)/1000))
77 #define lbtokg1(x) ((lbtokg(x)+5)/100)
78 #define lbtokg2(x) ( ( (lbtokg(x)+5)%100)/10)
80 #define lbtokg(x) ((int)((x)*5))
81 #define lbtokg1(x) (lbtokg(x)/100)
82 #define lbtokg2(x) ((lbtokg(x)%100)/10)
85 * Force a character to lowercase/uppercase
87 #define FORCELOWER(A) ((isupper((A))) ? tolower((A)) : (A))
88 #define FORCEUPPER(A) ((islower((A))) ? toupper((A)) : (A))
92 * Non-typed minimum value macro
95 #define MIN(a,b) (((a) > (b)) ? (b) : (a))
98 * Non-typed maximum value macro
101 #define MAX(a,b) (((a) < (b)) ? (b) : (a))
104 * Non-typed absolute value macro
107 #define ABS(a) (((a) < 0) ? (-(a)) : (a))
110 * Non-typed sign extractor macro
113 #define SGN(a) (((a) < 0) ? (-1) : ((a) != 0))
117 * Hack -- allow use of "ASCII" and "EBCDIC" for "indexes", "digits",
118 * and "Control-Characters".
120 * Note that all "index" values must be "lowercase letters", while
121 * all "digits" must be "digits". Control characters can be made
122 * from any legal characters. XXX XXX XXX
125 # define A2I(X) alphatoindex(X)
126 # define I2A(X) indextoalpha(X)
127 # define D2I(X) ((X) - '0')
128 # define I2D(X) ((X) + '0')
129 # define KTRL(X) ((X) & 0x1F)
130 # define ESCAPE '\033'
132 # define A2I(X) ((X) - 'a')
133 # define I2A(X) ((X) + 'a')
134 # define D2I(X) ((X) - '0')
135 # define I2D(X) ((X) + '0')
136 # define KTRL(X) ((X) & 0x1F)
137 # define ESCAPE '\033'
141 * Refer to the member at offset of structure
143 #define atoffset(TYPE, STRUCT_PTR, OFFSET) (*(TYPE*)(((char*)STRUCT_PTR) + (OFFSET)))