X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=blobdiff_plain;f=lib%2Fas3%2Fcompiler.c;h=2e6beb038ff7032431ebc4f3e7f2e7092add5007;hp=36bb1fac565b0da3a70fa9b2af1ba272aade847b;hb=3e303bea7eb10c99a7b3808f0c355ee63188eb9b;hpb=15d3df10f09bd780efa101d0c253db96716eb145 diff --git a/lib/as3/compiler.c b/lib/as3/compiler.c index 36bb1fa..2e6beb0 100644 --- a/lib/as3/compiler.c +++ b/lib/as3/compiler.c @@ -21,6 +21,7 @@ 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" @@ -39,6 +40,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 +50,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 +113,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 +156,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 +200,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 +270,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 +303,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 +327,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); + } }