168 |
m_fnArrayEqual = new CoreVMFunction_array_equal; |
m_fnArrayEqual = new CoreVMFunction_array_equal; |
169 |
m_fnSearch = new CoreVMFunction_search; |
m_fnSearch = new CoreVMFunction_search; |
170 |
m_fnSort = new CoreVMFunction_sort; |
m_fnSort = new CoreVMFunction_sort; |
171 |
|
m_fnIntToReal = new CoreVMFunction_int_to_real; |
172 |
|
m_fnRealToInt = new CoreVMFunction_real_to_int; |
173 |
} |
} |
174 |
|
|
175 |
ScriptVM::~ScriptVM() { |
ScriptVM::~ScriptVM() { |
189 |
delete m_fnArrayEqual; |
delete m_fnArrayEqual; |
190 |
delete m_fnSearch; |
delete m_fnSearch; |
191 |
delete m_fnSort; |
delete m_fnSort; |
192 |
|
delete m_fnIntToReal; |
193 |
|
delete m_fnRealToInt; |
194 |
delete m_varRealTimer; |
delete m_varRealTimer; |
195 |
delete m_varPerfTimer; |
delete m_varPerfTimer; |
196 |
} |
} |
216 |
dmsg(2,("Allocating %lld of global VM string variables.\n", context->globalStrVarCount)); |
dmsg(2,("Allocating %lld of global VM string variables.\n", context->globalStrVarCount)); |
217 |
if (!context->globalIntMemory) |
if (!context->globalIntMemory) |
218 |
context->globalIntMemory = new ArrayList<vmint>(); |
context->globalIntMemory = new ArrayList<vmint>(); |
219 |
|
if (!context->globalRealMemory) |
220 |
|
context->globalRealMemory = new ArrayList<vmfloat>(); |
221 |
if (!context->globalStrMemory) |
if (!context->globalStrMemory) |
222 |
context->globalStrMemory = new ArrayList<String>(); |
context->globalStrMemory = new ArrayList<String>(); |
223 |
context->globalIntMemory->resize(context->globalIntVarCount); |
context->globalIntMemory->resize(context->globalIntVarCount); |
224 |
|
context->globalRealMemory->resize(context->globalRealVarCount); |
225 |
memset(&((*context->globalIntMemory)[0]), 0, context->globalIntVarCount * sizeof(vmint)); |
memset(&((*context->globalIntMemory)[0]), 0, context->globalIntVarCount * sizeof(vmint)); |
226 |
|
memset(&((*context->globalRealMemory)[0]), 0, context->globalRealVarCount * sizeof(vmfloat)); |
227 |
|
|
228 |
context->globalStrMemory->resize(context->globalStrVarCount); |
context->globalStrMemory->resize(context->globalStrVarCount); |
229 |
|
|
243 |
return; |
return; |
244 |
} |
} |
245 |
if (!ctx->globalIntMemory) { |
if (!ctx->globalIntMemory) { |
246 |
std::cerr << "Internal error: no global memory assigend to script VM.\n"; |
std::cerr << "Internal error: no global integer memory assigend to script VM.\n"; |
247 |
|
return; |
248 |
|
} |
249 |
|
if (!ctx->globalRealMemory) { |
250 |
|
std::cerr << "Internal error: no global real number memory assigend to script VM.\n"; |
251 |
return; |
return; |
252 |
} |
} |
253 |
ctx->handlers->dump(); |
ctx->handlers->dump(); |
312 |
else if (name == "array_equal") return m_fnArrayEqual; |
else if (name == "array_equal") return m_fnArrayEqual; |
313 |
else if (name == "search") return m_fnSearch; |
else if (name == "search") return m_fnSearch; |
314 |
else if (name == "sort") return m_fnSort; |
else if (name == "sort") return m_fnSort; |
315 |
|
else if (name == "int_to_real") return m_fnIntToReal; |
316 |
|
else if (name == "real") return m_fnIntToReal; |
317 |
|
else if (name == "real_to_int") return m_fnRealToInt; |
318 |
|
else if (name == "int") return m_fnRealToInt; |
319 |
return NULL; |
return NULL; |
320 |
} |
} |
321 |
|
|