*/
SS_DATATYPE_OBJECT,
/**
- * \brief Array data type
+ * \brief Array data type (invalid when using static typing)
*/
SS_DATATYPE_ARRAY,
/**
NUM_SS_DATATYPES
};
+#define SS_MAKEARRAY(_type) ((_type) + 0x10000)
+#define SS_DOWNARRAY(_type) ((_type) - 0x10000)
+#define SS_GETARRAYDEPTH(_type) ((_type) >> 16)
+
+enum eSpiderValueOps
+{
+ SS_VALUEOP_NOP,
+
+ SS_VALUEOP_ADD,
+ SS_VALUEOP_SUBTRACT,
+ SS_VALUEOP_NEGATE,
+ SS_VALUEOP_MULIPLY,
+ SS_VALUEOP_DIVIDE,
+ SS_VALUEOP_MODULO,
+
+ SS_VALUEOP_BITNOT,
+ SS_VALUEOP_BITAND,
+ SS_VALUEOP_BITOR,
+ SS_VALUEOP_BITXOR,
+
+ SS_VALUEOP_SHIFTLEFT,
+ SS_VALUEOP_SHIFTRIGHT,
+ SS_VALUEOP_ROTATELEFT
+};
+
/**
* \brief Namespace definition
*/
int ReferenceCount; //!< Reference count
union {
- uint64_t Integer; //!< Integer data
+ int64_t Integer; //!< Integer data
double Real; //!< Real Number data
/**
* \brief String data
* \brief Function handler
*/
tSpiderValue *(*Handler)(tSpiderScript *Script, int nParams, tSpiderValue **Parameters);
+
+ /**
+ * \brief What type is returned
+ */
+ int ReturnType;
+
/**
* \brief Argument types
*
* \return Return value
*/
extern tSpiderValue *SpiderScript_ExecuteFunction(tSpiderScript *Script,
- tSpiderNamespace *Namespace, const char *Function,
+ const char *Function, const char *DefaultNamespaces[],
+ int NArguments, tSpiderValue **Arguments,
+ void **FunctionIdent
+ );
+/**
+ * \brief Execute an object method
+ */
+extern tSpiderValue *SpiderScript_ExecuteMethod(tSpiderScript *Script,
+ tSpiderObject *Object, const char *MethodName,
+ int NArguments, tSpiderValue **Arguments
+ );
+/**
+ * \brief Creates an object instance
+ */
+extern tSpiderValue *SpiderScript_CreateObject(tSpiderScript *Script,
+ const char *ClassName, const char *DefaultNamespaces[],
int NArguments, tSpiderValue **Arguments
);
+/**
+ * \brief Convert a script to bytecode and save to a file
+ */
+extern int SpiderScript_SaveBytecode(tSpiderScript *Script, const char *DestFile);
+/**
+ * \brief Save the AST of a script to a file
+ */
+extern int SpiderScript_SaveAST(tSpiderScript *Script, const char *Filename);
+
/**
* \brief Free a script
* \param Script Script structure to free
* \name tSpiderValue Manipulation functions
* \{
*/
+extern void SpiderScript_DereferenceValue(tSpiderValue *Object);
+extern void SpiderScript_ReferenceValue(tSpiderValue *Object);
extern tSpiderValue *SpiderScript_CreateInteger(uint64_t Value);
extern tSpiderValue *SpiderScript_CreateReal(double Value);
extern tSpiderValue *SpiderScript_CreateString(int Length, const char *Data);
+extern tSpiderValue *SpiderScript_StringConcat(const tSpiderValue *Str1, const tSpiderValue *Str2);
extern tSpiderValue *SpiderScript_CastValueTo(int Type, tSpiderValue *Source);
extern int SpiderScript_IsValueTrue(tSpiderValue *Value);
extern void SpiderScript_FreeValue(tSpiderValue *Value);
extern char *SpiderScript_DumpValue(tSpiderValue *Value);
+
+extern tSpiderValue *SpiderScript_DoOp(tSpiderValue *Left, enum eSpiderValueOps Op, int bCanCast, tSpiderValue *Right);
/**
* \}
*/