1const std = @import("std");
2const common = @import("./_common.zig");
3
4pub usingnamespace common.Main(struct {
5 pub const source_file = "EmojiSources";
6
7 pub const dest_file = "src/emoji_sources.zig";
8
9 pub const dest_header =
10 \\pub const ShiftJISMap = struct {
11 \\ code: u21,
12 \\ docomo: u21,
13 \\ kddi: u21,
14 \\ softbank: u21,
15 \\};
16 \\
17 \\pub const data = [_]ShiftJISMap{
18 \\
19 ;
20
21 pub const dest_footer =
22 \\};
23 \\
24 ;
25
26 pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !void {
27 _ = alloc;
28 if (std.mem.count(u8, line, " ") > 0) return;
29 var it = std.mem.splitScalar(u8, line, ';');
30 const code = it.next().?;
31 // FIXME remove @as and temp vars after switch off stage1
32 const docomo = common.nullify(it.next().?) orelse @as([]const u8, "0");
33 const kddi = common.nullify(it.next().?) orelse @as([]const u8, "0");
34 const softbank = common.nullify(it.next().?) orelse @as([]const u8, "0");
35
36 try writer.print(" .{{ .code = 0x{s}, .docomo = 0x{s}, .kddi = 0x{s}, .softbank = 0x{s} }},\n", .{
37 code,
38 docomo,
39 kddi,
40 softbank,
41 });
42 }
43});