MCPcopy Create free account
hub / github.com/crownengine/crown / run

Function run

src/resource/expression_language.cpp:118–144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

116 }
117
118 bool run(const unsigned *byte_code, const float *variables, Stack &stack, ComputeFunction compute_function)
119 {
120 if (compute_function == NULL)
121 compute_function = default_compute_function;
122
123 const unsigned *p = byte_code;
124 while (true) {
125 unsigned bc = *p++;
126 unsigned op = bc_mask(bc);
127 unsigned id = id_mask(bc);
128 switch (op) {
129 case BC_PUSH_VAR:
130 if (stack.size == stack.capacity) return false;
131 stack.data[stack.size++] = variables[id];
132 break;
133 case BC_FUNCTION:
134 compute_function((OpCode)id, stack);
135 break;
136 case BC_END:
137 return true;
138 default: // BC_PUSH_FLOAT
139 if (stack.size == stack.capacity) return false;
140 stack.data[stack.size++] = unsigned_to_float(bc);
141 break;
142 }
143 }
144 }
145
146} // namespace expression_language
147

Callers 5

process_assignmentFunction · 0.85
loop_unroll_countMethod · 0.85
test_expression_languageFunction · 0.85
evalMethod · 0.85
updateMethod · 0.85

Calls 3

bc_maskFunction · 0.85
id_maskFunction · 0.85
unsigned_to_floatFunction · 0.85

Tested by 1

test_expression_languageFunction · 0.68