Files
corelang/core_globals.cpp
2023-01-01 14:23:59 +01:00

67 lines
2.9 KiB
C++

thread_local Core_Ctx *pctx;
Allocator *bigint_allocator;
global S64 bigint_allocation_count;
//-----------------------------------------------------------------------------
// Type globals
//-----------------------------------------------------------------------------
const uintptr_t pointer_size = sizeof(uintptr_t);
const uintptr_t pointer_align = __alignof(uintptr_t);
global Ast_Type type__void = {TYPE_VOID};
global Ast_Type type__string = {TYPE_STRING, sizeof(String), __alignof(String)};
global Ast_Type type__bool = {TYPE_BOOL, sizeof(bool), __alignof(bool)};
global Ast_Type type__type = {TYPE_TYPE, sizeof(S64), __alignof(S64)};
global Ast_Type type__f32 = {TYPE_F32, sizeof(F32), __alignof(F32)};
global Ast_Type type__f64 = {TYPE_F64, sizeof(F64), __alignof(F64)};
global Ast_Type type__s8 = {TYPE_S8, sizeof(S8), __alignof(S8)};
global Ast_Type type__s16 = {TYPE_S16, sizeof(S16), __alignof(S16)};
global Ast_Type type__s32 = {TYPE_S32, sizeof(S32), __alignof(S32)};
global Ast_Type type__s64 = {TYPE_S64, sizeof(S64), __alignof(S64)};
global Ast_Type type__u8 = {TYPE_U8, sizeof(U8), __alignof(U8), true};
global Ast_Type type__u16 = {TYPE_U16, sizeof(U16), __alignof(U16), true};
global Ast_Type type__u32 = {TYPE_U32, sizeof(U32), __alignof(U32), true};
global Ast_Type type__u64 = {TYPE_U64, sizeof(U64), __alignof(U64), true};
global Ast_Type type__untyped_bool = {TYPE_UNTYPED_BOOL, sizeof(bool), __alignof(bool)};
global Ast_Type type__untyped_int = {TYPE_UNTYPED_INT, sizeof(S64), __alignof(S64)};
global Ast_Type type__untyped_string = {TYPE_UNTYPED_STRING, sizeof(String), __alignof(String)};
global Ast_Type type__untyped_float = {TYPE_UNTYPED_FLOAT, sizeof(double), __alignof(double)};
global Ast_Type type__char = {TYPE_CHAR, sizeof(char), __alignof(char)};
global Ast_Type type__int = {TYPE_INT, sizeof(int), __alignof(int)};
global Ast_Type *type_char = &type__char;
global Ast_Type *type_int = &type__int;
global Ast_Type *type_void = &type__void;
global Ast_Type *type_pointer_to_char; // Needs to be inited at runtime
global Ast_Type *type_pointer_to_void; // Needs to be inited at runtime
global Ast_Type *type_any; // Needs to be inited at runtime
global Ast_Type *type_type = &type__type;
global Ast_Type *type_string = &type__string;
global Ast_Type *type_bool = &type__bool;
global Ast_Type *type_f32 = &type__f32;
global Ast_Type *type_f64 = &type__f64;
global Ast_Type *type_s8 = &type__s8 ;
global Ast_Type *type_s16 = &type__s16;
global Ast_Type *type_s32 = &type__s32;
global Ast_Type *type_s64 = &type__s64;
global Ast_Type *type_u8 = &type__u8 ;
global Ast_Type *type_u16 = &type__u16;
global Ast_Type *type_u32 = &type__u32;
global Ast_Type *type_u64 = &type__u64;
global Ast_Type *untyped_string = &type__untyped_string;
global Ast_Type *untyped_bool = &type__untyped_bool;
global Ast_Type *untyped_int = &type__untyped_int;
global Ast_Type *untyped_float = &type__untyped_float;