Skip to content

Commit ecd65b2

Browse files
committed
VirtualMachine: Move instruction_arg_count to source file
1 parent 47d4a80 commit ecd65b2

File tree

2 files changed

+64
-3
lines changed

2 files changed

+64
-3
lines changed

src/engine/virtualmachine.cpp

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,69 @@ using namespace vm;
2424

2525
static const double pi = std::acos(-1); // TODO: Use std::numbers::pi in C++20
2626

27+
const unsigned int VirtualMachine::instruction_arg_count[] = {
28+
0, // OP_START
29+
0, // OP_HALT
30+
1, // OP_CONST
31+
0, // OP_NULL
32+
0, // OP_IF
33+
0, // OP_ELSE
34+
0, // OP_ENDIF
35+
0, // OP_FOREVER_LOOP
36+
0, // OP_REPEAT_LOOP
37+
0, // OP_UNTIL_LOOP
38+
0, // OP_BEGIN_UNTIL_LOOP
39+
0, // OP_LOOP_END
40+
0, // OP_PRINT
41+
0, // OP_ADD
42+
0, // OP_SUBTRACT
43+
0, // OP_MULTIPLY
44+
0, // OP_DIVIDE
45+
0, // OP_MOD
46+
0, // OP_RANDOM
47+
0, // OP_ROUND
48+
0, // OP_ABS
49+
0, // OP_FLOOR
50+
0, // OP_CEIL
51+
0, // OP_SQRT
52+
0, // OP_SIN
53+
0, // OP_COS
54+
0, // OP_TAN
55+
0, // OP_ASIN
56+
0, // OP_ACOS
57+
0, // OP_ATAN
58+
0, // OP_GREATER_THAN
59+
0, // OP_LESS_THAN
60+
0, // OP_EQUALS
61+
0, // OP_AND
62+
0, // OP_OR
63+
0, // OP_NOT
64+
1, // OP_SET_VAR
65+
1, // OP_CHANGE_VAR
66+
1, // OP_READ_VAR
67+
1, // OP_READ_LIST
68+
1, // OP_LIST_APPEND
69+
1, // OP_LIST_DEL
70+
1, // OP_LIST_DEL_ALL
71+
1, // OP_LIST_INSERT
72+
1, // OP_LIST_REPLACE
73+
1, // OP_LIST_GET_ITEM
74+
1, // OP_LIST_INDEX_OF
75+
1, // OP_LIST_LENGTH
76+
1, // OP_LIST_CONTAINS
77+
0, // OP_STR_CONCAT
78+
0, // OP_STR_AT
79+
0, // OP_STR_LENGTH
80+
0, // OP_STR_CONTAINS
81+
1, // OP_EXEC
82+
0, // OP_INIT_PROCEDURE
83+
1, // OP_CALL_PROCEDURE
84+
0, // OP_ADD_ARG
85+
1, // OP_READ_ARG
86+
0 // OP_BREAK_ATOMIC
87+
};
88+
;
89+
2790
/*! Constructs VirtualMachine. */
2891
VirtualMachine::VirtualMachine()
2992
{

src/engine/virtualmachine.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,7 @@ class LIBSCRATCHCPP_EXPORT VirtualMachine
132132
bool savePos() const { return m_savePos; }
133133

134134
private:
135-
static inline const unsigned int instruction_arg_count[] = {
136-
0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0
137-
};
135+
static const unsigned int instruction_arg_count[];
138136

139137
typedef struct
140138
{

0 commit comments

Comments
 (0)