Purple
0.1
Standard Language Specification
|
Definitions and function headers for the internal "Number" type. More...
#include <limits.h>
Go to the source code of this file.
Classes | |
struct | Number |
Container for various kinds of number data. More... | |
Macros | |
#define | NUMBER_BOOL(v) |
Generates a Number struct with type INT1. More... | |
#define | NUMBER_CHAR(v) |
Generates a Number struct with type INT8. More... | |
#define | NUMBER_SHORT(v) |
Generates a Number struct with type INT16. More... | |
#define | NUMBER_INT(v) |
Generates a Number struct with type INT32. More... | |
#define | NUMBER_LONG(v) |
Generates a Number struct with type INT64. More... | |
#define | NUMBER_FROM_TYPE_VAL(t, v) |
Generates a Number struct given a NumberType and a value. More... | |
#define | NT_MAX(a, b) (a > b ? a : b) |
Determines the larger NumberType of two. More... | |
#define | NT_MIN(a, b) (NT_MAX(a, b) == a ? b : a) |
Determines the smaller NumberType of two. More... | |
Typedefs | |
typedef struct Number | Number |
Container for various kinds of number data. More... | |
Enumerations | |
enum | NumberType { NT_INT1 , NT_INT8 , NT_INT16 , NT_INT32 , NT_INT64 } |
Types of numbers supported by Purple. More... | |
Functions | |
NumberType | token_type_to_number_type (int token_type) |
Convert a TokenType to a NumberType. More... | |
int | number_to_token_type (Number number) |
Variables | |
static const int | numberTypeByteSizes [] |
Size of each NumberType. More... | |
static const int | numberTypeBitSizes [] = {1, 8, 16, 32, 64} |
Bit size of each NumberType. More... | |
static const unsigned long long int | numberTypeMaxValues [] |
Max value of each NumberType. More... | |
static const char * | numberTypeFormatStrings [] = {"%d", "%d", "%d", "%d", "%ld"} |
Format strings for each data type. More... | |
Definitions and function headers for the internal "Number" type.
#define NT_MAX | ( | a, | |
b | |||
) | (a > b ? a : b) |
Determines the larger NumberType of two.
#define NT_MIN | ( | a, | |
b | |||
) | (NT_MAX(a, b) == a ? b : a) |
Determines the smaller NumberType of two.
#define NUMBER_BOOL | ( | v | ) |
#define NUMBER_CHAR | ( | v | ) |
#define NUMBER_FROM_TYPE_VAL | ( | t, | |
v | |||
) |
#define NUMBER_INT | ( | v | ) |
#define NUMBER_LONG | ( | v | ) |
#define NUMBER_SHORT | ( | v | ) |
enum NumberType |
int number_to_token_type | ( | Number | number | ) |
NumberType token_type_to_number_type | ( | int | token_type | ) |
Convert a TokenType to a NumberType.
token_type | TokenType to convert |
|
static |
Bit size of each NumberType.
|
static |
Size of each NumberType.
|
static |
Format strings for each data type.
|
static |
Max value of each NumberType.