Oolite
Loading...
Searching...
No Matches
OOJSSpecialFunctions.m File Reference
Include dependency graph for OOJSSpecialFunctions.m:

Go to the source code of this file.

Functions

static JSValue SpecialJSWarning (OOJS_NATIVE_ARGS)
void InitOOJSSpecialFunctions (JSContext *context, JSValueConst global)
JSValue JSSpecialFunctionsObjectWrapper (JSContext *context)

Variables

static const JSCFunctionListEntry sSpecialFunctionsMethods []

Function Documentation

◆ InitOOJSSpecialFunctions()

void InitOOJSSpecialFunctions ( JSContext * context,
JSValueConst global )

Definition at line 41 of file OOJSSpecialFunctions.m.

42{
43}

◆ JSSpecialFunctionsObjectWrapper()

JSValue JSSpecialFunctionsObjectWrapper ( JSContext * context)

Definition at line 45 of file OOJSSpecialFunctions.m.

46{
47 /*
48 Special object is created on the fly so it can be GCed (the debug
49 console script keeps a reference to its copy, but the prefix script
50 doesn't) and so we don't need to clean up a root on JS engine reset.
51 -- Ahruman 2011-03-30
52
53 With QuickJS, the caller owns the returned object.
54 */
55
56 JSValue special = JS_NewObject(context);
57 if (JS_IsException(special)) {
59 return JS_NULL;
60 }
61 JS_SetPropertyFunctionList(context, special, sSpecialFunctionsMethods, OOJS_COUNT(sSpecialFunctionsMethods));
62 JS_FreezeObject(context, special);
63
64 return special;
65}
static JSFunctionSpec sSpecialFunctionsMethods[]
OOINLINE void OOJSReportPendingException(JSContext *context)
#define OOJS_COUNT(array)

References OOJS_COUNT, OOJSAddGCObjectRoot, OOJSReportPendingException(), sSpecialFunctionsMethods, and OOJSValue::valueWithJSObject:inContext:.

Here is the call graph for this function:

◆ SpecialJSWarning()

JSValue SpecialJSWarning ( OOJS_NATIVE_ARGS )
static

Definition at line 67 of file OOJSSpecialFunctions.m.

68{
69 OOJS_PROFILE_ENTER // These functions are exception-safe
70
71 if (EXPECT_NOT(argc < 1))
72 {
73 OOJSReportBadArguments(context, @"special", @"jsWarning", argc, OOJS_ARGV, nil, @"string");
74 return JS_EXCEPTION;
75 }
76
78 OOJSReportWarning(context, @"%@", OOStringFromJSValue(context, OOJS_ARGV[0]));
80
82
84}
#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_NATIVE_ARGS, 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

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

Definition at line 33 of file OOJSSpecialFunctions.m.

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