home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / MAWK113.ZIP / mawk113 / code.h < prev    next >
C/C++ Source or Header  |  1991-12-04  |  3KB  |  151 lines

  1.  
  2. /********************************************
  3. code.h
  4. copyright 1991, Michael D. Brennan
  5.  
  6. This is a source file for mawk, an implementation of
  7. the AWK programming language.
  8.  
  9. Mawk is distributed without warranty under the terms of
  10. the GNU General Public License, version 2, 1991.
  11. ********************************************/
  12.  
  13.  
  14. /* $Log: code.h,v $
  15.  * Revision 5.1  1991/12/05  07:59:07  brennan
  16.  * 1.1 pre-release
  17.  *
  18. */
  19.  
  20.  
  21. /*  code.h  */
  22.  
  23. #ifndef  CODE_H
  24. #define  CODE_H
  25.  
  26. #include "memory.h"
  27.  
  28. /* coding scope */
  29. #define   SCOPE_MAIN    0
  30. #define   SCOPE_BEGIN   1  
  31. #define   SCOPE_END     2
  32. #define   SCOPE_FUNCT   3
  33.  
  34.  
  35. extern  INST  *code_ptr ;
  36. extern  INST  *main_start, *main_code_ptr ;
  37. extern  unsigned main_size ;
  38.  
  39. extern struct be_code {
  40. INST *start , *ptr ;
  41. unsigned size ; } begin_code , end_code ;
  42.  
  43. void PROTO(be_shrink, (struct be_code *)) ;
  44. void PROTO(be_expand, (struct be_code *)) ;
  45.  
  46. #define INST_BYTES(x) (sizeof(INST)*(x))
  47.  
  48. extern  CELL  eval_stack[] ;
  49.  
  50.  
  51. #define  code1(x)  code_ptr++ -> op = (x)
  52.  
  53. #define  code2(x,y)    (void)( code_ptr++ -> op = (x) ,\
  54.                          code_ptr++ -> ptr = (PTR)(y) )
  55.  
  56. extern int exit_code ;
  57.  
  58. /*  the machine opcodes  */
  59. /* to avoid confusion with a ptr FE_PUSHA must have op code 0 */
  60. /* unfortunately enums are less portable than defines */
  61.  
  62. #define  FE_PUSHA     0
  63. #define  FE_PUSHI     1
  64. #define  F_PUSHA      2
  65. #define  F_PUSHI      3
  66. #define  NF_PUSHI     4
  67. #define  _HALT        5
  68. #define  _STOP        6
  69. #define  _PUSHC       7
  70. #define  _PUSHD       8
  71. #define  _PUSHS       9
  72. #define  _PUSHINT    10
  73. #define  _PUSHA      11
  74. #define  _PUSHI      12
  75. #define  L_PUSHA     13
  76. #define  L_PUSHI     14
  77. #define  AE_PUSHA    15
  78. #define  AE_PUSHI    16
  79. #define  A_PUSHA     17
  80. #define  LAE_PUSHA   18
  81. #define  LAE_PUSHI   19
  82. #define  LA_PUSHA    20
  83. #define  _POP        21
  84. #define  _DUP        22
  85. #define  _ADD        23
  86. #define  _SUB        24
  87. #define  _MUL        25
  88. #define  _DIV        26
  89. #define  _MOD        27
  90. #define  _POW        28
  91. #define  _NOT        29
  92. #define  _TEST       30
  93. #define  A_TEST      31
  94. #define  A_DEL       32
  95. #define  ALOOP       33
  96. #define  A_CAT       34
  97. #define  _UMINUS     35
  98. #define  _UPLUS      36
  99. #define  _ASSIGN     37
  100. #define  _ADD_ASG    38
  101. #define  _SUB_ASG    39
  102. #define  _MUL_ASG    40
  103. #define  _DIV_ASG    41
  104. #define  _MOD_ASG    42
  105. #define  _POW_ASG    43
  106. #define  F_ASSIGN    44
  107. #define  F_ADD_ASG   45
  108. #define  F_SUB_ASG   46
  109. #define  F_MUL_ASG   47
  110. #define  F_DIV_ASG   48
  111. #define  F_MOD_ASG   49
  112. #define  F_POW_ASG   50
  113. #define  _CAT        51
  114. #define  _BUILTIN    52
  115. #define  _PRINT      53
  116. #define  _POST_INC   54
  117. #define  _POST_DEC   55
  118. #define  _PRE_INC    56
  119. #define  _PRE_DEC    57
  120. #define  F_POST_INC  58
  121. #define  F_POST_DEC  59
  122. #define  F_PRE_INC   60
  123. #define  F_PRE_DEC   61
  124. #define  _JMP        62
  125. #define  _JNZ        63
  126. #define  _JZ         64
  127. #define  _EQ         65
  128. #define  _NEQ        66
  129. #define  _LT         67
  130. #define  _LTE        68
  131. #define  _GT         69
  132. #define  _GTE        70
  133. #define  _MATCH0     71
  134. #define  _MATCH1     72
  135. #define  _MATCH2     73
  136. #define  _EXIT       74
  137. #define  _EXIT0      75
  138. #define  _NEXT       76
  139. #define  _RANGE      77
  140. #define  _CALL       78
  141. #define  _RET        79
  142. #define  _RET0       80
  143. #define  SET_ALOOP   81
  144. #define  OL_GL       82
  145. #define  OL_GL_NR    83
  146. #define  _OMAIN      84
  147. #define  _JMAIN      85
  148.  
  149.  
  150. #endif  /* CODE_H */
  151.