22 #include "CBot/CBotUtils.h"
24 #include "CBot/CBotDefines.h"
84 typedef bool (*RuntimeFunc)(
CBotVar* args,
CBotVar* result,
int& exception,
void* user);
123 bool AddFunction(
const std::string& name, std::unique_ptr<CBotExternalCall> call);
185 std::map<std::string, std::unique_ptr<CBotExternalCall>> m_list{};
186 void* m_user =
nullptr;
Class for mangaging CBot external calls.
Definition: CBotExternalCall.h:114
CBotExternalCallDefault(RuntimeFunc rExec, CompileFunc rCompile)
Constructor.
Definition: CBotExternalCall.cpp:129
bool CheckCall(const std::string &name)
Check if function with given name has been defined.
Definition: CBotExternalCall.cpp:69
bool AddFunction(const std::string &name, std::unique_ptr< CBotExternalCall > call)
Add a new function to the list.
Definition: CBotExternalCall.cpp:37
The execution stack.
Definition: CBotStack.h:44
void Clear()
Reset the list of registered functions.
Definition: CBotExternalCall.cpp:32
virtual bool Run(CBotVar *thisVar, CBotStack *pStack) override
Execute the function.
Definition: CBotExternalCall.cpp:144
Interface for external CBot calls.
Definition: CBotExternalCall.h:45
virtual CBotTypResult Compile(CBotVar *thisVar, CBotVar *args, void *user)=0
Compile the function.
A CBot variable.
Definition: CBotVar.h:42
Some enum values used across the CBot engine.
The CBotCStack class Management of the stack of compilation.
Definition: CBotCStack.h:35
bool RestoreCall(CBotToken *token, CBotVar *thisVar, CBotVar **ppVar, CBotStack *pStack)
Restore execution status after loading saved state.
Definition: CBotExternalCall.cpp:103
int DoCall(CBotToken *token, CBotVar *thisVar, CBotVar **ppVars, CBotStack *pStack, const CBotTypResult &rettype)
Find and call runtime function.
Definition: CBotExternalCall.cpp:74
void SetUserPtr(void *pUser)
Set user pointer to pass to compile functions.
Definition: CBotExternalCall.cpp:64
CBotExternalCall()
Constructor.
Definition: CBotExternalCall.cpp:119
Default implementation of CBot external call, using compilation and runtime functions.
Definition: CBotExternalCall.h:81
Class to define the complete type of a variable.
Definition: CBotTypResult.h:47
virtual CBotTypResult Compile(CBotVar *thisVar, CBotVar *args, void *user) override
Compile the function.
Definition: CBotExternalCall.cpp:139
CBot engine.
Definition: CBotCallMethode.cpp:28
virtual ~CBotExternalCallDefault()
Destructor.
Definition: CBotExternalCall.cpp:135
virtual ~CBotExternalCall()
Destructor.
Definition: CBotExternalCall.cpp:123
virtual bool Run(CBotVar *thisVar, CBotStack *pStack)=0
Execute the function.
Class representing one token of a program.
Definition: CBotToken.h:80
CBotTypResult CompileCall(CBotToken *&p, CBotVar *thisVar, CBotVar **ppVars, CBotCStack *pStack)
Find and call compile function.
Definition: CBotExternalCall.cpp:43