xref: /aoo41x/main/basic/source/inc/opcodes.hxx (revision 234bd5c5)
1*234bd5c5SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*234bd5c5SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*234bd5c5SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*234bd5c5SAndrew Rist  * distributed with this work for additional information
6*234bd5c5SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*234bd5c5SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*234bd5c5SAndrew Rist  * "License"); you may not use this file except in compliance
9*234bd5c5SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*234bd5c5SAndrew Rist  *
11*234bd5c5SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*234bd5c5SAndrew Rist  *
13*234bd5c5SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*234bd5c5SAndrew Rist  * software distributed under the License is distributed on an
15*234bd5c5SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*234bd5c5SAndrew Rist  * KIND, either express or implied.  See the License for the
17*234bd5c5SAndrew Rist  * specific language governing permissions and limitations
18*234bd5c5SAndrew Rist  * under the License.
19*234bd5c5SAndrew Rist  *
20*234bd5c5SAndrew Rist  *************************************************************/
21*234bd5c5SAndrew Rist 
22*234bd5c5SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _OPCODES_HXX
25cdf0e10cSrcweir #define _OPCODES_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "sbintern.hxx"
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #ifdef MTW
30cdf0e10cSrcweir #undef _NUMBER
31cdf0e10cSrcweir #endif
32cdf0e10cSrcweir 
33cdf0e10cSrcweir // Ein Opcode ist entweder 1, 3 oder 5 Bytes lang, je nach numerischen
34cdf0e10cSrcweir // Wert des Opcodes (s.u.).
35cdf0e10cSrcweir 
36cdf0e10cSrcweir enum SbiOpcode {
37cdf0e10cSrcweir 	// Alle Opcodes ohne Operanden
38cdf0e10cSrcweir 	_NOP = 0,
39cdf0e10cSrcweir 
40cdf0e10cSrcweir 	SbOP0_START = _NOP,
41cdf0e10cSrcweir 
42cdf0e10cSrcweir 	// Operatoren
43cdf0e10cSrcweir 	// die folgenden Operatoren sind genauso angeordnet
44cdf0e10cSrcweir 	// wie der enum SbxVarOp
45cdf0e10cSrcweir 	_EXP, _MUL, _DIV, _MOD, _PLUS, _MINUS, _NEG,
46cdf0e10cSrcweir 	_EQ,  _NE,  _LT,  _GT, _LE, _GE,
47cdf0e10cSrcweir 	_IDIV, _AND, _OR, _XOR, _EQV, _IMP, _NOT,
48cdf0e10cSrcweir 	_CAT,
49cdf0e10cSrcweir 	// Ende enum SbxVarOp
50cdf0e10cSrcweir 	_LIKE, _IS,
51cdf0e10cSrcweir 	// Laden/speichern
52cdf0e10cSrcweir 	_ARGC,              // neuen Argv einrichten
53cdf0e10cSrcweir 	_ARGV,              // TOS ==> aktueller Argv
54cdf0e10cSrcweir 	_INPUT,             // Input ==> TOS
55cdf0e10cSrcweir 	_LINPUT,            // Line Input ==> TOS
56cdf0e10cSrcweir 	_GET,				// TOS anfassen
57cdf0e10cSrcweir 	_SET,               // Speichern Objekt TOS ==> TOS-1
58cdf0e10cSrcweir 	_PUT,				// TOS ==> TOS-1
59cdf0e10cSrcweir 	_PUTC,				// TOS ==> TOS-1, dann ReadOnly
60cdf0e10cSrcweir 	_DIM,               // DIM
61cdf0e10cSrcweir 	_REDIM,             // REDIM
62cdf0e10cSrcweir 	_REDIMP,            // REDIM PRESERVE
63cdf0e10cSrcweir 	_ERASE,             // TOS loeschen
64cdf0e10cSrcweir 	// Verzweigen
65cdf0e10cSrcweir 	_STOP,              // Programmende
66cdf0e10cSrcweir 	_INITFOR,           // FOR-Variable initialisieren
67cdf0e10cSrcweir 	_NEXT,              // FOR-Variable inkrementieren
68cdf0e10cSrcweir 	_CASE,				// Anfang CASE
69cdf0e10cSrcweir 	_ENDCASE,           // Ende CASE
70cdf0e10cSrcweir 	_STDERROR,          // Standard-Fehlerbehandlung
71cdf0e10cSrcweir 	_NOERROR,           // keine Fehlerbehandlung
72cdf0e10cSrcweir 	_LEAVE,             // UP verlassen
73cdf0e10cSrcweir 	// E/A
74cdf0e10cSrcweir 	_CHANNEL,           // TOS = Kanalnummer
75cdf0e10cSrcweir 	_BPRINT,            // print TOS
76cdf0e10cSrcweir 	_PRINTF,            // print TOS in field
77cdf0e10cSrcweir 	_BWRITE,            // write TOS
78cdf0e10cSrcweir 	_RENAME,            // Rename Tos+1 to Tos
79cdf0e10cSrcweir 	_PROMPT,            // TOS = Prompt for Input
80cdf0e10cSrcweir 	_RESTART,           // Restartpunkt definieren
81cdf0e10cSrcweir 	_CHAN0,				// I/O-Kanal 0
82cdf0e10cSrcweir 	// Sonstiges
83cdf0e10cSrcweir 	_EMPTY,             // Leeren Ausdruck auf Stack
84cdf0e10cSrcweir 	_ERROR,				// TOS = Fehlercode
85cdf0e10cSrcweir 	_LSET,				// Speichern Objekt TOS ==> TOS-1
86cdf0e10cSrcweir 	_RSET,              // Speichern Objekt TOS ==> TOS-1
87cdf0e10cSrcweir 	_REDIMP_ERASE,		// Copies array to be later used by REDIM PRESERVE before erasing it
88cdf0e10cSrcweir 	_INITFOREACH,
89cdf0e10cSrcweir 	_VBASET,            // VBA-like Set
90cdf0e10cSrcweir 	_ERASE_CLEAR,       // Erase array and clear variable
91cdf0e10cSrcweir 	_ARRAYACCESS,       // Assign parameters to TOS and get value, used for array of arrays
92cdf0e10cSrcweir 	_BYVAL,             // byref -> byval for lvalue parameter passed in call
93cdf0e10cSrcweir 	SbOP0_END,
94cdf0e10cSrcweir 
95cdf0e10cSrcweir 	// Alle Opcodes mit einem Operanden
96cdf0e10cSrcweir 
97cdf0e10cSrcweir 	_NUMBER = 0x40,     // Laden einer numerischen Konstanten (+ID)
98cdf0e10cSrcweir 
99cdf0e10cSrcweir 	SbOP1_START = _NUMBER,
100cdf0e10cSrcweir 
101cdf0e10cSrcweir 	_SCONST,            // Laden einer Stringkonstanten (+ID)
102cdf0e10cSrcweir 	_CONST,             // Immediate Load (+Wert)
103cdf0e10cSrcweir 	_ARGN,              // Speichern eines named Args in Argv (+StringID)
104cdf0e10cSrcweir 	_PAD,               // String auf feste Laenge bringen (+Laenge)
105cdf0e10cSrcweir 	// Verzweigungen
106cdf0e10cSrcweir 	_JUMP,              // Sprung (+Target)
107cdf0e10cSrcweir 	_JUMPT,             // TOS auswerten, bedingter Sprung (+Target)
108cdf0e10cSrcweir 	_JUMPF,             // TOS auswerten, bedingter Sprung (+Target)
109cdf0e10cSrcweir 	_ONJUMP,            // TOS auswerten, Sprung in JUMP-Tabelle (+MaxVal)
110cdf0e10cSrcweir 	_GOSUB,             // UP-Aufruf (+Target)
111cdf0e10cSrcweir 	_RETURN,            // UP-Return (+0 oder Target)
112cdf0e10cSrcweir 	_TESTFOR,           // FOR-Variable testen, inkrementieren (+Endlabel)
113cdf0e10cSrcweir 	_CASETO,            // Tos+1 <= Case <= Tos, 2xremove (+Target)
114cdf0e10cSrcweir 	_ERRHDL,            // Fehler-Handler (+Offset)
115cdf0e10cSrcweir 	_RESUME,            // Resume nach Fehlern (+0 or 1 or Label)
116cdf0e10cSrcweir 	// E/A
117cdf0e10cSrcweir 	_CLOSE,             // (+Kanal/0)
118cdf0e10cSrcweir 	_PRCHAR,            // (+char)
119cdf0e10cSrcweir 	// Verwaltung
120cdf0e10cSrcweir 	_SETCLASS,          // Set + Klassennamen testen (+StringId)
121cdf0e10cSrcweir 	_TESTCLASS,         // Check TOS class (+StringId)
122cdf0e10cSrcweir 	_LIB,				// Libnamen fuer Declare-Procs setzen (+StringId)
123cdf0e10cSrcweir 	_BASED,          	// TOS wird um BASE erhoeht, BASE davor gepusht (+base)
124cdf0e10cSrcweir 	// Typanpassung im Argv
125cdf0e10cSrcweir 	_ARGTYP,          	// Letzten Parameter in Argv konvertieren (+Typ)
126cdf0e10cSrcweir 	_VBASETCLASS,       // VBA-like Set
127cdf0e10cSrcweir 	SbOP1_END,
128cdf0e10cSrcweir 
129cdf0e10cSrcweir 	// Alle Opcodes mit zwei Operanden
130cdf0e10cSrcweir 
131cdf0e10cSrcweir 	_RTL = 0x80,   		// Laden aus RTL (+StringID+Typ)
132cdf0e10cSrcweir 
133cdf0e10cSrcweir 	SbOP2_START = _RTL,
134cdf0e10cSrcweir 
135cdf0e10cSrcweir 	_FIND,       		// Laden (+StringID+Typ)
136cdf0e10cSrcweir 	_ELEM,       		// Laden Element (+StringID+Typ)
137cdf0e10cSrcweir 	_PARAM,				// Parameter (+Offset+Typ)
138cdf0e10cSrcweir 	// Verzweigen
139cdf0e10cSrcweir 	_CALL,				// DECLARE-Methode rufen (+StringID+Typ)
140cdf0e10cSrcweir 	_CALLC,				// Cdecl-DECLARE-Methode rufen (+StringID+Typ)
141cdf0e10cSrcweir 	_CASEIS,            // Case-Test (+Test-Opcode+True-Target)
142cdf0e10cSrcweir 	// Verwaltung
143cdf0e10cSrcweir 	_STMNT,             // Beginn eines Statements (+Line+Col)
144cdf0e10cSrcweir 	// E/A
145cdf0e10cSrcweir 	_OPEN,              // (+SvStreamFlags+Flags)
146cdf0e10cSrcweir 	// Objekte
147cdf0e10cSrcweir 	_LOCAL,				// Lokale Variable definieren (+StringID+Typ)
148cdf0e10cSrcweir 	_PUBLIC, 			// Modulglobale Variable (+StringID+Typ)
149cdf0e10cSrcweir 	_GLOBAL,			// Globale Variable definieren, public-Anweisung (+StringID+Typ)
150cdf0e10cSrcweir 	_CREATE,			// Objekt kreieren (+StringId+StringID)
151cdf0e10cSrcweir 	_STATIC,			// Statische Variabl (+StringID+Typ) JSM
152cdf0e10cSrcweir 	_TCREATE,			// User Defined Objekt kreieren
153cdf0e10cSrcweir 	_DCREATE,			// Objekt-Array kreieren (+StringId+StringID)
154cdf0e10cSrcweir 	_GLOBAL_P,      	// Globale Variable definieren, die beim Neustart von Basic
155cdf0e10cSrcweir                         // nicht ueberschrieben wird, P=PERSIST (+StringID+Typ)
156cdf0e10cSrcweir 	_FIND_G,        	// Sucht globale Variable mit Spezialbehandlung wegen _GLOBAL_P
157cdf0e10cSrcweir     _DCREATE_REDIMP,	// Objekt-Array redimensionieren (+StringId+StringID)
158cdf0e10cSrcweir 	_FIND_CM,        	// Search inside a class module (CM) to enable global search in time
159cdf0e10cSrcweir 	_PUBLIC_P, 			//  Module global Variable (persisted between calls)(+StringID+Typ)
160cdf0e10cSrcweir 	_FIND_STATIC,        	//  local static var lookup (+StringID+Typ)
161cdf0e10cSrcweir 
162cdf0e10cSrcweir 	SbOP2_END
163cdf0e10cSrcweir 
164cdf0e10cSrcweir };
165cdf0e10cSrcweir 
166cdf0e10cSrcweir 
167cdf0e10cSrcweir 
168cdf0e10cSrcweir #endif
169