30#ifdef OO_DEBUG_MONITOR_ENABLED
39#import "OOJSEngineTimeManagement.h"
41#import "OOJSSpecialFunctions.h"
50@interface OODebugMonitor (Private) <OOJavaScriptEngineMonitor>
52- (void)setUpDebugConsoleScript;
53- (void)javaScriptEngineWillReset:(NSNotification*)notification;
55- (void)disconnectDebuggerWithMessage:(NSString*)message;
57- (NSDictionary*)mergedConfiguration;
63- (NSMutableDictionary*)normalizeConfigDictionary:(NSDictionary*)dictionary;
64- (id)normalizeConfigValue:(
id)value forKey:(NSString*)key;
66- (NSArray*)loadSourceFile:(NSString*)filePath;
70@implementation OODebugMonitor
72NSString* NSApplicationWillTerminateNotification =
@"ApplicationWillTerminate";
77 NSUserDefaults* defaults =
nil;
78 NSMutableDictionary* config =
nil;
84 andMerge:YES] mutableCopy] autorelease];
85 _configFromOXPs = [[
self normalizeConfigDictionary:config] copy];
87 defaults = [NSUserDefaults standardUserDefaults];
88 config = [
self normalizeConfigDictionary:[defaults dictionaryForKey:@"debug-settings-override"]];
90 config = [NSMutableDictionary dictionary];
91 _configOverrides = [config retain];
93 _TCPIgnoresDroppedPackets = NO;
96#if OOJSENGINE_MONITOR_SUPPORT
97 [jsEng setMonitor:
self];
100 [
self setUpDebugConsoleScript];
102 [[NSNotificationCenter defaultCenter] addObserver:
self
103 selector:@selector(applicationWillTerminate:)
104 name:NSApplicationWillTerminateNotification
107 [[NSNotificationCenter defaultCenter] addObserver:
self
108 selector:@selector(javaScriptEngineWillReset:)
109 name:kOOJavaScriptEngineWillResetNotification
112 [[NSNotificationCenter defaultCenter] addObserver:
self
113 selector:@selector(setUpDebugConsoleScript)
114 name:kOOJavaScriptEngineDidResetNotification
123 [
self disconnectDebuggerWithMessage:@"Debug controller object destroyed while debugging in progress."];
125 [_configFromOXPs release];
126 [_configOverrides release];
130 [_sourceFiles release];
133 if (JS_IsObject(_jsSelf)) {
135 _jsSelf = JS_UNDEFINED;
138 if (_jsSelf != NULL) {
146+ (OODebugMonitor*)sharedDebugMonitor
156- (BOOL)setDebugger:(
id<OODebuggerInterface>)newDebugger
158 NSString* error =
nil;
160 if (newDebugger != _debugger) {
162 if (newDebugger !=
nil) {
163 [
self disconnectDebuggerWithMessage:@"New debugger set."];
165 [
self disconnectDebuggerWithMessage:@"Debugger disconnected programatically."];
169 if (newDebugger !=
nil) {
171 if ([newDebugger connectDebugMonitor:
self errorMessage:&error]) {
172 [newDebugger debugMonitor:
self
173 noteConfiguration:[
self mergedConfiguration]];
174 _debugger = [newDebugger retain];
176 OOLog(
@"debugMonitor.setDebugger.failed",
@"Could not connect to debugger %@, because an error occurred: %@", newDebugger, error);
179 @catch (NSException* exception) {
180 OOLog(
@"debugMonitor.setDebugger.failed",
@"Could not connect to debugger %@, because an exception occurred: %@ -- %@", newDebugger, [exception name], [exception reason]);
185 return _debugger == newDebugger;
188- (oneway void)performJSConsoleCommand:(in NSString*)command
193 [_script callMethod:OOJSID("consolePerformJSCommand") inContext:context withArguments:&commandVal count:1 result:NULL];
199- (void)appendJSConsoleLine:(
id)string
200 colorKey:(NSString*)colorKey
201 emphasisRange:(NSRange)emphasisRange
207 [_debugger debugMonitor:
self
208 jsConsoleOutput:string
210 emphasisRange:emphasisRange];
212 @catch (NSException* exception) {
213 OOLog(
@"debugMonitor.debuggerConnection.exception",
@"Exception while attempting to send JavaScript console text to debugger: %@ -- %@", [exception name], [exception reason]);
218- (void)appendJSConsoleLine:(
id)string
219 colorKey:(NSString*)colorKey
221 [
self appendJSConsoleLine:string
223 emphasisRange:NSMakeRange(0, 0)];
226- (void)clearJSConsole
230 [_debugger debugMonitorClearConsole:
self];
232 @catch (NSException* exception) {
233 OOLog(
@"debugMonitor.debuggerConnection.exception",
@"Exception while attempting to clear JavaScript console: %@ -- %@", [exception name], [exception reason]);
242 [_debugger debugMonitorShowConsole:
self];
244 @catch (NSException* exception) {
245 OOLog(
@"debugMonitor.debuggerConnection.exception",
@"Exception while attempting to show JavaScript console: %@ -- %@", [exception name], [exception reason]);
250- (id)configurationValueForKey:(in NSString*)key
252 return [
self configurationValueForKey:key class:Nil defaultValue:nil];
255- (id)configurationValueForKey:(NSString*)key class:(Class)class defaultValue:(
id)value
260 class = [NSObject class];
262 result = [_configOverrides objectForKey:key];
263 if (![result isKindOfClass:
class] && result != [NSNull
null])
264 result = [_configFromOXPs objectForKey:key];
265 if (![result isKindOfClass:
class] && result != [NSNull
null])
266 result = [[value retain] autorelease];
267 if (result == [NSNull
null])
273- (
long long)configurationIntValueForKey:(NSString*)key defaultValue:(
long long)value
278 object = [
self configurationValueForKey:key];
279 if ([
object respondsToSelector:
@selector(longLongValue)])
280 result = [object longLongValue];
281 else if ([
object respondsToSelector:
@selector(intValue)])
282 result = [object intValue];
289- (void)setConfigurationValue:(in
id)value forKey:(in NSString*)key
294 value = [
self normalizeConfigValue:value forKey:key];
297 [_configOverrides removeObjectForKey:key];
299 if (_configOverrides ==
nil)
300 _configOverrides = [[NSMutableDictionary alloc] init];
301 [_configOverrides setObject:value forKey:key];
307 value = [
self configurationValueForKey:key];
310 [_debugger debugMonitor:
self
311 noteChangedConfigrationValue:value
314 @catch (NSException* exception) {
315 OOLog(
@"debugMonitor.debuggerConnection.exception",
@"Exception while attempting to send configuration update to debugger: %@ -- %@", [exception name], [exception reason]);
319- (NSArray*)configurationKeys
321 NSMutableSet* result =
nil;
323 result = [NSMutableSet setWithCapacity:[_configFromOXPs count] + [_configOverrides count]];
324 [result addObjectsFromArray:[_configFromOXPs allKeys]];
325 [result addObjectsFromArray:[_configOverrides allKeys]];
327 return [[result allObjects] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
330- (BOOL)debuggerConnected
332 return _debugger !=
nil;
335- (void)writeMemStat:(NSString*)format, ...
338 va_start(args, format);
339 NSString* message = [[NSString alloc] initWithFormat:format arguments:args];
342 OOLog(
@"debug.memStats",
@"%@", message);
343 [
self appendJSConsoleLine:message colorKey:@"command-result"];
348static NSString* SizeString(
size_t size)
355 NSString* suffix =
@"";
357 if (
size < kThreshold << 10) {
358 return [NSString stringWithFormat:@"%zu bytes", size];
360 if (
size < kThreshold << 20) {
363 }
else if (
size < ((
size_t)kThreshold << 30)) {
372 float sizef = (float)
size / unit;
373 sizef = round(sizef * 100.0f) / 100.f;
375 return [NSString stringWithFormat:@"%.2f %@", sizef, suffix];
380 NSMutableSet* entityTextures;
381 NSMutableSet* visibleEntityTextures;
382 NSMutableSet* seenEntities;
384 size_t totalEntityObjSize;
385 size_t totalDrawableSize;
388- (void)dumpEntity:(
id)entity withState:(EntityDumpState*)state parentVisible:(BOOL)parentVisible
390 if ([state->seenEntities containsObject:entity] || entity ==
nil)
392 [state->seenEntities addObject:entity];
396 size_t entitySize = [entity oo_objectSize];
397 size_t drawableSize = 0;
398 if ([entity isKindOfClass:[OOEntityWithDrawable
class]]) {
399 OODrawable* drawable = [entity drawable];
400 drawableSize = [drawable totalSize];
403 BOOL visible = parentVisible && [entity isVisible];
405 NSSet* textures = [entity allTextures];
406 if (textures !=
nil) {
407 [state->entityTextures unionSet:textures];
409 [state->visibleEntityTextures unionSet:textures];
412 NSString* extra =
@"";
414 extra = [extra stringByAppendingString:@", visible"];
417 if (drawableSize != 0) {
418 extra = [extra stringByAppendingFormat:@", drawable: %@", SizeString(drawableSize)];
421 [
self writeMemStat:@"%@: %@%@", [entity shortDescription], SizeString(entitySize), extra];
423 state->totalEntityObjSize += entitySize;
424 state->totalDrawableSize += drawableSize;
427 if ([entity isShip]) {
429 foreach (subentity, [entity subEntityEnumerator]) {
430 [
self dumpEntity:subentity withState:state parentVisible:visible];
433 if ([entity isPlayer]) {
434 NSUInteger i,
count = [entity dialMaxMissiles];
435 for (i = 0; i <
count; i++) {
436 subentity = [entity missileForPylon:i];
437 if (subentity !=
nil)
438 [
self dumpEntity:subentity withState:state parentVisible:NO];
442 if ([entity isPlanet]) {
447 if (atmosphere !=
nil) {
448 [
self dumpEntity:atmosphere withState:state parentVisible:visible];
452 if ([entity isWormhole]) {
453 NSDictionary* shipInfo =
nil;
454 foreach (shipInfo, [entity shipsInTransit]) {
455 ShipEntity* ship = [shipInfo objectForKey:@"ship"];
456 [
self dumpEntity:ship withState:state parentVisible:NO];
462- (void)dumpMemoryStatistics
464 OOLog(
@"debug.memStats",
@"%@",
@"Memory statistics:");
468 NSSet* allTextures = [
OOTexture allTextures];
469 NSMutableDictionary* textureRefCounts = [NSMutableDictionary dictionaryWithCapacity:[allTextures count]];
471 OOTexture* tex =
nil;
472 foreach (tex, allTextures) {
474 [textureRefCounts setObject:[NSNumber numberWithUnsignedInteger:[tex retainCount] - 1] forKey:[NSValue valueWithNonretainedObject:tex]];
477 size_t totalSize = 0;
479 [
self writeMemStat:@"Entitites:"];
482 NSArray* entities = [UNIVERSE entityList];
483 EntityDumpState entityDumpState = {
484 .entityTextures = [NSMutableSet set],
485 .visibleEntityTextures = [NSMutableSet set],
486 .seenEntities = [NSMutableSet set]
490 foreach (entity, entities) {
491 [
self dumpEntity:entity withState:&entityDumpState parentVisible:YES];
493 foreach (entity, [
PLAYER scannedWormholes]) {
494 [
self dumpEntity:entity withState:&entityDumpState parentVisible:YES];
498 [
self writeMemStat:@"Total entity size (excluding %u entities not accounted for): %@ (%@ entity objects, %@ drawables)",
499 gLiveEntityCount - entityDumpState.seenCount,
500 SizeString(entityDumpState.totalEntityObjSize + entityDumpState.totalDrawableSize),
501 SizeString(entityDumpState.totalEntityObjSize),
502 SizeString(entityDumpState.totalDrawableSize)];
503 totalSize += entityDumpState.totalEntityObjSize + entityDumpState.totalDrawableSize;
508 NSMutableArray* textures = [[[
OOTexture cachedTexturesByAge] mutableCopy] autorelease];
510 foreach (tex, allTextures) {
511 if ([textures indexOfObject:tex] == NSNotFound) {
512 [textures addObject:tex];
516 size_t totalTextureObjSize = 0;
517 size_t totalTextureDataSize = 0;
518 size_t visibleTextureDataSize = 0;
520 [
self writeMemStat:@"Textures:"];
523 foreach (tex, textures) {
524 size_t objSize = [tex oo_objectSize];
525 size_t dataSize = [tex dataSize];
527#if OOTEXTURE_RELOADABLE
528 NSString* byteCountSuffix =
@"";
530 NSString* byteCountSuffix =
@" (* 2)";
533 NSString* usage =
@"";
534 if ([entityDumpState.visibleEntityTextures containsObject:tex]) {
535 visibleTextureDataSize += dataSize;
536 usage =
@", visible";
537 }
else if ([entityDumpState.entityTextures containsObject:tex]) {
541 unsigned refCount = [textureRefCounts oo_unsignedIntForKey:[NSValue valueWithNonretainedObject:tex]];
543 [
self writeMemStat:@"%@: [%u refs%@] %@%@",
547 SizeString(objSize + dataSize),
550 totalTextureDataSize += dataSize;
551 totalTextureObjSize += objSize;
553 totalSize += totalTextureObjSize + totalTextureDataSize;
557#if !OOTEXTURE_RELOADABLE
558 totalTextureDataSize *= 2;
560 [
self writeMemStat:@"Total texture size: %@ (%@ object overhead, %@ data, %@ visible texture data)",
561 SizeString(totalTextureObjSize + totalTextureDataSize),
562 SizeString(totalTextureObjSize),
563 SizeString(totalTextureDataSize),
564 SizeString(visibleTextureDataSize)];
566 totalSize += [
self dumpJSMemoryStatistics];
568 [
self writeMemStat:@"Total: %@", SizeString(totalSize)];
573- (size_t)dumpJSMemoryStatistics
577 JSRuntime* runtime = JS_GetRuntime(context);
583 JS_ComputeMemoryUsage(runtime, &usage);
584 size_t jsSize = (size_t)usage.malloc_size;
585 size_t jsGCThreshold = JS_GetGCThreshold(runtime);
589 [
self writeMemStat:@"JavaScript heap: %@ (%lli objects, next collection at %@)", SizeString(jsSize), (long long)usage.obj_count, SizeString(jsGCThreshold)];
591 size_t jsSize = JS_GetGCParameter(runtime, JSGC_BYTES);
592 size_t jsMax = JS_GetGCParameter(runtime, JSGC_MAX_BYTES);
593 uint32_t jsGCCount = JS_GetGCParameter(runtime, JSGC_NUMBER);
597 [
self writeMemStat:@"JavaScript heap: %@ (limit %@, %u collections to date)", SizeString(jsSize), SizeString(jsMax), jsGCCount];
602- (void)setTCPIgnoresDroppedPackets:(BOOL)flag
604 if (_TCPIgnoresDroppedPackets != flag) {
605 OOLog(
@"debugMonitor.TCPSettings",
@"The TCP console will %@ TCP packets.",
606 (flag ?
@"try to stay connected, ignoring dropped" :
@"disconnect if an error affects"));
608 _TCPIgnoresDroppedPackets = flag;
611- (BOOL)TCPIgnoresDroppedPackets
613 return _TCPIgnoresDroppedPackets;
616- (void)setUsingPlugInController:(BOOL)flag
618 _usingPlugInController = flag;
621- (BOOL)usingPlugInController
623 return _usingPlugInController;
626- (NSString*)sourceCodeForFile:(in NSString*)filePath line:(in
unsigned)line
628 id linesForFile =
nil;
630 linesForFile = [_sourceFiles objectForKey:filePath];
632 if (linesForFile ==
nil) {
633 linesForFile = [
self loadSourceFile:filePath];
634 if (linesForFile ==
nil)
635 linesForFile = [NSArray arrayWithObject:[NSString stringWithFormat:@"<Can't load file %@>", filePath]];
637 if (_sourceFiles ==
nil)
638 _sourceFiles = [[NSMutableDictionary alloc] init];
639 [_sourceFiles setObject:linesForFile forKey:filePath];
642 if ([linesForFile
count] < line || line == 0)
643 return @"<line out of range!>";
645 return [linesForFile objectAtIndex:line - 1];
648- (void)disconnectDebugger:(in
id<OODebuggerInterface>)debugger
649 message:(in NSString*)message
654 if (debugger == _debugger) {
655 [
self disconnectDebuggerWithMessage:message];
657 OOLog(
@"debugMonitor.disconnect.ignored",
@"Attempt to disconnect debugger %@, which is not current debugger; ignoring.", debugger);
662- (void)applicationWillTerminate
664 [[NSNotificationCenter defaultCenter] postNotificationName:NSApplicationWillTerminateNotification object:nil];
668- (void)applicationWillTerminate:(NSNotification*)notification
670 if (_configOverrides !=
nil) {
671 [[NSUserDefaults standardUserDefaults] setObject:_configOverrides forKey:@"debug-settings-override"];
674 [
self disconnectDebuggerWithMessage:@"Oolite is terminating."];
679@implementation OODebugMonitor (Private)
681- (void)setUpDebugConsoleScript
688 static NSString* path =
nil;
697 JS_FreeValue(context, special);
701 NSDictionary* jsProps = [NSDictionary dictionaryWithObjectsAndKeys:
703 specialWrapper, @"special",
709 if (_script ==
nil) {
711 JS_DefinePropertyValueStr(context, [[OOJavaScriptEngine sharedEngine] globalObject],
"debugConsole", [
self oo_jsValueInContext:context], JS_PROP_ENUMERABLE);
714 JS_DefineProperty(context, global,
"debugConsole", [
self oo_jsValueInContext:context], NULL, NULL, JSPROP_ENUMERATE);
721- (void)javaScriptEngineWillReset:(NSNotification*)notification
725 if (JS_IsObject(_jsSelf)) {
728 _jsSelf = JS_UNDEFINED;
736- (void)disconnectDebuggerWithMessage:(NSString*)message
739 [_debugger disconnectDebugMonitor:
self message:message];
741 @catch (NSException* exception) {
742 OOLog(
@"debugMonitor.debuggerConnection.exception",
@"Exception while attempting to disconnect debugger: %@ -- %@", [exception name], [exception reason]);
745 id debugger = _debugger;
750- (NSDictionary*)mergedConfiguration
752 NSMutableDictionary* result =
nil;
754 result = [NSMutableDictionary dictionary];
755 if (_configFromOXPs !=
nil)
756 [result addEntriesFromDictionary:_configFromOXPs];
757 if (_configOverrides !=
nil)
758 [result addEntriesFromDictionary:_configOverrides];
763- (NSArray*)loadSourceFile:(NSString*)filePath
765 NSString* contents =
nil;
766 NSArray* lines =
nil;
771 contents = [NSString stringWithContentsOfUnicodeFile:filePath];
778 lines = [contents componentsSeparatedByString:@"\n"];
782- (NSMutableDictionary*)normalizeConfigDictionary:(NSDictionary*)dictionary
784 NSMutableDictionary* result =
nil;
788 result = [NSMutableDictionary dictionaryWithCapacity:[dictionary count]];
791 value = [dictionary objectForKey:key];
792 value = [
self normalizeConfigValue:value forKey:key];
794 if (key !=
nil && value !=
nil)
795 [result setObject:value forKey:key];
801- (id)normalizeConfigValue:(
id)value forKey:(NSString*)key
803 OOColor* color =
nil;
807 if ([key hasSuffix:
@"-color"] || [key hasSuffix:
@"-colour"]) {
810 }
else if ([key hasPrefix:
@"show-console"]) {
812 value = [NSNumber numberWithBool:boolValue];
820- (oneway void)jsEngine:(in byref OOJavaScriptEngine*)engine
821 context:(in JSContext*)context
822 problemOfSeverity:(in NSString*)severity
823 inFile:(in NSString*)filePath
824 line:(in
unsigned)line
825 stackSkip:(in
unsigned)stackSkip
826 showingLocation:(in BOOL)showLocation
827 withMessage:(in NSString*)message
829 NSString* colorKey =
nil;
830 NSString* prefix =
nil;
831 NSString* sourceLine =
nil;
832 NSString* scriptLine =
nil;
833 NSMutableString* formattedMessage =
nil;
834 NSRange emphasisRange;
835 NSString* showKey =
nil;
836 BOOL isWarning = [severity isEqualToString:@"warning"];
838 if (_debugger ==
nil)
843 colorKey =
@"warning";
846 colorKey =
@"exception";
847 prefix =
@"Exception";
851 emphasisRange = NSMakeRange(0, [prefix length] + 1);
853 formattedMessage = [NSMutableString stringWithFormat:@"%@: %@", prefix, message];
860 scriptLine = [[thisScript weakRefUnderlyingObject] displayName];
861 [thisScript release];
863 if (scriptLine !=
nil) {
864 [formattedMessage appendFormat:@"\n Active script: %@", scriptLine];
867 if (showLocation && stackSkip == 0 && [filePath length] != 0) {
869 [formattedMessage appendFormat:@"\n %@, line %u", [filePath lastPathComponent], line];
872 sourceLine = [
self sourceCodeForFile:filePath line:line];
873 if (sourceLine !=
nil) {
874 [formattedMessage appendFormat:@":\n %@", sourceLine];
878 [
self appendJSConsoleLine:formattedMessage
880 emphasisRange:emphasisRange];
883 showKey =
@"show-console-on-warning";
885 showKey =
@"show-console-on-error";
887 [
self showJSConsole];
891- (oneway void)jsEngine:(in byref OOJavaScriptEngine*)engine
892 context:(in JSContext*)context
893 error:(in JSErrorReport*)errorReport
894 stackSkip:(in
unsigned)stackSkip
895 showingLocation:(in BOOL)showLocation
896 withMessage:(in NSString*)message
898 NSString* colorKey =
nil;
899 NSString* prefix =
nil;
900 NSString* filePath =
nil;
901 NSString* sourceLine =
nil;
902 NSString* scriptLine =
nil;
903 NSMutableString* formattedMessage =
nil;
904 NSRange emphasisRange;
905 NSString* showKey =
nil;
907 if (_debugger ==
nil)
910 if (errorReport->flags & JSREPORT_WARNING) {
911 colorKey =
@"warning";
913 }
else if (errorReport->flags & JSREPORT_EXCEPTION) {
914 colorKey =
@"exception";
915 prefix =
@"Exception";
921 if (errorReport->flags & JSREPORT_STRICT) {
922 prefix = [prefix stringByAppendingString:@" (strict mode)"];
926 emphasisRange = NSMakeRange(0, [prefix length] + 1);
928 formattedMessage = [NSMutableString stringWithFormat:@"%@: %@", prefix, message];
935 scriptLine = [[thisScript weakRefUnderlyingObject] displayName];
936 [thisScript release];
938 if (scriptLine !=
nil) {
939 [formattedMessage appendFormat:@"\n Active script: %@", scriptLine];
942 if (showLocation && stackSkip == 0) {
944 if (errorReport->filename != NULL)
945 filePath = [NSString stringWithUTF8String:errorReport->filename];
946 if ([filePath length] != 0) {
947 [formattedMessage appendFormat:@"\n %@, line %u", [filePath lastPathComponent], errorReport -> lineno];
950 sourceLine = [
self sourceCodeForFile:filePath line:errorReport->lineno];
951 if (sourceLine !=
nil) {
952 [formattedMessage appendFormat:@":\n %@", sourceLine];
957 [
self appendJSConsoleLine:formattedMessage
959 emphasisRange:emphasisRange];
961 if (errorReport->flags & JSREPORT_WARNING)
962 showKey =
@"show-console-on-warning";
964 showKey =
@"show-console-on-error";
966 [
self showJSConsole];
972- (oneway void)jsEngine:(in byref OOJavaScriptEngine*)engine
973 context:(in JSContext*)context
974 logMessage:(in NSString*)message
975 ofClass:(in NSString*)messageClass
977 [
self appendJSConsoleLine:message colorKey:@"log"];
979 [
self showJSConsole];
984- (JSValue)oo_jsValueInContext:(JSContext*)context
986 if (!JS_IsObject(_jsSelf)) {
989 return JS_DupValue(context, _jsSelf);
992- (jsval)oo_jsValueInContext:(JSContext*)context
994 if (_jsSelf == NULL) {
996 if (_jsSelf != NULL) {
1003 if (_jsSelf != NULL)
1004 return OBJECT_TO_JSVAL(_jsSelf);
1012@implementation OODebugMonitor (Singleton)
1021+ (id)allocWithZone:(NSZone*)inZone
1030- (id)copyWithZone:(NSZone*)inZone
1040- (NSUInteger)retainCount
#define foreachkey(VAR, DICT)
JSObject * DebugMonitorToJSConsole(JSContext *context, OODebugMonitor *monitor)
void OOJSConsoleDestroy(void)
#define OOJSStopTimeLimiter()
#define kOOJSLongTimeLimit
#define OOJSStartTimeLimiterWithTimeLimit(limit)
OOJSValue * JSSpecialFunctionsObjectWrapper(JSContext *context)
void OOJSPauseTimeLimiter(void)
#define OOJSFreeValue(context, value)
OOINLINE jsval OOJSValueFromNativeObject(JSContext *context, id object)
OOINLINE JSContext * OOJSAcquireContext(void)
#define OOJSAddGCObjectRoot(context, root, name)
OOINLINE void OOJSRelinquishContext(JSContext *context)
void OOJSResumeTimeLimiter(void)
#define OOLog(class, format,...)
static OONullTexture * sSingleton
OOINLINE OOScalar magnitude(Vector vec) INLINE_CONST_FUNC
OOColor * colorWithDescription:(id description)
NSArray * normalizedArray()
id scriptWithPath:properties:(NSString *path,[properties] NSDictionary *properties)
OOJSScript * currentlyRunningScript()
id valueWithJSValue:inContext:(jsval value,[inContext] JSContext *context)
JSObject * globalObject()
OOJavaScriptEngine * sharedEngine()
void removeGCObjectRoot:(JSObject **rootPtr)
NSString * pathForFileNamed:inFolder:(NSString *fileName,[inFolder] NSString *folderName)
NSDictionary * dictionaryFromFilesNamed:inFolder:andMerge:(NSString *fileName,[inFolder] NSString *folderName,[andMerge] BOOL mergeFiles)
typedef long(ZCALLBACK *tell_file_func) OF((voidpf opaque