() -> Workspace
Every program imports this module; there is nothing to write.
What every program has without importing anything: allocators, source locations, logging, type information and the compiler's intrinsics.
Procedures#
Platform#
Intrinsics#
(dest: *void, source: *void, count: s64)
Canonical bootstrap intrinsics declarations.
(dest: *void, value: u8, count: s64)
(a: *void, b: *void, count: s64) -> s16
(pointer: *$T, old: T, new: T) -> (success: bool, old_value: T)
(pointer: *$T) -> T
(pointer: *$T, new: T)
(pointer: *$T, new: T) -> old_value: T
Types#
Canonical bootstrap platform declarations.
Operating_System_Tag :: enum u32 {
NONE :: 0;
KRAMPOS :: 1;
WINDOWS :: 2;
LINUX :: 3;
ANDROID :: 4;
IOS :: 5;
MACOS :: 6;
NN_SWITCH :: 7;
PS4 :: 8;
PS5 :: 9;
XBOX :: 10;
WASM :: 11;
NN_SWITCH2 :: 12;
}CPU_Tag :: enum u32 {
UNINITIALIZED :: 0;
KRAMPU :: 1;
CUSTOM :: 2;
X64 :: 3;
ARM64 :: 4;
}:: s64
:: #type,distinct u16
Canonical bootstrap allocation declarations.
Allocator_Mode :: enum {
ALLOCATE :: 0;
RESIZE :: 1;
FREE :: 2;
STARTUP :: 3;
SHUTDOWN :: 4;
THREAD_START :: 5;
THREAD_STOP :: 6;
CREATE_HEAP :: 7;
DESTROY_HEAP :: 8;
IS_THIS_YOURS :: 9;
CAPS :: 10;
}Allocator_Caps :: enum_flags u32 {
MULTIPLE_THREADS :: 0x1;
CREATE_HEAP :: 0x2;
FREE :: 0x4;
ACTUALLY_RESIZE :: 0x8;
IS_THIS_YOURS :: 0x10;
HINT_I_AM_A_FAST_BUMP_ALLOCATOR :: 0x0100_0000;
HINT_I_AM_A_GENERAL_HEAP_ALLOCATOR :: 0x0200_0000;
HINT_I_AM_PER_FRAME_TEMPORARY_STORAGE :: 0x0400_0000;
HINT_I_AM_A_DEBUG_ALLOCATOR :: 0x0800_0000;
}:: #type (mode: Allocator_Mode, size: s64, old_size: s64, old_memory: *void, allocator_data: *void) -> *void
Allocator :: struct {
proc: Allocator_Proc;
data: *void;
}Canonical bootstrap storage declarations.
Newstring :: struct {
count: s64;
data: *u8;
}Array_View_64 :: struct {
count: s64;
data: *u8;
}Resizable_Array :: struct {
count: s64;
data: *void;
allocated: s64;
allocator: Allocator;
}Any_Struct :: struct {
type: *Type_Info;
value_pointer: *void;
}Procedure_With_Data :: struct {
proc: *void;
data: *void;
}For_Flags :: enum_flags u8 {
POINTER :: 0x1;
REVERSE :: 0x2;
}Canonical bootstrap reflection declarations.
Type_Info_Tag :: enum u32 {
INTEGER :: 0;
FLOAT :: 1;
BOOL :: 2;
STRING :: 3;
POINTER :: 4;
PROCEDURE :: 5;
VOID :: 6;
STRUCT :: 7;
ARRAY :: 8;
OVERLOAD_SET :: 9;
ANY :: 10;
ENUM :: 11;
POLYMORPHIC_VARIABLE :: 12;
TYPE :: 13;
CODE :: 14;
UNTYPED_LITERAL :: 15;
UNTYPED_ENUM :: 16;
VARIANT :: 18;
}Type_Info :: struct {
type: Type_Info_Tag;
runtime_size: s64;
}Type_Info_Integer :: struct {
using #as info: Type_Info;
signed: bool;
}Type_Info_Float :: struct {
using #as info: Type_Info;
}Type_Info_String :: struct {
using #as info: Type_Info;
}Type_Info_Procedure :: struct {
using #as info: Type_Info;
argument_types: [] *Type_Info;
return_types: [] *Type_Info;
procedure_flags: Flags;
Flags :: enum_flags u32 {
IS_ELSEWHERE :: 0x1;
IS_COMPILE_TIME_ONLY :: 0x2;
IS_POLYMORPHIC :: 0x4;
HAS_NO_CONTEXT :: 0x8;
IS_C_CALL :: 0x20;
IS_INTRINSIC :: 0x80;
IS_SYMMETRIC :: 0x100;
IS_CPP_METHOD :: 0x1000_0000;
HAS_CPP_NON_POD_RETURN_TYPE :: 0x2000_0000;
}
}Enum_Status_Flags :: enum_flags u16 {
INCOMPLETE :: 0x1;
}Enum_Type_Flags :: enum_flags u16 {
FLAGS :: 0x1;
COMPLETE :: 0x2;
SPECIFIED :: 0x4;
}Type_Info_Enum :: struct {
using #as info: Type_Info;
name: string;
internal_type: *Type_Info_Integer;
names: [] string;
values: [] s64;
status_flags: Enum_Status_Flags;
enum_type_flags: Enum_Type_Flags;
}Struct_Status_Flags :: enum_flags u32 {
INCOMPLETE :: 0x1;
LOCAL :: 0x4;
}Struct_Textual_Flags :: enum_flags u32 {
FOREIGN :: 0x1;
UNION :: 0x2;
NO_PADDING :: 0x4;
TYPE_INFO_NONE :: 0x8;
TYPE_INFO_NO_SIZE_COMPLAINT :: 0x10;
TYPE_INFO_PROCEDURES_ARE_VOID_POINTERS :: 0x20;
UNION_IS_TAGGED :: 0x40;
}Struct_Nontextual_Flags :: enum_flags u32 {
NOT_INSTANTIABLE :: 0x4;
ALL_MEMBERS_UNINITIALIZED :: 0x40;
POLYMORPHIC :: 0x100;
}Type_Info_Struct_Member :: struct {
name: string;
type: *Type_Info;
offset_in_bytes: s64;
flags: Flags;
notes: [] string;
offset_into_constant_storage: s64 = -1;
Flags :: enum_flags u32 {
CONSTANT :: 0x1;
IMPORTED :: 0x2;
USING :: 0x4;
PROCEDURE_WITH_VOID_POINTER_TYPE_INFO :: 0x8;
AS :: 0x10;
OVERLAY :: 0x20;
}
}Type_Info_Tagged_Union_Binding :: struct {
constant_value: u64;
member_index: s32;
}Type_Info_Struct :: struct {
using #as info: Type_Info;
name: string;
parameters: [] Type_Info_Struct_Member;
specified_parameters: [] Type_Info_Struct_Member;
members: [] Type_Info_Struct_Member;
tagged_union_bindings: [] Type_Info_Tagged_Union_Binding;
status_flags: Struct_Status_Flags;
nontextual_flags: Struct_Nontextual_Flags;
textual_flags: Struct_Textual_Flags;
alignment: s32;
polymorph_source_struct: *Type_Info_Struct;
initializer: (*void) #no_context;
constant_storage: [] u8;
notes: [] string;
}Type_Info_Variant_Flags :: enum_flags u32 {
DISTINCT :: 0x1;
ISA :: 0x2;
}Type_Info_Variant :: struct {
using #as info: Type_Info;
name: string;
variant_of: *Type_Info;
variant_flags: Type_Info_Variant_Flags;
}Canonical bootstrap diagnostics declarations.
Source_Code_Location :: struct {
fully_pathed_filename: string;
line_number: s64;
character_number: s64;
}Source_Code_Range :: struct {
fully_pathed_filename: string;
line_number_start: s64;
line_number_end: s64;
character_number_start: s64;
character_number_end: s64;
}Stack_Trace_Procedure_Info :: struct {
name: string;
location: Source_Code_Location;
procedure_address: *void;
}Stack_Trace_Node :: struct {
next: *Stack_Trace_Node;
info: *Stack_Trace_Procedure_Info;
hash: u64;
call_depth: u32;
line_number: u32;
}Log_Level :: enum u8 {
NORMAL :: 0;
VERBOSE :: 1;
VERY_VERBOSE :: 2;
}Log_Flags :: enum_flags u32 {
NONE :: 0x0;
ERROR :: 0x1;
WARNING :: 0x2;
CONTENT :: 0x4;
TO_FILE_ONLY :: 0x8;
VERBOSE_ONLY :: 0x10;
VERY_VERBOSE_ONLY :: 0x20;
TOPIC_ONLY :: 0x40;
}Log_Section :: struct {
name: string;
}Log_Info :: struct {
source_identifier: u64;
location: Source_Code_Location;
common_flags: Log_Flags;
user_flags: u32;
section: *Log_Section;
}:: #type ([] string)
Canonical bootstrap context declarations.
Constants#
:: #code #add_context #as using base: Context_Base