diff options
author | Pixel <Pixel> | 2002-07-26 13:45:53 +0000 |
---|---|---|
committer | Pixel <Pixel> | 2002-07-26 13:45:53 +0000 |
commit | b5c9aec9a9725bac99f948dab8bececb43e414e1 (patch) | |
tree | 6e1f703a2b5dc3c58939a55f8bca98d4a6350987 | |
parent | 8cc5bf50f11bca8ee945e6716c68d609fdaa9e8f (diff) |
Updated the lex thingies
-rwxr-xr-x | Xenogears/Makefile | 15 | ||||
-rw-r--r-- | Xenogears/compil-2.lex | 11 | ||||
-rw-r--r-- | Xenogears/compil.lex | 7 |
3 files changed, 24 insertions, 9 deletions
diff --git a/Xenogears/Makefile b/Xenogears/Makefile index 65a1121..4fec754 100755 --- a/Xenogears/Makefile +++ b/Xenogears/Makefile @@ -2,8 +2,9 @@ CPPFLAGS=-Wall -g -O3 -mcpu=i686 -pedantic -pedantic-errors -I../includes CXX=g++ +CC=gcc -TARGET = reinsert main_dump Decrypt script-comp script-dec XenoCD1.sqr XenoCD2.sqr +TARGET = reinsert main_dump Decrypt script-comp script-dec XenoCD1.sqr XenoCD2.sqr compil compil-2 all: ${TARGET} @@ -22,6 +23,18 @@ script-comp: script-comp.o ../includes/fileutils.h ../includes/generic.h ../incl script-dec: script-dec.o ../includes/fileutils.h ../includes/generic.h ../includes/lzss.h ../lib/lib.a ../generic/generic.a Makefile ${CXX} ${LDFLAGS} script-dec.o ../lib/lib.a ../generic/generic.a -o script-dec +compil: compil.o + ${CC} ${LDFLAGS} compil.o -o compil + +compil-2: compil-2.o + ${CC} ${LDFLAGS} compil-2.o -o compil-2 + +compil.c: compil.lex + lex -ocompil.c compil.lex + +compil-2.c: compil-2.lex + lex -ocompil-2.c compil-2.lex + clean: rm -f *.o ${TARGET} compil.c diff --git a/Xenogears/compil-2.lex b/Xenogears/compil-2.lex index 805a964..931a04c 100644 --- a/Xenogears/compil-2.lex +++ b/Xenogears/compil-2.lex @@ -7,6 +7,8 @@ /* Waiting for OpCode arguments */ %s Op + #include <string.h> + int num_blocks = 0; int num_lines = 0; int cur_num_lines = 0; @@ -21,8 +23,6 @@ %% <INITIAL>"<Blocks:"\ *[[:digit:]]+">"\n { - int i; - char zeros[4] = {0, 0, 0, 0}; num_blocks = atoi(yytext + 8); fprintf(stderr, "Number of blocks: %i\n", num_blocks); @@ -175,9 +175,10 @@ <I>"<Bare"\ +[[:xdigit:]]{1,2}">" { char str[5] = {'0', 'x', 0, 0, 0}; int d; - for (yytext += 6; *yytext == ' '; yytext++); - str[2] = *(yytext++); - str[3] = *(yytext++); + char * _yytext = yytext; + for (_yytext += 6; *_yytext == ' '; _yytext++); + str[2] = *(_yytext++); + str[3] = *(_yytext++); sscanf(str, "%i", &d); if (d > 255) { fprintf(stderr, "Error: Bare number too important: %i\n", d); diff --git a/Xenogears/compil.lex b/Xenogears/compil.lex index f6ceda8..7d221df 100644 --- a/Xenogears/compil.lex +++ b/Xenogears/compil.lex @@ -254,9 +254,10 @@ <I>"<Bare"\ +[[:xdigit:]]{1,2}">" { char str[5] = {'0', 'x', 0, 0, 0}; int d; - for (yytext += 6; *yytext == ' '; yytext++); - str[2] = *(yytext++); - str[3] = *(yytext++); + char * _yytext = yytext; + for (_yytext += 6; *_yytext == ' '; _yytext++); + str[2] = *(_yytext++); + str[3] = *(_yytext++); sscanf(str, "%i", &d); if (d > 255) { fprintf(stderr, "Error: Bare number too important: %i\n", d); |