From 1e551bdd1bf6aaf003fd1ba34eca63b8fcc7b5ba Mon Sep 17 00:00:00 2001 From: Mateusz Hromada Date: Tue, 9 Jun 2009 01:46:50 +0200 Subject: [PATCH] Migration to new build system. * sen moved and checked --- app/src/sen-l/Makefile | 12 ------ app/src/sen-l/sen.l | 80 ----------------------------------- auto/output/Makefile | 12 ++++-- src/sen.l | 95 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 104 insertions(+), 95 deletions(-) delete mode 100644 app/src/sen-l/Makefile delete mode 100644 app/src/sen-l/sen.l create mode 100644 src/sen.l diff --git a/app/src/sen-l/Makefile b/app/src/sen-l/Makefile deleted file mode 100644 index a26059d..0000000 --- a/app/src/sen-l/Makefile +++ /dev/null @@ -1,12 +0,0 @@ - -sen: sen.l - flex -osen.c sen.l - cc -O3 -o sen sen.c -lfl - -copy: -ifdef UTT_BIN_DIR - cp sen ${UTT_BIN_DIR} -endif - -clean: - rm sen.c sen diff --git a/app/src/sen-l/sen.l b/app/src/sen-l/sen.l deleted file mode 100644 index 4128e15..0000000 --- a/app/src/sen-l/sen.l +++ /dev/null @@ -1,80 +0,0 @@ -%{ - int pos=0,len=0; - - void set_position(); -%} - -ul [A-Z¡ÆÊ£ÑÓ¦¯¬] -ll [a-z±æê³ñ󶿼] -l ul|ll -n [0-9]+ -s [ \t]+ - - -ab1 (mgr|in¿|prof|hab|doc|dyr|kier|zast) -ab2 (ul|pl|al) - -abrv (ab1|ab2) - -SEG .*\n -N {n}{s}{n}{s}N{s}.*\n -S {n}{s}{n}{s}S{s}.*\n -P {n}{s}{n}{s}P{s}.*\n -W {n}{s}{n}{s}W{s}.*\n -UL {n}{s}{n}{s}W{s}{ul}.*\n -Cap {n}{s}{n}{s}W{s}{ul}{ll}*.*\n -POINT {n}{s}{n}{s}P{s}\.({s}.*)?\n -QMARK {n}{s}{n}{s}P{s}\?({s}.*)?\n -EXCL {n}{s}{n}{s}P{s}\!({s}.*)?\n -DASH {n}{s}{n}{s}P{s}\-({s}.*)?\n -POINTS {POINT}+ - -ABRV {n}{s}{n}{s}W{s}{abrv}({s}.*)?\n - -EOS {POINT}|{POINTS}|{QMARK}|{EXCL} - - -%% - - -{N}({POINT}{N})+ ECHO; set_position(); -({UL}{POINT}{S}?)+{Cap} ECHO; set_position(); -{ABRV}{POINT} ECHO; set_position(); - - -{P}/{S}{DASH} ECHO; set_position(); print_EOS(); -{EOS}/{S}({Cap}|{P}|{N}) ECHO; set_position(); print_EOS(); - -.* ECHO; set_position(); - -<> printf("%04d 00 EOS *\n",pos+len); exit(1); - -%% - -int main() -{ - printf("0000 00 BOS *\n"); - yylex(); -} - -int yywrap() -{ - return 1; -} - -void set_position() -{ - char *lastseg, *tmp; - yytext[yyleng-1]='\0'; - if(tmp=strrchr(yytext,'\n')) - lastseg=tmp+1; - else - lastseg=yytext; - sscanf(lastseg,"%d %d", &pos, &len); - yytext[yyleng-1]='\n'; -} - -int print_EOS() -{ - printf("%04d 00 EOS *\n%04d 00 BOS *\n",pos+len,pos+len); -} diff --git a/auto/output/Makefile b/auto/output/Makefile index f76817a..5cf24ef 100755 --- a/auto/output/Makefile +++ b/auto/output/Makefile @@ -42,13 +42,16 @@ ALL_FFLAGS = -t \$(FFLAGS) VPATH = ./src -PROGRAMS = tok +PROGRAMS = tok sen TOK_OBJ_FILES = tok.o tok_cmdline.o TOK_FLEX_FILES = tok.l TOK_GGO_FILES = tok_cmdline.ggo tok.o: tok_cmdline.h +SEN_OBJ_FILES = sen.o +SEN_FLEX_FILES = sen.l + CONFIG_FILES = src/config.h Makefile .SUFFIXES: @@ -58,6 +61,8 @@ CONFIG_FILES = src/config.h Makefile .INTERMEDIATE: \$(patsubst %.ggo,%.c,\$(TOK_GGO_FILES)) .INTERMEDIATE: \$(patsubst %.ggo,%.h,\$(TOK_GGO_FILES)) +.INTERMEDIATE: \$(patsubst %.l,%.c,\$(SEN_FLEX_FILES)) + .PHONY: all all: \$(PROGRAMS) @@ -79,6 +84,7 @@ clean: \$(RM) \$(patsubst %.l,%.c,\$(TOK_FLEX_FILES)) \$(RM) \$(patsubst %.ggo,%.c,\$(TOK_GGO_FILES)) \$(RM) \$(patsubst %.ggo,%.h,\$(TOK_GGO_FILES)) + \$(RM) \$(patsubst %.l,%.c,\$(SEN_FLEX_FILES)) .PHONY: distclean distclean: clean @@ -99,10 +105,10 @@ uninstall: \$(FLEX) -t \$< > \$@ %.c: %.ggo - gengetopt --input $< --file-name \$(patsubst %.c,%,\$@) --conf-parser + gengetopt --input $< --file-name \$(basename \$@) --conf-parser %.h: %.ggo - gengetopt --input $< --file-name \$(patsubst %.h,%,\$@) --conf-parser + gengetopt --input $< --file-name \$(basename \$@) --conf-parser %: %.o \$(CC) \$? -o \$@ \$(ALL_LDFLAGS) \$(ALL_CFLAGS) \$(ALL_LDLIBS) diff --git a/src/sen.l b/src/sen.l new file mode 100644 index 0000000..a3a6fcd --- /dev/null +++ b/src/sen.l @@ -0,0 +1,95 @@ +%{ + + void print_EOS(void); + void set_position(void); + + int pos=0; + int len=0; + +%} + +ul [A-Z¡ÆÊ£ÑÓ¦¯¬] +ll [a-z±æê³ñ󶿼] +l ul|ll +n [0-9]+ +s [ \t]+ + + +ab1 (mgr|in¿|prof|hab|doc|dyr|kier|zast) +ab2 (ul|pl|al) + +abrv (ab1|ab2) + +SEG .*\n +N {n}{s}{n}{s}N{s}.*\n +S {n}{s}{n}{s}S{s}.*\n +P {n}{s}{n}{s}P{s}.*\n +W {n}{s}{n}{s}W{s}.*\n +UL {n}{s}{n}{s}W{s}{ul}.*\n +Cap {n}{s}{n}{s}W{s}{ul}{ll}*.*\n +POINT {n}{s}{n}{s}P{s}\.({s}.*)?\n +QMARK {n}{s}{n}{s}P{s}\?({s}.*)?\n +EXCL {n}{s}{n}{s}P{s}\!({s}.*)?\n +DASH {n}{s}{n}{s}P{s}\-({s}.*)?\n +POINTS {POINT}+ + +ABRV {n}{s}{n}{s}W{s}{abrv}({s}.*)?\n + +EOS {POINT}|{POINTS}|{QMARK}|{EXCL} + + +%% + + +{N}({POINT}{N})+ { ECHO; set_position(); } +({UL}{POINT}{S}?)+{Cap} { ECHO; set_position(); } +{ABRV}{POINT} { ECHO; set_position(); } + + +{P}/{S}{DASH} { ECHO; set_position(); print_EOS(); } +{EOS}/{S}({Cap}|{P}|{N}) { ECHO; set_position(); print_EOS(); } + +.* { ECHO; set_position(); } + +<> { printf("%04d 00 EOS *\n",pos+len); exit(1); } + +%% + +int main() +{ + printf("0000 00 BOS *\n"); + yylex(); + return 0; +} + +int yywrap() +{ + return 1; +} + +void set_position() +{ + char *lastseg; + char *tmp; + + yytext[yyleng-1] = '\0'; + + tmp = strrchr(yytext, '\n'); + if( tmp ) + { + lastseg = tmp + 1; + } + else + { + lastseg = yytext; + } + + sscanf(lastseg, "%d %d", &pos, &len); + yytext[yyleng-1] = '\n'; + +} + +void print_EOS() +{ + printf("%04d 00 EOS *\n%04d 00 BOS *\n", pos+len, pos+len); +}