Oolite 1.91.0.7645-241119-222d325
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 59 of file OOJSWormhole.m.

60{
61 // Property IDs
66
67};
@ kWormhole_destination
@ kWormhole_expiryTime
@ kWormhole_arrivalTime
@ kWormhole_origin

Function Documentation

◆ InitOOJSWormhole()

void InitOOJSWormhole ( JSContext * context,
JSObject * global )

Definition at line 89 of file OOJSWormhole.m.

90{
94}
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.

+ Here is the call graph for this function:

◆ JSWormholeGetWormholeEntity()

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

Definition at line 97 of file OOJSWormhole.m.

98{
100
101 BOOL result;
102 Entity *entity = nil;
103
104 if (outEntity == NULL) return NO;
105 *outEntity = nil;
106
107 result = OOJSEntityGetEntity(context, wormholeObj, &entity);
108 if (!result) return NO;
109
110 if (![entity isKindOfClass:[WormholeEntity class]]) return NO;
111
112 *outEntity = (WormholeEntity *)entity;
113 return YES;
114
116}
#define OOJS_PROFILE_EXIT
#define OOJS_PROFILE_ENTER
return nil

References nil, OOJS_PROFILE_ENTER, and OOJS_PROFILE_EXIT.

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

+ Here is the caller graph for this function:

◆ WormholeGetProperty()

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

Definition at line 141 of file OOJSWormhole.m.

142{
143 if (!JSID_IS_INT(propID)) return YES;
144
145 OOJS_NATIVE_ENTER(context)
146
147 WormholeEntity *entity = nil;
148 id result = nil;
149
150 if (!JSWormholeGetWormholeEntity(context, this, &entity)) return NO;
151 if (entity == nil) { *value = JSVAL_VOID; return YES; }
152
153 switch (JSID_TO_INT(propID))
154 {
156 return JS_NewNumberValue(context, [entity arrivalTime], value);
157
159 return JS_NewNumberValue(context, [entity destination], value);
160
162 return JS_NewNumberValue(context, [entity expiryTime], value);
163
164 case kWormhole_origin:
165 return JS_NewNumberValue(context, [entity origin], value);
166
167 default:
169 return NO;
170 }
171
172 *value = OOJSValueFromNativeObject(context, result);
173 return YES;
174
176}
#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:140

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()

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

Definition at line 179 of file OOJSWormhole.m.

180{
181 if (!JSID_IS_INT(propID)) return YES;
182
183 OOJS_NATIVE_ENTER(context)
184
185 WormholeEntity *entity = nil;
186
187 if (!JSWormholeGetWormholeEntity(context, this, &entity)) return NO;
188 if (entity == nil) return YES;
189
190 switch (JSID_TO_INT(propID))
191 {
192
193 default:
195 return NO;
196 }
197
198 OOJSReportBadPropertyValue(context, this, propID, sWormholeProperties, *value);
199 return NO;
200
202}
void OOJSReportBadPropertyValue(JSContext *context, JSObject *thisObj, jsid propID, JSPropertySpec *propertySpec, jsval value)

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 42 of file OOJSWormhole.m.

43{
44 "Wormhole",
45 JSCLASS_HAS_PRIVATE,
46
47 JS_PropertyStub, // addProperty
48 JS_PropertyStub, // delProperty
49 WormholeGetProperty, // getProperty
50 WormholeSetProperty, // setProperty
51 JS_EnumerateStub, // enumerate
52 JS_ResolveStub, // resolve
53 JS_ConvertStub, // convert
55 JSCLASS_NO_OPTIONAL_MEMBERS
56};

Referenced by InitOOJSWormhole().

◆ sWormholeMethods

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

Definition at line 81 of file OOJSWormhole.m.

82{
83 // JS name Function min args
84// { "", WormholeDoStuff, 0 },
85 { 0 }
86};

Referenced by InitOOJSWormhole().

◆ sWormholeProperties

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

Definition at line 70 of file OOJSWormhole.m.

71{
72 // JS name ID flags
77 { 0 }
78};

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

◆ sWormholePrototype

JSObject* sWormholePrototype
static

Definition at line 33 of file OOJSWormhole.m.

Referenced by InitOOJSWormhole().