COMPILE
NAME
compile - Used to compile a file.
SYNOPSIS
compile(error : variable, src : filename, dst : "filename")
DESCRIPTION
This function is used to compile a file from a template and produce a binary file.
PARAMETERS
- src
- Source file.
- dst
- Destination file.
- error
- If an error occurs, put the error in this variable.
EXAMPLES
Note: In the followings examples, the _ between the { should be removed to make it work.
res={_{ compile(); }}. return src and dst must be specify
res={_{ compile(src:"",dst:""); }}. return Can't open input file
res={_{
remove("/tmp/tib.sn");
write(data:"test {_{ a=5; a * 6; }}",file:"/tmp/tib.sn");
compile(error:t,src:"/tmp/tib.sn",dst:"/tmp/tib.snc");
include("/tmp/tib.snc");
remove("/tmp/tib.sn");
t.errcode;
}}. return res=test 300.
res={_{
remove("/tmp/tib.sn");
write(data:"test {_{ a = 5; a * ; }}",file:"/tmp/tib.sn");
compile(src:"/tmp/tib.sn",dst:"/tmp/tib.snc");
include("/tmp/tib.snc");
remove("/tmp/tib.sn");
}}. return Error while parsing template
res={_{
remove("/tmp/tib.sn");
write(data:"test {_{ a = 5; a * ; }}",file:"/tmp/tib.sn");
compile(error:t,src:"/tmp/tib.sn",dst:"/tmp/tib.snc");
t.errcode;
remove("/tmp/tib.sn");
}}. return res=14.
res={_{
remove("/tmp/tib.sn");
write(data:"test {_{ global c; a = 5; c = a * c; c; }}",file:"/tmp/tib.sn");
compile(src:"/tmp/tib.sn",dst:"/tmp/tib.snc");
c=12;
include("/tmp/tib.snc");
c;
}}. return res=test 6060.
SEE ALSO
AUTHOR
Written by Pierre Laplante and Caroline Laplante, <laplante@sednove.com>
MODIFICATIONS
1.0 2014-09-09 21:24:14 laplante@sednove.com
Edit