home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
OL.LZH
/
PROGS.LZH
/
FARB2.ICN
< prev
next >
Wrap
Text File
|
1991-07-13
|
2KB
|
56 lines
############################################################################
#
# Name: farb2.icn
#
# Title: Generate Farberisms
#
# Author: Alan Beale
#
# Date: April 1, 1990
#
############################################################################
#
# Dave Farber, co-author of the original SNOBOL programming
# language, is noted for his creative use of the English language.
# Hence the terms ``farberisms'' and ``to farberate''. This pro-
# gram produces a randomly selected farberism.
#
# Notes: Not all of the farberisms contained in this program were
# uttered by the master himself; others have learned to emulate
# him. A few of the farberisms may be objectionable to some per-
# sons. ``I wouldn't marry her with a twenty-foot pole.''
#
############################################################################
#
# This program obtains its farberisms from the farber.sen file to
# allow additional farberisms to be added without recompilation or
# straining the limits of the Icon translator. It builds an index file
# farber.idx to allow for efficient access to the sentences file. The
# use of untranslated I/O for the index file is necessary for correct
# behavior on some systems (e.g., MVS).
#
############################################################################
procedure main(argv)
local f, ix, n
f := open("farber.sen", "r") | stop("*** cannot open \"farber.sen\"")
if not (ix := open("farber.idx", "ru")) then {
ix := open("farber.idx", "bcu")
n := 0;
repeat {
writes(ix, left(where(f), 10))
if not read(f) then break
n +:= 1
}
seek(ix, -10)
writes(ix, left(n, 10))
}
seek(ix, -10)
&random := map(&clock, ":", "8") +
map(reverse(&date[3:0]), "/", "5")
seek(ix,10*(?numeric(reads(ix,10))-1))
seek(f,numeric(reads(ix,10)))
write(read(f))
end