|
Bond 0.9
C++ Bond Runtime Library API Documentation
|
Various basic types used throughout the Bond Runtime Library. More...
Files | |
| file | include/bond/types/types.h |
| Fixed-size integer types and the sizes, signature types and mnemonics of Bond types. | |
Classes | |
| class | Bond::DataView |
| An immutable object that encapsulates a pointer to a constant contiguous block of memory representing arbitrary binary data and a count of the number of bytes of data. More... | |
| class | Bond::DataViewIndex |
| An immutable object that encapsulates an array of named constant DataView objects. More... | |
| class | Bond::QualifiedName |
| An immutable wrapper around a constant array of C-style strings to represent the fully qualified name of a symbol in compiled Bond bytecode. More... | |
| union | Bond::Value |
| Union of all value types representable by a Token in the Bond compiler. More... | |
| union | Bond::Value16 |
| Union of all 16 bit value types used within the Bond compiler, the CBO file format, and the Bond Virtual Machine. More... | |
| union | Bond::Value32 |
| Union of all 32 bit value types used within the Bond compiler, the CBO file format, and the Bond Virtual Machine. More... | |
| union | Bond::Value64 |
| Union of all 64 bit value types used within the Bond compiler, the CBO file format, and the Bond Virtual Machine. More... | |
| struct | Bond::Value::[struct].mString |
| The value as a string, which is not null terminated. More... | |
Macros | |
| #define | BOND_OPCODE_LIST |
| An X-macro that lists every opcode in the Bond Virtual Machine instruction set. | |
| #define | BOND_SIGNATURE_TYPE_LIST |
| An X-macro that lists the signature types used to describe the parameters and return values of functions in CBO files. | |
| #define | BOND_NATIVE_GETTER_SUFFIX "@get" |
| Suffix appended to the qualified name of a native struct member to form the name of the native function that reads its value. | |
| #define | BOND_NATIVE_SETTER_SUFFIX "@set" |
| Suffix appended to the qualified name of a native struct member to form the name of the native function that writes its value. | |
Functions | |
| BOND_API const char * | Bond::GetOpCodeMnemonic (OpCode opCode) |
| Returns the mnemonic of the given opcode, e.g. "addi" for OPCODE_ADDI. | |
| BOND_API OpCodeParam | Bond::GetOpCodeParamType (OpCode opCode) |
| Returns a value of the OpCodeParam enumeration describing the parameter types for the given opcode. | |
| BOND_API int32_t | Bond::GetStackDelta (OpCode opCode) |
| Returns how much the given opcode moves the stack pointer in multiples of BOND_SLOT_SIZE bytes. | |
| uint32_t | Bond::GetPointerSize (PointerSize pointerSize) |
| Returns the number of bytes in a pointer of the given size. | |
| BOND_API const char * | Bond::GetBondTypeMnemonic (SignatureType signatureType) |
| Returns the mnemonic of the given signature type as it is named in Bond, e.g. "int". | |
| BOND_API char * | Bond::ExpandBondTypeMnemonic (char *buffer, size_t length, SignatureType signatureType, uint32_t size) |
| Writes the mnemonic of the given signature type as it is named in Bond to the given buffer, expanding the size of an aggregate, e.g. "aggr<12>". | |
| BOND_API const char * | Bond::GetApiTypeMnemonic (SignatureType signatureType) |
| Returns the mnemonic of the given signature type as it is named in the C++ API, e.g. "int32_t". | |
| BOND_API char * | Bond::ExpandApiTypeMnemonic (char *buffer, size_t length, SignatureType signatureType, uint32_t size) |
| Writes the mnemonic of the given signature type as it is named in the C++ API to the given buffer, expanding the size of an aggregate, e.g. "aggr<12>". | |
| bool | Bond::operator< (const Value16 &a, const Value16 &b) |
Returns the result of the expression: a.mUShort < b.mUShort. | |
| bool | Bond::operator< (const Value32 &a, const Value32 &b) |
Returns the result of the expression: a.mUInt < b.mUInt. | |
| bool | Bond::operator< (const Value64 &a, const Value64 &b) |
Returns the result of the expression: a.mULong < b.mULong. | |
Variables | |
| const uint32_t | Bond::BOND_VOID_SIZE = 0 |
| Size in bytes of the Bond void type. | |
| const uint32_t | Bond::BOND_BOOL_SIZE = 1 |
| Size in bytes of the Bond bool type. | |
| const uint32_t | Bond::BOND_CHAR_SIZE = 1 |
| Size in bytes of the Bond char type. | |
| const uint32_t | Bond::BOND_UCHAR_SIZE = 1 |
| Size in bytes of the Bond uchar type. | |
| const uint32_t | Bond::BOND_SHORT_SIZE = 2 |
| Size in bytes of the Bond short type. | |
| const uint32_t | Bond::BOND_USHORT_SIZE = 2 |
| Size in bytes of the Bond ushort type. | |
| const uint32_t | Bond::BOND_INT_SIZE = 4 |
| Size in bytes of the Bond int type. | |
| const uint32_t | Bond::BOND_UINT_SIZE = 4 |
| Size in bytes of the Bond uint type. | |
| const uint32_t | Bond::BOND_LONG_SIZE = 8 |
| Size in bytes of the Bond long type. | |
| const uint32_t | Bond::BOND_ULONG_SIZE = 8 |
| Size in bytes of the Bond ulong type. | |
| const uint32_t | Bond::BOND_FLOAT_SIZE = 4 |
| Size in bytes of the Bond float type. | |
| const uint32_t | Bond::BOND_DOUBLE_SIZE = 8 |
| Size in bytes of the Bond double type. | |
| const uint32_t | Bond::BOND_DEFAULT_STRUCT_SIZE = 4 |
| Minimum size in bytes of a struct whose layout is computed by the compiler. | |
| const uint32_t | Bond::BOND_DEFAULT_STRUCT_ALIGN = BOND_DEFAULT_STRUCT_SIZE |
| Minimum alignment in bytes of a struct whose layout is computed by the compiler. | |
| const int32_t | Bond::BOND_SLOT_SIZE = 8 |
| Size in bytes of a slot on the operand stack of the VM. | |
| const PointerSize | Bond::BOND_NATIVE_POINTER_SIZE = (sizeof(void *) == 8) ? POINTER_64BIT : POINTER_32BIT |
| The size of pointers on the platform for which the code is compiled. | |
Various basic types used throughout the Bond Runtime Library.
| #define BOND_NATIVE_GETTER_SUFFIX "@get" |
Suffix appended to the qualified name of a native struct member to form the name of the native function that reads its value.
| #define BOND_NATIVE_SETTER_SUFFIX "@set" |
Suffix appended to the qualified name of a native struct member to form the name of the native function that writes its value.
| #define BOND_OPCODE_LIST |
An X-macro that lists every opcode in the Bond Virtual Machine instruction set.
To use it, define BOND_OPCODE_ITEM(opCode, mnemonic, param, stackDelta), expand BOND_OPCODE_LIST and then undefine BOND_OPCODE_ITEM. The arguments of each item are the opcode name without its OPCODE_ prefix, its mnemonic as an unquoted identifier, its parameter type without its OC_PARAM_ prefix, and how much it moves the stack pointer in multiples of BOND_SLOT_SIZE bytes. The instructions are described in docs/instruction-set.txt.
| #define BOND_SIGNATURE_TYPE_LIST |
An X-macro that lists the signature types used to describe the parameters and return values of functions in CBO files.
To use it, define BOND_SIGNATURE_TYPE_ITEM(type, bondType, apiType), expand BOND_SIGNATURE_TYPE_LIST and then undefine BOND_SIGNATURE_TYPE_ITEM. The arguments of each item are the signature type name without its SIG_ prefix, the printf format string of its mnemonic in Bond and the printf format string of its mnemonic in the C++ API. The aggregate mnemonics expect the size of the aggregate as a uint32_t argument.
| enum Bond::OpCode |
Enumeration of all opcodes in the Bond Virtual Machine instruction set.
| enum Bond::OpCodeParam |
Enumeration describing all combinations of parameter types for the instructions in the Bond Virtual Machine instruction set.
Parameters are encoded in the bytecode immediately after the opcode byte. Parameters that refer to a constant table are encoded as a 16-bit index into the table of the CBO.
| Enumerator | |
|---|---|
| OC_PARAM_NONE | No parameter. |
| OC_PARAM_CHAR | A signed 8-bit value. |
| OC_PARAM_UCHAR | An unsigned 8-bit value. |
| OC_PARAM_CHAR_CHAR | Two signed 8-bit values: a slot index and an increment. |
| OC_PARAM_SHORT | A signed 16-bit value. |
| OC_PARAM_USHORT | An unsigned 16-bit value. |
| OC_PARAM_INT | A signed 32-bit integer stored in the 32-bit constant table. |
| OC_PARAM_VAL32 | A 32-bit value stored in the 32-bit constant table. |
| OC_PARAM_VAL64 | A 64-bit value stored in the 64-bit constant table. |
| OC_PARAM_OFF16 | A signed 16-bit branch offset relative to the end of the instruction. |
| OC_PARAM_OFF32 | A signed 32-bit branch offset relative to the end of the instruction, stored in the 32-bit constant table. |
| OC_PARAM_STRING | A string stored in the string constant table. |
| OC_PARAM_NAME | A qualified name stored in the qualified name table. The CboLoader replaces the index with that of the referenced function or data entry in the CodeSegment. |
| OC_PARAM_LOOKUPSWITCH | A 32-bit aligned table holding a default offset, a match count and sorted pairs of match values and branch offsets. |
| OC_PARAM_TABLESWITCH | A 32-bit aligned table holding a default offset, a minimum and maximum match value and one branch offset per value in that range. |
| enum Bond::PointerSize |
| enum Bond::SignatureType |
Enumeration of the types of function parameters and return values in CBO files.
Its values are SIG_VOID, SIG_BOOL, SIG_CHAR, SIG_UCHAR, SIG_SHORT, SIG_USHORT, SIG_INT, SIG_UINT, SIG_LONG, SIG_ULONG, SIG_FLOAT, SIG_DOUBLE, SIG_POINTER and SIG_AGGREGATE, the last of which describes structs passed by value.
| Enumerator | |
|---|---|
| SIG_VOID | |
| SIG_BOOL | |
| SIG_CHAR | |
| SIG_UCHAR | |
| SIG_SHORT | |
| SIG_USHORT | |
| SIG_INT | |
| SIG_UINT | |
| SIG_LONG | |
| SIG_ULONG | |
| SIG_FLOAT | |
| SIG_DOUBLE | |
| SIG_POINTER | |
| SIG_AGGREGATE | |
| BOND_API char * Bond::ExpandApiTypeMnemonic | ( | char * | buffer, |
| size_t | length, | ||
| SignatureType | signatureType, | ||
| uint32_t | size ) |
Writes the mnemonic of the given signature type as it is named in the C++ API to the given buffer, expanding the size of an aggregate, e.g. "aggr<12>".
| buffer | The buffer to which the mnemonic is written. |
| length | The size of the buffer in bytes. The mnemonic is truncated if it does not fit. |
| signatureType | The signature type whose mnemonic is written. |
| size | The size in bytes of the type, used only by SIG_AGGREGATE. |
| BOND_API char * Bond::ExpandBondTypeMnemonic | ( | char * | buffer, |
| size_t | length, | ||
| SignatureType | signatureType, | ||
| uint32_t | size ) |
Writes the mnemonic of the given signature type as it is named in Bond to the given buffer, expanding the size of an aggregate, e.g. "aggr<12>".
| buffer | The buffer to which the mnemonic is written. |
| length | The size of the buffer in bytes. The mnemonic is truncated if it does not fit. |
| signatureType | The signature type whose mnemonic is written. |
| size | The size in bytes of the type, used only by SIG_AGGREGATE. |
| BOND_API const char * Bond::GetApiTypeMnemonic | ( | SignatureType | signatureType | ) |
Returns the mnemonic of the given signature type as it is named in the C++ API, e.g. "int32_t".
The mnemonic is a printf format string. That of SIG_AGGREGATE expects the size of the aggregate as a uint32_t argument; ExpandApiTypeMnemonic() can be used to expand it.
| BOND_API const char * Bond::GetBondTypeMnemonic | ( | SignatureType | signatureType | ) |
Returns the mnemonic of the given signature type as it is named in Bond, e.g. "int".
The mnemonic is a printf format string. That of SIG_AGGREGATE expects the size of the aggregate as a uint32_t argument; ExpandBondTypeMnemonic() can be used to expand it.
| BOND_API const char * Bond::GetOpCodeMnemonic | ( | OpCode | opCode | ) |
Returns the mnemonic of the given opcode, e.g. "addi" for OPCODE_ADDI.
| BOND_API OpCodeParam Bond::GetOpCodeParamType | ( | OpCode | opCode | ) |
Returns a value of the OpCodeParam enumeration describing the parameter types for the given opcode.
|
inline |
Returns the number of bytes in a pointer of the given size.
| BOND_API int32_t Bond::GetStackDelta | ( | OpCode | opCode | ) |
Returns how much the given opcode moves the stack pointer in multiples of BOND_SLOT_SIZE bytes.
Returns the result of the expression: a.mUShort < b.mUShort.
Returns the result of the expression: a.mUInt < b.mUInt.
Returns the result of the expression: a.mULong < b.mULong.
| const uint32_t Bond::BOND_BOOL_SIZE = 1 |
Size in bytes of the Bond bool type.
| const uint32_t Bond::BOND_CHAR_SIZE = 1 |
Size in bytes of the Bond char type.
| const uint32_t Bond::BOND_DEFAULT_STRUCT_ALIGN = BOND_DEFAULT_STRUCT_SIZE |
Minimum alignment in bytes of a struct whose layout is computed by the compiler.
| const uint32_t Bond::BOND_DEFAULT_STRUCT_SIZE = 4 |
Minimum size in bytes of a struct whose layout is computed by the compiler.
| const uint32_t Bond::BOND_DOUBLE_SIZE = 8 |
Size in bytes of the Bond double type.
| const uint32_t Bond::BOND_FLOAT_SIZE = 4 |
Size in bytes of the Bond float type.
| const uint32_t Bond::BOND_INT_SIZE = 4 |
Size in bytes of the Bond int type.
| const uint32_t Bond::BOND_LONG_SIZE = 8 |
Size in bytes of the Bond long type.
| const PointerSize Bond::BOND_NATIVE_POINTER_SIZE = (sizeof(void *) == 8) ? POINTER_64BIT : POINTER_32BIT |
The size of pointers on the platform for which the code is compiled.
| const uint32_t Bond::BOND_SHORT_SIZE = 2 |
Size in bytes of the Bond short type.
| const int32_t Bond::BOND_SLOT_SIZE = 8 |
Size in bytes of a slot on the operand stack of the VM.
| const uint32_t Bond::BOND_UCHAR_SIZE = 1 |
Size in bytes of the Bond uchar type.
| const uint32_t Bond::BOND_UINT_SIZE = 4 |
Size in bytes of the Bond uint type.
| const uint32_t Bond::BOND_ULONG_SIZE = 8 |
Size in bytes of the Bond ulong type.
| const uint32_t Bond::BOND_USHORT_SIZE = 2 |
Size in bytes of the Bond ushort type.
| const uint32_t Bond::BOND_VOID_SIZE = 0 |
Size in bytes of the Bond void type.