From 9edc0e612e98d4c563155a8fc2d96f27f4815831 Mon Sep 17 00:00:00 2001 From: joey Date: Tue, 7 Aug 2001 01:01:01 +0000 Subject: [PATCH] * Woo hoo! JWZ has placed newspeak under a BSD-ish license, so it moves in from filters-nonfree. Which is now empty, and will be removed. * Added studly caps filter by Nick Phillips . --- Makefile | 18 +- debian/TODO | 2 +- debian/changelog | 8 + debian/control | 9 +- debian/copyright | 30 +++ filters.6 | 10 +- jibberish | 11 +- newspeak.l | 686 +++++++++++++++++++++++++++++++++++++++++++++++ studly | 14 + 9 files changed, 762 insertions(+), 26 deletions(-) create mode 100644 newspeak.l create mode 100755 studly diff --git a/Makefile b/Makefile index 1d8cbc5..e80d129 100644 --- a/Makefile +++ b/Makefile @@ -2,25 +2,25 @@ LEX = flex -ALL = jethro kraut cockney jive nyc ken ky00te -OTHER = eleet b1ff chef jibberish upside-down rasterman +BUILD = jethro kraut cockney jive nyc ken ky00te newspeak +OTHER = eleet b1ff chef jibberish upside-down rasterman studly -all: $(OTHER) $(ALL) +all: $(OTHER) $(BUILD) -install: $(ALL) $(OTHER) +install: $(BUILD) $(OTHER) install -d $(PREFIX)/usr/games - install $(ALL) $(OTHER) $(PREFIX)/usr/games/ + install $(BUILD) $(OTHER) $(PREFIX)/usr/games/ install -d $(PREFIX)/usr/share/man/man6 install -m 0644 filters.6 $(PREFIX)/usr/share/man/man6 cd $(PREFIX)/usr/share/man/man6 && \ - $(foreach prog,$(ALL) $(OTHER),ln -s filters.6 $(prog).6;) + $(foreach prog,$(BUILD) $(OTHER),ln -s filters.6 $(prog).6;) -samples: $(ALL) $(OTHER) +samples: $(BUILD) $(OTHER) -rm -f SAMPLES - PATH=.:$$PATH; export PATH; echo $(ALL) $(OTHER) |xargs -n 1 sh makesample.sh + PATH=.:$$PATH; export PATH; echo $(BUILD) $(OTHER) |xargs -n 1 sh makesample.sh clean: - $(RM) -f core *.o *~ $(ALL) *.c SAMPLES + $(RM) -f core *.o *~ $(BUILD) *.c SAMPLES cd ky00te.dir && make clean .SUFFIXES: .l diff --git a/debian/TODO b/debian/TODO index 09845a3..053a6de 100644 --- a/debian/TODO +++ b/debian/TODO @@ -1,3 +1,3 @@ * censor filter (should be easy) * continue to make the chef filter more similar to the old one -* write more filters +* write and collect more filters diff --git a/debian/changelog b/debian/changelog index e891299..a46f423 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +filters (2.20) unstable; urgency=low + + * Woo hoo! JWZ has placed newspeak under a BSD-ish license, so it moves + in from filters-nonfree. Which is now empty, and will be removed. + * Added studly caps filter by Nick Phillips . + + -- Joey Hess Mon, 6 Aug 2001 20:38:49 -0400 + filters (2.19) unstable; urgency=low * Fixed jibberish makesamples run to not use installed versions of the diff --git a/debian/control b/debian/control index 7609864..1e2946c 100644 --- a/debian/control +++ b/debian/control @@ -3,13 +3,14 @@ Section: games Priority: optional Build-Depends: debhelper (>= 2.1.0), flex, bison | byacc | btyacc Maintainer: Joey Hess -Standards-Version: 3.5.5.0 +Standards-Version: 3.5.6.0 Package: filters Architecture: any -Conflicts: filters-nonfree (<< 2.7) -Replaces: filters-nonfree (<< 2.7) +Conflicts: filters-nonfree +Replaces: filters-nonfree Depends: ${shlibs:Depends} Description: a collection of filters, including B1FF and the swedish chef A collection of filters to do all sorts of strange things to text. - This includes such favorites as B1FF and the swedish chef. + This includes such favorites as B1FF and the swedish chef, and a wide + range of others. diff --git a/debian/copyright b/debian/copyright index deaa623..0942180 100644 --- a/debian/copyright +++ b/debian/copyright @@ -71,3 +71,33 @@ Edwards, confirmed the new copyright in this email: Everything else is copyright 1999-2001 by Joey Hess, under the terms of GPL. The full text of the GNU GPL can be found in /usr/share/common-licenses/GPL on Debian systems. + +The newspeak filter is now relicensed under a BSD-like copyright. Its +author, Jamie Zawinski, established the new copyright in this email: + + From: Jamie Zawinski + Date: Mon, 06 Aug 2001 16:17:02 -0700 + To: Joey Hess + Subject: Re: copyright of newspeak filter + + Hey there -- I'm cleaning out old mail, and don't remember if I replied + to this or not. Anyway, in case I didn't -- feel free to slap this + license atop the newspeak script (it's BSD-like, so that should work + for you.) + + 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. + +The studly filter is copyright Nick Phillips and +has the following license statement: + +# just for reference, you may do whatever you like with this file. + diff --git a/filters.6 b/filters.6 index a88c170..aa36a3d 100644 --- a/filters.6 +++ b/filters.6 @@ -1,6 +1,6 @@ .TH FILTERS 6 .SH NAME -ken, b1ff, chef, cockney, eleet, jethro, jibberish, jive, kraut, ky00te, nyc, rasterman, upside-down \- assorted text filters +ken, b1ff, chef, cockney, eleet, jethro, jibberish, jive, kraut, ky00te, newspeak, nyc, rasterman, studly, upside-down \- assorted text filters .SH SYNOPSIS $SHELL | chef .SH "DESCRIPTION" @@ -31,10 +31,14 @@ Generates text with a German accent. .IP ky00te This program places a very cute (and familiar to FurryMuck fans) accent on any text file. +.IP newspeak +A-la-1984 .IP nyc Brooklyn English .IP rasterman Makes text look like it came from the keyboard of Carsten Haitzler. +.IP studly +Studly caps. .IP upside-down Flips text upside down. Stand on your head and squint to read the output. .SH "SEE ALSO" @@ -46,4 +50,6 @@ Hess . Daniel V Klein wrote the cockney, jive, and nyc filters. jibberish is by Raul Miller , jethro is by Duane Paulson , rasterman is by Zachary Beane, ken is by -Stephen K Mulrine and kraut is by John Sparks. +Stephen K Mulrine , newspeak is authored by Jamie Zawinski +, studly is by Nick Phillips , and +kraut is by John Sparks. diff --git a/jibberish b/jibberish index 9271ef2..d5197b8 100644 --- a/jibberish +++ b/jibberish @@ -16,19 +16,10 @@ nyc ken ky00te rasterman -); - -@nonfree= qw( newspeak +studly ); -# Test to see if non-free filters are here, if so, add them to @all. -foreach (@nonfree) { - if (-x "/usr/games/$_") { - push @all, $_; - } -} - # shuffle order srand; for (0..$#all) { diff --git a/newspeak.l b/newspeak.l new file mode 100644 index 0000000..67b2c5e --- /dev/null +++ b/newspeak.l @@ -0,0 +1,686 @@ +%{ -*- Mode:Fundamental -*- +/* + * newspeak.l, version 1.1. + * Lex filter to transform plain English into NewSpeak. + * 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. + * + * Permissiom granted for noncommercial use and redistribution. + * To compile: + * + * flex newspeak.l + * cc -O -o newspeak lex.yy.c + * rm lex.yy.c + * + * This must be compiled with "flex", not normal "lex". Lex has + * some builtin, unchangable 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. + * + * You can get 'flex' by anonymous FTP to prep.ai.mit.edu, or + * anywhere else you get GNU software. + * + * Run this like so: "newspeak < some-text-file | more" + * + * There are some design notes near the end. Suggestions and + * improvements to this code are more than welcome. + * Hail Big Brother! + *--------------------------------------------------------------------------- + */ +#include + +unsigned int fcounter = 0; + +#define Y0 yytext[0] +#define Y1 yytext[1] +#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) + +#define COMP(string1,string2) compstring(0, (string1),(string2),0) +#define WCOMP(string1,string2) compstring(Y0,(string1),(string2),1) + +#define DUMP() printf("%s",yytext) +%} + +%e 8000 +%p 9000 +%n 2000 +%k 3000 +%a 5000 +%o 4000 + +W (([ ]?\n[ ]*)|[ ]|[\"'`]) +ES [.,;:!?/] +EW ({W}|{ES}|"'") + +YOUNG (([Yy]oung|[Ss]mall|[Ll]ittle){W}) +DEAD (([Dd]ead|[Dd]eceased){W}) +THE ([Tt]he{W}?) +ANDOR ({W}(([Aa]nd)|([Oo]r)){W}?) +COLOR (red|green|blue|yellow|cyan|magenta|purple|orange|mauve|pink|turquoise|brown|gr[ae]y) + +%% + +%{ + /****************************** + * PLUSwords * + ******************************/ +%} + +[Qq]uite{EW}/[A-Za-z][A-Za-z] CAP("plus"); +[Rr]ather{EW}/[A-Za-z][A-Za-z][A-Za-z] CAP("plus"); +[Kk]ind{EW}of{EW}/[A-Za-z][A-Za-z][A-Za-z] CAP("plus"); +[Kk]inda{EW}/[A-Za-z][A-Za-z][A-Za-z] CAP("plus"); +[Mm]ore{W}than{W}a{W}(little|bit){W} CAP("plus"); +[Pp]ro- CAP("plus"); + +[Hh]undreds{W}of{W}[Tt]housands | +[Hh]undreds{ANDOR}[Tt]housands | +[Hh]undreds{W}if{W}not{W}[Tt]housands | +[Tt]housands | +[Mm]illions CAP("doubleplusmany"); + +[Dd]ozens CAP("many"); +[Hh]undreds CAP("plusmany"); + +([Bb]right|[Ll]ight|[Ii]ntense){W}/{COLOR} CAP("plus"); +([Dd]im|[Ff]aded|[Dd]ark|[Pp]ale){W}/{COLOR} CAP("plusun"); +([Dd]im|[Ff]aded|[Dd]ark|[Pp]ale) CAP("unlight"); + +[Ee]very DUMP(); +[Vv]ery{W} | +[Rr]eally{W} | +[Tt]erribly{W} | +[Aa]wesome({W})? | +[Aa]wfully{W} CAP("doubleplus"); + +[Ww]hopping{EW} CAP("plusbig"); + +"O.K." | +[Aa]ll({W})?[Rr]ight | +[Oo][Kk][Aa][Yy] CAP("plusgood"); +{W}OK/{W} WCAP("plusgood"); + +([Tt]oo|[Oo]verly|[Tt]hat){W}[Mm]uch CAP("plusmuch"); + +{W}[Bb]ad/{EW} WCAP("ungood"); +{W}[Pp]oor/{EW} WCAP("ungood"); +{W}[Ll]ame/{EW} WCAP("ungood"); +{W}[Pp]itiful/{EW} WCAP("ungood"); +{W}[Nn]asty/{EW} WCAP("plusungood"); +{W}[Hh]orrid/{EW} WCAP("doubleplus ungood"); +{W}[Hh]orrible/{EW} WCAP("doubleplus ungood"); +{W}[Aa]wful/{W} WCAP("doubleplus ungood"); +{W}[Ee]vil/{W} WCAP("doubleplus ungood"); + +%{ + /****************************** + * Titles * + ******************************/ +%} + +{W}[Ss]ir/{EW} WCAP("citizen"); +{W}[Mm]r"."/{EW} WCAP("brother"); +[Mm]ister/{EW} CAP("brother"); +[Mm]adame? CAP("sister"); +{W}[Mm]iss/{EW} WCAP("sister"); +[Mm]a"'"?am/{EW} CAP("sister"); +{W}[Mm]r?s"."/{EW} WCAP("sister"); +Mrs/{EW} CAP("sister"); + +{YOUNG}?[Cc]hildren CAP("young citizens"); +{YOUNG}?[Bb]oys{ANDOR}[Gg]irl/s CAP("young citizens"); +{YOUNG}?([Kk]id|[Gg]irl|[Bb]oy|[Cc]hild)/{EW} CAP("young citizen"); + +[Ff]ellow CAP("citizen"); + +[Nn]on{W}?"-"?citizen CAP("unperson"); +[Nn]on{W}?"-"?member CAP("unperson"); +[Cc]riminal/s? CAP("unperson"); +{DEAD}(man|woman) CAP("unperson"); +{DEAD}(men|women) CAP("unpersons"); + +[Ii]n{W}[Pp]erson DUMP(); + +{W}[Uu]ser WCOMP("party ","worker"); +[Ss]tudent COMP("party ","worker"); +[Cc]itizen/s?{EW} COMP("party ","worker"); +[Pp]erson/s?{EW} COMP("party ","worker"); +[Pp]eople COMP("party ","workers"); + +[Ss]enator | +[Cc]ongressman | +[Ss]upervisor | +[Pp]rofessor printf("Inner Party Member"); +[Pp]rof"."/{EW} printf("Inner Party Member"); +[Pp]rof/{EW} printf("Inner Party Member"); + +Representative/s? printf("Inner Party Member"); +representatives printf("Inner Party Members"); + +[Ww]hite{W}[Cc]ollar | +[Uu]pper{W}[Cc]lass COMP("inner ","party"); +[Mm]iddle{W}[Cc]lass CAP("party"); +[Bb]lue{W}[Cc]ollar | +[Ww]orking{W}[Cc]lass | +[Ll]ower{W}[Cc]lass CAP("prole"); +([Ff]ool|[Ii]diot)/s?{EW} CAP("prole"); +[Ss]tupidity CAP("proleness"); + +%{ + /****************************** + * Organizations * + ******************************/ +%} + +[Aa]?{W}([Ww]hite{W}[Hh]ouse|[Gg]ovt\.?|[Gg]overnment){W}([Ss]ource|[Oo]fficial|[Ss]pokes(man|woman|person)) CAP("an Inner Party Member"); +{THE}?[Rr]epublican{W}[Pp]arty COMP("mini","luv"); +{THE}?[Dd]emocratic{W}[Pp]arty COMP("mini","plenty"); + +{THE}?Congress printf("MiniPax"); +{THE}?[Ss]enate printf("MiniPax"); +{THE}?[Hh]ouse{W}[Oo]f{W}[Rr]epresentatives printf("MiniPax"); +{THE}?[Ss]tate{W}[Dd]epartment printf("MiniPax"); +{THE}?[Ss]tate{W}[Dd]ept"."? printf("MiniPax"); +{THE}?[Dd]efen[cs]e{W}[Dd]epartment | +{THE}?[Dd]efen[cs]e{W}[Dd]ept"."? | +{THE}?[Ww]ar{W}[Dd]epartment | +{THE}?[Ww]ar{W}[Dd]ept"."? | +{THE}?[Hh]ouse{W}of{W}[Cc]ommons | +{THE}?Pentagon | +{THE}?[Ff]eds | +{THE}?FCC | +{THE}?D[Oo]D | +{THE}"D."[Oo]".D." | +{THE}?[Ss]ecret{W}[Ss]ervice COMP("mini","luv"); +{THE}?White{W}House | +{THE}?Kremlin printf("MiniTrue"); +{THE}?(CIA|NSA|FBI|MI"-"?5)/{EW} printf("MiniTrue"); +{THE}?("C.I.A."|"N.S.A."|"F.B.I.")/{EW} printf("MiniTrue"); +{THE}?[Aa]rchive/s? COMP("mini","rec"); +{THE}?[Ll]ibrary COMP("mini","rec"); +{THE}?[Ll]ibraries COMP("mini","recs"); + +[Tt]hought{W}[Pp]olice|[Nn]azis? COMP("think","pol"); +[Vv]ice{W}[Ss]quad COMP("sex","pol"); +PMRC|"P.M.R.C." COMP("sex","pol"); + +[Oo]fficer CAP("minister"); + +{THE}?[Dd]epartment{EW}of{EW}. | +{THE}?[Dd]ept"."?{EW}of{EW}. | +{THE}?[Uu]niversity{EW}of{EW}. | +{THE}?[Uu]niv"."?{EW}of{EW}. | +{THE}?[Dd]ept"."?{EW}of{EW}. | +{THE}?([Ss]ub"-"?)?[Cc]omm?itt?ee{EW}(of|on){EW}. | +{THE}?[Ss]chool{EW}of{EW}. { + if ((yytext[yyleng-1] >= 'A') && (yytext[yyleng-1] <= 'Z')) + /* "the school of Law" --> "MiniLaw" */ + printf("Mini%c",yytext[yyleng-1]); + else if ((yytext[yyleng-1] >= 'a') && (yytext[yyleng-1] <= 'z')) + /* "the school of law" --> "MiniLaw" (not "Minilaw") */ + printf("Mini%c",yytext[yyleng-1] - ('a' - 'A')); + /* "the school of 5 things" --> "Ministry of 5 things" */ + else printf("Ministry of %c",yytext[yyleng-1]); + } + +[Dd]epartment | +[Uu]niversity CAP("ministry"); +[Uu]niv"."?/{W} CAP("ministry"); +[Dd]ept"."?/{W} CAP("ministry"); +([Ss]ub"-"?)?[Cc]omm?itt?ee CAP("ministry"); + +{THE}[Pp]roject/{EW} CAP("the Three Year Plan"); +[Oo]ur{W}[Pp]roject/{EW} CAP("our Three Year Plan"); +[Bb]udget printf("Three Year Plan"); +[Pp]roject/{ES} printf("Three Year Plan"); + +{W}({THE}|([aa]{W}))[Pp]roject printf("%cthe Three Year Plan",Y0); + +[A-Za-z]+"'"[Ss]/{W}(law|Law|LAW|book|Book|BOOK|rule|Rule|RULE){EW} printf("Goldstein's"); + +%{ + /****************************** + * Actions * + ******************************/ +%} + +[Ii]n{W}love{EW} CAP("SexCriming"); +[Ll]ove{W}you/{EW} CAP("love Big Brother"); +[Ll]ove{W}me/{EW} CAP("love Big Brother"); + +[Cc]loning | +[Rr]eproduction | +[Cc]elibacy | +[Pp]rocreation COMP("good","sex"); + +[Cc]elibate | +[Pp]rocreate COMP("good","sexwise"); + +[Tt]elevisions? | +TVs? | +[Tt]"."[Vv]"."s? | +[Rr]adios? | +[Nn]ews{W}?[Pp]apers? | +[Jj]ournalism | +[Mm]ovies? | +[Rr]ock{EW}?"-"?(and|"&"|"'"?n"'"?){EW}?"-"?[Rr]oll({W}[Mm]usic)? | +(([Rr]ock|[Cc]lassical|[Ii]ndustrial|[Pp]op|[Dd]ance|[Rr]ap){W})?[Mm]usic | +[Tt]unes | +[Mm]oney | +[Cc]ash | +[Cc]omic{W}[Bb]ooks? | +([Ss]tar{W}?)?[Tt]rek COMP("prole","feed"); + +[Pp]eace{W}[Mm]ovement | +[Pp]eace{W}[Pp]rotest | +[Aa]nti{EW}[Ww]ar | +([Pp]assive{W})?[Rr]esistance | +[Cc]reativity | +[Tt]reason | +[Rr]esearch COMP("crime","think"); +%{ + /****************************** + * Religion * + ******************************/ +%} + +[Jj]esus{W}[Cc]hrist | +[Jj]esus | +{THE}?[Bb]uddh?a | +[Mm]ohamm?ed | +[Mm]artin{W}[Ll]uther{W}[Kk]ing | +J\.?\ ?R\.?\ \"?Bob\"?\ Dobbs printf("doubleplus crimethinker"); + +([Jj]esse{W})?[Hh]elms | +([RrDd]on(ald)?{W})?[Rr]ea?gan | +[Gg]eorge{W}[Gg]uscoria printf("doubleplus goodthinker"); + +[Jj]ewish COMP("crime","thinkwise"); +[Jj]ew | +[Cc]hristian | +[Mm]oslem | +[Bb]uddhist | +[Aa]thiest | +[Aa]gnostic COMP("crime","thinker"); + +[Ff]aith COMP("belly","feel"); + +%{ + /****************************** + * Places * + ******************************/ +%} + +[Ee]ngland|{THE}?[Uu]nited{W}[Kk]ingdom | +({THE}?[Uu]nited{W}[Ss]tates{W}[Oo]f{W})?[Aa]merica | +{THE}?[Uu]nited{W}[Ss]tates|USA|"U.S.A."|[Cc]anada | +[Gg]ermany|[Ii]srael|[Ee]urope printf("Oceana"); + +Iranian|Iraqu?i|Libyan|Russian|African|Egyptian printf("Eurasian"); +Iran|Iraq|Libya|Russia|Africa|Egypt | +([Ss]audi{W})?Arabia|{THE}?Soviet{W}Union printf("Eurasia"); +[Ss]oviet printf("Eurasian"); + +[Cc]hinese|[Jj]apanese|[Tt]aiwanese | +[Pp]hillipino|[Ii]ndian|[Aa]ustralian|[Mm]exican | +[Nn]icaraguan|[Ss]alvadori?an printf("Eastasian"); +China|[Jj]apan|[Tt]aiwan|{THE}?[Pp]hillipines|[Ii]ndia | +[Aa]ustralia|[Mm]exico|[Nn]icaragua|[Ee]l{W}[Ss]alvador printf("Eastasia"); + +[Kk]uwaiti printf("Eurasian"); +[Kk]uwait printf("The Malabar Front"); + +%{ + /****************************** + * Miscelaneous Translations * + ******************************/ +%} + +{W}[Ff]aster WCAP("plus speedful"); +{W}[Ss]lower WCAP("plus unspeedful"); +{W}[Ff]ast WCAP("speedful"); +{W}[Ss]low WCAP("unspeedful"); + +[Mm]odern CAP("plusnew"); +[Aa]ncient CAP("plusunnew"); +{W}old/{W} WCAP("plusunnew"); + +[Hh]appiness CAP("joyfulness"); +[Hh]appy CAP("joyful"); +[Qq]uick CAP("speedful"); +{W}[Ss]peedy WCAP("speedful"); +[Hh]eavy CAP("weightful"); +[Hh]eavill?y CAP("weightfully"); +[Ss]ick(ly)? CAP("unhealthful"); + +[Gg]ross | +[Ss]ickening | +[Ff]oul | +[Pp]utrid | +[Dd]isgusting COMP("crime","thinkful"); + +[Ss]mash | +[Cc]rush | +[Oo]bliterate | +[Aa]nnihilate | +[Nn]eutralize | +[Dd]emolish | +[Dd]estroy CAP("unbuild"); + +[Ii]nanimate CAP("unlifeful"); +[Ss]ociety|[Cc]ulture printf("IngSoc"); +[A-Za-z]+isi?m/{EW} printf("Goldsteinism"); +[A-Za-z]+ist/{EW} printf("Goldsteinist"); + +{W}[Dd]ead WCAP("unlifeful"); +{W}[Dd]eath WCAP("unlife"); +{W}[Ll]ie WCAP("untruth"); +{W}[Ff]alsehood WCAP("untruth"); +{W}[Mm]istake/{EW} WCAP("untruth"); +{W}[Ww]hisper WCAP("unshout"); +{W}[Pp]roud WCAP("prideful"); + +[Ff]alse CAP("untrue"); +[Dd]ark CAP("unlight"); +[Bb]lack CAP("unwhite"); +[Ff]orbidden CAP("unallowed"); +[Ff]orbid CAP("unallow"); +[Ff]ailure CAP("unsuccess"); +[Ff]ail/{EW} CAP("unwin"); + +[Ss]tatistics?/{EW} CAP("propaganda"); +{W}[Aa]n{W}[Aa]nn?ouncement WCAP("a NewsFlash"); +[Aa]nn?ouncement printf("NewsFlash"); +[Ii]nstructions? printf("B. B. DayOrder"); + +[Aa]lmost|[Nn]early CAP("within measurable distance of"); +[Ff]unny CAP("humorful"); + +[Dd]oom CAP("unsave"); +[Cc]haos CAP("unorder"); +[Cc]haotic CAP("unorderful"); +[Ee]nslaved CAP("protected"); +[Ee]nslave CAP("protect"); +[Dd]angerous CAP("unsafewise"); +[Dd]anger CAP("unsafe"); +([Bb]lind{W})?[Oo]bedience COMP("ing","soc"); +\"?[Nn]ew{W}[Ww]orld{W}[Oo]rder\"? printf("IngSoc"); + +[Pp]rivacy | +[Ii]ndividuality COMP("own","life"); + +IMHO printf("for the love of Big Brother"); + +[Ee]motion(al|s)? | +[Cc]onviction | +[Bb]elie(f|ve) | +[Aa]ccept(ance)? COMP("belly","feel"); + +[Dd]emocracy | +[Ll]iberty | +[Ff]reedom | +[Jj]ustice | +{THE}?[Aa]merican{W}[Ww]ay | +[Ss]ubversion | +[Pp]assion COMP("crime","think"); + +[Oo]bscenity | +[Pp]ornography | +[Oo]rgasm | +[Ee]rotica COMP("sex","crime"); +[Ss]exy | +[Oo]bscene | +[Pp]ornographic | +[Ee]rotic COMP("sex","crimeful"); + +[Cc]ritic/s?{W} COMP("crime","thinker"); + +[Ii]nfant{W}[Mm]ortality COMP("inf","mort"); + +[Ff]amilies | +[Pp]arents COMP("family ","units"); +[Mm]other{ANDOR}[Ff]ather | +[Bb]rother{ANDOR}[Ss]ister COMP("family ","unit"); +{W}[Pp]arent/s?{EW} WCOMP("family ","unit"); +[Ff]amily COMP("family ","unit"); + +God/{EW} printf("Big Brother"); +[Pp]res(ident|".")({W}([Bb]ush|[Rr]eagan))? printf("Big Brother"); +[Pp]rime{W}[Mm]inister printf("Big Brother"); + +([Gg][Nn][Uu]{W}([Ee]macs|EMACS){W})?[Gg]eneral{W}[Pp]ublic{W}[Ll]icense printf("NewSpeak Dictionary"); + +(questioning|murder|ass?ass?ination)/{ES} printf("interrogation"); + +[Ss]keptic/{EW} CAP("unperson"); +[Ss]illy CAP("foolhardy"); +{W}[A-Za-z][A-Za-z]?illy DUMP(); +[Ss]outhern|[Ss]outherly CAP("southwise"); +[Nn]orthern|[Nn]ortherly CAP("northwise"); +[Ee]astern|[Ee]easterly CAP("eastwise"); +[Ww]estern|[Ww]esterly CAP("westwise"); +[Pl]leasant CAP("goodwise"); +[Vv]iolent CAP("unpeacewise"); +[Vv]iolence CAP("unpeaceness"); +[Ii]ndifference CAP("uncarefulness"); +[Ii]ndifferent CAP("uncareful"); +[Bb]elly CAP("abdomen"); +[Cc]omic CAP("humorwise"); +{W}[Uu]nless WCAP("lest"); +usually printf("usualwise"); + +[Gg]uerillas COMP("party ","workers"); + +[Ww]ar/{EW} CAP("engagement"); +[Dd]efen[cs]e/{EW} CAP("peace"); +[Ii]nvasion CAP("liberation"); + +%{ + /****************************** + * Syllable Rewriting * + ****************************** + isn't ___ is un___ + not the ___ the un___ + not my ___ my un___ + anti___ un___ (etc...) + ___cally ___wise + ___ally ___wise + ___lly ___wise + ___ly ___wise + ___aic ___wise + ___lic ___wise + ___nnic ___wise + tric ___wise + ___ic ___wise + ous ___ful + ous ___eful + ___less un___ful + + */ +%} + +[Ii]sn"'"t{W}my{W} CAP("is my un"); +[Ii]s{W}not{W}my{W} CAP("is my un"); +[Ii]sn"'"t{W}[Tt]he{W} CAP("is the un"); +[Ii]s{W}not{W}[Tt]he{W} CAP("is the un"); +[Ii]sn"'"t{W}[Ii]n{W}[Tt]he{W} CAP("is in the un"); +[Ii]s{W}not{W}[Ii]n{W}[Tt]he{W} CAP("is in the un"); +[Ii]t"'"?s{W}not{W}[Tt]he{W} CAP("it's the un"); +[Ii]sn"'"t{W} CAP("is un"); +[Ii]s{W}not{W} CAP("is un"); +[Nn]ot{W}[Tt]he{W} CAP("the un"); +[Nn]ot{W}[Mm]y{W} CAP("my un"); +[Nn]ot{W}[Aa]{W} CAP("an un"); +[Nn]ot{W}have{W} CAP("has un"); +[Nn]ot{W}be{W} CAP("be un"); +[Nn]ot{W}[Oo]nly/{W} CAP("unonly"); /* avoid "unonwise" */ + +[Aa]{W}[Nn]ot{W} | +[Aa]{W}[Nn]on"-"? printf("%cn%cun",Y0,Y1); /* "a non_" -> "an un_" */ + +%{ +/* {W}[Nn]ot{W} | */ +%} +{W}[Ii]l"-"?/[a-z][a-z] WCAP("un"); +{W}[Aa]nti"-"? | +{W}[Nn]on"-"? WCAP("un"); + +robably|ventually|[Oo]bvious|[Bb]asic|{W}[Oo]nly|otally | +[Aa]rctic|holic|{EW}ally|{EW}[Aa]pply|{W}[Tt]opic DUMP(); + +{W}([Tt]raf|[Pp]aci|[Ss]peci)fi/c{W} DUMP(); +{W}(ma|tra)gi/c{W} DUMP(); +{W}(pub|cyc|re|fro|gar)li/c{W} DUMP(); +{W}(eth|cli|to)ni/c{W} DUMP(); +{W}(E|cle|met|cit)ri/c{W} DUMP(); +{W}(ch|ep|tr?op|t|mus|stat|att)i/c{W} DUMP(); +{W}only/{W} DUMP(); +{W}[Aa]tlantic DUMP(); + +[ \t\n][drstwDRSTW]ally printf("%c%cally", Y0, Y1); + +[a-z]ically/{W} printf("%cwise", Y0); +[a-z]ally/{W} printf("%cwise", Y0); +[a-z][a-z]lly/{W} printf("%c%cwise", Y0,Y1); +[a-z][a-z][a-z]ly/{W} printf("%c%c%cwise", Y0,Y1,Y2); +[a-z]ical/{W} printf("%cwise", Y0); + +[a-km-qs-z]aic/{EW} printf("%cwise", Y0); /* not laic, raic */ +[a-z]lic/{EW} printf("%clwise", Y0); +[a-z]nnic/{EW} printf("%cnwise", Y0); +[a-z][aeiou]tric/{EW} printf("%c%ctwise", Y0, Y1); +[a-z]tric/{EW} printf("%cwise", Y0); +[a-z]ic/{EW} printf("%cwise", Y0); +[a-z]lly/{EW} printf("%cwise", Y0); +[a-z]ly/{EW} printf("%cwise", Y0); + +[aeiouy][^aeiouy]ous/{EW} printf("%c%cful",Y0,Y1); +[^aeiouy]ous/{EW} printf("%ceful",Y0); +[^e]ous/{EW} printf("%cful",Y0); + +[A-Za-z]+less/{EW} { yytext[yyleng-4] = '\0'; + if (((yytext[1] < 'A') || (yytext[1] > 'Z')) && + (yytext[0] >= 'A') && (yytext[0] <= 'Z')) + yytext[0] = yytext[0] - ('a' - 'A'); + printf("%cn%sful",C('u'), yytext); + } + +". " { printf("%s",yytext); + fcounter &= 15; + 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",Y1,yytext+2); + +. printf(yytext); +\n printf("\n"); + +%{ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Brief description of Orwell's NewSpeak: + * --------------------------------------- + * Each word was made to serve as noun, verb, adjective and adverb. In + * particular, nouns and verbs were made exactly the same -- hence "think" + * replaced "thought" as a noun (viz. "crimethink" = thought crime, "thinkpol" + * = thought police). Adjectives were formed by adding "-ful" to a noun/verb; + * adverbs were formed by adding "-wise." Hence "speedful" = fast, + * "speedwise" = quickly, "unspeedwise" = slowly. + * + * The decision on which word should be negated was made fairly randomly; + * "dark" could be "unlight," or "light" could be "undark". But in all cases + * the most important objective (aside from ideological restriction) was + * euphony; the words had to be easily pronounceable. + * + * Most verb inflections were made regular; "he thinked," "he goed," "he + * eated"; only the auxiliaries and modals (to be, to have, may, shall, will, + * etc.) were allowed to inflect irregularly. Plurals were also regularized: + * "mans," "oxes," "childs." [This isn't implemented here.] + * + * There were three sets of words. The A vocabulary was for everyday use: + * car, man, red, good, etc. It was restricted to fairly simple words. + * + * The B vocabulary consisted of political/ideological words with very + * complicated connotations. All of the B words were compound words -- + * bellyfeel (blind emotional acceptance of the ideology), oldthink (the way + * of thought before the Revolution), crimethink, Ingsoc, goodsex (intercourse + * solely for the purpose of making babies and with no physical enjoyment on + * the part of the female), sexcrime (any kind of sex but goodsex, including + * sex for its own sake), goodthink (thinking in accordance with Ingsoc), and + * so on. These words were also subject to the modifications mentioned + * above--hence "goodthinker," "goodthinkful," "goodthinkwise." + * + * The C vocabulary consisted of scientific and technical words (though there + * was no longer any word for "science," any connotation it might have being + * subsumed into "Ingsoc"). + * + * Implementing a translator for all of this would be really complicated -- + * I'd need rather extensive lists of the "irregular" words (so they could be + * regularized), as well as lists of politically meaningful words (so they + * could be excised or translated into either "goodthink" or "crimethink," as + * appropriate). Any kind of sexual topic should become "sexcrime" (it being + * unlikely that any talk of sex these days would fit into "goodsex"). + * + * Basically, the reason it's hard is that NewSpeak was intended to *decrease* + * the vocabulary, and subsume complicated ideas into politically correct + * words so that you wouldn't have to understand the ideas anymore; you'd just + * have to emit the right words. So to properly "translate" anything into + * NewSpeak, you have to cut the vocabulary way down. + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + */ +%} + +%% +main() +{ + yylex(); + printf("\nHail Big Brother!\n"); +} + + +capstring(firstchar,string,i) + char firstchar, *string; + int i; +{ + if (firstchar != 0) putchar(firstchar); + putchar( (yytext[i] <= 'Z') ? (string[0] - ' ') : string[0]); + printf("%s",string+1); +} + +compstring(firstchar,string1,string2,i) + char firstchar, *string1, *string2; + int i; +{ + capstring(firstchar,string1,i); + capstring(0,string2,i); +} + +_caseify(c,i) + char c; + int i; +{ + if (yytext[i] <= 'Z') return (c - ' '); + else return (c); +} + +caseify(c) + char c; +{ _caseify(c,0); } + +caseify1(c) + char c; +{ _caseify(c,1); } diff --git a/studly b/studly new file mode 100755 index 0000000..8e69d9b --- /dev/null +++ b/studly @@ -0,0 +1,14 @@ +#!/usr/bin/perl + +# stUdLy cAPs, after emacs studly.el -- the commented line is just +# to remind diehards how it *should* be done ;) +# +# just for reference, you may do whatever you like with this file. +# +# -- nwp@lemon-computing.com + +for (my $offset = 0; defined(my $c = getc); $offset++) { +# (($c + $offset) % 4) == 2 and print (ord($c) ^ 32) or print($c); + (($c + $offset) % 4) != 2 and print($c) or $c =~ tr/[A-Za-z]/[a-zA-Z]/, print $c; +} + -- 2.39.2