59
59
opcode_PUSHMSGVAR = 1002, /* requires var operand */
60
60
opcode_PUSHCONSTANT = 1003, /* requires var operand */
61
61
opcode_UNARY_MINUS = 1010,
62
opcode_END_PROG = 1011
62
opcode_FUNC_CALL = 1012,
63
opcode_END_PROG = 2000
67
/* Additional doc, operation specific
70
All parameter passing is via the stack. Parameters are placed onto the stack in reverse order,
71
that means the last parameter is on top of the stack, the first at the bottom location.
72
At the actual top of the stack is the number of parameters. This permits functions to be
73
called with variable number of arguments. The function itself is responsible for poping
74
the right number of parameters of the stack and complaining if the number is incorrect.
75
On exit, a single return value must be pushed onto the stack. The FUNC_CALL operation
76
is generic. Its pVar argument contains the function name string (TODO: very slow, make
77
faster in later releases).
79
Sample Function call: sampleFunc(p1, p2, p3) ; returns number 4711 (sample)
80
Stacklayout on entry (order is top to bottom):
66
94
/* the vmop object */
67
95
typedef struct vmop_s {
68
96
BEGINobjInstance; /* Data to implement generic object - MUST be the first data element! */
72
/* TODO: add function pointer */
99
var_t *pVar; /* for function call, this is the name (string) of function to be called */
74
101
struct vmop_s *pNext; /* next operation or NULL, if end of program (logically this belongs to vmprg) */