Next: 6.2.2 getparam.h
Up: 6.2 The NEMO Macro
Previous: 6.2 The NEMO Macro
  Contents
  Index
The macro package stdinc.h provides all basic
definitions that ALL of NEMO's code must include as the first include
file. It also replaces the often used stdio.h include file in C
programs. The stdinc.h include file will provide us with a way to
standardize on future expansions, and make code more
machine/implementation independent (e.g. POSIX.1). In
addition, it defines a more logical standard for C notation. For
example, the normal C practice of using pointers to character for
pointer to byte, or integer for bool, tends to encourage a degree of
sloppy programming, which can be hard to understand at a later date.
A few of the basic definitions in this package:
- NULL:
- macro for 0, used to distinguish null characters and null pointers.
This is often already defined by stdio.h.
There is potential trouble when NULL has been set to
(void *)0,
'\0'
is OK though. Example on IBM's AIX operating
system.
- bool:
- typedef for short int or char,
used to specify boolean data. See also next item.
6.2.
- TRUE, FALSE:
- macros for 1 and 0, respectively, following normal C
conventions.
- byte:
- typedef for unsigned char, used to specify byte-sized data.
- string:
- typedef for char *, used to point to strings. Don't use
string for pointers you increment, decrement or explicitly
follow (using *); such pointers are really char *.
- real, realptr:
- typedef for float or double (float * or double *,
respectively), depending on the use of the SINGLEPREC flag.
The default is double.
- proc, iproc, rproc:
- typedefs for pointers to procedures (void functions), integer-valued
functions and real-valued functions respectively.
- local, permanent:
- macros for static. Use local when declaring variables or
functions within a file to be local to that file. They will not appear
in the symbol table be usable as external symbols. Use
permanent within a function, to retain their value upon
subsequent re-entries in that function.
- PI, TWO_PI, FOUR_PI, HALF_PI, FRTHRD_PI:
- macros for , , , and ,
respectively.
- ABS(x), SGN(x):
- macros for absolute value and sign of x, irrespective of the
type of x.. Beware of side effects.
- MAX(x,y), MIN(x,y):
- macros for the maximum and minimum of x,y, irrespective of the
type of x,y.
Beware of side effects.
- stream:
- typedef for FILE *. They are mostly used with the NEMO
functions stropen and strclose, which are functionally
similar to fopen(3) and fclose(3), plus some added
NEMO quirks. (see section below)
Next: 6.2.2 getparam.h
Up: 6.2 The NEMO Macro
Previous: 6.2 The NEMO Macro
  Contents
  Index
(c) Peter Teuben