SQInteger _extarget;\r
};\r
\r
+#define _INLINE \r
\r
#define STK(a) _stack._vals[_stackbase+(a)]\r
#define TARGET _stack._vals[_stackbase+arg0]\r
SQBool _root;\r
VarArgs _vargs;\r
};\r
-\r
+ \r
typedef sqvector<CallInfo> CallInfoVec;\r
public:\r
enum ExecutionType { ET_CALL, ET_RESUME_GENERATOR, ET_RESUME_VM };\r
SQVM(SQSharedState *ss);\r
~SQVM();\r
bool Init(SQVM *friendvm, SQInteger stacksize);\r
- bool Execute(SQObjectPtr &func, SQInteger target, SQInteger nargs, SQInteger stackbase, SQObjectPtr &outres, ExecutionType et = ET_CALL);\r
- //start a native call return when the NATIVE closure returns(returns true if the vm has been suspended)\r
+ bool Execute(SQObjectPtr &func, SQInteger target, SQInteger nargs, SQInteger stackbase, SQObjectPtr &outres, SQBool raiseerror, ExecutionType et = ET_CALL);\r
+ //starts a native call return when the NATIVE closure returns\r
bool CallNative(SQNativeClosure *nclosure, SQInteger nargs, SQInteger stackbase, bool tailcall, SQObjectPtr &retval,bool &suspend);\r
- //start a SQUIRREL call in the same "Execution loop"\r
+ //starts a SQUIRREL call in the same "Execution loop"\r
bool StartCall(SQClosure *closure, SQInteger target, SQInteger nargs, SQInteger stackbase, bool tailcall);\r
- bool CreateClassInstance(SQClass *theclass, SQInteger nargs, SQInteger stackbase, SQObjectPtr &retval);\r
+ bool CreateClassInstance(SQClass *theclass, SQObjectPtr &inst, SQObjectPtr &constructor);\r
//call a generic closure pure SQUIRREL or NATIVE\r
- bool Call(SQObjectPtr &closure, SQInteger nparams, SQInteger stackbase, SQObjectPtr &outres);\r
+ bool Call(SQObjectPtr &closure, SQInteger nparams, SQInteger stackbase, SQObjectPtr &outres,SQBool raiseerror);\r
SQRESULT Suspend();\r
\r
void CallDebugHook(SQInteger type,SQInteger forcedline=0);\r
bool Get(const SQObjectPtr &self, const SQObjectPtr &key, SQObjectPtr &dest, bool raw, bool fetchroot);\r
bool FallBackGet(const SQObjectPtr &self,const SQObjectPtr &key,SQObjectPtr &dest,bool raw);\r
bool Set(const SQObjectPtr &self, const SQObjectPtr &key, const SQObjectPtr &val, bool fetchroot);\r
- bool NewSlot(const SQObjectPtr &self, const SQObjectPtr &key, const SQObjectPtr &val);\r
+ bool NewSlot(const SQObjectPtr &self, const SQObjectPtr &key, const SQObjectPtr &val,bool bstatic);\r
bool DeleteSlot(const SQObjectPtr &self, const SQObjectPtr &key, SQObjectPtr &res);\r
bool Clone(const SQObjectPtr &self, SQObjectPtr &target);\r
bool ObjCmp(const SQObjectPtr &o1, const SQObjectPtr &o2,SQInteger &res);\r
bool ArithMetaMethod(SQInteger op, const SQObjectPtr &o1, const SQObjectPtr &o2, SQObjectPtr &dest);\r
bool Return(SQInteger _arg0, SQInteger _arg1, SQObjectPtr &retval);\r
//new stuff\r
- inline bool ARITH_OP(SQUnsignedInteger op,SQObjectPtr &trg,const SQObjectPtr &o1,const SQObjectPtr &o2);\r
- inline bool BW_OP(SQUnsignedInteger op,SQObjectPtr &trg,const SQObjectPtr &o1,const SQObjectPtr &o2);\r
- inline bool NEG_OP(SQObjectPtr &trg,const SQObjectPtr &o1);\r
- inline bool CMP_OP(CmpOP op, const SQObjectPtr &o1,const SQObjectPtr &o2,SQObjectPtr &res);\r
+ _INLINE bool ARITH_OP(SQUnsignedInteger op,SQObjectPtr &trg,const SQObjectPtr &o1,const SQObjectPtr &o2);\r
+ _INLINE bool BW_OP(SQUnsignedInteger op,SQObjectPtr &trg,const SQObjectPtr &o1,const SQObjectPtr &o2);\r
+ _INLINE bool NEG_OP(SQObjectPtr &trg,const SQObjectPtr &o1);\r
+ _INLINE bool CMP_OP(CmpOP op, const SQObjectPtr &o1,const SQObjectPtr &o2,SQObjectPtr &res);\r
bool CLOSURE_OP(SQObjectPtr &target, SQFunctionProto *func);\r
bool GETVARGV_OP(SQObjectPtr &target,SQObjectPtr &idx,CallInfo *ci);\r
bool CLASS_OP(SQObjectPtr &target,SQInteger base,SQInteger attrs);\r
+ bool GETPARENT_OP(SQObjectPtr &o,SQObjectPtr &target);\r
//return true if the loop is finished\r
bool FOREACH_OP(SQObjectPtr &o1,SQObjectPtr &o2,SQObjectPtr &o3,SQObjectPtr &o4,SQInteger arg_2,bool &finished);\r
bool DELEGATE_OP(SQObjectPtr &trg,SQObjectPtr &o1,SQObjectPtr &o2);\r
- inline bool LOCAL_INC(SQInteger op,SQObjectPtr &target, SQObjectPtr &a, SQObjectPtr &incr);\r
- inline bool PLOCAL_INC(SQInteger op,SQObjectPtr &target, SQObjectPtr &a, SQObjectPtr &incr);\r
- inline bool DerefInc(SQInteger op,SQObjectPtr &target, SQObjectPtr &self, SQObjectPtr &key, SQObjectPtr &incr, bool postfix);\r
+ _INLINE bool LOCAL_INC(SQInteger op,SQObjectPtr &target, SQObjectPtr &a, SQObjectPtr &incr);\r
+ _INLINE bool PLOCAL_INC(SQInteger op,SQObjectPtr &target, SQObjectPtr &a, SQObjectPtr &incr);\r
+ _INLINE bool DerefInc(SQInteger op,SQObjectPtr &target, SQObjectPtr &self, SQObjectPtr &key, SQObjectPtr &incr, bool postfix);\r
void PopVarArgs(VarArgs &vargs);\r
#ifdef _DEBUG_DUMP\r
void dumpstack(SQInteger stackbase=-1, bool dumpall = false);\r
//stack functions for the api\r
void Remove(SQInteger n);\r
\r
- inline bool IsFalse(SQObjectPtr &o)\r
- {\r
- if((type(o) & SQOBJECT_CANBEFALSE) && ( (type(o) == OT_FLOAT) && (_float(o) == SQFloat(0.0)) )\r
- || (_integer(o) == 0) ) { //OT_NULL|OT_INTEGER|OT_BOOL\r
- return true;\r
- }\r
- return false;\r
- }\r
- inline void Pop() {\r
- _stack[--_top] = _null_;\r
- }\r
-\r
- inline void Pop(SQInteger n) {\r
- for(SQInteger i = 0; i < n; i++){\r
- _stack[--_top] = _null_;\r
- }\r
- }\r
-\r
- inline void Push(const SQObjectPtr &o) { _stack[_top++] = o; }\r
- inline SQObjectPtr &Top() { return _stack[_top-1]; }\r
- inline SQObjectPtr &PopGet() { return _stack[--_top]; }\r
- inline SQObjectPtr &GetUp(SQInteger n) { return _stack[_top+n]; }\r
- inline SQObjectPtr &GetAt(SQInteger n) { return _stack[n]; }\r
+ bool IsFalse(SQObjectPtr &o);\r
+ \r
+ void Pop();\r
+ void Pop(SQInteger n);\r
+ void Push(const SQObjectPtr &o);\r
+ SQObjectPtr &Top();\r
+ SQObjectPtr &PopGet();\r
+ SQObjectPtr &GetUp(SQInteger n);\r
+ SQObjectPtr &GetAt(SQInteger n);\r
\r
SQObjectPtrVec _stack;\r
SQObjectPtrVec _vargsstack;\r
SQInteger _top;\r
SQInteger _stackbase;\r
SQObjectPtr _roottable;\r
- //SQObjectPtr _thrownerror;\r
SQObjectPtr _lasterror;\r
SQObjectPtr _errorhandler;\r
SQObjectPtr _debughook;\r