X-Git-Url: http://git.ieval.ro/?p=filters.git;a=blobdiff_plain;f=newspeak.l;h=4883d40cc62bdb933960f86076f67bf342b8614e;hp=67b2c5e2b074f964c60f2b4370b1def93e0d09ad;hb=HEAD;hpb=9edc0e612e98d4c563155a8fc2d96f27f4815831 diff --git a/newspeak.l b/newspeak.l index 67b2c5e..4883d40 100644 --- a/newspeak.l +++ b/newspeak.l @@ -13,7 +13,6 @@ * for any purpose. It is provided "as is" without express or * implied warranty. * - * Permissiom granted for noncommercial use and redistribution. * To compile: * * flex newspeak.l @@ -21,7 +20,7 @@ * rm lex.yy.c * * This must be compiled with "flex", not normal "lex". Lex has - * some builtin, unchangable limits which this program exceeds. + * some builtin, unchangeable limits which this program exceeds. * This has been verified to work with flex version 2.3.7, and * may not work with flex version 2.3.6. * @@ -44,7 +43,6 @@ unsigned int fcounter = 0; #define Y2 yytext[2] #define Y3 yytext[3] #define C caseify -#define C1 caseify1 #define CAP(string) capstring(0, (string),0) #define WCAP(string) capstring(Y0,(string),1) @@ -53,6 +51,12 @@ unsigned int fcounter = 0; #define WCOMP(string1,string2) compstring(Y0,(string1),(string2),1) #define DUMP() printf("%s",yytext) + +void capstring(char, char*, int); +void compstring(char, char*, char*, int); +char _caseify(char, int); +char caseify(char); + %} %e 8000 @@ -346,7 +350,7 @@ China|[Jj]apan|[Tt]aiwan|{THE}?[Pp]hillipines|[Ii]ndia | %{ /****************************** - * Miscelaneous Translations * + * Miscellaneous Translations * ******************************/ %} @@ -584,10 +588,10 @@ robably|ventually|[Oo]bvious|[Bb]asic|{W}[Oo]nly|otally | if (14 == fcounter++) printf("(fnord) "); } -[.,!?]\"([^\n\".!]+[.!])?\n/[\n\t ] printf("%c Hail Big Brother!\"%s",Y0,yytext+1); +[.,!?]\"([^\n\".!]+[.!])?\n/[\n\t ] printf("%c Hail Big Brother!\"%s",Y0,yytext+2); \"([.,!?][^\n\".!]+[.!])?\n/[\n\t ] printf("%c Hail Big Brother!\"%s",Y1,yytext+2); -. printf(yytext); +. printf("%s", yytext); \n printf("\n"); %{ @@ -645,14 +649,14 @@ robably|ventually|[Oo]bvious|[Bb]asic|{W}[Oo]nly|otally | %} %% -main() +int main() { yylex(); printf("\nHail Big Brother!\n"); } -capstring(firstchar,string,i) +void capstring(firstchar,string,i) char firstchar, *string; int i; { @@ -661,7 +665,7 @@ capstring(firstchar,string,i) printf("%s",string+1); } -compstring(firstchar,string1,string2,i) +void compstring(firstchar,string1,string2,i) char firstchar, *string1, *string2; int i; { @@ -669,7 +673,7 @@ compstring(firstchar,string1,string2,i) capstring(0,string2,i); } -_caseify(c,i) +char _caseify(c,i) char c; int i; { @@ -677,10 +681,8 @@ _caseify(c,i) else return (c); } -caseify(c) - char c; -{ _caseify(c,0); } - -caseify1(c) +char caseify(c) char c; -{ _caseify(c,1); } +{ + return _caseify(c,0); +}