Pristine Ack-5.5
[Ack-5.5.git] / lang / cem / cpp.ansi / replace.str
1 /*
2  * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
3  * See the copyright notice in the ACK home directory, in the file "Copyright".
4  */
5 /* $Id: replace.str,v 1.3 1994/06/24 11:38:16 ceriel Exp $ */
6 /*      DEFINITIONS FOR THE MACRO REPLACEMENT ROUTINES          */
7
8 struct repl {
9         struct  repl *next;
10         struct  idf *r_idf;             /* name of the macro */
11         struct  args *r_args;           /* replacement parameters */
12         int     r_level;                /* level of insertion */
13         int     r_size;                 /* current size of replacement buffer */
14         char    *r_ptr;                 /* replacement text index pointer */
15         char    *r_text;                /* replacement text */
16 };
17
18 /* ALLOCDEF "repl" 4 */
19
20 #define NO_REPL         (struct repl *)0
21
22 /*      The implementation of the ## operator is currently very clumsy.
23         When the the ## operator is used the arguments are taken from
24         the raw buffer; this buffer contains a precise copy of the
25         original argument. The fully expanded copy is in the arg buffer.
26         The two copies are here explicitely because:
27
28                 #define ABC     f()
29                 #define ABCD    2
30                 #define g(x, y) x ## y + h(x)
31
32                 g(ABC, D);
33
34         In this case we need two copies: one raw copy for the pasting
35         operator, and an expanded one as argument for h().
36 */
37 struct args {
38         char    *a_expptr;              /* expanded argument index pointer */
39         char    *a_expbuf;              /* expanded argument buffer pointer */
40         int     a_expsize;              /* current size of expanded buffer */
41         char    *a_expvec[NPARAMS];     /* expanded argument vector */
42         char    *a_rawptr;              /* raw argument index pointer */
43         char    *a_rawbuf;              /* raw argument buffer pointer */
44         int     a_rawsize;              /* current size of raw buffer */
45         char    *a_rawvec[NPARAMS];     /* raw argument vector */
46 };
47
48 /* ALLOCDEF "args" 2 */
49
50 #define NO_ARGS         (struct args *)0