replace.str 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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$ */
  6. /* DEFINITIONS FOR THE MACRO REPLACEMENT ROUTINES */
  7. struct repl {
  8. struct repl *next;
  9. struct idf *r_idf; /* name of the macro */
  10. struct args *r_args; /* replacement parameters */
  11. int r_level; /* level of insertion */
  12. int r_size; /* current size of replacement buffer */
  13. char *r_ptr; /* replacement text index pointer */
  14. char *r_text; /* replacement text */
  15. };
  16. /* ALLOCDEF "repl" 4 */
  17. #define NO_REPL (struct repl *)0
  18. /* The implementation of the ## operator is currently very clumsy.
  19. When the the ## operator is used the arguments are taken from
  20. the raw buffer; this buffer contains a precise copy of the
  21. original argument. The fully expanded copy is in the arg buffer.
  22. The two copies are here explicitely because:
  23. #define ABC f()
  24. #define ABCD 2
  25. #define g(x, y) x ## y + h(x)
  26. g(ABC, D);
  27. In this case we need two copies: one raw copy for the pasting
  28. operator, and an expanded one as argument for h().
  29. */
  30. struct args {
  31. char *a_expptr; /* expanded argument index pointer */
  32. char *a_expbuf; /* expanded argument buffer pointer */
  33. int a_expsize; /* current size of expanded buffer */
  34. char *a_expvec[NPARAMS]; /* expanded argument vector */
  35. char *a_rawptr; /* raw argument index pointer */
  36. char *a_rawbuf; /* raw argument buffer pointer */
  37. int a_rawsize; /* current size of raw buffer */
  38. char *a_rawvec[NPARAMS]; /* raw argument vector */
  39. };
  40. /* ALLOCDEF "args" 2 */
  41. #define NO_ARGS (struct args *)0