X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fas3compile.c;h=89252f5f7236d1262401ca1dccb9600ae47a6fbd;hb=f0f4599a8cc05f18859d2bb8d0afe447f3e00813;hp=d62d4476accfef0c80c3cc115a3dff2bd3553ff4;hpb=833472ed51c5e622420293e9d42a69e993f9a62f;p=swftools.git diff --git a/src/as3compile.c b/src/as3compile.c index d62d447..89252f5 100644 --- a/src/as3compile.c +++ b/src/as3compile.c @@ -38,14 +38,20 @@ static double width = 400; static double height = 300; static int flashversion = 9; static int verbose = 1; +static char local_with_networking = 0; +static char local_with_filesystem = 0; static struct options_t options[] = { {"h", "help"}, {"V", "version"}, +{"v", "verbose"}, +{"q", "quiet"}, {"C", "cgi"}, {"X", "width"}, {"Y", "height"}, {"r", "rate"}, +{"l", "library"}, +{"I", "include"}, {"T", "flashversion"}, {"o", "output"}, {0,0} @@ -90,6 +96,24 @@ 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 if (!strcmp(name, "N")) + { + local_with_networking = 1; + return 0; + } + else if (!strcmp(name, "L")) + { + local_with_filesystem = 1; + return 0; + } else { printf("Unknown option: -%s\n", name); exit(1); @@ -107,10 +131,14 @@ void args_callback_usage(char *name) printf("\n"); printf("-h , --help Print short help message and exit\n"); printf("-V , --version Print version info and exit\n"); + printf("-v , --verbose Increase verbosity\n"); + printf("-q , --quiet Decrease verbosity\n"); printf("-C , --cgi Output to stdout (for use in CGI environments)\n"); 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"); @@ -151,8 +179,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]); @@ -163,16 +201,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(); @@ -195,7 +223,6 @@ int main (int argc,char ** argv) } else { as3_warning("no global public MovieClip subclass"); } - as3_destroy(); @@ -203,6 +230,11 @@ int main (int argc,char ** argv) tag = swf_InsertTag(tag, ST_END); swf_FreeABC(code); + + if(local_with_filesystem) + swf.fileAttributes &= ~FILEATTRIBUTE_USENETWORK; + if(local_with_networking) + swf.fileAttributes |= FILEATTRIBUTE_USENETWORK; writeSWF(&swf); swf_FreeTags(&swf);