C Macros

PreviousUpNext
Up: The doctext Program Next: Enums and Structs Previous: C Routines

C macros are indicated by the structured comment /*M ... M*/. Unlike the case of C routines, macro definitions do not provide any information on the types of the arguments. Thus, the body of a structured comment for a C macro should include a synopsis section, containing a declaration of the macro as if it were a C routine. For example, if the Swap example were implemented as a macro, the structured comment for it would look like

 
/*M 
   Swap - Swaps two pointers 

Parameters: . ptr1,ptr2 - Pointers to swap

Synopsis: void Swap( ptr1, ptr2 ) void **ptr1, **ptr2; M*/

It is important that the word Synopsis be used; doctext and related programs (bfort and doc2lt) use this name to find the C-like declaration for the macro.


PreviousUpNext
Up: The doctext Program Next: Enums and Structs Previous: C Routines