Colobot
|
Classes | |
class | CBotClass |
A CBot class definition. More... | |
class | CBotCStack |
The CBotCStack class Management of the stack of compilation. More... | |
class | CBotDebug |
Various utilities used for debugging. More... | |
class | CBotDefParam |
The CBotDefParam class A list of parameters. More... | |
class | CBotExternalCall |
Interface for external CBot calls. More... | |
class | CBotExternalCallDefault |
Default implementation of CBot external call, using compilation and runtime functions. More... | |
class | CBotExternalCallClass |
Implementation of CBot external call for class methods, using compilation and runtime functions. More... | |
class | CBotExternalCallList |
Class for mangaging CBot external calls. More... | |
class | CBotBlock |
An instruction block - { ... }. More... | |
class | CBotBoolExpr |
An expression that results in a boolean value. More... | |
class | CBotBreak |
Instructions "break" and "continue" (with an optional label) More... | |
class | CBotCase |
Instruction "case", part of "switch" structure. More... | |
class | CBotCatch |
Instruction "catch", part of "try" structure. More... | |
class | CBotCondition |
A condition - boolean expression enclosed in brackets - (condition) More... | |
class | CBotDefArray |
Definition of an array (of any type) More... | |
class | CBotDefBoolean |
Definition of boolean variable - bool a, b = false. More... | |
class | CBotDefClass |
Definition of class instance variable. More... | |
class | CBotDefFloat |
Definition of a float variable - float a, b = 12.4. More... | |
class | CBotDefInt |
Definition of an integer variable - int a, b = 12. More... | |
class | CBotDefString |
Definition of a string variable - string a, b = "text";. More... | |
class | CBotDo |
do {...} while (...) structure More... | |
class | CBotEmpty |
Constant -1 of type int. More... | |
class | CBotExpression |
An arithmetic expression, with or without assignment. More... | |
class | CBotExprLitBool |
A boolean literal - true/false. More... | |
class | CBotExprLitNan |
The "nan" constant. More... | |
class | CBotExprLitNull |
The "null" constant. More... | |
class | CBotExprLitNum |
A number literal - 5, 1, 2.5, 3.75, etc. or a predefined numerical constant (see CBotToken::DefineNum()) More... | |
class | CBotExprLitString |
A string literal - "Some text". More... | |
class | CBotExprRetVar |
Access a member/element of the variable on the stack. More... | |
class | CBotExprUnaire |
Unary expression - +a, -a, !a, ~a, not a. More... | |
class | CBotExprVar |
Expression representing a variable name. More... | |
class | CBotFieldExpr |
Accessing a class field using dot operator - toto.x. More... | |
class | CBotFor |
Instruction for (init; test; incr) { ... }. More... | |
class | CBotFunction |
A function declaration in the code. More... | |
class | CBotIf |
Instruction if (condition) { ... } else { ... }. More... | |
class | CBotIndexExpr |
Instruction accessing an array element - array[x]. More... | |
class | CBotInstr |
Class for one CBot instruction. More... | |
class | CBotInstrCall |
A call to a function - func() More... | |
class | CBotInstrMethode |
A call to class method - var.func() More... | |
class | CBotLeftExpr |
Compilation of left side of an assignment. More... | |
class | CBotLeftExprVar |
A variable on the left side of an assignment. More... | |
class | CBotListArray |
Compilation of assignment of an array - {{1, 2, 3}, {3, 2, 1}}. More... | |
class | CBotListExpression |
Compile a comma-separated list of expressions or variable definitions. More... | |
class | CBotListInstr |
A list of instructions separated by semicolons - ...; ...; ...; ...;. More... | |
class | CBotLogicExpr |
An "inline if" operator - condition ? if_true : if_false. More... | |
class | CBotNew |
Creation of a class instance - "new" operator - new SomeClass() More... | |
class | CBotParExpr |
An expression. More... | |
class | CBotPostIncExpr |
Post increment/decrement. More... | |
class | CBotPreIncExpr |
Pre increment/decrement. More... | |
class | CBotReturn |
The "return" instruction. More... | |
class | CBotSwitch |
The switch structure. More... | |
class | CBotThrow |
The "throw" instruction. More... | |
class | CBotTry |
The "try" structure. More... | |
class | CBotTwoOpExpr |
Any expression with two operands. More... | |
class | CBotWhile |
The "while" loop - while (condition) { ... }. More... | |
class | CBotProgram |
Class that manages a CBot program. This is the main entry point into the CBot engine. More... | |
class | CBotStack |
The execution stack. More... | |
class | CBotToken |
Class representing one token of a program. More... | |
class | CBotTypResult |
Class to define the complete type of a variable. More... | |
class | CBotLinkedList |
class | CBotDoublyLinkedList |
class | CBotVar |
A CBot variable. More... | |
class | CBotVarArray |
CBotVar subclass for managing arrays (CBotTypArrayPointer) More... | |
class | CBotVarBoolean |
CBotVar subclass for managing boolean values (CBotTypBoolean) More... | |
class | CBotVarClass |
CBotVar subclass for managing classes (CBotTypClass, CBotTypIntrinsic) More... | |
class | CBotVarFloat |
CBotVar subclass for managing float values (CBotTypFloat) More... | |
class | CBotVarInt |
CBotVar subclass for managing integer values (CBotTypInt) More... | |
class | CBotVarPointer |
CBotVar subclass for managing pointers to classes (CBotTypPointer) More... | |
class | CBotVarString |
CBotVar subclass for managing string values (CBotTypString) More... | |
class | CBotVarValue |
A variable holding a simple value (bool, int, float, string) More... | |
class | CBotVarNumberBase |
A number based variable (bool, int, float) More... | |
class | CBotVarNumber |
A number variable (int, float) More... | |
class | CBotFile |
class | CBotFileAccessHandler |
Enumerations | |
enum | CBotType { CBotTypVoid = 0 , CBotTypByte = 1 , CBotTypShort = 2 , CBotTypChar = 3 , CBotTypInt = 4 , CBotTypLong = 5 , CBotTypFloat = 6 , CBotTypDouble = 7 , CBotTypBoolean = 8 , CBotTypString = 9 , CBotTypArrayPointer = 10 , CBotTypArrayBody = 11 , CBotTypPointer = 12 , CBotTypNullPointer = 13 , CBotTypClass = 15 , CBotTypIntrinsic = 16 , CBotTypMAX = 20 } |
Defines known types. This types are modeled on Java types. More... | |
enum | CBotGet { GetPosExtern = 1 , GetPosNom = 2 , GetPosParam = 3 , GetPosBloc = 4 } |
Different modes for CBotProgram::GetPosition. More... | |
enum | TokenId { TokenKeyWord = 2000 , ID_IF = 2000 , ID_ELSE , ID_WHILE , ID_DO , ID_FOR , ID_BREAK , ID_CONTINUE , ID_SWITCH , ID_CASE , ID_DEFAULT , ID_TRY , ID_THROW , ID_CATCH , ID_FINALLY , ID_TXT_AND , ID_TXT_OR , ID_TXT_NOT , ID_RETURN , ID_CLASS , ID_EXTENDS , ID_SYNCHO , ID_NEW , ID_PUBLIC , ID_EXTERN , ID_STATIC , ID_PROTECTED , ID_PRIVATE , ID_INT , ID_FLOAT , ID_BOOLEAN , ID_STRING , ID_VOID , ID_BOOL , TokenKeyVal = 2200 , ID_TRUE = 2200 , ID_FALSE , ID_NULL , ID_NAN , TokenKeyOp = 2300 , ID_OPENPAR = 2300 , ID_CLOSEPAR , ID_OPBLK , ID_CLBLK , ID_SEP , ID_COMMA , ID_DOTS , ID_DOT , ID_OPBRK , ID_CLBRK , ID_DBLDOTS , ID_LOGIC , ID_ADD , ID_SUB , ID_MUL , ID_DIV , ID_ASS , ID_ASSADD , ID_ASSSUB , ID_ASSMUL , ID_ASSDIV , ID_ASSOR , ID_ASSAND , ID_ASSXOR , ID_ASSSL , ID_ASSSR , ID_ASSASR , ID_SL , ID_SR , ID_ASR , ID_INC , ID_DEC , ID_LO , ID_HI , ID_LS , ID_HS , ID_EQ , ID_NE , ID_AND , ID_XOR , ID_OR , ID_LOG_AND , ID_LOG_OR , ID_LOG_NOT , ID_NOT , ID_MODULO , ID_POWER , ID_ASSMODULO , TX_UNDEF = 4000 , TX_NAN } |
This enum contains possible token types. More... | |
enum | TokenType { TokenTypNone = 0 , TokenTypKeyWord = 1 , TokenTypNum = 2 , TokenTypString = 3 , TokenTypVar = 4 , TokenTypDef = 5 } |
Types of tokens. More... | |
enum | CBotError : int { CBotNoErr = 0 , CBotErrOpenPar = 5000 , CBotErrClosePar = 5001 , CBotErrNotBoolean = 5002 , CBotErrUndefVar = 5003 , CBotErrBadLeft = 5004 , CBotErrNoTerminator = 5005 , CBotErrCaseOut = 5006 , CBotErrNoEnd = 5007 , CBotErrCloseBlock = 5008 , CBotErrElseWhitoutIf = 5009 , CBotErrOpenBlock = 5010 , CBotErrBadType1 = 5011 , CBotErrRedefVar = 5012 , CBotErrBadType2 = 5013 , CBotErrUndefCall = 5014 , CBotErrNoDoubleDots = 5015 , CBotErrNoWhile = 5016 , CBotErrBreakOutside = 5017 , CBotErrUndefLabel = 5019 , CBotErrLabel = 5018 , CBotErrNoCase = 5020 , CBotErrBadNum = 5021 , CBotErrVoid = 5022 , CBotErrNoType = 5023 , CBotErrNoVar = 5024 , CBotErrNoFunc = 5025 , CBotErrOverParam = 5026 , CBotErrRedefFunc = 5027 , CBotErrLowParam = 5028 , CBotErrBadParam = 5029 , CBotErrNbParam = 5030 , CBotErrUndefItem = 5031 , CBotErrUndefClass = 5032 , CBotErrNoConstruct = 5033 , CBotErrRedefClass = 5034 , CBotErrCloseIndex = 5035 , CBotErrReserved = 5036 , CBotErrBadNew = 5037 , CBotErrOpenIndex = 5038 , CBotErrBadString = 5039 , CBotErrBadIndex = 5040 , CBotErrPrivate = 5041 , CBotErrNoPublic = 5042 , CBotErrNoExpression = 5043 , CBotErrAmbiguousCall = 5044 , CBotErrFuncNotVoid = 5045 , CBotErrNoClassName = 5046 , CBotErrNoReturn = 5047 , CBotErrDefaultValue = 5048 , CBotErrEndQuote = 5049 , CBotErrBadEscape = 5050 , CBotErrOctalRange = 5051 , CBotErrHexDigits = 5052 , CBotErrHexRange = 5053 , CBotErrUnicodeName = 5054 , CBotErrZeroDiv = 6000 , CBotErrNotInit = 6001 , CBotErrBadThrow = 6002 , CBotErrNoRetVal = 6003 , CBotErrNoRun = 6004 , CBotErrUndefFunc = 6005 , CBotErrNotClass = 6006 , CBotErrNull = 6007 , CBotErrNan = 6008 , CBotErrOutArray = 6009 , CBotErrStackOver = 6010 , CBotErrDeletedPtr = 6011 , CBotErrFileOpen = 6012 , CBotErrNotOpen = 6013 , CBotErrRead = 6014 , CBotErrWrite = 6015 , CBotErrMAX } |
This enum contains possible CBot error values. Values in range 5000-5999 are compile errors, 6000-6999 are runtime errors. More... | |
Functions | |
FILE * | fOpen (const char *name, const char *mode) |
fOpen More... | |
int | fClose (FILE *filehandle) |
fClose More... | |
std::size_t | fWrite (const void *buffer, std::size_t elemsize, std::size_t length, FILE *filehandle) |
fWrite More... | |
std::size_t | fRead (void *buffer, std::size_t elemsize, std::size_t length, FILE *filehandle) |
fRead More... | |
bool | ReadWord (FILE *pf, unsigned short &w) |
ReadWord. More... | |
bool | ReadFloat (FILE *pf, float &w) |
ReadFloat. More... | |
bool | WriteLong (FILE *pf, long w) |
WriteLong. More... | |
bool | ReadLong (FILE *pf, long &w) |
ReadLong. More... | |
bool | ReadString (FILE *pf, std::string &s) |
ReadString. More... | |
bool | WriteType (FILE *pf, const CBotTypResult &type) |
WriteType. More... | |
bool | ReadType (FILE *pf, CBotTypResult &type) |
ReadType. More... | |
bool | SaveVars (FILE *pf, CBotVar *pVar) |
SaveVars. More... | |
bool | WriteWord (FILE *pf, unsigned short w) |
WriteWord. More... | |
bool | WriteFloat (FILE *pf, float w) |
WriteFloat. More... | |
CBotInstr * | CompileParams (CBotToken *&p, CBotCStack *pStack, CBotVar **ppVars) |
CompileParams Compile a list of parameters. More... | |
bool | TypeCompatible (CBotTypResult &type1, CBotTypResult &type2, int op=0) |
TypeCompatible Check if two results are consistent to make an operation. TypeCompatible is used in two ways: For non-assignment operations: see CBotTwoOpExpr::Compile TypeCompatible( leftType, rightType, opType ) More... | |
bool | TypesCompatibles (const CBotTypResult &type1, const CBotTypResult &type2) |
TypesCompatibles Check if two variables are compatible for parameter passing. More... | |
const std::string & | LoadString (TokenId id) |
Maps given ID to its string equivalent. More... | |
bool | IsOfType (CBotToken *&p, int type1, int type2=-1) |
Check if this token is of specified type. More... | |
bool | IsOfTypeList (CBotToken *&p, int type1,...) |
Check if this token is of specified type. More... | |
CBotVar * | MakeListVars (CBotVar **ppVars, bool bSetVal=false) |
MakeListVars Transforms the array of pointers to variables in a chained list of variables. More... | |
CBotTypResult | TypeParam (CBotToken *&p, CBotCStack *pile) |
TypeParam. More... | |
CBotTypResult | ArrayType (CBotToken *&p, CBotCStack *pile, CBotTypResult type) |
ArrayType. More... | |
bool | WriteString (FILE *pf, std::string s) |
WriteString. More... | |
long | GetNumInt (const std::string &str) |
GetNumInt Converts a string into integer may be of the form 0xabc123. More... | |
float | GetNumFloat (const std::string &str) |
GetNumFloat Converts a string into a float number. More... | |
bool | CharInList (const char c, const char *list) |
Search a null-terminated string for a char value. More... | |
std::string | CodePointToUTF8 (unsigned int val) |
Converts a Unicode code point to UTF-8 encoded character. More... | |
CBotTypResult | cNull (CBotVar *&var, void *user) |
CBotTypResult | cOneFloat (CBotVar *&var, void *user) |
CBotTypResult | cTwoFloat (CBotVar *&var, void *user) |
CBotTypResult | cString (CBotVar *&var, void *user) |
CBotTypResult | cStringString (CBotVar *&var, void *user) |
CBotTypResult | cOneInt (CBotVar *&var, void *user) |
CBotTypResult | cOneIntReturnBool (CBotVar *&var, void *user) |
CBotTypResult | cStrStr (CBotVar *&var, void *user) |
CBotTypResult | cIntStrStr (CBotVar *&var, void *user) |
CBotTypResult | cFloatStr (CBotVar *&var, void *user) |
CBotTypResult | cStrStrIntInt (CBotVar *&var, void *user) |
CBotTypResult | cStrStrInt (CBotVar *&var, void *user) |
CBotTypResult | cIntStr (CBotVar *&var, void *user) |
void | InitFileFunctions () |
void | SetFileAccessHandler (std::unique_ptr< CBotFileAccessHandler > fileHandler) |
void | InitMathFunctions () |
void | InitStringFunctions () |
Variables | |
const int | DEFAULT_TIMER = 100 |
CBot engine.
enum CBot::CBotType |
Defines known types. This types are modeled on Java types.
Do not change the order of elements.
Enumerator | |
---|---|
CBotTypVoid | void |
CBotTypByte | byte (NOT IMPLEMENTED) |
CBotTypShort | short (NOT IMPLEMENTED) |
CBotTypChar | char (NOT IMPLEMENTED) |
CBotTypInt | int |
CBotTypLong | long (NOT IMPLEMENTED) |
CBotTypFloat | float |
CBotTypDouble | double (NOT IMPLEMENTED) |
CBotTypBoolean | bool |
CBotTypString | string |
CBotTypArrayPointer | Pointer to an array (CBotTypArrayBody) |
CBotTypArrayBody | Array. |
CBotTypPointer | Pointer to a class (CBotTypClass or CBotTypIntrinsic) |
CBotTypNullPointer | Null pointer. |
CBotTypClass | Class instance. |
CBotTypIntrinsic | Intrinsic class instance. |
enum CBot::CBotGet |
Different modes for CBotProgram::GetPosition.
enum CBot::TokenId |
enum CBot::TokenType |
enum CBot::CBotError : int |
This enum contains possible CBot error values. Values in range 5000-5999 are compile errors, 6000-6999 are runtime errors.
Note that other values may be returned, for example exceptions for user-defined builtin functions, or "throw" instruction
Also note that these can't overlap with CBotType, see CBotTypResult for explanation
FILE * CBot::fOpen | ( | const char * | name, |
const char * | mode | ||
) |
fOpen
name | |
mode |
int CBot::fClose | ( | FILE * | filehandle | ) |
fClose
filehandle |
std::size_t CBot::fWrite | ( | const void * | buffer, |
std::size_t | elemsize, | ||
std::size_t | length, | ||
FILE * | filehandle | ||
) |
fWrite
buffer | |
elemsize | |
length | |
filehandle |
std::size_t CBot::fRead | ( | void * | buffer, |
std::size_t | elemsize, | ||
std::size_t | length, | ||
FILE * | filehandle | ||
) |
fRead
buffer | |
elemsize | |
length | |
filehandle |
bool CBot::ReadWord | ( | FILE * | pf, |
unsigned short & | w | ||
) |
ReadWord.
pf | |
w |
bool CBot::ReadFloat | ( | FILE * | pf, |
float & | w | ||
) |
ReadFloat.
pf | |
w |
bool CBot::WriteLong | ( | FILE * | pf, |
long | w | ||
) |
WriteLong.
pf | |
w |
bool CBot::ReadLong | ( | FILE * | pf, |
long & | w | ||
) |
ReadLong.
pf | |
w |
bool CBot::ReadString | ( | FILE * | pf, |
std::string & | s | ||
) |
ReadString.
pf | |
s |
bool CBot::WriteType | ( | FILE * | pf, |
const CBotTypResult & | type | ||
) |
WriteType.
pf | |
type |
bool CBot::ReadType | ( | FILE * | pf, |
CBotTypResult & | type | ||
) |
ReadType.
pf | |
type |
bool CBot::SaveVars | ( | FILE * | pf, |
CBotVar * | pVar | ||
) |
SaveVars.
pf | |
pVar |
bool CBot::WriteWord | ( | FILE * | pf, |
unsigned short | w | ||
) |
WriteWord.
pf | |
w |
bool CBot::WriteFloat | ( | FILE * | pf, |
float | w | ||
) |
WriteFloat.
pf | |
w |
CBotInstr * CBot::CompileParams | ( | CBotToken *& | p, |
CBotCStack * | pStack, | ||
CBotVar ** | ppVars | ||
) |
CompileParams Compile a list of parameters.
p | |
pStack | |
ppVars |
bool CBot::TypeCompatible | ( | CBotTypResult & | type1, |
CBotTypResult & | type2, | ||
int | op = 0 |
||
) |
TypeCompatible Check if two results are consistent to make an operation. TypeCompatible is used in two ways: For non-assignment operations: see CBotTwoOpExpr::Compile TypeCompatible( leftType, rightType, opType )
For assignment or compound assignment operations (it's reversed): see CBotReturn::Compile & CBotExpression::Compile TypeCompatible( valueType, varType, opType )
type1 | |
type2 | |
op |
bool CBot::TypesCompatibles | ( | const CBotTypResult & | type1, |
const CBotTypResult & | type2 | ||
) |
TypesCompatibles Check if two variables are compatible for parameter passing.
type1 | |
type2 |
const std::string & CBot::LoadString | ( | TokenId | id | ) |
Maps given ID to its string equivalent.
id | Token type identifier |
bool CBot::IsOfType | ( | CBotToken *& | p, |
int | type1, | ||
int | type2 = -1 |
||
) |
Check if this token is of specified type.
p | The token to compare |
type1 | First token type to comapre to the token |
type2 | Second token type to comapre to the token |
bool CBot::IsOfTypeList | ( | CBotToken *& | p, |
int | type1, | ||
... | |||
) |
Check if this token is of specified type.
p | The token to compare |
type1 | The list of token types to comapre to the token, 0-terminated |
MakeListVars Transforms the array of pointers to variables in a chained list of variables.
ppVars | |
bSetVal |
CBotTypResult CBot::TypeParam | ( | CBotToken *& | p, |
CBotCStack * | pile | ||
) |
TypeParam.
p | |
pile |
CBotTypResult CBot::ArrayType | ( | CBotToken *& | p, |
CBotCStack * | pile, | ||
CBotTypResult | type | ||
) |
ArrayType.
p | |
pile | |
type |
bool CBot::WriteString | ( | FILE * | pf, |
std::string | s | ||
) |
WriteString.
pf | |
s |
long CBot::GetNumInt | ( | const std::string & | str | ) |
GetNumInt Converts a string into integer may be of the form 0xabc123.
str |
float CBot::GetNumFloat | ( | const std::string & | str | ) |
GetNumFloat Converts a string into a float number.
str |
bool CBot::CharInList | ( | const char | c, |
const char * | list | ||
) |
Search a null-terminated string for a char value.
c | The char to find. |
list | The string to search. |
std::string CBot::CodePointToUTF8 | ( | unsigned int | val | ) |
Converts a Unicode code point to UTF-8 encoded character.
val | Code point value. |