Macros used in W3 code

These are macros which make it less tedious to program in portable C. They are defined in HTUtils.h. See Language features.


Generates the format parameter list for a function heading. Expands to either an ANSI or non-ANSI argument declaration list. Note in order to do this, it has to take one argument for the type and one for the argument name. This is messy but necessary. See example, also NOARGS, PARAMS.


As ARGS1, macros ARGS2, ARGS3 etc up to ARGS9 generate arguments lists for function headings with different numbers of arguments. See also NOARGS, PARAMS.


This is used instead of the keyword "const" which does not exist in K&R C. It expands to const when using ANSI C, otherwise nothing.


Generates the argument list for a function header with no arguments.. See also ARGS1, NOPARAMS.


This is used to generate the formal parameter list in a function declaration having no parameters. It expands to (void) for ANSI C and () for non-ANSI. See also: PARAMS


Define formal parameter list in function declaration. The normal ANSI function header is given enclosed in DOUBLE parentheses. This causes the whole list to be replaced with just () when a non-ANSI compiler is used. See also: NOPARAMS


This is a safe string assignment function. It takes as arguments two pointers. If the first is non-zero, it frees the block it points to. It then allocates a block of size sufficient for the zero-terminated string pointed to by the second, and assigns the first pointer to point to that block. Implemented nowadays in terms of a function. Note that unlike teh function, StrAllocCopy takes its first pointer by name not address (p, not &p).

(Part of style guide)


Tim BL