replace.str 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. /* $Header$ */
  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. char *r_ptr; /* replacement text pointer */
  13. char r_text[LAPBUF]; /* replacement text */
  14. };
  15. /* ALLOCDEF "repl" 4 */
  16. #define NO_REPL (struct repl *)0
  17. /* The implementation of the ## operator is currently very clumsy.
  18. When the the ## operator is used the arguments are taken from
  19. the raw buffer; this buffer contains a precise copy of the
  20. original argument. The fully expanded copy is in the arg buffer.
  21. The two copies are here explicitely because:
  22. #define ABC f()
  23. #define ABCD 2
  24. #define g(x, y) x ## y + h(x)
  25. g(ABC, D);
  26. In this case we need two copies: one raw copy for the pasting
  27. operator, and an expanded one as argument for h().
  28. */
  29. struct args {
  30. char *a_expptr; /* expanded argument pointer */
  31. char *a_expvec[NPARAMS]; /* expanded argument vector */
  32. char a_expbuf[ARGBUF]; /* expanded argument buffer space */
  33. char *a_rawptr; /* raw argument pointer */
  34. char *a_rawvec[NPARAMS]; /* raw argument vector */
  35. char a_rawbuf[ARGBUF]; /* raw argument buffer space */
  36. };
  37. /* ALLOCDEF "args" 2 */
  38. #define NO_ARGS (struct args *)0