X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Fas3%2Fmain.c;h=df7aed341ca5c5096d98f35fc6456d0f9857338b;hb=639ac6b9f7a89f10d02c5d9ef41bca3bad4eaf2b;hp=d72a11f3eec2228282edc3bf45918fc5cd0b2d2d;hpb=614bcc7011a3db29d3d868d71a228d49c690a7c9;p=swftools.git diff --git a/lib/as3/main.c b/lib/as3/main.c index d72a11f..df7aed3 100644 --- a/lib/as3/main.c +++ b/lib/as3/main.c @@ -27,28 +27,32 @@ #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"); - avm2_set_in(fi); + as3_file_input(fi); while(1) { - int token = avm2_lex(); + int token = as3_lex(); if(token==T_EOF) break; if(token>=32 && token<256) { printf("'%c'\n", token); } else { - printf("%s\n", token2string(token, avm2_lval)); + printf("%s\n", token2string(token, a3_lval)); } } } +extern int a3_debug; int main(int argn, char*argv[]) { char*filename = 0; @@ -58,15 +62,55 @@ int main(int argn, char*argv[]) fprintf(stderr, "please supply a filename\n"); exit(1); } - filename=argv[1]; - - if(argn>2 && !strcmp(argv[2], "-lex")) { - test_lexer(filename); - return 0; - } - + filename=argv[argn-1]; + + //a3_debug = 1; //if bison was called with -t + as3_add_include_dir(getcwd(buf, 512)); - as3_parse_file(filename); + + registry_init(); + + int t=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;