Oolite
Loading...
Searching...
No Matches
OOJavaScriptEngine.h File Reference
import "OOFoundation.h"
import "OOTypes.h"
#include <quickjs.h>
import "PlayerEntity.h"
import "PlayerEntityLegacyScriptEngine.h"
import "Universe.h"
import "OOJSPropID.h"
Include dependency graph for OOJavaScriptEngine.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  OOJavaScriptEngine
category  NSObject(OOJavaScript)
class  OOJSValue
category  NSString(OOJavaScriptExtensions)
struct  JSFunctionPredicateParameter

Macros

#define OOJS_QUICKJS   1
#define OOJSENGINE_MONITOR_SUPPORT   OO_DEBUG_MONITOR_ENABLED
#define OOJS_PROFILE   (OOLITE_DEBUG && !OOJS_POC_HARNESS)
#define OOJS_COUNT(array)
#define OOJSFreeValue(context, value)
#define OOJSUndefinedValue()
#define OOJSNullValue()
#define OOJSSTR(str)
#define DEFINE_JS_OBJECT_GETTER(NAME, JSCLASSID, OBJCCLASSNAME)
#define kOOJSLongTimeLimit   (5.0)
#define OOJSStartTimeLimiter()
#define OOJSDumpStack(cx)
#define OOJS_NATIVE_ARGS   JSContext *context, JSValueConst oojsThis, int argc, JSValueConst *oojsArgv
#define OOJS_GETTER_ARGS   JSContext *context, JSValueConst this, int magic
#define OOJS_SETTER_ARGS   JSContext *context, JSValueConst this, JSValueConst value, int magic
#define OOJS_THIS   oojsThis
#define OOJS_ARGV   oojsArgv
#define OOJS_IS_CONSTRUCTING   (!JS_IsUndefined(OOJS_THIS))
#define OOJS_RETURN(v)
#define OOJS_RETURN_VOID   OOJS_RETURN(JS_UNDEFINED)
#define OOJS_RETURN_NULL   OOJS_RETURN(JS_NULL)
#define OOJS_RETURN_BOOL(v)
#define OOJS_RETURN_INT(v)
#define OOJS_RETURN_DOUBLE(v)
#define OOJS_RETURN_OBJECT(o)
#define OOJS_RETURN_WITH_HELPER(helper, value)
#define OOJS_RETURN_VECTOR(value)
#define OOJS_RETURN_HPVECTOR(value)
#define OOJS_RETURN_QUATERNION(value)
#define OOJS_PROFILE_ENTER_NAMED(NAME)
#define OOJS_PROFILE_EXIT   }
#define OOJS_NATIVE_ENTER(cx)
#define OOJS_NATIVE_EXIT
#define OOJS_PROFILE_ENTER   OOJS_PROFILE_ENTER_NAMED(__FUNCTION__)
#define OOJS_PROFILE_EXIT_VOID   OOJS_PROFILE_EXIT
#define OOJS_BEGIN_FULL_NATIVE(context)
#define OOJS_END_FULL_NATIVE
#define OOJS_PROP_READWRITE_CB   JS_PROP_ENUMERABLE
#define OOJS_PROP_READONLY_CB   JS_PROP_ENUMERABLE
#define OOJS_PROP_HIDDEN_READWRITE_CB   0
#define OOJS_PROP_HIDDEN_READONLY_CB   0
#define OOJS_PROP_READWRITE   (JS_PROP_ENUMERABLE | JS_PROP_WRITABLE)
#define OOJS_PROP_READONLY   JS_PROP_ENUMERABLE
#define OOJS_PROP_HIDDEN_READWRITE   JS_PROP_WRITABLE
#define OOJS_PROP_HIDDEN_READONLY   0
#define OOJS_METHOD_READONLY   OOJS_PROP_HIDDEN_READONLY
#define OOJS_PROPERTY_RW(name, getter, setter, magic)
#define OOJS_PROPERTY_RO(name, getter, magic)

Typedefs

typedef JSRuntime OOJSInterruptHandlerArg
typedef id(* OOJSClassConverterCallback) (JSContext *context, JSValueConst object)

Enumerations

enum  { kOOJSMaxClassID = 1 << 16 }

Functions

OOINLINE JSContext * OOJSAcquireContext (void)
OOINLINE void OOJSRelinquishContext (JSContext *context)
OOINLINE BOOL OOJSValueIsUndefined (JSValueConst value)
OOINLINE JSValue OOJSValueFromDouble (JSContext *context, double value)
BOOL OOJSValueToBOOL (JSContext *context, JSValueConst value)
BOOL OOJSValueToInt32 (JSContext *context, JSValueConst value, int32_t *outValue)
NSString * OOJSWrapScriptSource (NSString *source)
JSValueConst OOJSLegacyConstRewriter (void)
void OOJSReportPendingException (JSContext *context)
void OOJSReportError (JSContext *context, NSString *format,...)
void OOJSReportErrorWithArguments (JSContext *context, NSString *format, va_list args)
void OOJSReportErrorForCaller (JSContext *context, NSString *scriptClass, NSString *function, NSString *format,...)
void OOJSReportWarning (JSContext *context, NSString *format,...)
void OOJSReportWarningWithArguments (JSContext *context, NSString *format, va_list args)
void OOJSReportWarningForCaller (JSContext *context, NSString *scriptClass, NSString *function, NSString *format,...)
NSString * OOStringFromJSPropertyMagic (int magic, const JSCFunctionListEntry *list, size_t count)
void OOJSReportBadPropertySelector (JSContext *context, JSValueConst thisObj, int magic, const JSCFunctionListEntry *list, size_t count)
void OOJSReportBadPropertyValue (JSContext *context, JSValueConst thisObj, int magic, const JSCFunctionListEntry *list, size_t count, JSValueConst value)
void OOJSReportBadArguments (JSContext *context, NSString *scriptClass, NSString *function, int argc, JSValueConst *argv, NSString *message, NSString *expectedArgsDescription)
void OOJSReportWrappedException (JSContext *context, id exception)
JSValue OOJSNativeFailure (JSContext *context)
void OOJSSetWarningOrErrorStackSkip (unsigned skip)
BOOL OOJSArgumentListGetNumber (JSContext *context, NSString *scriptClass, NSString *function, int argc, JSValueConst *argv, double *outNumber, int *outConsumed)
BOOL OOJSArgumentListGetNumberNoError (JSContext *context, int argc, JSValueConst *argv, double *outNumber, int *outConsumed)
OOINLINE JSValue OOJSValueFromBOOL (int b)
OOINLINE JSValue OOJSValueFromNativeObject (JSContext *context, id object)
JSValue OOJSObjectFromNativeObject (JSContext *context, id object)
NSString * OOStringFromJSValue (JSContext *context, JSValueConst value)
NSString * OOStringFromJSValueEvenIfNull (JSContext *context, JSValueConst value)
NSString * OOJSDescribeValue (JSContext *context, JSValueConst value, BOOL abbreviateObjects)
NSString * OOJSClassNameOfValue (JSContext *context, JSValueConst value)
NSString * OOStringFromJSID (JSAtom propID)
JSAtom OOJSIDFromString (NSString *string)
BOOL JSFunctionPredicate (Entity *entity, void *parameter)
BOOL JSEntityIsJavaScriptVisiblePredicate (Entity *entity, void *parameter)
BOOL JSEntityIsJavaScriptSearchablePredicate (Entity *entity, void *parameter)
BOOL JSEntityIsDemoShipPredicate (Entity *entity, void *parameter)
id OOJSNativeObjectFromJSValue (JSContext *context, JSValueConst value)
id OOJSNativeObjectFromJSObject (JSContext *context, JSValueConst object)
id OOJSNativeObjectOfClassFromJSValue (JSContext *context, JSValueConst value, Class requiredClass)
id OOJSNativeObjectOfClassFromJSObject (JSContext *context, JSValueConst object, Class requiredClass)
OOINLINE BOOL OOJSValueIsFunction (JSContext *context, JSValueConst value)
OOINLINE BOOL OOJSValueIsArray (JSContext *context, JSValueConst value)
NSDictionary * OOJSDictionaryFromJSValue (JSContext *context, JSValueConst value)
NSDictionary * OOJSDictionaryFromJSObject (JSContext *context, JSValueConst object)
NSDictionary * OOJSDictionaryFromStringTable (JSContext *context, JSValueConst value)
JSClassID OOJSRegisterClass (JSClassID *ioClassID, const JSClassDef *classDef)
JSValue OOJSObjectPrototype (JSContext *context)
const char * OOJSClassName (JSClassID classID)
void OOJSRegisterSubclass (JSClassID subclass, JSClassID superclass)
BOOL OOJSIsSubclass (JSClassID putativeSubclass, JSClassID superclass)
OOINLINE BOOL OOJSIsMemberOfSubclass (JSContext *context, JSValueConst object, JSClassID superclass)
int OOJSGetSharedPermanentOwnProperty (JSContext *context, JSPropertyDescriptor *desc, JSValueConst object, JSAtom prop)
int OOJSGetSharedPermanentOwnPropertyNames (JSContext *context, JSPropertyEnum **ptab, uint32_t *plen, JSValueConst object)
JSValueConst OOJSInitClass (JSContext *context, JSValueConst global, JSClassID classID, JSValueConst parentPrototype, JSCFunction *constructor, int constructorArgCount, const JSCFunctionListEntry *properties, size_t propertyCount, const JSCFunctionListEntry *methods, size_t methodCount, const JSCFunctionListEntry *staticMethods, size_t staticMethodCount)
BOOL OOJSObjectGetterImplPRIVATE (JSContext *context, JSValueConst object, JSClassID requiredClassID, Class requiredObjCClass, const char *name, id *outObject)
id OOJSBasicPrivateObjectConverter (JSContext *context, JSValueConst object)
void OOJSRegisterObjectConverter (JSClassID classID, OOJSClassConverterCallback converter)
void OOJSStartTimeLimiterWithTimeLimit (OOTimeDelta limit)
void OOJSStopTimeLimiter (void)
void OOJSPauseTimeLimiter (void)
void OOJSResumeTimeLimiter (void)
void OOJSResetTimeLimiter (void)
OOTimeDelta OOJSGetTimeLimiterLimit (void)
void OOJSSetTimeLimiterLimit (OOTimeDelta limit)
JSValue OOJSUnconstructableConstruct (JSContext *context, JSValueConst this, int argc, JSValueConst *argv)
void OOJSObjectWrapperFinalize (JSRuntime *runtime, JSValueConst this)
JSValue OOJSObjectWrapperToString (JSContext *context, JSValueConst this, int argc, JSValueConst *argv)

Variables

NSString *const kOOJavaScriptEngineWillResetNotification
NSString *const kOOJavaScriptEngineDidResetNotification
JSClassID gOOJSObjectClassID
JSClassID gOOJSStringClassID
JSClassID gOOJSArrayClassID
JSClassID gOOJSNumberClassID
JSClassID gOOJSBooleanClassID

Macro Definition Documentation

◆ DEFINE_JS_OBJECT_GETTER

