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 | NUMBERS_TYPEQUIV(A, B) (A.number_type == B.number_type && A.pointer_depth == B.pointer_depth) |
Determines if two Number structs have equivalent types. 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) |
NumberType | max_numbertype_for_val (long long int value) |
Finds the maximum NumberType possible for a given value. More... | |
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 * | numberTypeNames [] = {"bool", "char", "short", "int", "long"} |
Names 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 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 | ) |
#define NUMBERS_TYPEQUIV | ( | A, | |
B | |||
) | (A.number_type == B.number_type && A.pointer_depth == B.pointer_depth) |
Determines if two Number structs have equivalent types.
enum NumberType |
NumberType max_numbertype_for_val | ( | long long int | value | ) |
Finds the maximum NumberType possible for a given value.
value | Value to check |
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.
|
static |
Names of each NumberType.