X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=blobdiff_plain;f=lib%2Fas3%2Fcompiler.c;h=e6571dbfc74f885c838b848f499101737259511a;hp=36bb1fac565b0da3a70fa9b2af1ba272aade847b;hb=9ed9a87914fc9a590967d46de404e0f6290b7bb2;hpb=15d3df10f09bd780efa101d0c253db96716eb145 diff --git a/lib/as3/compiler.c b/lib/as3/compiler.c index 36bb1fa..e6571db 100644 --- a/lib/as3/compiler.c +++ b/lib/as3/compiler.c @@ -21,11 +21,14 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include "common.h" #include "tokenizer.h" #include "files.h" #include "parser.h" #include "parser.tab.h" #include "compiler.h" +#include "registry.h" +#include "assets.h" #include "../os.h" #ifdef HAVE_SYS_STAT_H #include @@ -39,6 +42,8 @@ extern int a3_parse(); extern int as3_lex(); extern int as3_lex_destroy(); +static char config_recurse = 0; + void as3_setverbosity(int level) { as3_verbosity=level; @@ -47,6 +52,12 @@ void as3_add_include_dir(char*dir) { add_include_dir(dir); } +void as3_set_option(const char*key, const char*value) +{ + if(!strcmp(key, "recurse")) { + config_recurse=atoi(value); + } +} static char registry_initialized = 0; static char parser_initialized = 0; @@ -104,6 +115,7 @@ static void as3_parse_file_or_array(const char*name, const char*filename, const a3_parse(); as3_lex_destroy(); finish_file(); + if(fi) fclose(fi); } typedef struct _scheduled_file { @@ -146,7 +158,7 @@ void as3_schedule_file(const char*name, const char*filename) } filename = normalize_path(filename); - + if(dict_contains(scheduled_dict, filename)) { return; //already processed } else { @@ -190,7 +202,7 @@ void as3_parse_file(const char*filename) compile_list = 0; as3_pass = 1; - as3_parse_file_or_array(filename, fullfilename, 0,0); + as3_schedule_file(filename, fullfilename); as3_parse_scheduled(); registry_resolve_all(); @@ -260,7 +272,8 @@ void as3_schedule_package(const char*package) char*dirname = strdup(package); int s=0; while(dirname[s]) { - if(dirname[s]=='.') dirname[s]='/'; + if(dirname[s]=='.') + dirname[s] = path_seperator; s++; }; if(!as3_schedule_directory(dirname)) @@ -292,22 +305,19 @@ static void schedule_class(const char*package, const char*cls, char error) strcpy(filename+t, cls); strcpy(filename+t+l2, ".as"); - char*f=0; - if(!(f=find_file(filename, error))) { + char*f=find_file(filename, error); + if(!f) { int i; - /* try lower case filename (not packagename!), too */ - for(i=t;i='A' && filename[i]<='Z') - filename[i] += 'a'-'A'; - } - if(!(f=find_file(filename, error))) { - if(error) { - strcpy(filename+t, cls); - strcpy(filename+t+l2, ".as"); - as3_warning("Could not open file %s", filename); - } - return; - } + filename = filename_to_lowercase(filename); + f=find_file(filename, error); + } + if(!f) { + if(error) { + strcpy(filename+t, cls); + strcpy(filename+t+l2, ".as"); + as3_warning("Could not open file %s", filename); + } + return; } as3_schedule_file(filename, f); } @@ -319,7 +329,9 @@ void as3_schedule_class(const char*package, const char*cls) void as3_schedule_class_noerror(const char*package, const char*cls) { - schedule_class(package, cls, 0); + if(config_recurse) { + schedule_class(package, cls, 0); + } } @@ -332,6 +344,10 @@ void* as3_getcode() } return as3code; } +void* as3_getassets(void*t) +{ + return swf_AssetsToTags((TAG*)t, registry_getassets()); +} char* as3_getglobalclass() { return as3_globalclass;