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