forked from ZigEmbeddedGroup/microzig
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparts_db.zig
More file actions
30 lines (22 loc) · 931 Bytes
/
parts_db.zig
File metadata and controls
30 lines (22 loc) · 931 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
const std = @import("std");
const MicroZig = @import("build/definitions");
pub const PartsDb = struct {
chips: []const MicroZig.Chip,
boards: []const MicroZig.Board,
};
pub fn main() !void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
defer _ = gpa.deinit();
var arena = std.heap.ArenaAllocator.init(gpa.allocator());
defer arena.deinit();
const allocator = arena.allocator();
const args = try std.process.argsAlloc(allocator);
defer std.process.argsFree(allocator, args);
const output_path = args[1];
var chips = std.array_list.Managed(MicroZig.Chip).init(allocator);
var boards = std.array_list.Managed(MicroZig.Board).init(allocator);
inline for (port) |port| {}
const json_str = std.json.stringifyAlloc(b.allocator, parts_db, .{}) catch @panic("OOM");
const output_file = try std.fs.cwd().createFile(output_path, .{});
defer output_file.close();
}