| 1 | //BasicFixed.h
 | 
|---|
| 2 | 
 | 
|---|
| 3 | 
 | 
|---|
| 4 | ////////////////
 | 
|---|
| 5 | // マシンタイプ
 | 
|---|
| 6 | ////////////////
 | 
|---|
| 7 | 
 | 
|---|
| 8 | #define MACHINE_X86     1
 | 
|---|
| 9 | #define MACHINE_AMD64   2
 | 
|---|
| 10 | 
 | 
|---|
| 11 | 
 | 
|---|
| 12 | ////////////////
 | 
|---|
| 13 | // 型
 | 
|---|
| 14 | ////////////////
 | 
|---|
| 15 | 
 | 
|---|
| 16 | /* basic\command.sbp内の "_System_Type_***" 定数と同期が必要 */
 | 
|---|
| 17 | #define FLAG_PTR        0x80000000
 | 
|---|
| 18 | #define FLAG_CAST       0x40000000
 | 
|---|
| 19 | 
 | 
|---|
| 20 | //整数型
 | 
|---|
| 21 | #define DEF_CHAR        0x00000001
 | 
|---|
| 22 | #define DEF_BYTE        0x00000002
 | 
|---|
| 23 | #define DEF_INTEGER     0x00000003
 | 
|---|
| 24 | #define DEF_WORD        0x00000004
 | 
|---|
| 25 | #define DEF_LONG        0x00000005
 | 
|---|
| 26 | #define DEF_DWORD       0x00000006
 | 
|---|
| 27 | #define DEF_INT64       0x00000007
 | 
|---|
| 28 | #define DEF_QWORD       0x00000008
 | 
|---|
| 29 | 
 | 
|---|
| 30 | //実数型
 | 
|---|
| 31 | #define DEF_SINGLE      0x00000009
 | 
|---|
| 32 | #define DEF_DOUBLE      0x0000000A
 | 
|---|
| 33 | 
 | 
|---|
| 34 | //bool型
 | 
|---|
| 35 | #define DEF_BOOLEAN     0x0000000B
 | 
|---|
| 36 | 
 | 
|---|
| 37 | //文字列型
 | 
|---|
| 38 | #define DEF_STRING      0x0000000C
 | 
|---|
| 39 | 
 | 
|---|
| 40 | //ポインタ型
 | 
|---|
| 41 | #define DEF_PTR_VOID    0x0000000D
 | 
|---|
| 42 | #define DEF_PTR_PROC    0x0000000E
 | 
|---|
| 43 | 
 | 
|---|
| 44 | //特殊型
 | 
|---|
| 45 | #define DEF_ANY         0x00000015
 | 
|---|
| 46 | #define DEF_OBJECT      0x00000016
 | 
|---|
| 47 | #define DEF_ELLIPSE     0x00000018
 | 
|---|
| 48 | 
 | 
|---|
| 49 | //ポインタ型
 | 
|---|
| 50 | #define MASK_PTR        0x0000ff00
 | 
|---|
| 51 | #define MASK_NATURAL    0x000000ff
 | 
|---|
| 52 | 
 | 
|---|
| 53 | #define PTR_LEVEL(t)    (((t)&MASK_PTR)>>8)
 | 
|---|
| 54 | #define NATURAL_TYPE(t) ((t)&MASK_NATURAL)
 | 
|---|
| 55 | #define MAKE_PTR_TYPE(t,p)  ((t)|((p)<<8))
 | 
|---|
| 56 | #define PTR_LEVEL_UP(t)     t = MAKE_PTR_TYPE(NATURAL_TYPE(t),PTR_LEVEL(t)+1)
 | 
|---|
| 57 | #define PTR_LEVEL_DOWN(t)   t = MAKE_PTR_TYPE(NATURAL_TYPE(t),PTR_LEVEL(t)-1)
 | 
|---|
| 58 | 
 | 
|---|
| 59 | #define DEF_PTR_BYTE    MAKE_PTR_TYPE(DEF_BYTE,1)
 | 
|---|
| 60 | #define DEF_PTR_OBJECT  MAKE_PTR_TYPE(DEF_OBJECT,1)
 | 
|---|
| 61 | 
 | 
|---|
| 62 | 
 | 
|---|
| 63 | 
 | 
|---|
| 64 | //NumOpe関数の結果がリテラル値の場合、その値の補助情報がindexに格納される
 | 
|---|
| 65 | #define LITERAL_NULL        -2
 | 
|---|
| 66 | #define LITERAL_M128_0      -3
 | 
|---|
| 67 | #define LITERAL_0_255       -4
 | 
|---|
| 68 | #define LITERAL_M32768_0    -5
 | 
|---|
| 69 | #define LITERAL_0_65535     -6
 | 
