Colobot
Public Member Functions | Static Public Member Functions | Public Attributes | Friends | List of all members
CBotStack Class Reference

Management of the execution stack. More...

#include <CBot.h>

Public Member Functions

void Delete ()
 Delete Remove current stack.
 
 CBotStack (CBotStack *ppapa)
 CBotStack Constructor of the stack. More...
 
 ~CBotStack ()
 ~CBotStack Destructor
 
bool StackOver ()
 StackOver Check if end of stack is reached. More...
 
int GetError (int &start, int &end)
 GetError Get error number of the stack. More...
 
int GetError ()
 GetError Get error number. More...
 
void Reset (void *pUser)
 Reset Reset error at and set user. More...
 
void SetType (CBotTypResult &type)
 SetType Determines the type. More...
 
int GetType (int mode=0)
 GetType Get the type of value on the stack. More...
 
CBotTypResult GetTypResult (int mode=0)
 Getes the type of complete value on the stack. More...
 
void AddVar (CBotVar *p)
 Adds a local variable. More...
 
CBotVarFindVar (CBotToken *&pToken, bool bUpdate=false, bool bModif=false)
 Fetch a variable by its token. More...
 
CBotVarFindVar (CBotToken &Token, bool bUpdate=false, bool bModif=false)
 Fetch a variable by its token. More...
 
CBotVarFindVar (const char *name)
 Fetch variable by its name. More...
 
CBotVarFindVar (long ident, bool bUpdate=false, bool bModif=false)
 Fetch a variable on the stack according to its identification number. More...
 
CBotVarCopyVar (CBotToken &Token, bool bUpdate=false)
 Find variable by its token and returns a copy of it. More...
 
CBotStackAddStack (CBotInstr *instr=NULL, bool bBlock=false)
 
CBotStackAddStackEOX (CBotCall *instr=NULL, bool bBlock=false)
 
CBotStackRestoreStack (CBotInstr *instr=NULL)
 
CBotStackRestoreStackEOX (CBotCall *instr=NULL)
 
CBotStackAddStack2 (bool bBlock=false)
 
bool Return (CBotStack *pFils)
 
bool ReturnKeep (CBotStack *pFils)
 
bool BreakReturn (CBotStack *pfils, const char *name=NULL)
 
bool IfContinue (int state, const char *name)
 
bool IsOk ()
 
bool SetState (int n, int lim=-10)
 
int GetState ()
 
bool IncState (int lim=-10)
 
bool IfStep ()
 
bool Execute ()
 
void SetVar (CBotVar *var)
 
void SetCopyVar (CBotVar *var)
 
CBotVarGetVar ()
 
CBotVarGetCopyVar ()
 
CBotVarGetPtVar ()
 
bool GetRetVar (bool bRet)
 
long GetVal ()
 
void SetStartError (int pos)
 
void SetError (int n, CBotToken *token=NULL)
 
void SetPosError (CBotToken *token)
 
void ResetError (int n, int start, int end)
 
void SetBreak (int val, const char *name)
 
void SetBotCall (CBotProgram *p)
 
CBotProgramGetBotCall (bool bFirst=false)
 
void * GetPUser ()
 
bool GetBlock ()
 
bool ExecuteCall (long &nIdent, CBotToken *token, CBotVar **ppVar, CBotTypResult &rettype)
 
void RestoreCall (long &nIdent, CBotToken *token, CBotVar **ppVar)
 
bool SaveState (FILE *pf)
 
bool RestoreState (FILE *pf, CBotStack *&pStack)
 
void GetRunPos (const char *&FunctionName, int &start, int &end)
 
CBotVarGetStackVars (const char *&FunctionName, int level)
 

Static Public Member Functions

static CBotStackFirstStack ()
 FirstStack Allocate first stack. More...
 
static void SetTimer (int n)
 

Public Attributes

int m_temp
 

Friends

class CBotInstArray
 
class CBotTry
 

Detailed Description

Management of the execution stack.

Actually the only thing it can do is to create an instance of a stack to use for routine CBotProgram :: Execute(CBotStack)

Constructor & Destructor Documentation

CBotStack::CBotStack ( CBotStack ppapa)

CBotStack Constructor of the stack.

Parameters
ppapaNot used.

Member Function Documentation

void CBotStack::AddVar ( CBotVar p)

Adds a local variable.

Parameters
[in]pVariable to be added.

p->m_bDontDelete = bDontDelete;

CBotVar * CBotStack::CopyVar ( CBotToken Token,
bool  bUpdate = false 
)

Find variable by its token and returns a copy of it.

Parameters
TokenToken upon which search is performed
bUpdateNot used.
Returns
Found variable, NULL if not found
CBotVar * CBotStack::FindVar ( CBotToken *&  pToken,
bool  bUpdate = false,
bool  bModif = false 
)

Fetch a variable by its token.

This may be a composite variable

Parameters
[in]pTokenToken upon which search is performed
[in]bUpdateNot used. Probably need to be removed
[in]bModifNot used. Probably need to be removed
Returns
Found variable
CBotVar * CBotStack::FindVar ( CBotToken Token,
bool  bUpdate = false,
bool  bModif = false 
)

Fetch a variable by its token.

This may be a composite variable

Parameters
[in]pTokenToken upon which search is performed
[in]bUpdateNot used. Probably need to be removed
[in]bModifNot used. Probably need to be removed
Returns
Found variable
CBotVar * CBotStack::FindVar ( const char *  name)

Fetch variable by its name.

Parameters
[in]nameName of variable to find
Returns
Found variable
CBotVar * CBotStack::FindVar ( long  ident,
bool  bUpdate = false,
bool  bModif = false 
)

Fetch a variable on the stack according to its identification number.

This is faster than comparing names

Parameters
[in]identIdentifier of a variable
[in]bUpdateNot used. Probably need to be removed
[in]bModifNot used. Probably need to be removed
Returns
Found variable
CBotStack * CBotStack::FirstStack ( )
static

FirstStack Allocate first stack.

Returns
pointer to created stack
int CBotStack::GetError ( int &  start,
int &  end 
)

GetError Get error number of the stack.

Parameters
[out]startbeginning of the stack
[out]endend of stack
Returns
error number
int CBotStack::GetError ( )
inline

GetError Get error number.

Returns
eror number
int CBotStack::GetType ( int  mode = 0)

GetType Get the type of value on the stack.

Parameters
[in]modeUsed when getting class type (1 gives pointer, 2 gives intrinsic).
Returns
Type number.
CBotTypResult CBotStack::GetTypResult ( int  mode = 0)

Getes the type of complete value on the stack.

Parameters
[in]modeUsed when getting class type (1 gives pointer, 2 gives intrinsic).
Returns
Type of an element.
void CBotStack::Reset ( void *  pUser)

Reset Reset error at and set user.

Parameters
[in]pUserUser of stack
void CBotStack::SetType ( CBotTypResult type)

SetType Determines the type.

Parameters
typeType of instruction on the stack.
bool CBotStack::StackOver ( )

StackOver Check if end of stack is reached.

Returns
true if end of stack

The documentation for this class was generated from the following files: