forked from livecode/livecode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathencode_errors.rev
More file actions
50 lines (40 loc) · 1.19 KB
/
encode_errors.rev
File metadata and controls
50 lines (40 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#! /usr/bin/revolution -ui
on startup
try
generate
catch tError
write tError & return to stderr
end try
end startup
on generate
local tOutput
generateErrorsList $1 & slash & "executionerrors.h", "MCexecutionerrors"
put the result & return into tOutput
generateErrorsList $1 & slash & "parseerrors.h", "MCparsingerrors"
put the result & return after tOutput
put tOutput into url ("binfile:" & $2)
end generate
on generateErrorsList pSrcFile, pName
local tArray
put "const char *" & pName & " =" & return after tArray
local tFound
put false into tFound
repeat for each line tLine in url ("file:" & pSrcFile)
if word 1 of tLine is "enum" then
put true into tFound
end if
if not tFound then
next repeat
end if
if word 1 of tLine is "};" then
exit repeat
end if
if word 1 of tLine is "//" and char 1 of word 2 of tLine is "{" then
get word 3 to -1 of tLine
replace quote with "\" & quote in it
put tab & quote & it & "\n" & quote & return after tArray
end if
end repeat
put ";" & return after tArray
return tArray
end generateErrorsList