git.asbjorn.biz
/
swftools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
removed ':' after pool statistics
[swftools.git]
/
lib
/
as3
/
main.c
diff --git
a/lib/as3/main.c
b/lib/as3/main.c
index
09e2669
..
4cbbb71
100644
(file)
--- a/
lib/as3/main.c
+++ b/
lib/as3/main.c
@@
-30,17
+30,21
@@
#include "tokenizer.h"
#include "parser.tab.h"
#include "parser.h"
#include "tokenizer.h"
#include "parser.tab.h"
#include "parser.h"
+#include "compiler.h"
-void test_lexer()
+void test_lexer(char*filename)
{
{
+ char*fullfilename = enter_file(filename, 0);
+ FILE*fi = fopen(fullfilename, "rb");
+ as3_set_in(fi);
while(1) {
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 {
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));
}
}
}
}
}
}
@@
-56,25
+60,17
@@
int main(int argn, char*argv[])
}
filename=argv[1];
}
filename=argv[1];
- registry_init();
-
- add_include_dir(getcwd(buf, 512));
- char*fullfilename = enter_file(filename, 0);
-
- FILE*fi = fopen(fullfilename, "rb");
- if(!fi) {
- perror(fullfilename);
- return 1;
- }
- initialize_state();
- avm2_set_in(fi);
-
if(argn>2 && !strcmp(argv[2], "-lex")) {
if(argn>2 && !strcmp(argv[2], "-lex")) {
- test_lexer();
+ test_lexer(filename);
return 0;
}
return 0;
}
- avm2_parse();
- void*code = finalize_state();
+
+ //extern int avm2_debug;
+ //avm2_debug = 1;
+
+ as3_add_include_dir(getcwd(buf, 512));
+ as3_parse_file(filename);
+ void*code = as3_getcode();
SWF swf;
memset(&swf, 0, sizeof(swf));
SWF swf;
memset(&swf, 0, sizeof(swf));
@@
-86,12
+82,11
@@
int main(int argn, char*argv[])
TAG*tag = swf.firstTag = swf_InsertTag(0, ST_DOABC);
swf_WriteABC(tag, code);
TAG*tag = swf.firstTag = swf_InsertTag(0, ST_DOABC);
swf_WriteABC(tag, code);
- if(globalclass) {
+ if(as3_getglobalclass()) {
tag = swf_InsertTag(tag, ST_SYMBOLCLASS);
swf_SetU16(tag, 1);
swf_SetU16(tag, 0);
tag = swf_InsertTag(tag, ST_SYMBOLCLASS);
swf_SetU16(tag, 1);
swf_SetU16(tag, 0);
- swf_SetString(tag, globalclass);
- free(globalclass);globalclass=0;
+ swf_SetString(tag, as3_getglobalclass());
} else {
printf("Warning: no global public MovieClip subclass\n");
}
} else {
printf("Warning: no global public MovieClip subclass\n");
}