Mon, 10 Sep 2018 13:52:35 +0100
Revamp console output to be driven by log_data()
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1 | #!/usr/bin/lua5.2 |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2 | package.preload['optlex']=(function(...) |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3 | local _ENV=_ENV; |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
4 | local function e(t,...) |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
5 | local e=package.loaded[t]or _ENV[t]or{_NAME=t}; |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
6 | package.loaded[t]=e; |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
7 | for t=1,select("#",...)do |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
8 | (select(t,...))(e); |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
9 | end |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
10 | _ENV=e; |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
11 | _M=e; |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
12 | return e; |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
13 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
14 | local s=_G |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
15 | local u=require"string" |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
16 | local i=u.match |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
17 | local e=u.sub |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
18 | local r=u.find |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
19 | local l=u.rep |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
20 | local c |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
21 | error=s.error |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
22 | warn={} |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
23 | local n,o,d |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
24 | local q={ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
25 | TK_KEYWORD=true, |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
26 | TK_NAME=true, |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
27 | TK_NUMBER=true, |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
28 | TK_STRING=true, |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
29 | TK_LSTRING=true, |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
30 | TK_OP=true, |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
31 | TK_EOS=true, |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
32 | } |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
33 | local b={ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
34 | TK_COMMENT=true, |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
35 | TK_LCOMMENT=true, |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
36 | TK_EOL=true, |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
37 | TK_SPACE=true, |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
38 | } |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
39 | local h |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
40 | local function k(e) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
41 | local t=n[e-1] |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
42 | if e<=1 or t=="TK_EOL"then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
43 | return true |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
44 | elseif t==""then |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
45 | return k(e-1) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
46 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
47 | return false |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
48 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
49 | local function g(e) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
50 | local t=n[e+1] |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
51 | if e>=#n or t=="TK_EOL"or t=="TK_EOS"then |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
52 | return true |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
53 | elseif t==""then |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
54 | return g(e+1) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
55 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
56 | return false |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
57 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
58 | local function E(a) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
59 | local t=#i(a,"^%-%-%[=*%[") |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
60 | local a=e(a,t+1,-(t-1)) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
61 | local e,t=1,0 |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
62 | while true do |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
63 | local a,n,i,o=r(a,"([\r\n])([\r\n]?)",e) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
64 | if not a then break end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
65 | e=a+1 |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
66 | t=t+1 |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
67 | if#o>0 and i~=o then |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
68 | e=e+1 |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
69 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
70 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
71 | return t |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
72 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
73 | local function v(s,h) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
74 | local a=i |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
75 | local t,e=n[s],n[h] |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
76 | if t=="TK_STRING"or t=="TK_LSTRING"or |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
77 | e=="TK_STRING"or e=="TK_LSTRING"then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
78 | return"" |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
79 | elseif t=="TK_OP"or e=="TK_OP"then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
80 | if(t=="TK_OP"and(e=="TK_KEYWORD"or e=="TK_NAME"))or |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
81 | (e=="TK_OP"and(t=="TK_KEYWORD"or t=="TK_NAME"))then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
82 | return"" |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
83 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
84 | if t=="TK_OP"and e=="TK_OP"then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
85 | local t,e=o[s],o[h] |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
86 | if(a(t,"^%.%.?$")and a(e,"^%."))or |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
87 | (a(t,"^[~=<>]$")and e=="=")or |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
88 | (t=="["and(e=="["or e=="="))then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
89 | return" " |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
90 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
91 | return"" |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
92 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
93 | local t=o[s] |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
94 | if e=="TK_OP"then t=o[h]end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
95 | if a(t,"^%.%.?%.?$")then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
96 | return" " |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
97 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
98 | return"" |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
99 | else |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
100 | return" " |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
101 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
102 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
103 | local function j() |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
104 | local a,s,i={},{},{} |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
105 | local e=1 |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
106 | for t=1,#n do |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
107 | local n=n[t] |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
108 | if n~=""then |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
109 | a[e],s[e],i[e]=n,o[t],d[t] |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
110 | e=e+1 |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
111 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
112 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
113 | n,o,d=a,s,i |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
114 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
115 | local function x(r) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
116 | local t=o[r] |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
117 | local t=t |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
118 | local n |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
119 | if i(t,"^0[xX]")then |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
120 | local e=s.tostring(s.tonumber(t)) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
121 | if#e<=#t then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
122 | t=e |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
123 | else |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
124 | return |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
125 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
126 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
127 | if i(t,"^%d+%.?0*$")then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
128 | t=i(t,"^(%d+)%.?0*$") |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
129 | if t+0>0 then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
130 | t=i(t,"^0*([1-9]%d*)$") |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
131 | local a=#i(t,"0*$") |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
132 | local o=s.tostring(a) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
133 | if a>#o+1 then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
134 | t=e(t,1,#t-a).."e"..o |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
135 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
136 | n=t |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
137 | else |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
138 | n="0" |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
139 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
140 | elseif not i(t,"[eE]")then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
141 | local a,t=i(t,"^(%d*)%.(%d+)$") |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
142 | if a==""then a=0 end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
143 | if t+0==0 and a==0 then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
144 | n="0" |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
145 | else |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
146 | local o=#i(t,"0*$") |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
147 | if o>0 then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
148 | t=e(t,1,#t-o) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
149 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
150 | if a+0>0 then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
151 | n=a.."."..t |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
152 | else |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
153 | n="."..t |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
154 | local a=#i(t,"^0*") |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
155 | local o=#t-a |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
156 | local a=s.tostring(#t) |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
157 | if o+2+#a<1+#t then |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
158 | n=e(t,-o).."e-"..a |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
159 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
160 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
161 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
162 | else |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
163 | local t,a=i(t,"^([^eE]+)[eE]([%+%-]?%d+)$") |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
164 | a=s.tonumber(a) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
165 | local h,o=i(t,"^(%d*)%.(%d*)$") |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
166 | if h then |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
167 | a=a-#o |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
168 | t=h..o |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
169 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
170 | if t+0==0 then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
171 | n="0" |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
172 | else |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
173 | local o=#i(t,"^0*") |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
174 | t=e(t,o+1) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
175 | o=#i(t,"0*$") |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
176 | if o>0 then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
177 | t=e(t,1,#t-o) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
178 | a=a+o |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
179 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
180 | local i=s.tostring(a) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
181 | if a==0 then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
182 | n=t |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
183 | elseif a>0 and(a<=1+#i)then |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
184 | n=t..l("0",a) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
185 | elseif a<0 and(a>=-#t)then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
186 | o=#t+a |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
187 | n=e(t,1,o).."."..e(t,o+1) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
188 | elseif a<0 and(#i>=-a-#t)then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
189 | o=-a-#t |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
190 | n="."..l("0",o)..t |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
191 | else |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
192 | n=t.."e"..a |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
193 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
194 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
195 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
196 | if n and n~=o[r]then |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
197 | if h then |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
198 | c("<number> (line "..d[r]..") "..o[r].." -> "..n) |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
199 | h=h+1 |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
200 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
201 | o[r]=n |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
202 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
203 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
204 | local function z(m) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
205 | local t=o[m] |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
206 | local n=e(t,1,1) |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
207 | local f=(n=="'")and'"'or"'" |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
208 | local t=e(t,2,-2) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
209 | local a=1 |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
210 | local l,s=0,0 |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
211 | while a<=#t do |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
212 | local c=e(t,a,a) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
213 | if c=="\\"then |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
214 | local o=a+1 |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
215 | local d=e(t,o,o) |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
216 | local h=r("abfnrtv\\\n\r\"\'0123456789",d,1,true) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
217 | if not h then |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
218 | t=e(t,1,a-1)..e(t,o) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
219 | a=a+1 |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
220 | elseif h<=8 then |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
221 | a=a+2 |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
222 | elseif h<=10 then |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
223 | local i=e(t,o,o+1) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
224 | if i=="\r\n"or i=="\n\r"then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
225 | t=e(t,1,a).."\n"..e(t,o+2) |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
226 | elseif h==10 then |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
227 | t=e(t,1,a).."\n"..e(t,o+1) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
228 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
229 | a=a+2 |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
230 | elseif h<=12 then |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
231 | if d==n then |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
232 | l=l+1 |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
233 | a=a+2 |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
234 | else |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
235 | s=s+1 |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
236 | t=e(t,1,a-1)..e(t,o) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
237 | a=a+1 |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
238 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
239 | else |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
240 | local i=i(t,"^(%d%d?%d?)",o) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
241 | o=a+1+#i |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
242 | local d=i+0 |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
243 | local h=u.char(d) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
244 | local r=r("\a\b\f\n\r\t\v",h,1,true) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
245 | if r then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
246 | i="\\"..e("abfnrtv",r,r) |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
247 | elseif d<32 then |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
248 | i="\\"..d |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
249 | elseif h==n then |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
250 | i="\\"..h |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
251 | l=l+1 |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
252 | elseif h=="\\"then |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
253 | i="\\\\" |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
254 | else |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
255 | i=h |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
256 | if h==f then |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
257 | s=s+1 |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
258 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
259 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
260 | t=e(t,1,a-1)..i..e(t,o) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
261 | a=a+#i |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
262 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
263 | else |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
264 | a=a+1 |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
265 | if c==f then |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
266 | s=s+1 |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
267 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
268 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
269 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
270 | if l>s then |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
271 | a=1 |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
272 | while a<=#t do |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
273 | local o,s,i=r(t,"([\'\"])",a) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
274 | if not o then break end |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
275 | if i==n then |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
276 | t=e(t,1,o-2)..e(t,o) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
277 | a=o |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
278 | else |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
279 | t=e(t,1,o-1).."\\"..e(t,o) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
280 | a=o+2 |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
281 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
282 | end |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
283 | n=f |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
284 | end |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
285 | t=n..t..n |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
286 | if t~=o[m]then |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
287 | if h then |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
288 | c("<string> (line "..d[m]..") "..o[m].." -> "..t) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
289 | h=h+1 |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
290 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
291 | o[m]=t |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
292 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
293 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
294 | local function _(u) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
295 | local t=o[u] |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
296 | local h=i(t,"^%[=*%[") |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
297 | local a=#h |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
298 | local c=e(t,-a,-1) |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
299 | local s=e(t,a+1,-(a+1)) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
300 | local n="" |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
301 | local t=1 |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
302 | while true do |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
303 | local a,o,r,h=r(s,"([\r\n])([\r\n]?)",t) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
304 | local o |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
305 | if not a then |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
306 | o=e(s,t) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
307 | elseif a>=t then |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
308 | o=e(s,t,a-1) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
309 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
310 | if o~=""then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
311 | if i(o,"%s+$")then |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
312 | warn.lstring="trailing whitespace in long string near line "..d[u] |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
313 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
314 | n=n..o |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
315 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
316 | if not a then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
317 | break |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
318 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
319 | t=a+1 |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
320 | if a then |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
321 | if#h>0 and r~=h then |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
322 | t=t+1 |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
323 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
324 | if not(t==1 and t==a)then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
325 | n=n.."\n" |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
326 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
327 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
328 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
329 | if a>=3 then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
330 | local e,t=a-1 |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
331 | while e>=2 do |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
332 | local a="%]"..l("=",e-2).."%]" |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
333 | if not i(n,a)then t=e end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
334 | e=e-1 |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
335 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
336 | if t then |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
337 | a=l("=",t-2) |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
338 | h,c="["..a.."[","]"..a.."]" |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
339 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
340 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
341 | o[u]=h..n..c |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
342 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
343 | local function w(u) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
344 | local a=o[u] |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
345 | local h=i(a,"^%-%-%[=*%[") |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
346 | local t=#h |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
347 | local d=e(a,-t,-1) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
348 | local s=e(a,t+1,-(t-1)) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
349 | local n="" |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
350 | local a=1 |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
351 | while true do |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
352 | local o,t,r,h=r(s,"([\r\n])([\r\n]?)",a) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
353 | local t |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
354 | if not o then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
355 | t=e(s,a) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
356 | elseif o>=a then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
357 | t=e(s,a,o-1) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
358 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
359 | if t~=""then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
360 | local a=i(t,"%s*$") |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
361 | if#a>0 then t=e(t,1,-(a+1))end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
362 | n=n..t |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
363 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
364 | if not o then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
365 | break |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
366 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
367 | a=o+1 |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
368 | if o then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
369 | if#h>0 and r~=h then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
370 | a=a+1 |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
371 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
372 | n=n.."\n" |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
373 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
374 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
375 | t=t-2 |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
376 | if t>=3 then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
377 | local e,a=t-1 |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
378 | while e>=2 do |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
379 | local t="%]"..l("=",e-2).."%]" |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
380 | if not i(n,t)then a=e end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
381 | e=e-1 |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
382 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
383 | if a then |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
384 | t=l("=",a-2) |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
385 | h,d="--["..t.."[","]"..t.."]" |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
386 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
387 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
388 | o[u]=h..n..d |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
389 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
390 | local function p(a) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
391 | local t=o[a] |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
392 | local i=i(t,"%s*$") |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
393 | if#i>0 then |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
394 | t=e(t,1,-(i+1)) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
395 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
396 | o[a]=t |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
397 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
398 | local function A(o,a) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
399 | if not o then return false end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
400 | local t=i(a,"^%-%-%[=*%[") |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
401 | local t=#t |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
402 | local i=e(a,-t,-1) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
403 | local e=e(a,t+1,-(t-1)) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
404 | if r(e,o,1,true)then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
405 | return true |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
406 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
407 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
408 | function optimize(t,i,r,a) |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
409 | local m=t["opt-comments"] |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
410 | local u=t["opt-whitespace"] |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
411 | local f=t["opt-emptylines"] |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
412 | local y=t["opt-eols"] |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
413 | local I=t["opt-strings"] |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
414 | local T=t["opt-numbers"] |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
415 | local O=t.KEEP |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
416 | h=t.DETAILS and 0 |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
417 | c=c or s.print |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
418 | if y then |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
419 | m=true |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
420 | u=true |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
421 | f=true |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
422 | end |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
423 | n,o,d |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
424 | =i,r,a |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
425 | local t=1 |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
426 | local a,r |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
427 | local s |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
428 | local function i(i,a,e) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
429 | e=e or t |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
430 | n[e]=i or"" |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
431 | o[e]=a or"" |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
432 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
433 | while true do |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
434 | a,r=n[t],o[t] |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
435 | local h=k(t) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
436 | if h then s=nil end |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
437 | if a=="TK_EOS"then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
438 | break |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
439 | elseif a=="TK_KEYWORD"or |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
440 | a=="TK_NAME"or |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
441 | a=="TK_OP"then |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
442 | s=t |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
443 | elseif a=="TK_NUMBER"then |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
444 | if T then |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
445 | x(t) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
446 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
447 | s=t |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
448 | elseif a=="TK_STRING"or |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
449 | a=="TK_LSTRING"then |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
450 | if I then |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
451 | if a=="TK_STRING"then |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
452 | z(t) |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
453 | else |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
454 | _(t) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
455 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
456 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
457 | s=t |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
458 | elseif a=="TK_COMMENT"then |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
459 | if m then |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
460 | if t==1 and e(r,1,1)=="#"then |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
461 | p(t) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
462 | else |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
463 | i() |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
464 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
465 | elseif u then |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
466 | p(t) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
467 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
468 | elseif a=="TK_LCOMMENT"then |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
469 | if A(O,r)then |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
470 | if u then |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
471 | w(t) |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
472 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
473 | s=t |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
474 | elseif m then |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
475 | local e=E(r) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
476 | if b[n[t+1]]then |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
477 | i() |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
478 | a="" |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
479 | else |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
480 | i("TK_SPACE"," ") |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
481 | end |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
482 | if not f and e>0 then |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
483 | i("TK_EOL",l("\n",e)) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
484 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
485 | if u and a~=""then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
486 | t=t-1 |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
487 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
488 | else |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
489 | if u then |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
490 | w(t) |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
491 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
492 | s=t |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
493 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
494 | elseif a=="TK_EOL"then |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
495 | if h and f then |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
496 | i() |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
497 | elseif r=="\r\n"or r=="\n\r"then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
498 | i("TK_EOL","\n") |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
499 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
500 | elseif a=="TK_SPACE"then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
501 | if u then |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
502 | if h or g(t)then |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
503 | i() |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
504 | else |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
505 | local a=n[s] |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
506 | if a=="TK_LCOMMENT"then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
507 | i() |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
508 | else |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
509 | local e=n[t+1] |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
510 | if b[e]then |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
511 | if(e=="TK_COMMENT"or e=="TK_LCOMMENT")and |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
512 | a=="TK_OP"and o[s]=="-"then |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
513 | else |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
514 | i() |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
515 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
516 | else |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
517 | local e=v(s,t+1) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
518 | if e==""then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
519 | i() |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
520 | else |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
521 | i("TK_SPACE"," ") |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
522 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
523 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
524 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
525 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
526 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
527 | else |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
528 | error("unidentified token encountered") |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
529 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
530 | t=t+1 |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
531 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
532 | j() |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
533 | if y then |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
534 | t=1 |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
535 | if n[1]=="TK_COMMENT"then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
536 | t=3 |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
537 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
538 | while true do |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
539 | a,r=n[t],o[t] |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
540 | if a=="TK_EOS"then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
541 | break |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
542 | elseif a=="TK_EOL"then |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
543 | local e,a=n[t-1],n[t+1] |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
544 | if q[e]and q[a]then |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
545 | local e=v(t-1,t+1) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
546 | if e==""then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
547 | i() |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
548 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
549 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
550 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
551 | t=t+1 |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
552 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
553 | j() |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
554 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
555 | if h and h>0 then c()end |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
556 | return n,o,d |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
557 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
558 | return{optimize=optimize} |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
559 | end) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
560 | package.preload['optparser']=(function(...) |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
561 | local _ENV=_ENV; |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
562 | local function e(t,...) |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
563 | local e=package.loaded[t]or _ENV[t]or{_NAME=t}; |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
564 | package.loaded[t]=e; |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
565 | for t=1,select("#",...)do |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
566 | (select(t,...))(e); |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
567 | end |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
568 | _ENV=e; |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
569 | _M=e; |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
570 | return e; |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
571 | end |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
572 | local e=_G |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
573 | local a=require"string" |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
574 | local l=require"table" |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
575 | local s="etaoinshrdlucmfwypvbgkqjxz_ETAOINSHRDLUCMFWYPVBGKQJXZ" |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
576 | local d="etaoinshrdlucmfwypvbgkqjxz_0123456789ETAOINSHRDLUCMFWYPVBGKQJXZ" |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
577 | local w={} |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
578 | for e in a.gmatch([[ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
579 | and break do else elseif end false for function if in |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
580 | local nil not or repeat return then true until while |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
581 | self _ENV]],"%S+")do |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
582 | w[e]=true |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
583 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
584 | local h,u, |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
585 | m,o, |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
586 | c,v, |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
587 | r, |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
588 | n |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
589 | local function f(e) |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
590 | local i={} |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
591 | for n=1,#e do |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
592 | local e=e[n] |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
593 | local o=e.name |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
594 | if not i[o]then |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
595 | i[o]={ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
596 | decl=0,token=0,size=0, |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
597 | } |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
598 | end |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
599 | local t=i[o] |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
600 | t.decl=t.decl+1 |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
601 | local i=e.xref |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
602 | local a=#i |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
603 | t.token=t.token+a |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
604 | t.size=t.size+a*#o |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
605 | if e.decl then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
606 | e.id=n |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
607 | e.xcount=a |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
608 | if a>1 then |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
609 | e.first=i[2] |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
610 | e.last=i[a] |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
611 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
612 | else |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
613 | t.id=n |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
614 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
615 | end |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
616 | return i |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
617 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
618 | local function y(e) |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
619 | local i=a.byte |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
620 | local n=a.char |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
621 | local a={ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
622 | TK_KEYWORD=true,TK_NAME=true,TK_NUMBER=true, |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
623 | TK_STRING=true,TK_LSTRING=true, |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
624 | } |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
625 | if not e["opt-comments"]then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
626 | a.TK_COMMENT=true |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
627 | a.TK_LCOMMENT=true |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
628 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
629 | local e={} |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
630 | for t=1,#h do |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
631 | e[t]=u[t] |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
632 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
633 | for t=1,#o do |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
634 | local t=o[t] |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
635 | local a=t.xref |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
636 | for t=1,t.xcount do |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
637 | local t=a[t] |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
638 | e[t]="" |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
639 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
640 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
641 | local t={} |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
642 | for e=0,255 do t[e]=0 end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
643 | for o=1,#h do |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
644 | local o,e=h[o],e[o] |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
645 | if a[o]then |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
646 | for a=1,#e do |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
647 | local e=i(e,a) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
648 | t[e]=t[e]+1 |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
649 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
650 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
651 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
652 | local function o(a) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
653 | local e={} |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
654 | for o=1,#a do |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
655 | local a=i(a,o) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
656 | e[o]={c=a,freq=t[a],} |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
657 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
658 | l.sort(e, |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
659 | function(t,e) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
660 | return t.freq>e.freq |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
661 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
662 | ) |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
663 | local t={} |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
664 | for a=1,#e do |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
665 | t[a]=n(e[a].c) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
666 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
667 | return l.concat(t) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
668 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
669 | s=o(s) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
670 | d=o(d) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
671 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
672 | local function p() |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
673 | local t |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
674 | local n,h=#s,#d |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
675 | local e=r |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
676 | if e<n then |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
677 | e=e+1 |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
678 | t=a.sub(s,e,e) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
679 | else |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
680 | local i,o=n,1 |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
681 | repeat |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
682 | e=e-i |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
683 | i=i*h |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
684 | o=o+1 |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
685 | until i>e |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
686 | local i=e%n |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
687 | e=(e-i)/n |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
688 | i=i+1 |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
689 | t=a.sub(s,i,i) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
690 | while o>1 do |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
691 | local i=e%h |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
692 | e=(e-i)/h |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
693 | i=i+1 |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
694 | t=t..a.sub(d,i,i) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
695 | o=o-1 |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
696 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
697 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
698 | r=r+1 |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
699 | return t,c[t]~=nil |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
700 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
701 | function optimize(e,i,t,s,a) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
702 | h,u,m,o |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
703 | =i,t,s,a |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
704 | r=0 |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
705 | n={} |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
706 | c=f(m) |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
707 | v=f(o) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
708 | if e["opt-entropy"]then |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
709 | y(e) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
710 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
711 | local e={} |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
712 | for t=1,#o do |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
713 | e[t]=o[t] |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
714 | end |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
715 | l.sort(e, |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
716 | function(t,e) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
717 | return t.xcount>e.xcount |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
718 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
719 | ) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
720 | local a,t,r={},1,false |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
721 | for o=1,#e do |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
722 | local e=e[o] |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
723 | if not e.preserve then |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
724 | a[t]=e |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
725 | t=t+1 |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
726 | elseif e.name=="self"then |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
727 | r=true |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
728 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
729 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
730 | e=a |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
731 | local s=#e |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
732 | while s>0 do |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
733 | local h,t |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
734 | repeat |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
735 | h,t=p() |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
736 | until not w[h] |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
737 | n[#n+1]=h |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
738 | local a=s |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
739 | if t then |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
740 | local i=m[c[h].id].xref |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
741 | local n=#i |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
742 | for t=1,s do |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
743 | local t=e[t] |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
744 | local s,e=t.act,t.rem |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
745 | while e<0 do |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
746 | e=o[-e].rem |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
747 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
748 | local o |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
749 | for t=1,n do |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
750 | local t=i[t] |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
751 | if t>=s and t<=e then o=true end |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
752 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
753 | if o then |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
754 | t.skip=true |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
755 | a=a-1 |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
756 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
757 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
758 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
759 | while a>0 do |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
760 | local t=1 |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
761 | while e[t].skip do |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
762 | t=t+1 |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
763 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
764 | a=a-1 |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
765 | local i=e[t] |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
766 | t=t+1 |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
767 | i.newname=h |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
768 | i.skip=true |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
769 | i.done=true |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
770 | local s,h=i.first,i.last |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
771 | local r=i.xref |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
772 | if s and a>0 then |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
773 | local n=a |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
774 | while n>0 do |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
775 | while e[t].skip do |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
776 | t=t+1 |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
777 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
778 | n=n-1 |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
779 | local e=e[t] |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
780 | t=t+1 |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
781 | local n,t=e.act,e.rem |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
782 | while t<0 do |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
783 | t=o[-t].rem |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
784 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
785 | if not(h<n or s>t)then |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
786 | if n>=i.act then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
787 | for o=1,i.xcount do |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
788 | local o=r[o] |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
789 | if o>=n and o<=t then |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
790 | a=a-1 |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
791 | e.skip=true |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
792 | break |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
793 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
794 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
795 | else |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
796 | if e.last and e.last>=i.act then |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
797 | a=a-1 |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
798 | e.skip=true |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
799 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
800 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
801 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
802 | if a==0 then break end |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
803 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
804 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
805 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
806 | local a,t={},1 |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
807 | for o=1,s do |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
808 | local e=e[o] |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
809 | if not e.done then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
810 | e.skip=false |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
811 | a[t]=e |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
812 | t=t+1 |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
813 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
814 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
815 | e=a |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
816 | s=#e |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
817 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
818 | for e=1,#o do |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
819 | local e=o[e] |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
820 | local t=e.xref |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
821 | if e.newname then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
822 | for a=1,e.xcount do |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
823 | local t=t[a] |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
824 | u[t]=e.newname |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
825 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
826 | e.name,e.oldname |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
827 | =e.newname,e.name |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
828 | else |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
829 | e.oldname=e.name |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
830 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
831 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
832 | if r then |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
833 | n[#n+1]="self" |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
834 | end |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
835 | local e=f(o) |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
836 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
837 | return{optimize=optimize} |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
838 | end) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
839 | package.preload['llex']=(function(...) |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
840 | local _ENV=_ENV; |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
841 | local function e(t,...) |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
842 | local e=package.loaded[t]or _ENV[t]or{_NAME=t}; |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
843 | package.loaded[t]=e; |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
844 | for t=1,select("#",...)do |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
845 | (select(t,...))(e); |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
846 | end |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
847 | _ENV=e; |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
848 | _M=e; |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
849 | return e; |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
850 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
851 | local y=_G |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
852 | local s=require"string" |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
853 | local l=s.find |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
854 | local c=s.match |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
855 | local n=s.sub |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
856 | local e='' |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
857 | local r='' |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
858 | local a=1 |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
859 | local d=1 |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
860 | local m={} |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
861 | local w={} |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
862 | local p={} |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
863 | local i='' |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
864 | local v={} |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
865 | for e in s.gmatch([[ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
866 | and break do else elseif end false for function if in |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
867 | local nil not or repeat return then true until while]],"%S+")do |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
868 | v[e]=true |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
869 | end |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
870 | local function o(a,t) |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
871 | local e=#m+1 |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
872 | m[e]=a |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
873 | w[e]=t |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
874 | p[e]=d |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
875 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
876 | local function h(t,s) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
877 | local n=n |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
878 | local i=n(e,t,t) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
879 | t=t+1 |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
880 | local e=n(e,t,t) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
881 | if(e=="\n"or e=="\r")and(e~=i)then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
882 | t=t+1 |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
883 | i=i..e |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
884 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
885 | if s then o("TK_EOL",i)end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
886 | d=d+1 |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
887 | a=t |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
888 | return t |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
889 | end |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
890 | function init(i,t) |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
891 | e=i |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
892 | r=t |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
893 | local t,n,e,i=l(e,"^(#[^\r\n]*)(\r?\n?)") |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
894 | if t then |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
895 | a=a+#e |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
896 | o("TK_COMMENT",e) |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
897 | if#i>0 then h(a,true)end |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
898 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
899 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
900 | function chunkid() |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
901 | if r and c(r,"^[=@]")then |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
902 | return n(r,2) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
903 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
904 | return"[string]" |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
905 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
906 | function errorline(t,a) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
907 | local e=error or y.error |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
908 | e(s.format("%s:%d: %s",chunkid(),a or d,t)) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
909 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
910 | local r=errorline |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
911 | local function u(t) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
912 | local i=n |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
913 | local n=i(e,t,t) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
914 | t=t+1 |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
915 | local o=#c(e,"=*",t) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
916 | t=t+o |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
917 | a=t |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
918 | return(i(e,t,t)==n)and o or(-o)-1 |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
919 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
920 | local function f(d,s) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
921 | local t=a+1 |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
922 | local n=n |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
923 | local o=n(e,t,t) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
924 | if o=="\r"or o=="\n"then |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
925 | t=h(t) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
926 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
927 | local o=t |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
928 | while true do |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
929 | local o,c,l=l(e,"([\r\n%]])",t) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
930 | if not o then |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
931 | r(d and"unfinished long string"or |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
932 | "unfinished long comment") |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
933 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
934 | t=o |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
935 | if l=="]"then |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
936 | if u(t)==s then |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
937 | i=n(e,i,a) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
938 | a=a+1 |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
939 | return i |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
940 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
941 | t=a |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
942 | else |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
943 | i=i.."\n" |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
944 | t=h(t) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
945 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
946 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
947 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
948 | local function b(u) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
949 | local t=a |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
950 | local s=l |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
951 | local d=n |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
952 | while true do |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
953 | local n,l,o=s(e,"([\n\r\\\"\'])",t) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
954 | if n then |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
955 | if o=="\n"or o=="\r"then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
956 | r("unfinished string") |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
957 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
958 | t=n |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
959 | if o=="\\"then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
960 | t=t+1 |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
961 | o=d(e,t,t) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
962 | if o==""then break end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
963 | n=s("abfnrtv\n\r",o,1,true) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
964 | if n then |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
965 | if n>7 then |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
966 | t=h(t) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
967 | else |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
968 | t=t+1 |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
969 | end |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
970 | elseif s(o,"%D")then |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
971 | t=t+1 |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
972 | else |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
973 | local o,a,e=s(e,"^(%d%d?%d?)",t) |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
974 | t=a+1 |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
975 | if e+1>256 then |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
976 | r("escape sequence too large") |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
977 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
978 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
979 | else |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
980 | t=t+1 |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
981 | if o==u then |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
982 | a=t |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
983 | return d(e,i,t-1) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
984 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
985 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
986 | else |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
987 | break |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
988 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
989 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
990 | r("unfinished string") |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
991 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
992 | function llex() |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
993 | local s=l |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
994 | local d=c |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
995 | while true do |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
996 | local t=a |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
997 | while true do |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
998 | local c,m,l=s(e,"^([_%a][_%w]*)",t) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
999 | if c then |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1000 | a=t+#l |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1001 | if v[l]then |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1002 | o("TK_KEYWORD",l) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1003 | else |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1004 | o("TK_NAME",l) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1005 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1006 | break |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1007 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1008 | local l,m,c=s(e,"^(%.?)%d",t) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1009 | if l then |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1010 | if c=="."then t=t+1 end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1011 | local u,h,i=s(e,"^%d*[%.%d]*([eE]?)",t) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1012 | t=h+1 |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1013 | if#i==1 then |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1014 | if d(e,"^[%+%-]",t)then |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1015 | t=t+1 |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1016 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1017 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1018 | local i,t=s(e,"^[_%w]*",t) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1019 | a=t+1 |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1020 | local e=n(e,l,t) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1021 | if not y.tonumber(e)then |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1022 | r("malformed number") |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1023 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1024 | o("TK_NUMBER",e) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1025 | break |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1026 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1027 | local m,w,c,l=s(e,"^((%s)[ \t\v\f]*)",t) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1028 | if m then |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1029 | if l=="\n"or l=="\r"then |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1030 | h(t,true) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1031 | else |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1032 | a=w+1 |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1033 | o("TK_SPACE",c) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1034 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1035 | break |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1036 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1037 | local h=d(e,"^%p",t) |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1038 | if h then |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1039 | i=t |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1040 | local l=s("-[\"\'.=<>~",h,1,true) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1041 | if l then |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1042 | if l<=2 then |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1043 | if l==1 then |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1044 | local r=d(e,"^%-%-(%[?)",t) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1045 | if r then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1046 | t=t+2 |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1047 | local h=-1 |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1048 | if r=="["then |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1049 | h=u(t) |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1050 | end |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1051 | if h>=0 then |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1052 | o("TK_LCOMMENT",f(false,h)) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1053 | else |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1054 | a=s(e,"[\n\r]",t)or(#e+1) |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1055 | o("TK_COMMENT",n(e,i,a-1)) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1056 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1057 | break |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1058 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1059 | else |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1060 | local e=u(t) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1061 | if e>=0 then |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1062 | o("TK_LSTRING",f(true,e)) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1063 | elseif e==-1 then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1064 | o("TK_OP","[") |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1065 | else |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1066 | r("invalid long string delimiter") |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1067 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1068 | break |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1069 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1070 | elseif l<=5 then |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1071 | if l<5 then |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1072 | a=t+1 |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1073 | o("TK_STRING",b(h)) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1074 | break |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1075 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1076 | h=d(e,"^%.%.?%.?",t) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1077 | else |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1078 | h=d(e,"^%p=?",t) |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1079 | end |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1080 | end |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1081 | a=t+#h |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1082 | o("TK_OP",h) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1083 | break |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1084 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1085 | local e=n(e,t,t) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1086 | if e~=""then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1087 | a=t+1 |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1088 | o("TK_OP",e) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1089 | break |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1090 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1091 | o("TK_EOS","") |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1092 | return |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1093 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1094 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1095 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1096 | return{ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1097 | llex=llex, |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1098 | init=init, |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1099 | chunkid=chunkid, |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1100 | tok=m, |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1101 | tokln=p, |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1102 | seminfo=w |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1103 | } |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1104 | end) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1105 | package.preload['lparser']=(function(...) |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1106 | local _ENV=_ENV; |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1107 | local function e(t,...) |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1108 | local e=package.loaded[t]or _ENV[t]or{_NAME=t}; |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1109 | package.loaded[t]=e; |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1110 | for t=1,select("#",...)do |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1111 | (select(t,...))(e); |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1112 | end |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1113 | _ENV=e; |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1114 | _M=e; |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1115 | return e; |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1116 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1117 | local U=_G |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1118 | local b=require"string" |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1119 | local D={} |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1120 | local T, |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1121 | j, |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1122 | A, |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1123 | C, |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1124 | d, |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1125 | r, |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1126 | P, |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1127 | t,k,l,y, |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1128 | p, |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1129 | a, |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1130 | W, |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1131 | q, |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1132 | N, |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1133 | u, |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1134 | g, |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1135 | E |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1136 | local f,n,w,_,x,v |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1137 | local e=b.gmatch |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1138 | local H={} |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1139 | for e in e("else elseif end until <eof>","%S+")do |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1140 | H[e]=true |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1141 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1142 | local Y={} |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1143 | for e in e("if while do for repeat function local return break","%S+")do |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1144 | Y[e]=e.."_stat" |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1145 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1146 | local S={} |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1147 | local V={} |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1148 | for e,a,t in e([[ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1149 | {+ 6 6}{- 6 6}{* 7 7}{/ 7 7}{% 7 7} |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1150 | {^ 10 9}{.. 5 4} |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1151 | {~= 3 3}{== 3 3} |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1152 | {< 3 3}{<= 3 3}{> 3 3}{>= 3 3} |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1153 | {and 2 2}{or 1 1} |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1154 | ]],"{(%S+)%s(%d+)%s(%d+)}")do |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1155 | S[e]=a+0 |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1156 | V[e]=t+0 |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1157 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1158 | local Z={["not"]=true,["-"]=true, |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1159 | ["#"]=true,} |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1160 | local ee=8 |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1161 | local function o(t,a) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1162 | local e=error or U.error |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1163 | e(b.format("(source):%d: %s",a or l,t)) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1164 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1165 | local function e() |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1166 | P=A[d] |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1167 | t,k,l,y |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1168 | =T[d],j[d],A[d],C[d] |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1169 | d=d+1 |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1170 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1171 | local function X() |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1172 | return T[d] |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1173 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1174 | local function s(a) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1175 | local e=t |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1176 | if e~="<number>"and e~="<string>"then |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1177 | if e=="<name>"then e=k end |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1178 | e="'"..e.."'" |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1179 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1180 | o(a.." near "..e) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1181 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1182 | local function c(e) |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1183 | s("'"..e.."' expected") |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1184 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1185 | local function o(a) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1186 | if t==a then e();return true end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1187 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1188 | local function L(e) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1189 | if t~=e then c(e)end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1190 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1191 | local function i(t) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1192 | L(t);e() |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1193 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1194 | local function F(e,t) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1195 | if not e then s(t)end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1196 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1197 | local function h(e,a,t) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1198 | if not o(e)then |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1199 | if t==l then |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1200 | c(e) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1201 | else |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1202 | s("'"..e.."' expected (to close '"..a.."' at line "..t..")") |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1203 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1204 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1205 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1206 | local function c() |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1207 | L("<name>") |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1208 | local t=k |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1209 | p=y |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1210 | e() |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1211 | return t |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1212 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1213 | local function I(e,t) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1214 | e.k="VK" |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1215 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1216 | local function R(e) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1217 | I(e,c()) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1218 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1219 | local function m(o,i) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1220 | local e=a.bl |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1221 | local t |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1222 | if e then |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1223 | t=e.locallist |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1224 | else |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1225 | t=a.locallist |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1226 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1227 | local e=#u+1 |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1228 | u[e]={ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1229 | name=o, |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1230 | xref={p}, |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1231 | decl=p, |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1232 | } |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1233 | if i or o=="_ENV"then |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1234 | u[e].preserve=true |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1235 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1236 | local a=#g+1 |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1237 | g[a]=e |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1238 | E[a]=t |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1239 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1240 | local function z(e) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1241 | local t=#g |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1242 | while e>0 do |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1243 | e=e-1 |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1244 | local t=t-e |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1245 | local a=g[t] |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1246 | local e=u[a] |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1247 | local o=e.name |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1248 | e.act=y |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1249 | g[t]=nil |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1250 | local i=E[t] |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1251 | E[t]=nil |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1252 | local t=i[o] |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1253 | if t then |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1254 | e=u[t] |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1255 | e.rem=-a |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1256 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1257 | i[o]=a |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1258 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1259 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1260 | local function O() |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1261 | local t=a.bl |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1262 | local e |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1263 | if t then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1264 | e=t.locallist |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1265 | else |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1266 | e=a.locallist |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1267 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1268 | for t,e in U.pairs(e)do |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1269 | local e=u[e] |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1270 | e.rem=y |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1271 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1272 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1273 | local function y(e,t) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1274 | if b.sub(e,1,1)=="("then |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1275 | return |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1276 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1277 | m(e,t) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1278 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1279 | local function U(o,a) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1280 | local t=o.bl |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1281 | local e |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1282 | if t then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1283 | e=t.locallist |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1284 | while e do |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1285 | if e[a]then return e[a]end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1286 | t=t.prev |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1287 | e=t and t.locallist |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1288 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1289 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1290 | e=o.locallist |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1291 | return e[a]or-1 |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1292 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1293 | local function b(t,o,e) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1294 | if t==nil then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1295 | e.k="VGLOBAL" |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1296 | return"VGLOBAL" |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1297 | else |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1298 | local a=U(t,o) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1299 | if a>=0 then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1300 | e.k="VLOCAL" |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1301 | e.id=a |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1302 | return"VLOCAL" |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1303 | else |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1304 | if b(t.prev,o,e)=="VGLOBAL"then |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1305 | return"VGLOBAL" |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1306 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1307 | e.k="VUPVAL" |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1308 | return"VUPVAL" |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1309 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1310 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1311 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1312 | local function Q(o) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1313 | local t=c() |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1314 | b(a,t,o) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1315 | if o.k=="VGLOBAL"then |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1316 | local e=N[t] |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1317 | if not e then |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1318 | e=#q+1 |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1319 | q[e]={ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1320 | name=t, |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1321 | xref={p}, |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1322 | } |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1323 | N[t]=e |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1324 | else |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1325 | local e=q[e].xref |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1326 | e[#e+1]=p |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1327 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1328 | else |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1329 | local e=o.id |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1330 | local e=u[e].xref |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1331 | e[#e+1]=p |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1332 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1333 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1334 | local function p(t) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1335 | local e={} |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1336 | e.isbreakable=t |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1337 | e.prev=a.bl |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1338 | e.locallist={} |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1339 | a.bl=e |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1340 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1341 | local function b() |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1342 | local e=a.bl |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1343 | O() |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1344 | a.bl=e.prev |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1345 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1346 | local function B() |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1347 | local e |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1348 | if not a then |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1349 | e=W |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1350 | else |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1351 | e={} |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1352 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1353 | e.prev=a |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1354 | e.bl=nil |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1355 | e.locallist={} |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1356 | a=e |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1357 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1358 | local function G() |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1359 | O() |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1360 | a=a.prev |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1361 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1362 | local function U(t) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1363 | local a={} |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1364 | e() |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1365 | R(a) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1366 | t.k="VINDEXED" |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1367 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1368 | local function K(t) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1369 | e() |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1370 | n(t) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1371 | i("]") |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1372 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1373 | local function M(e) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1374 | local e,a={},{} |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1375 | if t=="<name>"then |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1376 | R(e) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1377 | else |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1378 | K(e) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1379 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1380 | i("=") |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1381 | n(a) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1382 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1383 | local function O(e) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1384 | if e.v.k=="VVOID"then return end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1385 | e.v.k="VVOID" |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1386 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1387 | local function O(e) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1388 | n(e.v) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1389 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1390 | local function J(a) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1391 | local n=l |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1392 | local e={} |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1393 | e.v={} |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1394 | e.t=a |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1395 | a.k="VRELOCABLE" |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1396 | e.v.k="VVOID" |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1397 | i("{") |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1398 | repeat |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1399 | if t=="}"then break end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1400 | local t=t |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1401 | if t=="<name>"then |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1402 | if X()~="="then |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1403 | O(e) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1404 | else |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1405 | M(e) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1406 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1407 | elseif t=="["then |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1408 | M(e) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1409 | else |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1410 | O(e) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1411 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1412 | until not o(",")and not o(";") |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1413 | h("}","{",n) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1414 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1415 | local function X() |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1416 | local i=0 |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1417 | if t~=")"then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1418 | repeat |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1419 | local t=t |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1420 | if t=="<name>"then |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1421 | m(c()) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1422 | i=i+1 |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1423 | elseif t=="..."then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1424 | e() |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1425 | a.is_vararg=true |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1426 | else |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1427 | s("<name> or '...' expected") |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1428 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1429 | until a.is_vararg or not o(",") |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1430 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1431 | z(i) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1432 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1433 | local function M(n) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1434 | local a={} |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1435 | local i=l |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1436 | local o=t |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1437 | if o=="("then |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1438 | if i~=P then |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1439 | s("ambiguous syntax (function call x new statement)") |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1440 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1441 | e() |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1442 | if t==")"then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1443 | a.k="VVOID" |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1444 | else |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1445 | f(a) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1446 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1447 | h(")","(",i) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1448 | elseif o=="{"then |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1449 | J(a) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1450 | elseif o=="<string>"then |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1451 | I(a,k) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1452 | e() |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1453 | else |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1454 | s("function arguments expected") |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1455 | return |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1456 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1457 | n.k="VCALL" |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1458 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1459 | local function P(a) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1460 | local t=t |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1461 | if t=="("then |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1462 | local t=l |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1463 | e() |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1464 | n(a) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1465 | h(")","(",t) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1466 | elseif t=="<name>"then |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1467 | Q(a) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1468 | else |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1469 | s("unexpected symbol") |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1470 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1471 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1472 | local function O(a) |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1473 | P(a) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1474 | while true do |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1475 | local t=t |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1476 | if t=="."then |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1477 | U(a) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1478 | elseif t=="["then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1479 | local e={} |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1480 | K(e) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1481 | elseif t==":"then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1482 | local t={} |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1483 | e() |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1484 | R(t) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1485 | M(a) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1486 | elseif t=="("or t=="<string>"or t=="{"then |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1487 | M(a) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1488 | else |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1489 | return |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1490 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1491 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1492 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1493 | local function R(o) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1494 | local t=t |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1495 | if t=="<number>"then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1496 | o.k="VKNUM" |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1497 | elseif t=="<string>"then |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1498 | I(o,k) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1499 | elseif t=="nil"then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1500 | o.k="VNIL" |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1501 | elseif t=="true"then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1502 | o.k="VTRUE" |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1503 | elseif t=="false"then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1504 | o.k="VFALSE" |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1505 | elseif t=="..."then |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1506 | F(a.is_vararg==true, |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1507 | "cannot use '...' outside a vararg function"); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1508 | o.k="VVARARG" |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1509 | elseif t=="{"then |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1510 | J(o) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1511 | return |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1512 | elseif t=="function"then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1513 | e() |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1514 | x(o,false,l) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1515 | return |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1516 | else |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1517 | O(o) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1518 | return |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1519 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1520 | e() |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1521 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1522 | local function k(o,n) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1523 | local a=t |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1524 | local i=Z[a] |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1525 | if i then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1526 | e() |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1527 | k(o,ee) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1528 | else |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1529 | R(o) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1530 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1531 | a=t |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1532 | local t=S[a] |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1533 | while t and t>n do |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1534 | local o={} |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1535 | e() |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1536 | local e=k(o,V[a]) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1537 | a=e |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1538 | t=S[a] |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1539 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1540 | return a |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1541 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1542 | function n(e) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1543 | k(e,0) |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1544 | end |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1545 | local function I(e) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1546 | local t={} |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1547 | local e=e.v.k |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1548 | F(e=="VLOCAL"or e=="VUPVAL"or e=="VGLOBAL" |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1549 | or e=="VINDEXED","syntax error") |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1550 | if o(",")then |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1551 | local e={} |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1552 | e.v={} |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1553 | O(e.v) |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1554 | I(e) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1555 | else |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1556 | i("=") |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1557 | f(t) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1558 | return |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1559 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1560 | t.k="VNONRELOC" |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1561 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1562 | local function k(e,t) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1563 | i("do") |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1564 | p(false) |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1565 | z(e) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1566 | w() |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1567 | b() |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1568 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1569 | local function R(e) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1570 | local t=r |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1571 | y("(for index)") |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1572 | y("(for limit)") |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1573 | y("(for step)") |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1574 | m(e) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1575 | i("=") |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1576 | _() |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1577 | i(",") |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1578 | _() |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1579 | if o(",")then |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1580 | _() |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1581 | else |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1582 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1583 | k(1,true) |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1584 | end |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1585 | local function M(e) |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1586 | local t={} |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1587 | y("(for generator)") |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1588 | y("(for state)") |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1589 | y("(for control)") |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1590 | m(e) |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1591 | local e=1 |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1592 | while o(",")do |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1593 | m(c()) |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1594 | e=e+1 |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1595 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1596 | i("in") |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1597 | local a=r |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1598 | f(t) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1599 | k(e,false) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1600 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1601 | local function F(e) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1602 | local a=false |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1603 | Q(e) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1604 | while t=="."do |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1605 | U(e) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1606 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1607 | if t==":"then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1608 | a=true |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1609 | U(e) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1610 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1611 | return a |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1612 | end |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1613 | function _() |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1614 | local e={} |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1615 | n(e) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1616 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1617 | local function k() |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1618 | local e={} |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1619 | n(e) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1620 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1621 | local function S() |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1622 | e() |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1623 | k() |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1624 | i("then") |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1625 | w() |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1626 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1627 | local function P() |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1628 | local t,e={} |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1629 | m(c()) |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1630 | t.k="VLOCAL" |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1631 | z(1) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1632 | x(e,false,l) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1633 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1634 | local function U() |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1635 | local e=0 |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1636 | local t={} |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1637 | repeat |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1638 | m(c()) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1639 | e=e+1 |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1640 | until not o(",") |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1641 | if o("=")then |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1642 | f(t) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1643 | else |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1644 | t.k="VVOID" |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1645 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1646 | z(e) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1647 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1648 | function f(e) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1649 | n(e) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1650 | while o(",")do |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1651 | n(e) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1652 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1653 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1654 | function x(a,t,e) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1655 | B() |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1656 | i("(") |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1657 | if t then |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1658 | y("self",true) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1659 | z(1) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1660 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1661 | X() |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1662 | i(")") |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1663 | v() |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1664 | h("end","function",e) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1665 | G() |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1666 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1667 | function w() |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1668 | p(false) |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1669 | v() |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1670 | b() |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1671 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1672 | function for_stat() |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1673 | local o=r |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1674 | p(true) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1675 | e() |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1676 | local a=c() |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1677 | local e=t |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1678 | if e=="="then |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1679 | R(a) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1680 | elseif e==","or e=="in"then |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1681 | M(a) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1682 | else |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1683 | s("'=' or 'in' expected") |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1684 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1685 | h("end","for",o) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1686 | b() |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1687 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1688 | function while_stat() |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1689 | local t=r |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1690 | e() |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1691 | k() |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1692 | p(true) |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1693 | i("do") |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1694 | w() |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1695 | h("end","while",t) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1696 | b() |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1697 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1698 | function repeat_stat() |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1699 | local t=r |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1700 | p(true) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1701 | p(false) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1702 | e() |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1703 | v() |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1704 | h("until","repeat",t) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1705 | k() |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1706 | b() |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1707 | b() |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1708 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1709 | function if_stat() |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1710 | local a=r |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1711 | local o={} |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1712 | S() |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1713 | while t=="elseif"do |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1714 | S() |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1715 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1716 | if t=="else"then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1717 | e() |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1718 | w() |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1719 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1720 | h("end","if",a) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1721 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1722 | function return_stat() |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1723 | local a={} |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1724 | e() |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1725 | local e=t |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1726 | if H[e]or e==";"then |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1727 | else |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1728 | f(a) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1729 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1730 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1731 | function break_stat() |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1732 | local t=a.bl |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1733 | e() |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1734 | while t and not t.isbreakable do |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1735 | t=t.prev |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1736 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1737 | if not t then |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1738 | s("no loop to break") |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1739 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1740 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1741 | function expr_stat() |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1742 | local e={} |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1743 | e.v={} |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1744 | O(e.v) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1745 | if e.v.k=="VCALL"then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1746 | else |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1747 | e.prev=nil |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1748 | I(e) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1749 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1750 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1751 | function function_stat() |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1752 | local a=r |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1753 | local o,t={},{} |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1754 | e() |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1755 | local e=F(o) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1756 | x(t,e,a) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1757 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1758 | function do_stat() |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1759 | local t=r |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1760 | e() |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1761 | w() |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1762 | h("end","do",t) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1763 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1764 | function local_stat() |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1765 | e() |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1766 | if o("function")then |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1767 | P() |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1768 | else |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1769 | U() |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1770 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1771 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1772 | local function i() |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1773 | r=l |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1774 | local e=t |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1775 | local t=Y[e] |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1776 | if t then |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1777 | D[t]() |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1778 | if e=="return"or e=="break"then return true end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1779 | else |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1780 | expr_stat() |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1781 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1782 | return false |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1783 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1784 | function v() |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1785 | local e=false |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1786 | while not e and not H[t]do |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1787 | e=i() |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1788 | o(";") |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1789 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1790 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1791 | function parser() |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1792 | B() |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1793 | a.is_vararg=true |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1794 | e() |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1795 | v() |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1796 | L("<eof>") |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1797 | G() |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1798 | return q,u |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1799 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1800 | function init(e,o,n) |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1801 | d=1 |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1802 | W={} |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1803 | local t=1 |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1804 | T,j,A,C={},{},{},{} |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1805 | for a=1,#e do |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1806 | local e=e[a] |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1807 | local i=true |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1808 | if e=="TK_KEYWORD"or e=="TK_OP"then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1809 | e=o[a] |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1810 | elseif e=="TK_NAME"then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1811 | e="<name>" |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1812 | j[t]=o[a] |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1813 | elseif e=="TK_NUMBER"then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1814 | e="<number>" |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1815 | j[t]=0 |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1816 | elseif e=="TK_STRING"or e=="TK_LSTRING"then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1817 | e="<string>" |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1818 | j[t]="" |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1819 | elseif e=="TK_EOS"then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1820 | e="<eof>" |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1821 | else |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1822 | i=false |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1823 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1824 | if i then |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1825 | T[t]=e |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1826 | A[t]=n[a] |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1827 | C[t]=a |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1828 | t=t+1 |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1829 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1830 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1831 | q,N,u={},{},{} |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1832 | g,E={},{} |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1833 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1834 | D={ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1835 | expr=n, |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1836 | exp1=_, |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1837 | explist1=f, |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1838 | body=x, |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1839 | block=w, |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1840 | for_stat=for_stat, |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1841 | while_stat=while_stat, |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1842 | repeat_stat=repeat_stat, |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1843 | if_stat=if_stat, |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1844 | return_stat=return_stat, |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1845 | break_stat=break_stat, |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1846 | expr_stat=expr_stat, |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1847 | function_stat=function_stat, |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1848 | do_stat=do_stat, |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1849 | local_stat=local_stat, |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1850 | chunk=v, |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1851 | parser=parser, |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1852 | init=init |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1853 | } |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1854 | return D |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1855 | end) |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1856 | package.preload['minichunkspy']=(function(...) |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1857 | local _ENV=_ENV; |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1858 | local function e(t,...) |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1859 | local e=package.loaded[t]or _ENV[t]or{_NAME=t}; |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1860 | package.loaded[t]=e; |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1861 | for t=1,select("#",...)do |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1862 | (select(t,...))(e); |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1863 | end |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1864 | _ENV=e; |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1865 | _M=e; |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1866 | return e; |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1867 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1868 | local m,t,u=string,table,math |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1869 | local a,v,n,e=ipairs,setmetatable,type,assert |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1870 | local a=__END_OF_GLOBALS__ |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1871 | local c,l,i=m.char,m.byte,m.sub |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1872 | local w,d,g=u.frexp,u.ldexp,u.abs |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1873 | local p=t.concat |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1874 | local a=u.huge |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1875 | local k=a-a |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1876 | local o=false |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1877 | local r=4 |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1878 | local s=4 |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1879 | local h=8 |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1880 | local t={} |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1881 | local function y() |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1882 | t[#t+1] |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1883 | ={o,r,s,h} |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1884 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1885 | local function b() |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1886 | o,r,s,h |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1887 | =unpack(t[#t]) |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1888 | t[#t]=nil |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1889 | end |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1890 | local function t(e,t) |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1891 | return e.new(e,t) |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1892 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1893 | local f={} |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1894 | local t=t{ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1895 | new= |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1896 | function(e,a) |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1897 | local a=a or{} |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1898 | local t=f[e]or{ |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1899 | __index=e, |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1900 | __call=t |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1901 | } |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1902 | f[e]=t |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1903 | return v(a,t) |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1904 | end, |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1905 | } |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1906 | local j=t{ |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1907 | unpack=function(t,t,e)return nil,e end, |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1908 | pack=function(e,e)return""end |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1909 | } |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1910 | local f={} |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1911 | local function v(e) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1912 | local t=f[e]or t{ |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1913 | unpack=function(o,a,t) |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1914 | return i(a,t,t+e-1),t+e |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1915 | end, |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1916 | pack=function(a,t)return i(t,1,e)end |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1917 | } |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1918 | f[e]=t |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1919 | return t |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1920 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1921 | local q=t{ |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1922 | unpack=function(a,t,e) |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1923 | return l(t,e,e),e+1 |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1924 | end, |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1925 | pack=function(t,e)return c(e)end |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1926 | } |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1927 | local i=t{ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1928 | unpack= |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1929 | function(t,e,n) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1930 | local i,e,t,a=l(e,n,n+3) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1931 | if o then i,e,t,a=a,t,e,i end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1932 | return i+e*256+t*256^2+a*256^3,n+4 |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1933 | end, |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1934 | pack= |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1935 | function(t,s) |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1936 | e(n(s)=="number", |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1937 | "unexpected value type to pack as an uint32") |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1938 | local i,a,t,e |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1939 | e=s%2^32 |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1940 | i=e%256;e=(e-i)/256 |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1941 | a=e%256;e=(e-a)/256 |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1942 | t=e%256;e=(e-t)/256 |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1943 | if o then i,a,t,e=e,t,a,i end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1944 | return c(i,a,t,e) |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1945 | end |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1946 | } |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1947 | local x=t{ |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1948 | unpack= |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1949 | function(a,e,t) |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1950 | local a=i:unpack(e,t) |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1951 | local e=i:unpack(e,t+4) |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1952 | if o then a,e=e,a end |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1953 | return a+e*2^32,t+8 |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1954 | end, |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1955 | pack= |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1956 | function(a,t) |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1957 | e(n(t)=="number", |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1958 | "unexpected value type to pack as an uint64") |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1959 | local e=t%2^32 |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1960 | local t=(t-e)/2^32 |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1961 | if o then e,t=t,e end |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1962 | return i:pack(e)..i:pack(t) |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1963 | end |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1964 | } |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1965 | local function E(e,a) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1966 | local t=i:unpack(e,a) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1967 | local e=i:unpack(e,a+4) |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1968 | if o then t,e=e,t end |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1969 | local a=e%2^20 |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1970 | local t=t |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1971 | local o=t+a*2^32 |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1972 | e=(e-a)/2^20 |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1973 | local t=e%2^11 |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1974 | local e=e<=t and 1 or-1 |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1975 | return e,t,o |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1976 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1977 | local function c(n,a,t) |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1978 | local e=t%2^32 |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1979 | local t=(t-e)/2^32 |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1980 | local e=e |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1981 | local t=((n<0 and 2^11 or 0)+a)*2^20+t |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1982 | if o then e,t=t,e end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1983 | return i.pack(nil,e)..i.pack(nil,t) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1984 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1985 | local function _(e) |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1986 | if e~=e then return e end |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1987 | if e==0 then e=1/e end |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1988 | return e>0 and 1 or-1 |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1989 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1990 | local l=d(1,-1022-52) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1991 | local f=l*2^52 |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1992 | local z=d(2^52-1,-1022-52) |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1993 | local f=d(2^53-1,1023-52) |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1994 | e(l~=0 and l/2==0) |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1995 | e(f~=a) |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1996 | e(f*2==a) |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
1997 | local d=t{ |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1998 | unpack= |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
1999 | function(t,e,i) |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2000 | local n,o,t=E(e,i) |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2001 | local e |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2002 | if o==0 then |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2003 | e=d(t,-1022-52) |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2004 | elseif o==2047 then |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2005 | e=t==0 and a or k |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2006 | else |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2007 | e=d(2^52+t,o-1023-52) |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2008 | end |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2009 | e=n*e |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2010 | return e,i+8 |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2011 | end, |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2012 | pack= |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2013 | function(t,e) |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2014 | if e~=e then |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2015 | return c(1,2047,2^52-1) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2016 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2017 | local o=_(e) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2018 | e=g(e) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2019 | if e==a then return c(o,2047,0)end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2020 | if e==0 then return c(o,0,0)end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2021 | local t,a |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2022 | if e<=z then |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2023 | t=0 |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2024 | a=e/l |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2025 | else |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2026 | local o,e=w(e) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2027 | a=(2*o-1)*2^52 |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2028 | t=e+1022 |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2029 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2030 | return c(o,t,a) |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2031 | end |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2032 | } |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2033 | local a=q |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2034 | local l={ |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2035 | [4]=i, |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2036 | [8]=x |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2037 | } |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2038 | local w={ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2039 | [4]=float, |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2040 | [8]=d |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2041 | } |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2042 | local c=t{ |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2043 | unpack=function(a,t,e) |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2044 | return l[r]:unpack(t,e) |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2045 | end, |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2046 | pack=function(t,e) |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2047 | return l[r]:pack(e) |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2048 | end, |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2049 | } |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2050 | local i=t{ |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2051 | unpack=function(a,e,t) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2052 | return l[s]:unpack(e,t) |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2053 | end, |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2054 | pack=function(t,e) |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2055 | return l[s]:pack(e) |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2056 | end, |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2057 | } |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2058 | local g=t{ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2059 | unpack=function(a,t,e) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2060 | return w[h]:unpack(t,e) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2061 | end, |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2062 | pack=function(t,e) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2063 | return w[h]:pack(e) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2064 | end, |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2065 | } |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2066 | local k=v(4) |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2067 | local f=t{ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2068 | unpack= |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2069 | function(t,s,o) |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2070 | local i={} |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2071 | local e,a=1,1 |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2072 | while t[e]do |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2073 | local n=t[e] |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2074 | local t=n.name |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2075 | if not t then t,a=a,a+1 end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2076 | i[t],o=n:unpack(s,o) |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2077 | e=e+1 |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2078 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2079 | return i,o |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2080 | end, |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2081 | pack= |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2082 | function(a,n) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2083 | local i={} |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2084 | local e,t=1,1 |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2085 | while a[e]do |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2086 | local o=a[e] |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2087 | local a=o.name |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2088 | if not a then a,t=t,t+1 end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2089 | i[e]=o:pack(n[a]) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2090 | e=e+1 |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2091 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2092 | return p(i) |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2093 | end |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2094 | } |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2095 | local d=t{ |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2096 | unpack= |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2097 | function(n,t,e) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2098 | local o,e=i:unpack(t,e) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2099 | local a={} |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2100 | local i=n.type |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2101 | for o=1,o do |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2102 | a[o],e=i:unpack(t,e) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2103 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2104 | return a,e |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2105 | end, |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2106 | pack= |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2107 | function(o,a) |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2108 | local t=#a |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2109 | local e={i:pack(t)} |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2110 | local o=o.type |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2111 | for t=1,t do |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2112 | e[#e+1]=o:pack(a[t]) |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2113 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2114 | return p(e) |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2115 | end |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2116 | } |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2117 | local q=t{ |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2118 | unpack= |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2119 | function(o,a,t) |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2120 | local t,a=i:unpack(a,t) |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2121 | e(t==0 or t==1, |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2122 | "unpacked an unexpected value "..t.." for a Boolean") |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2123 | return t==1,a |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2124 | end, |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2125 | pack= |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2126 | function(a,t) |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2127 | e(n(t)=="boolean", |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2128 | "unexpected value type to pack as a Boolean") |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2129 | return i:pack(t and 1 or 0) |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2130 | end |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2131 | } |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2132 | local c=t{ |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2133 | unpack= |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2134 | function(t,a,e) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2135 | local t,e=c:unpack(a,e) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2136 | local o=nil |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2137 | if t>0 then |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2138 | local t=t-1 |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2139 | o=a:sub(e,e+t-1) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2140 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2141 | return o,e+t |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2142 | end, |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2143 | pack= |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2144 | function(a,t) |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2145 | e(n(t)=="nil"or n(t)=="string", |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2146 | "unexpected value type to pack as a String") |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2147 | if t==nil then |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2148 | return c:pack(0) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2149 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2150 | return c:pack(#t+1)..t.."\000" |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2151 | end |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2152 | } |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2153 | local p=f{ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2154 | v(4){name="signature"}, |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2155 | a{name="version"}, |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2156 | a{name="format"}, |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2157 | a{name="endianness"}, |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2158 | a{name="sizeof_int"}, |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2159 | a{name="sizeof_size_t"}, |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2160 | a{name="sizeof_insn"}, |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2161 | a{name="sizeof_Number"}, |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2162 | a{name="integral_flag"}, |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2163 | } |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2164 | local v={ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2165 | [0]=j, |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2166 | [1]=q, |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2167 | [3]=g, |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2168 | [4]=c, |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2169 | } |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2170 | local g=t{ |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2171 | unpack= |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2172 | function(i,o,t) |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2173 | local t,i=a:unpack(o,t) |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2174 | local a=v[t] |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2175 | e(a,"unknown constant type "..t.." to unpack") |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2176 | local a,o=a:unpack(o,i) |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2177 | if t==3 then |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2178 | e(n(a)=="number") |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2179 | end |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2180 | return{ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2181 | type=t, |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2182 | value=a |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2183 | },o |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2184 | end, |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2185 | pack= |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2186 | function(t,e) |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2187 | local e,t=e.type,e.value |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2188 | return a:pack(e)..v[e]:pack(t) |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2189 | end |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2190 | } |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2191 | local v=f{ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2192 | c{name="name"}, |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2193 | i{name="startpc"}, |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2194 | i{name="endpc"} |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2195 | } |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2196 | local a=f{ |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2197 | c{name="name"}, |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2198 | i{name="line"}, |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2199 | i{name="last_line"}, |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2200 | a{name="num_upvalues"}, |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2201 | a{name="num_parameters"}, |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2202 | a{name="is_vararg"}, |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2203 | a{name="max_stack_size"}, |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2204 | d{name="insns",type=k}, |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2205 | d{name="constants",type=g}, |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2206 | d{name="prototypes",type=nil}, |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2207 | d{name="source_lines",type=i}, |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2208 | d{name="locals",type=v}, |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2209 | d{name="upvalues",type=c}, |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2210 | } |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2211 | e(a[10].name=="prototypes", |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2212 | "missed the function prototype list") |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2213 | a[10].type=a |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2214 | local a=t{ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2215 | unpack= |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2216 | function(i,d,t) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2217 | local n={} |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2218 | local t,i=p:unpack(d,t) |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2219 | e(t.signature=="\027Lua","signature check failed") |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2220 | e(t.version==81,"version mismatch") |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2221 | e(t.format==0,"format mismatch") |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2222 | e(t.endianness==0 or |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2223 | t.endianness==1,"endianness mismatch") |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2224 | e(l[t.sizeof_int],"int size unsupported") |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2225 | e(l[t.sizeof_size_t],"size_t size unsupported") |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2226 | e(t.sizeof_insn==4,"insn size unsupported") |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2227 | e(w[t.sizeof_Number],"number size unsupported") |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2228 | e(t.integral_flag==0,"integral flag mismatch; only floats supported") |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2229 | y() |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2230 | o=t.endianness==0 |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2231 | r=t.sizeof_size_t |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2232 | s=t.sizeof_int |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2233 | h=t.sizeof_Number |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2234 | n.header=t |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2235 | n.body,i=a:unpack(d,i) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2236 | b() |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2237 | return n,i |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2238 | end, |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2239 | pack= |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2240 | function(e,t) |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2241 | local i |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2242 | y() |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2243 | local e=t.header |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2244 | o=e.endianness==0 |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2245 | r=e.sizeof_size_t |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2246 | s=e.sizeof_int |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2247 | h=e.sizeof_Number |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2248 | i=p:pack(t.header)..a:pack(t.body) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2249 | b() |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2250 | return i |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2251 | end |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2252 | } |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2253 | local function o(e) |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2254 | if n(e)=="function"then |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2255 | return o(m.dump(e)) |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2256 | end |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2257 | local t=a:unpack(e,1) |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2258 | local a=a:pack(t) |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2259 | if e==a then return true end |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2260 | local t |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2261 | local t=u.min(#e,#a) |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2262 | for t=1,t do |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2263 | local a=e:sub(t,t) |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2264 | local e=e:sub(t,t) |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2265 | if a~=e then |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2266 | return false,("chunk roundtripping failed: ".. |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2267 | "first byte difference at index %d"):format(t) |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2268 | end |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2269 | end |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2270 | return false,("chunk round tripping failed: ".. |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2271 | "original length %d vs. %d"):format(#e,#a) |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2272 | end |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2273 | return{ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2274 | disassemble=function(e)return a:unpack(e,1)end, |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2275 | assemble=function(e)return a:pack(e)end, |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2276 | validate=o |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2277 | } |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2278 | end) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2279 | do local e={}; |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2280 | e["vio"]="local vio = {};\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2281 | vio.__index = vio; \ |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2282 | \9\ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2283 | function vio.open(string)\ |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2284 | \9return setmetatable({ pos = 1, data = string }, vio);\ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2285 | end\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2286 | \ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2287 | function vio:read(format, ...)\ |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2288 | \9if self.pos >= #self.data then return; end\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2289 | \9if format == \"*a\" then\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2290 | \9\9local oldpos = self.pos;\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2291 | \9\9self.pos = #self.data;\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2292 | \9\9return self.data:sub(oldpos, self.pos);\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2293 | \9elseif format == \"*l\" then\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2294 | \9\9local data;\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2295 | \9\9data, self.pos = self.data:match(\"([^\\r\\n]*)\\r?\\n?()\", self.pos)\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2296 | \9\9return data;\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2297 | \9elseif format == \"*n\" then\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2298 | \9\9local data;\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2299 | \9\9data, self.pos = self.data:match(\"(%d+)()\", self.pos)\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2300 | \9\9return tonumber(data);\9\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2301 | \9elseif type(format) == \"number\" then\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2302 | \9\9local oldpos = self.pos;\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2303 | \9\9self.pos = self.pos + format;\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2304 | \9\9return self.data:sub(oldpos, self.pos-1);\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2305 | \9end\ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2306 | end\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2307 | \ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2308 | function vio:seek(whence, offset)\ |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2309 | \9if type(whence) == \"number\" then\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2310 | \9\9whence, offset = \"cur\", whence;\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2311 | \9end\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2312 | \9offset = offset or 0;\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2313 | \9\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2314 | \9if whence == \"cur\" then\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2315 | \9\9self.pos = self.pos + offset;\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2316 | \9elseif whence == \"set\" then\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2317 | \9\9self.pos = offset + 1;\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2318 | \9elseif whence == \"end\" then\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2319 | \9\9self.pos = #self.data - offset;\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2320 | \9end\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2321 | \9\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2322 | \9return self.pos;\ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2323 | end\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2324 | \ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2325 | local function _readline(f) return f:read(\"*l\"); end\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2326 | function vio:lines()\ |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2327 | \9return _readline, self;\ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2328 | end\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2329 | \ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2330 | function vio:write(...)\ |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2331 | \9for i=1,select('#', ...) do\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2332 | \9\9local dat = tostring(select(i, ...));\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2333 | \9\9self.data = self.data:sub(1, self.pos-1)..dat..self.data:sub(self.pos+#dat, -1);\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2334 | \9end\ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2335 | end\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2336 | \ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2337 | function vio:close()\ |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2338 | \9self.pos, self.data = nil, nil;\ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2339 | end\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2340 | \ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2341 | "e["gunzip.lua"]="local base_char,keywords=128,{\"and\",\"break\",\"do\",\"else\",\"elseif\",\"end\",\"false\",\"for\",\"function\",\"if\",\"in\",\"local\",\"nil\",\"not\",\"or\",\"repeat\",\"return\",\"then\",\"true\",\"until\",\"while\",\"read\",\"nbits\",\"nbits_left_in_byte\",\"wnd_pos\",\"output\",\"val\",\"input\",}; function prettify(code) return code:gsub(\"[\"..string.char(base_char)..\"-\"..string.char(base_char+#keywords)..\"]\", \ |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2342 | \9function (c) return keywords[c:byte()-base_char]; end) end return setfenv(assert(loadstring(prettify[===[Œ i,h,b,m,l,d,e,y,r,w,\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2343 | u,v,l,l=\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2344 | assert,error,ipairs,pairs,tostring,type,setmetatable,io,math,table.sort,\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2345 | math.max,string.char,io.open,_G;\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2346 | Œ ‰ p(n)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2347 | Œ l={};\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2348 | Œ e=e({},l)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2349 | ‰ l:__index(l)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2350 | Œ n=n(l);e[l]=n\ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2351 | ‘ n\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2352 | †\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2353 | ‘ e\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2354 | †\ |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2355 | Œ ‰ l(n,l)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2356 | l=l 1\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2357 | h({n},l+1)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2358 | †\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2359 | Œ ‰ _(n)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2360 | Œ l={}\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2361 | l.outbs=n\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2362 | l.wnd={}\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2363 | l.™=1\ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2364 | ‘ l\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2365 | †\ |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2366 | Œ ‰ t(l,e)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2367 | Œ n=l.™\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2368 | l.outbs(e)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2369 | l.wnd[n]=e\ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2370 | l.™=n%32768+1\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2371 | †\ |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2372 | Œ ‰ n(l)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2373 | ‘ i(l,'unexpected end of file')\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2374 | †\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2375 | Œ ‰ o(n,l)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2376 | ‘ n%(l+l)>=l\ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2377 | †\ |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2378 | Œ a=p(‰(l)‘ 2^l †)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2379 | Œ c=e({},{__mode='k'})\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2380 | Œ ‰ g(o)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2381 | Œ l=1\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2382 | Œ e={}\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2383 | ‰ e:–()\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2384 | Œ n\ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2385 | Š l<=#o ’\ |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2386 | n=o:byte(l)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2387 | l=l+1\ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2388 | †\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2389 | ‘ n\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2390 | †\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2391 | ‘ e\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2392 | †\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2393 | Œ l\ |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2394 | Œ ‰ s(d)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2395 | Œ n,l,o=0,0,{};\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2396 | ‰ o:˜()\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2397 | ‘ l\ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2398 | †\ |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2399 | ‰ o:–(e)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2400 | e=e 1\ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2401 | • l<e ƒ\ |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2402 | Œ e=d:–()\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2403 | Š Ž e ’ ‘ †\ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2404 | n=n+a[l]*e\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2405 | l=l+8\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2406 | †\ |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2407 | Œ o=a[e]\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2408 | Œ a=n%o\ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2409 | n=(n-a)/o\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2410 | l=l-e\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2411 | ‘ a\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2412 | †\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2413 | c[o]=“\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2414 | ‘ o\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2415 | †\ |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2416 | Œ ‰ f(l)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2417 | ‘ c[l] l s(g(l))\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2418 | †\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2419 | Œ ‰ s(l)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2420 | Œ n\ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2421 | Š y.type(l)=='file'’\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2422 | n=‰(n)l:write(v(n))†\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2423 | … d(l)=='function'’\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2424 | n=l\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2425 | †\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2426 | ‘ n\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2427 | †\ |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2428 | Œ ‰ d(e,o)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2429 | Œ l={}\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2430 | Š o ’\ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2431 | ˆ e,n ‹ m(e)ƒ\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2432 | Š n~=0 ’\ |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2433 | l[#l+1]={›=e,—=n}\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2434 | †\ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2435 | †\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2436 | „\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2437 | ˆ n=1,#e-2,2 ƒ\ |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2438 | Œ o,n,e=e[n],e[n+1],e[n+2]\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2439 | Š n~=0 ’\ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2440 | ˆ e=o,e-1 ƒ\ |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2441 | l[#l+1]={›=e,—=n}\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2442 | †\ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2443 | †\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2444 | †\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2445 | †\ |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2446 | w(l,‰(n,l)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2447 | ‘ n.—==l.— n.›<l.› n.—<l.—\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2448 | †)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2449 | Œ e=1\ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2450 | Œ o=0\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2451 | ˆ n,l ‹ b(l)ƒ\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2452 | Š l.—~=o ’\ |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2453 | e=e*a[l.—-o]\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2454 | o=l.—\ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2455 | †\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2456 | l.code=e\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2457 | e=e+1\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2458 | †\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2459 | Œ e=r.huge\ |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2460 | Œ c={}\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2461 | ˆ n,l ‹ b(l)ƒ\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2462 | e=r.min(e,l.—)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2463 | c[l.code]=l.›\ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2464 | †\ |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2465 | Œ ‰ o(n,e)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2466 | Œ l=0\ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2467 | ˆ e=1,e ƒ\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2468 | Œ e=n%2\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2469 | n=(n-e)/2\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2470 | l=l*2+e\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2471 | †\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2472 | ‘ l\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2473 | †\ |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2474 | Œ d=p(\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2475 | ‰(l)‘ a[e]+o(l,e)†)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2476 | ‰ l:–(a)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2477 | Œ o,l=1,0\ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2478 | • 1 ƒ\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2479 | Š l==0 ’\ |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2480 | o=d[n(a:–(e))]\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2481 | l=l+e\ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2482 | „\ |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2483 | Œ n=n(a:–())\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2484 | l=l+1\ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2485 | o=o*2+n\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2486 | †\ |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2487 | Œ l=c[o]\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2488 | Š l ’\ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2489 | ‘ l\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2490 | †\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2491 | †\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2492 | †\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2493 | ‘ l\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2494 | †\ |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2495 | Œ ‰ b(l)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2496 | Œ a=2^1\ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2497 | Œ e=2^2\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2498 | Œ c=2^3\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2499 | Œ d=2^4\ |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2500 | Œ n=l:–(8)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2501 | Œ n=l:–(8)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2502 | Œ n=l:–(8)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2503 | Œ n=l:–(8)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2504 | Œ t=l:–(32)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2505 | Œ t=l:–(8)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2506 | Œ t=l:–(8)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2507 | Š o(n,e)’\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2508 | Œ n=l:–(16)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2509 | Œ e=0\ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2510 | ˆ n=1,n ƒ\ |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2511 | e=l:–(8)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2512 | †\ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2513 | †\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2514 | Š o(n,c)’\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2515 | • l:–(8)~=0 ƒ †\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2516 | †\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2517 | Š o(n,d)’\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2518 | • l:–(8)~=0 ƒ †\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2519 | †\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2520 | Š o(n,a)’\ |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2521 | l:–(16)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2522 | †\ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2523 | †\ |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2524 | Œ ‰ p(l)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2525 | Œ f=l:–(5)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2526 | Œ i=l:–(5)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2527 | Œ e=n(l:–(4))\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2528 | Œ a=e+4\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2529 | Œ e={}\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2530 | Œ o={\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2531 | 16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15}\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2532 | ˆ n=1,a ƒ\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2533 | Œ l=l:–(3)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2534 | Œ n=o[n]\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2535 | e[n]=l\ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2536 | †\ |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2537 | Œ e=d(e,“)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2538 | Œ ‰ r(o)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2539 | Œ t={}\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2540 | Œ a\ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2541 | Œ c=0\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2542 | • c<o ƒ\ |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2543 | Œ o=e:–(l)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2544 | Œ e\ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2545 | Š o<=15 ’\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2546 | e=1\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2547 | a=o\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2548 | … o==16 ’\ |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2549 | e=3+n(l:–(2))\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2550 | … o==17 ’\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2551 | e=3+n(l:–(3))\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2552 | a=0\ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2553 | … o==18 ’\ |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2554 | e=11+n(l:–(7))\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2555 | a=0\ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2556 | „\ |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2557 | h'ASSERT'\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2558 | †\ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2559 | ˆ l=1,e ƒ\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2560 | t[c]=a\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2561 | c=c+1\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2562 | †\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2563 | †\ |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2564 | Œ l=d(t,“)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2565 | ‘ l\ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2566 | †\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2567 | Œ n=f+257\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2568 | Œ l=i+1\ |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2569 | Œ n=r(n)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2570 | Œ l=r(l)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2571 | ‘ n,l\ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2572 | †\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2573 | Œ a\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2574 | Œ o\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2575 | Œ c\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2576 | Œ r\ |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2577 | Œ ‰ h(e,n,l,d)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2578 | Œ l=l:–(e)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2579 | Š l<256 ’\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2580 | t(n,l)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2581 | … l==256 ’\ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2582 | ‘ “\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2583 | „\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2584 | Š Ž a ’\ |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2585 | Œ l={[257]=3}\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2586 | Œ e=1\ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2587 | ˆ n=258,285,4 ƒ\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2588 | ˆ n=n,n+3 ƒ l[n]=l[n-1]+e †\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2589 | Š n~=258 ’ e=e*2 †\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2590 | †\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2591 | l[285]=258\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2592 | a=l\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2593 | †\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2594 | Š Ž o ’\ |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2595 | Œ l={}\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2596 | ˆ e=257,285 ƒ\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2597 | Œ n=u(e-261,0)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2598 | l[e]=(n-(n%4))/4\ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2599 | †\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2600 | l[285]=0\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2601 | o=l\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2602 | †\ |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2603 | Œ a=a[l]\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2604 | Œ l=o[l]\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2605 | Œ l=e:–(l)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2606 | Œ o=a+l\ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2607 | Š Ž c ’\ |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2608 | Œ e={[0]=1}\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2609 | Œ l=1\ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2610 | ˆ n=1,29,2 ƒ\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2611 | ˆ n=n,n+1 ƒ e[n]=e[n-1]+l †\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2612 | Š n~=1 ’ l=l*2 †\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2613 | †\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2614 | c=e\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2615 | †\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2616 | Š Ž r ’\ |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2617 | Œ n={}\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2618 | ˆ e=0,29 ƒ\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2619 | Œ l=u(e-2,0)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2620 | n[e]=(l-(l%2))/2\ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2621 | †\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2622 | r=n\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2623 | †\ |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2624 | Œ l=d:–(e)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2625 | Œ a=c[l]\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2626 | Œ l=r[l]\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2627 | Œ l=e:–(l)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2628 | Œ l=a+l\ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2629 | ˆ e=1,o ƒ\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2630 | Œ l=(n.™-1-l)%32768+1\ |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2631 | t(n,i(n.wnd[l],'invalid distance'))\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2632 | †\ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2633 | †\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2634 | ‘ ‡\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2635 | †\ |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2636 | Œ ‰ u(l,a)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2637 | Œ i=l:–(1)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2638 | Œ e=l:–(2)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2639 | Œ r=0\ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2640 | Œ o=1\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2641 | Œ c=2\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2642 | Œ f=3\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2643 | Š e==r ’\ |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2644 | l:–(l:˜())\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2645 | Œ e=l:–(16)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2646 | Œ o=n(l:–(16))\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2647 | ˆ e=1,e ƒ\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2648 | Œ l=n(l:–(8))\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2649 | t(a,l)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2650 | †\ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2651 | … e==o e==c ’\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2652 | Œ n,o\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2653 | Š e==c ’\ |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2654 | n,o=p(l)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2655 | „\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2656 | n=d{0,8,144,9,256,7,280,8,288,}\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2657 | o=d{0,5,32,}\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2658 | †\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2659 | ” h(\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2660 | l,a,n,o\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2661 | );\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2662 | †\ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2663 | ‘ i~=0\ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2664 | †\ |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2665 | Œ ‰ e(l)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2666 | Œ n,l=f(l.œ)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2667 | ,_(s(l.š))\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2668 | ” u(n,l)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2669 | †\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2670 | ‘ ‰(n)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2671 | Œ l=f(n.œ)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2672 | Œ n=s(n.š)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2673 | b(l)\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2674 | e{œ=l,š=n}\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2675 | l:–(l:˜())\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2676 | l:–()\ |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2677 | †\ |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2678 | ]===], '@gunzip.lua')), getfenv())()"e["squish.debug"]="package.preload['minichunkspy']=(function(...)local _ENV=_ENV;local function module(name,...)local t=package.loaded[name]or _ENV[name]or{_NAME=name};package.loaded[name]=t;for i=1,select(\"#\",...)do(select(i,...))(t);end\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2679 | _ENV=t;_M=t;return t;end\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2680 | local string,table,math=string,table,math\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2681 | local ipairs,setmetatable,type,assert=ipairs,setmetatable,type,assert\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2682 | local _=__END_OF_GLOBALS__\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2683 | local string_char,string_byte,string_sub=string.char,string.byte,string.sub\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2684 | local table_concat=table.concat\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2685 | local math_abs,math_ldexp,math_frexp=math.abs,math.ldexp,math.frexp\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2686 | local Inf=math.huge\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2687 | local Nan=Inf-Inf\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2688 | local BIG_ENDIAN=false\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2689 | local function construct(class,...)return class.new(class,...)end\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2690 | local mt_memo={}local Field=construct{new=function(class,self)local self=self or{}local mt=mt_memo[class]or{__index=class,__call=construct}mt_memo[class]=mt\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2691 | return setmetatable(self,mt)end,}local None=Field{unpack=function(self,bytes,ix)return nil,ix end,pack=function(self,val)return\"\"end}local char_memo={}local function char(n)local field=char_memo[n]or Field{unpack=function(self,bytes,ix)return string_sub(bytes,ix,ix+n-1),ix+n\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2692 | end,pack=function(self,val)return string_sub(val,1,n)end}char_memo[n]=field\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2693 | return field\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2694 | end\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2695 | local uint8=Field{unpack=function(self,bytes,ix)return string_byte(bytes,ix,ix),ix+1\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2696 | end,pack=function(self,val)return string_char(val)end}local uint32=Field{unpack=function(self,bytes,ix)local a,b,c,d=string_byte(bytes,ix,ix+3)if BIG_ENDIAN then a,b,c,d=d,c,b,a end\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2697 | return a+b*256+c*256^2+d*256^3,ix+4\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2698 | end,pack=function(self,val)assert(type(val)==\"number\",\"unexpected value type to pack as an uint32\")local a,b,c,d\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2699 | d=val%2^32\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2700 | a=d%256;d=(d-a)/256\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2701 | b=d%256;d=(d-b)/256\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2702 | c=d%256;d=(d-c)/256\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2703 | if BIG_ENDIAN then a,b,c,d=d,c,b,a end\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2704 | return string_char(a,b,c,d)end}local int32=uint32{unpack=function(self,bytes,ix)local val,ix=uint32:unpack(bytes,ix)return val<2^32 and val or(val-2^31),ix\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2705 | end}local Byte=uint8\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2706 | local Size_t=uint32\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2707 | local Integer=int32\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2708 | local Number=char(8)local Insn=char(4)local Struct=Field{unpack=function(self,bytes,ix)local val={}local i,j=1,1\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2709 | while self[i]do\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2710 | local field=self[i]local key=field.name\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2711 | if not key then key,j=j,j+1 end\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2712 | val[key],ix=field:unpack(bytes,ix)i=i+1\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2713 | end\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2714 | return val,ix\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2715 | end,pack=function(self,val)local data={}local i,j=1,1\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2716 | while self[i]do\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2717 | local field=self[i]local key=field.name\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2718 | if not key then key,j=j,j+1 end\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2719 | data[i]=field:pack(val[key])i=i+1\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2720 | end\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2721 | return table_concat(data)end}local List=Field{unpack=function(self,bytes,ix)local len,ix=Integer:unpack(bytes,ix)local vals={}local field=self.type\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2722 | for i=1,len do\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2723 | vals[i],ix=field:unpack(bytes,ix)end\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2724 | return vals,ix\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2725 | end,pack=function(self,vals)local len=#vals\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2726 | local data={Integer:pack(len)}local field=self.type\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2727 | for i=1,len do\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2728 | data[#data+1]=field:pack(vals[i])end\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2729 | return table_concat(data)end}local Boolean=Field{unpack=function(self,bytes,ix)local val,ix=Integer:unpack(bytes,ix)assert(val==0 or val==1,\"unpacked an unexpected value \"..val..\" for a Boolean\")return val==1,ix\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2730 | end,pack=function(self,val)assert(type(val)==\"boolean\",\"unexpected value type to pack as a Boolean\")return Integer:pack(val and 1 or 0)end}local String=Field{unpack=function(self,bytes,ix)local len,ix=Integer:unpack(bytes,ix)local val=nil\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2731 | if len>0 then\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2732 | local string_len=len-1\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2733 | val=bytes:sub(ix,ix+string_len-1)end\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2734 | return val,ix+len\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2735 | end,pack=function(self,val)assert(type(val)==\"nil\"or type(val)==\"string\",\"unexpected value type to pack as a String\")if val==nil then\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2736 | return Integer:pack(0)end\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2737 | return Integer:pack(#val+1)..val..\"\\0\"end}local ChunkHeader=Struct{char(4){name=\"signature\"},Byte{name=\"version\"},Byte{name=\"format\"},Byte{name=\"endianness\"},Byte{name=\"sizeof_int\"},Byte{name=\"sizeof_size_t\"},Byte{name=\"sizeof_insn\"},Byte{name=\"sizeof_Number\"},Byte{name=\"integral_flag\"},}local ConstantTypes={[0]=None,[1]=Boolean,[3]=Number,[4]=String,}local Constant=Field{unpack=function(self,bytes,ix)local t,ix=Byte:unpack(bytes,ix)local field=ConstantTypes[t]assert(field,\"unknown constant type \"..t..\" to unpack\")local v,ix=field:unpack(bytes,ix)return{type=t,value=v},ix\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2738 | end,pack=function(self,val)local t,v=val.type,val.value\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2739 | return Byte:pack(t)..ConstantTypes[t]:pack(v)end}local Local=Struct{String{name=\"name\"},Integer{name=\"startpc\"},Integer{name=\"endpc\"}}local Function=Struct{String{name=\"name\"},Integer{name=\"line\"},Integer{name=\"last_line\"},Byte{name=\"num_upvalues\"},Byte{name=\"num_parameters\"},Byte{name=\"is_vararg\"},Byte{name=\"max_stack_size\"},List{name=\"insns\",type=Insn},List{name=\"constants\",type=Constant},List{name=\"prototypes\",type=nil},List{name=\"source_lines\",type=Integer},List{name=\"locals\",type=Local},List{name=\"upvalues\",type=String},}assert(Function[10].name==\"prototypes\",\"missed the function prototype list\")Function[10].type=Function\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2740 | local Chunk=Struct{ChunkHeader{name=\"header\"},Function{name=\"body\"}}local function validate(chunk)if type(chunk)==\"function\"then\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2741 | return validate(string.dump(chunk))end\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2742 | local f=Chunk:unpack(chunk,1)local chunk2=Chunk:pack(f)if chunk==chunk2 then return true end\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2743 | local i\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2744 | local len=math.min(#chunk,#chunk2)for i=1,len do\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2745 | local a=chunk:sub(i,i)local b=chunk:sub(i,i)if a~=b then\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2746 | return false,(\"chunk roundtripping failed: \"..\"first byte difference at index %d\"):format(i)end\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2747 | end\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2748 | return false,(\"chunk round tripping failed: \"..\"original length %d vs. %d\"):format(#chunk,#chunk2)end\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2749 | return{disassemble=function(chunk)return Chunk:unpack(chunk,1)end,assemble=function(disassembled)return Chunk:pack(disassembled)end,validate=validate}end)local cs=require\"minichunkspy\"local function ___adjust_chunk(chunk,newname,lineshift)local c=cs.disassemble(string.dump(chunk));c.body.name=newname;lineshift=-c.body.line;local function shiftlines(c)c.line=c.line+lineshift;c.last_line=c.last_line+lineshift;for i,line in ipairs(c.source_lines)do\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2750 | c.source_lines[i]=line+lineshift;end\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2751 | for i,f in ipairs(c.prototypes)do\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2752 | shiftlines(f);end\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2753 | end\ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2754 | shiftlines(c.body);return assert(loadstring(cs.assemble(c),newname))();end\ |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2755 | "function require_resource(t)return e[t]or error("resource '"..tostring(t).."' not found");end end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2756 | pcall(require,"luarocks.require"); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2757 | local o={v="verbose",vv="very_verbose",o="output",q="quiet",qq="very_quiet",g="debug"} |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2758 | local e={use_http=false,module_compat=not not _ENV}; |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2759 | for t,a in ipairs(arg)do |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2760 | if a:match("^%-")then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2761 | local t=a:match("^%-%-?([^%s=]+)()") |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2762 | t=(o[t]or t):gsub("%-+","_"); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2763 | if t:match("^no_")then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2764 | t=t:sub(4,-1); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2765 | e[t]=false; |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2766 | else |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2767 | e[t]=a:match("=(.*)$")or true; |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2768 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2769 | else |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2770 | base_path=a; |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2771 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2772 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2773 | if e.very_verbose then e.verbose=true;end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2774 | if e.very_quiet then e.quiet=true;end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2775 | local t=function()end |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2776 | local t,o,s,h=t,t,t,t; |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2777 | if not e.very_quiet then t=print;end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2778 | if not e.quiet then o=print;end |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2779 | if e.verbose or e.very_verbose then s=print;end |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2780 | if e.very_verbose then h=print;end |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2781 | print=s; |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2782 | local i,d,n={},{},{}; |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2783 | function Module(e) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2784 | if i[e]then |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2785 | s("Ignoring duplicate module definition for "..e); |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2786 | return function()end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2787 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2788 | local t=#i+1; |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2789 | i[t]={name=e,url=___fetch_url}; |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2790 | i[e]=i[t]; |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2791 | return function(e) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2792 | i[t].path=e; |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2793 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2794 | end |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2795 | function Resource(t,a) |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2796 | local e=#n+1; |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2797 | n[e]={name=t,path=a or t}; |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2798 | return function(t) |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2799 | n[e].path=t; |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2800 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2801 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2802 | function AutoFetchURL(e) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2803 | ___fetch_url=e; |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2804 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2805 | function Main(e) |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2806 | table.insert(d,e); |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2807 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2808 | function Output(t) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2809 | if e.output==nil then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2810 | out_fn=t; |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2811 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2812 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2813 | function Option(t) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2814 | t=t:gsub("%-","_"); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2815 | if e[t]==nil then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2816 | e[t]=true; |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2817 | return function(a) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2818 | e[t]=a; |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2819 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2820 | else |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2821 | return function()end; |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2822 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2823 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2824 | function GetOption(t) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2825 | return e[t:gsub('%-','_')]; |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2826 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2827 | function Message(t) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2828 | if not e.quiet then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2829 | o(t); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2830 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2831 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2832 | function Error(a) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2833 | if not e.very_quiet then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2834 | t(a); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2835 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2836 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2837 | function Exit() |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2838 | os.exit(1); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2839 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2840 | base_path=(base_path or"."):gsub("/$","").."/" |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2841 | squishy_file=base_path.."squishy"; |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2842 | out_fn=e.output; |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2843 | local r,a=pcall(dofile,squishy_file); |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2844 | if not r then |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2845 | t("Couldn't read squishy file: "..a); |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2846 | os.exit(1); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2847 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2848 | if not out_fn then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2849 | t("No output file specified by user or squishy file"); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2850 | os.exit(1); |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2851 | elseif#d==0 and#i==0 and#n==0 then |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2852 | t("No files, modules or resources. Not going to generate an empty file."); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2853 | os.exit(1); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2854 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2855 | local r={}; |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2856 | function r.filesystem(e) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2857 | local e,t=io.open(e); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2858 | if not e then return false,t;end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2859 | local t=e:read("*a"); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2860 | e:close(); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2861 | return t; |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2862 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2863 | if e.use_http then |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2864 | function r.http(t) |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2865 | local e=require"socket.http"; |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2866 | local t,e=e.request(t); |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2867 | if e==200 then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2868 | return t; |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2869 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2870 | return false,"HTTP status code: "..tostring(e); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2871 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2872 | else |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2873 | function r.http(e) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2874 | return false,"Module not found. Re-squish with --use-http option to fetch it from "..e; |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2875 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2876 | end |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2877 | s("Resolving modules..."); |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2878 | do |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2879 | local e=package.config:sub(1,1); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2880 | local n=package.config:sub(5,5); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2881 | local o=package.path:gsub("[^;]+",function(t) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2882 | if not t:match("^%"..e)then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2883 | return base_path..t; |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2884 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2885 | end):gsub("/%./","/"); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2886 | local a=package.cpath:gsub("[^;]+",function(t) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2887 | if not t:match("^%"..e)then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2888 | return base_path..t; |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2889 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2890 | end):gsub("/%./","/"); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2891 | function resolve_module(t,a) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2892 | t=t:gsub("%.",e); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2893 | for e in a:gmatch("[^;]+")do |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2894 | e=e:gsub("%"..n,t); |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2895 | h("Looking for "..e) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2896 | local t=io.open(e); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2897 | if t then |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2898 | h("Found!"); |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2899 | t:close(); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2900 | return e; |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2901 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2902 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2903 | return nil; |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2904 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2905 | for a,e in ipairs(i)do |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2906 | if not e.path then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2907 | e.path=resolve_module(e.name,o); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2908 | if not e.path then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2909 | t("Couldn't resolve module: "..e.name); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2910 | else |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2911 | e.path=e.path:gsub("^"..base_path:gsub("%p","%%%1"),""); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2912 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2913 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2914 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2915 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2916 | for a,e in ipairs(i)do |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2917 | if not e.path then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2918 | t("Exiting due to missing modules without a path"); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2919 | os.exit(1); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2920 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2921 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2922 | if e.list_files or e.list_missing_files then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2923 | local function t(t) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2924 | if e.list_missing_files then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2925 | local e=io.open(t); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2926 | if e then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2927 | e:close(); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2928 | return; |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2929 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2930 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2931 | io.write(t,"\n"); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2932 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2933 | for a,e in pairs(d)do |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2934 | t(e); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2935 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2936 | for a,e in ipairs(i)do |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2937 | t(e.path); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2938 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2939 | for a,e in ipairs(n)do |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2940 | t(e.path); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2941 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2942 | return; |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2943 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2944 | o("Writing "..out_fn.."..."); |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2945 | local a,l=io.open(out_fn,"w+"); |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2946 | if not a then |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2947 | t("Couldn't open output file: "..tostring(l)); |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2948 | os.exit(1); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2949 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2950 | if e.executable then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2951 | if e.executable==true then |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2952 | a:write("#!/usr/bin/env lua\n"); |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2953 | else |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
2954 | a:write("#!"..e.executable,"\n"); |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2955 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2956 | end |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2957 | s("Packing modules..."); |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2958 | for o,i in ipairs(i)do |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2959 | local d,s=i.name,i.path; |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2960 | if i.path:sub(1,1)~="/"then |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2961 | s=base_path..i.path; |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2962 | end |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2963 | h("Packing "..d.." ("..s..")..."); |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2964 | local o,n=r.filesystem(s); |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2965 | if(not o)and i.url then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2966 | local e=i.url:gsub("%?",i.path); |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2967 | h("Fetching: "..e) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2968 | if e:match("^https?://")then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2969 | o,n=r.http(e); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2970 | elseif e:match("^file://")or e:match("^[/%.]")then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2971 | local e,t=io.open((e:gsub("^file://",""))); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2972 | if e then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2973 | o,n=e:read("*a"); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2974 | e:close(); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2975 | else |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2976 | o,n=nil,t; |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2977 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2978 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2979 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2980 | if o then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2981 | o=o:gsub("^#[^\r\n]*\r?\n",""); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2982 | if not e.debug then |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2983 | a:write("package.preload['",d,"'] = (function (...)\n"); |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2984 | if e.module_compat then |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2985 | a:write[[ |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2986 | local _ENV = _ENV; |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2987 | local function module(name, ...) |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2988 | local t = package.loaded[name] or _ENV[name] or { _NAME = name }; |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2989 | package.loaded[name] = t; |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2990 | for i = 1, select("#", ...) do |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2991 | (select(i, ...))(t); |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2992 | end |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2993 | _ENV = t; |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2994 | _M = t; |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2995 | return t; |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2996 | end |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2997 | ]]; |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
2998 | end |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2999 | a:write(o); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3000 | a:write(" end)\n"); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3001 | else |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3002 | a:write("package.preload['",d,"'] = assert(loadstring(\n"); |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3003 | a:write(("%q\n"):format(o)); |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3004 | a:write(", ",("%q"):format("@"..s),"))\n"); |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3005 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3006 | else |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3007 | t("Couldn't pack module '"..d.."': "..(n or"unknown error... path to module file correct?")); |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3008 | os.exit(1); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3009 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3010 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3011 | if#n>0 then |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3012 | s("Packing resources...") |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3013 | a:write("do local resources = {};\n"); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3014 | for o,e in ipairs(n)do |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3015 | local o,e=e.name,e.path; |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3016 | local e,i=io.open(base_path..e,"rb"); |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3017 | if not e then |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3018 | t("Couldn't load resource: "..tostring(i)); |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3019 | os.exit(1); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3020 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3021 | local t=e:read("*a"); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3022 | local e=0; |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3023 | t:gsub("(=+)",function(t)e=math.max(e,#t);end); |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3024 | a:write(("resources[%q] = %q"):format(o,t)); |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3025 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3026 | if e.virtual_io then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3027 | local e=require_resource("vio"); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3028 | if not e then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3029 | t("Virtual IO requested but is not enabled in this build of squish"); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3030 | else |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3031 | a:write(e,"\n") |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3032 | a:write[[local io_open, io_lines = io.open, io.lines; function io.open(fn, mode) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3033 | if not resources[fn] then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3034 | return io_open(fn, mode); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3035 | else |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3036 | return vio.open(resources[fn]); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3037 | end end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3038 | function io.lines(fn) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3039 | if not resources[fn] then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3040 | return io_lines(fn); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3041 | else |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3042 | return vio.open(resources[fn]):lines() |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3043 | end end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3044 | local _dofile = dofile; |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3045 | function dofile(fn) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3046 | if not resources[fn] then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3047 | return _dofile(fn); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3048 | else |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3049 | return assert(loadstring(resources[fn]))(); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3050 | end end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3051 | local _loadfile = loadfile; |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3052 | function loadfile(fn) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3053 | if not resources[fn] then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3054 | return _loadfile(fn); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3055 | else |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3056 | return loadstring(resources[fn], "@"..fn); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3057 | end end ]] |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3058 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3059 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3060 | a:write[[function require_resource(name) return resources[name] or error("resource '"..tostring(name).."' not found"); end end ]] |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3061 | end |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3062 | h("Finalising...") |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3063 | for e,o in pairs(d)do |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3064 | local e,i=io.open(base_path..o); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3065 | if not e then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3066 | t("Failed to open "..o..": "..i); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3067 | os.exit(1); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3068 | else |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3069 | a:write((e:read("*a"):gsub("^#.-\n",""))); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3070 | e:close(); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3071 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3072 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3073 | a:close(); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3074 | o("OK!"); |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3075 | local h=require"optlex" |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3076 | local r=require"optparser" |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3077 | local a=require"llex" |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3078 | local d=require"lparser" |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3079 | local i={ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3080 | none={}; |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3081 | debug={"whitespace","locals","entropy","comments","numbers"}; |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3082 | default={"comments","whitespace","emptylines","numbers","locals"}; |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3083 | basic={"comments","whitespace","emptylines"}; |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3084 | full={"comments","whitespace","emptylines","eols","strings","numbers","locals","entropy"}; |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3085 | } |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3086 | if e.minify_level and not i[e.minify_level]then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3087 | t("Unknown minify level: "..e.minify_level); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3088 | t("Available minify levels: none, basic, default, full, debug"); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3089 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3090 | for a,t in ipairs(i[e.minify_level or"default"]or{})do |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3091 | if e["minify_"..t]==nil then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3092 | e["minify_"..t]=true; |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3093 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3094 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3095 | local n={ |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3096 | ["opt-locals"]=e.minify_locals; |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3097 | ["opt-comments"]=e.minify_comments; |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3098 | ["opt-entropy"]=e.minify_entropy; |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3099 | ["opt-whitespace"]=e.minify_whitespace; |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3100 | ["opt-emptylines"]=e.minify_emptylines; |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3101 | ["opt-eols"]=e.minify_eols; |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3102 | ["opt-strings"]=e.minify_strings; |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3103 | ["opt-numbers"]=e.minify_numbers; |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3104 | } |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3105 | local function i(e) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3106 | t("minify: "..e);os.exit(1); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3107 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3108 | local function l(e) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3109 | local t=io.open(e,"rb") |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3110 | if not t then i("cannot open \""..e.."\" for reading")end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3111 | local a=t:read("*a") |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3112 | if not a then i("cannot read from \""..e.."\"")end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3113 | t:close() |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3114 | return a |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3115 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3116 | local function u(e,a) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3117 | local t=io.open(e,"wb") |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3118 | if not t then i("cannot open \""..e.."\" for writing")end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3119 | local a=t:write(a) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3120 | if not a then i("cannot write to \""..e.."\"")end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3121 | t:close() |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3122 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3123 | function minify_string(e) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3124 | a.init(e) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3125 | a.llex() |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3126 | local t,e,a |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3127 | =a.tok,a.seminfo,a.tokln |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3128 | if n["opt-locals"]then |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3129 | r.print=print |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3130 | d.init(t,e,a) |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3131 | local o,a=d.parser() |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3132 | r.optimize(n,t,e,o,a) |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3133 | end |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3134 | h.print=print |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3135 | t,e,a |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3136 | =h.optimize(n,t,e,a) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3137 | local e=table.concat(e) |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3138 | if string.find(e,"\r\n",1,1)or |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3139 | string.find(e,"\n\r",1,1)then |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3140 | h.warn.mixedeol=true |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3141 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3142 | return e; |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3143 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3144 | function minify_file(e,t) |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3145 | local e=l(e); |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3146 | e=minify_string(e); |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3147 | u(t,e); |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3148 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3149 | if e.minify~=false then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3150 | o("Minifying "..out_fn.."..."); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3151 | minify_file(out_fn,out_fn); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3152 | o("OK!"); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3153 | end |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3154 | local h=require"llex" |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3155 | local i=128; |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3156 | local n={"and","break","do","else","elseif", |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3157 | "end","false","for","function","if", |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3158 | "in","local","nil","not","or","repeat", |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3159 | "return","then","true","until","while"} |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3160 | function uglify_file(l,o) |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3161 | local r,a=io.open(l); |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3162 | if not r then |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3163 | t("Can't open input file for reading: "..tostring(a)); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3164 | return; |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3165 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3166 | local a,s=io.open(o..".uglified","w+b"); |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3167 | if not a then |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3168 | t("Can't open output file for writing: "..tostring(s)); |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3169 | return; |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3170 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3171 | local s=r:read("*a"); |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3172 | r:close(); |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3173 | local r,t=s:match("^(#.-\n)(.+)$"); |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3174 | local t=t or s; |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3175 | if r then |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3176 | a:write(r) |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3177 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3178 | while i+#n<=255 and t:find("["..string.char(i).."-"..string.char(i+#n-1).."]")do |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3179 | i=i+1; |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3180 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3181 | if i+#n>255 then |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3182 | a:write(t); |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3183 | a:close(); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3184 | os.rename(o..".uglified",o); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3185 | return; |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3186 | end |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3187 | local d={} |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3188 | for t,e in ipairs(n)do |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3189 | d[e]=string.char(i+t); |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3190 | end |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3191 | local r=0; |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3192 | s:gsub("(=+)",function(e)r=math.max(r,#e);end); |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3193 | h.init(t,"@"..l); |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3194 | h.llex() |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3195 | local s=h.seminfo; |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3196 | if e.uglify_level=="full"and i+#n<255 then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3197 | local e={}; |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3198 | for o,a in ipairs(h.tok)do |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3199 | if a=="TK_NAME"or a=="TK_STRING"then |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3200 | local t=string.format("%q,%q",a,s[o]); |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3201 | if not e[t]then |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3202 | e[t]={type=a,value=s[o],count=0}; |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3203 | e[#e+1]=e[t]; |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3204 | end |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3205 | e[t].count=e[t].count+1; |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3206 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3207 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3208 | for t=1,#e do |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3209 | local e=e[t]; |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3210 | e.score=(e.count)*(#e.value-1)-#string.format("%q",e.value)-1; |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3211 | end |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3212 | table.sort(e,function(e,t)return e.score>t.score;end); |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3213 | local t=255-(i+#n); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3214 | for t=t+1,#e do |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3215 | e[t]=nil; |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3216 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3217 | local t=#n; |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3218 | for a,e in ipairs(e)do |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3219 | if e.score>0 then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3220 | table.insert(n,e.value); |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3221 | d[e.value]=string.char(i+t+a); |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3222 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3223 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3224 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3225 | a:write("local base_char,keywords=",tostring(i),",{"); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3226 | for t,e in ipairs(n)do |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3227 | a:write(string.format("%q",e),','); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3228 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3229 | a:write[[}; function prettify(code) return code:gsub("["..string.char(base_char).."-"..string.char(base_char+#keywords).."]", |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3230 | function (c) return keywords[c:byte()-base_char]; end) end ]] |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3231 | a:write[[return setfenv(assert(loadstring(prettify]] |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3232 | a:write("[",string.rep("=",r+1),"["); |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3233 | for e,t in ipairs(h.tok)do |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3234 | if t=="TK_KEYWORD"or t=="TK_NAME"or t=="TK_STRING"then |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3235 | local t=d[s[e]]; |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3236 | if t then |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3237 | a:write(t); |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3238 | else |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3239 | a:write(s[e]); |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3240 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3241 | else |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3242 | a:write(s[e]); |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3243 | end |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3244 | end |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3245 | a:write("]",string.rep("=",r+1),"]"); |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3246 | a:write(", '@",o,"')), getfenv())()"); |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3247 | a:close(); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3248 | os.rename(o..".uglified",o); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3249 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3250 | if e.uglify then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3251 | o("Uglifying "..out_fn.."..."); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3252 | uglify_file(out_fn,out_fn); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3253 | o("OK!"); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3254 | end |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3255 | local i=require"minichunkspy" |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3256 | function compile_string(t,a) |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3257 | local o=string.dump(loadstring(t,a)); |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3258 | if((not e.debug)or e.compile_strip)and e.compile_strip~=false then |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3259 | local t=i.disassemble(o); |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3260 | local function a(e) |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3261 | e.source_lines,e.locals,e.upvalues={},{},{}; |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3262 | for t,e in ipairs(e.prototypes)do |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3263 | a(e); |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3264 | end |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3265 | end |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3266 | s("Stripping debug info..."); |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3267 | a(t.body); |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3268 | return i.assemble(t); |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3269 | end |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3270 | return o; |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3271 | end |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3272 | function compile_file(a,e) |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3273 | local o,a=io.open(a); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3274 | if not o then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3275 | t("Can't open input file for reading: "..tostring(a)); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3276 | return; |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3277 | end |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3278 | local a,i=io.open(e..".compiled","w+"); |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3279 | if not a then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3280 | t("Can't open output file for writing: "..tostring(i)); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3281 | return; |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3282 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3283 | local i=o:read("*a"); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3284 | o:close(); |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3285 | local t,o=i:match("^(#.-\n)(.+)$"); |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3286 | local o=o or i; |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3287 | if t then |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3288 | a:write(t) |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3289 | end |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3290 | a:write(compile_string(o,e)); |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3291 | os.rename(e..".compiled",e); |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3292 | end |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3293 | if e.compile then |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3294 | o("Compiling "..out_fn.."..."); |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3295 | compile_file(out_fn,out_fn); |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3296 | o("OK!"); |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3297 | end |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3298 | function gzip_file(e,a) |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3299 | local o,e=io.open(e); |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3300 | if not o then |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3301 | t("Can't open input file for reading: "..tostring(e)); |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3302 | return; |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3303 | end |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3304 | local e,i=io.open(a..".gzipped","wb+"); |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3305 | if not e then |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3306 | t("Can't open output file for writing: "..tostring(i)); |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3307 | return; |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3308 | end |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3309 | local i=o:read("*a"); |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3310 | o:close(); |
102
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3311 | local n,o=i:match("^(#.-\n)(.+)$"); |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3312 | local o=o or i; |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3313 | if n then |
984b3ba0ea99
buildscripts/squish: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
86
diff
changeset
|
3314 | e:write(n) |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3315 | end |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3316 | local i,n=io.open(a..".pregzip","wb+"); |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3317 | if not i then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3318 | t("Can't open temp file for writing: "..tostring(n)); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3319 | return; |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3320 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3321 | i:write(o); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3322 | i:close(); |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3323 | local t=io.popen("gzip -c '"..a..".pregzip'"); |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3324 | o=t:read("*a"); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3325 | t:close(); |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3326 | os.remove(a..".pregzip"); |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3327 | local t=0; |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3328 | o:gsub("(=+)",function(e)t=math.max(t,#e);end); |
86
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3329 | e:write("local ungz = (function ()",require_resource"gunzip.lua"," end)()\n"); |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3330 | e:write[[return assert(loadstring((function (i)local o={} ungz{input=i,output=function(b)table.insert(o,string.char(b))end}return table.concat(o)end) ]]; |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3331 | e:write((string.format("%q",o):gsub("\026","\\026"))); |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3332 | e:write(", '@",a,"'))()"); |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3333 | e:close(); |
3c64919a50f9
buildscripts/sqush: Update to 5.2-compatible version
Matthew Wild <mwild1@gmail.com>
parents:
74
diff
changeset
|
3334 | os.rename(a..".gzipped",a); |
74
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3335 | end |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3336 | if e.gzip then |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3337 | o("Gzipping "..out_fn.."..."); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3338 | gzip_file(out_fn,out_fn); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3339 | o("OK!"); |
b3f2711684a7
Add Makefile and other files for building
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3340 | end |