LibreOffice Module basic (master) 1
opcodes.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#pragma once
21
22// An opcode can have a length of 1, 3 or 5 bytes,
23// depending on its numeric value (see below).
24
25enum class SbiOpcode {
26 // all opcodes without operands
27 NOP_ = 0,
28
30
31 // operators
32 // the following operators are ordered
33 // the same way as the enum SbxVarOp
35 EQ_, NE_, LT_, GT_, LE_, GE_,
37 CAT_,
38 // end of enum SbxVarOp
39 LIKE_, IS_,
40 // load/save
41 ARGC_, // establish new Argv
42 ARGV_, // TOS ==> current Argv
43 INPUT_, // Input ==> TOS
44 LINPUT_, // Line Input ==> TOS
45 GET_, // touch TOS
46 SET_, // save object TOS ==> TOS-1
47 PUT_, // TOS ==> TOS-1
48 PUTC_, // TOS ==> TOS-1, then ReadOnly
49 DIM_, // DIM
50 REDIM_, // REDIM
51 REDIMP_, // REDIM PRESERVE
52 ERASE_, // delete TOS
53 // branch
54 STOP_, // end of program
55 INITFOR_, // initialize FOR-variable
56 NEXT_, // increment FOR-variable
57 CASE_, // beginning CASE
58 ENDCASE_, // end CASE
59 STDERROR_, // standard error handling
60 NOERROR_, // no error handling
61 LEAVE_, // leave UP
62 // E/A
63 CHANNEL_, // TOS = channel number
64 BPRINT_, // print TOS
65 PRINTF_, // print TOS in field
66 BWRITE_, // write TOS
67 RENAME_, // Rename Tos+1 to Tos
68 PROMPT_, // TOS = Prompt for Input
69 RESTART_, // define restart point
70 CHAN0_, // I/O-channel 0
71 // miscellaneous
72 EMPTY_, // empty expression on stack
73 ERROR_, // TOS = error code
74 LSET_, // saving object TOS ==> TOS-1
75 RSET_, // saving object TOS ==> TOS-1
76 REDIMP_ERASE_, // Copies array to be later used by REDIM PRESERVE before erasing it
78 VBASET_, // VBA-like Set
79 ERASE_CLEAR_, // Erase array and clear variable
80 ARRAYACCESS_, // Assign parameters to TOS and get value, used for array of arrays
81 BYVAL_, // byref -> byval for lvalue parameter passed in call
82
84
85 // all opcodes with one operand
86
87 NUMBER_ = 0x40, // loading a numeric constant (+ID)
88
90
91 SCONST_, // loading a string constant (+ID)
92 CONST_, // Immediate Load (+ value)
93 ARGN_, // saving a named Arg in Argv (+StringID)
94 PAD_, // bring string to a firm length (+length)
95 // branch
96 JUMP_, // jump (+target)
97 JUMPT_, // evaluate TOS, conditional jump (+target)
98 JUMPF_, // evaluate TOS, conditional jump (+target)
99 ONJUMP_, // evaluate TOS, jump into JUMP-table (+MaxVal)
100 GOSUB_, // UP-call (+Target)
101 RETURN_, // UP-return (+0 or Target)
102 TESTFOR_, // test FOR-variable, increment (+Endlabel)
103 CASETO_, // Tos+1 <= Case <= Tos, 2xremove (+Target)
104 ERRHDL_, // error handler (+Offset)
105 RESUME_, // Resume after errors (+0 or 1 or Label)
106 // E/A
107 CLOSE_, // (+channel/0)
108 PRCHAR_, // (+char)
109 // management
110 SETCLASS_, // test set + class names (+StringId)
111 TESTCLASS_, // Check TOS class (+StringId)
112 LIB_, // set lib name for declare-procs (+StringId)
113 BASED_, // TOS is incremented by BASE, BASE is pushed before (+base)
114 // type adjustment in the Argv
115 ARGTYP_, // convert last parameter in Argv (+type)
116 VBASETCLASS_, // VBA-like Set
117
119
120 // all opcodes with two operands
121
122 RTL_ = 0x80, // load from the RTL (+StringID+Typ)
123
125
126 FIND_, // load (+StringID+Typ)
127 ELEM_, // load element (+StringID+Typ)
128 PARAM_, // parameters (+Offset+Typ)
129 // branch
130 CALL_, // call DECLARE-method (+StringID+Typ)
131 CALLC_, // call Cdecl-DECLARE-Method (+StringID+Typ)
132 CASEIS_, // case-test (+Test-Opcode+True-Target)
133 // management
134 STMNT_, // begin of a statement (+Line+Col)
135 // E/A
136 OPEN_, // (+StreamMode+Flags)
137 // objects
138 LOCAL_, // define locals variables (+StringID+Typ)
139 PUBLIC_, // module global variables (+StringID+Typ)
140 GLOBAL_, // define global variables, public command (+StringID+Typ)
141 CREATE_, // create object (+StringId+StringID)
142 STATIC_, // static variable (+StringID+Typ) JSM
143 TCREATE_, // create user-defined object
144 DCREATE_, // create object-array (+StringId+StringID)
145 GLOBAL_P_, // define global variable that's not overwritten on restarting
146 // the Basic, P=PERSIST (+StringID+Typ)
147 FIND_G_, // finds global variable with special treatment due to GLOBAL_P_
148 DCREATE_REDIMP_, // redimension object-array (+StringId+StringID)
149 FIND_CM_, // Search inside a class module (CM) to enable global search in time
150 PUBLIC_P_, // Module global Variable (persisted between calls)(+StringID+Typ)
151 FIND_STATIC_, // local static var lookup (+StringID+Typ)
152
154};
155
156/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SbiOpcode
Definition: opcodes.hxx:25
#define CONST_
Definition: stdobj.cxx:46
@ ERROR_
Definition: token.hxx:49