blob: ccdde008f089c9bc678eaa655a01cf18aaccc4d8 [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 Samsef5867a2010-07-28 11:17:53 -0700182static int64_t SC_uptimeMillis()
Jason Sams22fa3712010-05-19 17:22:57 -0700183{
184 return nanoseconds_to_milliseconds(systemTime(SYSTEM_TIME_MONOTONIC));
185}
186
Jason Samsef5867a2010-07-28 11:17:53 -0700187static int64_t SC_startTimeMillis()
Jason Sams22fa3712010-05-19 17:22:57 -0700188{
189 GET_TLS();
190 return sc->mEnviroment.mStartTimeMillis;
191}
192
Jason Samsef5867a2010-07-28 11:17:53 -0700193static int64_t SC_elapsedTimeMillis()
Jason Sams22fa3712010-05-19 17:22:57 -0700194{
195 GET_TLS();
196 return nanoseconds_to_milliseconds(systemTime(SYSTEM_TIME_MONOTONIC))
197 - sc->mEnviroment.mStartTimeMillis;
198}
199
Jason Samsef5867a2010-07-28 11:17:53 -0700200static float SC_getDt()
Joe Onorato9c4e4ca2009-08-09 11:39:02 -0700201{
202 GET_TLS();
Jason Samsef5867a2010-07-28 11:17:53 -0700203 int64_t l = sc->mEnviroment.mLastDtTime;
204 sc->mEnviroment.mLastDtTime = systemTime(SYSTEM_TIME_MONOTONIC);
205 return ((float)(sc->mEnviroment.mLastDtTime - l)) / 1.0e9;
Jason Samse45ac6e2009-07-20 14:31:06 -0700206}
207
208
Jason Samse45ac6e2009-07-20 14:31:06 -0700209//////////////////////////////////////////////////////////////////////////////
210//
211//////////////////////////////////////////////////////////////////////////////
212
Jason Samsbe36bf32010-05-11 14:03:58 -0700213static uint32_t SC_allocGetDimX(RsAllocation va)
214{
215 GET_TLS();
216 const Allocation *a = static_cast<const Allocation *>(va);
217 //LOGE("SC_allocGetDimX a=%p", a);
218 //LOGE(" type=%p", a->getType());
219 return a->getType()->getDimX();
220}
221
222static uint32_t SC_allocGetDimY(RsAllocation va)
223{
224 GET_TLS();
225 const Allocation *a = static_cast<const Allocation *>(va);
226 return a->getType()->getDimY();
227}
228
229static uint32_t SC_allocGetDimZ(RsAllocation va)
230{
231 GET_TLS();
232 const Allocation *a = static_cast<const Allocation *>(va);
233 return a->getType()->getDimZ();
234}
235
236static uint32_t SC_allocGetDimLOD(RsAllocation va)
237{
238 GET_TLS();
239 const Allocation *a = static_cast<const Allocation *>(va);
240 return a->getType()->getDimLOD();
241}
242
243static uint32_t SC_allocGetDimFaces(RsAllocation va)
244{
245 GET_TLS();
246 const Allocation *a = static_cast<const Allocation *>(va);
247 return a->getType()->getDimFaces();
248}
249
Jason Sams7bf29dd2010-07-19 15:38:19 -0700250const void * SC_getElementAtX(RsAllocation va, uint32_t x)
251{
252 const Allocation *a = static_cast<const Allocation *>(va);
253 const Type *t = a->getType();
254 const uint8_t *p = (const uint8_t *)a->getPtr();
255 return &p[t->getElementSizeBytes() * x];
256}
257
258const void * SC_getElementAtXY(RsAllocation va, uint32_t x, uint32_t y)
259{
260 const Allocation *a = static_cast<const Allocation *>(va);
261 const Type *t = a->getType();
262 const uint8_t *p = (const uint8_t *)a->getPtr();
263 return &p[t->getElementSizeBytes() * (x + y*t->getDimX())];
264}
265
266const void * SC_getElementAtXYZ(RsAllocation va, uint32_t x, uint32_t y, uint32_t z)
267{
268 const Allocation *a = static_cast<const Allocation *>(va);
269 const Type *t = a->getType();
270 const uint8_t *p = (const uint8_t *)a->getPtr();
271 return &p[t->getElementSizeBytes() * (x + y*t->getDimX())];
272}
Jason Samsbe36bf32010-05-11 14:03:58 -0700273
Jason Samse45ac6e2009-07-20 14:31:06 -0700274
Jason Sams22fa3712010-05-19 17:22:57 -0700275static void SC_debugF(const char *s, float f) {
276 LOGE("%s %f, 0x%08x", s, f, *((int *) (&f)));
Jason Samsc9d43db2009-07-28 12:02:16 -0700277}
Jason Sams22fa3712010-05-19 17:22:57 -0700278static void SC_debugFv2(const char *s, rsvF_2 fv) {
279 float *f = (float *)&fv;
280 LOGE("%s {%f, %f}", s, f[0], f[1]);
Romain Guy370ed152009-08-20 17:08:33 -0700281}
Jason Sams22fa3712010-05-19 17:22:57 -0700282static void SC_debugFv3(const char *s, rsvF_4 fv) {
283 float *f = (float *)&fv;
284 LOGE("%s {%f, %f, %f}", s, f[0], f[1], f[2]);
Jason Samsc9d43db2009-07-28 12:02:16 -0700285}
Jason Sams22fa3712010-05-19 17:22:57 -0700286static void SC_debugFv4(const char *s, rsvF_4 fv) {
287 float *f = (float *)&fv;
288 LOGE("%s {%f, %f, %f, %f}", s, f[0], f[1], f[2], f[3]);
289}
290static void SC_debugI32(const char *s, int32_t i) {
291 LOGE("%s %i 0x%x", s, i, i);
Romain Guy370ed152009-08-20 17:08:33 -0700292}
Jason Samsef5867a2010-07-28 11:17:53 -0700293static void SC_debugU32(const char *s, uint32_t i) {
294 LOGE("%s %i 0x%x", s, i, i);
295}
Romain Guy370ed152009-08-20 17:08:33 -0700296
Jason Sams7bf29dd2010-07-19 15:38:19 -0700297static void SC_debugP(const char *s, const void *p) {
298 LOGE("%s %p", s, p);
299}
300
Jason Samsef5867a2010-07-28 11:17:53 -0700301static uint32_t SC_toClient2(int cmdID, void *data, int len)
Jason Sams8c401ef2009-10-06 13:58:47 -0700302{
303 GET_TLS();
Jason Samsef5867a2010-07-28 11:17:53 -0700304 //LOGE("SC_toClient %i %i %i", cmdID, len);
305 return rsc->sendMessageToClient(data, cmdID, len, false);
Jason Sams8c401ef2009-10-06 13:58:47 -0700306}
307
Jason Samsef5867a2010-07-28 11:17:53 -0700308static uint32_t SC_toClient(int cmdID)
Jason Sams3a27c952009-10-07 18:14:01 -0700309{
310 GET_TLS();
Jason Samsef5867a2010-07-28 11:17:53 -0700311 //LOGE("SC_toClient %i", cmdID);
312 return rsc->sendMessageToClient(NULL, cmdID, 0, false);
313}
314
315static uint32_t SC_toClientBlocking2(int cmdID, void *data, int len)
316{
317 GET_TLS();
318 //LOGE("SC_toClientBlocking %i %i", cmdID, len);
319 return rsc->sendMessageToClient(data, cmdID, len, true);
320}
321
322static uint32_t SC_toClientBlocking(int cmdID)
323{
324 GET_TLS();
325 //LOGE("SC_toClientBlocking %i", cmdID);
326 return rsc->sendMessageToClient(NULL, cmdID, 0, true);
Jason Sams3a27c952009-10-07 18:14:01 -0700327}
328
Jason Samsbe36bf32010-05-11 14:03:58 -0700329int SC_divsi3(int a, int b)
330{
331 return a / b;
332}
Jason Sams3a27c952009-10-07 18:14:01 -0700333
Jason Samsce92d4b2010-05-17 14:55:34 -0700334int SC_getAllocation(const void *ptr)
335{
336 GET_TLS();
337 const Allocation *alloc = sc->ptrToAllocation(ptr);
338 return (int)alloc;
339}
340
341
Jason Samsace3e012010-07-15 17:11:13 -0700342void SC_ForEach(RsScript vs,
343 RsAllocation vin,
344 RsAllocation vout,
345 const void *usr)
Jason Samsc61346b2010-05-28 18:23:22 -0700346{
347 GET_TLS();
Jason Samsace3e012010-07-15 17:11:13 -0700348 const Allocation *ain = static_cast<const Allocation *>(vin);
Jason Samsc61346b2010-05-28 18:23:22 -0700349 Allocation *aout = static_cast<Allocation *>(vout);
Jason Samsace3e012010-07-15 17:11:13 -0700350 Script *s = static_cast<Script *>(vs);
351 s->runForEach(rsc, ain, aout, usr);
Jason Samsc61346b2010-05-28 18:23:22 -0700352}
353
Jason Samsace3e012010-07-15 17:11:13 -0700354void SC_ForEach2(RsScript vs,
355 RsAllocation vin,
356 RsAllocation vout,
357 const void *usr,
358 const RsScriptCall *call)
Jason Samsc61346b2010-05-28 18:23:22 -0700359{
360 GET_TLS();
Jason Samsace3e012010-07-15 17:11:13 -0700361 const Allocation *ain = static_cast<const Allocation *>(vin);
Jason Samsc61346b2010-05-28 18:23:22 -0700362 Allocation *aout = static_cast<Allocation *>(vout);
Jason Samsc61346b2010-05-28 18:23:22 -0700363 Script *s = static_cast<Script *>(vs);
Jason Samsace3e012010-07-15 17:11:13 -0700364 s->runForEach(rsc, ain, aout, usr, call);
Jason Samsc61346b2010-05-28 18:23:22 -0700365}
366
Jason Samse45ac6e2009-07-20 14:31:06 -0700367//////////////////////////////////////////////////////////////////////////////
368// Class implementation
369//////////////////////////////////////////////////////////////////////////////
370
Jason Samsbe36bf32010-05-11 14:03:58 -0700371// llvm name mangling ref
372// <builtin-type> ::= v # void
373// ::= b # bool
374// ::= c # char
375// ::= a # signed char
376// ::= h # unsigned char
377// ::= s # short
378// ::= t # unsigned short
379// ::= i # int
380// ::= j # unsigned int
381// ::= l # long
382// ::= m # unsigned long
383// ::= x # long long, __int64
384// ::= y # unsigned long long, __int64
385// ::= f # float
386// ::= d # double
Jason Samse45ac6e2009-07-20 14:31:06 -0700387
Jason Samsaeb094b2010-05-18 13:35:45 -0700388static ScriptCState::SymbolTable_t gSyms[] = {
Jason Samsbe36bf32010-05-11 14:03:58 -0700389 { "__divsi3", (void *)&SC_divsi3 },
390
Jason Sams22fa3712010-05-19 17:22:57 -0700391 // allocation
Jason Samsef5867a2010-07-28 11:17:53 -0700392 { "_Z19rsAllocationGetDimX13rs_allocation", (void *)&SC_allocGetDimX },
393 { "_Z19rsAllocationGetDimY13rs_allocation", (void *)&SC_allocGetDimY },
394 { "_Z19rsAllocationGetDimZ13rs_allocation", (void *)&SC_allocGetDimZ },
395 { "_Z21rsAllocationGetDimLOD13rs_allocation", (void *)&SC_allocGetDimLOD },
396 { "_Z23rsAllocationGetDimFaces13rs_allocation", (void *)&SC_allocGetDimFaces },
397 { "_Z15rsGetAllocationPKv", (void *)&SC_getAllocation },
Jason Sams22fa3712010-05-19 17:22:57 -0700398
Jason Sams7bf29dd2010-07-19 15:38:19 -0700399 { "_Z14rsGetElementAt13rs_allocationj", (void *)&SC_getElementAtX },
400 { "_Z14rsGetElementAt13rs_allocationjj", (void *)&SC_getElementAtXY },
401 { "_Z14rsGetElementAt13rs_allocationjjj", (void *)&SC_getElementAtXYZ },
402
403
Jason Sams22fa3712010-05-19 17:22:57 -0700404 // Debug
405 { "_Z7rsDebugPKcf", (void *)&SC_debugF },
406 { "_Z7rsDebugPKcDv2_f", (void *)&SC_debugFv2 },
407 { "_Z7rsDebugPKcDv3_f", (void *)&SC_debugFv3 },
408 { "_Z7rsDebugPKcDv4_f", (void *)&SC_debugFv4 },
409 { "_Z7rsDebugPKci", (void *)&SC_debugI32 },
Jason Samsef5867a2010-07-28 11:17:53 -0700410 { "_Z7rsDebugPKcj", (void *)&SC_debugU32 },
Jason Sams7bf29dd2010-07-19 15:38:19 -0700411 { "_Z7rsDebugPKcPKv", (void *)&SC_debugP },
Jason Sams22fa3712010-05-19 17:22:57 -0700412 //extern void __attribute__((overloadable))rsDebug(const char *, const void *);
413
414
415 // RS Math
416 { "_Z6rsRandi", (void *)&SC_randi },
417 { "_Z6rsRandii", (void *)&SC_randi2 },
418 { "_Z6rsRandf", (void *)&SC_randf },
419 { "_Z6rsRandff", (void *)&SC_randf2 },
420 { "_Z6rsFracf", (void *)&SC_frac },
421
422 // time
Jason Samsef5867a2010-07-28 11:17:53 -0700423 { "_Z8rsSecond", (void *)&SC_second },
424 { "_Z8rsMinute", (void *)&SC_minute },
425 { "_Z6rsHour", (void *)&SC_hour },
426 { "_Z5rsDay", (void *)&SC_day },
427 { "_Z7rsMonth", (void *)&SC_month },
428 { "_Z6rsYear", (void *)&SC_year },
429 { "_Z14rsUptimeMillis", (void*)&SC_uptimeMillis },
430 { "_Z17rsStartTimeMillis", (void*)&SC_startTimeMillis },
431 { "_Z19rsElapsedTimeMillis", (void*)&SC_elapsedTimeMillis },
432 { "_Z7rsGetDt", (void*)&SC_getDt },
433
Jason Sams22fa3712010-05-19 17:22:57 -0700434 { "rsSecond", (void *)&SC_second },
435 { "rsMinute", (void *)&SC_minute },
436 { "rsHour", (void *)&SC_hour },
437 { "rsDay", (void *)&SC_day },
438 { "rsMonth", (void *)&SC_month },
439 { "rsYear", (void *)&SC_year },
Jason Samsef5867a2010-07-28 11:17:53 -0700440 { "rsUptimeMillis", (void*)&SC_uptimeMillis },
441 { "rsStartTimeMillis", (void*)&SC_startTimeMillis },
442 { "rsElapsedTimeMillis", (void*)&SC_elapsedTimeMillis },
443 { "rsGetDt", (void*)&SC_getDt },
Jason Sams22fa3712010-05-19 17:22:57 -0700444
Jason Samsef5867a2010-07-28 11:17:53 -0700445 { "_Z14rsSendToClienti", (void *)&SC_toClient },
446 { "_Z14rsSendToClientiPKvj", (void *)&SC_toClient2 },
447 { "_Z22rsSendToClientBlockingi", (void *)&SC_toClientBlocking },
448 { "_Z22rsSendToClientBlockingiPKvj", (void *)&SC_toClientBlocking2 },
Jason Sams22fa3712010-05-19 17:22:57 -0700449
Jason Samsace3e012010-07-15 17:11:13 -0700450 { "_Z9rsForEach9rs_script13rs_allocationS0_PKv", (void *)&SC_ForEach },
451 //{ "_Z9rsForEach9rs_script13rs_allocationS0_PKv", (void *)&SC_ForEach2 },
Jason Sams22fa3712010-05-19 17:22:57 -0700452
453////////////////////////////////////////////////////////////////////
454
Jason Samsbe36bf32010-05-11 14:03:58 -0700455 //{ "sinf_fast", (void *)&SC_sinf_fast },
456 //{ "cosf_fast", (void *)&SC_cosf_fast },
Jason Samse45ac6e2009-07-20 14:31:06 -0700457
Jason Samsbe36bf32010-05-11 14:03:58 -0700458 { NULL, NULL }
Jason Samse45ac6e2009-07-20 14:31:06 -0700459};
460
461const ScriptCState::SymbolTable_t * ScriptCState::lookupSymbol(const char *sym)
462{
463 ScriptCState::SymbolTable_t *syms = gSyms;
464
465 while (syms->mPtr) {
466 if (!strcmp(syms->mName, sym)) {
467 return syms;
468 }
469 syms++;
470 }
471 return NULL;
472}
473