#define DEFINE_JS_OBJECT_GETTER ( NAME,
JSCLASSID,
OBJCCLASSNAME )
Value:
static BOOL NAME(JSContext* context, JSValueConst inObject, OBJCCLASSNAME** outObject) GCC_ATTR((unused)); \
static BOOL NAME(JSContext* context, JSValueConst inObject, OBJCCLASSNAME** outObject) \
{ \
NSCParameterAssert(outObject != NULL); \
static Class cls = Nil; \
if (EXPECT_NOT(cls == Nil)) \
cls = [OBJCCLASSNAME class]; \
return OOJSObjectGetterImplPRIVATE(context, inObject, (JSCLASSID), cls, #NAME, (id*)outObject); \
}
#define EXPECT_NOT(x)
#define GCC_ATTR(x)
BOOL OOJSObjectGetterImplPRIVATE(JSContext *context, JSObject *object, JSClass *requiredJSClass, Class requiredObjCClass, const char *name, id *outObject)

Definition at line 561 of file OOJavaScriptEngine.h.

561#define DEFINE_JS_OBJECT_GETTER(NAME, JSCLASSID, OBJCCLASSNAME) \
562 static BOOL NAME(JSContext* context, JSValueConst inObject, OBJCCLASSNAME** outObject) GCC_ATTR((unused)); \
563 static BOOL NAME(JSContext* context, JSValueConst inObject, OBJCCLASSNAME** outObject) \
564 { \
565 NSCParameterAssert(outObject != NULL); \
566 static Class cls = Nil; \
567 if (EXPECT_NOT(cls == Nil)) \
568 cls = [OBJCCLASSNAME class]; \
569 return OOJSObjectGetterImplPRIVATE(context, inObject, (JSCLASSID), cls, #NAME, (id*)outObject); \
570 }

◆ kOOJSLongTimeLimit

#define kOOJSLongTimeLimit   (5.0)

Definition at line 593 of file OOJavaScriptEngine.h.

◆ OOJS_ARGV

#define OOJS_ARGV   oojsArgv

Definition at line 658 of file OOJavaScriptEngine.h.

◆ OOJS_BEGIN_FULL_NATIVE

#define OOJS_BEGIN_FULL_NATIVE ( context)
Value:
{ \
(void)(context); \
OOJSPauseTimeLimiter(); \
@try {

Definition at line 777 of file OOJavaScriptEngine.h.

777#define OOJS_BEGIN_FULL_NATIVE(context) \
778 { \
779 (void)(context); \
780 OOJSPauseTimeLimiter(); \
781 @try {

◆ OOJS_COUNT

#define OOJS_COUNT ( array)
Value:
(sizeof(array) / sizeof *(array))

Definition at line 93 of file OOJavaScriptEngine.h.

Referenced by ClockGetProperty(), DockGetProperty(), DockSetProperty(), EntityGetProperty(), EntitySetProperty(), EquipmentInfoGetProperty(), EquipmentInfoSetProperty(), ExhaustPlumeGetProperty(), ExhaustPlumeSetProperty(), FlasherGetProperty(), FlasherSetProperty(), GlobalGetProperty(), InitOOJSClock(), InitOOJSDock(), InitOOJSEntity(), InitOOJSEquipmentInfo(), InitOOJSExhaustPlume(), InitOOJSFlasher(), InitOOJSFrameCallbacks(), InitOOJSManifest(), InitOOJSMission(), InitOOJSOolite(), InitOOJSPlanet(), InitOOJSPlayer(), InitOOJSPlayerShip(), InitOOJSQuaternion(), InitOOJSScript(), InitOOJSShip(), InitOOJSShipGroup(), InitOOJSSound(), InitOOJSSoundSource(), InitOOJSStation(), InitOOJSSun(), InitOOJSSystem(), InitOOJSSystemInfo(), InitOOJSTimer(), InitOOJSVector(), InitOOJSVisualEffect(), InitOOJSWaypoint(), InitOOJSWormhole(), JSSpecialFunctionsObjectWrapper(), ManifestGetProperty(), MissionGetProperty(), MissionSetProperty(), OoliteGetProperty(), OoliteSetProperty(), PlanetGetProperty(), PlanetSetProperty(), PlayerGetProperty(), PlayerSetProperty(), PlayerShipGetProperty(), PlayerShipSetProperty(), QuaternionGetProperty(), QuaternionSetProperty(), RegisterStandardObjectConverters(), SetUpOOJSGlobal(), ShipGetProperty(), ShipGroupGetProperty(), ShipGroupSetProperty(), ShipSetProperty(), SoundGetProperty(), SoundSourceGetProperty(), SoundSourceSetProperty(), StationGetProperty(), StationSetProperty(), SunGetProperty(), SystemGetProperty(), SystemInfoGetProperty(), SystemSetProperty(), TimerGetProperty(), TimerSetProperty(), VectorGetProperty(), VectorSetProperty(), VisualEffectGetProperty(), VisualEffectSetProperty(), WaypointGetProperty(), WaypointSetProperty(), and WormholeGetProperty().

◆ OOJS_END_FULL_NATIVE

#define OOJS_END_FULL_NATIVE
Value:
} \
@finally \
{ \
OOJSResumeTimeLimiter(); \
} \
}

Definition at line 783 of file OOJavaScriptEngine.h.

783#define OOJS_END_FULL_NATIVE \
784 } \
785 @finally \
786 { \
787 OOJSResumeTimeLimiter(); \
788 } \
789 }

◆ OOJS_GETTER_ARGS

◆ OOJS_IS_CONSTRUCTING

#define OOJS_IS_CONSTRUCTING   (!JS_IsUndefined(OOJS_THIS))

Definition at line 665 of file OOJavaScriptEngine.h.

Referenced by ShipGroupConstruct(), SoundSourceConstruct(), and TimerConstruct().

◆ OOJS_METHOD_READONLY

#define OOJS_METHOD_READONLY   OOJS_PROP_HIDDEN_READONLY

Definition at line 804 of file OOJavaScriptEngine.h.

◆ OOJS_NATIVE_ARGS

#define OOJS_NATIVE_ARGS   JSContext *context, JSValueConst oojsThis, int argc, JSValueConst *oojsArgv

Definition at line 654 of file OOJavaScriptEngine.h.

Referenced by ClockAddSeconds(), ClockClockStringForTime(), DockIsQueued(), EquipmentInfoStaticInfoForKey(), ExhaustPlumeRemove(), FlasherRemove(), FontMeasureString(), GlobalAddFrameCallback(), GlobalAutoAIForRole(), GlobalClearExtraGuiScreenKeys(), GlobalDisplayNameForCommodity(), GlobalExpandDescription(), GlobalExpandMissionText(), GlobalGetGuiColorSettingForKey(), GlobalGetScreenBackgroundForKey(), GlobalIsValidFrameCallback(), GlobalKeyBindingDescription(), GlobalLog(), GlobalLog(), GlobalPauseGame(), GlobalRandomInhabitantsDescription(), GlobalRandomName(), GlobalRemoveFrameCallback(), GlobalSetExtraGuiScreenKeys(), GlobalSetGuiColorSettingForKey(), GlobalSetScreenBackground(), GlobalSetScreenBackgroundForKey(), GlobalSetScreenOverlay(), JSClockToString(), ManifestComment(), ManifestSetComment(), ManifestSetShortComment(), ManifestShortComment(), MissionAddMessageText(), MissionMarkSystem(), MissionRunScreen(), MissionRunShipLibrary(), MissionSetInstructions(), MissionSetInstructionsKey(), MissionUnmarkSystem(), OoliteCompareVersion(), PlayerAddMessageToArrivalReport(), PlayerAudioMessage(), PlayerCommsMessage(), PlayerConsoleMessage(), PlayerDecreaseContractReputation(), PlayerDecreaseParcelReputation(), PlayerDecreasePassengerReputation(), PlayerEndScenario(), PlayerIncreaseContractReputation(), PlayerIncreaseParcelReputation(), PlayerIncreasePassengerReputation(), PlayerReplaceShip(), PlayerSetEscapePodDestination(), PlayerSetPlayerRole(), PlayerShipAddParcel(), PlayerShipAddPassenger(), PlayerShipAwardContract(), PlayerShipAwardEquipmentToCurrentPylon(), PlayerShipBeginGalacticHyperspaceCountdown(), PlayerShipBeginHyperspaceCountdown(), PlayerShipCancelDockingRequest(), PlayerShipCancelHyperspaceCountdown(), PlayerShipDisengageAutopilot(), PlayerShipEngageAutopilotToStation(), PlayerShipHideHUDSelector(), PlayerShipLaunch(), PlayerShipRemoveAllCargo(), PlayerShipRemoveContract(), PlayerShipRemoveParcel(), PlayerShipRemovePassenger(), PlayerShipRequestDockingClearance(), PlayerShipResetCustomView(), PlayerShipResetScannerZoom(), PlayerShipSetCustomHUDDial(), PlayerShipSetCustomView(), PlayerShipSetMultiFunctionDisplay(), PlayerShipSetMultiFunctionText(), PlayerShipSetPrimedEquipment(), PlayerShipShowHUDSelector(), PlayerShipTakeInternalDamage(), PlayerShipUseSpecialCargo(), PlayerStopAudioMessage(), QuaternionConjugate(), QuaternionDot(), QuaternionMultiply(), QuaternionNormalize(), QuaternionRotate(), QuaternionRotateX(), QuaternionRotateY(), QuaternionRotateZ(), QuaternionStaticRandom(), QuaternionToArray(), QuaternionToSource(), QuaternionToString(), QuaternionVectorForward(), QuaternionVectorRight(), QuaternionVectorUp(), RemoveOrExplodeShip(), ShipAbandonShip(), ShipAddCargoEntity(), ShipAddCollisionException(), ShipAddDefenseTarget(), ShipAdjustCargo(), ShipAwardEquipment(), ShipBecomeCascadeExplosion(), ShipBroadcastCascadeImminent(), ShipBroadcastDistressMessage(), ShipCanAwardEquipment(), ShipCheckCourseToDestination(), ShipCheckScanner(), ShipClearDefenseTargets(), ShipCommsMessage(), ShipDamageAssessment(), ShipDealEnergyDamage(), ShipDeployEscorts(), ShipDockEscorts(), ShipDumpCargo(), ShipEjectItem(), ShipEjectSpecificItem(), ShipEnterWormhole(), ShipEquipmentStatus(), ShipExitAI(), ShipExitSystem(), ShipExplode(), ShipFindNearestStation(), ShipFireECM(), ShipFireMissile(), ShipGetMaterials(), ShipGetSafeCourseToDestination(), ShipGetShaders(), ShipGroupAddShip(), ShipGroupConstruct(), ShipGroupContainsShip(), ShipGroupRemoveShip(), ShipHasEquipmentProviding(), ShipHasRole(), ShipMarkTargetForFines(), ShipNotifyGroupOfWormhole(), ShipOfferToEscort(), ShipPatrolReportIn(), ShipPerformAttack(), ShipPerformCollect(), ShipPerformEscort(), ShipPerformFaceDestination(), ShipPerformFlee(), ShipPerformFlyToRangeFromDestination(), ShipPerformHold(), ShipPerformIdle(), ShipPerformIntercept(), ShipPerformLandOnPlanet(), ShipPerformMining(), ShipPerformScriptedAI(), ShipPerformScriptedAttackAI(), ShipPerformStop(), ShipPerformTumble(), ShipReactToAIMessage(), ShipRecallDockingInstructions(), ShipRemove(), ShipRemoveCollisionException(), ShipRemoveDefenseTarget(), ShipRemoveEquipment(), ShipRequestDockingInstructions(), ShipRequestHelpFromGroup(), ShipRestoreSubEntities(), ShipRunLegacyScriptActions(), ShipSelectNewMissile(), ShipSendAIMessage(), ShipSetAI(), ShipSetBounty(), ShipSetCargo(), ShipSetCargoType(), ShipSetCrew(), ShipSetEquipmentStatus(), ShipSetMaterials(), ShipSetMaterialsInternal(), ShipSetScript(), ShipSetShaders(), ShipSpawn(), ShipStaticKeys(), ShipStaticKeysForRole(), ShipStaticRoleIsInCategory(), ShipStaticRoles(), ShipStaticSetShipDataForKey(), ShipStaticShipDataForKey(), ShipSwitchAI(), ShipThreatAssessment(), ShipThrowSpark(), ShipUpdateEscortFormation(), SoundSourceConstruct(), SoundSourcePlay(), SoundSourcePlayOrRepeat(), SoundSourceStop(), SoundStaticLoad(), SoundStaticMusicSoundSource(), SoundStaticPlayMusic(), SoundStaticStopMusic(), SpecialJSWarning(), StationAbortAllDockings(), StationAbortDockingForShip(), StationAddShipToShipyard(), StationCanDockShip(), StationDecreaseAlertLevel(), StationDockPlayer(), StationIncreaseAlertLevel(), StationLaunchDefenseShip(), StationLaunchEscort(), StationLaunchMiner(), StationLaunchPatrol(), StationLaunchPirateShip(), StationLaunchPolice(), StationLaunchScavenger(), StationLaunchShipWithRole(), StationLaunchShuttle(), StationRemoveShipFromShipyard(), StationSetInterface(), StationSetMarketPrice(), StationSetMarketQuantity(), SunCancelNova(), SunGoNova(), SystemAddGroup(), SystemAddGroupToRoute(), SystemAddMoon(), SystemAddPlanet(), SystemAddShips(), SystemAddShipsToRoute(), SystemAddVisualEffect(), SystemCountEntitiesWithScanClass(), SystemCountShipsWithPrimaryRole(), SystemCountShipsWithRole(), SystemEntitiesWithScanClass(), SystemFilteredEntities(), SystemInfoDistanceToSystem(), SystemInfoRouteToSystem(), SystemInfoSamplePrice(), SystemInfoSetPropertyMethod(), SystemInfoStaticFilteredSystems(), SystemInfoStaticSetInterstellarProperty(), SystemLegacyAddShips(), SystemLegacyAddShipsAt(), SystemLegacyAddShipsAtPrecisely(), SystemLegacyAddShipsWithinRadius(), SystemLegacyAddSystemShips(), SystemLegacySpawnShip(), SystemLocationFromCode(), SystemSendAllShipsAway(), SystemSetPopulator(), SystemSetWaypoint(), SystemShipsWithPrimaryRole(), SystemShipsWithRole(), SystemStaticInfoForSystem(), SystemStaticSystemIDForName(), SystemStaticSystemNameForID(), SystemToString(), TimerConstruct(), TimerStart(), TimerStop(), VectorAdd(), VectorAngleTo(), VectorCross(), VectorDirection(), VectorDistanceTo(), VectorDot(), VectorFromCoordinateSystem(), VectorMagnitude(), VectorMultiply(), VectorRotateBy(), VectorRotationTo(), VectorSquaredDistanceTo(), VectorSquaredMagnitude(), VectorStaticInterpolate(), VectorStaticRandom(), VectorStaticRandomDirection(), VectorStaticRandomDirectionAndLength(), VectorSubtract(), VectorToArray(), VectorToCoordinateSystem(), VectorToSource(), VectorToString(), VectorTripleProduct(), VisualEffectGetMaterials(), VisualEffectGetShaders(), VisualEffectRemove(), VisualEffectRestoreSubEntities(), VisualEffectScale(), VisualEffectSetMaterials(), VisualEffectSetMaterialsInternal(), and VisualEffectSetShaders().

◆ OOJS_NATIVE_ENTER

#define OOJS_NATIVE_ENTER ( cx)
Value:
{ \
JSContext* oojsNativeContext = (cx); \
@try {

Definition at line 758 of file OOJavaScriptEngine.h.

758#define OOJS_NATIVE_ENTER(cx) \
759 { \
760 JSContext* oojsNativeContext = (cx); \
761 @try {

◆ OOJS_NATIVE_EXIT

#define OOJS_NATIVE_EXIT
Value:
} \
@catch (id exception) \
{ \
OOJSReportWrappedException(oojsNativeContext, exception); \
return JS_EXCEPTION; \
} \
}

Definition at line 763 of file OOJavaScriptEngine.h.

763#define OOJS_NATIVE_EXIT \
764 } \
765 @catch (id exception) \
766 { \
767 OOJSReportWrappedException(oojsNativeContext, exception); \
768 return JS_EXCEPTION; \
769 } \
770 }

◆ OOJS_PROFILE

#define OOJS_PROFILE   (OOLITE_DEBUG && !OOJS_POC_HARNESS)

Definition at line 90 of file OOJavaScriptEngine.h.

◆ OOJS_PROFILE_ENTER

#define OOJS_PROFILE_ENTER   OOJS_PROFILE_ENTER_NAMED(__FUNCTION__)

◆ OOJS_PROFILE_ENTER_NAMED

#define OOJS_PROFILE_ENTER_NAMED ( NAME)
Value:
{

Definition at line 755 of file OOJavaScriptEngine.h.

Referenced by OOJSObjectGetterImplPRIVATE().

◆ OOJS_PROFILE_EXIT

#define OOJS_PROFILE_EXIT   }

Definition at line 756 of file OOJavaScriptEngine.h.

Referenced by OOJSValue::valueWithJSObject:inContext:.

◆ OOJS_PROFILE_EXIT_VOID

#define OOJS_PROFILE_EXIT_VOID   OOJS_PROFILE_EXIT

Definition at line 775 of file OOJavaScriptEngine.h.

◆ OOJS_PROP_HIDDEN_READONLY

#define OOJS_PROP_HIDDEN_READONLY   0

Definition at line 803 of file OOJavaScriptEngine.h.

◆ OOJS_PROP_HIDDEN_READONLY_CB

#define OOJS_PROP_HIDDEN_READONLY_CB   0

Definition at line 797 of file OOJavaScriptEngine.h.

◆ OOJS_PROP_HIDDEN_READWRITE

#define OOJS_PROP_HIDDEN_READWRITE   JS_PROP_WRITABLE

Definition at line 802 of file OOJavaScriptEngine.h.

◆ OOJS_PROP_HIDDEN_READWRITE_CB

#define OOJS_PROP_HIDDEN_READWRITE_CB   0

Definition at line 796 of file OOJavaScriptEngine.h.

◆ OOJS_PROP_READONLY

#define OOJS_PROP_READONLY   JS_PROP_ENUMERABLE

Definition at line 801 of file OOJavaScriptEngine.h.

◆ OOJS_PROP_READONLY_CB

#define OOJS_PROP_READONLY_CB   JS_PROP_ENUMERABLE

Definition at line 795 of file OOJavaScriptEngine.h.

◆ OOJS_PROP_READWRITE

#define OOJS_PROP_READWRITE   (JS_PROP_ENUMERABLE | JS_PROP_WRITABLE)

Definition at line 800 of file OOJavaScriptEngine.h.

◆ OOJS_PROP_READWRITE_CB

#define OOJS_PROP_READWRITE_CB   JS_PROP_ENUMERABLE

Definition at line 794 of file OOJavaScriptEngine.h.

◆ OOJS_PROPERTY_RO

#define OOJS_PROPERTY_RO ( name,
getter,
magic )
Value:
JS_CGETSET_MAGIC_DEF2(name, getter, NULL, magic, OOJS_PROP_READONLY_CB)
#define OOJS_PROP_READONLY_CB

Definition at line 808 of file OOJavaScriptEngine.h.

◆ OOJS_PROPERTY_RW

#define OOJS_PROPERTY_RW ( name,
getter,
setter,
magic )
Value:
JS_CGETSET_MAGIC_DEF2(name, getter, setter, magic, OOJS_PROP_READWRITE_CB)
#define OOJS_PROP_READWRITE_CB

Definition at line 807 of file OOJavaScriptEngine.h.

◆ OOJS_QUICKJS

#define OOJS_QUICKJS   1

Definition at line 72 of file OOJavaScriptEngine.h.

◆ OOJS_RETURN

#define OOJS_RETURN ( v)
Value:
do { \
return (v); \
} while (0)

Definition at line 667 of file OOJavaScriptEngine.h.

667#define OOJS_RETURN(v) \
668 do { \
669 return (v); \
670 } while (0)

◆ OOJS_RETURN_BOOL

#define OOJS_RETURN_BOOL ( v)
Value:
#define OOJS_RETURN(v)
OOINLINE jsval OOJSValueFromBOOL(int b) INLINE_CONST_FUNC

Definition at line 673 of file OOJavaScriptEngine.h.

◆ OOJS_RETURN_DOUBLE

#define OOJS_RETURN_DOUBLE ( v)
Value:
OOJS_RETURN(JS_NewFloat64(context, (v)))

Definition at line 675 of file OOJavaScriptEngine.h.

◆ OOJS_RETURN_HPVECTOR

#define OOJS_RETURN_HPVECTOR ( value)
Value:
BOOL HPVectorToJSValue(JSContext *context, HPVector vector, jsval *outValue) NONNULL_FUNC
Definition OOJSVector.m:310
#define OOJS_RETURN_WITH_HELPER(helper, value)

Definition at line 687 of file OOJavaScriptEngine.h.

◆ OOJS_RETURN_INT

#define OOJS_RETURN_INT ( v)
Value:
OOJS_RETURN(JS_NewInt32(context, (v)))

Definition at line 674 of file OOJavaScriptEngine.h.

◆ OOJS_RETURN_NULL

#define OOJS_RETURN_NULL   OOJS_RETURN(JS_NULL)

Definition at line 672 of file OOJavaScriptEngine.h.

◆ OOJS_RETURN_OBJECT

#define OOJS_RETURN_OBJECT ( o)
Value:
OOINLINE jsval OOJSValueFromNativeObject(JSContext *context, id object)

Definition at line 676 of file OOJavaScriptEngine.h.

◆ OOJS_RETURN_QUATERNION

#define OOJS_RETURN_QUATERNION ( value)
Value:
BOOL QuaternionToJSValue(JSContext *context, Quaternion quaternion, jsval *outValue) NONNULL_FUNC

Definition at line 688 of file OOJavaScriptEngine.h.

◆ OOJS_RETURN_VECTOR

#define OOJS_RETURN_VECTOR ( value)
Value:
BOOL VectorToJSValue(JSContext *context, Vector vector, jsval *outValue) NONNULL_FUNC
Definition OOJSVector.m:264

Definition at line 686 of file OOJavaScriptEngine.h.

◆ OOJS_RETURN_VOID

#define OOJS_RETURN_VOID   OOJS_RETURN(JS_UNDEFINED)

Definition at line 671 of file OOJavaScriptEngine.h.

◆ OOJS_RETURN_WITH_HELPER

#define OOJS_RETURN_WITH_HELPER ( helper,
value )
Value:
do { \
JSValue oojsRVal; \
if (!helper(context, (value), &oojsRVal)) \
return OOJSNativeFailure(context); \
return oojsRVal; \
} while (0)
JSValue OOJSNativeFailure(JSContext *context)

