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

Go to the source code of this file.

Macros

#define GET_THIS_EXHAUSTPLUME(THISENT)

Enumerations

enum  { kExhaustPlume_size }

Functions

static BOOL JSExhaustPlumeGetExhaustPlumeEntity (JSContext *context, JSObject *jsobj, OOExhaustPlumeEntity **outEntity)
static JSBool ExhaustPlumeGetProperty (JSContext *context, JSObject *this, jsid propID, jsval *value)
static JSBool ExhaustPlumeSetProperty (JSContext *context, JSObject *this, jsid propID, JSBool strict, jsval *value)
static JSBool ExhaustPlumeRemove (JSContext *context, uintN argc, jsval *vp)
void InitOOJSExhaustPlume (JSContext *context, JSObject *global)

Variables

static JSObject * sExhaustPlumePrototype
static JSClass sExhaustPlumeClass
static JSPropertySpec sExhaustPlumeProperties []
static JSFunctionSpec sExhaustPlumeMethods []

Macro Definition Documentation

◆ GET_THIS_EXHAUSTPLUME

#define GET_THIS_EXHAUSTPLUME ( THISENT)
Value:
do { \
return NO; /* Exception */ \
if (OOIsStaleEntity(THISENT)) \
} while (0)
#define EXPECT_NOT(x)
OOINLINE BOOL OOIsStaleEntity(Entity *entity)
Definition OOJSEntity.h:69
static BOOL JSExhaustPlumeGetExhaustPlumeEntity(JSContext *context, JSObject *jsobj, OOExhaustPlumeEntity **outEntity)
#define OOJS_THIS
#define OOJS_RETURN_VOID

Definition at line 193 of file OOJSExhaustPlume.m.

193#define GET_THIS_EXHAUSTPLUME(THISENT) \
194 do { \
195 if (EXPECT_NOT(!JSExhaustPlumeGetExhaustPlumeEntity(context, OOJS_THIS, &THISENT))) \
196 return NO; /* Exception */ \
197 if (OOIsStaleEntity(THISENT)) \
198 OOJS_RETURN_VOID; \
199 } while (0)

Referenced by ExhaustPlumeRemove(), and ExhaustPlumeRemove().

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
kExhaustPlume_size 

Definition at line 56 of file OOJSExhaustPlume.m.

56 {
57 // Property IDs
59};
@ kExhaustPlume_size

Function Documentation

◆ ExhaustPlumeGetProperty()

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

Definition at line 125 of file OOJSExhaustPlume.m.

126{
127 if (!JSID_IS_INT(propID))
128 return YES;
129
130 OOJS_NATIVE_ENTER(context)
131
132 OOExhaustPlumeEntity* entity = nil;
133 id result = nil;
134
135 if (!JSExhaustPlumeGetExhaustPlumeEntity(context, this, &entity))
136 return NO;
137 if (entity == nil) {
138 *value = JSVAL_VOID;
139 return YES;
140 }
141
142 switch (JSID_TO_INT(propID)) {
144 return VectorToJSValue(context, [entity scale], value);
145
146 default:
148 return NO;
149 }
150
151 *value = OOJSValueFromNativeObject(context, result);
152 return YES;
153
155}
#define OOJS_NATIVE_ENTER(cx)
#define OOJS_NATIVE_EXIT
static JSPropertySpec sExhaustPlumeProperties[]
BOOL VectorToJSValue(JSContext *context, Vector vector, jsval *outValue) NONNULL_FUNC
Definition OOJSVector.m:264
OOINLINE jsval OOJSValueFromNativeObject(JSContext *context, id object)
void OOJSReportBadPropertySelector(JSContext *context, JSObject *thisObj, jsid propID, JSPropertySpec *propertySpec)
return nil

References JSExhaustPlumeGetExhaustPlumeEntity(), kExhaustPlume_size, nil, OOJS_NATIVE_ENTER, OOJS_NATIVE_EXIT, OOJSReportBadPropertySelector(), OOJSValueFromNativeObject(), sExhaustPlumeProperties, and VectorToJSValue().

Here is the call graph for this function:

◆ ExhaustPlumeRemove()

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

Definition at line 201 of file OOJSExhaustPlume.m.

202{
203 OOJS_NATIVE_ENTER(context)
204
205 OOExhaustPlumeEntity* thisEnt = nil;
206 GET_THIS_EXHAUSTPLUME(thisEnt);
207
208 ShipEntity* parent = [thisEnt owner];
209 [parent removeExhaust:thisEnt];
210
212
214}
#define GET_THIS_EXHAUSTPLUME(THISENT)
id owner()
Definition Entity.m:548
void removeExhaust:(OOExhaustPlumeEntity *exhaust)

References GET_THIS_EXHAUSTPLUME, nil, OOJS_NATIVE_ENTER, OOJS_NATIVE_EXIT, OOJS_RETURN_VOID, Entity::owner, and ShipEntity::removeExhaust:.

Here is the call graph for this function:

◆ ExhaustPlumeSetProperty()

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

Definition at line 157 of file OOJSExhaustPlume.m.

