X-Git-Url: http://git.ieval.ro/?p=filters.git;a=blobdiff_plain;f=newspeak.l;h=4883d40cc62bdb933960f86076f67bf342b8614e;hp=e291f6d9d7b4321c43afe62b59de03dd41401777;hb=HEAD;hpb=7e3afbbacdd24f8c3fb87599eeda32b977fe6d6c diff --git a/newspeak.l b/newspeak.l index e291f6d..4883d40 100644 --- a/newspeak.l +++ b/newspeak.l @@ -2,8 +2,16 @@ /* * newspeak.l, version 1.1. * Lex filter to transform plain English into NewSpeak. - * Copyright (c) 1991 Jamie Zawinski . - * Permission granted for noncommercial use and redistribution. + * Copyright (c) 1991 Jamie Zawinski . + * + * Permission to use, copy, modify, distribute, and sell this + * software and its documentation for any purpose is hereby granted + * without fee, provided that the above copyright notice appear in + * all copies and that both that copyright notice and this + * permission notice appear in supporting documentation. No + * representations are made about the suitability of this software + * for any purpose. It is provided "as is" without express or + * implied warranty. * * To compile: * @@ -12,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. * @@ -35,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) @@ -44,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 @@ -337,7 +350,7 @@ China|[Jj]apan|[Tt]aiwan|{THE}?[Pp]hillipines|[Ii]ndia | %{ /****************************** - * Miscelaneous Translations * + * Miscellaneous Translations * ******************************/ %} @@ -575,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"); %{ @@ -636,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; { @@ -652,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; { @@ -660,7 +673,7 @@ compstring(firstchar,string1,string2,i) capstring(0,string2,i); } -_caseify(c,i) +char _caseify(c,i) char c; int i; { @@ -668,10 +681,8 @@ _caseify(c,i) else return (c); } -caseify(c) +char caseify(c) char c; -{ _caseify(c,0); } - -caseify1(c) - char c; -{ _caseify(c,1); } +{ + return _caseify(c,0); +}