Definition at line 678 of file OOJavaScriptEngine.h.

678#define OOJS_RETURN_WITH_HELPER(helper, value) \
679 do { \
680 JSValue oojsRVal; \
681 if (!helper(context, (value), &oojsRVal)) \
682 return OOJSNativeFailure(context); \
683 return oojsRVal; \
684 } while (0)

◆ OOJS_SETTER_ARGS

◆ OOJS_THIS

#define OOJS_THIS   oojsThis

Definition at line 657 of file OOJavaScriptEngine.h.

◆ OOJSDumpStack

#define OOJSDumpStack ( cx)
Value:
do { \
} while (0)

Definition at line 614 of file OOJavaScriptEngine.h.

614#define OOJSDumpStack(cx) \
615 do { \
616 } while (0)

◆ OOJSENGINE_MONITOR_SUPPORT

#define OOJSENGINE_MONITOR_SUPPORT   OO_DEBUG_MONITOR_ENABLED

Definition at line 83 of file OOJavaScriptEngine.h.

◆ OOJSFreeValue

#define OOJSFreeValue ( context,
value )
Value:
JS_FreeValue((context), (value))

Definition at line 218 of file OOJavaScriptEngine.h.

◆ OOJSNullValue

#define OOJSNullValue ( )
Value:
JS_NULL

Definition at line 220 of file OOJavaScriptEngine.h.

◆ OOJSStartTimeLimiter

#define OOJSStartTimeLimiter ( )

◆ OOJSSTR

#define OOJSSTR ( str)
Value:
JS_AtomToString(OOJSAcquireContext(), OOJSID(str))
#define OOJSID(str)
Definition OOJSPropID.h:42
OOINLINE JSContext * OOJSAcquireContext(void)

Definition at line 384 of file OOJavaScriptEngine.h.

◆ OOJSUndefinedValue

#define OOJSUndefinedValue ( )
Value:
JS_UNDEFINED

Definition at line 219 of file OOJavaScriptEngine.h.

Typedef Documentation

◆ OOJSClassConverterCallback

typedef id(* OOJSClassConverterCallback) (JSContext *context, JSValueConst object)

Definition at line 587 of file OOJavaScriptEngine.h.

◆ OOJSInterruptHandlerArg

typedef JSRuntime OOJSInterruptHandlerArg

Definition at line 80 of file OOJavaScriptEngine.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
kOOJSMaxClassID 

Definition at line 502 of file OOJavaScriptEngine.h.

502{ kOOJSMaxClassID = 1 << 16 }; // QuickJS's limit.
@ kOOJSMaxClassID

Function Documentation

◆ JSEntityIsDemoShipPredicate()

BOOL JSEntityIsDemoShipPredicate ( Entity * entity,
void * parameter )

Definition at line 1949 of file OOJavaScriptEngine.m.

1950{
1951 return ([entity isVisibleToScripts] && [entity isShip] && [entity status] == STATUS_COCKPIT_DISPLAY && ![entity isSubEntity]);
1952}

◆ JSEntityIsJavaScriptSearchablePredicate()

BOOL JSEntityIsJavaScriptSearchablePredicate ( Entity * entity,
void * parameter )

Definition at line 1917 of file OOJavaScriptEngine.m.

1918{
1920
1921 if (![entity isVisibleToScripts])
1922 return NO;
1923 if ([entity isShip]) {
1924 if ([entity isSubEntity])
1925 return NO;
1926 if ([entity status] == STATUS_COCKPIT_DISPLAY)
1927 return NO; // Demo ship
1928 return YES;
1929 } else if ([entity isPlanet]) {
1930 switch ([(OOPlanetEntity*)entity planetType]) {
1931 case STELLAR_TYPE_MOON:
1933 case STELLAR_TYPE_SUN:
1934 return YES;
1935
1936#if !NEW_PLANETS
1938#endif
1940 return NO;
1941 }
1942 }
1943
1944 return YES; // would happen if we added a new script-visible class
1945
1947}
#define OOJS_PROFILE_EXIT
#define OOJS_PROFILE_ENTER
@ STELLAR_TYPE_MOON
@ STELLAR_TYPE_ATMOSPHERE
@ STELLAR_TYPE_MINIATURE
@ STELLAR_TYPE_SUN
@ STELLAR_TYPE_NORMAL_PLANET

