Oolite 1.91.0.7646-241128-10e222e
Loading...
Searching...
No Matches
OOJSSpecialFunctions.m File Reference
#include <jsdbgapi.h>
import "OOJSSpecialFunctions.h"
+ Include dependency graph for OOJSSpecialFunctions.m:

Go to the source code of this file.

Functions

static JSBool SpecialJSWarning (JSContext *context, uintN argc, jsval *vp)
 
static JSBool SpecialMarkConsoleEntryPoint (JSContext *context, uintN argc, jsval *vp)
 
void InitOOJSSpecialFunctions (JSContext *context, JSObject *global)
 
OOJSValueJSSpecialFunctionsObjectWrapper (JSContext *context)
 

Variables

static JSFunctionSpec sSpecialFunctionsMethods []
 

Function Documentation

◆ InitOOJSSpecialFunctions()

void InitOOJSSpecialFunctions ( JSContext * context,
JSObject * global )

Definition at line 47 of file OOJSSpecialFunctions.m.

48{
49}

◆ JSSpecialFunctionsObjectWrapper()

OOJSValue * JSSpecialFunctionsObjectWrapper ( JSContext * context)

Definition at line 52 of file OOJSSpecialFunctions.m.

53{
54 /*
55 Special object is created on the fly so it can be GCed (the debug
56 console script keeps a reference to its copy, but the prefix script
57 doesn't) and so we don't need to clean up a root on JS engine reset.
58 -- Ahruman 2011-03-30
59 */
60
61 JSObject *special = NULL;
62 OOJSAddGCObjectRoot(context, &special, "OOJSSpecialFunctions");
63
64 special = JS_NewObject(context, NULL, NULL, NULL);
65 JS_DefineFunctions(context, special, sSpecialFunctionsMethods);
66 JS_FreezeObject(context, special);
67
68 OOJSValue *result = [OOJSValue valueWithJSObject:special inContext:context];
69
70 JS_RemoveObjectRoot(context, &special);
71
72 return result;
73}
static JSFunctionSpec sSpecialFunctionsMethods[]
#define OOJSAddGCObjectRoot(context, root, name)
id valueWithJSObject:inContext:(JSObject *object,[inContext] JSContext *context)

References OOJSAddGCObjectRoot, sSpecialFunctionsMethods, and OOJSValue::valueWithJSObject:inContext:.

+ Here is the call graph for this function:

◆ SpecialJSWarning()

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

Definition at line 76 of file OOJSSpecialFunctions.m.

77{
78 OOJS_PROFILE_ENTER // These functions are exception-safe
79
80 if (EXPECT_NOT(argc < 1))
81 {
82 OOJSReportBadArguments(context, @"special", @"jsWarning", argc, OOJS_ARGV, nil, @"string");
83 return NO;
84 }
85
87 OOJSReportWarning(context, @"%@", OOStringFromJSValue(context, OOJS_ARGV[0]));
89
91
93}
#define EXPECT_NOT(x)
#define OOJS_PROFILE_EXIT
#define OOJS_PROFILE_ENTER
void OOJSReportWarning(JSContext *context, NSString *format,...)
void OOJSSetWarningOrErrorStackSkip(unsigned skip)
NSString * OOStringFromJSValue(JSContext *context, jsval value)
#define OOJS_ARGV
void OOJSReportBadArguments(JSContext *context, NSString *scriptClass, NSString *function, uintN argc, jsval *argv, NSString *message, NSString *expectedArgsDescription)
#define OOJS_RETURN_VOID
return nil

References EXPECT_NOT, nil, OOJS_ARGV, OOJS_PROFILE_ENTER, OOJS_PROFILE_EXIT, OOJS_RETURN_VOID, OOJSReportBadArguments(), OOJSReportWarning(), OOJSSetWarningOrErrorStackSkip(), and OOStringFromJSValue().

+ Here is the call graph for this function:

◆ SpecialMarkConsoleEntryPoint()

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

Definition at line 97 of file OOJSSpecialFunctions.m.

98{
99 // First stack frame will be in eval() in console.script.evaluate(), unless someone is playing silly buggers.
100
101 JSStackFrame *frame = NULL;
102 if (JS_FrameIterator(context, &frame) != NULL)
103 {
104 OOJSMarkConsoleEvalLocation(context, frame);
105 }
106
108}
void OOJSMarkConsoleEvalLocation(JSContext *context, JSStackFrame *stackFrame)

References OOJS_RETURN_VOID, and OOJSMarkConsoleEvalLocation().

+ Here is the call graph for this function:

Variable Documentation

◆ sSpecialFunctionsMethods

JSFunctionSpec sSpecialFunctionsMethods[]
static
Initial value:
=
{
{ "jsWarning", SpecialJSWarning, 1 },
{ "markConsoleEntryPoint", SpecialMarkConsoleEntryPoint, 0 },
{ 0 }
}
static JSBool SpecialJSWarning(JSContext *context, uintN argc, jsval *vp)
static JSBool SpecialMarkConsoleEntryPoint(JSContext *context, uintN argc, jsval *vp)

Definition at line 36 of file OOJSSpecialFunctions.m.

37{
38 // JS name Function min args
39 { "jsWarning", SpecialJSWarning, 1 },
40#ifndef NDEBUG
41 { "markConsoleEntryPoint", SpecialMarkConsoleEntryPoint, 0 },
42#endif
43 { 0 }
44};

Referenced by JSSpecialFunctionsObjectWrapper().