![]() |
BlitzMax Extended
0.8.11
Pushing Blitz to the Max.
|
Introduces most used data types. More...
#include <float.h>
#include <limits.h>
#include <stdint.h>
#include "_common.h"
Go to the source code of this file.
Data Structures | |
struct | BBTypeKeyInfo |
Contains useful information about each type key. More... | |
Defines | |
#define | BBBYTE_MIN ((BBByte) 0x00) |
The minimum value a variable of type BBByte can hold. | |
#define | BBBYTE_MAX ((BBByte) 0xff) |
The maximum value a variable of type BBByte can hold. | |
#define | BBSHORT_MIN ((BBShort) 0x0000) |
The minimum value a variable of type BBShort can hold. | |
#define | BBSHORT_MAX ((BBShort) 0xffff) |
The maximum value a variable of type BBShort can hold. | |
#define | BBINT_MIN ((BBInt) 0x80000000) |
The minimum value a variable of type BBInt can hold. | |
#define | BBINT_MAX ((BBInt) 0x7fffffff) |
The maximum value a variable of type BBInt can hold. | |
#define | BBLONG_MIN ((BBLong) 0x800000000000000L) |
The minimum value a variable of type BBLong can hold. | |
#define | BBLONG_MAX ((BBLong) 0x7ffffffffffffffL) |
The maximum value a variable of type BBLong can hold. | |
#define | BBFLOAT_MIN ((BBFloat) -FLT_MAX) |
The minimum value a variable of type BBFloat can hold. | |
#define | BBFLOAT_MAX ((BBFloat) FLT_MAX) |
The maximum value a variable of type BBFloat can hold. | |
#define | BBDOUBLE_MIN ((BBDouble) -DBL_MAX) |
The minimum value a variable of type BBDouble can hold. | |
#define | BBDOUBLE_MAX ((BBDouble) DBL_MAX) |
The maximum value a variable of type BBDouble can hold. | |
#define | BBCHAR_MIN ((BBChar) 0x0000) |
The minimum value a variable of type BBChar can hold. | |
#define | BBCHAR_MAX ((BBChar) 0xffff) |
The maximum value a variable of type BBChar can hold. | |
#define | BBSIZE_MIN ((BBSize) 0) |
The minimal value a variable of type BBSize can hold. | |
#define | BBTYPEKEY_ISVALID(key) ((key) >= BBTYPEKEY_BYTE && (key) <= BBTYPEKEY_ARRAY) |
Checks if a type key is valid. | |
#define | BBTYPEKEY_ISNUMERIC(key) ((key) >= BBTYPEKEY_BYTE && (key) <= BBTYPEKEY_DOUBLE) |
Checks if a type key identifies a numeric variable. | |
#define | BBTYPEKEY_ISPRIMITIVE(key) ((key) >= BBTYPEKEY_BYTE && (key) <= BBTYPEKEY_OBJECT) |
Checks if a type key identifies a primitive data type. | |
#define | BBTYPEKEY_ISCOMPLEX(key) ((key) >= BBTYPEKEY_OBJECT && (key) <= BBTYPEKEY_ARRAY) |
Checks if a type key identifies a complex data type. | |
#define | BBTYPETAG_KEY(tag) bbToTypeKeyData[(tag)[0]] |
Gets the corresponding BBTypeKey for a type tag. | |
Typedefs | |
typedef unsigned short | BBShort |
The BlitzMax "Short" data type. | |
typedef signed int | BBInt |
The BlitzMax "Int" data type. | |
typedef BBInt64 | BBLong |
The BlitzMax "Long" data type. | |
typedef float | BBFloat |
The BlitzMax "Float" data type. | |
typedef double | BBDouble |
The BlitzMax "Double" data type. | |
typedef unsigned short | BBChar |
The BlitzMax internal character type. | |
Enumerations | |
enum | BBBool |
Boolean data type. More... | |
enum | BBTypeKey { BBTYPEKEY_BYTE, BBTYPEKEY_SHORT, BBTYPEKEY_INT, BBTYPEKEY_LONG, BBTYPEKEY_FLOAT, BBTYPEKEY_DOUBLE, BBTYPEKEY_POINTER, BBTYPEKEY_VOID, BBTYPEKEY_FUNCTION, BBTYPEKEY_OBJECT, BBTYPEKEY_STRING, BBTYPEKEY_ARRAY } |
An integer identifier mapping a type tag. More... | |
Variables | |
BB_BEGIN_DECLS typedef unsigned char | BBByte |
The BlitzMax "Byte" data type. | |
const BBTypeKeyInfo | bbTypeKeyInfo [] |
Stores the TypeKey information for all known BlitzMax data types. |
Introduces most used data types.
BlitzMax has two kinds of data types: Primitive and complex types.
Primitive types store one value or a pointer to one. They include: BBByte, BBShort, BBInt, BBLong, BBFloat, BBDouble and BBChar
Complex data types are BlitzMax objects, consisting of a C struct to store the data and a BBClass that defines the functionality. They include: BBObject, BBString, BBArray and every user defined class
#define BBTYPEKEY_ISCOMPLEX | ( | key | ) | ((key) >= BBTYPEKEY_OBJECT && (key) <= BBTYPEKEY_ARRAY) |
Checks if a type key identifies a complex data type.
The following data types are considered to be "complex": BBObject
, BBString
and BBArray
Therefore the following type keys will check positive for complex data type: BBTYPEKEY_OBJECT
, BBTYPEKEY_STRING
and BBTYPEKEY_ARRAY
key | The type key to check |
true | If the key identifies a complex data type |
false | If the does not identify a valid complex variable |
#define BBTYPEKEY_ISNUMERIC | ( | key | ) | ((key) >= BBTYPEKEY_BYTE && (key) <= BBTYPEKEY_DOUBLE) |
Checks if a type key identifies a numeric variable.
The following data types are considered to be "numeric": BBByte
, BBShort
and BBInt
, BBLong
, BBFloat
and BBDouble
Therefore the following type keys will check positive for complex data type: BBTYPEKEY_BYTE
, BBTYPEKEY_SHORT
and BBTYPEKEY_INT
, BBTYPEKEY_LONG
, BBTYPEKEY_FLOAT
and BBTYPEKEY_DOUBLE
key | The type key to check |
true | If the key identifies a numeric variable |
false | If the does not identify a valid numeric variable |
#define BBTYPEKEY_ISPRIMITIVE | ( | key | ) | ((key) >= BBTYPEKEY_BYTE && (key) <= BBTYPEKEY_OBJECT) |
Checks if a type key identifies a primitive data type.
The following data types are considered to be "primitive": BBByte
, BBShort
, BBInt
, BBLong
, BBFloat
, BBDouble
, void*
, void
and (*)
Therefore the following type keys will check positive for primitive data type: BBTYPEKEY_BYTE
, BBTYPEKEY_SHORT
and BBTYPEKEY_INT
, BBTYPEKEY_LONG
, BBTYPEKEY_FLOAT
, BBTYPEKEY_DOUBLE
, BBTYPEKEY_POINTER
, BBTYPEKEY_VOID
, BBTYPEKEY_FUNCTION
key | The type key to check |
true | If the key identifies a primitive data type |
false | If the does not identify a valid primitive variable |
Referenced by bbArrayClone().
#define BBTYPEKEY_ISVALID | ( | key | ) | ((key) >= BBTYPEKEY_BYTE && (key) <= BBTYPEKEY_ARRAY) |
Checks if a type key is valid.
All known keys are considered to be valid.
key | The type key to check as an integer |
true | If the key is valid |
false | If the key is not valid |
#define BBTYPETAG_KEY | ( | tag | ) | bbToTypeKeyData[(tag)[0]] |
Gets the corresponding BBTypeKey for a type tag.
tag | The type tag as a null-terminated string |
Referenced by bbArrayClone(), bbArrayCompare(), bbArrayEndsWith(), bbArrayFindDouble(), bbArrayFindFloat(), bbArrayFindInt(), bbArrayFindLong(), bbArrayFindObject(), bbArrayFindString(), bbArrayNew1D(), bbArrayReverse(), bbArrayRotate(), bbArrayStartsWith(), and bbArrayToString().
typedef unsigned short BBChar |
The BlitzMax internal character type.
Represents a single UCS-2 character code.
typedef BBInt64 BBLong |
The BlitzMax "Long" data type.
typedef unsigned short BBShort |
The BlitzMax "Short" data type.
enum BBBool |
Boolean data type.
Although BlitzMax does not have a designated boolean data type as of now, this is useful for improving readability.
enum BBTypeKey |
An integer identifier mapping a type tag.
BlitzMax uses a system of null-terminated strings internally to inform about the type of an argument, for example in the array functions.
Sometimes it can be benefiticial to execution speed to just look up information about a data type in an array instead of checking by hand. The problem is, that by using the first letters of the type tag string as the array's keys would waste memory without need. Type keys solve this problem.
By mapping type tags to type keys you can create arrays containing extra information for each type without wasting precious memory.
BB_BEGIN_DECLS typedef unsigned char BBByte |
The BlitzMax "Byte" data type.
Referenced by bbArrayFindInt(), bbArrayFromData(), bbArraySort(), and bbStringFromBytes().
const BBTypeKeyInfo bbTypeKeyInfo[] |
Stores the TypeKey information for all known BlitzMax data types.