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

Go to the source code of this file.

Enumerations

enum  { kWormhole_arrivalTime , kWormhole_destination , kWormhole_expiryTime , kWormhole_origin }

Functions

static BOOL JSWormholeGetWormholeEntity (JSContext *context, JSObject *stationObj, WormholeEntity **outEntity)
static JSBool WormholeGetProperty (JSContext *context, JSObject *this, jsid propID, jsval *value)
static JSBool WormholeSetProperty (JSContext *context, JSObject *this, jsid propID, JSBool strict, jsval *value)
void InitOOJSWormhole (JSContext *context, JSObject *global)

Variables

static JSObject * sWormholePrototype
static JSClass sWormholeClass
static JSPropertySpec sWormholeProperties []
static JSFunctionSpec sWormholeMethods []

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
kWormhole_arrivalTime 
kWormhole_destination 
kWormhole_expiryTime 
kWormhole_origin 

Definition at line 53 of file OOJSWormhole.m.

53 {
54 // Property IDs
59
60};
@ kWormhole_destination
@ kWormhole_expiryTime
@ kWormhole_arrivalTime
@ kWormhole_origin

Function Documentation

◆ InitOOJSWormhole()

void InitOOJSWormhole ( JSContext * context,
JSObject * global )

Definition at line 77 of file OOJSWormhole.m.

78{
82}
OOINLINE JSClass * JSEntityClass(void)
Definition OOJSEntity.h:42
OOINLINE JSObject * JSEntityPrototype(void)
Definition OOJSEntity.h:43
static JSPropertySpec sWormholeProperties[]
static JSObject * sWormholePrototype
static JSFunctionSpec sWormholeMethods[]
static JSClass sWormholeClass
void OOJSRegisterObjectConverter(JSClass *theClass, OOJSClassConverterCallback converter)
JSBool OOJSUnconstructableConstruct(JSContext *context, uintN argc, jsval *vp)
void OOJSRegisterSubclass(JSClass *subclass, JSClass *superclass)
id OOJSBasicPrivateObjectConverter(JSContext *context, JSObject *object)

References JSEntityClass(), JSEntityPrototype(), OOJSBasicPrivateObjectConverter(), OOJSRegisterObjectConverter(), OOJSRegisterSubclass(), OOJSUnconstructableConstruct(), sWormholeClass, sWormholeMethods, sWormholeProperties, and sWormholePrototype.

Referenced by OOJavaScriptEngine(Private)::createMainThreadContext.

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

◆ JSWormholeGetWormholeEntity()

BOOL JSWormholeGetWormholeEntity ( JSContext * context,
JSObject * stationObj,
WormholeEntity ** outEntity )
static

Definition at line 84 of file OOJSWormhole.m.

85{
87
88 BOOL result;
89 Entity* entity = nil;
90
91 if (outEntity == NULL)
92 return NO;
93 *outEntity = nil;
94
95 result = OOJSEntityGetEntity(context, wormholeObj, &entity);
96 if (!result)
97 return NO;
98
99 if (![entity isKindOfClass:[WormholeEntity class]])
100 return NO;
101
102 *outEntity = (WormholeEntity*)entity;
103 return YES;
104
106}
#define OOJS_PROFILE_EXIT
#define OOJS_PROFILE_ENTER
return nil

References nil, OOJS_PROFILE_ENTER, and OOJS_PROFILE_EXIT.

Referenced by WormholeGetProperty(), WormholeGetProperty(), and WormholeSetProperty().

Here is the caller graph for this function:

◆ WormholeGetProperty()

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

Definition at line 128 of file OOJSWormhole.m.

129{
130 if (!JSID_IS_INT(propID))
131 return YES;
132
133 OOJS_NATIVE_ENTER(context)
134
135 WormholeEntity* entity = nil;
136 id result = nil;
137
138 if (!JSWormholeGetWormholeEntity(context, this, &entity))
139 return NO;
140 if (entity == nil) {
141 *value = JSVAL_VOID;
142 return YES;
143 }
144
145 switch (JSID_TO_INT(propID)) {
147 return JS_NewNumberValue(context, [entity arrivalTime], value);
148
150 return JS_NewNumberValue(context, [entity destination], value);
151
153 return JS_NewNumberValue(context, [entity expiryTime], value);
154
155 case kWormhole_origin:
156 return JS_NewNumberValue(context, [entity origin], value);
157
158 default:
160 return NO;
161 }
162
163 *value = OOJSValueFromNativeObject(context, result);
164 return YES;
165
167}
#define OOJS_NATIVE_ENTER(cx)
#define OOJS_NATIVE_EXIT
static BOOL JSWormholeGetWormholeEntity(JSContext *context, JSObject *stationObj, WormholeEntity **outEntity)
OOINLINE jsval OOJSValueFromNativeObject(JSContext *context, id object)
void OOJSReportBadPropertySelector(JSContext *context, JSObject *thisObj, jsid propID, JSPropertySpec *propertySpec)
voidpf uLong int origin
Definition ioapi.h:132