References OOJS_PROFILE_ENTER, OOJS_PROFILE_EXIT, STELLAR_TYPE_ATMOSPHERE, STELLAR_TYPE_MINIATURE, STELLAR_TYPE_MOON, STELLAR_TYPE_NORMAL_PLANET, and STELLAR_TYPE_SUN.

◆ JSEntityIsJavaScriptVisiblePredicate()

BOOL JSEntityIsJavaScriptVisiblePredicate ( Entity * entity,
void * parameter )

Definition at line 1908 of file OOJavaScriptEngine.m.

1909{
1911
1912 return [entity isVisibleToScripts];
1913
1915}

References Entity::isVisibleToScripts, OOJS_PROFILE_ENTER, and OOJS_PROFILE_EXIT.

Here is the call graph for this function:

◆ JSFunctionPredicate()

BOOL JSFunctionPredicate ( Entity * entity,
void * parameter )

Definition at line 1868 of file OOJavaScriptEngine.m.

1869{
1871
1872 JSFunctionPredicateParameter* param = parameter;
1873 jsval args[1];
1874 jsval rval = JSVAL_VOID;
1875 JSBool result = NO;
1876
1877 NSCParameterAssert(entity != nil && param != NULL);
1878 NSCParameterAssert(param->context != NULL && JS_IsInRequest(param->context));
1879 NSCParameterAssert(OOJSValueIsFunction(param->context, param->function));
1880
1881 if (EXPECT_NOT(param->errorFlag))
1882 return NO;
1883
1884 args[0] = [entity oo_jsValueInContext:param->context]; // entity is required to be non-nil (asserted above), so oo_jsValueInContext: is safe.
1885
1888 BOOL success = JS_CallFunctionValue(param->context, param->jsThis, param->function, 1, args, &rval);
1891
1892 if (success) {
1893 if (!JS_ValueToBoolean(param->context, rval, &result))
1894 result = NO;
1895 if (JS_IsExceptionPending(param->context)) {
1896 JS_ReportPendingException(param->context);
1897 param->errorFlag = YES;
1898 }
1899 } else {
1900 param->errorFlag = YES;
1901 }
1902
1903 return result;
1904
1906}
#define OOJSStopTimeLimiter()
#define OOJSStartTimeLimiter()
void OOJSPauseTimeLimiter(void)
#define JS_IsInRequest(context)
OOINLINE BOOL OOJSValueIsFunction(JSContext *context, jsval value)
void OOJSResumeTimeLimiter(void)
return nil

References EXPECT_NOT, nil, Entity::oo_jsValueInContext:, OOJS_PROFILE_ENTER, OOJS_PROFILE_EXIT, OOJSPauseTimeLimiter(), OOJSReportPendingException(), OOJSResumeTimeLimiter(), OOJSStartTimeLimiter, OOJSStopTimeLimiter, OOJSValueIsFunction(), and OOJSValueToBOOL().

Here is the call graph for this function:

◆ OOJSAcquireContext()

OOINLINE JSContext * OOJSAcquireContext ( void )

Definition at line 199 of file OOJavaScriptEngine.h.

200{
201 extern JSContext* gOOJSMainThreadContext;
202 NSCAssert(gOOJSMainThreadContext != NULL, @"Attempt to use JavaScript context before JavaScript engine is initialized.");
204}
JSContext * gOOJSMainThreadContext

References gOOJSMainThreadContext, and OOINLINE.

◆ OOJSArgumentListGetNumber()

BOOL OOJSArgumentListGetNumber ( JSContext * context,
NSString * scriptClass,
NSString * function,
int argc,
JSValueConst * argv,
double * outNumber,
int * outConsumed )

Definition at line 1004 of file OOJavaScriptEngine.m.

1005{
1006 if (OOJSArgumentListGetNumberNoError(context, argc, argv, outNumber, outConsumed)) {
1007 return YES;
1008 } else {
1009 OOJSReportBadArguments(context, scriptClass, function, argc, argv,
1010 @"Expected number, got", NULL);
1011 return NO;
1012 }
1013}
BOOL OOJSArgumentListGetNumberNoError(JSContext *context, uintN argc, jsval *argv, double *outNumber, uintN *outConsumed)
void OOJSReportBadArguments(JSContext *context, NSString *scriptClass, NSString *function, uintN argc, jsval *argv, NSString *message, NSString *expectedArgsDescription)

References OOJSArgumentListGetNumberNoError(), OOJSArgumentListGetNumberNoError(), OOJSReportBadArguments(), and OOJSReportBadArguments().

Here is the call graph for this function:

◆ OOJSArgumentListGetNumberNoError()

BOOL OOJSArgumentListGetNumberNoError ( JSContext * context,
int argc,
JSValueConst * argv,
double * outNumber,
int * outConsumed )

Definition at line 1015 of file OOJavaScriptEngine.m.

1016{
1018
1019 double value;
1020
1021 NSCParameterAssert(context != NULL && (argv != NULL || argc == 0) && outNumber != NULL);
1022
1023 // Get value, if possible.
1024 if (EXPECT_NOT(argc < 1 || JS_ToFloat64(context, &value, argv[0]) < 0 || isnan(value))) {
1025 // ToNumber can throw (e.g. for a Symbol); this variant must not leave an exception pending.
1026 if (JS_HasException(context))
1027 JS_FreeValue(context, JS_GetException(context));
1028 if (outConsumed != NULL)
1029 *outConsumed = 0;
1030 return NO;
1031 }
1032
1033 // Success.
1034 *outNumber = value;
1035 if (outConsumed != NULL)
1036 *outConsumed = 1;
1037 return YES;
1038
1040}

References EXPECT_NOT, OOJS_PROFILE_ENTER, and OOJS_PROFILE_EXIT.

Referenced by OOJSArgumentListGetNumber().

Here is the caller graph for this function:

◆ OOJSBasicPrivateObjectConverter()

id OOJSBasicPrivateObjectConverter ( JSContext * context,
JSValueConst object )

Definition at line 1951 of file OOJavaScriptEngine.m.

1952{
1953 /* This will do the right thing - for non-OOWeakReferences,
1954 weakRefUnderlyingObject returns the object itself. For nil, of course,
1955 it returns nil.
1956 */
1957 JSClassID ignored;
1958 id result = JS_GetAnyOpaque(object, &ignored);
1959 return [result weakRefUnderlyingObject];
1960}

◆ OOJSClassName()

const char * OOJSClassName ( JSClassID classID)

Definition at line 89 of file OOJSClasses.m.

90{
91 return (classID < kOOJSMaxClassID) ? sClassNames[classID] : NULL;
92}
static const char * sClassNames[kOOJSMaxClassID]
Definition OOJSClasses.m:30

References kOOJSMaxClassID, and sClassNames.

Referenced by OOJSClassNameOfValue(), OOJSInitClass(), OOJSObjectGetterImplPRIVATE(), and OOJSObjectWrapperToString().

Here is the caller graph for this function:

◆ OOJSClassNameOfValue()

NSString * OOJSClassNameOfValue ( JSContext * context,
JSValueConst value )

Definition at line 1313 of file OOJavaScriptEngine.m.

1314{
1315 if (!JS_IsObject(value))
1316 return @"primitive";
1317
1318 const char* registered = OOJSClassName(JS_GetClassID(value));
1319 if (registered != NULL)
1320 return [NSString stringWithUTF8String:registered];
1321
1322 JSValue ctor = JS_GetPropertyStr(context, value, "constructor");
1323 JSValue name = JS_IsObject(ctor) ? JS_GetPropertyStr(context, ctor, "name") : JS_UNDEFINED;
1324 NSString* result = OOStringFromJSValue(context, name);
1325 JS_FreeValue(context, name);
1326 JS_FreeValue(context, ctor);
1327 return result ?: @"Object";
1328}
NSString * OOStringFromJSValue(JSContext *context, jsval value)
const char * OOJSClassName(JSClassID classID)
Definition OOJSClasses.m:89

References OOJSClassName(), OOStringFromJSValue(), and OOStringFromJSValue().

Referenced by ManifestSetProperty(), ManifestSetPropertyExotic(), OOJSReportBadPropertySelector(), and OOJSReportBadPropertyValue().

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

◆ OOJSDescribeValue()

NSString * OOJSDescribeValue ( JSContext * context,
JSValueConst value,
BOOL abbreviateObjects )

Definition at line 1404 of file OOJavaScriptEngine.m.

1405{
1406 return DescribeValue(context, value, abbreviateObjects, NO);
1407}
static NSString * DescribeValue(JSContext *context, jsval value, BOOL abbreviateObjects, BOOL recursing)

References DescribeValue(), and DescribeValue().

Referenced by OOJSReportBadPropertyValue().

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

◆ OOJSDictionaryFromJSObject()

NSDictionary * OOJSDictionaryFromJSObject ( JSContext * context,
JSValueConst object )

Definition at line 1797 of file OOJavaScriptEngine.m.

1798{
1800
1801 JSPropertyEnum* properties = NULL;
1802 uint32_t i, count;
1803
1804 if (JS_GetOwnPropertyNames(context, &properties, &count, object, JS_GPN_STRING_MASK | JS_GPN_ENUM_ONLY) < 0) {
1805 JS_FreeValue(context, JS_GetException(context));
1806 return nil;
1807 }
1808
1809 NSMutableDictionary* result = [NSMutableDictionary dictionaryWithCapacity:count];
1810 for (i = 0; i != count; ++i) {
1811 id objKey = KeyForAtom(context, properties[i].atom);
1812 JSValue value = JS_GetProperty(context, object, properties[i].atom);
1813 if (JS_IsException(value)) {
1814 JS_FreeValue(context, JS_GetException(context));
1815 continue;
1816 }
1817
1818 if (objKey != nil && !JS_IsUndefined(value)) {
1819 id objValue = OOJSNativeObjectFromJSValue(context, value);
1820 if (objValue != nil) {
1821 [result setObject:objValue forKey:objKey];
1822 }
1823 }
1824 JS_FreeValue(context, value);
1825 }
1826
1827 JS_FreePropertyEnum(context, properties, count);
1828 return result;
1829
1831}
id OOJSNativeObjectFromJSValue(JSContext *context, jsval value)
unsigned count
static id KeyForAtom(JSContext *context, JSAtom atom)

References count, KeyForAtom(), nil, OOJS_PROFILE_ENTER, OOJS_PROFILE_EXIT, and OOJSNativeObjectFromJSValue().

Referenced by OOJavaScriptEngine(Private)::registerStandardObjectConverters.

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

◆ OOJSDictionaryFromJSValue()

NSDictionary * OOJSDictionaryFromJSValue ( JSContext * context,
JSValueConst value )

Definition at line 1768 of file OOJavaScriptEngine.m.

1769{
1771
1772 if (EXPECT_NOT(!JS_IsObject(value))) {
1773 return nil;
1774 }
1775 return OOJSDictionaryFromJSObject(context, value);
1776
1778}
NSDictionary * OOJSDictionaryFromJSObject(JSContext *context, JSObject *object)

References EXPECT_NOT, nil, OOJS_PROFILE_ENTER, OOJS_PROFILE_EXIT, and OOJSDictionaryFromJSObject().

Here is the call graph for this function:

◆ OOJSDictionaryFromStringTable()

NSDictionary * OOJSDictionaryFromStringTable ( JSContext * context,
JSValueConst value )

Definition at line 1833 of file OOJavaScriptEngine.m.

