1 /* see copyright notice in squirrel.h */
2 #ifndef _SQFUNCSTATE_H_
3 #define _SQFUNCSTATE_H_
4 ///////////////////////////////////
9 SQFuncState(SQSharedState *ss,SQFunctionProto *func,SQFuncState *parent,CompilerErrorFunc efunc,void *ed);
14 void Error(const SQChar *err);
15 SQFuncState *PushChildState(SQSharedState *ss,SQFunctionProto *func);
17 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);}
18 void AddInstruction(SQInstruction &i);
19 void SetIntructionParams(int pos,int arg0,int arg1,int arg2=0,int arg3=0);
20 void SetIntructionParam(int pos,int arg,int val);
21 SQInstruction &GetInstruction(int pos){return _instructions[pos];}
22 void PopInstructions(int size){for(int i=0;i<size;i++)_instructions.pop_back();}
23 void SetStackSize(int n);
24 void SnoozeOpt(){_optimization=false;}
25 int GetCurrentPos(){return _instructions.size()-1;}
26 //int GetStringConstant(const SQChar *cons);
27 int GetNumericConstant(const SQInteger cons);
28 int GetNumericConstant(const SQFloat cons);
29 int PushLocalVariable(const SQObject &name);
30 void AddParameter(const SQObject &name);
31 void AddOuterValue(const SQObject &name);
32 int GetLocalVariable(const SQObject &name);
33 int GetOuterVariable(const SQObject &name);
36 int CalcStackFrameSize();
37 void AddLineInfos(int line,bool lineop,bool force=false);
40 int PushTarget(int n=-1);
43 int GetUpTarget(int n);
44 bool IsLocal(unsigned int stkpos);
45 SQObject CreateString(const SQChar *s,int len = -1);
47 SQLocalVarInfoVec _vlocals;
48 SQIntVec _targetstack;
51 SQIntVec _unresolvedbreaks;
52 SQIntVec _unresolvedcontinues;
53 SQObjectPtrVec _functions;
54 SQObjectPtrVec _parameters;
55 SQOuterVarVec _outervalues;
56 SQInstructionVec _instructions;
57 SQLocalVarInfoVec _localvarinfos;
58 SQObjectPtr _literals;
61 SQLineInfoVec _lineinfos;
64 SQIntVec _breaktargets; //contains number of nested exception traps
65 SQIntVec _continuetargets;
69 SQSharedState *_sharedstate;
70 sqvector<SQFuncState*> _childstates;
71 int GetConstant(const SQObject &cons);
73 CompilerErrorFunc _errfunc;
78 #endif //_SQFUNCSTATE_H_