forked from livecode/livecode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathencode_source.rev
More file actions
34 lines (28 loc) · 788 Bytes
/
encode_source.rev
File metadata and controls
34 lines (28 loc) · 788 Bytes
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
#! /usr/bin/revolution -ui
# $1 = source file
# $2 = dst file
# $3 = var name
on startup
try
generate
catch tError
write tError & return to stderr
end try
end startup
on generate
local tSource
set the itemDelimiter to comma
local tInput, tOutput, tLength
put url ("file:" & $1) into tInput
put "const char *" & $3 & "[] =" & return after tOutput
put "{" & return after tOutput
repeat for each line tLine in tInput
replace "\" with "\\" in tLine
replace quote with "\" & quote in tLine
put tab & quote & tLine & "\n" & quote & comma & return after tOutput
end repeat
put tab & 0 & return after tOutput
put "}" & return after tOutput
put ";" & return after tOutput
put tOutput into url ("file:" & $2)
end generate