Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
1.3 KiB

  1. /*****************************************************************************
  2. *
  3. * predef.c
  4. *
  5. * Predefined macros.
  6. *
  7. *****************************************************************************/
  8. #include "m4.h"
  9. OP rgop[] = {
  10. #define x(cop, lop) op##cop,
  11. EachOpX()
  12. #undef x
  13. };
  14. PTCH mptchptch[] = {
  15. #define x(cop, lop) #lop,
  16. EachOp()
  17. #undef x
  18. };
  19. /*****************************************************************************
  20. *
  21. * opEof, opEoi
  22. *
  23. * Doesn't actually do anything.
  24. *
  25. *****************************************************************************/
  26. DeclareOp(opEof)
  27. {
  28. }
  29. DeclareOp(opEoi)
  30. {
  31. }
  32. /*****************************************************************************
  33. *
  34. * InitPredefs
  35. *
  36. * Add definitions for all the predefined macros.
  37. *
  38. *****************************************************************************/
  39. void STDCALL
  40. InitPredefs(void)
  41. {
  42. TCH rgtch[2];
  43. TOK tokSym;
  44. TOK tokVal;
  45. #define tch rgtch[1]
  46. PMAC pmac;
  47. rgtch[0] = tchMagic;
  48. for (tch = 0; tch < tchEof; tch++) {
  49. SetStaticPtokPtchCtch(&tokSym, mptchptch[tch], strlen(mptchptch[tch]));
  50. SetStaticPtokPtchCtch(&tokVal, rgtch, 2);
  51. pmac = pmacGetPtok(&tokSym);
  52. Assert(!pmac->pval); /* Should be a fresh token */
  53. PushdefPmacPtok(pmac, &tokVal);
  54. }
  55. }
  56. #undef tch