Oolite 1.91.0.7645-241119-222d325
Loading...
Searching...
No Matches
OOJSConsole.m File Reference
import "OOJSConsole.h"
import "OODebugMonitor.h"
#include <stdint.h>
import "OOJSEngineTimeManagement.h"
import "OOJSScript.h"
import "OOJSVector.h"
import "OOJSEntity.h"
import "OOJSCall.h"
import "OOLoggingExtended.h"
import "OOConstToString.h"
import "OOOpenGLExtensionManager.h"
import "OODebugFlags.h"
import "OOProfilingStopwatch.h"
import "ResourceManager.h"
+ Include dependency graph for OOJSConsole.m:

Go to the source code of this file.

Classes

category  Entity(OODebugInspector)
 

Macros

#define DEBUG_FLAG_DECL(x)
 
#define DEBUG_FLAG_CASE(x)
 
#define LONG_TIME   (1e7)
 

Enumerations

enum  {
  kConsole_debugFlags , kConsole_detailLevel , kConsole_maximumDetailLevel , kConsole_displayFPS ,
  kConsole_platformDescription , kConsole_ignoreDroppedPackets , kConsole_pedanticMode , kConsole_showErrorLocations ,
  kConsole_dumpStackForErrors , kConsole_dumpStackForWarnings , kConsole_glVendorString , kConsole_glRendererString ,
  kConsole_glFixedFunctionTextureUnitCount , kConsole_glFragmentShaderTextureUnitCount , kConsole_DEBUG_LINKED_LISTS , kConsole_DEBUG_COLLISIONS ,
  kConsole_DEBUG_DOCKING , kConsole_DEBUG_OCTREE_LOGGING , kConsole_DEBUG_BOUNDING_BOXES , kConsole_DEBUG_OCTREE_DRAW ,
  kConsole_DEBUG_DRAW_NORMALS , kConsole_DEBUG_NO_DUST , kConsole_DEBUG_NO_SHADER_FALLBACK , kConsole_DEBUG_SHADER_VALIDATION ,
  kConsole_DEBUG_MISC
}
 

Functions

NSString * OOPlatformDescription (void)
 
static JSBool ConsoleGetProperty (JSContext *context, JSObject *this, jsid propID, jsval *value)
 
static JSBool ConsoleSetProperty (JSContext *context, JSObject *this, jsid propID, JSBool strict, jsval *value)
 
static void ConsoleFinalize (JSContext *context, JSObject *this)
 
static JSBool ConsoleConsoleMessage (JSContext *context, uintN argc, jsval *vp)
 
static JSBool ConsoleClearConsole (JSContext *context, uintN argc, jsval *vp)
 
static JSBool ConsoleScriptStack (JSContext *context, uintN argc, jsval *vp)
 
static JSBool ConsoleInspectEntity (JSContext *context, uintN argc, jsval *vp)
 
static JSBool ConsoleIsExecutableJavaScript (JSContext *context, uintN argc, jsval *vp)
 
static JSBool ConsoleDisplayMessagesInClass (JSContext *context, uintN argc, jsval *vp)
 
static JSBool ConsoleSetDisplayMessagesInClass (JSContext *context, uintN argc, jsval *vp)
 
static JSBool ConsoleWriteLogMarker (JSContext *context, uintN argc, jsval *vp)
 
static JSBool ConsoleWriteMemoryStats (JSContext *context, uintN argc, jsval *vp)
 
static JSBool ConsoleWriteJSMemoryStats (JSContext *context, uintN argc, jsval *vp)
 
static JSBool ConsoleGarbageCollect (JSContext *context, uintN argc, jsval *vp)
 
static JSBool ConsoleProfile (JSContext *context, uintN argc, jsval *vp)
 
static JSBool ConsoleGetProfile (JSContext *context, uintN argc, jsval *vp)
 
static JSBool ConsoleTrace (JSContext *context, uintN argc, jsval *vp)
 
static JSBool ConsoleSettingsDeleteProperty (JSContext *context, JSObject *this, jsid propID, jsval *value)
 
static JSBool ConsoleSettingsGetProperty (JSContext *context, JSObject *this, jsid propID, jsval *value)
 
static JSBool ConsoleSettingsSetProperty (JSContext *context, JSObject *this, jsid propID, JSBool strict, jsval *value)
 
static JSBool PerformProfiling (JSContext *context, NSString *nominalFunction, uintN argc, jsval *argv, jsval *rval, BOOL trace, OOTimeProfile **profile)
 
static void InitOOJSConsole (JSContext *context, JSObject *global)
 
void OOJSConsoleDestroy (void)
 
JSObject * DebugMonitorToJSConsole (JSContext *context, OODebugMonitor *monitor)
 
static BOOL DoWeDefineAllDebugFlags (enum OODebugFlags flags) GCC_ATTR((unused))
 

Variables

static JSObject * sConsolePrototype = NULL
 
static JSObject * sConsoleSettingsPrototype = NULL
 
static JSClass sConsoleClass
 
static JSPropertySpec sConsoleProperties []
 
static JSFunctionSpec sConsoleMethods []
 
static JSClass sConsoleSettingsClass
 

Macro Definition Documentation

◆ DEBUG_FLAG_CASE

#define DEBUG_FLAG_CASE ( x)
Value:
case kConsole_##x: *value = INT_TO_JSVAL(x); break;
float x

Referenced by ConsoleGetProperty().

◆ DEBUG_FLAG_DECL

