blob: ea01134218e88f0582ae19b37c5f5cd1235fc71f [file] [log] [blame]
Jason Samse45ac6e2009-07-20 14:31:06 -07001/*
2 * Copyright (C) 2009 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include "rsContext.h"
18#include "rsScriptC.h"
19#include "rsMatrix.h"
20
21#include "acc/acc.h"
Joe Onorato9c4e4ca2009-08-09 11:39:02 -070022#include "utils/Timers.h"
Jason Samse45ac6e2009-07-20 14:31:06 -070023
Romain Guy98e10fd2009-07-30 18:45:01 -070024#include <time.h>
Romain Guy98e10fd2009-07-30 18:45:01 -070025
Jason Samse45ac6e2009-07-20 14:31:06 -070026using namespace android;
27using namespace android::renderscript;
28
29#define GET_TLS() Context::ScriptTLSStruct * tls = \
30 (Context::ScriptTLSStruct *)pthread_getspecific(Context::gThreadTLSKey); \
31 Context * rsc = tls->mContext; \
32 ScriptC * sc = (ScriptC *) tls->mScript
33
Jason Samsbe36bf32010-05-11 14:03:58 -070034
Jason Samse45ac6e2009-07-20 14:31:06 -070035//////////////////////////////////////////////////////////////////////////////
36// Math routines
37//////////////////////////////////////////////////////////////////////////////
38
Romain Guy2275d632009-08-18 11:39:17 -070039static float SC_sinf_fast(float x)
40{
41 const float A = 1.0f / (2.0f * M_PI);
42 const float B = -16.0f;
43 const float C = 8.0f;
Jason Samsa57c0a72009-09-04 14:42:41 -070044
Romain Guy2275d632009-08-18 11:39:17 -070045 // scale angle for easy argument reduction
46 x *= A;
Jason Samsa57c0a72009-09-04 14:42:41 -070047
Romain Guy2275d632009-08-18 11:39:17 -070048 if (fabsf(x) >= 0.5f) {
49 // argument reduction
50 x = x - ceilf(x + 0.5f) + 1.0f;
51 }
Jason Samsa57c0a72009-09-04 14:42:41 -070052
Romain Guy2275d632009-08-18 11:39:17 -070053 const float y = B * x * fabsf(x) + C * x;
54 return 0.2215f * (y * fabsf(y) - y) + y;
55}
56
57static float SC_cosf_fast(float x)
58{
59 x += float(M_PI / 2);
60
61 const float A = 1.0f / (2.0f * M_PI);
62 const float B = -16.0f;
63 const float C = 8.0f;
Jason Samsa57c0a72009-09-04 14:42:41 -070064
Romain Guy2275d632009-08-18 11:39:17 -070065 // scale angle for easy argument reduction
66 x *= A;
Jason Samsa57c0a72009-09-04 14:42:41 -070067
Romain Guy2275d632009-08-18 11:39:17 -070068 if (fabsf(x) >= 0.5f) {
69 // argument reduction
70 x = x - ceilf(x + 0.5f) + 1.0f;
71 }
Jason Samsa57c0a72009-09-04 14:42:41 -070072
Romain Guy2275d632009-08-18 11:39:17 -070073 const float y = B * x * fabsf(x) + C * x;
74 return 0.2215f * (y * fabsf(y) - y) + y;
75}
76
Jason Sams22fa3712010-05-19 17:22:57 -070077
Jason Samse45ac6e2009-07-20 14:31:06 -070078static float SC_randf(float max)
79{
80 float r = (float)rand();
81 return r / RAND_MAX * max;
82}
83
Romain Guy39dbc802009-07-31 11:20:59 -070084static float SC_randf2(float min, float max)
85{
86 float r = (float)rand();
87 return r / RAND_MAX * (max - min) + min;
88}
89
Jason Sams22fa3712010-05-19 17:22:57 -070090static int SC_randi(int max)
91{
92 return (int)SC_randf(max);
93}
94
95static int SC_randi2(int min, int max)
96{
97 return (int)SC_randf2(min, max);
98}
99
Jason Samsbe36bf32010-05-11 14:03:58 -0700100static float SC_frac(float v)
101{
102 int i = (int)floor(v);
103 return fmin(v - i, 0x1.fffffep-1f);
104}
105
Romain Guy98e10fd2009-07-30 18:45:01 -0700106//////////////////////////////////////////////////////////////////////////////
107// Time routines
108//////////////////////////////////////////////////////////////////////////////
Jason Samse45ac6e2009-07-20 14:31:06 -0700109
Joe Onorato9c4e4ca2009-08-09 11:39:02 -0700110static int32_t SC_second()
Romain Guy98e10fd2009-07-30 18:45:01 -0700111{
112 GET_TLS();
113
114 time_t rawtime;
115 time(&rawtime);
116
Romain Guy519cdc92009-11-11 15:36:06 -0800117 struct tm *timeinfo;
118 timeinfo = localtime(&rawtime);
119 return timeinfo->tm_sec;
Romain Guy98e10fd2009-07-30 18:45:01 -0700120}
121
Joe Onorato9c4e4ca2009-08-09 11:39:02 -0700122static int32_t SC_minute()
Romain Guy98e10fd2009-07-30 18:45:01 -0700123{
124 GET_TLS();
Jason Samse5ffb872009-08-09 17:01:55 -0700125
Romain Guy98e10fd2009-07-30 18:45:01 -0700126 time_t rawtime;
127 time(&rawtime);
Jason Samse5ffb872009-08-09 17:01:55 -0700128
Romain Guy519cdc92009-11-11 15:36:06 -0800129 struct tm *timeinfo;
130 timeinfo = localtime(&rawtime);
131 return timeinfo->tm_min;
Jason Samse5ffb872009-08-09 17:01:55 -0700132}
Romain Guy98e10fd2009-07-30 18:45:01 -0700133
Joe Onorato9c4e4ca2009-08-09 11:39:02 -0700134static int32_t SC_hour()
Romain Guy98e10fd2009-07-30 18:45:01 -0700135{
136 GET_TLS();
Jason Samse5ffb872009-08-09 17:01:55 -0700137
Romain Guy98e10fd2009-07-30 18:45:01 -0700138 time_t rawtime;
139 time(&rawtime);
Jason Samse5ffb872009-08-09 17:01:55 -0700140
Romain Guy519cdc92009-11-11 15:36:06 -0800141 struct tm *timeinfo;
142 timeinfo = localtime(&rawtime);
143 return timeinfo->tm_hour;
Romain Guy39dbc802009-07-31 11:20:59 -0700144}
145
Joe Onorato9c4e4ca2009-08-09 11:39:02 -0700146static int32_t SC_day()
Romain Guy39dbc802009-07-31 11:20:59 -0700147{
148 GET_TLS();
Jason Samse5ffb872009-08-09 17:01:55 -0700149
Romain Guy39dbc802009-07-31 11:20:59 -0700150 time_t rawtime;
151 time(&rawtime);
Jason Samse5ffb872009-08-09 17:01:55 -0700152
Romain Guy519cdc92009-11-11 15:36:06 -0800153 struct tm *timeinfo;
154 timeinfo = localtime(&rawtime);
155 return timeinfo->tm_mday;
Jason Samse5ffb872009-08-09 17:01:55 -0700156}
Jason Samse45ac6e2009-07-20 14:31:06 -0700157
Joe Onorato9c4e4ca2009-08-09 11:39:02 -0700158static int32_t SC_month()
Romain Guy39dbc802009-07-31 11:20:59 -0700159{
160 GET_TLS();
Jason Samse5ffb872009-08-09 17:01:55 -0700161
Romain Guy39dbc802009-07-31 11:20:59 -0700162 time_t rawtime;
163 time(&rawtime);
Jason Samse5ffb872009-08-09 17:01:55 -0700164
Romain Guy519cdc92009-11-11 15:36:06 -0800165 struct tm *timeinfo;
166 timeinfo = localtime(&rawtime);
167 return timeinfo->tm_mon;
Jason Samse5ffb872009-08-09 17:01:55 -0700168}
Romain Guy39dbc802009-07-31 11:20:59 -0700169
Joe Onorato9c4e4ca2009-08-09 11:39:02 -0700170static int32_t SC_year()
Romain Guy39dbc802009-07-31 11:20:59 -0700171{
172 GET_TLS();
Jason Samse5ffb872009-08-09 17:01:55 -0700173
Romain Guy39dbc802009-07-31 11:20:59 -0700174 time_t rawtime;
175 time(&rawtime);
Jason Samse5ffb872009-08-09 17:01:55 -0700176
Romain Guy519cdc92009-11-11 15:36:06 -0800177 struct tm *timeinfo;
178 timeinfo = localtime(&rawtime);
179 return timeinfo->tm_year;
Romain Guy39dbc802009-07-31 11:20:59 -0700180}
181
Jason Sams22fa3712010-05-19 17:22:57 -0700182static int64_t SC_uptimeMillis2()
183{
184 return nanoseconds_to_milliseconds(systemTime(SYSTEM_TIME_MONOTONIC));
185}
186
187static int64_t SC_startTimeMillis2()
188{
189 GET_TLS();
190 return sc->mEnviroment.mStartTimeMillis;
191}
192
193static int64_t SC_elapsedTimeMillis2()
194{
195 GET_TLS();
196 return nanoseconds_to_milliseconds(systemTime(SYSTEM_TIME_MONOTONIC))
197 - sc->mEnviroment.mStartTimeMillis;
198}
199
Joe Onorato9c4e4ca2009-08-09 11:39:02 -0700200static int32_t SC_uptimeMillis()
201{
202 return nanoseconds_to_milliseconds(systemTime(SYSTEM_TIME_MONOTONIC));
203}
204
205static int32_t SC_startTimeMillis()
206{
207 GET_TLS();
208 return sc->mEnviroment.mStartTimeMillis;
209}
210
211static int32_t SC_elapsedTimeMillis()
212{
213 GET_TLS();
214 return nanoseconds_to_milliseconds(systemTime(SYSTEM_TIME_MONOTONIC))
215 - sc->mEnviroment.mStartTimeMillis;
216}
217
Jason Samse45ac6e2009-07-20 14:31:06 -0700218//////////////////////////////////////////////////////////////////////////////
219// Matrix routines
220//////////////////////////////////////////////////////////////////////////////
221
222
223static void SC_matrixLoadIdentity(rsc_Matrix *mat)
224{
225 Matrix *m = reinterpret_cast<Matrix *>(mat);
226 m->loadIdentity();
227}
228
229static void SC_matrixLoadFloat(rsc_Matrix *mat, const float *f)
230{
231 Matrix *m = reinterpret_cast<Matrix *>(mat);
232 m->load(f);
233}
234
235static void SC_matrixLoadMat(rsc_Matrix *mat, const rsc_Matrix *newmat)
236{
237 Matrix *m = reinterpret_cast<Matrix *>(mat);
238 m->load(reinterpret_cast<const Matrix *>(newmat));
239}
240
241static void SC_matrixLoadRotate(rsc_Matrix *mat, float rot, float x, float y, float z)
242{
243 Matrix *m = reinterpret_cast<Matrix *>(mat);
244 m->loadRotate(rot, x, y, z);
245}
246
247static void SC_matrixLoadScale(rsc_Matrix *mat, float x, float y, float z)
248{
249 Matrix *m = reinterpret_cast<Matrix *>(mat);
250 m->loadScale(x, y, z);
251}
252
253static void SC_matrixLoadTranslate(rsc_Matrix *mat, float x, float y, float z)
254{
255 Matrix *m = reinterpret_cast<Matrix *>(mat);
256 m->loadTranslate(x, y, z);
257}
258
259static void SC_matrixLoadMultiply(rsc_Matrix *mat, const rsc_Matrix *lhs, const rsc_Matrix *rhs)
260{
261 Matrix *m = reinterpret_cast<Matrix *>(mat);
262 m->loadMultiply(reinterpret_cast<const Matrix *>(lhs),
263 reinterpret_cast<const Matrix *>(rhs));
264}
265
266static void SC_matrixMultiply(rsc_Matrix *mat, const rsc_Matrix *rhs)
267{
268 Matrix *m = reinterpret_cast<Matrix *>(mat);
269 m->multiply(reinterpret_cast<const Matrix *>(rhs));
270}
271
272static void SC_matrixRotate(rsc_Matrix *mat, float rot, float x, float y, float z)
273{
274 Matrix *m = reinterpret_cast<Matrix *>(mat);
275 m->rotate(rot, x, y, z);
276}
277
278static void SC_matrixScale(rsc_Matrix *mat, float x, float y, float z)
279{
280 Matrix *m = reinterpret_cast<Matrix *>(mat);
281 m->scale(x, y, z);
282}
283
284static void SC_matrixTranslate(rsc_Matrix *mat, float x, float y, float z)
285{
286 Matrix *m = reinterpret_cast<Matrix *>(mat);
287 m->translate(x, y, z);
288}
289
290
Jason Samse45ac6e2009-07-20 14:31:06 -0700291//////////////////////////////////////////////////////////////////////////////
292//
293//////////////////////////////////////////////////////////////////////////////
294
Jason Samsbe36bf32010-05-11 14:03:58 -0700295static uint32_t SC_allocGetDimX(RsAllocation va)
296{
297 GET_TLS();
298 const Allocation *a = static_cast<const Allocation *>(va);
299 //LOGE("SC_allocGetDimX a=%p", a);
300 //LOGE(" type=%p", a->getType());
301 return a->getType()->getDimX();
302}
303
304static uint32_t SC_allocGetDimY(RsAllocation va)
305{
306 GET_TLS();
307 const Allocation *a = static_cast<const Allocation *>(va);
308 return a->getType()->getDimY();
309}
310
311static uint32_t SC_allocGetDimZ(RsAllocation va)
312{
313 GET_TLS();
314 const Allocation *a = static_cast<const Allocation *>(va);
315 return a->getType()->getDimZ();
316}
317
318static uint32_t SC_allocGetDimLOD(RsAllocation va)
319{
320 GET_TLS();
321 const Allocation *a = static_cast<const Allocation *>(va);
322 return a->getType()->getDimLOD();
323}
324
325static uint32_t SC_allocGetDimFaces(RsAllocation va)
326{
327 GET_TLS();
328 const Allocation *a = static_cast<const Allocation *>(va);
329 return a->getType()->getDimFaces();
330}
331
332
Jason Samse45ac6e2009-07-20 14:31:06 -0700333
Jason Sams22fa3712010-05-19 17:22:57 -0700334static void SC_debugF(const char *s, float f) {
335 LOGE("%s %f, 0x%08x", s, f, *((int *) (&f)));
Jason Samsc9d43db2009-07-28 12:02:16 -0700336}
Jason Sams22fa3712010-05-19 17:22:57 -0700337static void SC_debugFv2(const char *s, rsvF_2 fv) {
338 float *f = (float *)&fv;
339 LOGE("%s {%f, %f}", s, f[0], f[1]);
Romain Guy370ed152009-08-20 17:08:33 -0700340}
Jason Sams22fa3712010-05-19 17:22:57 -0700341static void SC_debugFv3(const char *s, rsvF_4 fv) {
342 float *f = (float *)&fv;
343 LOGE("%s {%f, %f, %f}", s, f[0], f[1], f[2]);
Jason Samsc9d43db2009-07-28 12:02:16 -0700344}
Jason Sams22fa3712010-05-19 17:22:57 -0700345static void SC_debugFv4(const char *s, rsvF_4 fv) {
346 float *f = (float *)&fv;
347 LOGE("%s {%f, %f, %f, %f}", s, f[0], f[1], f[2], f[3]);
348}
349static void SC_debugI32(const char *s, int32_t i) {
350 LOGE("%s %i 0x%x", s, i, i);
Romain Guy370ed152009-08-20 17:08:33 -0700351}
352
Jason Sams8c401ef2009-10-06 13:58:47 -0700353static uint32_t SC_toClient(void *data, int cmdID, int len, int waitForSpace)
354{
355 GET_TLS();
Jason Samsbe36bf32010-05-11 14:03:58 -0700356 //LOGE("SC_toClient %i %i %i", cmdID, len, waitForSpace);
Jason Sams8c401ef2009-10-06 13:58:47 -0700357 return rsc->sendMessageToClient(data, cmdID, len, waitForSpace != 0);
358}
359
Jason Sams3a27c952009-10-07 18:14:01 -0700360static void SC_scriptCall(int scriptID)
361{
362 GET_TLS();
Jason Samsc61346b2010-05-28 18:23:22 -0700363 rsc->runScript((Script *)scriptID);
Jason Sams3a27c952009-10-07 18:14:01 -0700364}
365
Jason Samsbe36bf32010-05-11 14:03:58 -0700366int SC_divsi3(int a, int b)
367{
368 return a / b;
369}
Jason Sams3a27c952009-10-07 18:14:01 -0700370
Jason Samsce92d4b2010-05-17 14:55:34 -0700371int SC_getAllocation(const void *ptr)
372{
373 GET_TLS();
374 const Allocation *alloc = sc->ptrToAllocation(ptr);
375 return (int)alloc;
376}
377
378
Jason Samsc61346b2010-05-28 18:23:22 -0700379void SC_ForEachii(RsScript vs, RsAllocation vin)
380{
381 GET_TLS();
382 Script *s = static_cast<Script *>(vs);
383 Allocation *ain = static_cast<Allocation *>(vin);
384 s->runForEach(rsc, ain, NULL);
385}
386
387void SC_ForEachiii(RsScript vs, RsAllocation vin, RsAllocation vout)
388{
389 GET_TLS();
390 Script *s = static_cast<Script *>(vs);
391 Allocation *ain = static_cast<Allocation *>(vin);
392 Allocation *aout = static_cast<Allocation *>(vout);
393 s->runForEach(rsc, ain, aout);
394}
395
396void SC_ForEachiiii(RsScript vs, RsAllocation vin, int xStart, int xEnd)
397{
398 GET_TLS();
399 Script *s = static_cast<Script *>(vs);
400 Allocation *ain = static_cast<Allocation *>(vin);
401 s->runForEach(rsc, ain, NULL, xStart, xEnd);
402}
403
404void SC_ForEachiiiii(RsScript vs, RsAllocation vin, RsAllocation vout, int xStart, int xEnd)
405{
406 GET_TLS();
407 Script *s = static_cast<Script *>(vs);
408 Allocation *ain = static_cast<Allocation *>(vin);
409 Allocation *aout = static_cast<Allocation *>(vout);
410 s->runForEach(rsc, ain, aout, xStart, xEnd);
411}
412
413void SC_ForEachiiiiii(RsScript vs, RsAllocation vin, int xStart, int yStart, int xEnd, int yEnd)
414{
415 GET_TLS();
416 Script *s = static_cast<Script *>(vs);
417 Allocation *ain = static_cast<Allocation *>(vin);
418 s->runForEach(rsc, ain, NULL, xStart, yStart, xEnd, yEnd);
419}
420
421void SC_ForEachiiiiiii(RsScript vs, RsAllocation vin, RsAllocation vout, int xStart, int yStart, int xEnd, int yEnd)
422{
423 GET_TLS();
424 Script *s = static_cast<Script *>(vs);
425 Allocation *ain = static_cast<Allocation *>(vin);
426 Allocation *aout = static_cast<Allocation *>(vout);
427 s->runForEach(rsc, ain, aout, xStart, yStart, xEnd, yEnd);
428}
429
430
Jason Samse45ac6e2009-07-20 14:31:06 -0700431//////////////////////////////////////////////////////////////////////////////
432// Class implementation
433//////////////////////////////////////////////////////////////////////////////
434
Jason Samsbe36bf32010-05-11 14:03:58 -0700435// llvm name mangling ref
436// <builtin-type> ::= v # void
437// ::= b # bool
438// ::= c # char
439// ::= a # signed char
440// ::= h # unsigned char
441// ::= s # short
442// ::= t # unsigned short
443// ::= i # int
444// ::= j # unsigned int
445// ::= l # long
446// ::= m # unsigned long
447// ::= x # long long, __int64
448// ::= y # unsigned long long, __int64
449// ::= f # float
450// ::= d # double
Jason Samse45ac6e2009-07-20 14:31:06 -0700451
Jason Samsaeb094b2010-05-18 13:35:45 -0700452static ScriptCState::SymbolTable_t gSyms[] = {
Jason Samsbe36bf32010-05-11 14:03:58 -0700453 { "__divsi3", (void *)&SC_divsi3 },
454
Jason Sams22fa3712010-05-19 17:22:57 -0700455 // allocation
456 { "rsAllocationGetDimX", (void *)&SC_allocGetDimX },
457 { "rsAllocationGetDimY", (void *)&SC_allocGetDimY },
458 { "rsAllocationGetDimZ", (void *)&SC_allocGetDimZ },
459 { "rsAllocationGetDimLOD", (void *)&SC_allocGetDimLOD },
460 { "rsAllocationGetDimFaces", (void *)&SC_allocGetDimFaces },
461 { "rsGetAllocation", (void *)&SC_getAllocation },
462
Jason Sams22fa3712010-05-19 17:22:57 -0700463 // Debug
464 { "_Z7rsDebugPKcf", (void *)&SC_debugF },
465 { "_Z7rsDebugPKcDv2_f", (void *)&SC_debugFv2 },
466 { "_Z7rsDebugPKcDv3_f", (void *)&SC_debugFv3 },
467 { "_Z7rsDebugPKcDv4_f", (void *)&SC_debugFv4 },
468 { "_Z7rsDebugPKci", (void *)&SC_debugI32 },
469 //extern void __attribute__((overloadable))rsDebug(const char *, const void *);
470
471
472 // RS Math
473 { "_Z6rsRandi", (void *)&SC_randi },
474 { "_Z6rsRandii", (void *)&SC_randi2 },
475 { "_Z6rsRandf", (void *)&SC_randf },
476 { "_Z6rsRandff", (void *)&SC_randf2 },
477 { "_Z6rsFracf", (void *)&SC_frac },
478
479 // time
480 { "rsSecond", (void *)&SC_second },
481 { "rsMinute", (void *)&SC_minute },
482 { "rsHour", (void *)&SC_hour },
483 { "rsDay", (void *)&SC_day },
484 { "rsMonth", (void *)&SC_month },
485 { "rsYear", (void *)&SC_year },
486 { "rsUptimeMillis", (void*)&SC_uptimeMillis2 },
487 { "rsStartTimeMillis", (void*)&SC_startTimeMillis2 },
488 { "rsElapsedTimeMillis", (void*)&SC_elapsedTimeMillis2 },
489
490 { "rsSendToClient", (void *)&SC_toClient },
491
492 // matrix
493 { "rsMatrixLoadIdentity", (void *)&SC_matrixLoadIdentity },
494 { "rsMatrixLoadFloat", (void *)&SC_matrixLoadFloat },
495 { "rsMatrixLoadMat", (void *)&SC_matrixLoadMat },
496 { "rsMatrixLoadRotate", (void *)&SC_matrixLoadRotate },
497 { "rsMatrixLoadScale", (void *)&SC_matrixLoadScale },
498 { "rsMatrixLoadTranslate", (void *)&SC_matrixLoadTranslate },
499 { "rsMatrixLoadMultiply", (void *)&SC_matrixLoadMultiply },
500 { "rsMatrixMultiply", (void *)&SC_matrixMultiply },
501 { "rsMatrixRotate", (void *)&SC_matrixRotate },
502 { "rsMatrixScale", (void *)&SC_matrixScale },
503 { "rsMatrixTranslate", (void *)&SC_matrixTranslate },
504
Jason Samsc61346b2010-05-28 18:23:22 -0700505 { "_Z9rsForEachii", (void *)&SC_ForEachii },
506 { "_Z9rsForEachiii", (void *)&SC_ForEachiii },
507 { "_Z9rsForEachiiii", (void *)&SC_ForEachiiii },
508 { "_Z9rsForEachiiiii", (void *)&SC_ForEachiiiii },
509 { "_Z9rsForEachiiiiii", (void *)&SC_ForEachiiiiii },
510 { "_Z9rsForEachiiiiiii", (void *)&SC_ForEachiiiiiii },
Jason Sams22fa3712010-05-19 17:22:57 -0700511
512////////////////////////////////////////////////////////////////////
513
Jason Samsbe36bf32010-05-11 14:03:58 -0700514 //{ "sinf_fast", (void *)&SC_sinf_fast },
515 //{ "cosf_fast", (void *)&SC_cosf_fast },
Jason Samse45ac6e2009-07-20 14:31:06 -0700516
Jason Samsbe36bf32010-05-11 14:03:58 -0700517 { "scriptCall", (void *)&SC_scriptCall },
Jason Samsce92d4b2010-05-17 14:55:34 -0700518
Jason Samsc9d43db2009-07-28 12:02:16 -0700519
Jason Samsbe36bf32010-05-11 14:03:58 -0700520 { NULL, NULL }
Jason Samse45ac6e2009-07-20 14:31:06 -0700521};
522
523const ScriptCState::SymbolTable_t * ScriptCState::lookupSymbol(const char *sym)
524{
525 ScriptCState::SymbolTable_t *syms = gSyms;
526
527 while (syms->mPtr) {
528 if (!strcmp(syms->mName, sym)) {
529 return syms;
530 }
531 syms++;
532 }
533 return NULL;
534}
535