home *** CD-ROM | disk | FTP | other *** search
- A while back, mark@pixar posted a program to generate random 'National
- Enquirer' headlines. This program worked from a 'rules file' which was a text
- file describing how the headlines would be constructed.
-
- Mark's program was, unfortunately, highly non-portable, and rather than
- try to salvage it I wrote a new interpreter for the same text file.
- Since then I have added several features, and thus greatly changed the
- format of the rules file. Credits go to mark for the original concept
- and much of the text in the supplied rulesfile ( which I have cleaned up
- and added to ).
-
- This shar includes the National Enquirer rules-file 'headline', the
- MAD rock concert rulesfile 'madrock.sp', the Sci-Fi plot rulesfile
- 'sifi.sp', the source to the 'spew' interpreter, a 'manual' for the
- format of the control file, and this READ_ME file. I believe this
- program might actually be useful, for such tasks as generating huge
- quantities of input text for testing programs. ( I may have a
- file which generates random syntactically-correct C code, but I
- won't admit to it!! :-). The format of the file allows a wide variety of text
- formats to be generated - it almost works like Yacc in reverse.
- Anyway, things like 'festoon' could certainly be coded as 'spew' rulesfiles,
- and could thus be sent to the net as a 'spew' source.
- Sorry I haven't written a proper manual page, but...
-
- USAGE:
- spew [n] generate one [or n] random thing(s) from default
- rulesfile. If the environment variable RULESFILE
- is set, the file-name is taken from there; other-
- wise a compiled-in name is used ( see Installation
- instructions ).
-
- spew [n] file Same, but use the given file as input.
-
- spew -c
- or spew -c file 'Compress' the default or given file to the
- standard output (the compressed format is unreadable
- and must be redirected). 'Compress' is a misnomer
- because the file gets about 20% larger. The
- 'compressed' format is more efficient for spew to
- operate from, though. Spew automatically knows
- whether it is reading a compressed or human-readable
- rulesfile. Examples:
- spew headline << make a headline
- spew -c headline >headline.comp << make compressed file
- spew headline.comp << make another headline
-
- spew -d
- spew -d file Read the default or given file, and dump the
- resulting internal structure to the std output.
- The format is pretty easy to figure out. It is
- somewhat different when the input file is in
- 'compressed' format. DUMP must be #define'd
- to enable this feeping creature.
-
-
- INSTALLATION INSTRUCTIONS:
- The file spew.c contains some clearly labeled #defines which you may
- want to play with. It should be possible to port to non-Un*x systems
- just by changing these. The most important ones to start with are:
-
- DEFFILE which is the default rules file to use. Set this to the path
- of your 'headline' file and then you can just put 'spew' in your
- .login.
- ENVIRON which is set to "RULESFILE" in the release package. If this
- environment variable is set, it is assumed to be a default file-name
- over-riding the DEFFILE. You may want to change this.
- Remove the #define if you don't have getenv().
- SETRAND
- ROLL(n) define the former to a STATEMENT (not an expression) which
- initializes your random number generator. Define the latter as
- an expression which gives a random integer in the range 0<=i<n.
- 'n' will be an integer from 1 to several hundred.
- The supplied definitions may or may not work well, depending
- on your machine (here we have a VAX 11/780 4.2BSD, works ok
- on a Sun too ).
-
- -------------------------------------------------------------------------
- Notes of modification:
-
- I have modified the source to make it compilable under DOS on an IBM-PC
- with Borland Turbo C. It is still compilable under UNIX, just make sure
- the #define DOS is commented out. It should compile just fine with
- Microsoft C v4.0/v5.x, but I have not tried it.
- -- Ti Kan --
- -------------------------------------------------------------------------
- I modified Ti Kan's version to include the \PRUNE pseudoclass (described
- above) and to break output lines on word boundaries (which could
- concievably hurt some uses, but I've never seen a spewfile for
- anything but humor text). It should still compile everywhere it used
- to ( :-) ); if setjmp/longjmp is not available then #define PRUNE can
- be commented out.
- William Lewis (phelliax)
- wiml@milton.u.washington.edu
- -------------------------------------------------------------------------
- echo shar: "a missing newline was added to 'readme'"
-