|---|
| 70 | #define LITERAL_OTHER_MINUS -7
 | 
|---|
| 71 | #define LITERAL_OTHER_PLUS  -8
 | 
|---|
| 72 | 
 | 
|---|
| 73 | #define LITERAL_STRING      -9
 | 
|---|
| 74 | 
 | 
|---|
| 75 | #define IS_LITERAL(x) (x<=LITERAL_NULL&&x!=LITERAL_STRING)
 | 
|---|
| 76 | #define IS_MINUS_LITERAL(x) (x==LITERAL_M128_0||x==LITERAL_M32768_0||x==LITERAL_OTHER_MINUS)
 | 
|---|
| 77 | #define IS_POSITIVE_LITERAL(x) (x==LITERAL_NULL||x==LITERAL_0_255||x==LITERAL_0_65535||x==LITERAL_OTHER_PLUS)
 | 
|---|
| 78 | 
 | 
|---|
| 79 | //////////////////////////////////////
 | 
|---|
| 80 | /* 演算子(優先順位が関係している) */
 | 
|---|
| 81 | //////////////////////////////////////
 | 
|---|
| 82 | 
 | 
|---|
| 83 | //論理演算子
 | 
|---|
| 84 | #define CALC_XOR            3   // Xor
 | 
|---|
| 85 | #define CALC_OR             6   // Or
 | 
|---|
| 86 | #define CALC_AND            9   // And
 | 
|---|
| 87 | #define CALC_NOT            12  // Not
 | 
|---|
| 88 | 
 | 
|---|
| 89 | //比較演算子
 | 
|---|
| 90 | #define CALC_PE             21  // <=
 | 
|---|
| 91 | #define CALC_QE             22  // >=
 | 
|---|
| 92 | #define CALC_NOTEQUAL       23  // <>
 | 
|---|
| 93 | #define CALC_EQUAL          24  // =
 | 
|---|
| 94 | #define CALC_P              25  // <
 | 
|---|
| 95 | #define CALC_Q              26  // >
 | 
|---|
| 96 | 
 | 
|---|
| 97 | //算術演算子
 | 
|---|
| 98 | #define CALC_SHL            31  //<<
 | 
|---|
| 99 | #define CALC_SHR            32  //>>
 | 
|---|
| 100 | #define CALC_ADDITION       41  // +
 | 
|---|
| 101 | #define CALC_SUBTRACTION    42  // -
 | 
|---|
| 102 | #define CALC_STRPLUS        43  // &
 | 
|---|
| 103 | #define CALC_MOD            51  // Mod
 | 
|---|
| 104 | #define CALC_PRODUCT        61  // *
 | 
|---|
| 105 | #define CALC_QUOTIENT       62  // /
 | 
|---|
| 106 | #define CALC_INTQUOTIENT    63  //整数除算
 | 
|---|
| 107 | #define CALC_AS             71  // As
 | 
|---|
| 108 | #define CALC_BYVAL          72  // ByVal
 | 
|---|
| 109 | #define CALC_MINUSMARK      81  // -x
 | 
|---|
| 110 | #define CALC_POWER          91  // ^
 | 
|---|
| 111 | 
 | 
|---|
| 112 | //代入演算子
 | 
|---|
| 113 | #define CALC_SUBSITUATION   200
 | 
|---|
| 114 | 
 | 
|---|
| 115 | //添え字演算子
 | 
|---|
| 116 | #define CALC_ARRAY_GET      201
 | 
|---|
| 117 | #define CALC_ARRAY_SET      202
 | 
|---|
| 118 | 
 | 
|---|
| 119 | 
 | 
|---|
| 120 | //////////////////////////////////////////////////////////////////////
 | 
|---|
| 121 | // エスケープシーケンス用のバイトコードは0xA0~0xCFの範囲も利用できる
 | 
|---|
| 122 | //////////////////////////////////////////////////////////////////////
 | 
|---|
| 123 | 
 | 
|---|
| 124 | //以下制御用エスケープシーケンス
 | 
|---|
| 125 | #define ESC_MOD         '1' //MOD 演算子
 | 
|---|
| 126 | #define ESC_AND         '&' //AND 演算子
 | 
|---|
| 127 | #define ESC_OR          '3' //OR 演算子
 | 
|---|
| 128 | #define ESC_XOR         '4' //XOR 演算子
 | 
|---|
| 129 | #define ESC_NOT         '5' //NOT 演算子
 | 
|---|
| 130 | #define ESC_AS          '6' //AS(区切り文字)
 | 
|---|
| 131 | #define ESC_THEN        2   //Then
 | 
|---|
| 132 | #define ESC_ELSE        3   //Else
 | 
|---|
| 133 | #define ESC_IF          'A' //If
 | 
|---|
| 134 | #define ESC_ELSEIF      'B' //ElseIf
 | 
