home *** CD-ROM | disk | FTP | other *** search
/ The CDPD Public Domain Collection for CDTV 3 / CDPDIII.bin / pd / programming / gnusmalltalk / mstbyte.h < prev    next >
C/C++ Source or Header  |  1992-02-15  |  4KB  |  134 lines

  1. /***********************************************************************
  2.  *
  3.  *    Byte Code definitions.
  4.  *
  5.  ***********************************************************************/
  6.  
  7. /***********************************************************************
  8.  *
  9.  * Copyright (C) 1990, 1991, 1992 Free Software Foundation, Inc.
  10.  * Written by Steve Byrne.
  11.  *
  12.  * This file is part of GNU Smalltalk.
  13.  *
  14.  * GNU Smalltalk is free software; you can redistribute it and/or modify it
  15.  * under the terms of the GNU General Public License as published by the Free
  16.  * Software Foundation; either version 1, or (at your option) any later 
  17.  * version.
  18.  * 
  19.  * GNU Smalltalk is distributed in the hope that it will be useful, but WITHOUT
  20.  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
  21.  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
  22.  * more details.
  23.  * 
  24.  * You should have received a copy of the GNU General Public License along with
  25.  * GNU Smalltalk; see the file COPYING.  If not, write to the Free Software
  26.  * Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  
  27.  *
  28.  ***********************************************************************/
  29.  
  30.  
  31. /*
  32.  *    Change Log
  33.  * ============================================================================
  34.  * Author      Date       Change 
  35.  * sbyrne     2 Jan 89      Created.
  36.  *
  37.  */
  38.  
  39.  
  40. #ifndef __MSTBYTE__
  41. #define __MSTBYTE__
  42.  
  43. /* ??? I don't like these being defines, but you can't do math on enums, and
  44.  * you can't switch on variables.  I like the looks of these (lexically
  45.  * speaking) but it does violate the guidelines about when to use defines.
  46.  */
  47.  
  48. #define pushReceiverVariable    0
  49. #define pushTemporaryVariable    16
  50. #define pushLitConstant        32
  51. #define pushLitVariable        64
  52. #define popReceiverVariable    96
  53. #define popTemporaryVariable    104
  54. #define pushSpecial        112
  55. #define returnIndexed        120
  56. #define returnMethodStackTop    124
  57. #define returnBlockStackTop    125
  58. #define pushIndexed        128
  59. #define storeIndexed        129
  60. #define popStoreIndexed        130
  61. #define sendSelector1ExtByte    131
  62. #define sendSelector2ExtByte    132
  63. #define sendSuper1ExtByte    133
  64. #define sendSuper2ExtByte    134
  65. #define popStackTop        135
  66. #define dupStackTop        136
  67. #define pushActiveContext    137
  68. #define jumpShort        144
  69. #define popJumpFalseShort    152
  70. #define jumpLong        160
  71. #define popJumpTrue        168
  72. #define popJumpFalse        172
  73. #define plusSpecial        176
  74. #define minusSpecial        177
  75. #define lessThanSpecial        178
  76. #define greaterThanSpecial    179
  77. #define lessEqualSpecial    180
  78. #define greaterEqualSpecial    181
  79. #define equalSpecial        182
  80. #define notEqualSpecial        183
  81. #define timesSpecial        184
  82. #define divideSpecial        185
  83. #define remainderSpecial    186
  84. #define bitShiftColonSpecial    188
  85. #define integerDivideSpecial    189
  86. #define bitAndColonSpecial    190
  87. #define bitOrColonSpecial    191
  88. #define atColonSpecial        192
  89. #define atColonPutColonSpecial    193
  90. #define sizeSpecial        194
  91. #define nextSpecial        195
  92. #define nextPutColonSpecial    196
  93. #define atEndSpecial        197
  94. #define sameObjectSpecial    198
  95. #define classSpecial        199
  96. #define blockCopyColonSpecial    200
  97. #define valueSpecial        201
  98. #define valueColonSpecial    202
  99. #define doColonSpecial        203
  100. #define newSpecial        204
  101. #define newColonSpecial        205
  102. #define sendSelectorNoArg    208
  103. #define sendSelector1Arg    224
  104. #define sendSelector2Arg    240
  105.  
  106. #define receiverIndex        0
  107. #define trueIndex        1
  108. #define falseIndex        2
  109. #define nilIndex        3
  110. #define litMinusOneIndex    4
  111. #define litZeroIndex        5
  112. #define litOneIndex        6
  113. #define litTwoIndex        7
  114.  
  115. #define receiverLocation    (0 << 6)
  116. #define temporaryLocation    (1 << 6)
  117. #define litConstLocation    (2 << 6)
  118. #define litVarLocation        (3 << 6)
  119.  
  120. #define locationMask        (3 << 6)
  121.  
  122. typedef struct ByteCodeArray    *ByteCodes;
  123.  
  124. extern ByteCodes    getByteCodes(), saveByteCodeArray();
  125.  
  126. extern void        initByteCodes(),
  127.             compileByte(), compileAndFreeByteCodes(),
  128.               restoreByteCodeArray(), freeByteCodes(),
  129.               copyByteCodes(), printByteCodeName(); 
  130.  
  131. extern    int        currentByteCodeLength(), isSimpleReturn();
  132.  
  133. #endif /* __MSTBYTE__ */
  134.