LibreOffice Module basic (master)
1
basic
source
inc
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
25
enum class
SbiOpcode
{
26
// all opcodes without operands
27
NOP_
= 0,
28
29
SbOP0_START
=
NOP_
,
30
31
// operators
32
// the following operators are ordered
33
// the same way as the enum SbxVarOp
34
EXP_
,
MUL_
,
DIV_
,
MOD_
,
PLUS_
,
MINUS_
,
NEG_
,
35
EQ_
,
NE_
,
LT_
,
GT_
,
LE_
,
GE_
,
36
IDIV_
,
AND_
,
OR_
,
XOR_
,
EQV_
,
IMP_
,
NOT_
,
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
77
INITFOREACH_
,
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
83
SbOP0_END
=
BYVAL_
,
84
85
// all opcodes with one operand
86
87
NUMBER_
= 0x40,
// loading a numeric constant (+ID)
88
89
SbOP1_START
=
NUMBER_
,
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
118
SbOP1_END
=
VBASETCLASS_
,
119
120
// all opcodes with two operands
121
122
RTL_
= 0x80,
// load from the RTL (+StringID+Typ)
123
124
SbOP2_START
=
RTL_
,
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
153
SbOP2_END
=
FIND_STATIC_
154
};
155
156
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SbiOpcode
SbiOpcode
Definition:
opcodes.hxx:25
SbiOpcode::INITFOR_
@ INITFOR_
SbiOpcode::LT_
@ LT_
SbiOpcode::PAD_
@ PAD_
SbiOpcode::JUMPT_
@ JUMPT_
SbiOpcode::CASETO_
@ CASETO_
SbiOpcode::RSET_
@ RSET_
SbiOpcode::BWRITE_
@ BWRITE_
SbiOpcode::ERRHDL_
@ ERRHDL_
SbiOpcode::OR_
@ OR_
SbiOpcode::CALLC_
@ CALLC_
SbiOpcode::IS_
@ IS_
SbiOpcode::ARGTYP_
@ ARGTYP_
SbiOpcode::BYVAL_
@ BYVAL_
SbiOpcode::CASE_
@ CASE_
SbiOpcode::PUT_
@ PUT_
SbiOpcode::ARGV_
@ ARGV_
SbiOpcode::MUL_
@ MUL_
SbiOpcode::RESTART_
@ RESTART_
SbiOpcode::RENAME_
@ RENAME_
SbiOpcode::NEG_
@ NEG_
SbiOpcode::CLOSE_
@ CLOSE_
SbiOpcode::GET_
@ GET_
SbiOpcode::ERASE_CLEAR_
@ ERASE_CLEAR_
SbiOpcode::REDIM_
@ REDIM_
SbiOpcode::LIB_
@ LIB_
SbiOpcode::VBASETCLASS_
@ VBASETCLASS_
SbiOpcode::SbOP1_START
@ SbOP1_START
SbiOpcode::SETCLASS_
@ SETCLASS_
SbiOpcode::FIND_STATIC_
@ FIND_STATIC_
SbiOpcode::CHANNEL_
@ CHANNEL_
SbiOpcode::NEXT_
@ NEXT_
SbiOpcode::SbOP2_END
@ SbOP2_END
SbiOpcode::REDIMP_
@ REDIMP_
SbiOpcode::RESUME_
@ RESUME_
SbiOpcode::RETURN_
@ RETURN_
SbiOpcode::BPRINT_
@ BPRINT_
SbiOpcode::EQV_
@ EQV_
SbiOpcode::REDIMP_ERASE_
@ REDIMP_ERASE_
SbiOpcode::ARRAYACCESS_
@ ARRAYACCESS_
SbiOpcode::XOR_
@ XOR_
SbiOpcode::CHAN0_
@ CHAN0_
SbiOpcode::MINUS_
@ MINUS_
SbiOpcode::STDERROR_
@ STDERROR_
SbiOpcode::TESTCLASS_
@ TESTCLASS_
SbiOpcode::GLOBAL_P_
@ GLOBAL_P_
SbiOpcode::FIND_G_
@ FIND_G_
SbiOpcode::DCREATE_REDIMP_
@ DCREATE_REDIMP_
SbiOpcode::CAT_
@ CAT_
SbiOpcode::GLOBAL_
@ GLOBAL_
SbiOpcode::TESTFOR_
@ TESTFOR_
SbiOpcode::CASEIS_
@ CASEIS_
SbiOpcode::BASED_
@ BASED_
SbiOpcode::IMP_
@ IMP_
SbiOpcode::GE_
@ GE_
SbiOpcode::PUBLIC_
@ PUBLIC_
SbiOpcode::EXP_
@ EXP_
SbiOpcode::JUMPF_
@ JUMPF_
SbiOpcode::GOSUB_
@ GOSUB_
SbiOpcode::GT_
@ GT_
SbiOpcode::ARGN_
@ ARGN_
SbiOpcode::LOCAL_
@ LOCAL_
SbiOpcode::INPUT_
@ INPUT_
SbiOpcode::DCREATE_
@ DCREATE_
SbiOpcode::DIM_
@ DIM_
SbiOpcode::RTL_
@ RTL_
SbiOpcode::NOERROR_
@ NOERROR_
SbiOpcode::PARAM_
@ PARAM_
SbiOpcode::AND_
@ AND_
SbiOpcode::IDIV_
@ IDIV_
SbiOpcode::PUTC_
@ PUTC_
SbiOpcode::LINPUT_
@ LINPUT_
SbiOpcode::SCONST_
@ SCONST_
SbiOpcode::ELEM_
@ ELEM_
SbiOpcode::ERASE_
@ ERASE_
SbiOpcode::PLUS_
@ PLUS_
SbiOpcode::CALL_
@ CALL_
SbiOpcode::EMPTY_
@ EMPTY_
SbiOpcode::SbOP0_END
@ SbOP0_END
SbiOpcode::SbOP2_START
@ SbOP2_START
SbiOpcode::SbOP1_END
@ SbOP1_END
SbiOpcode::LE_
@ LE_
SbiOpcode::DIV_
@ DIV_
SbiOpcode::VBASET_
@ VBASET_
SbiOpcode::NOP_
@ NOP_
SbiOpcode::PUBLIC_P_
@ PUBLIC_P_
SbiOpcode::STOP_
@ STOP_
SbiOpcode::ONJUMP_
@ ONJUMP_
SbiOpcode::TCREATE_
@ TCREATE_
SbiOpcode::STMNT_
@ STMNT_
SbiOpcode::SbOP0_START
@ SbOP0_START
SbiOpcode::FIND_CM_
@ FIND_CM_
SbiOpcode::LIKE_
@ LIKE_
SbiOpcode::NUMBER_
@ NUMBER_
SbiOpcode::LEAVE_
@ LEAVE_
SbiOpcode::FIND_
@ FIND_
SbiOpcode::STATIC_
@ STATIC_
SbiOpcode::NE_
@ NE_
SbiOpcode::CREATE_
@ CREATE_
SbiOpcode::PROMPT_
@ PROMPT_
SbiOpcode::PRCHAR_
@ PRCHAR_
SbiOpcode::INITFOREACH_
@ INITFOREACH_
SbiOpcode::ARGC_
@ ARGC_
SbiOpcode::JUMP_
@ JUMP_
SbiOpcode::SET_
@ SET_
SbiOpcode::NOT_
@ NOT_
SbiOpcode::EQ_
@ EQ_
SbiOpcode::ENDCASE_
@ ENDCASE_
SbiOpcode::PRINTF_
@ PRINTF_
SbiOpcode::OPEN_
@ OPEN_
SbiOpcode::MOD_
@ MOD_
SbiOpcode::LSET_
@ LSET_
CONST_
#define CONST_
Definition:
stdobj.cxx:46
ERROR_
@ ERROR_
Definition:
token.hxx:49
Generated on Sun Jul 30 2023 04:39:06 for LibreOffice Module basic (master) by
1.9.3