X-Git-Url: http://git.ieval.ro/?p=filters.git;a=blobdiff_plain;f=cockney.l;h=180068dff8b183e79858f3eb15ef01279986a141;hp=f6d0ad202958460041f56bb34a2264b86406019f;hb=3627d06a62ddb3b5e1adbf67a6e3b480b5fd0c01;hpb=fb5da53f9aebccc37fa1aea6b6939fbbcb9ad659 diff --git a/cockney.l b/cockney.l index f6d0ad2..180068d 100644 --- a/cockney.l +++ b/cockney.l @@ -15,21 +15,24 @@ EW [ \t.,;!\?$] %Start junk -%% +%option noyywrap %{ - void eos() { - if (yytext[yyleng-1] == '.') - dintI(); - else - unput(yytext[yyleng-1]); - } - - void plastc() { - unput(yytext[yyleng-1]); - } +#include +void eos(void); +void plastc(void); +char caseify(char); +void I(void); +void bloody(void); +void set_did(short); +void clear_did(void); +void dintI(void); +void pooped(void); +void expletive(void); %} +%% + . { srandom(time(0L)); unput(yytext[0]); BEGIN 0; } {BW}[Tt]he{EW} { ECHO; bloody(); } {BW}[Ss]teal{EW} { printf("%c%cick",yytext[0],yytext[1]-5); @@ -103,7 +106,20 @@ ime{EW} { printf("oime"); eos(); } %% -caseify(c) +void eos() +{ + if (yytext[yyleng-1] == '.') + dintI(); + else + unput(yytext[yyleng-1]); +} + +void plastc() +{ + unput(yytext[yyleng-1]); +} + +char caseify(c) char c; { if (yytext[0] <= 'Z') @@ -113,7 +129,7 @@ char c; } -I() +void I() { /* extern long random(); */ @@ -126,7 +142,7 @@ I() static short b_count = 0; static short b_which = 0; -bloody() +void bloody() { if (b_count++ % 2 == 0) { switch (b_which++ % 4) { @@ -140,17 +156,18 @@ bloody() static short did = 0; -set_did(val) +void set_did(val) +short val; { did = val; } -clear_did() +void clear_did() { did = 0; } -dintI() +void dintI() { /* extern long random(); */ @@ -163,7 +180,7 @@ dintI() clear_did(); } -pooped() +void pooped() { /* extern long random(); */ @@ -180,7 +197,7 @@ pooped() } } -expletive() +void expletive() { /* Blimey