aboutsummaryrefslogtreecommitdiff
path: root/builtin/builtin.odin
blob: b4a3e38aa6aae03db4bc985fc5cf9c8e9831f4f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
package ols_builtin

// Procedures
@builtin len :: proc(array: Array_Type) -> int ---
@builtin cap :: proc(array: Array_Type) -> int ---

size_of      :: proc($T: typeid) -> int ---
@builtin align_of     :: proc($T: typeid) -> int ---
@builtin type_of      :: proc(x: expr) -> type ---
@builtin type_info_of :: proc($T: typeid) -> ^runtime.Type_Info ---
@builtin typeid_of    :: proc($T: typeid) -> typeid ---

offset_of_selector :: proc(selector: $T) -> uintptr ---
offset_of_member   :: proc($T: typeid, member: $M) -> uintptr ---

@builtin offset_of :: proc{offset_of_selector, offset_of_member}

@builtin offset_of_by_string :: proc($T: typeid, member: string) -> uintptr ---

@builtin swizzle :: proc(x: [N]T, indices: ..int) -> [len(indices)]T ---

complex    :: proc(real, imag: Float) -> Complex_Type ---
quaternion :: proc(real, imag, jmag, kmag: Float) -> Quaternion_Type ---
real       :: proc(value: Complex_Or_Quaternion) -> Float ---
imag       :: proc(value: Complex_Or_Quaternion) -> Float ---
jmag       :: proc(value: Quaternion) -> Float ---
kmag       :: proc(value: Quaternion) -> Float ---
conj       :: proc(value: Complex_Or_Quaternion) -> Complex_Or_Quaternion ---

@builtin min   :: proc(values: ..T) -> T ---
@builtin max   :: proc(values: ..T) -> T ---
@builtin abs   :: proc(value: T) -> T ---
@builtin clamp :: proc(value, minimum, maximum: T) -> T ---

@builtin unreachable :: proc() -> ! ---

@(private="file") _raw_data_slice   :: proc(value: []$E)         -> [^]E    ---
@(private="file") _raw_data_dynamic :: proc(value: [dynamic]$E)  -> [^]E    ---
@(private="file") _raw_data_array   :: proc(value: ^[$N]$E)      -> [^]E    ---
@(private="file") _raw_data_simd    :: proc(value: ^#simd[$N]$E) -> [^]E    ---
@(private="file") _raw_data_string  :: proc(value: string)       -> [^]byte ---
// raw_data is a built-in procedure which returns the underlying data of a built-in data type as a Multi-Pointer.
@builtin raw_data :: proc{_raw_data_slice, _raw_data_dynamic, _raw_data_array, _raw_data_simd, _raw_data_string}

/*
	This is interally from the compiler
*/

Odin_OS_Type :: enum int {
	Unknown,
	Windows,
	Darwin,
	Linux,
	Essence,
	FreeBSD,
	Haiku,
	OpenBSD,
	WASI,
	JS,
	Freestanding,
}

@builtin
ODIN_OS: Odin_OS_Type

Odin_Arch_Type :: enum int {
	Unknown,
	amd64,
	i386,
	arm64,
	wasm32,
	wasm64p32,
}

@builtin
ODIN_ARCH:  Odin_Arch_Type

Odin_Build_Mode_Type :: enum int {
	Executable,
	Dynamic,
	Object,
	Assembly,
	LLVM_IR,
}

@builtin
ODIN_BUILD_MODE: Odin_Build_Mode_Type

Odin_Endian_Type :: enum int {
	Unknown,
	Little,
	Big,
}

@builtin
ODIN_ENDIAN: Odin_Endian_Type

Odin_Platform_Subtarget_Type :: enum int {
	Default,
	iOS,
}

@builtin
ODIN_PLATFORM_SUBTARGET: Odin_Platform_Subtarget_Type

Odin_Sanitizer_Flag :: enum u32 {
	Address,
	Memory,
	Thread,
}

@builtin
ODIN_SANITIZER_FLAGS: distinct bit_set[Odin_Sanitizer_Flag; u32]

@builtin
ODIN_DEBUG: bool