1 /* see copyright notice in squirrel.h */
2 #ifndef _SQFUNCSTATE_H_
3 #define _SQFUNCSTATE_H_
4 ///////////////////////////////////
11 SQFuncState(SQSharedState *ss,SQFunctionProto *func,SQFuncState *parent);
15 void AddInstruction(SQOpcode _op,int arg0=0,int arg1=0,int arg2=0,int arg3=0){SQInstruction i(_op,arg0,arg1,arg2,arg3);AddInstruction(i);}
16 void AddInstruction(SQInstruction &i);
17 void SetIntructionParams(int pos,int arg0,int arg1,int arg2=0,int arg3=0);
18 void SetIntructionParam(int pos,int arg,int val);
19 SQInstruction &GetInstruction(int pos){return _instructions[pos];}
20 void PopInstructions(int size){for(int i=0;i<size;i++)_instructions.pop_back();}
21 void SetStackSize(int n);
22 void SnoozeOpt(){_optimization=false;}
23 int GetCurrentPos(){return _instructions.size()-1;}
24 int GetStringConstant(const SQChar *cons);
25 int GetNumericConstant(const SQInteger cons);
26 int GetNumericConstant(const SQFloat cons);
27 int PushLocalVariable(const SQObjectPtr &name);
28 void AddParameter(const SQObjectPtr &name);
29 void AddOuterValue(const SQObjectPtr &name);
30 int GetLocalVariable(const SQObjectPtr &name);
31 int GetOuterVariable(const SQObjectPtr &name);
34 int CalcStackFrameSize();
35 void AddLineInfos(int line,bool lineop,bool force=false);
38 int PushTarget(int n=-1);
41 int GetUpTarget(int n);
42 bool IsLocal(unsigned int stkpos);
43 SQObject CreateString(const SQChar *s);
45 SQLocalVarInfoVec _vlocals;
46 SQIntVec _targetstack;
49 SQIntVec _unresolvedbreaks;
50 SQIntVec _unresolvedcontinues;
51 SQObjectPtrVec _functions;
52 SQObjectPtrVec _parameters;
53 SQObjectPtrVec _stringrefs;
54 SQOuterVarVec _outervalues;
55 SQInstructionVec _instructions;
56 SQLocalVarInfoVec _localvarinfos;
57 SQObjectPtr _literals;
59 SQLineInfoVec _lineinfos;
62 SQIntVec _breaktargets; //contains number of nested exception traps
63 SQIntVec _continuetargets;
67 SQSharedState *_sharedstate;
69 int GetConstant(SQObjectPtr cons);
73 #endif //_SQFUNCSTATE_H_