1834{
1836
1837 JSPropertyEnum* properties = NULL;
1838 uint32_t i, count;
1839
1840 if (EXPECT_NOT(JS_IsNull(tableValue) || JS_IsUndefined(tableValue))) {
1841 return nil;
1842 }
1843
1844 JSValue tableObject = JS_ToObject(context, tableValue);
1845 if (JS_IsException(tableObject)) {
1846 JS_FreeValue(context, JS_GetException(context));
1847 return nil;
1848 }
1849
1850 if (JS_GetOwnPropertyNames(context, &properties, &count, tableObject, JS_GPN_STRING_MASK | JS_GPN_ENUM_ONLY) < 0) {
1851 JS_FreeValue(context, JS_GetException(context));
1852 JS_FreeValue(context, tableObject);
1853 return nil;
1854 }
1855
1856 NSMutableDictionary* result = [NSMutableDictionary dictionaryWithCapacity:count];
1857 for (i = 0; i != count; ++i) {
1858 NSString* objKey = OOStringFromJSID(properties[i].atom);
1859 JSValue value = JS_GetProperty(context, tableObject, properties[i].atom);
1860 if (JS_IsException(value)) {
1861 JS_FreeValue(context, JS_GetException(context));
1862 continue;
1863 }
1864
1865 if (objKey != nil && !JS_IsUndefined(value)) {
1866 NSString* objValue = OOStringFromJSValueEvenIfNull(context, value);
1867 if (objValue != nil) {
1868 [result setObject:objValue forKey:objKey];
1869 }
1870 }
1871 JS_FreeValue(context, value);
1872 }
1873
1874 JS_FreePropertyEnum(context, properties, count);
1875 JS_FreeValue(context, tableObject);
1876 return result;
1877
1879}
NSString * OOStringFromJSValueEvenIfNull(JSContext *context, jsval value)
NSString * OOStringFromJSID(JSAtom propID)

References count, EXPECT_NOT, nil, OOJS_PROFILE_ENTER, OOJS_PROFILE_EXIT, OOStringFromJSID(), and OOStringFromJSValueEvenIfNull().

Here is the call graph for this function:

◆ OOJSGetSharedPermanentOwnProperty()

int OOJSGetSharedPermanentOwnProperty ( JSContext * context,
JSPropertyDescriptor * desc,
JSValueConst object,
JSAtom prop )

Definition at line 161 of file OOJSClasses.m.

162{
163 JSClassID classID = JS_GetClassID(object);
164 if (classID == 0 || classID >= kOOJSMaxClassID || !TableContainsAtom(&sSharedProperties[classID], prop))
165 return 0;
166
167 JSValue prototype = JS_GetClassProto(context, classID);
168 int result = 0;
169 // The prototype holds the property in its own shape, so this does not recurse.
170 if (JS_IsObject(prototype) && !JS_IsStrictEqual(context, prototype, object))
171 result = JS_GetOwnProperty(context, desc, prototype, prop);
172 JS_FreeValue(context, prototype);
173 return result;
174}
static BOOL TableContainsAtom(const SharedPropertyTable *table, JSAtom atom)
static SharedPropertyTable sSharedProperties[kOOJSMaxClassID]
Definition OOJSClasses.m:50

References kOOJSMaxClassID, sSharedProperties, and TableContainsAtom().

Referenced by ManifestGetOwnProperty(), RecordSharedProperties(), and SystemInfoExoticGetOwnProperty().

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

◆ OOJSGetSharedPermanentOwnPropertyNames()

int OOJSGetSharedPermanentOwnPropertyNames ( JSContext * context,
JSPropertyEnum ** ptab,
uint32_t * plen,
JSValueConst object )

Definition at line 176 of file OOJSClasses.m.

177{
178 JSClassID classID = JS_GetClassID(object);
179 const SharedPropertyTable* table = (classID != 0 && classID < kOOJSMaxClassID) ? &sSharedProperties[classID] : NULL;
180 uint32_t count = (table != NULL) ? table->count : 0;
181
182 // A class's own prototype gets its properties from its shape, not from here.
183 JSValue prototype = (count != 0) ? JS_GetClassProto(context, classID) : JS_UNDEFINED;
184 if (JS_IsStrictEqual(context, prototype, object))
185 count = 0;
186 JS_FreeValue(context, prototype);
187
188 JSPropertyEnum* tab = js_malloc(context, sizeof(JSPropertyEnum) * (count ? count : 1));
189 if (tab == NULL)
190 return -1;
191
192 for (uint32_t i = 0; i < count; i++) {
193 tab[i].atom = JS_DupAtom(context, table->atoms[i]);
194 tab[i].is_enumerable = false; // Ignored; QuickJS asks get_own_property for flags.
195 }
196
197 *ptab = tab;
198 *plen = count;
199 return 0;
200}

References SharedPropertyTable::atoms, count, SharedPropertyTable::count, kOOJSMaxClassID, and sSharedProperties.

Referenced by RecordSharedProperties().

Here is the caller graph for this function:

◆ OOJSGetTimeLimiterLimit()

OOTimeDelta OOJSGetTimeLimiterLimit ( void )

Definition at line 164 of file OOJSEngineTimeManagement.m.

165{
166 return sLimiterTimeLimit;
167}
static double sLimiterTimeLimit

References sLimiterTimeLimit.

◆ OOJSIDFromString()

JSAtom OOJSIDFromString ( NSString * string)

Definition at line 873 of file OOJavaScriptEngine.m.

874{
875 if (EXPECT_NOT(string == nil))
876 return JSID_VOID;
877
878 JSContext* context = OOJSAcquireContext();
879
880 enum { kStackBufSize = 1024 };
881 unichar stackBuf[kStackBufSize];
882 unichar* buffer;
883 size_t length = [string length];
884 if (length < kStackBufSize) {
885 buffer = stackBuf;
886 } else {
887 buffer = malloc(sizeof(unichar) * length);
888 if (EXPECT_NOT(buffer == NULL))
889 return JSID_VOID;
890 }
891 [string getCharacters:buffer];
892
893 JSString* jsString = JS_InternUCStringN(context, buffer, length);
894
895 if (EXPECT_NOT(buffer != stackBuf))
896 free(buffer);
897
898 OOJSRelinquishContext(context);
899
900 if (EXPECT(jsString != NULL))
901 return INTERNED_STRING_TO_JSID(jsString);
902 else
903 return JSID_VOID;
904}
#define EXPECT(x)
OOINLINE void OOJSRelinquishContext(JSContext *context)

References EXPECT, EXPECT_NOT, nil, and OOJSAcquireContext().

Here is the call graph for this function:

◆ OOJSInitClass()

JSValueConst OOJSInitClass ( JSContext * context,
JSValueConst global,
JSClassID classID,
JSValueConst parentPrototype,
JSCFunction * constructor,
int constructorArgCount,
const JSCFunctionListEntry * properties,
size_t propertyCount,
const JSCFunctionListEntry * methods,
size_t methodCount,
const JSCFunctionListEntry * staticMethods,
size_t staticMethodCount )

Definition at line 202 of file OOJSClasses.m.

207{
208 JSValue prototype;
209 if (JS_IsUndefined(parentPrototype)) {
210 JSValue objectPrototype = OOJSObjectPrototype(context);
211 prototype = JS_NewObjectProtoClass(context, objectPrototype, classID);
212 JS_FreeValue(context, objectPrototype);
213 } else {
214 prototype = JS_NewObjectProtoClass(context, parentPrototype, classID);
215 }
216
217 if (properties != NULL) {
218 JS_SetPropertyFunctionList(context, prototype, properties, (int)propertyCount);
219 RecordSharedProperties(context, classID, properties, propertyCount);
220 }
221 if (methods != NULL)
222 JS_SetPropertyFunctionList(context, prototype, methods, (int)methodCount);
223
224 if (constructor != NULL) {
225 const char* name = OOJSClassName(classID);
226 JSValue ctor = JS_NewCFunction2(context, constructor, name, constructorArgCount, JS_CFUNC_constructor_or_func, 0);
227 JS_SetConstructor(context, ctor, prototype);
228 if (staticMethods != NULL)
229 JS_SetPropertyFunctionList(context, ctor, staticMethods, (int)staticMethodCount);
230 JS_DefinePropertyValueStr(context, global, name, ctor, JS_PROP_WRITABLE | JS_PROP_CONFIGURABLE);
231 }
232
233 // The calls above don't report failures; don't leave an exception for the next script to find.
234 if (JS_HasException(context))
236
237 // The context's class prototype table takes ownership, so the value stays valid as a borrowed reference.
238 JS_SetClassProto(context, classID, prototype);
239 return prototype;
240}
JSValue OOJSObjectPrototype(JSContext *context)
Definition OOJSClasses.m:81
static void RecordSharedProperties(JSContext *context, JSClassID classID, const JSCFunctionListEntry *properties, size_t count)
const char * OOJSClassName(JSClassID classID)
Definition OOJSClasses.m:89
OOINLINE void OOJSReportPendingException(JSContext *context)

References OOJSClassName(), OOJSObjectPrototype(), OOJSReportPendingException(), and RecordSharedProperties().

Referenced by InitOOJSClock(), InitOOJSDock(), InitOOJSEntity(), InitOOJSEquipmentInfo(), InitOOJSExhaustPlume(), InitOOJSFlasher(), InitOOJSManifest(), InitOOJSMission(), InitOOJSOolite(), InitOOJSPlanet(), InitOOJSPlayer(), InitOOJSPlayerShip(), InitOOJSQuaternion(), InitOOJSScript(), InitOOJSShip(), InitOOJSShipGroup(), InitOOJSSound(), InitOOJSSoundSource(), InitOOJSStation(), InitOOJSSun(), InitOOJSSystem(), InitOOJSSystemInfo(), InitOOJSTimer(), InitOOJSVector(), InitOOJSVisualEffect(), InitOOJSWaypoint(), and InitOOJSWormhole().

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

◆ OOJSIsMemberOfSubclass()

OOINLINE BOOL OOJSIsMemberOfSubclass ( JSContext * context,
JSValueConst object,
JSClassID superclass )

Definition at line 512 of file OOJavaScriptEngine.h.

513{
514 return JS_IsObject(object) && OOJSIsSubclass(JS_GetClassID(object), superclass);
515}
BOOL OOJSIsSubclass(JSClass *putativeSubclass, JSClass *superclass)

References OOINLINE, and OOJSIsSubclass().

Here is the call graph for this function:

◆ OOJSIsSubclass()

BOOL OOJSIsSubclass ( JSClassID putativeSubclass,
JSClassID superclass )

Definition at line 102 of file OOJSClasses.m.

103{
104 while (putativeSubclass != 0 && putativeSubclass < kOOJSMaxClassID) {
105 if (putativeSubclass == superclass)
106 return YES;
107
108 putativeSubclass = sSuperclasses[putativeSubclass];
109 }
110
111 return NO;
112}
static JSClassID sSuperclasses[kOOJSMaxClassID]
Definition OOJSClasses.m:31

References kOOJSMaxClassID, and sSuperclasses.

◆ OOJSLegacyConstRewriter()

JSValueConst OOJSLegacyConstRewriter ( void )

Definition at line 520 of file OOJavaScriptEngine.m.

521{
523}
static JSValue sLegacyConstRewriter

References sLegacyConstRewriter.

Referenced by RewriteLegacyConst().

Here is the caller graph for this function:

◆ OOJSNativeFailure()

JSValue OOJSNativeFailure ( JSContext * context)

Definition at line 894 of file OOJavaScriptEngine.m.

895{
896 if (JS_HasException(context))
897 return JS_EXCEPTION;
898
899 // Uncatchable errors are not reported by OOJSReportPendingException().
900 JSValue error = JS_NewError(context);
901 JS_SetUncatchableError(context, error);
902 return JS_Throw(context, error);
903}

References OOJavaScriptEngine::context.

