Change record field syntax

This commit is contained in:
Ginger Bill
2016-12-18 22:23:34 +00:00
parent e370337f97
commit 4c10fbdcd4
11 changed files with 193 additions and 304 deletions
+55 -55
View File
@@ -13,67 +13,67 @@
// IMPORTANT NOTE(bill): Do not change the order of any of this data
// The compiler relies upon this _exact_ order
type Type_Info_Member struct #ordered {
name: string; // can be empty if tuple
type_info: ^Type_Info;
offset: int; // offsets are not used in tuples
};
name string; // can be empty if tuple
type_info ^Type_Info;
offset int; // offsets are not used in tuples
}
type Type_Info_Record struct #ordered {
fields: []Type_Info_Member;
size: int; // in bytes
align: int; // in bytes
packed: bool;
ordered: bool;
};
fields []Type_Info_Member;
size int; // in bytes
align int; // in bytes
packed bool;
ordered bool;
}
type Type_Info union {
Named: struct #ordered {
name: string;
base: ^Type_Info; // This will _not_ be a Type_Info.Named
Named struct #ordered {
name string;
base ^Type_Info; // This will _not_ be a Type_Info.Named
};
Integer: struct #ordered {
size: int; // in bytes
signed: bool;
Integer struct #ordered {
size int; // in bytes
signed bool;
};
Float: struct #ordered {
size: int; // in bytes
Float struct #ordered {
size int; // in bytes
};
Any: struct #ordered {};
String: struct #ordered {};
Boolean: struct #ordered {};
Pointer: struct #ordered {
elem: ^Type_Info; // nil -> rawptr
Any struct #ordered {};
String struct #ordered {};
Boolean struct #ordered {};
Pointer struct #ordered {
elem ^Type_Info; // nil -> rawptr
};
Maybe: struct #ordered {
elem: ^Type_Info;
Maybe struct #ordered {
elem ^Type_Info;
};
Procedure: struct #ordered {
params: ^Type_Info; // Type_Info.Tuple
results: ^Type_Info; // Type_Info.Tuple
variadic: bool;
Procedure struct #ordered {
params ^Type_Info; // Type_Info.Tuple
results ^Type_Info; // Type_Info.Tuple
variadic bool;
};
Array: struct #ordered {
elem: ^Type_Info;
elem_size: int;
count: int;
Array struct #ordered {
elem ^Type_Info;
elem_size int;
count int;
};
Slice: struct #ordered {
elem: ^Type_Info;
elem_size: int;
Slice struct #ordered {
elem ^Type_Info;
elem_size int;
};
Vector: struct #ordered {
elem: ^Type_Info;
elem_size: int;
count: int;
align: int;
Vector struct #ordered {
elem ^Type_Info;
elem_size int;
count int;
align int;
};
Tuple: Type_Info_Record;
Struct: Type_Info_Record;
Union: Type_Info_Record;
Raw_Union: Type_Info_Record;
Enum: struct #ordered {
base: ^Type_Info;
values: []i64;
names: []string;
Tuple Type_Info_Record;
Struct Type_Info_Record;
Union Type_Info_Record;
Raw_Union Type_Info_Record;
Enum struct #ordered {
base ^Type_Info;
values []i64;
names []string;
};
};
@@ -126,18 +126,18 @@ type Allocator_Proc proc(allocator_data rawptr, mode Allocator_Mode,
type Allocator struct #ordered {
procedure: Allocator_Proc;
data: rawptr;
procedure Allocator_Proc;
data rawptr;
}
type Context struct #ordered {
thread_id: int;
thread_id int;
allocator: Allocator;
allocator Allocator;
user_data: rawptr;
user_index: int;
user_data rawptr;
user_index int;
}
#thread_local var __context Context;