function pointers and callbacks
This commit is contained in:
@@ -24,19 +24,41 @@ Type_Kind :: enum u8 {
|
||||
C_Double,
|
||||
C_Longdouble,
|
||||
Pointer,
|
||||
Array,
|
||||
Function,
|
||||
Record,
|
||||
}
|
||||
|
||||
Type :: struct {
|
||||
kind: Type_Kind,
|
||||
child: Type_Id,
|
||||
params: []Type_Id,
|
||||
record: u32,
|
||||
count: u64,
|
||||
mutable: bool,
|
||||
variadic: bool,
|
||||
}
|
||||
|
||||
Record_Kind :: enum u8 {
|
||||
Struct,
|
||||
Union,
|
||||
}
|
||||
|
||||
Field :: struct {
|
||||
name: string,
|
||||
type: Type_Id,
|
||||
offset: u64,
|
||||
}
|
||||
|
||||
Record :: struct {
|
||||
name: string,
|
||||
identity: string,
|
||||
fields: [dynamic]Field,
|
||||
size: u64,
|
||||
alignment: u32,
|
||||
kind: Record_Kind,
|
||||
complete: bool,
|
||||
reason: string,
|
||||
}
|
||||
|
||||
Alias :: struct {
|
||||
@@ -82,9 +104,17 @@ init_result :: proc(allocator := context.allocator) -> Result {
|
||||
}
|
||||
|
||||
destroy_result :: proc(result: ^Result) {
|
||||
for type_item in result.types {
|
||||
delete(type_item.params, result.allocator)
|
||||
}
|
||||
for record in result.records {
|
||||
delete(record.name, result.allocator)
|
||||
delete(record.identity, result.allocator)
|
||||
for field in record.fields {
|
||||
delete(field.name, result.allocator)
|
||||
}
|
||||
delete(record.fields)
|
||||
delete(record.reason, result.allocator)
|
||||
}
|
||||
for alias in result.aliases {
|
||||
delete(alias.name, result.allocator)
|
||||
|
||||
Reference in New Issue
Block a user