You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/engine/virtualmachine.h
+47-45Lines changed: 47 additions & 45 deletions
Original file line number
Diff line number
Diff line change
@@ -15,51 +15,53 @@ namespace vm
15
15
16
16
enum Opcode
17
17
{
18
-
OP_START, /*!< The first instruction of every bytecode. */
19
-
OP_HALT, /*!< The last instruction of every bytecode. */
20
-
OP_CONST, /*!< Adds a constant value with the index in the argument to the next register. */
21
-
OP_NULL, /*!< Adds a null (zero) value to the next register. */
22
-
OP_CHECKPOINT, /*!< A checkpoint for the VirtualMachine::moveToLastCheckpoint() method. */
23
-
OP_IF, /*!< Jumps to the next instruction if the last register holds "true". If it's false, jumps to OP_ELSE or OP_ENDIF. */
24
-
OP_ELSE, /*!< Jumps to OP_ENDIF. This instruction is typically reached when the if statement condition was "true". */
25
-
OP_ENDIF, /*!< Doesn't do anything, but is used by OP_IF and OP_ELSE. */
26
-
OP_FOREVER_LOOP, /*!< Runs a forever loop. */
27
-
OP_REPEAT_LOOP, /*!< Runs a repeat loop with the number of periods stored in the last register. */
28
-
OP_UNTIL_LOOP, /*!< Evaluates the condition before OP_BEGIN_UNTIL_LOOP and runs a repeat until loop. */
29
-
OP_BEGIN_UNTIL_LOOP, /*!< Used by OP_UNTIL_LOOP. */
30
-
OP_LOOP_END, /*!< Ends the loop. */
31
-
OP_PRINT, /*!< Prints the value stored in the last register. */
32
-
OP_ADD, /*!< Adds the values stored in the last 2 registers and stores the result in the last registry, deleting the input registers. */
33
-
OP_SUBTRACT, /*!< Subtracts the values stored in the last 2 registers and stores the result in the last registry, deleting the input registers. */
34
-
OP_MULTIPLY, /*!< Multiplies the values stored in the last 2 registers and stores the result in the last registry, deleting the input registers. */
35
-
OP_DIVIDE, /*!< Divides the values stored in the last 2 registers and stores the result in the last registry, deleting the input registers. */
36
-
OP_MOD, /*!< Calculates module of the values stored in the last 2 registers and stores the result in the last registry, deleting the input registers. */
37
-
OP_RANDOM, /*!< Generates a random value in the range stored in the last 2 registers and stores the result in the last registry, deleting the input registers. */
38
-
OP_ROUND, /*!< Rounds the number in the last register and stores the result in the last register. */
39
-
OP_ABS, /*!< Calculates the absolute value of the number in the last register and stores the result in the last register. */
40
-
OP_FLOOR, /*!< Calculates the floor of the number in the last register and stores the result in the last register. */
41
-
OP_CEIL, /*!< Calculates the ceiling of the number in the last register and stores the result in the last register. */
42
-
OP_SQRT, /*!< Calculates the square root of the number in the last register and stores the result in the last register. */
43
-
OP_SIN, /*!< Calculates the sine of the number in the last register and stores the result in the last register. */
44
-
OP_COS, /*!< Calculates the cosine of the number in the last register and stores the result in the last register. */
45
-
OP_TAN, /*!< Calculates the tangent of the number in the last register and stores the result in the last register. */
46
-
OP_ASIN, /*!< Calculates the arcsine of the number in the last register and stores the result in the last register. */
47
-
OP_ACOS, /*!< Calculates the arccosine of the number in the last register and stores the result in the last register. */
48
-
OP_ATAN, /*!< Calculates the arctangent of the number in the last register and stores the result in the last register. */
49
-
OP_GREATER_THAN, /*!< Compares (>) the values stored in the last 2 registers and stores the result in the last registry, deleting the input registers. */
50
-
OP_LESS_THAN, /*!< Compares (<) the values stored in the last 2 registers and stores the result in the last registry, deleting the input registers. */
51
-
OP_EQUALS, /*!< Compares (==) the values stored in the last 2 registers and stores the result in the last registry, deleting the input registers. */
52
-
OP_AND, /*!< AND gate. The result is stored in the last registry and the input registers are deleted. */
53
-
OP_OR, /*!< OR gate. The result is stored in the last registry and the input registers are deleted. */
54
-
OP_NOT, /*!< NOT gate. The result is stored in the last registry and the input registers are deleted. */
55
-
OP_SET_VAR, /*!< Sets the variable with the index in the argument to the value stored in the last register. */
56
-
OP_CHANGE_VAR, /*!< Increments (or decrements) the variable with the index in the argument by the value stored in the last register. */
57
-
OP_READ_VAR, /*!< Reads the variable with the index in the argument and stores the value in the last register. */
58
-
OP_READ_LIST, /*!< Converts the list with the index in the argument to a string and stores the result in the last register. */
59
-
OP_LIST_APPEND, /*!< Appens the value stored in the last register to the list with the index in the argument. */
60
-
OP_LIST_DEL, /*!< Deletes the index (or item like "last" or "random") stored in the last register of the list with the index in the argument. */
61
-
OP_LIST_DEL_ALL, /*!< Clears the list with the index in the argument. */
62
-
OP_LIST_INSERT, /*!< Inserts the value from the second last register at the index (or item like "last" or "random") stored in the last register to the list with the index in the argument. */
18
+
OP_START, /*!< The first instruction of every bytecode. */
19
+
OP_HALT, /*!< The last instruction of every bytecode. */
20
+
OP_CONST, /*!< Adds a constant value with the index in the argument to the next register. */
21
+
OP_NULL, /*!< Adds a null (zero) value to the next register. */
22
+
OP_CHECKPOINT, /*!< A checkpoint for the VirtualMachine::moveToLastCheckpoint() method. */
23
+
OP_IF, /*!< Jumps to the next instruction if the last register holds "true". If it's false, jumps to OP_ELSE or OP_ENDIF. */
24
+
OP_ELSE, /*!< Jumps to OP_ENDIF. This instruction is typically reached when the if statement condition was "true". */
25
+
OP_ENDIF, /*!< Doesn't do anything, but is used by OP_IF and OP_ELSE. */
26
+
OP_FOREVER_LOOP, /*!< Runs a forever loop. */
27
+
OP_REPEAT_LOOP, /*!< Runs a repeat loop with the number of periods stored in the last register. */
28
+
OP_REPEAT_LOOP_INDEX, /*!< Returns the index of current repeat loop. */
29
+
OP_REPEAT_LOOP_INDEX1, /*!< Returns the index of current repeat loop plus 1. */
30
+
OP_UNTIL_LOOP, /*!< Evaluates the condition before OP_BEGIN_UNTIL_LOOP and runs a repeat until loop. */
31
+
OP_BEGIN_UNTIL_LOOP, /*!< Used by OP_UNTIL_LOOP. */
32
+
OP_LOOP_END, /*!< Ends the loop. */
33
+
OP_PRINT, /*!< Prints the value stored in the last register. */
34
+
OP_ADD, /*!< Adds the values stored in the last 2 registers and stores the result in the last registry, deleting the input registers. */
35
+
OP_SUBTRACT, /*!< Subtracts the values stored in the last 2 registers and stores the result in the last registry, deleting the input registers. */
36
+
OP_MULTIPLY, /*!< Multiplies the values stored in the last 2 registers and stores the result in the last registry, deleting the input registers. */
37
+
OP_DIVIDE, /*!< Divides the values stored in the last 2 registers and stores the result in the last registry, deleting the input registers. */
38
+
OP_MOD, /*!< Calculates module of the values stored in the last 2 registers and stores the result in the last registry, deleting the input registers. */
39
+
OP_RANDOM, /*!< Generates a random value in the range stored in the last 2 registers and stores the result in the last registry, deleting the input registers. */
40
+
OP_ROUND, /*!< Rounds the number in the last register and stores the result in the last register. */
41
+
OP_ABS, /*!< Calculates the absolute value of the number in the last register and stores the result in the last register. */
42
+
OP_FLOOR, /*!< Calculates the floor of the number in the last register and stores the result in the last register. */
43
+
OP_CEIL, /*!< Calculates the ceiling of the number in the last register and stores the result in the last register. */
44
+
OP_SQRT, /*!< Calculates the square root of the number in the last register and stores the result in the last register. */
45
+
OP_SIN, /*!< Calculates the sine of the number in the last register and stores the result in the last register. */
46
+
OP_COS, /*!< Calculates the cosine of the number in the last register and stores the result in the last register. */
47
+
OP_TAN, /*!< Calculates the tangent of the number in the last register and stores the result in the last register. */
48
+
OP_ASIN, /*!< Calculates the arcsine of the number in the last register and stores the result in the last register. */
49
+
OP_ACOS, /*!< Calculates the arccosine of the number in the last register and stores the result in the last register. */
50
+
OP_ATAN, /*!< Calculates the arctangent of the number in the last register and stores the result in the last register. */
51
+
OP_GREATER_THAN, /*!< Compares (>) the values stored in the last 2 registers and stores the result in the last registry, deleting the input registers. */
52
+
OP_LESS_THAN, /*!< Compares (<) the values stored in the last 2 registers and stores the result in the last registry, deleting the input registers. */
53
+
OP_EQUALS, /*!< Compares (==) the values stored in the last 2 registers and stores the result in the last registry, deleting the input registers. */
54
+
OP_AND, /*!< AND gate. The result is stored in the last registry and the input registers are deleted. */
55
+
OP_OR, /*!< OR gate. The result is stored in the last registry and the input registers are deleted. */
56
+
OP_NOT, /*!< NOT gate. The result is stored in the last registry and the input registers are deleted. */
57
+
OP_SET_VAR, /*!< Sets the variable with the index in the argument to the value stored in the last register. */
58
+
OP_CHANGE_VAR, /*!< Increments (or decrements) the variable with the index in the argument by the value stored in the last register. */
59
+
OP_READ_VAR, /*!< Reads the variable with the index in the argument and stores the value in the last register. */
60
+
OP_READ_LIST, /*!< Converts the list with the index in the argument to a string and stores the result in the last register. */
61
+
OP_LIST_APPEND, /*!< Appens the value stored in the last register to the list with the index in the argument. */
62
+
OP_LIST_DEL, /*!< Deletes the index (or item like "last" or "random") stored in the last register of the list with the index in the argument. */
63
+
OP_LIST_DEL_ALL, /*!< Clears the list with the index in the argument. */
64
+
OP_LIST_INSERT, /*!< Inserts the value from the second last register at the index (or item like "last" or "random") stored in the last register to the list with the index in the argument. */
63
65
OP_LIST_REPLACE, /*!< Replaces the index (or item like "last" or "random") stored in the second last register with the value from the last register in the list with the index in the argument. */
64
66
OP_LIST_GET_ITEM, /*!< Stores the value at the index (or item like "last" or "random") (of the list with the index in the argument) stored in the last register, in the last register. */
65
67
OP_LIST_INDEX_OF, /*!< Stores the index of the value from the last register in the last register (of the list with the index in the argument). */
0 commit comments