Class for mangaging CBot external calls.
More...
#include <CBotExternalCall.h>
|
bool | AddFunction (const std::string &name, std::unique_ptr< CBotExternalCall > call) |
| Add a new function to the list. More...
|
|
CBotTypResult | CompileCall (CBotToken *&p, CBotVar *thisVar, CBotVar **ppVars, CBotCStack *pStack) |
| Find and call compile function. More...
|
|
bool | CheckCall (const std::string &name) |
| Check if function with given name has been defined. More...
|
|
int | DoCall (CBotToken *token, CBotVar *thisVar, CBotVar **ppVars, CBotStack *pStack, const CBotTypResult &rettype) |
| Find and call runtime function. More...
|
|
bool | RestoreCall (CBotToken *token, CBotVar *thisVar, CBotVar **ppVar, CBotStack *pStack) |
| Restore execution status after loading saved state. More...
|
|
void | SetUserPtr (void *pUser) |
| Set user pointer to pass to compile functions. More...
|
|
void | Clear () |
| Reset the list of registered functions. More...
|
|
Class for mangaging CBot external calls.
- See also
- CBotProgram::AddFunction() for information on how to add your functions to this list
bool CBot::CBotExternalCallList::AddFunction |
( |
const std::string & |
name, |
|
|
std::unique_ptr< CBotExternalCall > |
call |
|
) |
| |
Add a new function to the list.
- Parameters
-
name | Function name |
call | Function to add |
- Returns
- true
Find and call compile function.
This function sets an error in compilation stack in case of failure
- Parameters
-
p | Token representing the function name |
thisVar | "this" variable for class calls, nullptr for normal calls |
ppVars | List of arguments (only types!) |
pStack | Compilation stack |
- Returns
- CBotTypResult representing the return type of the function (CBotType), or an error (CBotError)
bool CBot::CBotExternalCallList::CheckCall |
( |
const std::string & |
name | ) |
|
Check if function with given name has been defined.
- Parameters
-
- Returns
- true if function was defined
Find and call runtime function.
This function sets an error in runtime stack in case of failure
- Parameters
-
token | Token representing the function name |
thisVar | "this" variable for class calls, nullptr for normal calls |
ppVars | List of arguments |
pStack | Runtime stack |
rettype | Return type of the function, as returned by CompileCall() |
- Returns
- -1 if call failed (no such function), 0 if function requested interruption, 1 on success
Restore execution status after loading saved state.
- Parameters
-
token | Token representing the function name |
thisVar | "this" variable for class calls, nullptr for normal calls |
ppVar | List of arguments |
pStack | Runtime stack |
- Returns
- false on failure (e.g. function doesn't exist)
void CBot::CBotExternalCallList::SetUserPtr |
( |
void * |
pUser | ) |
|
Set user pointer to pass to compile functions.
This is for compile functions only, runtime functions use CBotStack::GetUserPtr()
- Parameters
-
void CBot::CBotExternalCallList::Clear |
( |
| ) |
|
Reset the list of registered functions.
The documentation for this class was generated from the following files:
- /build/colobot-4LMcse/colobot-0.1.8/src/CBot/CBotExternalCall.h
- /build/colobot-4LMcse/colobot-0.1.8/src/CBot/CBotExternalCall.cpp