Sirikata
|
#include <v8.h>
#include <sirikata/core/util/Platform.hpp>
#include "../JSObjectStructs/JSPositionListener.hpp"
Go to the source code of this file.
Namespaces | |
namespace | Sirikata |
Note: All the classes provided in this file are thin wrappers around the corresponding classes in ASIO. | |
namespace | Sirikata::JS |
Defines | |
#define | V8_EXCEPTION_STRING(stringErrMsg) return v8::ThrowException(v8::Exception::Error(v8::String::New(stringErrMsg.c_str(),stringErrMsg.length()))); |
#define | V8_EXCEPTION_CSTR(cstrErrMsg) return v8::ThrowException(v8::Exception::Error(v8::String::New(cstrErrMsg))); |
#define | INLINE_TIME_CONV_ERROR(toConvert, whereError, whichArg, whereWriteTo) |
#define | INLINE_DOUBLE_CONV_ERROR(toConvert, whereError, whichArg, whereWriteTo) |
#define | INLINE_INTEGER_CONV_ERROR(toConvert, whereError, whichArg, whereWriteTo) |
#define | INLINE_SPACEID_CONV_ERROR(toConvert, whereError, whichArg, whereWriteTo) |
#define | INLINE_OBJID_CONV_ERROR(toConvert, whereError, whichArg, whereWriteTo) |
#define | INLINE_SA_CONV_ERROR(toConvert, whereError, whichArg, whereWriteTo) |
#define | INLINE_DECODE_UINT_32(toConvert, whereWriteTo) |
#define | INLINE_DECODE_UINT_32_ERROR(toConvert, whereError, whichArg, whereWriteTo) |
#define | INLINE_STR_CONV_ERROR(toConvert, whereError, whichArg, whereWriteTo) |
#define | INLINE_STR_CONV(toConvert, whereWriteTo, defaultArg) |
Functions | |
JSPositionListener * | Sirikata::JS::decodeJSPosListener (v8::Handle< v8::Value > toDecode, String &errorMessage) |
bool | Sirikata::JS::decodeString (v8::Handle< v8::Value > toDecode, String &decodedValue, String &errorMessage) |
bool | Sirikata::JS::decodeBool (v8::Handle< v8::Value > toDecode, bool &decodedValue, String &errorMessage) |
bool | Sirikata::JS::decodeSporef (v8::Handle< v8::Value > toDecode, SpaceObjectReference &sporef, String &errorMessage) |
bool | Sirikata::JS::decodeSpaceID (v8::Handle< v8::Value > toDecode, SpaceID &space, String &errorMessage) |
bool | Sirikata::JS::decodeObjectReference (v8::Handle< v8::Value > toDecode, ObjectReference &oref, String &errorMessage) |
bool | Sirikata::JS::decodeUint64FromString (v8::Handle< v8::Value > toDecode, uint64 &decodedInt, String &errorMessage) |
bool | Sirikata::JS::decodeTimedMotionVector (v8::Handle< v8::Value >toDecodePos, v8::Handle< v8::Value >toDecodeVel, v8::Handle< v8::Value >toDecodeTimeAsString, TimedMotionVector3f &toDecodeTo, String &errorMessage) |
bool | Sirikata::JS::decodeTimedMotionQuat (v8::Handle< v8::Value > orientationQuat, v8::Handle< v8::Value > orientationVelQuat, v8::Handle< v8::Value > toDecodeTimeAsString, TimedMotionQuaternion &toDecodeTo, String &errorMessage) |
bool | Sirikata::JS::decodeBoundingSphere3f (v8::Handle< v8::Value > toDecodeCenterVec, v8::Handle< v8::Value > toDecodeRadius, BoundingSphere3f &toDecodeTo, String &errMsg) |
bool | Sirikata::JS::decodeInt64 (v8::Handle< v8::Value > toDecode, int64 &toDecodeTo, String &errMsg) |
bool | Sirikata::JS::decodeUint32 (v8::Handle< v8::Value > toDecode, uint32 &toDecodeTo, String &errMsg) |
bool | Sirikata::JS::decodeSolidAngle (v8::Handle< v8::Value > toDecode, SolidAngle &toDecodeTo, String &errMsg) |
bool | Sirikata::JS::decodeDouble (v8::Handle< v8::Value > toDecode, double &toDecodeTo, String &errMsg) |
bool | Sirikata::JS::decodeTimeFromString (v8::Handle< v8::Value > toDecode, Time &toDecodeTo, String &errorMessage) |
void | Sirikata::JS::debug_checkCurrentContextX (v8::Handle< v8::Context > ctx, String additionalMessage) |
void | Sirikata::JS::printAllPropertyNames (v8::Handle< v8::Object > objToPrint) |
String | Sirikata::JS::uint16StrToStr (v8::Handle< v8::String > toDeserialize) |
v8::Handle< v8::Value > | Sirikata::JS::strToUint16Str (const String &toSerialize) |
#define INLINE_DECODE_UINT_32 | ( | toConvert, | |
whereWriteTo | |||
) |
uint32 whereWriteTo; \ { \ String _errMsg; \ if (! decodeUint32(toConvert,whereWriteTo,_errMsg)) \ JSLOG(error, "error. cannot decode the uint32 in INLINE_DECODE_UINT_32"); \ }
toConvert | v8::Handle<v8::Value> that we will try to decode as a uint32 |
whereWriteTo | should be the name of the uint32 that we want to decode the uint32 to. Shouldn't already be declared. Gets declared in the following #define. |
#define INLINE_DECODE_UINT_32_ERROR | ( | toConvert, | |
whereError, | |||
whichArg, | |||
whereWriteTo | |||
) |
uint32 whereWriteTo; \ { \ String _errMsg = "In " #whereError "cannot convert " #whichArg " to uint32";\ if (! decodeUint32(toConvert,whereWriteTo,_errMsg)) \ return v8::ThrowException(v8::Exception::Error(v8::String::New(_errMsg.c_str(), _errMsg.length()))); \ }
Referenced by Sirikata::JS::JSSystem::root_createContext().
#define INLINE_DOUBLE_CONV_ERROR | ( | toConvert, | |
whereError, | |||
whichArg, | |||
whereWriteTo | |||
) |
double whereWriteTo; \ { \ String _errMsg = "In " #whereError " cannot convert arg " #whichArg " to double"; \ if (!decodeDouble(toConvert,whereWriteTo,_errMsg)) \ V8_EXCEPTION_STRING(_errMsg); \ }
Referenced by Sirikata::JS::JSUtilObj::ScriptDiv(), and Sirikata::JS::JSUtilObj::ScriptMult().
#define INLINE_INTEGER_CONV_ERROR | ( | toConvert, | |
whereError, | |||
whichArg, | |||
whereWriteTo | |||
) |
int64 whereWriteTo; \ { \ String _errMsg = "In " #whereError " cannot convert arg " #whichArg " to integer"; \ if (!decodeInt64(toConvert,whereWriteTo,_errMsg)) \ V8_EXCEPTION_STRING(_errMsg); \ }
Referenced by Sirikata::JS::JSUtilObj::ScriptMod().
#define INLINE_OBJID_CONV_ERROR | ( | toConvert, | |
whereError, | |||
whichArg, | |||
whereWriteTo | |||
) |
ObjectReference whereWriteTo; \ { \ String _errMsg = "In " #whereError "cannot convert arg " #whichArg " to object reference"; \ if (!decodeObjectReference(toConvert,whereWriteTo,_errMsg)) \ return v8::ThrowException(v8::Exception::Error(v8::String::New(_errMsg.c_str(), _errMsg.length()))); \ }
Referenced by Sirikata::JS::JSUtilObj::ScriptSporef().
#define INLINE_SA_CONV_ERROR | ( | toConvert, | |
whereError, | |||
whichArg, | |||
whereWriteTo | |||
) |
SolidAngle whereWriteTo; \ { \ String _errMsg = "In " #whereError "cannot convert arg " #whichArg " to solid angle"; \ if (!decodeSolidAngle(toConvert,whereWriteTo,_errMsg)) \ return v8::ThrowException(v8::Exception::Error(v8::String::New(_errMsg.c_str(), _errMsg.length()))); \ }
#define INLINE_SPACEID_CONV_ERROR | ( | toConvert, | |
whereError, | |||
whichArg, | |||
whereWriteTo | |||
) |
SpaceID whereWriteTo; \ { \ String _errMsg = "In " #whereError "cannot convert arg " #whichArg " to space id"; \ if (!decodeSpaceID(toConvert,whereWriteTo,_errMsg)) \ return v8::ThrowException(v8::Exception::Error(v8::String::New(_errMsg.c_str(), _errMsg.length()))); \ }
Referenced by Sirikata::JS::JSUtilObj::ScriptSporef().
#define INLINE_STR_CONV | ( | toConvert, | |
whereWriteTo, | |||
defaultArg | |||
) |
String whereWriteTo; \ { \ String _errMsg; \ if (!decodeString(toConvert,whereWriteTo,_errMsg)) \ { \ JSLOG(error,"error. cannot decode the string value in INLINE_STR_CONV"); \ whereWriteTo = defaultArg; \ } \ }
toConvert | v8::Handle<v8::Value> that we are trying to read as a string |
whereWriteTo | should be the name of the string that we want to decode the string to. shouldn't already be declared. Becomes declared in the #define. If string conversion failed, log error, and write default value into string. |
defaultArg | If string conversion fails, set whereWriteTo string to this string. |
Referenced by Sirikata::JS::getPropertyNames(), Sirikata::JS::JSSerializer::serializeFieldValueInternal(), and Sirikata::JS::JSSerializer::serializeObjectInternal().
#define INLINE_STR_CONV_ERROR | ( | toConvert, | |
whereError, | |||
whichArg, | |||
whereWriteTo | |||
) |
String whereWriteTo; \ { \ String _errMsg = "In " #whereError "cannot convert arg " #whichArg " to string"; \ if (!decodeString(toConvert,whereWriteTo,_errMsg)) \ return v8::ThrowException(v8::Exception::Error(v8::String::New(_errMsg.c_str(), _errMsg.length()))); \ }
toConvert | is a v8::Handle<v8::Value> that we are trying to read as a string |
whereError | should be the name of the function that running this in. Will be part of error message if cannot decode string. |
whichArg | should be a number that corresponds to which arg couldn't decode. Will be part of error message if cannot decode string. |
whereWriteTo | should be the name of the string that we want to decode the string to. shouldn't already be declared. Becomes declared in the #define. |
Referenced by Sirikata::JS::JSSystem::emersonCompileString(), Sirikata::JS::JSSystem::pushEvalContextScopeDirectory(), Sirikata::JS::JSSystem::root_createEntity(), Sirikata::JS::JSSystem::root_createEntityNoSpace(), Sirikata::JS::JSSystem::root_http(), Sirikata::JS::JSSystem::root_print(), Sirikata::JS::JSSystem::setRestoreScript(), Sirikata::JS::JSSystem::storageCount(), Sirikata::JS::JSSystem::storageErase(), Sirikata::JS::JSSystem::storageRangeErase(), Sirikata::JS::JSSystem::storageRangeRead(), Sirikata::JS::JSSystem::storageRead(), and Sirikata::JS::JSSystem::storageWrite().
#define INLINE_TIME_CONV_ERROR | ( | toConvert, | |
whereError, | |||
whichArg, | |||
whereWriteTo | |||
) |
Time whereWriteTo; \ { \ String _errMsg = "In " #whereError " cannot convert arg " #whichArg " to Time"; \ if (!decodeTimeFromString(toConvert,whereWriteTo,_errMsg)) \ V8_EXCEPTION_STRING(_errMsg); \ }
Referenced by Sirikata::JS::JSSystem::root_restorePresence().
#define V8_EXCEPTION_CSTR | ( | cstrErrMsg | ) | return v8::ThrowException(v8::Exception::Error(v8::String::New(cstrErrMsg))); |
Referenced by Sirikata::JS::JSObjectScript::debug_fileRead(), Sirikata::JS::JSObjectScript::debug_fileWrite(), Sirikata::JS::JSSystem::emersonCompileString(), Sirikata::JS::JSObjectScript::executeInSandbox(), Sirikata::JS::JSSystem::getAssociatedPresence(), Sirikata::JS::JSSystem::getUniqueToken(), Sirikata::JS::JSSystemStruct::httpRequest(), Sirikata::JS::JSInvokableObject::invoke(), Sirikata::JS::JSObjectScript::popEvalContextScopeDirectory(), Sirikata::JS::JSSystem::popEvalContextScopeDirectory(), Sirikata::JS::JSObjectScript::pushEvalContextScopeDirectory(), Sirikata::JS::JSSystem::pushEvalContextScopeDirectory(), Sirikata::JS::JSSystem::root_restorePresence(), Sirikata::JS::JSSystem::root_sendSandbox(), Sirikata::JS::JSUtilObj::ScriptDiv(), Sirikata::JS::JSUtilObj::ScriptEqual(), Sirikata::JS::JSUtilObj::ScriptMod(), Sirikata::JS::JSUtilObj::ScriptMult(), Sirikata::JS::JSSystemStruct::sendMessageNoErrorHandler(), Sirikata::JS::JSContextStruct::sendSandbox(), Sirikata::JS::JSSystem::setPresenceMessageCallback(), Sirikata::JS::JSSystem::setSandboxMessageCallback(), and Sirikata::JS::JSSystemStruct::struct_createContext().
#define V8_EXCEPTION_STRING | ( | stringErrMsg | ) | return v8::ThrowException(v8::Exception::Error(v8::String::New(stringErrMsg.c_str(),stringErrMsg.length()))); |