CookieDoc.tioga
Spreitzer, May 6, 1985 8:16:42 pm PDT
Cookie
CEDAR 6.0 — FOR INTERNAL XEROX USE ONLY
Cookie
Mike Spreitzer
© Copyright 1985 Xerox Corporation. All rights reserved.
Abstract: Cookie provides fortune cookies
Keywords: Fortune, Cookie, Saying, Addage, Do It, Quote, Snippet, Command
XEROX  Xerox Corporation
   Palo Alto Research Center
   3333 Coyote Hill Road
   Palo Alto, California 94304

For Internal Xerox Use Only
1. Cookie
Cookie implements one command-tool command: Cookie. It gives you 1 cookie, and sets up the command tool to gratuitously give you a cookie every 10th command on the average. Of course, the numbers are variable.
name Cookie
syntax
Cookie ([<keyword> [= | ← | ~ | :]] <value>)*
Possible keyword-value pairs are:
Probability : <real number in [0, 1]> (defaut 0.1)
Initial : <integer> (default 1)
If the keyword is omitted, the first argument is taken to be the Probability; the second, the Initial.
description
This is the fortune cookie program. It prints fortunes in the command tools from which it was invoked. At the time of invocation, it prints a number of fortunes given by "Initial". Thereafter, after every command, it will print an additional fortune, with the given probability.
Parameters that are not given in the command are taken from the UserProfile (with names "Cookie.<keyword>"). If not found there, the indicated defaults are used.
The cookies are loaded from the list of files given in UserProfile entry "Cookie.Sources". The files are looked for in the directory which was current when Cookie was run. The cookies may be given relative weights. To do this, precede a filename token with a real number token; all the cookies in subsequent files get that same weight (unless overridden). For example, to weight each cookie by the inverse of the number of cookies in its file, you could say:
Cookie.Sources: 8.0E-4 Almond.Cookies 1.2E-3 Legal.Cookies 2.9E-3 Doit.LOTS 1.6E-2 Snippets
The default token list of Cookie.Sources is
Almond.Cookies Legal.Cookies Doit.LOTS Snippets Dans.Cookies
The files should contain rope literals separated by white space. For each data file, Cookie maintains an index file, whose name is the name of the data file, followed by ".Index".
Cookie is enabled by a Boolean User Profile entry named "Cookie.Enabled" (defaults to FALSE).
installation
Do a bringover, enable Cookie in your profile, then issue the Cookie command:
% cd ///Commands/
% Bringover -p [Indigo]<Cedar5.1>Top>Cookie.DF
... edit profile to include:
Cookie.Enabled: TRUE
% cd ///Foo/
% PrintSearchRules
(... ///Commands/ ...)
% Cookie ...
examples
Ask for a fortune after, on the average, every other command (and none initially)
% Cookie 0.5 0
% date
Friday, January 27, 1984 3:45 pm
% date
Friday, January 27, 1984 3:45 pm
Stop searching forever. Happiness is unattainable.
%
Ask to be bothered no more, after receiving one fortune:
% Cookie 0 Initial = 1
A truly wise man never plays leapfrog with a Unicorn.
warnings
You may not like the cookies.
stop/undo
Impossible
implementation
Cookie.Mesa, from Cookie.DF
contact
Spreitzer