Referenced by DockGetProperty(), DockIsQueued(), DockSetProperty(), EquipmentInfoGetProperty(), EquipmentInfoSetProperty(), EquipmentInfoStaticInfoForKey(), ExhaustPlumeGetProperty(), ExhaustPlumeSetProperty(), FlasherGetProperty(), FlasherSetProperty(), FontMeasureString(), PlanetGetProperty(), PlanetSetProperty(), PlayerAddMessageToArrivalReport(), PlayerAudioMessage(), PlayerCommsMessage(), PlayerConsoleMessage(), PlayerEndScenario(), PlayerGetProperty(), PlayerReplaceShip(), PlayerSetEscapePodDestination(), PlayerSetPlayerRole(), PlayerSetProperty(), PlayerShipAddParcel(), PlayerShipAddPassenger(), PlayerShipAwardContract(), PlayerShipAwardEquipmentToCurrentPylon(), PlayerShipBeginGalacticHyperspaceCountdown(), PlayerShipBeginHyperspaceCountdown(), PlayerShipCancelDockingRequest(), PlayerShipEngageAutopilotToStation(), PlayerShipGetProperty(), PlayerShipHideHUDSelector(), PlayerShipRemoveAllCargo(), PlayerShipRemoveContract(), PlayerShipRemoveParcel(), PlayerShipRemovePassenger(), PlayerShipRequestDockingClearance(), PlayerShipResetCustomView(), PlayerShipSetCustomHUDDial(), PlayerShipSetCustomView(), PlayerShipSetMultiFunctionDisplay(), PlayerShipSetMultiFunctionText(), PlayerShipSetPrimedEquipment(), PlayerShipSetProperty(), PlayerShipShowHUDSelector(), PlayerShipUseSpecialCargo(), RemoveOrExplodeShip(), ShipAddCargoEntity(), ShipAddCollisionException(), ShipAddDefenseTarget(), ShipAdjustCargo(), ShipAwardEquipment(), ShipCanAwardEquipment(), ShipCheckScanner(), ShipCommsMessage(), ShipDealEnergyDamage(), ShipDumpCargo(), ShipEjectItem(), ShipEjectSpecificItem(), ShipEnterWormhole(), ShipEquipmentStatus(), ShipExitAI(), ShipExitSystem(), ShipGetProperty(), ShipGroupAddShip(), ShipGroupConstruct(), ShipGroupContainsShip(), ShipGroupGetProperty(), ShipGroupRemoveShip(), ShipGroupSetProperty(), ShipHasEquipmentProviding(), ShipHasRole(), ShipOfferToEscort(), ShipPatrolReportIn(), ShipReactToAIMessage(), ShipRemove(), ShipRemoveCollisionException(), ShipRemoveDefenseTarget(), ShipRemoveEquipment(), ShipRunLegacyScriptActions(), ShipSendAIMessage(), ShipSetAI(), ShipSetBounty(), ShipSetCargo(), ShipSetCargoType(), ShipSetCrew(), ShipSetEquipmentStatus(), ShipSetMaterials(), ShipSetProperty(), ShipSetScript(), ShipSetShaders(), ShipSpawn(), ShipStaticKeysForRole(), ShipStaticRoleIsInCategory(), ShipStaticSetShipDataForKey(), ShipStaticShipDataForKey(), ShipSwitchAI(), ShipThreatAssessment(), SoundGetProperty(), SoundSourceGetProperty(), SoundSourcePlay(), SoundSourcePlayOrRepeat(), SoundSourceSetProperty(), SoundSourceStop(), SoundStaticLoad(), SoundStaticPlayMusic(), SoundStaticStopMusic(), StationAbortDockingForShip(), StationAddShipToShipyard(), StationCanDockShip(), StationGetProperty(), StationLaunchShipWithRole(), StationRemoveShipFromShipyard(), StationSetInterface(), StationSetMarketPrice(), StationSetMarketQuantity(), StationSetProperty(), SunCancelNova(), SunGetProperty(), SunGoNova(), SystemAddMoon(), SystemAddPlanet(), SystemAddVisualEffect(), SystemCountEntitiesWithScanClass(), SystemCountShipsWithPrimaryRole(), SystemCountShipsWithRole(), SystemEntitiesWithScanClass(), SystemFilteredEntities(), SystemGetProperty(), SystemInfoDistanceToSystem(), SystemInfoGetProperty(), SystemInfoRouteToSystem(), SystemInfoSamplePrice(), SystemInfoSetPropertyMethod(), SystemInfoStaticFilteredSystems(), SystemInfoStaticSetInterstellarProperty(), SystemLegacyAddShips(), SystemLegacyAddShipsAt(), SystemLegacyAddShipsAtPrecisely(), SystemLegacyAddShipsWithinRadius(), SystemLegacyAddSystemShips(), SystemLegacySpawnShip(), SystemLocationFromCode(), SystemSetPopulator(), SystemSetProperty(), SystemSetWaypoint(), SystemShipsWithPrimaryRole(), SystemShipsWithRole(), SystemStaticInfoForSystem(), SystemStaticSystemIDForName(), SystemStaticSystemNameForID(), TimerConstruct(), TimerGetProperty(), TimerSetProperty(), TimerStart(), TimerStop(), VectorFromCoordinateSystem(), VectorToCoordinateSystem(), VisualEffectGetProperty(), VisualEffectScale(), VisualEffectSetMaterials(), VisualEffectSetProperty(), VisualEffectSetShaders(), WaypointGetProperty(), WaypointSetProperty(), and WormholeGetProperty().

Here is the call graph for this function:

◆ OOJSNativeObjectFromJSObject()

id OOJSNativeObjectFromJSObject ( JSContext * context,
JSValueConst object )

Definition at line 1918 of file OOJavaScriptEngine.m.

1919{
1921
1922 if (!JS_IsObject(object))
1923 return nil;
1924
1925 JSClassID classID = JS_GetClassID(object);
1926 OOJSClassConverterCallback converter = (classID < kOOJSMaxClassID) ? sObjectConverters[classID] : NULL;
1927 if (converter != NULL) {
1928 return converter(context, object);
1929 }
1930 return nil;
1931
1933}
id(* OOJSClassConverterCallback)(JSContext *context, JSObject *object)
static NSMutableDictionary * sObjectConverters

References kOOJSMaxClassID, nil, OOJS_PROFILE_ENTER, OOJS_PROFILE_EXIT, and sObjectConverters.

◆ OOJSNativeObjectFromJSValue()

id OOJSNativeObjectFromJSValue ( JSContext * context,
JSValueConst value )

Definition at line 1886 of file OOJavaScriptEngine.m.

1887{
1889
1890 if (JS_IsNull(value) || JS_IsUndefined(value))
1891 return nil;
1892
1893 int32_t intValue;
1894 double doubleValue;
1895
1896 if (JS_VALUE_GET_TAG(value) == JS_TAG_INT) {
1897 JS_ToInt32(context, &intValue, value);
1898 return [NSNumber numberWithInt:intValue];
1899 }
1900 if (JS_IsNumber(value)) {
1901 JS_ToFloat64(context, &doubleValue, value);
1902 return [NSNumber numberWithDouble:doubleValue];
1903 }
1904 if (JS_IsBool(value)) {
1905 return [NSNumber numberWithBool:JS_VALUE_GET_BOOL(value)];
1906 }
1907 if (JS_IsString(value)) {
1908 return OOStringFromJSValue(context, value);
1909 }
1910 if (JS_IsObject(value)) {
1911 return OOJSNativeObjectFromJSObject(context, value);
1912 }
1913 return nil;
1914
1916}
id OOJSNativeObjectFromJSObject(JSContext *context, JSObject *tableObject)

References nil, OOJS_PROFILE_ENTER, OOJS_PROFILE_EXIT, OOJSNativeObjectFromJSObject(), and OOStringFromJSValue().

Here is the call graph for this function:

◆ OOJSNativeObjectOfClassFromJSObject()

id OOJSNativeObjectOfClassFromJSObject ( JSContext * context,
JSValueConst object,
Class requiredClass )

Definition at line 1943 of file OOJavaScriptEngine.m.

1944{
1945 id result = OOJSNativeObjectFromJSObject(context, object);
1946 if (![result isKindOfClass:requiredClass])
1947 result = nil;
1948 return result;
1949}

References nil, and OOJSNativeObjectFromJSObject().

Here is the call graph for this function:

◆ OOJSNativeObjectOfClassFromJSValue()

id OOJSNativeObjectOfClassFromJSValue ( JSContext * context,
JSValueConst value,
Class requiredClass )

Definition at line 1935 of file OOJavaScriptEngine.m.

1936{
1937 id result = OOJSNativeObjectFromJSValue(context, value);
1938 if (![result isKindOfClass:requiredClass])
1939 result = nil;
1940 return result;
1941}

References nil, and OOJSNativeObjectFromJSValue().

Here is the call graph for this function:

◆ OOJSObjectFromNativeObject()

JSValue OOJSObjectFromNativeObject ( JSContext * context,
id object )

Definition at line 1322 of file OOJavaScriptEngine.m.

1323{
1324 jsval value = OOJSValueFromNativeObject(context, object);
1325 JSObject* result = NULL;
1326 if (JS_ValueToObject(context, value, &result))
1327 return result;
1328 return NULL;
1329}

References OOJSValueFromNativeObject().

Here is the call graph for this function:

◆ OOJSObjectGetterImplPRIVATE()

BOOL OOJSObjectGetterImplPRIVATE ( JSContext * context,
JSValueConst object,
JSClassID requiredClassID,
Class requiredObjCClass,
const char * name,
id * outObject )

Definition at line 1732 of file OOJavaScriptEngine.m.

1733{
1734 NSCParameterAssert(requiredObjCClass != Nil);
1735 NSCParameterAssert(context != NULL && requiredClassID != 0 && outObject != NULL);
1736
1737 /*
1738 Ensure it's a valid type of JS object. This is absolutely necessary,
1739 because if we don't check it we'll crash trying to get the private
1740 field of something that isn't an ObjC object wrapper - for example,
1741 Ship.setAI.call(new Vector3D, "") is valid JavaScript.
1742 */
1743 JSClassID actualClassID = JS_GetClassID(object);
1744 if (EXPECT_NOT(!OOJSIsSubclass(actualClassID, requiredClassID))) {
1745 OOJSReportError(context, @"Native method expected %s, got %@.", OOJSClassName(requiredClassID), OOStringFromJSValue(context, object));
1746 return NO;
1747 }
1748
1749 // Get the underlying object.
1750 JSClassID ignored;
1751 *outObject = [(id)JS_GetAnyOpaque(object, &ignored) weakRefUnderlyingObject];
1752
1753#ifndef NDEBUG
1754 // Double-check that the underlying object is of the expected ObjC class.
1755 if (EXPECT_NOT(*outObject != nil && ![*outObject isKindOfClass:requiredObjCClass])) {
1756 OOJSReportError(context, @"Native method expected %@ from %s and got correct JS type but incorrect native object %@", requiredObjCClass, OOJSClassName(requiredClassID), *outObject);
1757 return NO;
1758 }
1759#endif
1760
1761 return YES;
1762}
void OOJSReportError(JSContext *context, NSString *format,...)
BOOL OOJSIsSubclass(JSClass *putativeSubclass, JSClass *superclass)

References EXPECT_NOT, nil, OOJSClassName(), OOJSIsSubclass(), OOJSReportError(), and OOStringFromJSValue().

Here is the call graph for this function:

◆ OOJSObjectPrototype()

JSValue OOJSObjectPrototype ( JSContext * context)

Definition at line 81 of file OOJSClasses.m.

82{
83 JSValue object = JS_NewObject(context);
84 JSValue result = JS_GetPrototype(context, object);
85 JS_FreeValue(context, object);
86 return result;
87}

Referenced by InitOOJSMissionVariables(), InitOOJSWorldScripts(), and OOJSInitClass().

Here is the caller graph for this function:

◆ OOJSObjectWrapperFinalize()

void OOJSObjectWrapperFinalize ( JSRuntime * runtime,
JSValueConst this )

Definition at line 1597 of file OOJavaScriptEngine.m.

1598{
1600
1601 JSClassID classID;
1602 id object = JS_GetAnyOpaque(this, &classID);
1603 if (object != nil) {
1604 [[object weakRefUnderlyingObject] oo_clearJSSelf:this];
1605 [object release];
1606 JS_SetOpaque(this, NULL);
1607 }
1608
1610}

References nil, OOJS_PROFILE_ENTER, and OOJS_PROFILE_EXIT.

◆ OOJSObjectWrapperToString()

JSValue OOJSObjectWrapperToString ( JSContext * context,
JSValueConst this,
int argc,
JSValueConst * argv )

Definition at line 1612 of file OOJavaScriptEngine.m.

1613{
1614 OOJS_NATIVE_ENTER(context)
1615
1616 id object = nil;
1617 NSString* description = nil;
1618
1619 object = OOJSNativeObjectFromJSObject(context, this);
1620 if (object != nil) {
1621 description = [object oo_jsDescription];
1622 if (description == nil)
1623 description = [object description];
1624 }
1625 if (description == nil) {
1626 const char* className = OOJSClassName(JS_GetClassID(this));
1627 if (className != NULL) {
1628 description = [NSString stringWithFormat:@"[object %@]", [NSString stringWithUTF8String:className]];
1629 }
1630 }
1631 if (description == nil)
1632 description = @"[object]";
1633
1634 OOJS_RETURN_OBJECT(description);
1635
1637}
#define OOJS_NATIVE_ENTER(cx)
#define OOJS_NATIVE_EXIT
#define OOJS_RETURN_OBJECT(o)

References nil, OOJS_NATIVE_ENTER, OOJS_NATIVE_EXIT, OOJS_RETURN_OBJECT, OOJSClassName(), and OOJSNativeObjectFromJSObject().

Here is the call graph for this function:

◆ OOJSPauseTimeLimiter()

void OOJSPauseTimeLimiter ( void )

Definition at line 129 of file OOJSEngineTimeManagement.m.

130{
131 if (sLimiterPauseDepth++ == 0) {
134 }
135}
static OOHighResTimeValue sLimiterPauseStart
static int sLimiterPauseDepth
#define OOGetHighResTime
#define OODisposeHighResTime(time)

References MonotonicTime(), MonotonicTime(), sLimiterPauseDepth, and sLimiterPauseStart.

Referenced by OOJSReportPendingException().

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

◆ OOJSRegisterClass()

JSClassID OOJSRegisterClass ( JSClassID * ioClassID,
const JSClassDef * classDef )

Definition at line 61 of file OOJSClasses.m.

62{
63 NSCParameterAssert(ioClassID != NULL && classDef != NULL);
64
65 JSRuntime* runtime = JS_GetRuntime(OOJSAcquireContext());
66 JSClassID classID = JS_NewClassID(runtime, ioClassID);
67 NSCAssert(classID < kOOJSMaxClassID, @"QuickJS class ID out of range.");
68
69 if (!JS_IsRegisteredClass(runtime, classID)) {
70 JSClassDef def = *classDef;
71 if (def.exotic == NULL) {
72 sOwnExoticMethods[classID] = calloc(1, sizeof(JSClassExoticMethods));
73 def.exotic = sOwnExoticMethods[classID];
74 }
75 JS_NewClass(runtime, classID, &def);
76 sClassNames[classID] = classDef->class_name;
77 }
78 return classID;
79}
static JSClassExoticMethods * sOwnExoticMethods[kOOJSMaxClassID]
Definition OOJSClasses.m:59

References kOOJSMaxClassID, OOJSAcquireContext(), sClassNames, and sOwnExoticMethods.

Referenced by InitOOJSClock(), InitOOJSDock(), InitOOJSEntity(), InitOOJSEquipmentInfo(), InitOOJSExhaustPlume(), InitOOJSFlasher(), InitOOJSManifest(), InitOOJSMission(), InitOOJSMissionVariables(), InitOOJSOolite(), InitOOJSPlanet(), InitOOJSPlayer(), InitOOJSPlayerShip(), InitOOJSQuaternion(), InitOOJSScript(), InitOOJSShip(), InitOOJSShipGroup(), InitOOJSSound(), InitOOJSSoundSource(), InitOOJSStation(), InitOOJSSun(), InitOOJSSystem(), InitOOJSSystemInfo(), InitOOJSTimer(), InitOOJSVector(), InitOOJSVisualEffect(), InitOOJSWaypoint(), InitOOJSWorldScripts(), and InitOOJSWormhole().

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

◆ OOJSRegisterObjectConverter()

void OOJSRegisterObjectConverter ( JSClassID classID,
OOJSClassConverterCallback converter )

Definition at line 1962 of file OOJavaScriptEngine.m.

1963{
1964 if (classID == 0 || classID >= kOOJSMaxClassID)
1965 return;
1966 sObjectConverters[classID] = converter;
1967}

References kOOJSMaxClassID, and sObjectConverters.

◆ OOJSRegisterSubclass()

void OOJSRegisterSubclass ( JSClassID subclass,
JSClassID superclass )

Definition at line 94 of file OOJSClasses.m.

95{
96 NSCParameterAssert(subclass != 0 && superclass != 0 && subclass < kOOJSMaxClassID);
97 NSCAssert(sSuperclasses[subclass] == 0 || sSuperclasses[subclass] == superclass, @"A JS class cannot be registered as a subclass of multiple classes.");
98
99 sSuperclasses[subclass] = superclass;
100}

References kOOJSMaxClassID, and sSuperclasses.

◆ OOJSRelinquishContext()

OOINLINE void OOJSRelinquishContext ( JSContext * context)

Definition at line 206 of file OOJavaScriptEngine.h.

207{
208 (void)context;
209}

References OOINLINE.

◆ OOJSReportBadArguments()

void OOJSReportBadArguments ( JSContext * context,
NSString * scriptClass,
NSString * function,
int argc,
JSValueConst * argv,
NSString * message,
NSString * expectedArgsDescription )

Definition at line 975 of file OOJavaScriptEngine.m.

976{
977 @try {
978 if (message == nil)
979 message = @"Invalid arguments";
980 message = [NSString stringWithFormat:@"%@ %@", message, [NSString stringWithJavaScriptParameters:argv count:argc inContext:context]];
981 if (expectedArgsDescription != nil)
982 message = [NSString stringWithFormat:@"%@ -- expected %@", message, expectedArgsDescription];
983
984 OOJSReportErrorForCaller(context, scriptClass, function, @"%@.", message);
985 }
986 @catch (id exception) {
987 // Squash any secondary errors during error handling.
988 }
989}
void OOJSReportErrorForCaller(JSContext *context, NSString *scriptClass, NSString *function, NSString *format,...)

References nil, and OOJSReportErrorForCaller().

Referenced by OOJSArgumentListGetNumber().

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

◆ OOJSReportBadPropertySelector()

void OOJSReportBadPropertySelector ( JSContext * context,
JSValueConst thisObj,
int magic,
const JSCFunctionListEntry * list,
size_t count )

Definition at line 958 of file OOJavaScriptEngine.m.

959{
960 NSString* propName = OOStringFromJSPropertyMagic(magic, list, count);
961 NSString* className = OOJSClassNameOfValue(context, thisObj);
962
963 OOJSReportError(context, @"Invalid property identifier %@ for instance of %@.", propName, className);
964}
NSString * OOJSClassNameOfValue(JSContext *context, JSValueConst value)
NSString * OOStringFromJSPropertyMagic(int magic, const JSCFunctionListEntry *list, size_t count)

References count, OOJSClassNameOfValue(), OOJSReportError(), OOStringFromJSPropertyMagic(), and PropertyNameForMagic().

Here is the call graph for this function:

◆ OOJSReportBadPropertyValue()

void OOJSReportBadPropertyValue ( JSContext * context,
JSValueConst thisObj,
int magic,
const JSCFunctionListEntry * list,
size_t count,
JSValueConst value )

Definition at line 966 of file OOJavaScriptEngine.m.

967{
968 NSString* propName = OOStringFromJSPropertyMagic(magic, list, count);
969 NSString* className = OOJSClassNameOfValue(context, thisObj);
970 NSString* valueDesc = OOJSDescribeValue(context, value, YES);
971
972 OOJSReportError(context, @"Cannot set property %@ of instance of %@ to invalid value %@.", propName, className, valueDesc);
973}
NSString * OOJSDescribeValue(JSContext *context, jsval value, BOOL abbreviateObjects)

References count, OOJSClassNameOfValue(), OOJSDescribeValue(), OOJSDescribeValue(), OOJSReportError(), OOStringFromJSPropertyMagic(), and PropertyNameForMagic().

Here is the call graph for this function:

◆ OOJSReportError()

void OOJSReportError ( JSContext * context,
NSString * format,
... )

Definition at line 930 of file OOJavaScriptEngine.m.

931{
932 va_list args;
933
934 va_start(args, format);
935 OOJSReportErrorWithArguments(context, format, args);
936 va_end(args);
937}
void OOJSReportErrorWithArguments(JSContext *context, NSString *format, va_list args)

References OOJSReportErrorWithArguments().

Referenced by OOJSReportBadPropertySelector(), OOJSReportBadPropertyValue(), OOJSReportErrorForCaller(), and OOJSReportWrappedException().

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

◆ OOJSReportErrorForCaller()

void OOJSReportErrorForCaller ( JSContext * context,
NSString * scriptClass,
NSString * function,
NSString * format,
... )

Definition at line 939 of file OOJavaScriptEngine.m.

940{
941 va_list args;
942 NSString* msg = nil;
943
944 @try {
945 va_start(args, format);
946 msg = [[NSString alloc] initWithFormat:format arguments:args];
947 va_end(args);
948
949 OOJSReportError(context, @"%@%@", CallerPrefix(scriptClass, function), msg);
950 }
951 @catch (id exception) {
952 // Squash any secondary errors during error handling.
953 }
954 [msg release];
955}
static NSString * CallerPrefix(NSString *scriptClass, NSString *function)

References CallerPrefix(), CallerPrefix(), nil, and OOJSReportError().

Referenced by OOJSReportBadArguments().

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

◆ OOJSReportErrorWithArguments()

void OOJSReportErrorWithArguments ( JSContext * context,
NSString * format,
va_list args )

Definition at line 957 of file OOJavaScriptEngine.m.

958{
959 NSString* msg = nil;
960
961 NSCParameterAssert(JS_IsInRequest(context));
962
963 @try {
964 msg = [[NSString alloc] initWithFormat:format arguments:args];
965 JS_ReportError(context, "%s", [msg UTF8String]);
966 }
967 @catch (id exception) {
968 // Squash any secondary errors during error handling.
969 }
970 [msg release];
971}

References nil.

Referenced by OOJSReportError().

Here is the caller graph for this function:

◆ OOJSReportPendingException()

void OOJSReportPendingException ( JSContext * context)

Definition at line 173 of file OOJavaScriptEngine.h.

174{
175 JS_ReportPendingException(context);
176}

References LogProblem(), LogProblem(), OOINLINE, OOJSPauseTimeLimiter(), OOJSResumeTimeLimiter(), OOStringFromJSValue(), OOStringFromJSValue(), OOStringFromJSValueEvenIfNull(), OOStringFromJSValueEvenIfNull(), StackOfValue(), and StackOfValue().

Referenced by PlayerEntity::adjustPriceByScriptForEqKey:withCurrent:, OOJavaScriptEngine::callJSFunction:forObject:argc:argv:result:, OOJavaScriptEngine::callJSFunction:forObject:argc:argv:result:, OOJSScript::callMethod:inContext:withArguments:count:result:, OOJSScript::callMethodNamed:withArguments:count:result:, CompileScriptWithName(), OOJSFunction::evaluatePredicateWithContext:scope:arguments:, OOJSFunction::evaluateWithContext:scope:arguments:result:, GetParam(), GetParam(), GetParam(), GetParameter(), GetParameterImageDescriptor(), InitOOJSManifest(), OOJSFunction::initWithName:scope:code:argumentCount:argumentNames:fileName:lineNumber:context:, OOJSScript::initWithPath:, OOJSScript::initWithPath:properties:, JSFunctionPredicate(), JSSpecialFunctionsObjectWrapper(), LoadCompatibilityScript(), OOJSScript(Private)::loadScriptWithContext:, MissionRunScreen(), OOJSFrameCallbacksInvoke(), OOJSInitClass(), OOStringFromDeciCredits(), RewriteLegacyConst(), RunScriptWithName(), ShipEntity(PureAI)::scanForNearestShipMatchingPredicate:, and OORegExpMatcher::string:matchesExpression:flags:.

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

◆ OOJSReportWarning()

void OOJSReportWarning ( JSContext * context,
NSString * format,
... )

Definition at line 994 of file OOJavaScriptEngine.m.

995{
996 va_list args;
997
998 va_start(args, format);
999 OOJSReportWarningWithArguments(context, format, args);
1000 va_end(args);
1001}
void OOJSReportWarningWithArguments(JSContext *context, NSString *format, va_list args)

References OOJSReportWarningWithArguments().

Referenced by OOJSReportWarningForCaller().

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

◆ OOJSReportWarningForCaller()

void OOJSReportWarningForCaller ( JSContext * context,
NSString * scriptClass,
NSString * function,
NSString * format,
... )

Definition at line 1003 of file OOJavaScriptEngine.m.

1004{
1005 va_list args;
1006 NSString* msg = nil;
1007
1008 @try {
1009 va_start(args, format);
1010 msg = [[NSString alloc] initWithFormat:format arguments:args];
1011 va_end(args);
1012
1013 OOJSReportWarning(context, @"%@%@", CallerPrefix(scriptClass, function), msg);
1014 }
1015 @catch (id exception) {
1016 // Squash any secondary errors during error handling.
1017 }
1018 [msg release];
1019}
void OOJSReportWarning(JSContext *context, NSString *format,...)

References CallerPrefix(), CallerPrefix(), nil, and OOJSReportWarning().

Here is the call graph for this function:

◆ OOJSReportWarningWithArguments()

void OOJSReportWarningWithArguments ( JSContext * context,
NSString * format,
va_list args )

Definition at line 1021 of file OOJavaScriptEngine.m.

1022{
1023 NSString* msg = nil;
1024
1025 @try {
1026 msg = [[NSString alloc] initWithFormat:format arguments:args];
1027 JS_ReportWarning(context, "%s", [msg UTF8String]);
1028 }
1029 @catch (id exception) {
1030 // Squash any secondary errors during error handling.
1031 }
1032 [msg release];
1033}

References CurrentStack(), LogProblem(), LogProblem(), nil, OOJSPauseTimeLimiter(), OOJSResumeTimeLimiter(), and StackOfValue().

Referenced by OOJSReportWarning().

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

◆ OOJSReportWrappedException()

void OOJSReportWrappedException ( JSContext * context,
id exception )

Definition at line 973 of file OOJavaScriptEngine.m.

974{
975 if (!JS_IsExceptionPending(context)) {
976 if ([exception isKindOfClass:[NSException class]])
977 OOJSReportError(context, @"Native exception: %@", [exception reason]);
978 else
979 OOJSReportError(context, @"Unidentified native exception");
980 }
981 // Else, let the pending exception propagate.
982}

References OOJSReportError().

Referenced by ManifestDeleteProperty(), ManifestGetOwnProperty(), ManifestSetPropertyExotic(), MissionVariablesDefineOwnProperty(), MissionVariablesDeleteProperty(), MissionVariablesGetOwnProperty(), MissionVariablesGetOwnPropertyNames(), MissionVariablesSetProperty(), WorldScriptsGetOwnProperty(), and WorldScriptsGetOwnPropertyNames().

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

◆ OOJSResetTimeLimiter()

void OOJSResetTimeLimiter ( void )

Definition at line 156 of file OOJSEngineTimeManagement.m.

157{
160
161 sStop = NO;
162}
static BOOL sStop
static OOHighResTimeValue sLimiterStart

References MonotonicTime(), OODisposeHighResTime, OOGetHighResTime, sLimiterStart, and sStop.

Here is the call graph for this function:

◆ OOJSResumeTimeLimiter()

void OOJSResumeTimeLimiter ( void )

Definition at line 137 of file OOJSEngineTimeManagement.m.

138{
139 if (--sLimiterPauseDepth == 0)
140
141 {
145
146 sLimiterTimeLimit += elapsed;
147 }
148}
OOTimeDelta OOHighResTimeDeltaInSeconds(OOHighResTimeValue startTime, OOHighResTimeValue endTime)
uint64_t OOHighResTimeValue
double OOTimeDelta
Definition OOTypes.h:193

References MonotonicTime(), MonotonicTime(), sLimiterPauseDepth, sLimiterPauseStart, and sLimiterTimeLimit.

Referenced by OOJSReportPendingException().

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

◆ OOJSSetTimeLimiterLimit()

void OOJSSetTimeLimiterLimit ( OOTimeDelta limit)

Definition at line 169 of file OOJSEngineTimeManagement.m.

170{
171 sLimiterTimeLimit = limit;
172}

References sLimiterTimeLimit.

◆ OOJSSetWarningOrErrorStackSkip()

void OOJSSetWarningOrErrorStackSkip ( unsigned skip)

Definition at line 1068 of file OOJavaScriptEngine.m.

1069{
1071}
static unsigned sErrorHandlerStackSkip

References sErrorHandlerStackSkip.

◆ OOJSStartTimeLimiterWithTimeLimit()

void OOJSStartTimeLimiterWithTimeLimit ( OOTimeDelta limit)

Definition at line 626 of file OOJavaScriptEngine.m.

627{
628 if (sLimiterStartDepth++ == 0) {
629 if (limit <= 0.0)
630 limit = OOJS_TIME_LIMIT;
631 sLimiterTimeLimit = limit;
634 }
635}
#define OOJS_TIME_LIMIT
static unsigned sLimiterStartDepth
static double MonotonicTime(void)

References MonotonicTime(), MonotonicTime(), OOJS_TIME_LIMIT, sLimiterPauseDepth, sLimiterStart, sLimiterStartDepth, and sLimiterTimeLimit.

Here is the call graph for this function:

◆ OOJSStopTimeLimiter()

void OOJSStopTimeLimiter ( void )

Definition at line 637 of file OOJavaScriptEngine.m.

638{
639 if (sLimiterStartDepth == 0) {
640 OOLog(@"bug.javaScript.limiterDepth", @"%@", @"Attempt to stop JavaScript time limiter while it is already fully stopped. This is an internal bug, please report it.");
641 return;
642 }
643
644 if (--sLimiterStartDepth == 0)
645 sLimiterTimeLimit = 0.0;
646}
#define OOLog(class, format,...)
Definition OOLogging.h:84

References OOLog, sLimiterStartDepth, and sLimiterTimeLimit.

Referenced by OOJavaScriptEngine::callJSFunction:forObject:argc:argv:result:.

Here is the caller graph for this function:

◆ OOJSUnconstructableConstruct()

JSValue OOJSUnconstructableConstruct ( JSContext * context,
JSValueConst this,
int argc,
JSValueConst * argv )

Definition at line 1586 of file OOJavaScriptEngine.m.

1587{
1588 // For constructors, this is new.target, i.e. the constructor function itself.
1589 JSValue nameVal = JS_GetPropertyStr(context, this, "name");
1590 NSString* name = OOStringFromJSValue(context, nameVal);
1591 JS_FreeValue(context, nameVal);
1592
1593 OOJSReportError(context, @"%@ cannot be used as a constructor.", name);
1594 return JS_EXCEPTION;
1595}

References OOJSReportError(), and OOStringFromJSValue().

Here is the call graph for this function:

◆ OOJSValueFromBOOL()

OOINLINE JSValue OOJSValueFromBOOL ( int b)

Definition at line 318 of file OOJavaScriptEngine.h.

319{
320 return JS_NewBool(NULL, b != 0);
321}

References OOINLINE.

◆ OOJSValueFromDouble()

OOINLINE JSValue OOJSValueFromDouble ( JSContext * context,
double value )

Definition at line 225 of file OOJavaScriptEngine.h.

226{
227 return JS_NewNumber(context, value);
228}

References OOINLINE.

◆ OOJSValueFromNativeObject()

OOINLINE JSValue OOJSValueFromNativeObject ( JSContext * context,
id object )

Definition at line 352 of file OOJavaScriptEngine.h.

353{
354 if (object != nil)
355 return [object oo_jsValueInContext:context];
356 return JS_NULL;
357}

References nil, and OOINLINE.

◆ OOJSValueIsArray()

OOINLINE BOOL OOJSValueIsArray ( JSContext * context,
JSValueConst value )

Definition at line 462 of file OOJavaScriptEngine.h.

463{
464 return JS_IsArray(value);
465}

References OOINLINE.

◆ OOJSValueIsFunction()

OOINLINE BOOL OOJSValueIsFunction ( JSContext * context,
JSValueConst value )

Definition at line 457 of file OOJavaScriptEngine.h.

458{
459 return JS_IsFunction(context, value);
460}

References OOINLINE.

◆ OOJSValueIsUndefined()

OOINLINE BOOL OOJSValueIsUndefined ( JSValueConst value)

Definition at line 221 of file OOJavaScriptEngine.h.

222{
223 return JS_IsUndefined(value);
224}

References OOINLINE.

◆ OOJSValueToBOOL()

BOOL OOJSValueToBOOL ( JSContext * context,
JSValueConst value )

Definition at line 574 of file OOJavaScriptEngine.m.

575{
576 int result = JS_ToBool(context, value);
577 if (result < 0) {
578 JS_FreeValue(context, JS_GetException(context));
579 return NO;
580 }
581 return result != 0;
582}

◆ OOJSValueToInt32()

BOOL OOJSValueToInt32 ( JSContext * context,
JSValueConst value,
int32_t * outValue )

Definition at line 584 of file OOJavaScriptEngine.m.

585{
586 double number;
587 if (JS_ToFloat64(context, &number, value) < 0)
588 return NO;
589
590 number = floor(number + 0.5);
591 if (isnan(number) || number < INT32_MIN || number > INT32_MAX) {
592 OOJSReportError(context, @"can't convert %@ to an integer", OOStringFromJSValueEvenIfNull(context, value));
593 return NO;
594 }
595
596 *outValue = (int32_t)number;
597 return YES;
598}

References OOJSReportError(), and OOStringFromJSValueEvenIfNull().

Here is the call graph for this function:

◆ OOJSWrapScriptSource()

NSString * OOJSWrapScriptSource ( NSString * source)

Definition at line 567 of file OOJavaScriptEngine.m.

568{
569 // A newline before the closing part is needed if the last line is a // comment.
570 NSString* lineEnd = [source hasSuffix:@"\n"] ? @"" : @"\n";
571 return [NSString stringWithFormat:@"with(this){(function(){%@%@}).call(this)}", source, lineEnd];
572}

◆ OOStringFromJSID()

NSString * OOStringFromJSID ( JSAtom propID)

Definition at line 1078 of file OOJavaScriptEngine.m.

1079{
1080 JSContext* context = OOJSAcquireContext();
1081 JSValue value = JS_AtomToString(context, propID);
1082 NSString* result = OOStringFromJSValue(context, value);
1083 JS_FreeValue(context, value);
1084 return result;
1085}

References OOJSAcquireContext(), and OOStringFromJSValue().

Here is the call graph for this function:

◆ OOStringFromJSPropertyMagic()

NSString * OOStringFromJSPropertyMagic ( int magic,
const JSCFunctionListEntry * list,
size_t count )

Definition at line 949 of file OOJavaScriptEngine.m.

950{
951 for (size_t i = 0; i < count; i++) {
952 if (list[i].def_type == JS_DEF_CGETSET_MAGIC && list[i].magic == magic)
953 return [NSString stringWithUTF8String:list[i].name];
954 }
955 return [NSString stringWithFormat:@"%i", magic];
956}

References count.

Referenced by OOJSReportBadPropertySelector(), OOJSReportBadPropertyValue(), and ShipSetProperty().

Here is the caller graph for this function:

◆ OOStringFromJSValue()

NSString * OOStringFromJSValue ( JSContext * context,
JSValueConst value )

Definition at line 1301 of file OOJavaScriptEngine.m.

1302{
1304
1305 if (EXPECT(!JS_IsNull(value) && !JS_IsUndefined(value))) {
1306 return OOStringFromJSValueEvenIfNull(context, value);
1307 }
1308 return nil;
1309
1311}

References EXPECT, nil, OOJS_PROFILE_ENTER, OOJS_PROFILE_EXIT, OOStringFromJSValueEvenIfNull(), and OOStringFromJSValueEvenIfNull().

Referenced by DescribeValue(), GlobalLog(), OOJSClassNameOfValue(), OOJSReportPendingException(), and StackOfValue().

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

◆ OOStringFromJSValueEvenIfNull()

NSString * OOStringFromJSValueEvenIfNull ( JSContext * context,
JSValueConst value )

Definition at line 1283 of file OOJavaScriptEngine.m.

1284{
1286
1287 size_t length;
1288 const char* chars = JS_ToCStringLen(context, &length, value); // Calls the value's toString method if needed.
1289 if (chars == NULL) {
1290 JS_FreeValue(context, JS_GetException(context));
1291 return nil;
1292 }
1293
1294 NSString* result = [[[NSString alloc] initWithBytes:chars length:length encoding:NSUTF8StringEncoding] autorelease];
1295 JS_FreeCString(context, chars);
1296 return result;
1297
1299}

References nil, OOJS_PROFILE_ENTER, and OOJS_PROFILE_EXIT.

Referenced by DescribeValue(), GlobalLog(), OOJSReportPendingException(), and OOStringFromJSValue().

Here is the caller graph for this function:

Variable Documentation

◆ gOOJSArrayClassID

JSClassID gOOJSArrayClassID

Definition at line 450 of file OOJavaScriptEngine.h.

Referenced by RegisterStandardObjectConverters().

◆ gOOJSBooleanClassID

JSClassID gOOJSBooleanClassID

Definition at line 450 of file OOJavaScriptEngine.h.

Referenced by RegisterStandardObjectConverters().

◆ gOOJSNumberClassID

JSClassID gOOJSNumberClassID

Definition at line 450 of file OOJavaScriptEngine.h.

Referenced by RegisterStandardObjectConverters().

◆ gOOJSObjectClassID

JSClassID gOOJSObjectClassID
extern

Definition at line 1884 of file OOJavaScriptEngine.m.

Referenced by DescribeValue(), and RegisterStandardObjectConverters().

◆ gOOJSStringClassID

◆ kOOJavaScriptEngineDidResetNotification

NSString* const kOOJavaScriptEngineDidResetNotification
extern

Definition at line 97 of file OOJavaScriptEngine.m.

◆ kOOJavaScriptEngineWillResetNotification

NSString* const kOOJavaScriptEngineWillResetNotification
extern

Definition at line 96 of file OOJavaScriptEngine.m.