bump product version to 5.0.4.1
[LibreOffice.git] / basic / source / inc / opcodes.hxx
blob669933117ecb80a715e5fccd116925f9db6c0678
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_BASIC_SOURCE_INC_OPCODES_HXX
21 #define INCLUDED_BASIC_SOURCE_INC_OPCODES_HXX
23 #include "sbintern.hxx"
25 // An opcode can have a length of 1, 3 or 5 bytes,
26 // depending on its numeric value (see below).
28 enum SbiOpcode {
29 // all opcodes without operands
30 _NOP = 0,
32 SbOP0_START = _NOP,
34 // operators
35 // the following operators are ordered
36 // the same way as the enum SbxVarOp
37 _EXP, _MUL, _DIV, _MOD, _PLUS, _MINUS, _NEG,
38 _EQ, _NE, _LT, _GT, _LE, _GE,
39 _IDIV, _AND, _OR, _XOR, _EQV, _IMP, _NOT,
40 _CAT,
41 // end of enum SbxVarOp
42 _LIKE, _IS,
43 // load/save
44 _ARGC, // establish new Argv
45 _ARGV, // TOS ==> current Argv
46 _INPUT, // Input ==> TOS
47 _LINPUT, // Line Input ==> TOS
48 _GET, // touch TOS
49 _SET, // save object TOS ==> TOS-1
50 _PUT, // TOS ==> TOS-1
51 _PUTC, // TOS ==> TOS-1, then ReadOnly
52 _DIM, // DIM
53 _REDIM, // REDIM
54 _REDIMP, // REDIM PRESERVE
55 _ERASE, // delete TOS
56 // branch
57 _STOP, // end of program
58 _INITFOR, // initialize FOR-variable
59 _NEXT, // increment FOR-variable
60 _CASE, // beginning CASE
61 _ENDCASE, // end CASE
62 _STDERROR, // standard error handling
63 _NOERROR, // no error handling
64 _LEAVE, // leave UP
65 // E/A
66 _CHANNEL, // TOS = channel number
67 _BPRINT, // print TOS
68 _PRINTF, // print TOS in field
69 _BWRITE, // write TOS
70 _RENAME, // Rename Tos+1 to Tos
71 _PROMPT, // TOS = Prompt for Input
72 _RESTART, // define restart point
73 _CHAN0, // I/O-channel 0
74 // miscellaneous
75 _EMPTY, // empty expression on stack
76 _ERROR, // TOS = error code
77 _LSET, // saving object TOS ==> TOS-1
78 _RSET, // saving object TOS ==> TOS-1
79 _REDIMP_ERASE, // Copies array to be later used by REDIM PRESERVE before erasing it
80 _INITFOREACH,
81 _VBASET, // VBA-like Set
82 _ERASE_CLEAR, // Erase array and clear variable
83 _ARRAYACCESS, // Assign parameters to TOS and get value, used for array of arrays
84 _BYVAL, // byref -> byval for lvalue parameter passed in call
86 SbOP0_END = _BYVAL,
88 // all opcodes with one operand
90 _NUMBER = 0x40, // loading a numeric constant (+ID)
92 SbOP1_START = _NUMBER,
94 _SCONST, // loading a stringconstant (+ID)
95 _CONST, // Immediate Load (+ value)
96 _ARGN, // saving a named Arg in Argv (+StringID)
97 _PAD, // bring string to a firm length (+length)
98 // Verzweigungen
99 _JUMP, // jump (+target)
100 _JUMPT, // evaluate TOS, conditional jump (+target)
101 _JUMPF, // evaluate TOS, conditional jump (+target)
102 _ONJUMP, // evaluate TOS, jump into JUMP-table (+MaxVal)
103 _GOSUB, // UP-call (+Target)
104 _RETURN, // UP-return (+0 or Target)
105 _TESTFOR, // test FOR-variable, increment (+Endlabel)
106 _CASETO, // Tos+1 <= Case <= Tos, 2xremove (+Target)
107 _ERRHDL, // error handler (+Offset)
108 _RESUME, // Resume after errors (+0 or 1 or Label)
109 // E/A
110 _CLOSE, // (+channel/0)
111 _PRCHAR, // (+char)
112 // Verwaltung
113 _SETCLASS, // test set + class names (+StringId)
114 _TESTCLASS, // Check TOS class (+StringId)
115 _LIB, // set lib name for declar-procs (+StringId)
116 _BASED, // TOS is incremented by BASE, BASE is pushed before (+base)
117 // type adjustment in the Argv
118 _ARGTYP, // convert last parameter in Argv (+type)
119 _VBASETCLASS, // VBA-like Set
121 SbOP1_END = _VBASETCLASS,
123 // all opcodes with two operands
125 _RTL = 0x80, // load from the RTL (+StringID+Typ)
127 SbOP2_START = _RTL,
129 _FIND, // load (+StringID+Typ)
130 _ELEM, // load element (+StringID+Typ)
131 _PARAM, // parameters (+Offset+Typ)
132 // branch
133 _CALL, // call DECLARE-method (+StringID+Typ)
134 _CALLC, // call Cdecl-DECLARE-Method (+StringID+Typ)
135 _CASEIS, // case-test (+Test-Opcode+True-Target)
136 // management
137 _STMNT, // begin of a statement (+Line+Col)
138 // E/A
139 _OPEN, // (+StreamMode+Flags)
140 // objects
141 _LOCAL, // define locals variables (+StringID+Typ)
142 _PUBLIC, // module global variables (+StringID+Typ)
143 _GLOBAL, // define global variables, public command (+StringID+Typ)
144 _CREATE, // create object (+StringId+StringID)
145 _STATIC, // static variable (+StringID+Typ) JSM
146 _TCREATE, // create user-defined object
147 _DCREATE, // create object-array (+StringId+StringID)
148 _GLOBAL_P, // define global variable that's not overwritten on restarting
149 // the Basic, P=PERSIST (+StringID+Typ)
150 _FIND_G, // finds global variable with special treatment due to _GLOBAL_P
151 _DCREATE_REDIMP, // redimension object-array (+StringId+StringID)
152 _FIND_CM, // Search inside a class module (CM) to enable global search in time
153 _PUBLIC_P, // Module global Variable (persisted between calls)(+StringID+Typ)
154 _FIND_STATIC, // local static var lookup (+StringID+Typ)
156 SbOP2_END = _FIND_STATIC
159 #endif
161 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */