BlitzMax Extended  0.8.11
Pushing Blitz to the Max.
Data Structures | Defines | Typedefs | Enumerations | Variables
blitz_types.h File Reference

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.

Detailed Description

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

Author:
Mark Sibly
Fabian Niemann

Define Documentation

#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

See also:
BBTYPEKEY_ISPRIMITIVE
Parameters:
keyThe type key to check
Return values:
trueIf the key identifies a complex data type
falseIf 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

See also:
BBTYPEKEY_ISPRIMITIVE
Parameters:
keyThe type key to check
Return values:
trueIf the key identifies a numeric variable
falseIf 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

See also:
BBTYPEKEY_ISCOMPLEX, BBTYPEKEY_ISNUMERIC
Parameters:
keyThe type key to check
Return values:
trueIf the key identifies a primitive data type
falseIf 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.

Parameters:
keyThe type key to check as an integer
Return values:
trueIf the key is valid
falseIf the key is not valid
#define BBTYPETAG_KEY (   tag)    bbToTypeKeyData[(tag)[0]]

Gets the corresponding BBTypeKey for a type tag.

See also:
BBTypeKey
Parameters:
tagThe type tag as a null-terminated string
Returns:
The corresponding type key

Referenced by bbArrayClone(), bbArrayCompare(), bbArrayEndsWith(), bbArrayFindDouble(), bbArrayFindFloat(), bbArrayFindInt(), bbArrayFindLong(), bbArrayFindObject(), bbArrayFindString(), bbArrayNew1D(), bbArrayReverse(), bbArrayRotate(), bbArrayStartsWith(), and bbArrayToString().


Typedef Documentation

typedef unsigned short BBChar

The BlitzMax internal character type.

Represents a single UCS-2 character code.

See also:
BBCHAR_MIN, BBCHAR_MAX
typedef signed int BBInt

The BlitzMax "Int" data type.

See also:
BBINT_MIN, BBINT_MAX
typedef BBInt64 BBLong

The BlitzMax "Long" data type.

See also:
BBLONG_MIN, BBLONG_MAX
typedef unsigned short BBShort

The BlitzMax "Short" data type.

See also:
BBSHORT_MIN, BBSHORT_MAX

Enumeration Type Documentation

enum BBBool

Boolean data type.

Although BlitzMax does not have a designated boolean data type as of now, this is useful for improving readability.

See also:
BBTRUE, BBFALSE
Note:
In BlitzMax everything with a value 0 is considered 'False' and everything non-zero is considered 'True'. No matter the type.
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.

Enumerator:
BBTYPEKEY_BYTE 

Identifies the type BBByte.

BBTYPEKEY_SHORT 

Identifies the type BBShort.

BBTYPEKEY_INT 

Identifies the type BBInt.

BBTYPEKEY_LONG 

Identifies the type BBLong.

BBTYPEKEY_FLOAT 

Identifies the type BBFloat.

BBTYPEKEY_DOUBLE 

Identifies the type BBDouble.

BBTYPEKEY_POINTER 

Identifies a pointer to a variable.

BBTYPEKEY_VOID 

Identifies the type void.

BBTYPEKEY_FUNCTION 

Identifies a function.

BBTYPEKEY_OBJECT 

Identifies the type BBObject*.

BBTYPEKEY_STRING 

Identifies the type BBString*.

BBTYPEKEY_ARRAY 

Identifies the type BBArray*.


Variable Documentation

BB_BEGIN_DECLS typedef unsigned char BBByte

The BlitzMax "Byte" data type.

See also:
BBBYTE_MIN, BBBYTE_MAX

Referenced by bbArrayFindInt(), bbArrayFromData(), bbArraySort(), and bbStringFromBytes().

Stores the TypeKey information for all known BlitzMax data types.

See also:
BBTypeKeyInfo