158{
159 if (!JSID_IS_INT(propID))
160 return YES;
161
162 OOJS_NATIVE_ENTER(context)
163
164 OOExhaustPlumeEntity* entity = nil;
165 Vector vValue;
166
167 if (!JSExhaustPlumeGetExhaustPlumeEntity(context, this, &entity))
168 return NO;
169 if (entity == nil)
170 return YES;
171
172 switch (JSID_TO_INT(propID)) {
174 if (JSValueToVector(context, *value, &vValue)) {
175 [entity setScale:vValue];
176 return YES;
177 }
178 break;
179
180 default:
182 return NO;
183 }
184
185 OOJSReportBadPropertyValue(context, this, propID, sExhaustPlumeProperties, *value);
186 return NO;
187
189}
BOOL JSValueToVector(JSContext *context, jsval value, Vector *outVector) NONNULL_FUNC
Definition OOJSVector.m:341
void OOJSReportBadPropertyValue(JSContext *context, JSObject *thisObj, jsid propID, JSPropertySpec *propertySpec, jsval value)
void setScale:(Vector scale)

References JSExhaustPlumeGetExhaustPlumeEntity(), JSValueToVector(), kExhaustPlume_size, nil, OOJS_NATIVE_ENTER, OOJS_NATIVE_EXIT, OOJSReportBadPropertySelector(), OOJSReportBadPropertyValue(), OOExhaustPlumeEntity::setScale:, and sExhaustPlumeProperties.

Here is the call graph for this function:

◆ InitOOJSExhaustPlume()

void InitOOJSExhaustPlume ( JSContext * context,
JSObject * global )

Definition at line 74 of file OOJSExhaustPlume.m.

75{
79}
OOINLINE JSClass * JSEntityClass(void)
Definition OOJSEntity.h:42
OOINLINE JSObject * JSEntityPrototype(void)
Definition OOJSEntity.h:43
static JSClass sExhaustPlumeClass
static JSObject * sExhaustPlumePrototype
static JSFunctionSpec sExhaustPlumeMethods[]
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(), sExhaustPlumeClass, sExhaustPlumeMethods, sExhaustPlumeProperties, and sExhaustPlumePrototype.

Referenced by OOJavaScriptEngine(Private)::createMainThreadContext.

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

◆ JSExhaustPlumeGetExhaustPlumeEntity()

BOOL JSExhaustPlumeGetExhaustPlumeEntity ( JSContext * context,
JSObject * jsobj,
OOExhaustPlumeEntity ** outEntity )
static

Definition at line 81 of file OOJSExhaustPlume.m.

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

References nil, OOJS_PROFILE_ENTER, and OOJS_PROFILE_EXIT.

Referenced by ExhaustPlumeGetProperty(), ExhaustPlumeGetProperty(), ExhaustPlumeSetProperty(), and ExhaustPlumeSetProperty().

Here is the caller graph for this function:

Variable Documentation

◆ sExhaustPlumeClass

JSClass sExhaustPlumeClass
static
Initial value:
= {
"ExhaustPlume",
JSCLASS_HAS_PRIVATE,
JS_PropertyStub,
JS_PropertyStub,
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
JSCLASS_NO_OPTIONAL_MEMBERS
}
static JSBool ExhaustPlumeGetProperty(JSContext *context, JSObject *this, jsid propID, jsval *value)
static JSBool ExhaustPlumeSetProperty(JSContext *context, JSObject *this, jsid propID, JSBool strict, jsval *value)
void OOJSObjectWrapperFinalize(JSContext *context, JSObject *this)

Definition at line 41 of file OOJSExhaustPlume.m.

41 {
42 "ExhaustPlume",
43 JSCLASS_HAS_PRIVATE,
44
45 JS_PropertyStub, // addProperty
46 JS_PropertyStub, // delProperty
47 ExhaustPlumeGetProperty, // getProperty
48 ExhaustPlumeSetProperty, // setProperty
49 JS_EnumerateStub, // enumerate
50 JS_ResolveStub, // resolve
51 JS_ConvertStub, // convert
52 OOJSObjectWrapperFinalize, // finalize
53 JSCLASS_NO_OPTIONAL_MEMBERS
54};

Referenced by OOExhaustPlumeEntity(OOJavaScriptExtensions)::getJSClass:andPrototype:, InitOOJSExhaustPlume(), and InitOOJSExhaustPlume().

◆ sExhaustPlumeMethods

JSFunctionSpec sExhaustPlumeMethods[]
static
Initial value:
= {
{ "remove", ExhaustPlumeRemove, 0 },
{ 0 }
}
static JSBool ExhaustPlumeRemove(JSContext *context, uintN argc, jsval *vp)

Definition at line 67 of file OOJSExhaustPlume.m.

67 {
68 // JS name Function min args
69 { "remove", ExhaustPlumeRemove, 0 },
70
71 { 0 }
72};

Referenced by InitOOJSExhaustPlume(), and InitOOJSExhaustPlume().

◆ sExhaustPlumeProperties

JSPropertySpec sExhaustPlumeProperties[]
static
Initial value:
= {
{ 0 }
}
#define OOJS_PROP_READWRITE_CB

Definition at line 61 of file OOJSExhaustPlume.m.

61 {
62 // JS name ID flags
64 { 0 }
65};

Referenced by ExhaustPlumeGetProperty(), ExhaustPlumeGetProperty(), ExhaustPlumeSetProperty(), ExhaustPlumeSetProperty(), InitOOJSExhaustPlume(), and InitOOJSExhaustPlume().

◆ sExhaustPlumePrototype

JSObject* sExhaustPlumePrototype
static