/* * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. * See the copyright notice in the ACK home directory, in the file "Copyright". */ /* $Id$ */ /* DEFINITIONS FOR THE MACRO REPLACEMENT ROUTINES */ #ifndef _REPLACE_H_ #define _REPLACE_H_ #include "parameters.h" struct repl { struct repl *next; struct idf *r_idf; /* name of the macro */ struct args *r_args; /* replacement parameters */ int r_level; /* level of insertion */ int r_size; /* current size of replacement buffer */ char *r_ptr; /* replacement text index pointer */ char *r_text; /* replacement text */ }; /* ALLOCDEF "repl" 4 */ #define NO_REPL (struct repl *)0 /* The implementation of the ## operator is currently very clumsy. When the the ## operator is used the arguments are taken from the raw buffer; this buffer contains a precise copy of the original argument. The fully expanded copy is in the arg buffer. The two copies are here explicitely because: #define ABC f() #define ABCD 2 #define g(x, y) x ## y + h(x) g(ABC, D); In this case we need two copies: one raw copy for the pasting operator, and an expanded one as argument for h(). */ struct args { char *a_expptr; /* expanded argument index pointer */ char *a_expbuf; /* expanded argument buffer pointer */ int a_expsize; /* current size of expanded buffer */ char *a_expvec[NPARAMS]; /* expanded argument vector */ char *a_rawptr; /* raw argument index pointer */ char *a_rawbuf; /* raw argument buffer pointer */ int a_rawsize; /* current size of raw buffer */ char *a_rawvec[NPARAMS]; /* raw argument vector */ }; /* ALLOCDEF "args" 2 */ #define NO_ARGS (struct args *)0 struct idf; void unstackrepl(void); int replace(register struct idf *idf); void EnableMacros(void); void add2repl(register struct repl *repl, int ch); #endif /* REPLACE_H_ */