50 lines
1.4 KiB
Zig
50 lines
1.4 KiB
Zig
const std = @import("std");
|
|
|
|
pub fn main() !void {
|
|
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
|
|
defer _ = gpa.deinit();
|
|
const allocator = gpa.allocator();
|
|
|
|
const args = try std.process.argsAlloc(allocator);
|
|
defer std.process.argsFree(allocator, args);
|
|
|
|
if (args.len < 2) {
|
|
std.debug.print("Usage: {s} <path-to-sdl3-headers>\n", .{args[0]});
|
|
std.debug.print("Example: {s} ../SDL/include/SDL3\n", .{args[0]});
|
|
return error.MissingArgument;
|
|
}
|
|
|
|
const headers_path = args[1];
|
|
|
|
std.debug.print("SDL3 Header Parser\n", .{});
|
|
std.debug.print("==================\n\n", .{});
|
|
std.debug.print("Scanning headers in: {s}\n\n", .{headers_path});
|
|
|
|
// Open the directory
|
|
var dir = std.fs.cwd().openDir(headers_path, .{ .iterate = true }) catch |err| {
|
|
std.debug.print("Error: Could not open directory '{s}': {}\n", .{ headers_path, err });
|
|
return err;
|
|
};
|
|
defer dir.close();
|
|
|
|
// Iterate over files
|
|
var iter = dir.iterate();
|
|
var count: usize = 0;
|
|
|
|
while (try iter.next()) |entry| {
|
|
if (entry.kind != .file) continue;
|
|
|
|
// Check if it's a .h file
|
|
if (std.mem.endsWith(u8, entry.name, ".h")) {
|
|
count += 1;
|
|
std.debug.print(" [{d}] {s}\n", .{ count, entry.name });
|
|
}
|
|
}
|
|
|
|
std.debug.print("\nTotal headers found: {d}\n", .{count});
|
|
}
|
|
|
|
test "basic test" {
|
|
try std.testing.expect(true);
|
|
}
|