Oolite 1.91.0.7644-241112-7f5034b
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 { \
if (EXPECT_NOT(!JSExhaustPlumeGetExhaustPlumeEntity(context, OOJS_THIS, &THISENT))) return NO; /* Exception */ \
} while (0)
#define EXPECT_NOT(x)
OOINLINE BOOL OOIsStaleEntity(Entity *entity)
Definition OOJSEntity.h:71
static BOOL JSExhaustPlumeGetExhaustPlumeEntity(JSContext *context, JSObject *jsobj, OOExhaustPlumeEntity **outEntity)
#define OOJS_THIS
#define OOJS_RETURN_VOID

Definition at line 202 of file OOJSExhaustPlume.m.

202#define GET_THIS_EXHAUSTPLUME(THISENT) do { \
203 if (EXPECT_NOT(!JSExhaustPlumeGetExhaustPlumeEntity(context, OOJS_THIS, &THISENT))) return NO; /* Exception */ \
204 if (OOIsStaleEntity(THISENT)) OOJS_RETURN_VOID; \
205} while (0)

Referenced by OOExhaustPlumeEntity(OOJavaScriptExtensions)::getJSClass:andPrototype:.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
kExhaustPlume_size 

Definition at line 61 of file OOJSExhaustPlume.m.

62{
63 // Property IDs
65};
@ kExhaustPlume_size

Function Documentation

◆ ExhaustPlumeGetProperty()

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

Definition at line 137 of file OOJSExhaustPlume.m.

138{
139 if (!JSID_IS_INT(propID)) return YES;
140
141 OOJS_NATIVE_ENTER(context)
142
143 OOExhaustPlumeEntity *entity = nil;
144 id result = nil;
145
146 if (!JSExhaustPlumeGetExhaustPlumeEntity(context, this, &entity)) return NO;
147 if (entity == nil) { *value = JSVAL_VOID; return YES; }
148
149 switch (JSID_TO_INT(propID))
150 {
152 return VectorToJSValue(context, [entity scale], value);
153
154 default:
156 return NO;
157 }
158
159 *value = OOJSValueFromNativeObject(context, result);
160 return YES;
161
163}
#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:185
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()

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

Definition at line 208 of file OOJSExhaustPlume.m.

209{
210 OOJS_NATIVE_ENTER(context)
211
212 OOExhaustPlumeEntity *thisEnt = nil;
213 GET_THIS_EXHAUSTPLUME(thisEnt);
214
215 ShipEntity *parent = [thisEnt owner];
216 [parent removeExhaust:thisEnt];
217
219
221}
#define GET_THIS_EXHAUSTPLUME(THISENT)
id owner()
Definition Entity.m:583
void removeExhaust:(OOExhaustPlumeEntity *exhaust)

◆ ExhaustPlumeSetProperty()

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

Definition at line 166 of file OOJSExhaustPlume.m.

167{
168 if (!JSID_IS_INT(propID)) return YES;
169
170 OOJS_NATIVE_ENTER(context)
171
172 OOExhaustPlumeEntity *entity = nil;
173 Vector vValue;
174
175 if (!JSExhaustPlumeGetExhaustPlumeEntity(context, this, &entity)) return NO;
176 if (entity == nil) return YES;
177
178 switch (JSID_TO_INT(propID))
179 {
181 if (JSValueToVector(context, *value, &vValue))
182 {
183 [entity setScale:vValue];
184 return YES;
185 }
186 break;
187
188 default:
190 return NO;
191 }
192
193 OOJSReportBadPropertyValue(context, this, propID, sExhaustPlumeProperties, *value);
194 return NO;
195
197}
BOOL JSValueToVector(JSContext *context, jsval value, Vector *outVector) NONNULL_FUNC
Definition OOJSVector.m:259
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 85 of file OOJSExhaustPlume.m.

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

+ Here is the call graph for this function:

◆ JSExhaustPlumeGetExhaustPlumeEntity()

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

Definition at line 93 of file OOJSExhaustPlume.m.

94{
96
97 BOOL result;
98 Entity *entity = nil;
99
100 if (outEntity == NULL) return NO;
101 *outEntity = nil;
102
103 result = OOJSEntityGetEntity(context, jsobj, &entity);
104 if (!result) return NO;
105
106 if (![entity isKindOfClass:[OOExhaustPlumeEntity class]]) return NO;
107
108 *outEntity = (OOExhaustPlumeEntity *)entity;
109 return YES;
110
112}
#define OOJS_PROFILE_EXIT
#define OOJS_PROFILE_ENTER

References nil, OOJS_PROFILE_ENTER, and OOJS_PROFILE_EXIT.

Referenced by ExhaustPlumeGetProperty(), 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 44 of file OOJSExhaustPlume.m.

45{
46 "ExhaustPlume",
47 JSCLASS_HAS_PRIVATE,
48
49 JS_PropertyStub, // addProperty
50 JS_PropertyStub, // delProperty
51 ExhaustPlumeGetProperty, // getProperty
52 ExhaustPlumeSetProperty, // setProperty
53 JS_EnumerateStub, // enumerate
54 JS_ResolveStub, // resolve
55 JS_ConvertStub, // convert
57 JSCLASS_NO_OPTIONAL_MEMBERS
58};

Referenced by InitOOJSExhaustPlume().

◆ sExhaustPlumeMethods

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

Definition at line 76 of file OOJSExhaustPlume.m.

77{
78 // JS name Function min args
79 { "remove", ExhaustPlumeRemove, 0 },
80
81 { 0 }
82};

Referenced by InitOOJSExhaustPlume().

◆ sExhaustPlumeProperties

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

Definition at line 68 of file OOJSExhaustPlume.m.

69{
70 // JS name ID flags
72 { 0 }
73};

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

◆ sExhaustPlumePrototype

JSObject* sExhaustPlumePrototype
static

Definition at line 33 of file OOJSExhaustPlume.m.

Referenced by InitOOJSExhaustPlume().