1989-10-23 10:35:56 +00:00
|
|
|
/*
|
|
|
|
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
|
|
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
|
|
|
*/
|
|
|
|
/* $Header$ */
|
|
|
|
/* DEFINITIONS FOR THE MACRO REPLACEMENT ROUTINES */
|
|
|
|
|
|
|
|
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 */
|
1989-11-22 12:59:15 +00:00
|
|
|
int r_size; /* current size of replacement buffer */
|
|
|
|
char *r_ptr; /* replacement text index pointer */
|
|
|
|
char *r_text; /* replacement text */
|
1989-10-23 10:35:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* 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 {
|
1989-11-22 12:59:15 +00:00
|
|
|
char *a_expptr; /* expanded argument index pointer */
|
|
|
|
char *a_expbuf; /* expanded argument buffer pointer */
|
|
|
|
int a_expsize; /* current size of expanded buffer */
|
1989-10-23 10:35:56 +00:00
|
|
|
char *a_expvec[NPARAMS]; /* expanded argument vector */
|
1989-11-22 12:59:15 +00:00
|
|
|
char *a_rawptr; /* raw argument index pointer */
|
|
|
|
char *a_rawbuf; /* raw argument buffer pointer */
|
|
|
|
int a_rawsize; /* current size of raw buffer */
|
1989-10-23 10:35:56 +00:00
|
|
|
char *a_rawvec[NPARAMS]; /* raw argument vector */
|
|
|
|
};
|
|
|
|
|
|
|
|
/* ALLOCDEF "args" 2 */
|
|
|
|
|
|
|
|
#define NO_ARGS (struct args *)0
|