aboutsummaryrefslogtreecommitdiff
path: root/src/3rdParty/gencode.yue
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2026-01-21 10:05:19 +0800
committerLi Jin <dragon-fly@qq.com>2026-01-21 10:05:19 +0800
commit604a8e5e53cdc7391a502fcabf07e8f1cc2a778c (patch)
tree18dca1f8314fe918d6173ed4acbdc84c5b541752 /src/3rdParty/gencode.yue
parentc6229c02564024d8c02c2d438b2fc180ce4c6bcf (diff)
downloadyuescript-main.tar.gz
yuescript-main.tar.bz2
yuescript-main.zip
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."