home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Fred Fish Collection 1.5
/
ffcollection-1-5-1992-11.iso
/
ff_progs
/
prt_util
/
spew.lzh
/
SPEW
/
README
< prev
next >
Wrap
Text File
|
1991-08-16
|
3KB
|
75 lines
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 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 ).