dev/sdl3-parser #1
|
|
@ -430,12 +430,7 @@ pub const CodeGen = struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ) *GPUDevice {
|
// ) *GPUDevice {
|
||||||
// Add trailing comma for functions with more than 3 parameters (triggers multi-line formatting)
|
|
||||||
if (func.params.len > 3) {
|
|
||||||
try self.output.writer(self.allocator).print(",) {s} {{\n", .{zig_return_type});
|
|
||||||
} else {
|
|
||||||
try self.output.writer(self.allocator).print(") {s} {{\n", .{zig_return_type});
|
try self.output.writer(self.allocator).print(") {s} {{\n", .{zig_return_type});
|
||||||
}
|
|
||||||
|
|
||||||
// Function body - call C API with appropriate casts
|
// Function body - call C API with appropriate casts
|
||||||
try self.output.appendSlice(self.allocator, " return ");
|
try self.output.appendSlice(self.allocator, " return ");
|
||||||
|
|
@ -523,12 +518,7 @@ pub const CodeGen = struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ) *GPUDevice {
|
// ) *GPUDevice {
|
||||||
// Add trailing comma for functions with more than 3 parameters (triggers multi-line formatting)
|
|
||||||
if (func.params.len > 3) {
|
|
||||||
try self.output.writer(self.allocator).print(",) {s} {{\n", .{zig_return_type});
|
|
||||||
} else {
|
|
||||||
try self.output.writer(self.allocator).print(") {s} {{\n", .{zig_return_type});
|
try self.output.writer(self.allocator).print(") {s} {{\n", .{zig_return_type});
|
||||||
}
|
|
||||||
|
|
||||||
// Function body - call C API with appropriate casts
|
// Function body - call C API with appropriate casts
|
||||||
try self.output.appendSlice(self.allocator, " return ");
|
try self.output.appendSlice(self.allocator, " return ");
|
||||||
|
|
|
||||||
|
|
@ -1060,6 +1060,8 @@ pub const Scanner = struct {
|
||||||
"SDL_PRINTF_VARARG_FUNCV",
|
"SDL_PRINTF_VARARG_FUNCV",
|
||||||
"SDL_WPRINTF_VARARG_FUNC",
|
"SDL_WPRINTF_VARARG_FUNC",
|
||||||
"SDL_SCANF_VARARG_FUNC",
|
"SDL_SCANF_VARARG_FUNC",
|
||||||
|
"SDL_ACQUIRE",
|
||||||
|
"SDL_RELEASE",
|
||||||
};
|
};
|
||||||
for (vararg_macros) |macro| {
|
for (vararg_macros) |macro| {
|
||||||
if (std.mem.indexOf(u8, text, macro)) |pos| {
|
if (std.mem.indexOf(u8, text, macro)) |pos| {
|
||||||
|
|
|
||||||
|
|
@ -78,9 +78,13 @@ pub fn convertType(c_type: []const u8, allocator: Allocator) ![]const u8 {
|
||||||
if (std.mem.eql(u8, trimmed, "bool *")) return try allocator.dupe(u8, "*bool");
|
if (std.mem.eql(u8, trimmed, "bool *")) return try allocator.dupe(u8, "*bool");
|
||||||
if (std.mem.eql(u8, trimmed, "size_t *")) return try allocator.dupe(u8, "*usize");
|
if (std.mem.eql(u8, trimmed, "size_t *")) return try allocator.dupe(u8, "*usize");
|
||||||
if (std.mem.eql(u8, trimmed, "float *")) return try allocator.dupe(u8, "*f32");
|
if (std.mem.eql(u8, trimmed, "float *")) return try allocator.dupe(u8, "*f32");
|
||||||
|
if (std.mem.eql(u8, trimmed, "const float *")) return try allocator.dupe(u8, "*const f32");
|
||||||
if (std.mem.eql(u8, trimmed, "double *")) return try allocator.dupe(u8, "*f64");
|
if (std.mem.eql(u8, trimmed, "double *")) return try allocator.dupe(u8, "*f64");
|
||||||
|
if (std.mem.eql(u8, trimmed, "Uint8 *")) return try allocator.dupe(u8, "*u8");
|
||||||
|
if (std.mem.eql(u8, trimmed, "Uint16 *")) return try allocator.dupe(u8, "*u16");
|
||||||
if (std.mem.eql(u8, trimmed, "Uint32 *")) return try allocator.dupe(u8, "*u32");
|
if (std.mem.eql(u8, trimmed, "Uint32 *")) return try allocator.dupe(u8, "*u32");
|
||||||
if (std.mem.eql(u8, trimmed, "Uint64 *")) return try allocator.dupe(u8, "*u64");
|
if (std.mem.eql(u8, trimmed, "Uint64 *")) return try allocator.dupe(u8, "*u64");
|
||||||
|
if (std.mem.eql(u8, trimmed, "Sint16 *")) return try allocator.dupe(u8, "*i16");
|
||||||
if (std.mem.eql(u8, trimmed, "Sint32 *")) return try allocator.dupe(u8, "*i32");
|
if (std.mem.eql(u8, trimmed, "Sint32 *")) return try allocator.dupe(u8, "*i32");
|
||||||
if (std.mem.eql(u8, trimmed, "const bool *")) return try allocator.dupe(u8, "*const bool");
|
if (std.mem.eql(u8, trimmed, "const bool *")) return try allocator.dupe(u8, "*const bool");
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue