Oolite
Loading...
Searching...
No Matches
OOJSSpecialFunctions.m File Reference
import "OOJSSpecialFunctions.h"
#include <jsdbgapi.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)
void InitOOJSSpecialFunctions (JSContext *context, JSObject *global)
OOJSValue * JSSpecialFunctionsObjectWrapper (JSContext *context)

Variables

static JSFunctionSpec sSpecialFunctionsMethods []

Function Documentation

◆ InitOOJSSpecialFunctions()

void InitOOJSSpecialFunctions ( JSContext * context,
JSObject * global )

Definition at line 43 of file OOJSSpecialFunctions.m.

44{
45}

Referenced by OOJavaScriptEngine(Private)::createMainThreadContext.

Here is the caller graph for this function:

◆ JSSpecialFunctionsObjectWrapper()

OOJSValue * JSSpecialFunctionsObjectWrapper ( JSContext * context)

Definition at line 47 of file OOJSSpecialFunctions.m.

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

◆ SpecialJSWarning()

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

Definition at line 70 of file OOJSSpecialFunctions.m.

71{
72 OOJS_PROFILE_ENTER // These functions are exception-safe
73
74 if (EXPECT_NOT(argc < 1))
75 {
76 OOJSReportBadArguments(context, @"special", @"jsWarning", argc, OOJS_ARGV, nil, @"string");
77 return NO;
78 }
79
81 OOJSReportWarning(context, @"%@", OOStringFromJSValue(context, OOJS_ARGV[0]));
83
85
87}
#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:

Variable Documentation

◆ sSpecialFunctionsMethods

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

Definition at line 34 of file OOJSSpecialFunctions.m.

34 {
35 // JS name Function min args
36 { "jsWarning", SpecialJSWarning, 1 },
37#ifdef OO_DEBUG_MONITOR_ENABLED
38 { "markConsoleEntryPoint", SpecialMarkConsoleEntryPoint, 0 },
39#endif
40 { 0 }
41};

Referenced by JSSpecialFunctionsObjectWrapper().