-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgen.py
93 lines (83 loc) · 2.19 KB
/
gen.py
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
includes = [
"<stdint.h>",
"<float.h>",
"<stddef.h>",
"<stdbool.h>",
"<math.h>",
"<string.h>",
"<stdarg.h>",
"<xmmintrin.h> // SSE2",
"<pmmintrin.h> // SSE3",
"<smmintrin.h> // SSE4",
]
includes_impl = [
"<stdlib.h>",
"<stdio.h>",
]
files = [
"rjd_platform.h",
"rjd_debug.h",
"rjd_result.h",
"rjd_enum.h",
"rjd_hash.h",
"rjd_atomic.h",
"rjd_mem.h",
"rjd_rng.h",
"rjd_array.h",
"rjd_math.h",
"rjd_geo.h",
"rjd_procgeo.h",
"rjd_easing.h",
"rjd_strbuf.h",
"rjd_timer.h",
"rjd_cmd.h",
"rjd_dict.h",
"rjd_fio.h",
"rjd_thread.h",
"rjd_strpool.h",
"rjd_slotmap.h",
"rjd_utf8.h",
"rjd_path.h",
"rjd_stream.h",
"rjd_binrw.h",
"rjd_strhash.h",
"rjd_resource_types.h",
"rjd_resource_loader.h",
"rjd_resource.h",
"rjd_window.h",
"rjd_input.h",
"rjd_gfx.h",
"rjd_gfx_metal.h",
"rjd_gfx_d3d11.h",
]
concat = "#pragma once\n\n"
concat += "////////////////////////////////////////////////////////////////////////////////\n"
concat += "// autogenerated rjd.h\n"
concat += "////////////////////////////////////////////////////////////////////////////////\n\n"
for include in includes:
concat += "#include " + include + "\n"
concat += "\n#if RJD_IMPL\n"
for include in includes_impl:
concat += "\t#include " + include + "\n"
concat += "#endif\n\n"
for filename in files:
with open(filename, "r") as file:
data = file.read()
concat += "////////////////////////////////////////////////////////////////////////////////\n"
concat += "// " + filename + "\n"
concat += "////////////////////////////////////////////////////////////////////////////////\n"
concat += "\n"
concat += data;
concat += "\n"
with open("rjd.h", "w", newline='\n') as file:
file.write(concat)
with open("rjd_all.h", "w") as file:
allh = "#pragma once\n\n"
for include in includes:
allh += "#include " + include + "\n"
for include in includes_impl:
allh += "#include " + include + "\n"
allh += "\n"
for include in files:
allh += "#include \"" + include + "\"\n"
file.write(allh)