X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Fas3%2Fmain.c;h=2835556f78358f3cf4d8ed98b2880cd38f5b220f;hb=8a7da6f65154bb96d47695cbcbf42684cccb0aad;hp=4901e43812d0cd654b5f3d69f0b71b54cb9fe88f;hpb=3e1312c39052252e112f435ba3193f550cf891cb;p=swftools.git diff --git a/lib/as3/main.c b/lib/as3/main.c index 4901e43..2835556 100644 --- a/lib/as3/main.c +++ b/lib/as3/main.c @@ -27,16 +27,19 @@ #include "../rfxswf.h" #include "../os.h" #include "files.h" +#include "common.h" #include "tokenizer.h" #include "parser.tab.h" #include "parser.h" #include "compiler.h" +#include "import.h" void test_lexer(char*filename) { - char*fullfilename = enter_file(filename, 0); + char*fullfilename = find_file(filename, 1); + enter_file(filename, fullfilename, 0); FILE*fi = fopen(fullfilename, "rb"); - as3_set_in(fi); + as3_file_input(fi); while(1) { int token = as3_lex(); if(token==T_EOF) @@ -49,6 +52,7 @@ void test_lexer(char*filename) } } +extern int a3_debug; int main(int argn, char*argv[]) { char*filename = 0; @@ -59,23 +63,58 @@ int main(int argn, char*argv[]) exit(1); } filename=argv[argn-1]; + + //a3_debug = 1; //if bison was called with -t + as3_add_include_dir(getcwd(buf, 512)); + + registry_init(); + int t=0; + char*mainclass = 0; for(t=1;tdata, m->len); + //memfile_close(m); + if(!strcmp(filename, ".")) { + as3_parse_directory("."); + } else { + as3_parse_file(filename); + } + void*code = as3_getcode(); SWF swf; @@ -88,11 +127,14 @@ int main(int argn, char*argv[]) TAG*tag = swf.firstTag = swf_InsertTag(0, ST_DOABC); swf_WriteABC(tag, code); - if(as3_getglobalclass()) { + if(!mainclass) + mainclass = as3_getglobalclass(); + + if(mainclass) { tag = swf_InsertTag(tag, ST_SYMBOLCLASS); swf_SetU16(tag, 1); swf_SetU16(tag, 0); - swf_SetString(tag, as3_getglobalclass()); + swf_SetString(tag, mainclass); } else { printf("Warning: no global public MovieClip subclass\n"); }