22 #include "CBot/CBotTypResult.h" 34 class CBotExternalCallList;
132 bool Compile(
const std::string& program, std::vector<std::string>& functions,
void* pUser =
nullptr);
166 bool Start(
const std::string& name);
178 bool Run(
void* pUser =
nullptr,
int timer = -1);
187 bool GetRunPos(std::string& functionName,
int& start,
int& end);
273 bool rExec(
CBotVar* pVar,
CBotVar* pResult,
int& Exception,
void* pUser),
280 static bool DefineNum(
const std::string& name,
long val);
323 CBotGet modestart = GetPosExtern,
324 CBotGet modestop = GetPosBloc);
364 int m_errorStart = 0;
Class for mangaging CBot external calls.
Definition: CBotExternalCall.h:114
~CBotProgram()
Destructor.
Definition: CBotProgram.cpp:47
bool GetPosition(const std::string &name, int &start, int &stop, CBotGet modestart=GetPosExtern, CBotGet modestop=GetPosBloc)
GetPosition Gives the position of a routine in the original text the user can select the item to find...
Definition: CBotProgram.cpp:172
A function declaration in the code.
Definition: CBotFunction.h:42
bool m_bCompileClass
true while compiling class
Definition: CBotProgram.h:340
static void Init()
Initializes the module, should be done once (and only once) at the beginning.
Definition: CBotProgram.cpp:385
Class that manages a CBot program. This is the main entry point into the CBot engine.
Definition: CBotProgram.h:83
The execution stack.
Definition: CBotStack.h:44
bool GetRunPos(std::string &functionName, int &start, int &end)
Gives the current position in the executing program.
Definition: CBotProgram.cpp:234
static CBotExternalCallList * GetExternalCalls()
Returns static list of all registered external calls.
Definition: CBotProgram.cpp:414
bool Start(const std::string &name)
Starts the program using given function as an entry point. The function must be declared as "extern"...
Definition: CBotProgram.cpp:149
A CBot class definition.
Definition: CBotClass.h:105
CBotVar * GetStackVars(std::string &functionName, int level)
Provides the pointer to the variables on the execution stack.
Definition: CBotProgram.cpp:245
static void Free()
Frees the static memory areas.
Definition: CBotProgram.cpp:407
Various utilities used for debugging.
Definition: CBotDebug.h:29
A CBot variable.
Definition: CBotVar.h:42
Some enum values used across the CBot engine.
CBotProgram()
Constructor.
Definition: CBotProgram.cpp:38
CBotError
This enum contains possible CBot error values. Values in range 5000-5999 are compile errors...
Definition: CBotEnums.h:190
bool SaveState(FILE *pf)
Save the current execution status into a file.
Definition: CBotProgram.cpp:331
CBotFunction * GetFunctions()
Returns the list of all user-defined functions in this program as instances of CBotFunction.
Definition: CBotProgram.cpp:285
CBotError GetError()
Returns the last error.
Definition: CBotProgram.cpp:260
void Stop()
Stops execution of the program.
Definition: CBotProgram.cpp:225
static bool DefineNum(const std::string &name, long val)
Define a new constant.
Definition: CBotProgram.cpp:324
static int GetVersion()
Returns version of the CBot library.
Definition: CBotProgram.cpp:380
CBotGet
Different modes for CBotProgram::GetPosition.
Definition: CBotEnums.h:62
bool RestoreState(FILE *pf)
Restore the execution state from a file.
Definition: CBotProgram.cpp:349
Class to define the complete type of a variable.
Definition: CBotTypResult.h:47
CBot engine.
Definition: CBotCallMethode.cpp:28
static bool AddFunction(const std::string &name, bool rExec(CBotVar *pVar, CBotVar *pResult, int &Exception, void *pUser), CBotTypResult rCompile(CBotVar *&pVar, void *pUser))
Add a function that can be called from CBot.
Definition: CBotProgram.cpp:317
bool Run(void *pUser=nullptr, int timer=-1)
Executes the program.
Definition: CBotProgram.cpp:187
bool Compile(const std::string &program, std::vector< std::string > &functions, void *pUser=nullptr)
Compile compiles the program given as string.
Definition: CBotProgram.cpp:59
static void SetTimer(int n)
Sets the number of steps (parts of instructions) to execute in Run() before suspending the program ex...
Definition: CBotProgram.cpp:254