wasm app
This commit is contained in:
@@ -26,7 +26,7 @@ typedef double f64;
|
||||
#endif
|
||||
|
||||
#define fn
|
||||
#define glb
|
||||
#define global
|
||||
#define locl
|
||||
|
||||
#if PLATFORM_WASM
|
||||
@@ -53,10 +53,14 @@ typedef double f64;
|
||||
#define offsetof(st, m) ((usize)&(((st *)0)->m))
|
||||
#endif
|
||||
#define expect(x) if (!(x))
|
||||
#define unused(x) (void)(x)
|
||||
|
||||
#define kib(x) (1024ULL * (x##ULL))
|
||||
#define mib(x) (1024ULL * kib(x))
|
||||
#define gib(x) (1024ULL * mib(x))
|
||||
#define thousand(n) ((n)*1000)
|
||||
#define million(n) ((n)*1000000)
|
||||
#define billion(n) ((n)*1000000000)
|
||||
|
||||
#define DEFER_LOOP(begin, end) for (i32 PASTE(_i_, __LINE__) = (begin, 0); !PASTE(_i_, __LINE__); PASTE(_i_, __LINE__) += (end, 1))
|
||||
#define STACK(type, size) struct { type data[size]; i32 len; }
|
||||
|
||||
@@ -29,7 +29,7 @@ fn usize align_down(usize size, usize align) {
|
||||
fn void ma_init(ma_arena_t *arena, usize reserve) {
|
||||
reserve = align_up(reserve, ma_page_size);
|
||||
arena->align = ma_default_alignment;
|
||||
arena->data = (u8 *)vmem_reserve(reserve);
|
||||
arena->data = (u8 *)os_vmem_reserve(reserve);
|
||||
if (arena->data) {
|
||||
arena->reserve = reserve;
|
||||
}
|
||||
@@ -38,12 +38,12 @@ fn void ma_init(ma_arena_t *arena, usize reserve) {
|
||||
fn ma_arena_t *ma_create(usize reserve) {
|
||||
ma_arena_t *result = NULL;
|
||||
|
||||
void *data = vmem_reserve(reserve);
|
||||
void *data = os_vmem_reserve(reserve);
|
||||
if (!data) return result;
|
||||
|
||||
b32 success = vmem_commit(data, ma_page_size);
|
||||
b32 success = os_vmem_commit(data, ma_page_size);
|
||||
if (!success) {
|
||||
vmem_release(data);
|
||||
os_vmem_release(data);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ fn void *ma_push_size_ex(ma_arena_t *arena, usize size) {
|
||||
usize to_commit = new_len_aligned_to_page_size - arena->commit;
|
||||
usize to_commit_clamped = CLAMP_TOP(to_commit, arena->reserve);
|
||||
if (to_commit_clamped > 0) {
|
||||
b32 success = vmem_commit(arena->data + arena->commit, to_commit_clamped);
|
||||
b32 success = os_vmem_commit(arena->data + arena->commit, to_commit_clamped);
|
||||
if (success) {
|
||||
MA_ASAN_UNPOISON_MEMORY_REGION(arena->data + arena->commit, to_commit_clamped);
|
||||
arena->commit += to_commit_clamped;
|
||||
@@ -115,7 +115,7 @@ fn ma_arena_t *ma_push_arena(ma_arena_t *allocator, usize size) {
|
||||
fn void ma_destroy(ma_arena_t *arena) {
|
||||
if (arena == NULL || arena->data == NULL) return;
|
||||
b32 zero_memory = (u8 *)arena != arena->data;
|
||||
vmem_release(arena->data);
|
||||
os_vmem_release(arena->data);
|
||||
if (zero_memory) memory_zero(arena, sizeof(ma_arena_t));
|
||||
}
|
||||
|
||||
|
||||
@@ -257,7 +257,7 @@ fn lex_array_t lex_tokens(ma_arena_t *arena, char *file_name, s8_t stream) {
|
||||
return token_array;
|
||||
}
|
||||
|
||||
glb s8_t global_lex_kind_simple_strings[] = {
|
||||
global s8_t global_lex_kind_simple_strings[] = {
|
||||
#define X(KIND, STR, SIMPLE) s8_const_lit(SIMPLE),
|
||||
LEX_KIND_XLIST
|
||||
#undef X
|
||||
@@ -268,7 +268,7 @@ fn s8_t lex_kind_to_simple_s8(lex_kind_t kind) {
|
||||
return global_lex_kind_simple_strings[kind];
|
||||
}
|
||||
|
||||
glb s8_t global_lex_kind_strings[] = {
|
||||
global s8_t global_lex_kind_strings[] = {
|
||||
#define X(KIND, STR, SIMPLE) s8_const_lit(STR),
|
||||
LEX_KIND_XLIST
|
||||
#undef X
|
||||
|
||||
@@ -34,7 +34,7 @@ fn void default_log_proc(log_event_t ev) {
|
||||
b32 bdate = (tcx.log.flags & log_flag_date);
|
||||
b32 btime = (tcx.log.flags & log_flag_time);
|
||||
if (bdate || btime) {
|
||||
date = date_now();
|
||||
date = os_date_now();
|
||||
}
|
||||
if (bdate) {
|
||||
sb8_printf(sb, "%04u.%02u.%02u ", date.year, date.month, date.day);
|
||||
@@ -51,9 +51,9 @@ fn void default_log_proc(log_event_t ev) {
|
||||
s8_t result = sb8_serial_end(sb);
|
||||
|
||||
if (ev.level != log_level_fatal) {
|
||||
print_console_message(result.str);
|
||||
os_console_log(result.str);
|
||||
} else {
|
||||
print_error_message(result.str);
|
||||
os_error_box(result.str);
|
||||
#if PLATFORM_WASM
|
||||
debug_break();
|
||||
#else
|
||||
|
||||
@@ -63,7 +63,7 @@ fn void default_log_proc(log_event_t ev);
|
||||
|
||||
#define program_version "---"
|
||||
#if PLATFORM_DEBUG_ASSERT
|
||||
#define assert(x) (!(x) && (print_error_message(FILE_AND_LINE ": internal program error! assertion failed, program version: " program_version "\n"), debug_break()))
|
||||
#define assert(x) (!(x) && (os_error_box(FILE_AND_LINE ": internal program error! assertion failed, program version: " program_version "\n"), debug_break()))
|
||||
#else
|
||||
#define assert(x) (void)(x)
|
||||
#endif
|
||||
|
||||
@@ -205,9 +205,9 @@ union r3i64_t {
|
||||
|
||||
#define rgba_macro_const(r, g, b, a) { r / 255.0f, g / 255.0f, b / 255.0f, a / 255.0f }
|
||||
|
||||
glb v4f32_t primary_color_global = rgba_macro_const(245, 238, 230, 255);
|
||||
glb v4f32_t secondary_color_global = rgba_macro_const(255, 248, 227, 255);
|
||||
glb v4f32_t accent1_color_global = rgba_macro_const(243, 215, 202, 255);
|
||||
glb v4f32_t accent2_color_global = rgba_macro_const(230, 164, 180, 255);
|
||||
glb v4f32_t white_color_global = rgba_macro_const(255, 255, 255, 255);
|
||||
glb v4f32_t black_color_global = rgba_macro_const(0, 0, 0, 255);
|
||||
global v4f32_t primary_color_global = rgba_macro_const(245, 238, 230, 255);
|
||||
global v4f32_t secondary_color_global = rgba_macro_const(255, 248, 227, 255);
|
||||
global v4f32_t accent1_color_global = rgba_macro_const(243, 215, 202, 255);
|
||||
global v4f32_t accent2_color_global = rgba_macro_const(230, 164, 180, 255);
|
||||
global v4f32_t white_color_global = rgba_macro_const(255, 255, 255, 255);
|
||||
global v4f32_t black_color_global = rgba_macro_const(0, 0, 0, 255);
|
||||
|
||||
@@ -9,13 +9,13 @@ struct date_t {
|
||||
u16 year;
|
||||
};
|
||||
|
||||
fn void print_error_message(char *str);
|
||||
fn void print_console_message(char *str);
|
||||
fn date_t date_now(void);
|
||||
fn void os_error_box(char *str);
|
||||
fn void os_console_log(char *str);
|
||||
fn date_t os_date_now(void);
|
||||
|
||||
fn void *vmem_reserve(usize size);
|
||||
fn b32 vmem_commit(void *p, usize size);
|
||||
fn b32 vmem_release(void *p);
|
||||
fn b32 vmem_decommit(void *p, usize size);
|
||||
fn void *os_vmem_reserve(usize size);
|
||||
fn b32 os_vmem_commit(void *p, usize size);
|
||||
fn b32 os_vmem_release(void *p);
|
||||
fn b32 os_vmem_decommit(void *p, usize size);
|
||||
|
||||
fn void core_init(void); // required in wasm
|
||||
@@ -1,25 +1,25 @@
|
||||
fn void *vmem_reserve(usize size) {
|
||||
fn void *os_vmem_reserve(usize size) {
|
||||
void *result = mmap(0, size, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
|
||||
return result == MAP_FAILED ? NULL : result;
|
||||
}
|
||||
|
||||
fn b32 vmem_commit(void *p, usize size) {
|
||||
fn b32 os_vmem_commit(void *p, usize size) {
|
||||
mprotect(p, size, PROT_READ|PROT_WRITE);
|
||||
return true;
|
||||
}
|
||||
|
||||
fn b32 vmem_release(void *p) {
|
||||
fn b32 os_vmem_release(void *p) {
|
||||
void *result = munmap(ptr, size);
|
||||
return result == MAP_FAILED ? false : true;
|
||||
}
|
||||
|
||||
fn b32 vmem_decommit(void *p, usize size) {
|
||||
fn b32 os_vmem_decommit(void *p, usize size) {
|
||||
madvise(ptr, size, MADV_DONTNEED);
|
||||
mprotect(ptr, size, PROT_NONE);
|
||||
return true;
|
||||
}
|
||||
|
||||
fn date_t date_now(void) {
|
||||
fn date_t os_date_now(void) {
|
||||
date_t result = {0};
|
||||
time_t time = time(NULL);
|
||||
struct tm *lt = localtime(&time);
|
||||
@@ -32,11 +32,24 @@ fn date_t date_now(void) {
|
||||
return result;
|
||||
}
|
||||
|
||||
fn void print_error_message(char *str) {
|
||||
fn u64 os_get_microseconds(void) {
|
||||
struct timespec t;
|
||||
clock_gettime(CLOCK_MONOTONIC, &t);
|
||||
u64 result = t.tv_sec*million(1) + (t.tv_nsec/thousand(1));
|
||||
return result;
|
||||
}
|
||||
|
||||
fn f64 os_get_milliseconds(void) {
|
||||
u64 micros = os_get_microseconds();
|
||||
f64 result = (f64)micros / 1000.0;
|
||||
return result;
|
||||
}
|
||||
|
||||
fn void os_error_box(char *str) {
|
||||
fprintf(stderr, "%s", str);
|
||||
}
|
||||
|
||||
fn void print_console_message(char *str) {
|
||||
fn void os_console_log(char *str) {
|
||||
puts(str);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,33 +1,36 @@
|
||||
fn_wasm_import void wasm_alert(isize ptr, i32 len);
|
||||
fn_wasm_import f64 wasm_parse_float(isize str, i32 len);
|
||||
fn_wasm_import void wasm_write_to_console(isize str, i32 len);
|
||||
fn_wasm_import f64 wasm_get_milliseconds(void);
|
||||
|
||||
fn void *vmem_reserve(usize size) {
|
||||
extern char __heap_base;
|
||||
|
||||
fn void *os_vmem_reserve(usize size) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
fn b32 vmem_commit(void *p, usize size) {
|
||||
fn b32 os_vmem_commit(void *p, usize size) {
|
||||
return false;
|
||||
}
|
||||
|
||||
fn b32 vmem_release(void *p) {
|
||||
fn b32 os_vmem_release(void *p) {
|
||||
return true;
|
||||
}
|
||||
|
||||
fn b32 vmem_decommit(void *p, usize size) {
|
||||
fn b32 os_vmem_decommit(void *p, usize size) {
|
||||
return true;
|
||||
}
|
||||
|
||||
fn date_t date_now(void) {
|
||||
fn date_t os_date_now(void) {
|
||||
date_t result = {0}; // don't need timed logs in browser
|
||||
return result;
|
||||
}
|
||||
|
||||
fn void print_error_message(char *str) {
|
||||
fn void os_error_box(char *str) {
|
||||
wasm_alert((isize)str, str_len(str));
|
||||
}
|
||||
|
||||
fn void print_console_message(char *str) {
|
||||
fn void os_console_log(char *str) {
|
||||
wasm_write_to_console((isize)str, str_len(str));
|
||||
}
|
||||
|
||||
@@ -36,7 +39,9 @@ fn double strtod(const char *str, char **end_unused) {
|
||||
return wasm_parse_float((isize)str, str_len((char *)str));
|
||||
}
|
||||
|
||||
extern char __heap_base;
|
||||
fn f64 os_get_milliseconds(void) {
|
||||
return wasm_get_milliseconds();
|
||||
}
|
||||
|
||||
fn void core_init(void) {
|
||||
isize page_size = kib(64);
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
fn void *vmem_reserve(usize size) {
|
||||
fn void *os_vmem_reserve(usize size) {
|
||||
void *result = (uint8_t *)VirtualAlloc(0, size, MEM_RESERVE, PAGE_READWRITE);
|
||||
return result;
|
||||
}
|
||||
|
||||
fn b32 vmem_commit(void *p, usize size) {
|
||||
fn b32 os_vmem_commit(void *p, usize size) {
|
||||
void *result = VirtualAlloc(p, size, MEM_COMMIT, PAGE_READWRITE);
|
||||
return result ? true : false;
|
||||
}
|
||||
|
||||
fn b32 vmem_release(void *p) {
|
||||
fn b32 os_vmem_release(void *p) {
|
||||
BOOL result = VirtualFree(p, 0, MEM_RELEASE);
|
||||
return result ? true : false;
|
||||
}
|
||||
|
||||
fn b32 vmem_decommit(void *p, usize size) {
|
||||
fn b32 os_vmem_decommit(void *p, usize size) {
|
||||
BOOL result = VirtualFree(p, size, MEM_DECOMMIT);
|
||||
return result ? true : false;
|
||||
}
|
||||
|
||||
fn date_t date_now(void) {
|
||||
fn date_t os_date_now(void) {
|
||||
date_t result = {0};
|
||||
SYSTEMTIME lt;
|
||||
GetLocalTime(<);
|
||||
@@ -32,12 +32,37 @@ fn date_t date_now(void) {
|
||||
return result;
|
||||
}
|
||||
|
||||
fn void print_error_message(char *str) {
|
||||
global LARGE_INTEGER win32__performance_frequency;
|
||||
global u64 win32_performance_frequency = 1;
|
||||
|
||||
fn u64 os_get_microseconds(void) {
|
||||
if (win32__performance_frequency.QuadPart == 0) {
|
||||
win32__performance_frequency.QuadPart = 1; // don't query more then one time
|
||||
if(QueryPerformanceFrequency(&win32__performance_frequency)) {
|
||||
win32_performance_frequency = win32__performance_frequency.QuadPart;
|
||||
}
|
||||
}
|
||||
|
||||
u64 result = 0;
|
||||
LARGE_INTEGER n;
|
||||
if (QueryPerformanceCounter(&n)) {
|
||||
result = (n.QuadPart*million(1))/win32_performance_frequency;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
fn f64 os_get_milliseconds(void) {
|
||||
u64 micros = os_get_microseconds();
|
||||
f64 result = (f64)micros / 1000.0;
|
||||
return result;
|
||||
}
|
||||
|
||||
fn void os_error_box(char *str) {
|
||||
MessageBoxA(NULL, str, "fatal error", MB_OK);
|
||||
fprintf(stderr, "%s", str);
|
||||
}
|
||||
|
||||
fn void print_console_message(char *str) {
|
||||
fn void os_console_log(char *str) {
|
||||
OutputDebugStringA(str);
|
||||
puts(str);
|
||||
}
|
||||
|
||||
@@ -69,47 +69,47 @@ fn type_member_t *ti_get_member(s8_t name, type_t *type);
|
||||
#define DEFINE_STRUCT(x) type_t type__##x = {type_kind_struct, s8_const_lit(#x), sizeof(x), .members = members__##x, .count = lengthof(members__##x)}
|
||||
#define POINTER(x) (type_t){type_kind_pointer, s8_const_lit(#x "*"), sizeof(void *), .base = &type__##x}
|
||||
|
||||
glb type_t type__i8 = {type_kind_i8, s8_const_lit("i8"), sizeof(i8)};
|
||||
glb type_t type__i16 = {type_kind_i16, s8_const_lit("i16"), sizeof(i16)};
|
||||
glb type_t type__i32 = {type_kind_i32, s8_const_lit("i32"), sizeof(i32)};
|
||||
glb type_t type__i64 = {type_kind_i64, s8_const_lit("i64"), sizeof(i64)};
|
||||
glb type_t type__u8 = {type_kind_u8, s8_const_lit("u8"), sizeof(u8)};
|
||||
glb type_t type__u16 = {type_kind_u16, s8_const_lit("u16"), sizeof(u16)};
|
||||
glb type_t type__u32 = {type_kind_u32, s8_const_lit("u32"), sizeof(u32)};
|
||||
glb type_t type__u64 = {type_kind_u64, s8_const_lit("u64"), sizeof(u64)};
|
||||
glb type_t type__b8 = {type_kind_b8, s8_const_lit("b8"), sizeof(b8)};
|
||||
glb type_t type__b16 = {type_kind_b16, s8_const_lit("b16"), sizeof(b16)};
|
||||
glb type_t type__b32 = {type_kind_b32, s8_const_lit("b32"), sizeof(b32)};
|
||||
glb type_t type__b64 = {type_kind_b64, s8_const_lit("b64"), sizeof(b64)};
|
||||
glb type_t type__f32 = {type_kind_f32, s8_const_lit("f32"), sizeof(f32)};
|
||||
glb type_t type__f64 = {type_kind_f64, s8_const_lit("f64"), sizeof(f64)};
|
||||
glb type_t type__isize = {type_kind_isize, s8_const_lit("isize"), sizeof(isize)};
|
||||
glb type_t type__usize = {type_kind_usize, s8_const_lit("usize"), sizeof(usize)};
|
||||
glb type_t type__int = {type_kind_int, s8_const_lit("int"), sizeof(int)};
|
||||
glb type_t type__char = {type_kind_char, s8_const_lit("char"), sizeof(char)};
|
||||
global type_t type__i8 = {type_kind_i8, s8_const_lit("i8"), sizeof(i8)};
|
||||
global type_t type__i16 = {type_kind_i16, s8_const_lit("i16"), sizeof(i16)};
|
||||
global type_t type__i32 = {type_kind_i32, s8_const_lit("i32"), sizeof(i32)};
|
||||
global type_t type__i64 = {type_kind_i64, s8_const_lit("i64"), sizeof(i64)};
|
||||
global type_t type__u8 = {type_kind_u8, s8_const_lit("u8"), sizeof(u8)};
|
||||
global type_t type__u16 = {type_kind_u16, s8_const_lit("u16"), sizeof(u16)};
|
||||
global type_t type__u32 = {type_kind_u32, s8_const_lit("u32"), sizeof(u32)};
|
||||
global type_t type__u64 = {type_kind_u64, s8_const_lit("u64"), sizeof(u64)};
|
||||
global type_t type__b8 = {type_kind_b8, s8_const_lit("b8"), sizeof(b8)};
|
||||
global type_t type__b16 = {type_kind_b16, s8_const_lit("b16"), sizeof(b16)};
|
||||
global type_t type__b32 = {type_kind_b32, s8_const_lit("b32"), sizeof(b32)};
|
||||
global type_t type__b64 = {type_kind_b64, s8_const_lit("b64"), sizeof(b64)};
|
||||
global type_t type__f32 = {type_kind_f32, s8_const_lit("f32"), sizeof(f32)};
|
||||
global type_t type__f64 = {type_kind_f64, s8_const_lit("f64"), sizeof(f64)};
|
||||
global type_t type__isize = {type_kind_isize, s8_const_lit("isize"), sizeof(isize)};
|
||||
global type_t type__usize = {type_kind_usize, s8_const_lit("usize"), sizeof(usize)};
|
||||
global type_t type__int = {type_kind_int, s8_const_lit("int"), sizeof(int)};
|
||||
global type_t type__char = {type_kind_char, s8_const_lit("char"), sizeof(char)};
|
||||
|
||||
glb type_t type__s8_t = { type_kind_struct, s8_const_lit("s8_t"), sizeof(s8_t), .count = 2,
|
||||
global type_t type__s8_t = { type_kind_struct, s8_const_lit("s8_t"), sizeof(s8_t), .count = 2,
|
||||
.members = (type_member_t[]){
|
||||
{s8_const_lit("str"), &POINTER(char), .offset = offsetof(s8_t, str)},
|
||||
{s8_const_lit("len"), &type__i64, .offset = offsetof(s8_t, len)},
|
||||
}
|
||||
};
|
||||
|
||||
glb type_t type__s16_t = { type_kind_struct, s8_const_lit("s16_t"), sizeof(s16_t), .count = 2,
|
||||
global type_t type__s16_t = { type_kind_struct, s8_const_lit("s16_t"), sizeof(s16_t), .count = 2,
|
||||
.members = (type_member_t[]){
|
||||
{s8_const_lit("str"), &POINTER(u16), .offset = offsetof(s16_t, str)},
|
||||
{s8_const_lit("len"), &type__i64, .offset = offsetof(s16_t, len)},
|
||||
}
|
||||
};
|
||||
|
||||
glb type_t type__s32_t = { type_kind_struct, s8_const_lit("s32_t"), sizeof(s32_t), .count = 2,
|
||||
global type_t type__s32_t = { type_kind_struct, s8_const_lit("s32_t"), sizeof(s32_t), .count = 2,
|
||||
.members = (type_member_t[]){
|
||||
{s8_const_lit("str"), &POINTER(u32), .offset = offsetof(s32_t, str)},
|
||||
{s8_const_lit("len"), &type__i64, .offset = offsetof(s32_t, len)},
|
||||
}
|
||||
};
|
||||
|
||||
glb type_t type__ma_arena_t = { type_kind_struct, s8_const_lit("ma_arena_t"), sizeof(ma_arena_t), .count = 6,
|
||||
global type_t type__ma_arena_t = { type_kind_struct, s8_const_lit("ma_arena_t"), sizeof(ma_arena_t), .count = 6,
|
||||
.members = (type_member_t[]){
|
||||
{s8_const_lit("data"), &POINTER(u8), .offset = offsetof(ma_arena_t, data)},
|
||||
{s8_const_lit("len"), &type__usize, .offset = offsetof(ma_arena_t, len)},
|
||||
@@ -120,21 +120,21 @@ glb type_t type__ma_arena_t = { type_kind_struct, s8_const_lit("ma_arena_t"), si
|
||||
}
|
||||
};
|
||||
|
||||
glb type_t type__ma_temp_t = { type_kind_struct, s8_const_lit("ma_temp_t"), sizeof(ma_temp_t), .count = 2,
|
||||
global type_t type__ma_temp_t = { type_kind_struct, s8_const_lit("ma_temp_t"), sizeof(ma_temp_t), .count = 2,
|
||||
.members = (type_member_t[]){
|
||||
{s8_const_lit("arena"), &POINTER(ma_arena_t), .offset = offsetof(ma_temp_t, arena)},
|
||||
{s8_const_lit("len"), &type__usize, .offset = offsetof(ma_temp_t, len)},
|
||||
}
|
||||
};
|
||||
|
||||
glb type_t type__v2f32_t = { type_kind_struct, s8_const_lit("v2f32_t"), sizeof(v2f32_t), .count = 2,
|
||||
global type_t type__v2f32_t = { type_kind_struct, s8_const_lit("v2f32_t"), sizeof(v2f32_t), .count = 2,
|
||||
.members = (type_member_t[]){
|
||||
{s8_const_lit("x"), &type__f32, .offset = offsetof(v2f32_t, x)},
|
||||
{s8_const_lit("y"), &type__f32, .offset = offsetof(v2f32_t, y)},
|
||||
}
|
||||
};
|
||||
|
||||
glb type_t type__v3f32_t = { type_kind_struct, s8_const_lit("v3f32_t"), sizeof(v3f32_t), .count = 3,
|
||||
global type_t type__v3f32_t = { type_kind_struct, s8_const_lit("v3f32_t"), sizeof(v3f32_t), .count = 3,
|
||||
.members = (type_member_t[]){
|
||||
{s8_const_lit("x"), &type__f32, .offset = offsetof(v3f32_t, x)},
|
||||
{s8_const_lit("y"), &type__f32, .offset = offsetof(v3f32_t, y)},
|
||||
@@ -142,7 +142,7 @@ glb type_t type__v3f32_t = { type_kind_struct, s8_const_lit("v3f32_t"), sizeof(v
|
||||
}
|
||||
};
|
||||
|
||||
glb type_t type__v4f32_t = { type_kind_struct, s8_const_lit("v4f32_t"), sizeof(v4f32_t), .count = 4,
|
||||
global type_t type__v4f32_t = { type_kind_struct, s8_const_lit("v4f32_t"), sizeof(v4f32_t), .count = 4,
|
||||
.members = (type_member_t[]){
|
||||
{s8_const_lit("x"), &type__f32, .offset = offsetof(v4f32_t, x)},
|
||||
{s8_const_lit("y"), &type__f32, .offset = offsetof(v4f32_t, y)},
|
||||
@@ -151,7 +151,7 @@ glb type_t type__v4f32_t = { type_kind_struct, s8_const_lit("v4f32_t"), sizeof(v
|
||||
}
|
||||
};
|
||||
|
||||
glb type_t type__r3f32_t = { type_kind_struct, s8_const_lit("r3f32_t"), sizeof(r3f32_t), .count = 6,
|
||||
global type_t type__r3f32_t = { type_kind_struct, s8_const_lit("r3f32_t"), sizeof(r3f32_t), .count = 6,
|
||||
.members = (type_member_t[]){
|
||||
{s8_const_lit("x0"), &type__f32, .offset = offsetof(r3f32_t, x0)},
|
||||
{s8_const_lit("y0"), &type__f32, .offset = offsetof(r3f32_t, y0)},
|
||||
@@ -162,28 +162,28 @@ glb type_t type__r3f32_t = { type_kind_struct, s8_const_lit("r3f32_t"), sizeof(r
|
||||
}
|
||||
};
|
||||
|
||||
glb type_member_t members__r2f32_t[] = {
|
||||
global type_member_t members__r2f32_t[] = {
|
||||
{s8_const_lit("x0"), &type__f32, .offset = offsetof(r2f32_t, x0)},
|
||||
{s8_const_lit("y0"), &type__f32, .offset = offsetof(r2f32_t, y0)},
|
||||
{s8_const_lit("x1"), &type__f32, .offset = offsetof(r2f32_t, x1)},
|
||||
{s8_const_lit("y1"), &type__f32, .offset = offsetof(r2f32_t, y1)},
|
||||
};
|
||||
glb DEFINE_STRUCT(r2f32_t);
|
||||
global DEFINE_STRUCT(r2f32_t);
|
||||
|
||||
glb type_member_t members__r1f32_t[] = {
|
||||
global type_member_t members__r1f32_t[] = {
|
||||
{s8_const_lit("x0"), &type__f32, .offset = offsetof(r1f32_t, x0)},
|
||||
{s8_const_lit("x1"), &type__f32, .offset = offsetof(r1f32_t, x1)},
|
||||
};
|
||||
glb DEFINE_STRUCT(r1f32_t);
|
||||
global DEFINE_STRUCT(r1f32_t);
|
||||
|
||||
glb type_t type__v2f64_t = { type_kind_struct, s8_const_lit("v2f64_t"), sizeof(v2f64_t), .count = 2,
|
||||
global type_t type__v2f64_t = { type_kind_struct, s8_const_lit("v2f64_t"), sizeof(v2f64_t), .count = 2,
|
||||
.members = (type_member_t[]){
|
||||
{s8_const_lit("x"), &type__f64, .offset = offsetof(v2f64_t, x)},
|
||||
{s8_const_lit("y"), &type__f64, .offset = offsetof(v2f64_t, y)},
|
||||
}
|
||||
};
|
||||
|
||||
glb type_t type__v3f64_t = { type_kind_struct, s8_const_lit("v3f64_t"), sizeof(v3f64_t), .count = 3,
|
||||
global type_t type__v3f64_t = { type_kind_struct, s8_const_lit("v3f64_t"), sizeof(v3f64_t), .count = 3,
|
||||
.members = (type_member_t[]){
|
||||
{s8_const_lit("x"), &type__f64, .offset = offsetof(v3f64_t, x)},
|
||||
{s8_const_lit("y"), &type__f64, .offset = offsetof(v3f64_t, y)},
|
||||
@@ -191,7 +191,7 @@ glb type_t type__v3f64_t = { type_kind_struct, s8_const_lit("v3f64_t"), sizeof(v
|
||||
}
|
||||
};
|
||||
|
||||
glb type_t type__v4f64_t = { type_kind_struct, s8_const_lit("v4f64_t"), sizeof(v4f64_t), .count = 4,
|
||||
global type_t type__v4f64_t = { type_kind_struct, s8_const_lit("v4f64_t"), sizeof(v4f64_t), .count = 4,
|
||||
.members = (type_member_t[]){
|
||||
{s8_const_lit("x"), &type__f64, .offset = offsetof(v4f64_t, x)},
|
||||
{s8_const_lit("y"), &type__f64, .offset = offsetof(v4f64_t, y)},
|
||||
@@ -200,7 +200,7 @@ glb type_t type__v4f64_t = { type_kind_struct, s8_const_lit("v4f64_t"), sizeof(v
|
||||
}
|
||||
};
|
||||
|
||||
glb type_t type__r3f64_t = { type_kind_struct, s8_const_lit("r3f64_t"), sizeof(r3f64_t), .count = 6,
|
||||
global type_t type__r3f64_t = { type_kind_struct, s8_const_lit("r3f64_t"), sizeof(r3f64_t), .count = 6,
|
||||
.members = (type_member_t[]){
|
||||
{s8_const_lit("x0"), &type__f64, .offset = offsetof(r3f64_t, x0)},
|
||||
{s8_const_lit("y0"), &type__f64, .offset = offsetof(r3f64_t, y0)},
|
||||
@@ -211,28 +211,28 @@ glb type_t type__r3f64_t = { type_kind_struct, s8_const_lit("r3f64_t"), sizeof(r
|
||||
}
|
||||
};
|
||||
|
||||
glb type_member_t members__r2f64_t[] = {
|
||||
global type_member_t members__r2f64_t[] = {
|
||||
{s8_const_lit("x0"), &type__f64, .offset = offsetof(r2f64_t, x0)},
|
||||
{s8_const_lit("y0"), &type__f64, .offset = offsetof(r2f64_t, y0)},
|
||||
{s8_const_lit("x1"), &type__f64, .offset = offsetof(r2f64_t, x1)},
|
||||
{s8_const_lit("y1"), &type__f64, .offset = offsetof(r2f64_t, y1)},
|
||||
};
|
||||
glb DEFINE_STRUCT(r2f64_t);
|
||||
global DEFINE_STRUCT(r2f64_t);
|
||||
|
||||
glb type_member_t members__r1f64_t[] = {
|
||||
global type_member_t members__r1f64_t[] = {
|
||||
{s8_const_lit("x0"), &type__f64, .offset = offsetof(r1f64_t, x0)},
|
||||
{s8_const_lit("x1"), &type__f64, .offset = offsetof(r1f64_t, x1)},
|
||||
};
|
||||
glb DEFINE_STRUCT(r1f64_t);
|
||||
global DEFINE_STRUCT(r1f64_t);
|
||||
|
||||
glb type_t type__v2i32_t = { type_kind_struct, s8_const_lit("v2i32_t"), sizeof(v2i32_t), .count = 2,
|
||||
global type_t type__v2i32_t = { type_kind_struct, s8_const_lit("v2i32_t"), sizeof(v2i32_t), .count = 2,
|
||||
.members = (type_member_t[]){
|
||||
{s8_const_lit("x"), &type__i32, .offset = offsetof(v2i32_t, x)},
|
||||
{s8_const_lit("y"), &type__i32, .offset = offsetof(v2i32_t, y)},
|
||||
}
|
||||
};
|
||||
|
||||
glb type_t type__v3i32_t = { type_kind_struct, s8_const_lit("v3i32_t"), sizeof(v3i32_t), .count = 3,
|
||||
global type_t type__v3i32_t = { type_kind_struct, s8_const_lit("v3i32_t"), sizeof(v3i32_t), .count = 3,
|
||||
.members = (type_member_t[]){
|
||||
{s8_const_lit("x"), &type__i32, .offset = offsetof(v3i32_t, x)},
|
||||
{s8_const_lit("y"), &type__i32, .offset = offsetof(v3i32_t, y)},
|
||||
@@ -240,7 +240,7 @@ glb type_t type__v3i32_t = { type_kind_struct, s8_const_lit("v3i32_t"), sizeof(v
|
||||
}
|
||||
};
|
||||
|
||||
glb type_t type__v4i32_t = { type_kind_struct, s8_const_lit("v4i32_t"), sizeof(v4i32_t), .count = 4,
|
||||
global type_t type__v4i32_t = { type_kind_struct, s8_const_lit("v4i32_t"), sizeof(v4i32_t), .count = 4,
|
||||
.members = (type_member_t[]){
|
||||
{s8_const_lit("x"), &type__i32, .offset = offsetof(v4i32_t, x)},
|
||||
{s8_const_lit("y"), &type__i32, .offset = offsetof(v4i32_t, y)},
|
||||
@@ -249,7 +249,7 @@ glb type_t type__v4i32_t = { type_kind_struct, s8_const_lit("v4i32_t"), sizeof(v
|
||||
}
|
||||
};
|
||||
|
||||
glb type_t type__r3i32_t = { type_kind_struct, s8_const_lit("r3i32_t"), sizeof(r3i32_t), .count = 6,
|
||||
global type_t type__r3i32_t = { type_kind_struct, s8_const_lit("r3i32_t"), sizeof(r3i32_t), .count = 6,
|
||||
.members = (type_member_t[]){
|
||||
{s8_const_lit("x0"), &type__i32, .offset = offsetof(r3i32_t, x0)},
|
||||
{s8_const_lit("y0"), &type__i32, .offset = offsetof(r3i32_t, y0)},
|
||||
@@ -260,29 +260,29 @@ glb type_t type__r3i32_t = { type_kind_struct, s8_const_lit("r3i32_t"), sizeof(r
|
||||
}
|
||||
};
|
||||
|
||||
glb type_member_t members__r2i32_t[] = {
|
||||
global type_member_t members__r2i32_t[] = {
|
||||
{s8_const_lit("x0"), &type__i32, .offset = offsetof(r2i32_t, x0)},
|
||||
{s8_const_lit("y0"), &type__i32, .offset = offsetof(r2i32_t, y0)},
|
||||
{s8_const_lit("x1"), &type__i32, .offset = offsetof(r2i32_t, x1)},
|
||||
{s8_const_lit("y1"), &type__i32, .offset = offsetof(r2i32_t, y1)},
|
||||
};
|
||||
glb DEFINE_STRUCT(r2i32_t);
|
||||
global DEFINE_STRUCT(r2i32_t);
|
||||
|
||||
glb type_member_t members__r1i32_t[] = {
|
||||
global type_member_t members__r1i32_t[] = {
|
||||
{s8_const_lit("x0"), &type__i32, .offset = offsetof(r1i32_t, x0)},
|
||||
{s8_const_lit("x1"), &type__i32, .offset = offsetof(r1i32_t, x1)},
|
||||
};
|
||||
glb DEFINE_STRUCT(r1i32_t);
|
||||
global DEFINE_STRUCT(r1i32_t);
|
||||
|
||||
|
||||
glb type_t type__v2i64_t = { type_kind_struct, s8_const_lit("v2i64_t"), sizeof(v2i64_t), .count = 2,
|
||||
global type_t type__v2i64_t = { type_kind_struct, s8_const_lit("v2i64_t"), sizeof(v2i64_t), .count = 2,
|
||||
.members = (type_member_t[]){
|
||||
{s8_const_lit("x"), &type__i64, .offset = offsetof(v2i64_t, x)},
|
||||
{s8_const_lit("y"), &type__i64, .offset = offsetof(v2i64_t, y)},
|
||||
}
|
||||
};
|
||||
|
||||
glb type_t type__v3i64_t = { type_kind_struct, s8_const_lit("v3i64_t"), sizeof(v3i64_t), .count = 3,
|
||||
global type_t type__v3i64_t = { type_kind_struct, s8_const_lit("v3i64_t"), sizeof(v3i64_t), .count = 3,
|
||||
.members = (type_member_t[]){
|
||||
{s8_const_lit("x"), &type__i64, .offset = offsetof(v3i64_t, x)},
|
||||
{s8_const_lit("y"), &type__i64, .offset = offsetof(v3i64_t, y)},
|
||||
@@ -290,7 +290,7 @@ glb type_t type__v3i64_t = { type_kind_struct, s8_const_lit("v3i64_t"), sizeof(v
|
||||
}
|
||||
};
|
||||
|
||||
glb type_t type__v4i64_t = { type_kind_struct, s8_const_lit("v4i64_t"), sizeof(v4i64_t), .count = 4,
|
||||
global type_t type__v4i64_t = { type_kind_struct, s8_const_lit("v4i64_t"), sizeof(v4i64_t), .count = 4,
|
||||
.members = (type_member_t[]){
|
||||
{s8_const_lit("x"), &type__i64, .offset = offsetof(v4i64_t, x)},
|
||||
{s8_const_lit("y"), &type__i64, .offset = offsetof(v4i64_t, y)},
|
||||
@@ -299,7 +299,7 @@ glb type_t type__v4i64_t = { type_kind_struct, s8_const_lit("v4i64_t"), sizeof(v
|
||||
}
|
||||
};
|
||||
|
||||
glb type_t type__r3i64_t = { type_kind_struct, s8_const_lit("r3i64_t"), sizeof(r3i64_t), .count = 6,
|
||||
global type_t type__r3i64_t = { type_kind_struct, s8_const_lit("r3i64_t"), sizeof(r3i64_t), .count = 6,
|
||||
.members = (type_member_t[]){
|
||||
{s8_const_lit("x0"), &type__i64, .offset = offsetof(r3i64_t, x0)},
|
||||
{s8_const_lit("y0"), &type__i64, .offset = offsetof(r3i64_t, y0)},
|
||||
@@ -310,35 +310,35 @@ glb type_t type__r3i64_t = { type_kind_struct, s8_const_lit("r3i64_t"), sizeof(r
|
||||
}
|
||||
};
|
||||
|
||||
glb type_member_t members__r2i64_t[] = {
|
||||
global type_member_t members__r2i64_t[] = {
|
||||
{s8_const_lit("x0"), &type__i64, .offset = offsetof(r2i64_t, x0)},
|
||||
{s8_const_lit("y0"), &type__i64, .offset = offsetof(r2i64_t, y0)},
|
||||
{s8_const_lit("x1"), &type__i64, .offset = offsetof(r2i64_t, x1)},
|
||||
{s8_const_lit("y1"), &type__i64, .offset = offsetof(r2i64_t, y1)},
|
||||
};
|
||||
glb DEFINE_STRUCT(r2i64_t);
|
||||
global DEFINE_STRUCT(r2i64_t);
|
||||
|
||||
glb type_member_t members__r1i64_t[] = {
|
||||
global type_member_t members__r1i64_t[] = {
|
||||
{s8_const_lit("x0"), &type__i64, .offset = offsetof(r1i64_t, x0)},
|
||||
{s8_const_lit("x1"), &type__i64, .offset = offsetof(r1i64_t, x1)},
|
||||
};
|
||||
glb DEFINE_STRUCT(r1i64_t);
|
||||
global DEFINE_STRUCT(r1i64_t);
|
||||
|
||||
glb type_member_t members__lex_kind_t[] = {
|
||||
global type_member_t members__lex_kind_t[] = {
|
||||
#define X(KIND, STR, SIMPLE) {.name = s8_const_lit("lex_kind_" #KIND), .value = lex_kind_##KIND},
|
||||
LEX_KIND_XLIST
|
||||
#undef X
|
||||
};
|
||||
DEFINE_ENUM(lex_kind_t);
|
||||
|
||||
glb type_member_t members__lex_suffix_t[] = {
|
||||
global type_member_t members__lex_suffix_t[] = {
|
||||
#define X(KIND) {.name = s8_const_lit("lex_suffix_" #KIND), .value = lex_suffix_##KIND},
|
||||
LEX_SUFFIX_XLIST
|
||||
#undef X
|
||||
};
|
||||
DEFINE_ENUM(lex_suffix_t);
|
||||
|
||||
glb type_member_t members__log_level_t[] = {
|
||||
global type_member_t members__log_level_t[] = {
|
||||
{.name = s8_const_lit("log_level_debug"), .value = log_level_debug},
|
||||
{.name = s8_const_lit("log_level_info"), .value = log_level_info},
|
||||
{.name = s8_const_lit("log_level_warning"), .value = log_level_warning},
|
||||
|
||||
Reference in New Issue
Block a user