top.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /* $Id$ */
  2. /*
  3. * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  4. * See the copyright notice in the ACK home directory, in the file "Copyright".
  5. */
  6. /* Tunable constants; may be overruled by machine descriptor table */
  7. #ifndef OP_SEPARATOR
  8. #define OP_SEPARATOR ','
  9. #endif
  10. #ifndef LABEL_TERMINATOR
  11. #define LABEL_TERMINATOR ':'
  12. #endif
  13. #ifndef LABEL_STARTER
  14. #define LABEL_STARTER 'I'
  15. #endif
  16. #ifndef OPC_TERMINATOR
  17. #define OPC_TERMINATOR ' '
  18. #endif
  19. #ifndef MAX_OPC_LEN
  20. #define MAX_OPC_LEN 10
  21. #endif
  22. #ifndef MAXOPLEN
  23. #define MAXOPLEN 25
  24. #endif
  25. #ifndef MAXOP
  26. #define MAXOP 2
  27. #endif
  28. #ifndef MAXLINELEN
  29. #define MAXLINELEN 100
  30. #endif
  31. #ifndef MAXVARLEN
  32. #define MAXVARLEN 25
  33. #endif
  34. typedef struct instruction *instr_p;
  35. typedef struct pattern_descr *patdescr_p;
  36. typedef struct instr_descr *idescr_p;
  37. typedef struct templat *templ_p;
  38. struct instruction {
  39. instr_p fw;
  40. instr_p bw;
  41. char line[MAXLINELEN+1];
  42. char *rest_line;
  43. char opc[MAX_OPC_LEN+1];
  44. char op[MAXOP][MAXOPLEN+1];
  45. short state;
  46. };
  47. /* state: */
  48. #define ONLY_OPC 0
  49. #define JUNK 1
  50. #define DONE 2
  51. struct variable {
  52. int vstate;
  53. char value[MAXVARLEN];
  54. };
  55. /* vstate: */
  56. #define UNINSTANTIATED 0
  57. #define INSTANTIATED 1
  58. struct pattern_descr {
  59. int patlen;
  60. idescr_p pat;
  61. int replen;
  62. idescr_p repl;
  63. };
  64. struct templat {
  65. char *lctxt;
  66. int varno;
  67. char *rctxt;
  68. };
  69. struct instr_descr {
  70. char *opcode;
  71. struct templat templates[MAXOP];
  72. };
  73. typedef int bool;
  74. #define TRUE 1
  75. #define FALSE 0
  76. #define NIL (instr_p) 0
  77. #define NULLSTRING (char *) 0
  78. #define assert(x) if(!(x)) badassertion(__FILE__,__LINE__)