Oolite 1.91.0.7645-241119-222d325
|
import "OOJSVector.h"
import "OOJavaScriptEngine.h"
import <objc/objc-runtime.h>
import "OOConstToString.h"
import "OOJSEntity.h"
import "OOJSQuaternion.h"
Go to the source code of this file.
Macros | |
#define | COUNT(FIELD) |
Enumerations | |
enum | { kVector_x , kVector_y , kVector_z } |
Functions | |
static BOOL | GetThisVector (JSContext *context, JSObject *vectorObj, HPVector *outVector, NSString *method) NONNULL_FUNC |
static JSBool | VectorGetProperty (JSContext *context, JSObject *this, jsid propID, jsval *value) |
static JSBool | VectorSetProperty (JSContext *context, JSObject *this, jsid propID, JSBool strict, jsval *value) |
static void | VectorFinalize (JSContext *context, JSObject *this) |
static JSBool | VectorConstruct (JSContext *context, uintN argc, jsval *vp) |
static JSBool | VectorToString (JSContext *context, uintN argc, jsval *vp) |
static JSBool | VectorToSource (JSContext *context, uintN argc, jsval *vp) |
static JSBool | VectorAdd (JSContext *context, uintN argc, jsval *vp) |
static JSBool | VectorSubtract (JSContext *context, uintN argc, jsval *vp) |
static JSBool | VectorDistanceTo (JSContext *context, uintN argc, jsval *vp) |
static JSBool | VectorSquaredDistanceTo (JSContext *context, uintN argc, jsval *vp) |
static JSBool | VectorMultiply (JSContext *context, uintN argc, jsval *vp) |
static JSBool | VectorDot (JSContext *context, uintN argc, jsval *vp) |
static JSBool | VectorAngleTo (JSContext *context, uintN argc, jsval *vp) |
static JSBool | VectorFromCoordinateSystem (JSContext *context, uintN argc, jsval *vp) |
static JSBool | VectorToCoordinateSystem (JSContext *context, uintN argc, jsval *vp) |
static JSBool | VectorCross (JSContext *context, uintN argc, jsval *vp) |
static JSBool | VectorTripleProduct (JSContext *context, uintN argc, jsval *vp) |
static JSBool | VectorDirection (JSContext *context, uintN argc, jsval *vp) |
static JSBool | VectorMagnitude (JSContext *context, uintN argc, jsval *vp) |
static JSBool | VectorSquaredMagnitude (JSContext *context, uintN argc, jsval *vp) |
static JSBool | VectorRotationTo (JSContext *context, uintN argc, jsval *vp) |
static JSBool | VectorRotateBy (JSContext *context, uintN argc, jsval *vp) |
static JSBool | VectorToArray (JSContext *context, uintN argc, jsval *vp) |
static JSBool | VectorStaticInterpolate (JSContext *context, uintN argc, jsval *vp) |
static JSBool | VectorStaticRandom (JSContext *context, uintN argc, jsval *vp) |
static JSBool | VectorStaticRandomDirection (JSContext *context, uintN argc, jsval *vp) |
static JSBool | VectorStaticRandomDirectionAndLength (JSContext *context, uintN argc, jsval *vp) |
void | InitOOJSVector (JSContext *context, JSObject *global) |
JSObject * | JSVectorWithVector (JSContext *context, Vector vector) |
BOOL | VectorToJSValue (JSContext *context, Vector vector, jsval *outValue) |
JSObject * | JSVectorWithHPVector (JSContext *context, HPVector vector) |
BOOL | HPVectorToJSValue (JSContext *context, HPVector vector, jsval *outValue) |
BOOL | NSPointToVectorJSValue (JSContext *context, NSPoint point, jsval *outValue) |
BOOL | JSValueToHPVector (JSContext *context, jsval value, HPVector *outVector) |
BOOL | JSValueToVector (JSContext *context, jsval value, Vector *outVector) |
BOOL | JSObjectGetVector (JSContext *context, JSObject *vectorObj, HPVector *outVector) |
BOOL | JSVectorSetVector (JSContext *context, JSObject *vectorObj, Vector vector) |
BOOL | JSVectorSetHPVector (JSContext *context, JSObject *vectorObj, HPVector vector) |
static BOOL | VectorFromArgumentListNoErrorInternal (JSContext *context, uintN argc, jsval *argv, HPVector *outVector, uintN *outConsumed, BOOL permitNumberList) |
BOOL | VectorFromArgumentList (JSContext *context, NSString *scriptClass, NSString *function, uintN argc, jsval *argv, HPVector *outVector, uintN *outConsumed) |
BOOL | VectorFromArgumentListNoError (JSContext *context, uintN argc, jsval *argv, HPVector *outVector, uintN *outConsumed) |
Variables | |
static JSObject * | sVectorPrototype |
static JSClass | sVectorClass |
static JSPropertySpec | sVectorProperties [] |
static JSFunctionSpec | sVectorMethods [] |
static JSFunctionSpec | sVectorStaticMethods [] |
#define COUNT | ( | FIELD | ) |
Definition at line 325 of file OOJSVector.m.
anonymous enum |
Enumerator | |
---|---|
kVector_x | |
kVector_y | |
kVector_z |
Definition at line 95 of file OOJSVector.m.
|
static |
Definition at line 410 of file OOJSVector.m.
References EXPECT, JSObjectGetVector(), and OOJSReportBadArguments().
Referenced by VectorAdd(), VectorAngleTo(), VectorCross(), VectorDirection(), VectorDistanceTo(), VectorDot(), VectorFromCoordinateSystem(), VectorMagnitude(), VectorMultiply(), VectorRotateBy(), VectorRotationTo(), VectorSquaredDistanceTo(), VectorSquaredMagnitude(), VectorSubtract(), VectorToArray(), VectorToCoordinateSystem(), VectorToSource(), VectorToString(), and VectorTripleProduct().
BOOL HPVectorToJSValue | ( | JSContext * | context, |
HPVector | vector, | ||
jsval * | outValue ) |
Definition at line 228 of file OOJSVector.m.
References EXPECT_NOT, JSVectorWithHPVector(), OOJS_PROFILE_ENTER, and OOJS_PROFILE_EXIT.
Referenced by EntityGetProperty(), and ShipGetProperty().
void InitOOJSVector | ( | JSContext * | context, |
JSObject * | global ) |
Definition at line 153 of file OOJSVector.m.
References sVectorClass, sVectorMethods, sVectorProperties, sVectorPrototype, sVectorStaticMethods, and VectorConstruct().
BOOL JSObjectGetVector | ( | JSContext * | context, |
JSObject * | vectorObj, | ||
HPVector * | outVector ) |
Definition at line 330 of file OOJSVector.m.
References COUNT, EXPECT, EXPECT_NOT, JSEntityClass(), kZeroHPVector, OOJS_PROFILE_ENTER, OOJS_PROFILE_EXIT, OOJSIsMemberOfSubclass(), Entity::position, sVectorClass, x, and y.
Referenced by JSValueToHPVector(), and JSValueToVector().
BOOL JSValueToHPVector | ( | JSContext * | context, |
jsval | value, | ||
HPVector * | outVector ) |
Definition at line 252 of file OOJSVector.m.
References EXPECT_NOT, and JSObjectGetVector().
Referenced by EntitySetProperty(), ShipSetProperty(), and SystemSetWaypoint().
BOOL JSValueToVector | ( | JSContext * | context, |
jsval | value, | ||
Vector * | outVector ) |
Definition at line 259 of file OOJSVector.m.
References EXPECT_NOT, JSObjectGetVector(), and kZeroHPVector.
Referenced by ExhaustPlumeSetProperty(), OOPlanetEntity(OOJavaScriptExtensions)::getJSClass:andPrototype:, MissionRunScreen(), PlayerShipSetCustomView(), PlayerShipSetProperty(), ShipSetProperty(), SoundSourceSetProperty(), SystemSetPopulator(), and VisualEffectSetProperty().
BOOL JSVectorSetHPVector | ( | JSContext * | context, |
JSObject * | vectorObj, | ||
HPVector | vector ) |
Definition at line 426 of file OOJSVector.m.
References EXPECT_NOT, OOJS_PROFILE_ENTER, OOJS_PROFILE_EXIT, and sVectorClass.
Referenced by JSVectorSetVector(), and VectorSetProperty().
BOOL JSVectorSetVector | ( | JSContext * | context, |
JSObject * | vectorObj, | ||
Vector | vector ) |
Definition at line 420 of file OOJSVector.m.
References JSVectorSetHPVector().
JSObject * JSVectorWithHPVector | ( | JSContext * | context, |
HPVector | vector ) |
Definition at line 202 of file OOJSVector.m.
References EXPECT_NOT, OOJS_PROFILE_ENTER, OOJS_PROFILE_EXIT, sVectorClass, and sVectorPrototype.
Referenced by HPVectorToJSValue().
JSObject * JSVectorWithVector | ( | JSContext * | context, |
Vector | vector ) |
Definition at line 159 of file OOJSVector.m.
References EXPECT_NOT, OOJS_PROFILE_ENTER, OOJS_PROFILE_EXIT, sVectorClass, and sVectorPrototype.
Referenced by OOJSCallObjCObjectMethod(), and VectorToJSValue().
BOOL NSPointToVectorJSValue | ( | JSContext * | context, |
NSPoint | point, | ||
jsval * | outValue ) |
Definition at line 246 of file OOJSVector.m.
References VectorToJSValue().
Referenced by PlayerShipGetProperty(), and SystemInfoGetProperty().
|
static |
Definition at line 683 of file OOJSVector.m.
References EXPECT_NOT, GetThisVector(), OOJS_ARGV, OOJS_PROFILE_ENTER, OOJS_PROFILE_EXIT, OOJS_RETURN_HPVECTOR, OOJS_THIS, and VectorFromArgumentList().
|
static |
Definition at line 795 of file OOJSVector.m.
References EXPECT_NOT, GetThisVector(), OOJS_ARGV, OOJS_PROFILE_ENTER, OOJS_PROFILE_EXIT, OOJS_RETURN_DOUBLE, OOJS_THIS, and VectorFromArgumentList().
|
static |
Definition at line 609 of file OOJSVector.m.
References EXPECT_NOT, kZeroHPVector, OOJS_ARGV, OOJS_PROFILE_ENTER, OOJS_PROFILE_EXIT, OOJS_RETURN_JSOBJECT, OOJSReportBadArguments(), sVectorClass, and VectorFromArgumentListNoErrorInternal().
Referenced by InitOOJSVector().
|
static |
Definition at line 819 of file OOJSVector.m.
References EXPECT_NOT, GetThisVector(), OOJS_ARGV, OOJS_PROFILE_ENTER, OOJS_PROFILE_EXIT, OOJS_RETURN_HPVECTOR, OOJS_THIS, and VectorFromArgumentList().
|
static |
Definition at line 861 of file OOJSVector.m.
References EXPECT_NOT, GetThisVector(), OOJS_PROFILE_ENTER, OOJS_PROFILE_EXIT, OOJS_RETURN_HPVECTOR, and OOJS_THIS.
|
static |
Definition at line 719 of file OOJSVector.m.
References EXPECT_NOT, GetThisVector(), OOJS_ARGV, OOJS_PROFILE_ENTER, OOJS_PROFILE_EXIT, OOJS_RETURN_DOUBLE, OOJS_THIS, and VectorFromArgumentList().
|
static |
Definition at line 776 of file OOJSVector.m.
References EXPECT_NOT, GetThisVector(), OOJS_ARGV, OOJS_PROFILE_ENTER, OOJS_PROFILE_EXIT, OOJS_RETURN_DOUBLE, OOJS_THIS, and VectorFromArgumentList().
|
static |
Definition at line 593 of file OOJSVector.m.
References OOJS_PROFILE_ENTER, OOJS_PROFILE_EXIT_VOID, and sVectorClass.
BOOL VectorFromArgumentList | ( | JSContext * | context, |
NSString * | scriptClass, | ||
NSString * | function, | ||
uintN | argc, | ||
jsval * | argv, | ||
HPVector * | outVector, | ||
uintN * | outConsumed ) |
Definition at line 495 of file OOJSVector.m.
References OOJSReportBadArguments(), and VectorFromArgumentListNoErrorInternal().
BOOL VectorFromArgumentListNoError | ( | JSContext * | context, |
uintN | argc, | ||
jsval * | argv, | ||
HPVector * | outVector, | ||
uintN * | outConsumed ) |
Definition at line 508 of file OOJSVector.m.
References VectorFromArgumentListNoErrorInternal().
|
static |
Definition at line 453 of file OOJSVector.m.
References EXPECT_NOT, JSObjectGetVector(), OOJS_PROFILE_ENTER, OOJS_PROFILE_EXIT, x, and y.
Referenced by VectorConstruct(), VectorFromArgumentList(), and VectorFromArgumentListNoError().
|
static |
Definition at line 1027 of file OOJSVector.m.
References EXPECT_NOT, GetThisVector(), MIN, nil, OOJS_ARGV, OOJS_BEGIN_FULL_NATIVE, OOJS_END_FULL_NATIVE, OOJS_NATIVE_ENTER, OOJS_NATIVE_EXIT, OOJS_RETURN_HPVECTOR, OOJS_THIS, OOJSReportBadArguments(), and OOStringFromJSValue().
|
static |
Definition at line 516 of file OOJSVector.m.
References EXPECT_NOT, JSObjectGetVector(), kVector_x, kVector_y, kVector_z, OOJS_PROFILE_ENTER, OOJS_PROFILE_EXIT, OOJSReportBadPropertySelector(), and sVectorProperties.
|
static |
Definition at line 878 of file OOJSVector.m.
References EXPECT_NOT, GetThisVector(), OOJS_PROFILE_ENTER, OOJS_PROFILE_EXIT, OOJS_RETURN_DOUBLE, and OOJS_THIS.
|
static |
Definition at line 757 of file OOJSVector.m.
References EXPECT_NOT, GetThisVector(), OOJS_ARGV, OOJS_PROFILE_ENTER, OOJS_PROFILE_EXIT, OOJS_RETURN_HPVECTOR, OOJS_THIS, and OOJSArgumentListGetNumber().
|
static |
Definition at line 947 of file OOJSVector.m.
References EXPECT_NOT, GetThisVector(), OOJS_ARGV, OOJS_PROFILE_ENTER, OOJS_PROFILE_EXIT, OOJS_RETURN_HPVECTOR, OOJS_THIS, quaternion_rotate_HPvector(), and QuaternionFromArgumentList().
|
static |
Definition at line 914 of file OOJSVector.m.
References EXPECT_NOT, GetThisVector(), OOJS_ARGV, OOJS_PROFILE_ENTER, OOJS_PROFILE_EXIT, OOJS_RETURN_QUATERNION, OOJS_THIS, OOJSArgumentListGetNumber(), quaternion_limited_rotation_between(), quaternion_rotation_between(), and VectorFromArgumentList().
|
static |
Definition at line 552 of file OOJSVector.m.
References EXPECT_NOT, JSObjectGetVector(), JSVectorSetHPVector(), kVector_x, kVector_y, kVector_z, OOJS_PROFILE_ENTER, OOJS_PROFILE_EXIT, OOJSReportBadPropertySelector(), OOJSReportBadPropertyValue(), and sVectorProperties.
|
static |
Definition at line 738 of file OOJSVector.m.
References EXPECT_NOT, GetThisVector(), OOJS_ARGV, OOJS_PROFILE_ENTER, OOJS_PROFILE_EXIT, OOJS_RETURN_DOUBLE, OOJS_THIS, and VectorFromArgumentList().
|
static |
Definition at line 896 of file OOJSVector.m.
References EXPECT_NOT, GetThisVector(), OOJS_PROFILE_ENTER, OOJS_PROFILE_EXIT, OOJS_RETURN_DOUBLE, and OOJS_THIS.
|
static |
Definition at line 1059 of file OOJSVector.m.
References EXPECT_NOT, OOJS_ARGV, OOJS_PROFILE_ENTER, OOJS_PROFILE_EXIT, OOJS_RETURN_HPVECTOR, OOJSArgumentListGetNumber(), OOJSReportBadArguments(), and VectorFromArgumentList().
|
static |
Definition at line 1097 of file OOJSVector.m.
References OOHPVectorRandomSpatial(), OOJS_ARGV, OOJS_PROFILE_ENTER, OOJS_PROFILE_EXIT, OOJS_RETURN_HPVECTOR, and OOJSArgumentListGetNumberNoError().
|
static |
Definition at line 1112 of file OOJSVector.m.
References OOJS_ARGV, OOJS_PROFILE_ENTER, OOJS_PROFILE_EXIT, OOJS_RETURN_HPVECTOR, OOJSArgumentListGetNumberNoError(), and OORandomUnitHPVector().
|
static |
Definition at line 1127 of file OOJSVector.m.
References OOHPVectorRandomRadial(), OOJS_ARGV, OOJS_PROFILE_ENTER, OOJS_PROFILE_EXIT, OOJS_RETURN_HPVECTOR, and OOJSArgumentListGetNumberNoError().
|
static |
Definition at line 701 of file OOJSVector.m.
References EXPECT_NOT, GetThisVector(), OOJS_ARGV, OOJS_PROFILE_ENTER, OOJS_PROFILE_EXIT, OOJS_RETURN_HPVECTOR, OOJS_THIS, and VectorFromArgumentList().
|
static |
Definition at line 966 of file OOJSVector.m.
References EXPECT_NOT, GetThisVector(), OOJS_PROFILE_ENTER, OOJS_PROFILE_EXIT, OOJS_SET_RVAL, and OOJS_THIS.
|
static |
Definition at line 999 of file OOJSVector.m.
References EXPECT_NOT, GetThisVector(), MIN, nil, OOJS_ARGV, OOJS_BEGIN_FULL_NATIVE, OOJS_END_FULL_NATIVE, OOJS_NATIVE_ENTER, OOJS_NATIVE_EXIT, OOJS_RETURN_HPVECTOR, OOJS_THIS, OOJSReportBadArguments(), and OOStringFromJSValue().
BOOL VectorToJSValue | ( | JSContext * | context, |
Vector | vector, | ||
jsval * | outValue ) |
Definition at line 185 of file OOJSVector.m.
References EXPECT_NOT, JSVectorWithVector(), OOJS_PROFILE_ENTER, and OOJS_PROFILE_EXIT.
Referenced by EntityGetProperty(), ExhaustPlumeGetProperty(), NSPointToVectorJSValue(), PlanetGetProperty(), PlayerShipGetProperty(), ShipGetProperty(), SoundSourceGetProperty(), SystemInfoGetProperty(), and VisualEffectGetProperty().
|
static |
Definition at line 667 of file OOJSVector.m.
References EXPECT_NOT, GetThisVector(), OOJS_NATIVE_ENTER, OOJS_NATIVE_EXIT, OOJS_RETURN_OBJECT, and OOJS_THIS.
|
static |
Definition at line 652 of file OOJSVector.m.
References EXPECT_NOT, GetThisVector(), OOJS_NATIVE_ENTER, OOJS_NATIVE_EXIT, OOJS_RETURN_OBJECT, and OOJS_THIS.
|
static |
Definition at line 837 of file OOJSVector.m.
References EXPECT_NOT, GetThisVector(), OOJS_ARGV, OOJS_PROFILE_ENTER, OOJS_PROFILE_EXIT, OOJS_RETURN_DOUBLE, OOJS_THIS, and VectorFromArgumentList().
|
static |
Definition at line 78 of file OOJSVector.m.
Referenced by InitOOJSVector(), JSObjectGetVector(), JSVectorSetHPVector(), JSVectorWithHPVector(), JSVectorWithVector(), VectorConstruct(), and VectorFinalize().
|
static |
Definition at line 114 of file OOJSVector.m.
Referenced by InitOOJSVector().
|
static |
Definition at line 104 of file OOJSVector.m.
Referenced by InitOOJSVector(), VectorGetProperty(), and VectorSetProperty().
|
static |
Definition at line 39 of file OOJSVector.m.
Referenced by InitOOJSVector(), JSVectorWithHPVector(), and JSVectorWithVector().
|
static |
Definition at line 140 of file OOJSVector.m.
Referenced by InitOOJSVector().