|---|
| 135 | #define ESC_ENDIF       'C' //End If
 | 
|---|
| 136 | #define ESC_DEF         'D' //Def
 | 
|---|
| 137 | #define ESC_DECLARE     'E' //Declare
 | 
|---|
| 138 | #define ESC_SUB         'F' //Sub
 | 
|---|
| 139 | #define ESC_ENDSUB      'G' //End Sub
 | 
|---|
| 140 | #define ESC_EXITSUB     'H' //Exit Sub
 | 
|---|
| 141 | #define ESC_FUNCTION    'I' //Function
 | 
|---|
| 142 | #define ESC_ENDFUNCTION 'J' //End Function
 | 
|---|
| 143 | #define ESC_EXITFUNCTION 'K'//Exit Function
 | 
|---|
| 144 | #define ESC_BYVAL       'L' //ByVal
 | 
|---|
| 145 | #define ESC_BYREF       'M' //ByRef
 | 
|---|
| 146 | #define ESC_TYPE        'N' //Type
 | 
|---|
| 147 | #define ESC_ENDTYPE     'O' //End Type
 | 
|---|
| 148 | #define ESC_EXITFOR     'P' //Exit For
 | 
|---|
| 149 | #define ESC_EXITWHILE   'Q' //Exit Wend
 | 
|---|
| 150 | #define ESC_EXITDO      'R' //Exit Do
 | 
|---|
| 151 | #define ESC_SELECTCASE  'S' //Select Case
 | 
|---|
| 152 | #define ESC_CASE        'T' //Case
 | 
|---|
| 153 | #define ESC_CASEELSE    'U' //Case Else
 | 
|---|
| 154 | #define ESC_ENDSELECT   'V' //End Select
 | 
|---|
| 155 | #define ESC_CONST       'W' //Const
 | 
|---|
| 156 | #define ESC_WITH        'X' //With
 | 
|---|
| 157 | #define ESC_ENDWITH     'Y' //End With
 | 
|---|
| 158 | #define ESC_CDECL       'Z' //cdecl規約
 | 
|---|
| 159 | #define ESC_MACRO       'a' //Macro
 | 
|---|
| 160 | #define ESC_ENDMACRO    'b' //End Macro
 | 
|---|
| 161 | #define ESC_EXITMACRO   'c' //Exit Macro
 | 
|---|
| 162 | #define ESC_EXPORT      'd' //Export
 | 
|---|
| 163 | #define ESC_CONTINUE    'e' //Continue
 | 
|---|
| 164 | #define ESC_PSMEM       'f' //"->" Member of Pointer Struct(構造体ポインタのメンバ参照)
 | 
|---|
| 165 | #define ESC_STATIC      'g' //Static
 | 
|---|
| 166 | #define ESC_TYPEDEF     'h' //TypeDef
 | 
|---|
| 167 | #define ESC_TRY         'i' //Try
 | 
|---|
| 168 | #define ESC_CATCH       'j' //Catch
 | 
|---|
| 169 | #define ESC_FINALLY     'k' //Finally
 | 
|---|
| 170 | #define ESC_THROW       'l' //Throw
 | 
|---|
| 171 | #define ESC_ENDTRY      'm' //End Try
 | 
|---|
| 172 | //EXEファイル用制御エスケープシーケンス
 | 
|---|
| 173 | #define ESC_USING       'o' //Print命令語のUsing
 | 
|---|
| 174 | #define ESC_FOR         'p' //Open命令語のFor
 | 
|---|
| 175 | #define ESC_LINENUM     'q' //行番号を示す
 | 
|---|
| 176 | 
 | 
|---|
| 177 | //オブジェクト指向エスケープシーケンス
 | 
|---|
| 178 | #define ESC_CLASS           (char)0xA0
 | 
|---|
| 179 | #define ESC_ENDCLASS        (char)0xA1
 | 
|---|
| 180 | #define ESC_ABSTRACT        (char)0xA2
 | 
|---|
| 181 | #define ESC_VIRTUAL         (char)0xA3
 | 
|---|
| 182 | #define ESC_OVERRIDE        (char)0xA4
 | 
|---|
| 183 | #define ESC_INHERITS        (char)0xA5
 | 
|---|
| 184 | #define ESC_ENUM            (char)0xA6
 | 
|---|
| 185 | #define ESC_ENDENUM         (char)0xA7
 | 
|---|
| 186 | #define ESC_NEW             (char)0xA8
 | 
|---|
| 187 | #define ESC_INTERFACE       (char)0xA9
 | 
|---|
| 188 | #define ESC_ENDINTERFACE    (char)0xAA
 | 
|---|
| 189 | #define ESC_OPERATOR        (char)0xAB
 | 
|---|
| 190 | 
 | 
|---|