Listing 7 Declaring synthesized templates in C

/* decl_gen.h -- declarations generating file */

/* max function envelope */
#ifdef max /* C uses function name test */
  extern max_TYPE max(max_TYPE x, max_TYPE y);
#endif

#ifdef stack   /* open stack struct envelope */
#ifdef stack_MAX_ITEMS /* default parameters */
  #define stack_MAX_ITEMS 5U
#endif

struct stack {
   stack_ITEM * itemPtrs[stack_MAX_ITEMS];
   unsigned items;
};

extern void stack_scope(init)
   (struct stack * stackPtr);
extern int stack_scope(full)
   (struct stack * stackPtr);
extern int stack_scope(push)
   (struct stack * stackPtr, stack_ITEM * itemPtr);
extern stack_ITEM * stack_scope(top)
   (struct stack * stackPtr);
extern stack_ITEM * stacks_cope(pop)
   (struct stack * stackPtr);

#endif  /* close stack struct envelope */

#ifndef def_gen_c   /* parameter wrapup section */
  #undef max
  #undef max_TYPE
  #under stack
  #undef stack_ITEM
  #undef stack_MAX_ITEMS
  #undef stack_scope
#endif
/* End of File */