From: Matthias Kramm Date: Mon, 16 Feb 2009 16:22:53 +0000 (+0100) Subject: added -l, -I options X-Git-Tag: release-0-9-0~78 X-Git-Url: http://git.asbjorn.it/?a=commitdiff_plain;h=90916f8638e4a996fc945e5ed90d7618d3dca0f6;p=swftools.git added -l, -I options --- diff --git a/src/as3compile.1 b/src/as3compile.1 index 13a4abf..c8b1de1 100644 --- a/src/as3compile.1 +++ b/src/as3compile.1 @@ -1,4 +1,4 @@ -.TH as3compile "1" "January 2009" "as3compile" "swftools" +.TH as3compile "1" "February 2009" "as3compile" "swftools" .SH NAME as3compile - Compile .as ActionScript 3.0 files to swf. @@ -34,6 +34,12 @@ Compiles a file written in ActionScript to a SWF file. \fB\-r\fR, \fB\-\-rate\fR Set target SWF framerate .TP +\fB\-l\fR, \fB\-\-library\fR \fIfile\fR + Include library file \fIfile\fR +.TP +\fB\-I\fR, \fB\-\-include\fR \fIdir\fR + Add include dir \fIdir\fR +.TP \fB\-T\fR, \fB\-\-flashversion\fR \fInum\fR \fInum\fR must be >= 9. .TP diff --git a/src/as3compile.c b/src/as3compile.c index f42af26..4f0193e 100644 --- a/src/as3compile.c +++ b/src/as3compile.c @@ -48,6 +48,8 @@ static struct options_t options[] = { {"X", "width"}, {"Y", "height"}, {"r", "rate"}, +{"l", "library"}, +{"I", "include"}, {"T", "flashversion"}, {"o", "output"}, {0,0} @@ -92,6 +94,14 @@ int args_callback_option(char*name,char*val) do_cgi = 1; return 0; } + else if(!strcmp(name, "-l")) { + as3_import_file(val); + return 1; + } + else if(!strcmp(name, "-I")) { + as3_add_include_dir(val); + return 1; + } else { printf("Unknown option: -%s\n", name); exit(1); @@ -115,6 +125,8 @@ void args_callback_usage(char *name) printf("-X , --width Set target SWF width\n"); printf("-Y , --height Set target SWF width\n"); printf("-r , --rate Set target SWF framerate\n"); + printf("-l , --library Include library file \n"); + printf("-I , --include Add include dir \n"); printf("-T , --flashversion Set target SWF flash version to .\n"); printf("-o , --output Set output file to .\n"); printf("\n"); @@ -155,8 +167,18 @@ void writeSWF(SWF*swf) int main (int argc,char ** argv) { + char buf[512]; + char*currentdir = getcwd(buf, 512); + if(!currentdir) { + as3_warning("Could not determine the current directory"); + } else { + as3_add_include_dir(currentdir); + } + registry_init(); + int t; processargs(argc, argv); + as3_setverbosity(verbose); if(!filename) { args_callback_usage(argv[0]); @@ -167,16 +189,6 @@ int main (int argc,char ** argv) //as3_warning("output name not given, writing to %s", outputname); } - as3_setverbosity(verbose); - - char buf[512]; - char*currentdir = getcwd(buf, 512); - if(!currentdir) { - as3_warning("Could not determine the current directory"); - } else { - as3_add_include_dir(currentdir); - } - as3_parse_file(filename); void*code = as3_getcode(); @@ -199,7 +211,6 @@ int main (int argc,char ** argv) } else { as3_warning("no global public MovieClip subclass"); } - as3_destroy(); diff --git a/src/as3compile.doc b/src/as3compile.doc index ce8f6b8..a24543c 100644 --- a/src/as3compile.doc +++ b/src/as3compile.doc @@ -20,6 +20,10 @@ Compiles a file written in ActionScript to a SWF file. Set target SWF width -r, --rate Set target SWF framerate +-l, --library + Include library file +-I, --include + Add include dir -T, --flashversion Set target SWF flash version to . must be >= 9.