Path: utzoo!utgpu!watmath!att!ucbvax!tut.cis.ohio-state.edu!bloom-beacon!bu-cs!bucsb!bear From: bear@bucsb.UUCP (Blair M. Burtan) Newsgroups: alt.sources Subject: Spew - The headline generator Message-ID: <3033@bucsb.UUCP> Date: 8 Aug 89 16:43:17 GMT Reply-To: bear@bucsb.UUCP (Blair M. Burtan) Organization: Boston Univ Comp. Sci. Lines: 720 #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh manual.spew <<'END_OF_manual.spew' XINPUT FILE FORMAT: X XThe file is a series of class definitions followed by an end Xmarker. The end marker is a line containing only "%%". X XA class definition begins with a line containing '%' followed by a class Xname. Class names can be any length and can consist of any combination Xof upper and lower case letters, and numbers. X XThe lines following are instances of the class, one per line. When a Xclass is invoked, one of these is picked at random. Most characters in Xthe line are just copied to the output. The newline at the end is not Xcopied. An instance may be continued onto the next line by ending the Xline with '\'. There is a limit of 1000 bytes on the total size of an Xinstance. An instance may begin with '%' if it is escaped: '\%'. A Xnewline may be written as '\!'. A backslash may be written as '\\'. X XThe following is a simple rules-file that prints out either 'foo' Xor bar, followed by a carriage-return: X X%MAIN Xfoo\! Xbar\! X%% X XThe program generates a random instance of the class 'MAIN', which in Xthis case selects 'foo' or 'bar', with a 50-50 chance. A newline is Xappended. X X WEIGHTS X XTo give 'foo' a 90% chance of happening, you can assign weights: X X%MAIN X(9)foo\! Xbar\! X%% X XThe weight of 'bar' is 1 by default. If an instance is to begin with '(' Xit must be escaped, or given an explicit weight: X X\(animal) X(1)(vegetable) X X INVOCATION X XClasses are normally invoked by writing their name immediately after a Xbackslash. Below is a rules-file which is equivalent to the foo-bar Xexample: X X%MAIN X\word\! X%word X(9)foo Xbar X%% X XIn this case, the class 'word' outputs either 'foo' or 'bar', and Xthe newline is appended after the invocation in 'MAIN'. X XIf you wish to immediately follow a class invokation by a letter or a number, Xyou must write it followed by a slash and a space: X X%MAIN X\word/ bar\! X%word Xfoo Xbar X%% X XThe above outputs either 'foobar' or 'barbar'. This method must also Xbe used if the invokation is to be immediately followed by a slash. X X VARIANTS X XA class may be defined with variants, and may then be invoked with Xvariants. The 's' variant defined for the 'fruit' class below Xallows correct plurals to be generated: X X%fruit{s} Xapple{s} Xcherr{yies} Xpear{s} Xmango{es} X%MAIN XOne \fruit and two \fruit/s.\! X%% X XThe variant tag is a single letter or number. In an invocation, the Xclass name is followed by a slash which is followed by the tag. Every Xclass has a 'null' variant (tagged by a space) by default (thus the "/ " Xnotation). X XIn the class definition line, the class name is followed by a list Xof variant tags in curly brackets. The order of the tags is Xsignificant. X XIn an instance definition, variants may be created with the following Xnotation: X { <1st-variant-text> <2nd-variant-text } X XWhen a class is invoked with a null tag, or with a blank tag, the Xtext before the first '' is used. If the first tag is used in the Xinvocation (i.e. the first tag listed in {}'s in the class definition), Xthe text between the first and second 's is used, and so forth. All Xtext not in {}'s is copied regardless of the tag used. X XThere are normally as many 's in these as there are tags defined. XIf there are too many tags, the excess ones select null strings, and Xif there are too many 's, the excess strings are redundant. X XThe '{' character, if required literally, must always be escaped Xoutside the selector construction: '\{', even when no variants are Xdefined in a class. The '' and '}' characters must likewise be Xescaped inside a constructor. X XInvocations may appear in a selector, but cannot span a selector. XI.e. you cannot select between invoking 'catwalk' and 'catfish' by X X \cat{walkfish} X XYou must use {\catwalk\catfish}. X XFinally, there is the & tag which may be used in an invocation and Xselects the same tag letter (or number) which the invoking Xclass was invoked with: X X%food{s} X\fruit/& <--- this is the same as X{\fruit\fruit/s} <--- this. X XMAIN is initially invoked with the null tag (although it can be invoked Xrecursively with other tags). X XHere is a class with multiple tags that generates irregular verbs: X X%verb{sd} X{eateatsate} X{beiswas} X{seeseessaw} Xlook{sed} Xf{indindsound} X%% X XThus \verb/d generates a past-tense verb. X X COMMENTS: X XAt any point, '\*' may appear on a line and the rest of the line Xis ignored. Blank lines are ignored completely ( as are lines Xbeginning in \* ). XEmpty instances must therefore be given an explicit weight of one: X X%AllOrNothing\* 50% chance, 'All', or nothing. XAll X(1) X END_OF_manual.spew if test 4545 -ne `wc -c spew.uu <<'END_OF_spew.uu' Xbegin 644 spew.c XM+RH*("H@4U!%5RY#"B`J+PHC:69N9&5F(&QI;G0*7)I9VAT(#$Y.#<@1W)E9R!3;6ET:"(L"B(@(%!E2`H*3L*(V1E9FEN92!I;F1E>"!S=')C:'(*(V1E9FEN XM92!R:6YD97@@'1E'1E"!S:7IE(&]F(&EN<'5T(&QI;F4@*B\*(V1E9FEN92!-05A$148@,3`P,`D) XM+RH@;6%X(",@8GET97,@:6X@82!D969I;FET:6]N("HO"B`*+RH@1&5F:6YE XM('1H92!D969A=6QT(')U;&5S9FEL92`J+PH@"B-I9FYD968@1$5&1DE,10HC XM(&1E9FEN92!$149&24Q%(")H96%D;&EN92(*(V5N9&EF"B`*+RH@1&5F:6YE XM('1H92!E;G9I'1E'0@*B\*?2!D969N.PID969N("IP7,@9F]L;'=E9"!B XM>2!A('9APH):6YT('=E:6=H=#L)+RH@=&]T86P@ XM=V5I9VAT(&]F(&1E9FEN:71I;VYS(&EN(&-L87-S("HO"@ED969N("IL:7-T XM.PDO*B!L:7-T(&]F('1H96T@*B\*"6-H87(@*FYA;64["2\J(&YA;64@;V8@ XM=&AI2`](#$[ XM"FEN="!#;VUP26X@/2!&04Q313L)+RH@:7,@:6YP=70@9FEL92!I;B!C;VUP XMPH)8VAAPH)"0EC7V9L86<@ XM/2!44E5%.R`)+RH@)V-O;7!R97-S)R!O<'1I;VX@*B\*"0D)+2UAPH)"0ED7V9L86<@/2!44E5%.PDO*B`G9'5M XM<"<@;W!T:6]N("HO"@D)"2TM87)G8SL*"0D)*RMAPH)"6EF*"!#;VUP26X@*2!S<')I;G1F*"!M86EN7V-L87-S+"`B)60O("(L XM($-O;7!-86EN*3L*"0EE;'-E"2`@("`@PH)"7)E861C;VUP*"D["2\J(')E860@8V]M<')E'0H*3L*"7T*?0IR96%D=&5X="@I>PH)&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PH)+RI.3U1214%#2$5$*B\*?0HC:69D968@1%5-4`ID=6UP*"E[ XM"@ER96=IR5S XM?2`E9#I<;B(L:2`L8W`M/G1A9W,L(&-P+3YW96EG:'0@*3L*"0EE;'-E"@D) XM"7!R:6YT9B@B)7,L('LEPH)"69P5QN(BD["@D)97AI="@Q*3L*"7T*"7)E XM='5R;B!P.PI]"B`*+RH*("H@=W)I=&4@=&AE(&9I;&4@=&\@=&AE('-T86YD XM87)D(&]U='!U="!I;B!C;VUPPH)"6-P(#T@;&]O:W5P*")-04E.+R`B*3L) XM"2\J(&=E="!M86EN("HO"@D):68H(&-P(#T]($Y53$P@*7L*"0D)9G!R:6YT XM9BAS=&1E'0["@E]"@EP=71W*"!N+"!S=&1O=70@*3L)+RH@=W)I=&4@=&AE(&-O XM=6YT(&]F('1H96T@*B\*"61P(#T@8W`M/FQIPH)"6-O;7!D968H9'`I.PH)"61P(#T@9'`M/FYE>'0["2\J(&-O XM;7!R97-S('1H96T@*B\*"7T*?0IC;VUP9&5F*&1P*0IR96=IPH)PDO*B!A(')E9B`J+PH)"0D)8VQAPH)"0D)"69PPH)"0D)"7!R:6YT9B@B)6,E9"(L($)3 XM3$%32"P@8W`M0VQAPD)+RH@:7,@97-C87!E('-E<2`J+PH)"0D) XM<'5T8VAAPH)PH)"61P(#T@*&1E9FX@*BEM>5]A;&QO XM8R@@*'5N2`I"G)E9VES XM=&5R(&-H87(@*G=H97)E.PIR96=I`H@"G!U XM='<@*'=OPH) XM9G=R:71E("@H8VAAheadline.uu <<'END_OF_headline.uu' Xbegin 644 headline XM7"H@3F%T:6]N86P@16YQ=6ER97(@2&5A9&QI;F5S+@I<*@HE4U!)4DE454%, XM"E-P:7)I='5A;`I#;&%I6%N=`I496QE<&%T:&EC"E1E;&5K:6YE=&EC XM"B5214Q!5$E610I&871H97(*56YC;&4*1W)A;F1F871H97(*1W)A;F1M;W1H XM97(*4V]N"D1A=6=H=&5R"DUO=&AE<@I!=6YT"E!O0HE XM5T5!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(*)41% XM040*7$9$14%$"EQ-1$5!1`HE14%4>W-D?0I[96%T?&5A='-\871E?0IK:61N XM87![?'-\<&5D?0I[=&%K97QT86MEWQS?&5D?0ID979O XM=7)[?'-\961]"FUA:6U[?'-\961]"FEN:G5R97M\WQS?&1] XM"B5305E[WQS?0I2979E86Q[?'-]"EPJ061M:71[?'-]"D-L86EM XM>WQS?0I);G-I6-H;VQO9VES='M\WQS?0I0:'ES:6-I XM86Y[?'-]"DYE=7)O;&]G:7-T>WQS?0I$96YT:7-T>WQS?0I0961I871R:6-I XM86Y[?'-]"E9E=')I;F%R:6%N>WQS?0I/<'1I8VEA;GM\WQS?0I0:'ES XM:6-IWQS?0I%;F=I;F5EWQS?0I0WQS?0I"WQS?0I!22!%>'!EWQS?&5D XM?0I-=71I;&%T97M\2U<3E5-0D52,0I&;W)T>2U<3E5-0D52,0I&:69T>2U<3E5-0D52,0I3 XM:7AT>2U<3E5-0D52,0I3979E;G1Y+5Q.54U"15(Q"D5I9VAT>2U<3E5-0D52 XM,0I.:6YE='DM7$Y534)%4C$*)4Y534)%4C$*5'=O"E1H'1E96X*4V5V96YT XM965N"D5I9VAT965N"DYI;F5T965N"B5&3T]$>V%]"GM\82!]5&%C;PHH-2E< XM1E)5250O)@I[?&%N('U%;F-H:6QA9&$*>WQA('U"=7)R:71O"GM\82!]5V%T XM97)M96QO;@I[?&$@?51R:7!L92!)8V4@0W)E86T@0V]N90I[?&$@?51O65R>WQS?0I[ XM36%N?$UE;GT*5V]M>V%N?&5N?0I45B!097)S;VYA;&ET>WE\:65S?0I'86UE XM(%-H;W<@2&]S='M\6QV86YI80I4:6UE7=O;V0*1&%Y=&]N82!"96%C XM:`I386QT($QA:V4@0VET>0I-:7-S:7-S875G80I-86IO2!"92!);G9O;'9E9`HE4%)/3T8*7%!(3U1/"EQ02$]4 XM3PHN7"$@+2T@7$Y!5$E/3D%,2519(%Q30TE%3E1)4U0O2!<4D5,051)5D4@5&\@1&5A=&@@ XM5VET:"!<5T5!4$].+V$B("TM(%Q015)33TX*7%!%4E-/3B!';V5S($)E0I<3E5-0D52(%EE87)S($9O2!!8W%U:70@3F]T;W)I;W5S(%Q714%03TX@375R9&5R97(@1G)O XM;2!<4$Q!0T4*7$U#14Q%0B!A;F0@7$9#14Q%0B!3965N(%1O9V5T:&5R(&EN XM(%Q03$%#12X@(DES($ET($QO=F4_(@I<4$524T].+R`G2!<0D%"62(L(%Q305DO"!#:&%N9V4*(DD@06T@ XM5&AE(%)E:6YC87)N871I;VX@;V8@7$9$14%$(BP@7%-!62]S(%Q&0T5,14(* XM(DD@06T@5&AE(%)E:6YC87)N871I;VX@;V8@7$U$14%$(BP@7%-!62]S(%Q- XM0T5,14(*7%-#245.5$E35"]S($1I