summaryrefslogtreecommitdiff
path: root/src/3rdParty/gencode.yue
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdParty/gencode.yue')
-rwxr-xr-xsrc/3rdParty/gencode.yue26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/3rdParty/gencode.yue b/src/3rdParty/gencode.yue
new file mode 100755
index 0000000..e0dbcb9
--- /dev/null
+++ b/src/3rdParty/gencode.yue
@@ -0,0 +1,26 @@
1#!yue -e
2
3for file in *["luaminify.lua",]
4 text = ""
5 with io.open file
6 text = \read "*a"
7 \close!
8
9 indent = "\t"
10 count = 0
11 text = text\gsub "#!", "--#!"
12 bytes = indent .. string.gsub text, "(.)", (ch)->
13 sep = ""
14 count += 1
15 if count == 15
16 count = 0
17 sep = "\n" .. indent
18 string.format "%3u,%s", string.byte(ch), sep
19
20 name = file\gsub "%.", "_"
21 output = "#{name}.h"
22 with io.open output, "w"
23 \write "const char #{name}[] = {\n#{bytes}\n};"
24 \close!
25
26 print "file \"#{output}\"generated."