#define DEBUG_FLAG_DECL ( x)
Value:
{ #x, kConsole_##x, OOJS_PROP_READONLY_CB }
#define OOJS_PROP_READONLY_CB

◆ LONG_TIME

#define LONG_TIME   (1e7)

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
kConsole_debugFlags 
kConsole_detailLevel 
kConsole_maximumDetailLevel 
kConsole_displayFPS 
kConsole_platformDescription 
kConsole_ignoreDroppedPackets 
kConsole_pedanticMode 
kConsole_showErrorLocations 
kConsole_dumpStackForErrors 
kConsole_dumpStackForWarnings 
kConsole_glVendorString 
kConsole_glRendererString 
kConsole_glFixedFunctionTextureUnitCount 
kConsole_glFragmentShaderTextureUnitCount 
kConsole_DEBUG_LINKED_LISTS 
kConsole_DEBUG_COLLISIONS 
kConsole_DEBUG_DOCKING 
kConsole_DEBUG_OCTREE_LOGGING 
kConsole_DEBUG_BOUNDING_BOXES 
kConsole_DEBUG_OCTREE_DRAW 
kConsole_DEBUG_DRAW_NORMALS 
kConsole_DEBUG_NO_DUST 
kConsole_DEBUG_NO_SHADER_FALLBACK 
kConsole_DEBUG_SHADER_VALIDATION 
kConsole_DEBUG_MISC 

Definition at line 120 of file OOJSConsole.m.

121{
122 // Property IDs
123 kConsole_debugFlags, // debug flags, integer, read/write
124 kConsole_detailLevel, // graphics detail level, symbolic string, read/write
125 kConsole_maximumDetailLevel, // maximum graphics detail level, symbolic string, read-only
126 kConsole_displayFPS, // display FPS (and related info), boolean, read/write
127 kConsole_platformDescription, // Information about system we're running on in unspecified format, string, read-only
128 kConsole_ignoreDroppedPackets, // boolean (default false), read/write
129 kConsole_pedanticMode, // JS pedantic mode (JS_STRICT flag, not the same as "use strict"), boolean (default true), read/write
130 kConsole_showErrorLocations, // Show error/warning source locations, boolean (default true), read/write
131 kConsole_dumpStackForErrors, // Write stack dump when reporting error/exception, boolean (default false), read/write
132 kConsole_dumpStackForWarnings, // Write stack dump when reporting warning, boolean (default false), read/write
133
134 kConsole_glVendorString, // OpenGL GL_VENDOR string, string, read-only
135 kConsole_glRendererString, // OpenGL GL_RENDERER string, string, read-only
136 kConsole_glFixedFunctionTextureUnitCount, // GL_MAX_TEXTURE_UNITS_ARB, integer, read-only
137 kConsole_glFragmentShaderTextureUnitCount, // GL_MAX_TEXTURE_IMAGE_UNITS_ARB, integer, read-only
138
139 // Symbolic constants for debug flags:
150
152};
@ kConsole_detailLevel
@ kConsole_DEBUG_COLLISIONS
@ kConsole_platformDescription
@ kConsole_DEBUG_DRAW_NORMALS
@ kConsole_DEBUG_OCTREE_LOGGING
@ kConsole_glVendorString
@ kConsole_dumpStackForErrors
@ kConsole_dumpStackForWarnings
@ kConsole_showErrorLocations
@ kConsole_pedanticMode
@ kConsole_displayFPS
@ kConsole_ignoreDroppedPackets
@ kConsole_DEBUG_SHADER_VALIDATION
@ kConsole_DEBUG_NO_DUST
@ kConsole_DEBUG_OCTREE_DRAW
@ kConsole_DEBUG_BOUNDING_BOXES
@ kConsole_DEBUG_NO_SHADER_FALLBACK
@ kConsole_glRendererString
@ kConsole_maximumDetailLevel
@ kConsole_glFixedFunctionTextureUnitCount
@ kConsole_DEBUG_MISC
@ kConsole_glFragmentShaderTextureUnitCount
@ kConsole_DEBUG_DOCKING
@ kConsole_debugFlags
@ kConsole_DEBUG_LINKED_LISTS

Function Documentation

◆ ConsoleClearConsole()

static JSBool ConsoleClearConsole ( JSContext * context,
uintN argc,
jsval * vp )
static

Definition at line 693 of file OOJSConsole.m.

694{
695 OOJS_NATIVE_ENTER(context)
696
697 id monitor = nil;
698
699 monitor = OOJSNativeObjectFromJSObject(context, OOJS_THIS);
700 if (![monitor isKindOfClass:[OODebugMonitor class]])
701 {
702 OOJSReportError(context, @"Expected OODebugMonitor, got %@ in %s. %@", [monitor class], __PRETTY_FUNCTION__, @"This is an internal error, please report it.");
703 return NO;
704 }
705
706 [monitor clearJSConsole];
708
710}
#define OOJS_NATIVE_ENTER(cx)
#define OOJS_NATIVE_EXIT
#define OOJS_THIS
id OOJSNativeObjectFromJSObject(JSContext *context, JSObject *object)
void OOJSReportError(JSContext *context, NSString *format,...)
#define OOJS_RETURN_VOID
return nil

References nil, OOJS_NATIVE_ENTER, OOJS_NATIVE_EXIT, OOJS_RETURN_VOID, OOJS_THIS, OOJSNativeObjectFromJSObject(), and OOJSReportError().

+ Here is the call graph for this function:

◆ ConsoleConsoleMessage()

static JSBool ConsoleConsoleMessage ( JSContext * context,
uintN argc,
jsval * vp )
static

Definition at line 631 of file OOJSConsole.m.

632{
633 NSRange emphasisRange = {0, 0};
634
635 OOJS_NATIVE_ENTER(context)
636
637 id monitor = nil;
638 NSString *colorKey = nil,
639 *message = nil;
640 jsdouble location, length;
641
642 // Not OOJS_BEGIN_FULL_NATIVE() - we use JSAPI while paused.
645 if (monitor == nil)
646 {
647 OOJSReportError(context, @"Expected OODebugMonitor, got %@ in %s. %@", [monitor class], __PRETTY_FUNCTION__, @"This is an internal error, please report it.");
649 return NO;
650 }
651
652 if (argc > 0) colorKey = OOStringFromJSValue(context,OOJS_ARGV[0]);
653 if (argc > 1) message = OOStringFromJSValue(context,OOJS_ARGV[1]);
654
655 if (argc > 3)
656 {
657 // Attempt to get two numbers, specifying an emphasis range.
658 if (JS_ValueToNumber(context, OOJS_ARGV[2], &location) &&
659 JS_ValueToNumber(context, OOJS_ARGV[3], &length))
660 {
661 emphasisRange = (NSRange){location, length};
662 }
663 }
664
665 if (message == nil)
666 {
667 if (colorKey == nil)
668 {
669 OOJSReportWarning(context, @"Console.consoleMessage() called with no parameters.");
670 }
671 else
672 {
673 message = colorKey;
674 colorKey = @"command-result";
675 }
676 }
677
678 if (message != nil)
679 {
680 [monitor appendJSConsoleLine:message
681 colorKey:colorKey
682 emphasisRange:emphasisRange];
683 }
685
687
689}
void OOJSPauseTimeLimiter(void)
void OOJSReportWarning(JSContext *context, NSString *format,...)
NSString * OOStringFromJSValue(JSContext *context, jsval value)
#define OOJS_ARGV
void OOJSResumeTimeLimiter(void)
id OOJSNativeObjectOfClassFromJSObject(JSContext *context, JSObject *object, Class requiredClass)

References nil, OOJS_ARGV, OOJS_NATIVE_ENTER, OOJS_NATIVE_EXIT, OOJS_RETURN_VOID, OOJS_THIS, OOJSNativeObjectOfClassFromJSObject(), OOJSPauseTimeLimiter(), OOJSReportError(), OOJSReportWarning(), OOJSResumeTimeLimiter(), and OOStringFromJSValue().

+ Here is the call graph for this function:

◆ ConsoleDisplayMessagesInClass()

static JSBool ConsoleDisplayMessagesInClass ( JSContext * context,
uintN argc,
jsval * vp )
static

Definition at line 826 of file OOJSConsole.m.

827{
828 OOJS_NATIVE_ENTER(context)
829
830 NSString *messageClass = nil;
831
832 messageClass = OOStringFromJSValue(context, OOJS_ARGV[0]);
833 OOJS_RETURN_BOOL(messageClass != nil && OOLogWillDisplayMessagesInClass(messageClass));
834
836}
#define OOJS_RETURN_BOOL(v)
BOOL OOLogWillDisplayMessagesInClass(NSString *inMessageClass)
Definition OOLogging.m:144

References nil, OOJS_ARGV, OOJS_NATIVE_ENTER, OOJS_NATIVE_EXIT, OOJS_RETURN_BOOL, OOLogWillDisplayMessagesInClass(), and OOStringFromJSValue().

+ Here is the call graph for this function:

◆ ConsoleFinalize()

static void ConsoleFinalize ( JSContext * context,
JSObject * this )
static

Definition at line 518 of file OOJSConsole.m.

519{
521
522 [(id)JS_GetPrivate(context, this) release];
523 JS_SetPrivate(context, this, nil);
524
526}
#define OOJS_PROFILE_EXIT_VOID
#define OOJS_PROFILE_ENTER

References nil, OOJS_PROFILE_ENTER, and OOJS_PROFILE_EXIT_VOID.

◆ ConsoleGarbageCollect()

static JSBool ConsoleGarbageCollect ( JSContext * context,
uintN argc,
jsval * vp )
static

Definition at line 901 of file OOJSConsole.m.

902{
903 OOJS_NATIVE_ENTER(context)
904
905 uint32_t bytesBefore = JS_GetGCParameter(JS_GetRuntime(context), JSGC_BYTES);
906 JS_GC(context);
907 uint32_t bytesAfter = JS_GetGCParameter(JS_GetRuntime(context), JSGC_BYTES);
908
909 OOJS_RETURN_OBJECT(([NSString stringWithFormat:@"Bytes before: %u Bytes after: %u", bytesBefore, bytesAfter]));
910
912}
#define OOJS_RETURN_OBJECT(o)

References OOJS_NATIVE_ENTER, OOJS_NATIVE_EXIT, and OOJS_RETURN_OBJECT.

◆ ConsoleGetProfile()

static JSBool ConsoleGetProfile ( JSContext * context,
uintN argc,
jsval * vp )
static

Definition at line 1024 of file OOJSConsole.m.

1025{
1026 OOJS_NATIVE_ENTER(context)
1027
1028
1030 {
1031 OOJSReportError(context, @"Profiling functions may not be called while already profiling.");
1032 return NO;
1033 }
1034
1035 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
1036 OOTimeProfile *profile = nil;
1037
1038 JSBool result = PerformProfiling(context, @"getProfile", argc, OOJS_ARGV, NULL, NO, &profile);
1039 if (result)
1040 {
1041 OOJS_SET_RVAL(OOJSValueFromNativeObject(context, profile));
1042 }
1043
1044 [pool release];
1045 return result;
1046
1048}
#define EXPECT_NOT(x)
static JSBool PerformProfiling(JSContext *context, NSString *nominalFunction, uintN argc, jsval *argv, jsval *rval, BOOL trace, OOTimeProfile **profile)
BOOL OOJSIsProfiling(void)
#define OOJS_SET_RVAL(v)
OOINLINE jsval OOJSValueFromNativeObject(JSContext *context, id object)

References EXPECT_NOT, nil, OOJS_ARGV, OOJS_NATIVE_ENTER, OOJS_NATIVE_EXIT, OOJS_SET_RVAL, OOJSIsProfiling(), OOJSReportError(), OOJSValueFromNativeObject(), and PerformProfiling().

+ Here is the call graph for this function:

◆ ConsoleGetProperty()

static JSBool ConsoleGetProperty ( JSContext * context,
JSObject * this,
jsid propID,
jsval * value )
static

Definition at line 308 of file OOJSConsole.m.

309{
310 if (!JSID_IS_INT(propID)) return YES;
311
312 OOJS_NATIVE_ENTER(context)
313
314 switch (JSID_TO_INT(propID))
315 {
316#ifndef NDEBUG
318 *value = INT_TO_JSVAL((uint32_t)gDebugFlags);
319 break;
320#endif
321
323 *value = [OOStringFromGraphicsDetail([UNIVERSE detailLevel]) oo_jsValueInContext:context];
324 break;
325
327 *value = [OOStringFromGraphicsDetail([[OOOpenGLExtensionManager sharedManager] maximumDetailLevel]) oo_jsValueInContext:context];
328 break;
329
331 *value = OOJSValueFromBOOL([UNIVERSE displayFPS]);
332 break;
333
336 break;
337
339 {
340 uint32_t options = JS_GetOptions(context);
341 *value = OOJSValueFromBOOL(options & JSOPTION_STRICT);
342 }
343 break;
344
346 *value = OOJSValueFromBOOL([[OODebugMonitor sharedDebugMonitor] TCPIgnoresDroppedPackets]);
347 break;
348
350 *value = OOJSValueFromBOOL([[OOJavaScriptEngine sharedEngine] showErrorLocations]);
351 break;
352
354 *value = OOJSValueFromBOOL([[OOJavaScriptEngine sharedEngine] dumpStackForErrors]);
355 break;
356
358 *value = OOJSValueFromBOOL([[OOJavaScriptEngine sharedEngine] dumpStackForWarnings]);
359 break;
360
362 *value = OOJSValueFromNativeObject(context, [[OOOpenGLExtensionManager sharedManager] vendorString]);
363 break;
364
366 *value = OOJSValueFromNativeObject(context, [[OOOpenGLExtensionManager sharedManager] rendererString]);
367 break;
368
370 *value = INT_TO_JSVAL([[OOOpenGLExtensionManager sharedManager] textureUnitCount]);
371 break;
372
374 *value = INT_TO_JSVAL([[OOOpenGLExtensionManager sharedManager] textureImageUnitCount]);
375 break;
376
377#define DEBUG_FLAG_CASE(x) case kConsole_##x: *value = INT_TO_JSVAL(x); break;
388
390#undef DEBUG_FLAG_CASE
391
392 default:
394 return NO;
395 }
396
397 return YES;
398
400}
NSUInteger gDebugFlags
Definition main.m:7
NSString * OOStringFromGraphicsDetail(OOGraphicsDetail detail)
@ DEBUG_COLLISIONS
Definition OODebugFlags.h:7
@ DEBUG_NO_DUST
@ DEBUG_DOCKING
Definition OODebugFlags.h:8
@ DEBUG_SHADER_VALIDATION
@ DEBUG_MISC
@ DEBUG_OCTREE_LOGGING
Definition OODebugFlags.h:9
@ DEBUG_OCTREE_DRAW
@ DEBUG_NO_SHADER_FALLBACK
@ DEBUG_DRAW_NORMALS
@ DEBUG_LINKED_LISTS
Definition OODebugFlags.h:5
@ DEBUG_BOUNDING_BOXES
#define DEBUG_FLAG_CASE(x)
NSString * OOPlatformDescription(void)
static JSPropertySpec sConsoleProperties[]
void OOJSReportBadPropertySelector(JSContext *context, JSObject *thisObj, jsid propID, JSPropertySpec *propertySpec)
OOINLINE jsval OOJSValueFromBOOL(int b) INLINE_CONST_FUNC
#define UNIVERSE
Definition Universe.h:833

References DEBUG_BOUNDING_BOXES, DEBUG_COLLISIONS, DEBUG_DOCKING, DEBUG_DRAW_NORMALS, DEBUG_FLAG_CASE, DEBUG_LINKED_LISTS, DEBUG_MISC, DEBUG_NO_DUST, DEBUG_NO_SHADER_FALLBACK, DEBUG_OCTREE_DRAW, DEBUG_OCTREE_LOGGING, DEBUG_SHADER_VALIDATION, gDebugFlags, kConsole_debugFlags, kConsole_detailLevel, kConsole_displayFPS, kConsole_dumpStackForErrors, kConsole_dumpStackForWarnings, kConsole_glFixedFunctionTextureUnitCount, kConsole_glFragmentShaderTextureUnitCount, kConsole_glRendererString, kConsole_glVendorString, kConsole_ignoreDroppedPackets, kConsole_maximumDetailLevel, kConsole_pedanticMode, kConsole_platformDescription, kConsole_showErrorLocations, OOOpenGLExtensionManager::maximumDetailLevel, OOJS_NATIVE_ENTER, OOJS_NATIVE_EXIT, OOJSReportBadPropertySelector(), OOJSValueFromBOOL(), OOJSValueFromNativeObject(), OOPlatformDescription(), sConsoleProperties, OOOpenGLExtensionManager::sharedManager, and UNIVERSE.

+ Here is the call graph for this function:

◆ ConsoleInspectEntity()

static JSBool ConsoleInspectEntity ( JSContext * context,
uintN argc,
jsval * vp )
static

Definition at line 725 of file OOJSConsole.m.

726{
727 OOJS_NATIVE_ENTER(context)
728
729 Entity *entity = nil;
730
731 if (JSValueToEntity(context, OOJS_ARGV[0], &entity))
732 {
734 if ([entity respondsToSelector:@selector(inspect)])
735 {
736 [entity inspect];
737 }
739 }
740
742
744}
#define OOJS_END_FULL_NATIVE
#define OOJS_BEGIN_FULL_NATIVE(context)
BOOL JSValueToEntity(JSContext *context, jsval value, Entity **outEntity)
Definition OOJSEntity.m:146

References Entity::inspect, Entity(OODebugInspector)::inspect, JSValueToEntity(), nil, OOJS_ARGV, OOJS_BEGIN_FULL_NATIVE, OOJS_END_FULL_NATIVE, OOJS_NATIVE_ENTER, OOJS_NATIVE_EXIT, and OOJS_RETURN_VOID.

+ Here is the call graph for this function:

◆ ConsoleIsExecutableJavaScript()

static JSBool ConsoleIsExecutableJavaScript ( JSContext * context,
uintN argc,
jsval * vp )
static

Definition at line 797 of file OOJSConsole.m.

798{
799 OOJS_NATIVE_ENTER(context)
800
801 BOOL result = NO;
802 JSObject *target = NULL;
803
804 if (argc < 2 || !JS_ValueToObject(context, OOJS_ARGV[0], &target) || !JSVAL_IS_STRING(OOJS_ARGV[1]))
805 {
806 OOJS_RETURN_BOOL(NO); // Fail silently
807 }
808
809 // Not OOJS_BEGIN_FULL_NATIVE() - we use JSAPI while paused.
811
812 // FIXME: this must be possible using just JSAPI functions.
813 NSString *string = OOStringFromJSValue(context, OOJS_ARGV[1]);
814 NSData *stringData = [string dataUsingEncoding:NSUTF8StringEncoding];
815 result = JS_BufferIsCompilableUnit(context, target, [stringData bytes], [stringData length]);
816
818
819 OOJS_RETURN_BOOL(result);
820
822}

References OOJS_ARGV, OOJS_NATIVE_ENTER, OOJS_NATIVE_EXIT, OOJS_RETURN_BOOL, OOJSPauseTimeLimiter(), OOJSResumeTimeLimiter(), and OOStringFromJSValue().

+ Here is the call graph for this function:

◆ ConsoleProfile()

static JSBool ConsoleProfile ( JSContext * context,
uintN argc,
jsval * vp )
static

Definition at line 997 of file OOJSConsole.m.

998{
999 OOJS_NATIVE_ENTER(context)
1000
1002 {
1003 OOJSReportError(context, @"Profiling functions may not be called while already profiling.");
1004 return NO;
1005 }
1006
1007 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
1008 OOTimeProfile *profile = nil;
1009
1010 JSBool result = PerformProfiling(context, @"profile", argc, OOJS_ARGV, NULL, NO, &profile);
1011 if (result)
1012 {
1013 OOJS_SET_RVAL(OOJSValueFromNativeObject(context, [profile description]));
1014 }
1015
1016 [pool release];
1017 return result;
1018
1020}

References EXPECT_NOT, nil, OOJS_ARGV, OOJS_NATIVE_ENTER, OOJS_NATIVE_EXIT, OOJS_SET_RVAL, OOJSIsProfiling(), OOJSReportError(), OOJSValueFromNativeObject(), and PerformProfiling().

+ Here is the call graph for this function:

◆ ConsoleScriptStack()

static JSBool ConsoleScriptStack ( JSContext * context,
uintN argc,
jsval * vp )
static

Definition at line 714 of file OOJSConsole.m.

715{
716 OOJS_NATIVE_ENTER(context)
717
718 OOJS_RETURN_OBJECT([OOJSScript scriptStack]);
719
721}

References OOJS_NATIVE_ENTER, OOJS_NATIVE_EXIT, and OOJS_RETURN_OBJECT.

◆ ConsoleSetDisplayMessagesInClass()

static JSBool ConsoleSetDisplayMessagesInClass ( JSContext * context,
uintN argc,
jsval * vp )
static

Definition at line 840 of file OOJSConsole.m.

841{
842 OOJS_NATIVE_ENTER(context)
843
844 NSString *messageClass = nil;
845 JSBool flag;
846
847 messageClass = OOStringFromJSValue(context, OOJS_ARGV[0]);
848 if (messageClass != nil && JS_ValueToBoolean(context, OOJS_ARGV[1], &flag))
849 {
850 OOLogSetDisplayMessagesInClass(messageClass, flag);
851 }
853
855}
void OOLogSetDisplayMessagesInClass(NSString *inClass, BOOL inFlag)
Definition OOLogging.m:182

References nil, OOJS_ARGV, OOJS_NATIVE_ENTER, OOJS_NATIVE_EXIT, OOJS_RETURN_VOID, OOLogSetDisplayMessagesInClass(), and OOStringFromJSValue().

+ Here is the call graph for this function:

◆ ConsoleSetProperty()

static JSBool ConsoleSetProperty ( JSContext * context,
JSObject * this,
jsid propID,
JSBool strict,
jsval * value )
static

Definition at line 403 of file OOJSConsole.m.

404{
405 if (!JSID_IS_INT(propID)) return YES;
406
407 OOJS_NATIVE_ENTER(context)
408
409 int32 iValue;
410 JSBool bValue = NO;
411 NSString *sValue;
412
413 switch (JSID_TO_INT(propID))
414 {
415#ifndef NDEBUG
417 if (JS_ValueToInt32(context, *value, &iValue))
418 {
419 gDebugFlags = iValue;
420 }
421 break;
422#endif
424 sValue = OOStringFromJSValue(context, *value);
426 [UNIVERSE setDetailLevel:OOGraphicsDetailFromString(sValue)];
428 break;
429
431 if (JS_ValueToBoolean(context, *value, &bValue))
432 {
433 [UNIVERSE setDisplayFPS:bValue];
434 }
435 break;
436
438 if (JS_ValueToBoolean(context, *value, &bValue))
439 {
440 uint32_t options = JS_GetOptions(context);
441 if (bValue) options |= JSOPTION_STRICT;
442 else options &= ~JSOPTION_STRICT;
443
444 JS_SetOptions(context, options);
445 }
446 break;
447
449 if (JS_ValueToBoolean(context, *value, &bValue))
450 {
451 [[OODebugMonitor sharedDebugMonitor] setTCPIgnoresDroppedPackets:bValue];
452 }
453 break;
454
456 if (JS_ValueToBoolean(context, *value, &bValue))
457 {
458 [[OOJavaScriptEngine sharedEngine] setShowErrorLocations:bValue];
459 }
460 break;
461
463 if (JS_ValueToBoolean(context, *value, &bValue))
464 {
465 [[OOJavaScriptEngine sharedEngine] setDumpStackForErrors:bValue];
466 }
467 break;
468
470 if (JS_ValueToBoolean(context, *value, &bValue))
471 {
472 [[OOJavaScriptEngine sharedEngine] setDumpStackForWarnings:bValue];
473 }
474 break;
475
476 default:
478 return NO;
479 }
480
481 return YES;
482
484}
OOGraphicsDetail OOGraphicsDetailFromString(NSString *string)

References gDebugFlags, kConsole_debugFlags, kConsole_detailLevel, kConsole_displayFPS, kConsole_dumpStackForErrors, kConsole_dumpStackForWarnings, kConsole_ignoreDroppedPackets, kConsole_pedanticMode, kConsole_showErrorLocations, OOJS_BEGIN_FULL_NATIVE, OOJS_END_FULL_NATIVE, OOJS_NATIVE_ENTER, OOJS_NATIVE_EXIT, OOJSReportBadPropertySelector(), OOStringFromJSValue(), sConsoleProperties, OOJavaScriptEngine::setDumpStackForErrors:, OOJavaScriptEngine::setDumpStackForWarnings:, OOJavaScriptEngine::setShowErrorLocations:, OODebugMonitor::setTCPIgnoresDroppedPackets:, OODebugMonitor::sharedDebugMonitor, and OOJavaScriptEngine::sharedEngine.

+ Here is the call graph for this function:

◆ ConsoleSettingsDeleteProperty()

static JSBool ConsoleSettingsDeleteProperty ( JSContext * context,
JSObject * this,
jsid propID,
jsval * value )
static

Definition at line 529 of file OOJSConsole.m.

530{
531 OOJS_NATIVE_ENTER(context)
532
533 NSString *key = nil;
534 id monitor = nil;
535
536 if (!JSID_IS_STRING(propID)) return NO;
537 key = OOStringFromJSString(context, JSID_TO_STRING(propID));
538
539 monitor = OOJSNativeObjectFromJSObject(context, this);
540 if (![monitor isKindOfClass:[OODebugMonitor class]])
541 {
542 OOJSReportError(context, @"Expected OODebugMonitor, got %@ in %s. %@", [monitor class], __PRETTY_FUNCTION__, @"This is an internal error, please report it.");
543 return NO;
544 }
545
546 [monitor setConfigurationValue:nil forKey:key];
547 *value = JSVAL_TRUE;
548 return YES;
549
551}
NSString * OOStringFromJSString(JSContext *context, JSString *string)

References nil, OOJS_NATIVE_ENTER, OOJS_NATIVE_EXIT, OOJSNativeObjectFromJSObject(), OOJSReportError(), and OOStringFromJSString().

+ Here is the call graph for this function:

◆ ConsoleSettingsGetProperty()

static JSBool ConsoleSettingsGetProperty ( JSContext * context,
JSObject * this,
jsid propID,
jsval * value )
static

Definition at line 554 of file OOJSConsole.m.

555{
556 if (!JSID_IS_STRING(propID)) return YES;
557
558 OOJS_NATIVE_ENTER(context)
559
560 NSString *key = nil;
561 id settingValue = nil;
562 id monitor = nil;
563
564 key = OOStringFromJSString(context, JSID_TO_STRING(propID));
565
566 monitor = OOJSNativeObjectFromJSObject(context, this);
567 if (![monitor isKindOfClass:[OODebugMonitor class]])
568 {
569 OOJSReportError(context, @"Expected OODebugMonitor, got %@ in %s. %@", [monitor class], __PRETTY_FUNCTION__, @"This is an internal error, please report it.");
570 return NO;
571 }
572
573 settingValue = [monitor configurationValueForKey:key];
574 if (settingValue != NULL) *value = [settingValue oo_jsValueInContext:context];
575 else *value = JSVAL_VOID;
576
577 return YES;
578
580}

References nil, OOJS_NATIVE_ENTER, OOJS_NATIVE_EXIT, OOJSNativeObjectFromJSObject(), OOJSReportError(), and OOStringFromJSString().

+ Here is the call graph for this function:

◆ ConsoleSettingsSetProperty()

static JSBool ConsoleSettingsSetProperty ( JSContext * context,
JSObject * this,
jsid propID,
JSBool strict,
jsval * value )
static

Definition at line 583 of file OOJSConsole.m.

584{
585 if (!JSID_IS_STRING(propID)) return YES;
586
587 OOJS_NATIVE_ENTER(context)
588
589 NSString *key = nil;
590 id settingValue = nil;
591 id monitor = nil;
592
593 key = OOStringFromJSString(context, JSID_TO_STRING(propID));
594
595 monitor = OOJSNativeObjectFromJSObject(context, this);
596 if (![monitor isKindOfClass:[OODebugMonitor class]])
597 {
598 OOJSReportError(context, @"Expected OODebugMonitor, got %@ in %s. %@", [monitor class], __PRETTY_FUNCTION__, @"This is an internal error, please report it.");
599 return NO;
600 }
601
602 // Not OOJS_BEGIN_FULL_NATIVE() - we use JSAPI while paused.
604 if (JSVAL_IS_NULL(*value) || JSVAL_IS_VOID(*value))
605 {
606 [monitor setConfigurationValue:nil forKey:key];
607 }
608 else
609 {
610 settingValue = OOJSNativeObjectFromJSValue(context, *value);
611 if (settingValue != nil)
612 {
613 [monitor setConfigurationValue:settingValue forKey:key];
614 }
615 else
616 {
617 OOJSReportWarning(context, @"debugConsole.settings: could not convert %@ to native object.", OOStringFromJSValue(context, *value));
618 }
619 }
621
622 return YES;
623
625}
id OOJSNativeObjectFromJSValue(JSContext *context, jsval value)

References nil, OOJS_NATIVE_ENTER, OOJS_NATIVE_EXIT, OOJSNativeObjectFromJSObject(), OOJSNativeObjectFromJSValue(), OOJSPauseTimeLimiter(), OOJSReportError(), OOJSReportWarning(), OOJSResumeTimeLimiter(), OOStringFromJSString(), and OOStringFromJSValue().

+ Here is the call graph for this function:

◆ ConsoleTrace()

static JSBool ConsoleTrace ( JSContext * context,
uintN argc,
jsval * vp )
static

Definition at line 1052 of file OOJSConsole.m.

1053{
1054 OOJS_NATIVE_ENTER(context)
1055
1057 {
1058 OOJSReportError(context, @"Profiling functions may not be called while already profiling.");
1059 return NO;
1060 }
1061
1062 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
1063 jsval rval;
1064
1065 JSBool result = PerformProfiling(context, @"trace", argc, OOJS_ARGV, &rval, YES, NULL);
1066 if (result)
1067 {
1068 OOJS_SET_RVAL(rval);
1069 }
1070
1071 [pool release];
1072 return result;
1073
1075}

References EXPECT_NOT, OOJS_ARGV, OOJS_NATIVE_ENTER, OOJS_NATIVE_EXIT, OOJS_SET_RVAL, OOJSIsProfiling(), OOJSReportError(), and PerformProfiling().

+ Here is the call graph for this function:

◆ ConsoleWriteJSMemoryStats()

static JSBool ConsoleWriteJSMemoryStats ( JSContext * context,
uintN argc,
jsval * vp )
static

Definition at line 886 of file OOJSConsole.m.

887{
888 OOJS_NATIVE_ENTER(context)
889
891 [[OODebugMonitor sharedDebugMonitor] dumpJSMemoryStatistics];
893
895
897}

References OODebugMonitor::dumpJSMemoryStatistics, OOJS_BEGIN_FULL_NATIVE, OOJS_END_FULL_NATIVE, OOJS_NATIVE_ENTER, OOJS_NATIVE_EXIT, OOJS_RETURN_VOID, and OODebugMonitor::sharedDebugMonitor.

+ Here is the call graph for this function:

◆ ConsoleWriteLogMarker()

static JSBool ConsoleWriteLogMarker ( JSContext * context,
uintN argc,
jsval * vp )
static

Definition at line 859 of file OOJSConsole.m.

860{
861 OOJS_NATIVE_ENTER(context)
862
865
867}
void OOLogInsertMarker(void)
Definition OOLogging.m:632

References OOJS_NATIVE_ENTER, OOJS_NATIVE_EXIT, OOJS_RETURN_VOID, and OOLogInsertMarker().

+ Here is the call graph for this function:

◆ ConsoleWriteMemoryStats()

static JSBool ConsoleWriteMemoryStats ( JSContext * context,
uintN argc,
jsval * vp )
static

Definition at line 871 of file OOJSConsole.m.

872{
873 OOJS_NATIVE_ENTER(context)
874
876 [[OODebugMonitor sharedDebugMonitor] dumpMemoryStatistics];
878
880
882}

References OODebugMonitor::dumpMemoryStatistics, OOJS_BEGIN_FULL_NATIVE, OOJS_END_FULL_NATIVE, OOJS_NATIVE_ENTER, OOJS_NATIVE_EXIT, OOJS_RETURN_VOID, and OODebugMonitor::sharedDebugMonitor.

+ Here is the call graph for this function:

◆ DebugMonitorToJSConsole()

JSObject * DebugMonitorToJSConsole ( JSContext * context,
OODebugMonitor * monitor )

Definition at line 255 of file OOJSConsole.m.

256{
258
259 OOJavaScriptEngine *engine = nil;
260 JSObject *object = NULL;
261 JSObject *settingsObject = NULL;
262 jsval value;
263
264 NSCAssert(JS_EnterLocalRootScope(context), @"Failed to create JS GC root scope");
265 engine = [OOJavaScriptEngine sharedEngine];
266
267 if (sConsolePrototype == NULL)
268 {
269 InitOOJSConsole(context, [engine globalObject]);
270 }
271
272 // Create Console object
273 object = JS_NewObject(context, &sConsoleClass, sConsolePrototype, NULL);
274 if (object != NULL)
275 {
276 if (!JS_SetPrivate(context, object, [monitor weakRetain])) object = NULL;
277 }
278
279 if (object != NULL)
280 {
281 // Create ConsoleSettings object
282 settingsObject = JS_NewObject(context, &sConsoleSettingsClass, sConsoleSettingsPrototype, NULL);
283 if (settingsObject != NULL)
284 {
285 if (!JS_SetPrivate(context, settingsObject, [monitor weakRetain])) settingsObject = NULL;
286 }
287 if (settingsObject != NULL)
288 {
289 value = OBJECT_TO_JSVAL(settingsObject);
290 if (!JS_SetProperty(context, object, "settings", &value))
291 {
292 settingsObject = NULL;
293 }
294 }
295
296 if (settingsObject == NULL) object = NULL;
297 }
298
299 JS_LeaveLocalRootScope(context);
300
301 return object;
302 // Analyzer: object leaked. (x2) [Expected, objects are retained by JS object.]
303
305}
static JSObject * sConsolePrototype
Definition OOJSConsole.m:60
static void InitOOJSConsole(JSContext *context, JSObject *global)
static JSClass sConsoleClass
static JSClass sConsoleSettingsClass
static JSObject * sConsoleSettingsPrototype
Definition OOJSConsole.m:61
#define OOJS_PROFILE_EXIT

References InitOOJSConsole(), nil, OOJS_PROFILE_ENTER, OOJS_PROFILE_EXIT, sConsoleClass, sConsolePrototype, sConsoleSettingsClass, sConsoleSettingsPrototype, and OOJavaScriptEngine::sharedEngine.

+ Here is the call graph for this function:

◆ DoWeDefineAllDebugFlags()

static BOOL DoWeDefineAllDebugFlags ( enum OODebugFlags flags)
static

Definition at line 488 of file OOJSConsole.m.

489{
490 /* This function doesn't do anything, but will generate a warning
491 (Enumeration value 'DEBUG_FOO' not handled in switch) if a debug flag
492 is added without updating it. The point is that if you get such a
493 warning, you should first add a JS symbolic constant for the flag,
494 then add it to the switch to suppress the warning.
495 NOTE: don't add a default: to this switch, or I will have to hurt you.
496 -- Ahruman 2010-04-11
497 */
498 switch (flags)
499 {
501 case DEBUG_COLLISIONS:
502 case DEBUG_DOCKING:
507 case DEBUG_NO_DUST:
510 case DEBUG_MISC:
511 return YES;
512 }
513
514 return NO;
515}

References DEBUG_BOUNDING_BOXES, DEBUG_COLLISIONS, DEBUG_DOCKING, DEBUG_DRAW_NORMALS, DEBUG_LINKED_LISTS, DEBUG_MISC, DEBUG_NO_DUST, DEBUG_NO_SHADER_FALLBACK, DEBUG_OCTREE_DRAW, DEBUG_OCTREE_LOGGING, and DEBUG_SHADER_VALIDATION.

◆ InitOOJSConsole()

static void InitOOJSConsole ( JSContext * context,
JSObject * global )
static

Definition at line 239 of file OOJSConsole.m.

240{
241 sConsolePrototype = JS_InitClass(context, global, NULL, &sConsoleClass, OOJSUnconstructableConstruct, 0, sConsoleProperties, sConsoleMethods, NULL, NULL);
243
244 sConsoleSettingsPrototype = JS_InitClass(context, global, NULL, &sConsoleSettingsClass, OOJSUnconstructableConstruct, 0, NULL, NULL, NULL, NULL);
246}
static JSFunctionSpec sConsoleMethods[]
void OOJSRegisterObjectConverter(JSClass *theClass, OOJSClassConverterCallback converter)
JSBool OOJSUnconstructableConstruct(JSContext *context, uintN argc, jsval *vp)
id OOJSBasicPrivateObjectConverter(JSContext *context, JSObject *object)

References OOJSBasicPrivateObjectConverter(), OOJSRegisterObjectConverter(), OOJSUnconstructableConstruct(), sConsoleClass, sConsoleMethods, sConsoleProperties, sConsolePrototype, sConsoleSettingsClass, and sConsoleSettingsPrototype.

Referenced by DebugMonitorToJSConsole().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ OOJSConsoleDestroy()

void OOJSConsoleDestroy ( void )

Definition at line 249 of file OOJSConsole.m.

250{
251 sConsolePrototype = NULL;
252}

References sConsolePrototype.

◆ OOPlatformDescription()

NSString * OOPlatformDescription ( void )

Definition at line 185 of file OOLogHeader.m.

186{
187 #if OOLITE_MAC_OS_X
188 NSString *systemString = [NSString stringWithFormat:@OS_TYPE_STRING " %@", [[NSProcessInfo processInfo] operatingSystemVersionString]];
189 #else
190 #define systemString @OS_TYPE_STRING
191 #endif
192
193 return [NSString stringWithFormat:@"%@ ("CPU_TYPE_STRING RELEASE_VARIANT_STRING")", systemString];
194}
#define CPU_TYPE_STRING
#define RELEASE_VARIANT_STRING
#define OS_TYPE_STRING

Referenced by ConsoleGetProperty().

+ Here is the caller graph for this function:

◆ PerformProfiling()

static JSBool PerformProfiling ( JSContext * context,
NSString * nominalFunction,
uintN argc,
jsval * argv,
jsval * rval,
BOOL trace,
OOTimeProfile ** profile )
static

Definition at line 1078 of file OOJSConsole.m.

1079{
1080 // Get function.
1081 jsval function = argv[0];
1082 if (!OOJSValueIsFunction(context, function))
1083 {
1084 OOJSReportBadArguments(context, @"Console", nominalFunction, 1, argv, nil, @"function");
1085 return NO;
1086 }
1087
1088 // Get "this" object.
1089 jsval this;
1090 if (argc > 1) this = argv[1];
1091 else
1092 {
1093 jsval debugConsole = OOJSValueFromNativeObject(context, [OODebugMonitor sharedDebugMonitor]);
1094 assert(JSVAL_IS_OBJECT(debugConsole) && !JSVAL_IS_NULL(debugConsole));
1095 JS_GetProperty(context, JSVAL_TO_OBJECT(debugConsole), "script", &this);
1096 }
1097
1098 JSObject *thisObj;
1099 if (!JS_ValueToObject(context, this, &thisObj)) thisObj = NULL;
1100
1101 jsval ignored;
1102 if (outRval == NULL) outRval = &ignored;
1103
1104 // Fiddle with time limiter.
1105 // We want to save the current limit, reset the limiter, and set the time limit to a long time.
1106#define LONG_TIME (1e7) // A long time - 115.7 days - but, crucially, finite.
1107
1108 OOTimeDelta originalLimit = OOJSGetTimeLimiterLimit();
1111
1112 OOJSBeginProfiling(trace);
1113
1114 // Call the function.
1115 BOOL result = JS_CallFunctionValue(context, thisObj, function, 0, NULL, outRval);
1116
1117 // Get results.
1118 OOTimeProfile *profile = OOJSEndProfiling();
1119 if (outProfile != NULL) *outProfile = profile;
1120
1121 // Restore original timer state.
1122 OOJSSetTimeLimiterLimit(originalLimit);
1124
1125 JS_ReportPendingException(context);
1126
1127 return result;
1128}
#define LONG_TIME
OOTimeProfile * OOJSEndProfiling(void)
void OOJSResetTimeLimiter(void)
void OOJSBeginProfiling(BOOL trace)
OOTimeDelta OOJSGetTimeLimiterLimit(void)
void OOJSSetTimeLimiterLimit(OOTimeDelta limit)
OOINLINE BOOL OOJSValueIsFunction(JSContext *context, jsval value)
void OOJSReportBadArguments(JSContext *context, NSString *scriptClass, NSString *function, uintN argc, jsval *argv, NSString *message, NSString *expectedArgsDescription)
double OOTimeDelta
Definition OOTypes.h:224

Referenced by ConsoleGetProfile(), ConsoleProfile(), and ConsoleTrace().

+ Here is the caller graph for this function:

Variable Documentation

◆ sConsoleClass

JSClass sConsoleClass
static
Initial value:
=
{
"Console",
JSCLASS_HAS_PRIVATE,
JS_PropertyStub,
JS_PropertyStub,
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
JSCLASS_NO_OPTIONAL_MEMBERS
}
static JSBool ConsoleGetProperty(JSContext *context, JSObject *this, jsid propID, jsval *value)
static void ConsoleFinalize(JSContext *context, JSObject *this)
static JSBool ConsoleSetProperty(JSContext *context, JSObject *this, jsid propID, JSBool strict, jsval *value)

Definition at line 103 of file OOJSConsole.m.

104{
105 "Console",
106 JSCLASS_HAS_PRIVATE,
107
108 JS_PropertyStub, // addProperty
109 JS_PropertyStub, // delProperty
110 ConsoleGetProperty, // getProperty
111 ConsoleSetProperty, // setProperty
112 JS_EnumerateStub, // enumerate
113 JS_ResolveStub, // resolve
114 JS_ConvertStub, // convert
115 ConsoleFinalize, // finalize
116 JSCLASS_NO_OPTIONAL_MEMBERS
117};

Referenced by DebugMonitorToJSConsole(), and InitOOJSConsole().

◆ sConsoleMethods

JSFunctionSpec sConsoleMethods[]
static
Initial value:
=
{
{ "consoleMessage", ConsoleConsoleMessage, 2 },
{ "clearConsole", ConsoleClearConsole, 0 },
{ "scriptStack", ConsoleScriptStack, 0 },
{ "inspectEntity", ConsoleInspectEntity, 1 },
{ "isExecutableJavaScript", ConsoleIsExecutableJavaScript, 2 },
{ "displayMessagesInClass", ConsoleDisplayMessagesInClass, 1 },
{ "setDisplayMessagesInClass", ConsoleSetDisplayMessagesInClass, 2 },
{ "writeLogMarker", ConsoleWriteLogMarker, 0 },
{ "writeMemoryStats", ConsoleWriteMemoryStats, 0 },
{ "writeJSMemoryStats", ConsoleWriteJSMemoryStats, 0 },
{ "garbageCollect", ConsoleGarbageCollect, 0 },
{ "profile", ConsoleProfile, 1 },
{ "getProfile", ConsoleGetProfile, 1 },
{ "trace", ConsoleTrace, 1 },
{ 0 }
}
static JSBool ConsoleIsExecutableJavaScript(JSContext *context, uintN argc, jsval *vp)
static JSBool ConsoleTrace(JSContext *context, uintN argc, jsval *vp)
static JSBool ConsoleWriteJSMemoryStats(JSContext *context, uintN argc, jsval *vp)
static JSBool ConsoleGetProfile(JSContext *context, uintN argc, jsval *vp)
static JSBool ConsoleConsoleMessage(JSContext *context, uintN argc, jsval *vp)
static JSBool ConsoleScriptStack(JSContext *context, uintN argc, jsval *vp)
static JSBool ConsoleGarbageCollect(JSContext *context, uintN argc, jsval *vp)
static JSBool ConsoleWriteMemoryStats(JSContext *context, uintN argc, jsval *vp)
static JSBool ConsoleDisplayMessagesInClass(JSContext *context, uintN argc, jsval *vp)
static JSBool ConsoleSetDisplayMessagesInClass(JSContext *context, uintN argc, jsval *vp)
static JSBool ConsoleInspectEntity(JSContext *context, uintN argc, jsval *vp)
static JSBool ConsoleProfile(JSContext *context, uintN argc, jsval *vp)
static JSBool ConsoleWriteLogMarker(JSContext *context, uintN argc, jsval *vp)
static JSBool ConsoleClearConsole(JSContext *context, uintN argc, jsval *vp)

Definition at line 192 of file OOJSConsole.m.

193{
194 // JS name Function min args
195 { "consoleMessage", ConsoleConsoleMessage, 2 },
196 { "clearConsole", ConsoleClearConsole, 0 },
197 { "scriptStack", ConsoleScriptStack, 0 },
198 { "inspectEntity", ConsoleInspectEntity, 1 },
199#if OO_DEBUG
200 { "__setUpCallObjC", ConsoleSetUpCallObjC, 1 },
201#endif
202 { "isExecutableJavaScript", ConsoleIsExecutableJavaScript, 2 },
203 { "displayMessagesInClass", ConsoleDisplayMessagesInClass, 1 },
204 { "setDisplayMessagesInClass", ConsoleSetDisplayMessagesInClass, 2 },
205 { "writeLogMarker", ConsoleWriteLogMarker, 0 },
206 { "writeMemoryStats", ConsoleWriteMemoryStats, 0 },
207 { "writeJSMemoryStats", ConsoleWriteJSMemoryStats, 0 },
208 { "garbageCollect", ConsoleGarbageCollect, 0 },
209#if DEBUG
210 { "dumpNamedRoots", ConsoleDumpNamedRoots, 0 },
211 { "dumpHeap", ConsoleDumpHeap, 0 },
212#endif
213#if OOJS_PROFILE
214 { "profile", ConsoleProfile, 1 },
215 { "getProfile", ConsoleGetProfile, 1 },
216 { "trace", ConsoleTrace, 1 },
217#endif
218 { 0 }
219};

Referenced by InitOOJSConsole().

◆ sConsoleProperties

JSPropertySpec sConsoleProperties[]
static

Definition at line 155 of file OOJSConsole.m.

156{
157 // JS name ID flags
160 { "maximumDetailLevel", kConsole_maximumDetailLevel, OOJS_PROP_READONLY_CB },
162 { "platformDescription", kConsole_platformDescription, OOJS_PROP_READONLY_CB },
164 { "ignoreDroppedPackets", kConsole_ignoreDroppedPackets, OOJS_PROP_READWRITE_CB },
168 { "glVendorString", kConsole_glVendorString, OOJS_PROP_READONLY_CB },
169 { "glRendererString", kConsole_glRendererString, OOJS_PROP_READONLY_CB },
170 { "glFixedFunctionTextureUnitCount", kConsole_glFixedFunctionTextureUnitCount, OOJS_PROP_READONLY_CB },
171 { "glFragmentShaderTextureUnitCount", kConsole_glFragmentShaderTextureUnitCount, OOJS_PROP_READONLY_CB },
172
173#define DEBUG_FLAG_DECL(x) { #x, kConsole_##x, OOJS_PROP_READONLY_CB }
184
186#undef DEBUG_FLAG_DECL
187
188 { 0 }
189};
#define DEBUG_FLAG_DECL(x)
#define OOJS_PROP_READWRITE_CB
#define OOJS_PROP_HIDDEN_READWRITE_CB

Referenced by ConsoleGetProperty(), ConsoleSetProperty(), and InitOOJSConsole().

◆ sConsolePrototype

JSObject* sConsolePrototype = NULL
static

Definition at line 60 of file OOJSConsole.m.

Referenced by DebugMonitorToJSConsole(), InitOOJSConsole(), and OOJSConsoleDestroy().

◆ sConsoleSettingsClass

JSClass sConsoleSettingsClass
static
Initial value:
=
{
"ConsoleSettings",
JSCLASS_HAS_PRIVATE,
JS_PropertyStub,
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
JSCLASS_NO_OPTIONAL_MEMBERS
}
static JSBool ConsoleSettingsSetProperty(JSContext *context, JSObject *this, jsid propID, JSBool strict, jsval *value)
static JSBool ConsoleSettingsGetProperty(JSContext *context, JSObject *this, jsid propID, jsval *value)
static JSBool ConsoleSettingsDeleteProperty(JSContext *context, JSObject *this, jsid propID, jsval *value)

Definition at line 222 of file OOJSConsole.m.

223{
224 "ConsoleSettings",
225 JSCLASS_HAS_PRIVATE,
226
227 JS_PropertyStub, // addProperty
228 ConsoleSettingsDeleteProperty, // delProperty
229 ConsoleSettingsGetProperty, // getProperty
230 ConsoleSettingsSetProperty, // setProperty
231 JS_EnumerateStub, // enumerate. FIXME: this should work.
232 JS_ResolveStub, // resolve
233 JS_ConvertStub, // convert
234 ConsoleFinalize, // finalize (same as Console)
235 JSCLASS_NO_OPTIONAL_MEMBERS
236};

Referenced by DebugMonitorToJSConsole(), and InitOOJSConsole().

◆ sConsoleSettingsPrototype

JSObject* sConsoleSettingsPrototype = NULL
static

Definition at line 61 of file OOJSConsole.m.

Referenced by DebugMonitorToJSConsole(), and InitOOJSConsole().