macro.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /* $Header$ */
  2. /* PREPROCESSOR: DEFINITION OF MACRO DESCRIPTOR */
  3. #include "nopp.h"
  4. #ifndef NOPP
  5. /* The flags of the mc_flag field of the macro structure. Note that
  6. these flags can be set simultaneously.
  7. */
  8. #define NOFLAG 0 /* no special flags */
  9. #define FUNC 01 /* function attached */
  10. #define PREDEF 02 /* predefined macro */
  11. #define FORMALP 0200 /* mask for creating macro formal parameter */
  12. /* The macro descriptor is very simple, except the fact that the
  13. mc_text, which points to the replacement text, contains the
  14. non-ascii characters \201, \202, etc, indicating the position of a
  15. formal parameter in this text.
  16. */
  17. struct macro {
  18. struct macro *next;
  19. char * mc_text; /* the replacement text */
  20. int mc_nps; /* number of formal parameters */
  21. int mc_length; /* length of replacement text */
  22. char mc_flag; /* marking this macro */
  23. };
  24. /* allocation definitions of struct macro */
  25. /* ALLOCDEF "macro" */
  26. extern char *st_alloc();
  27. extern struct macro *h_macro;
  28. #define new_macro() ((struct macro *) \
  29. st_alloc((char **)&h_macro, sizeof(struct macro)))
  30. #define free_macro(p) st_free(p, h_macro, sizeof(struct macro))
  31. /* `token' numbers of keywords of command-line processor
  32. */
  33. #define K_UNKNOWN 0
  34. #define K_DEFINE 1
  35. #define K_ELIF 2
  36. #define K_ELSE 3
  37. #define K_ENDIF 4
  38. #define K_IF 5
  39. #define K_IFDEF 6
  40. #define K_IFNDEF 7
  41. #define K_INCLUDE 8
  42. #define K_LINE 9
  43. #define K_UNDEF 10
  44. #endif NOPP