References JSWormholeGetWormholeEntity(), kWormhole_arrivalTime, kWormhole_destination, kWormhole_expiryTime, kWormhole_origin, nil, OOJS_NATIVE_ENTER, OOJS_NATIVE_EXIT, OOJSReportBadPropertySelector(), OOJSValueFromNativeObject(), and sWormholeProperties.

Here is the call graph for this function:

◆ WormholeSetProperty()

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

Definition at line 169 of file OOJSWormhole.m.

170{
171 if (!JSID_IS_INT(propID))
172 return YES;
173
174 OOJS_NATIVE_ENTER(context)
175
176 WormholeEntity* entity = nil;
177
178 if (!JSWormholeGetWormholeEntity(context, this, &entity))
179 return NO;
180 if (entity == nil)
181 return YES;
182
183 switch (JSID_TO_INT(propID)) {
184
185 default:
187 return NO;
188 }
189
190 OOJSReportBadPropertyValue(context, this, propID, sWormholeProperties, *value);
191 return NO;
192
194}
void OOJSReportBadPropertyValue(JSContext *context, JSObject *thisObj, jsid propID, JSPropertySpec *propertySpec, jsval value)

References JSWormholeGetWormholeEntity(), nil, OOJS_NATIVE_ENTER, OOJS_NATIVE_EXIT, OOJSReportBadPropertySelector(), OOJSReportBadPropertyValue(), and sWormholeProperties.

Here is the call graph for this function:

Variable Documentation

◆ sWormholeClass

JSClass sWormholeClass
static
Initial value:
= {
"Wormhole",
JSCLASS_HAS_PRIVATE,
JS_PropertyStub,
JS_PropertyStub,
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
JSCLASS_NO_OPTIONAL_MEMBERS
}
static JSBool WormholeSetProperty(JSContext *context, JSObject *this, jsid propID, JSBool strict, jsval *value)
static JSBool WormholeGetProperty(JSContext *context, JSObject *this, jsid propID, jsval *value)
void OOJSObjectWrapperFinalize(JSContext *context, JSObject *this)

Definition at line 38 of file OOJSWormhole.m.

38 {
39 "Wormhole",
40 JSCLASS_HAS_PRIVATE,
41
42 JS_PropertyStub, // addProperty
43 JS_PropertyStub, // delProperty
44 WormholeGetProperty, // getProperty
45 WormholeSetProperty, // setProperty
46 JS_EnumerateStub, // enumerate
47 JS_ResolveStub, // resolve
48 JS_ConvertStub, // convert
49 OOJSObjectWrapperFinalize, // finalize
50 JSCLASS_NO_OPTIONAL_MEMBERS
51};

Referenced by WormholeEntity(OOJavaScriptExtensions)::getJSClass:andPrototype:, InitOOJSWormhole(), and InitOOJSWormhole().

◆ sWormholeMethods

JSFunctionSpec sWormholeMethods[]
static
Initial value:
= {
{ 0 }
}

Definition at line 71 of file OOJSWormhole.m.

71 {
72 // JS name Function min args
73 // { "", WormholeDoStuff, 0 },
74 { 0 }
75};

Referenced by InitOOJSWormhole().

◆ sWormholeProperties

JSPropertySpec sWormholeProperties[]
static
Initial value:
= {
{ 0 }
}
#define OOJS_PROP_READONLY_CB

Definition at line 62 of file OOJSWormhole.m.

62 {
63 // JS name ID flags
68 { 0 }
69};

Referenced by InitOOJSWormhole(), InitOOJSWormhole(), WormholeGetProperty(), WormholeGetProperty(), and WormholeSetProperty().

◆ sWormholePrototype

JSObject* sWormholePrototype
static