home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-08-31 | 31.6 KB | 1,027 lines |
- Newsgroups: comp.sources.misc
- From: David F. Skoll <dfs@doe.carleton.ca>
- Subject: v22i082: thought - A replacement for 'fortune', Patch02
- Message-ID: <1991Aug30.214945.7856@sparky.IMD.Sterling.COM>
- X-Md4-Signature: c1c0a05e504c8c382331edb56ed6a686
- Date: Fri, 30 Aug 1991 21:49:45 GMT
- Approved: kent@sparky.imd.sterling.com
-
- Submitted-by: David F. Skoll <dfs@doe.carleton.ca>
- Posting-number: Volume 22, Issue 82
- Archive-name: thought/patch02
- Environment: UNIX
- Patch-To: thought: Volume 21, Issue 23-24
-
- This is Official Patch #2 for Thought. You should previously have
- applied Patch#1 so that your current version is 1.0 (PL 1). To see
- the current version, type "thought -v".
-
- To apply the patch, change the the Thought source directory and unshar
- this file. Type "patch < Patch02", and re-make and re-install Thought.
-
- What this shar does:
-
- o Includes a new control file (rap.rc) for generating rap songs.
-
- o Causes Thought not to "re-use" words in a given sentence.
-
- o Allows you to give words identifiers so they WILL be re-used if
- you so desire. This allows you to create long passages which
- consistently use previous words. For example:
-
- {defsent Don't touch the {n:a}! {N:a;plural} are bad!}
-
- could result in:
-
- "Don't touch the dog! Dogs are bad!"
- "Don't touch the tooth! Teeth are bad!" (etc)
-
- o Certain spelling errors and bugs in thought.rc are fixed. Also
- adds past tense of verbs, and a couple of new sentence definitions.
-
- o The thoughtfile.man man page is updated.
-
- --
- David F. Skoll
-
- -------------- Cut Here ---------- Cut Here ---------- Cut Here -------------
- #!/bin/sh
- # This is Thought 1.0 Patch 2, a shell archive (shar 3.32)
- # made 08/29/1991 14:51 UTC by dfs@wesley
- # Source directory /enterprise/transporter/dfs/work/.thought/v1.0.2
- #
- # existing files will NOT be overwritten
- #
- # This shar contains:
- # length mode name
- # ------ ---------- ------------------------------------------
- # 27303 -rw------- Patch02
- # 1226 -rw------- rap.rc
- #
- if touch 2>&1 | fgrep 'amc' > /dev/null
- then TOUCH=touch
- else TOUCH=true
- fi
- # ============= Patch02 ==============
- if test X"$1" != X"-c" -a -f 'Patch02'; then
- echo "File already exists: skipping 'Patch02'"
- else
- echo "x - extracting Patch02 (Text)"
- sed 's/^X//' << 'SHAR_EOF' > Patch02 &&
- X#
- X# Add the rap.rc file to Makefile's MANIFEST variable
- X#
- X*** ../v1.0.1/Makefile Mon Aug 26 10:31:50 1991
- X--- ./Makefile Thu Aug 29 10:10:21 1991
- X***************
- X*** 59,67 ****
- X #--------------- SHOULDN'T CHANGE STUFF BELOW HERE ---------------
- X
- X #Version of THOUGHT
- X! VERSION= 1.0.1
- X
- X! MANIFEST= Makefile README examples protos.h st.rc thought.c thought.man thought.rc thoughtfile.man version.h insult.rc new-user.rc buzzword.rc
- X
- X all: thought.c protos.h version.h
- X $(CC) $(HAVE_RANDOM) $(NO_STRDUP) $(NO_STRICMP) -DLIBPATH=\"$(LIBDIR)\" -DFILE_DEFAULT=\"$(GRAMFILE)\" -o thought thought.c
- X--- 59,67 ----
- X #--------------- SHOULDN'T CHANGE STUFF BELOW HERE ---------------
- X
- X #Version of THOUGHT
- X! VERSION= 1.0.2
- X
- X! MANIFEST= Makefile README examples protos.h st.rc thought.c thought.man thought.rc thoughtfile.man version.h insult.rc new-user.rc buzzword.rc rap.rc
- X
- X all: thought.c protos.h version.h
- X $(CC) $(HAVE_RANDOM) $(NO_STRDUP) $(NO_STRICMP) -DLIBPATH=\"$(LIBDIR)\" -DFILE_DEFAULT=\"$(GRAMFILE)\" -o thought thought.c
- X#
- X# Update README
- X#
- X*** ../v1.0.1/README Mon Aug 26 10:43:49 1991
- X--- ./README Thu Aug 29 10:42:19 1991
- X***************
- X*** 20,26 ****
- X And you're on your way! To create your own grammar files, read the
- X man page for "thoughtfile".
- X
- X! I have supplied five grammar files:
- X
- X 'thought.rc' produces generally demented sayings.
- X
- X--- 20,26 ----
- X And you're on your way! To create your own grammar files, read the
- X man page for "thoughtfile".
- X
- X! I have supplied a few grammar files:
- X
- X 'thought.rc' produces generally demented sayings.
- X
- X***************
- X*** 31,37 ****
- X
- X 'insult.rc' generates childish insults
- X
- X! 'new-user' generates messages designed to panic new Unix users.
- X
- X --
- X David F. Skoll (dfs@doe.carleton.ca)
- X--- 31,40 ----
- X
- X 'insult.rc' generates childish insults
- X
- X! 'new-user.rc' generates messages designed to panic new Unix users.
- X!
- X! 'rap.rc' creates dumb rap songs. (But probably no dumber than the
- X! commercial ones.)
- X
- X --
- X David F. Skoll (dfs@doe.carleton.ca)
- X#
- X# Update protos.h - change the structure of a tag to make it possible
- X# not to "re-use" words. Also add a structure for holding words which
- X# have identifiers so we can find them again. Add the prototype declaration
- X# for InitializeTags
- X#
- X*** ../v1.0.1/protos.h Mon Aug 26 10:39:34 1991
- X--- ./protos.h Mon Aug 26 15:03:48 1991
- X***************
- X*** 28,35 ****
- X {
- X struct tag *next;
- X char *def;
- X! Word *wordlist;
- X! int numwords; /* Number of words with this tag definition */
- X } Tag;
- X
- X /* Define the structure of a sentence */
- X--- 28,37 ----
- X {
- X struct tag *next;
- X char *def;
- X! Word *wordlist; /* List of words for this tag */
- X! Word *realword; /* Real start of list */
- X! int numwords; /* Number of words unpicked with this tag definition */
- X! int realnum; /* Total number of words with this definition */
- X } Tag;
- X
- X /* Define the structure of a sentence */
- X***************
- X*** 40,45 ****
- X--- 42,55 ----
- X char *def;
- X } Sentence;
- X
- X+ /* Define the structure of "identified" words */
- X+ typedef struct ident
- X+ {
- X+ struct ident *next;
- X+ char *def;
- X+ Word *w;
- X+ } Ident;
- X+
- X /* ARGH! Our stupid header files don't give prototype for getenv! */
- X #ifdef __STDC__
- X char * getenv(char *);
- X***************
- X*** 71,76 ****
- X--- 81,87 ----
- X #ifdef NO_STRICMP
- X int stricmp(const char *s1, const char *s2);
- X #endif
- X+ void InitializeTags(void);
- X #else
- X Tag * FindTag();
- X char * FindModifier();
- X***************
- X*** 95,98 ****
- X--- 106,110 ----
- X #ifdef NO_STRICMP
- X int stricmp();
- X #endif
- X+ void InitializeTags();
- X #endif
- X#
- X# Add a third set of "token separators" so we don't barf if parsing a colon
- X# within a word definition. Increase the sizes of various system buffers.
- X# Add the {reuse} command. Add code for identifiers and non-reusing of words.
- X# Add code to handle "\n" escape sequence in sentence definitions.
- X#
- X*** ../v1.0.1/thought.c Mon Aug 26 11:15:09 1991
- X--- ./thought.c Thu Aug 29 10:16:13 1991
- X***************
- X*** 64,72 ****
- X
- X #define UPPER(c) ( ((c) >= 'a' && (c) <= 'z') ? (c) - ('a' - 'A') : (c) )
- X
- X! char *SEP1="{}=;,";
- X! char *SEP2="{}=;, \n\t";
- X
- X /* The global data structures - a singly-linked list of tags
- X and a singly-linked list of sentence definitions. */
- X
- X--- 64,76 ----
- X
- X #define UPPER(c) ( ((c) >= 'a' && (c) <= 'z') ? (c) - ('a' - 'A') : (c) )
- X
- X! #define iseow(c) (isspace(c) || (c) == '\\')
- X
- X+ char *SEP1="{}=:;,";
- X+ char *SEP2="{}=:;, \n\t";
- X+ char *SEP3="{}=;,";
- X+
- X+
- X /* The global data structures - a singly-linked list of tags
- X and a singly-linked list of sentence definitions. */
- X
- X***************
- X*** 73,85 ****
- X Tag *TagList = NULL;
- X int NumTags = 0;
- X
- X Sentence *SentenceList = NULL;
- X int NumSentences = 0;
- X
- X! char Buffer[1024]; /* Temp buffer - big for sentence definitions */
- X! char Mod[32]; /* Temp buffer to hold current modifier */
- X! char Token[200]; /* Another temp. buffer for various stuff */
- X! char FileName[256]; /* Resolved filename */
- X /***************************************************************/
- X /* */
- X /* ReadChar */
- X--- 77,92 ----
- X Tag *TagList = NULL;
- X int NumTags = 0;
- X
- X+ char ReUse = 0; /* Should we re-use words? */
- X+
- X Sentence *SentenceList = NULL;
- X int NumSentences = 0;
- X
- X! char Buffer[8192]; /* Temp buffer - big for sentence definitions */
- X! char Mod[32]; /* Temp buffer to hold current modifier */
- X! char Identifier[96]; /* Temp buffer to hold current identifier */
- X! char Token[200]; /* Another temp. buffer for various stuff */
- X! char FileName[256]; /* Resolved filename */
- X /***************************************************************/
- X /* */
- X /* ReadChar */
- X***************
- X*** 241,248 ****
- X exit(1);
- X }
- X new->next = TagList;
- X! new->wordlist = (Word *) NULL;
- X new->numwords = 0;
- X TagList = new;
- X NumTags++;
- X new->def = strdup(Buffer);
- X--- 248,256 ----
- X exit(1);
- X }
- X new->next = TagList;
- X! new->realword = (Word *) NULL;
- X new->numwords = 0;
- X+ new->realnum = 0;
- X TagList = new;
- X NumTags++;
- X new->def = strdup(Buffer);
- X***************
- X*** 334,369 ****
- X char *s;
- X Word *new;
- X
- X! s = ReadToken(SEP1, fp, NULL);
- X
- X while(1) {
- X! if (strchr(SEP1, *s)) {
- X fprintf(stderr, "Illegal word definition: %s\n", s);
- X exit(1);
- X }
- X strcpy(Buffer, s);
- X! s = ReadToken(SEP1, fp, NULL);
- X while (*s == ';') { /* Collect modifiers */
- X strcat(Buffer, s);
- X! s = ReadToken(SEP1, fp, NULL); /* Modifier name */
- X strcat(Buffer, s);
- X! if (strchr(SEP1, *s)) {
- X fprintf(stderr, "Illegal word definition: %s\n", s);
- X exit(1);
- X }
- X! s = ReadToken(SEP1, fp, NULL); /* equals sign */
- X strcat(Buffer, s);
- X if (*s != '=') {
- X fprintf(stderr, "Illegal word definition: %s\n", s);
- X exit(1);
- X }
- X! s = ReadToken(SEP1, fp, NULL); /* Definition */
- X strcat(Buffer, s);
- X! if (strchr(SEP1, *s)) {
- X fprintf(stderr, "Illegal word definition: %s\n", s);
- X exit(1);
- X }
- X! s = ReadToken(SEP1, fp, NULL);
- X }
- X if (*s != ',' && *s != CRIGHT) {
- X fprintf(stderr, "Illegal word definition: %s%s\n", Buffer, s);
- X--- 342,377 ----
- X char *s;
- X Word *new;
- X
- X! s = ReadToken(SEP3, fp, NULL);
- X
- X while(1) {
- X! if (strchr(SEP3, *s)) {
- X fprintf(stderr, "Illegal word definition: %s\n", s);
- X exit(1);
- X }
- X strcpy(Buffer, s);
- X! s = ReadToken(SEP3, fp, NULL);
- X while (*s == ';') { /* Collect modifiers */
- X strcat(Buffer, s);
- X! s = ReadToken(SEP3, fp, NULL); /* Modifier name */
- X strcat(Buffer, s);
- X! if (strchr(SEP3, *s)) {
- X fprintf(stderr, "Illegal word definition: %s\n", s);
- X exit(1);
- X }
- X! s = ReadToken(SEP3, fp, NULL); /* equals sign */
- X strcat(Buffer, s);
- X if (*s != '=') {
- X fprintf(stderr, "Illegal word definition: %s\n", s);
- X exit(1);
- X }
- X! s = ReadToken(SEP3, fp, NULL); /* Definition */
- X strcat(Buffer, s);
- X! if (strchr(SEP3, *s)) {
- X fprintf(stderr, "Illegal word definition: %s\n", s);
- X exit(1);
- X }
- X! s = ReadToken(SEP3, fp, NULL);
- X }
- X if (*s != ',' && *s != CRIGHT) {
- X fprintf(stderr, "Illegal word definition: %s%s\n", Buffer, s);
- X***************
- X*** 379,389 ****
- X fprintf(stderr, "Memory allocation error for word: %s\n", Buffer);
- X exit(1);
- X }
- X! new->next = tag->wordlist;
- X! tag->wordlist = new;
- X! tag->numwords++;
- X if (*s == CRIGHT) return 0;
- X! s = ReadToken(SEP1, fp, NULL);
- X }
- X }
- X
- X--- 387,397 ----
- X fprintf(stderr, "Memory allocation error for word: %s\n", Buffer);
- X exit(1);
- X }
- X! new->next = tag->realword;
- X! tag->realword = new;
- X! tag->realnum++;
- X if (*s == CRIGHT) return 0;
- X! s = ReadToken(SEP3, fp, NULL);
- X }
- X }
- X
- X***************
- X*** 485,490 ****
- X--- 493,507 ----
- X }
- X s = ReadToken(SEP2, fp, NULL);
- X if (! stricmp(s, "deftag")) DefTag(fp);
- X+ else if (! stricmp(s, "reuse")) {
- X+ ReUse = 1;
- X+ s = ReadToken(SEP2, fp, NULL);
- X+ if (*s != CRIGHT) {
- X+ fprintf(stderr, "Expecting %c, found %s\n", CRIGHT, s);
- X+ fclose(fp);
- X+ exit(1);
- X+ }
- X+ }
- X else if (! stricmp(s, "defsent")) DefSent(fp);
- X else {
- X t = FindTag(s);
- X***************
- X*** 518,527 ****
- X char *mod;
- X char ch;
- X Tag *tag;
- X! Word *w;
- X int i;
- X char upper;
- X
- X out = Buffer;
- X *out = 0;
- X
- X--- 535,547 ----
- X char *mod;
- X char ch;
- X Tag *tag;
- X! Word *w, *prevw;
- X int i;
- X char upper;
- X+ Ident *identifiers = NULL;
- X+ Ident *id;
- X
- X+ InitializeTags(); /* Initialize all the tags, etc. */
- X out = Buffer;
- X *out = 0;
- X
- X***************
- X*** 534,539 ****
- X--- 554,562 ----
- X }
- X tok = ReadToken(SEP1, NULL, &sd);
- X if (*tok >= 'A' && *tok <='Z') upper = 1; else upper = 0;
- X+
- X+ /* Save the token name in case it needs an identifier */
- X+ strcpy(Identifier, tok);
- X tag = FindTag(tok);
- X if (!tag) {
- X fprintf(stderr, "Unknown tag %s in sentence definition\n%s\n", tok, sen->def);
- X***************
- X*** 540,549 ****
- X exit(1);
- X }
- X tok = ReadToken(SEP1, NULL, &sd);
- X! if (*tok != ';' && *tok != CRIGHT) {
- X fprintf(stderr, "Illegal tag usage in %s\n", sen->def);
- X exit(1);
- X }
- X if (*tok == ';') {
- X tok = ReadToken(SEP1, NULL, &sd);
- X strcpy(Mod, tok);
- X--- 563,584 ----
- X exit(1);
- X }
- X tok = ReadToken(SEP1, NULL, &sd);
- X! if (*tok != ';' && *tok != CRIGHT && *tok != ':') {
- X fprintf(stderr, "Illegal tag usage in %s\n", sen->def);
- X exit(1);
- X }
- X+ /* If it's a colon, then this is a word that should be given an identifier */
- X+ if (*tok == ':') {
- X+ strcat(Identifier, tok);
- X+ tok = ReadToken(SEP1, NULL, &sd);
- X+ strcat(Identifier, tok);
- X+ tok = ReadToken(SEP1, NULL, &sd);
- X+ if (*tok != ';' && *tok != CRIGHT) {
- X+ fprintf(stderr, "Illegal tag usage in %s\n", sen->def);
- X+ exit(1);
- X+ }
- X+ } else *Identifier = 0; /* No identifier needed! */
- X+
- X if (*tok == ';') {
- X tok = ReadToken(SEP1, NULL, &sd);
- X strcpy(Mod, tok);
- X***************
- X*** 555,582 ****
- X }
- X } else mod = (char *) NULL;
- X
- X! /* We've got the tag and the modifier - now pick a random word */
- X! if (!tag->numwords) {
- X! fprintf(stderr, "Tag %s has no words defined.\n", tag->def);
- X! exit(1);
- X! }
- X! i = (RAND() >> 4) % tag->numwords;
- X
- X /* Find the actual word - this is HIGHLY INEFFICIENT!! */
- X! w = tag->wordlist;
- X! while (i && w) {
- X! w = w->next;
- X! i--;
- X! }
- X
- X! if (!w) {
- X! fprintf(stderr, "Internal error! numwords for tag %s is too high!!!\n", tag->def);
- X! exit(1);
- X }
- X
- X! /* We've got a word - emit it */
- X WriteWord(tag, w, mod, &out, upper);
- X }
- X }
- X /***************************************************************/
- X /* */
- X--- 590,675 ----
- X }
- X } else mod = (char *) NULL;
- X
- X! /* We've got the tag and the modifier and possibly an identifier.
- X! If we have an identifier, search the previously-used-words list for it.
- X! If found, use that word. Otherwise, pick a new word and if necessary
- X! add it to the previously-used-words list. */
- X! if (*Identifier) {
- X! id = identifiers;
- X! while (id) {
- X! if (!stricmp(id->def, Identifier)) break;
- X! id = id->next;
- X! }
- X! } else id = NULL;
- X
- X+ if (id) w = id->w;
- X+
- X+ /* If no identifier supplied, OR identifier not found, pick a random word */
- X+ if (!*Identifier || !id) {
- X+ if (!tag->numwords) {
- X+ fprintf(stderr, "Tag %s has no remaining words defined.\n", tag->def);
- X+ exit(1);
- X+ }
- X+ i = (RAND() >> 4) % tag->numwords;
- X+
- X /* Find the actual word - this is HIGHLY INEFFICIENT!! */
- X! w = tag->wordlist;
- X! prevw = (Word *) NULL;
- X! while (i && w) {
- X! prevw = w;
- X! w = w->next;
- X! i--;
- X! }
- X
- X! if (!w) {
- X! fprintf(stderr, "Internal error! numwords for tag %s is too high!!!\n", tag->def);
- X! exit(1);
- X! }
- X!
- X! /* Move the word to the beginning of the list */
- X! if (!ReUse) {
- X! if (prevw) {
- X! prevw->next = w->next;
- X! w->next = tag->realword;
- X! tag->realword = w;
- X! } else {
- X! tag->wordlist = w->next;
- X! }
- X!
- X! /* Decrement the number of words remaining to be picked */
- X! tag->numwords--;
- X! }
- X }
- X
- X! /* If an identifier was supplied, and we picked a random word, add to the
- X! list of previously-identified words */
- X! if (*Identifier && !id) {
- X! id = (Ident *) malloc(sizeof(Ident));
- X! if (!id) {
- X! fprintf(stderr, "Memory allocation error for identifier: %s\n", Identifier);
- X! exit(1);
- X! }
- X! id->next = identifiers;
- X! identifiers = id;
- X! id->def = strdup(Identifier);
- X! id->w = w;
- X! if (!id->def) {
- X! fprintf(stderr, "Memory allocation error for identifier: %s\n", Identifier);
- X! exit(1);
- X! }
- X! }
- X! /* Emit the word */
- X WriteWord(tag, w, mod, &out, upper);
- X }
- X+
- X+ /* De-allocate memory used for identifiers */
- X+ id = identifiers;
- X+ while (identifiers) {
- X+ id = id->next;
- X+ free(identifiers->def);
- X+ free(identifiers);
- X+ identifiers = id;
- X+ }
- X }
- X /***************************************************************/
- X /* */
- X***************
- X*** 685,690 ****
- X--- 778,788 ----
- X pos = 0;
- X while (*s) {
- X wd = NextWord(&s); /* With leading spaces, not with trailing spaces */
- X+ if (*wd == '\n') {
- X+ putchar('\n');
- X+ pos = 0;
- X+ continue;
- X+ }
- X len = strlen(wd);
- X if (pos + len > width-2) {
- X putchar('\n');
- X***************
- X*** 717,732 ****
- X char *t;
- X while (isspace(**s)) *dest++ = *(*s)++; /* Copy leading spaces */
- X
- X realword = dest; /* Start of the real word */
- X if (**s == '-' || **s == '+') (*s)++; /* Skip any "a/an" thing */
- X! while (**s && !isspace(**s)) *dest++ = *(*s)++; /* Copy word */
- X *dest = 0;
- X
- X if (stricmp(realword, "a")) return Token; /* Exit if not "a" */
- X
- X! /* Look for start of next word */
- X t = *s;
- X! while (isspace(*t)) t++;
- X if (strchr("aeiouAEIOU+", *t)) {
- X *dest++ = 'n';
- X *dest = 0;
- X--- 815,844 ----
- X char *t;
- X while (isspace(**s)) *dest++ = *(*s)++; /* Copy leading spaces */
- X
- X+ /* If it's a '\n', */
- X+ if (**s == '\\' && *(*s+1) == 'n') {
- X+ *Token = '\n';
- X+ *(Token+1) = 0;
- X+ (*s)+=2;
- X+ /* Chew up following whitespace */
- X+ while(isspace(**s)) (*s)++;
- X+ return Token;
- X+ }
- X+
- X realword = dest; /* Start of the real word */
- X if (**s == '-' || **s == '+') (*s)++; /* Skip any "a/an" thing */
- X! while (**s && !iseow(**s)) *dest++ = *(*s)++; /* Copy word */
- X *dest = 0;
- X
- X if (stricmp(realword, "a")) return Token; /* Exit if not "a" */
- X
- X! /* Look for start of next valid word */
- X t = *s;
- X! while(1) {
- X! while (isspace(*t)) t++;
- X! if (*t != '\\') break;
- X! if (*(t+1) == 'n') t += 2; else break;
- X! }
- X if (strchr("aeiouAEIOU+", *t)) {
- X *dest++ = 'n';
- X *dest = 0;
- X***************
- X*** 993,995 ****
- X--- 1105,1127 ----
- X return strcpy(ret, s);
- X }
- X #endif
- X+
- X+ /***************************************************************/
- X+ /* */
- X+ /* InitializeTags - set up the numwords and wordlist fields */
- X+ /* to their initial values. */
- X+ /* */
- X+ /***************************************************************/
- X+ #ifdef __STDC__
- X+ void InitializeTags(void)
- X+ #else
- X+ void InitializeTags()
- X+ #endif
- X+ {
- X+ Tag *cur = TagList;
- X+ while(cur) {
- X+ cur->numwords = cur->realnum;
- X+ cur->wordlist = cur->realword;
- X+ cur = cur->next;
- X+ }
- X+ }
- X#
- X# Fix various spelling errors and bugs in thought.rc. Also add past forms
- X# of verbs, and participles. Add a couple more sentence definitions.
- X#
- X*** ../v1.0.1/thought.rc Fri Aug 23 10:58:47 1991
- X--- ./thought.rc Tue Aug 27 10:56:08 1991
- X***************
- X*** 7,25 ****
- X {deftag art} # Articles - "the", "a", and so on
- X {deftag adj} # Adjectives
- X {deftag adv} # Adverbs
- X! {deftag vi;3s=!s} # Intransitive verbs with mod for 3rd person singular
- X! {deftag vt;3s=!s} # Transitive verbs with mod for 3rd person singular
- X {deftag n;p=!s} # Nouns with mod for plural
- X {deftag mname} # Male's name
- X {deftag fname} # Female's name
- X {deftag name} # Name (either gender)
- X
- X-
- X #--------------------------------------------------------------------------#
- X
- X # Now let's define a bunch of sentences
- X
- X {defsent
- X {Art} {adj} {n} {vi;3s} {adv}.
- X }
- X
- X--- 7,38 ----
- X {deftag art} # Articles - "the", "a", and so on
- X {deftag adj} # Adjectives
- X {deftag adv} # Adverbs
- X! {deftag vi;3s=!s;ing=!ing;pa=!ed} # Intr. verbs with mods
- X! {deftag vt;3s=!s;ing=!ing;pa=!ed} # Transitive verbs with mods
- X {deftag n;p=!s} # Nouns with mod for plural
- X {deftag mname} # Male's name
- X {deftag fname} # Female's name
- X {deftag name} # Name (either gender)
- X+ {deftag bodypart;p=!s}
- X
- X #--------------------------------------------------------------------------#
- X
- X # Now let's define a bunch of sentences
- X
- X {defsent
- X+ {Mname:1} thought that {Fname:1} had stolen his {n:1}. He loved that
- X+ {adj} {n:1}. {Fname:1} denied taking the {n:1} and said that
- X+ {Fname:2} had it. {Mname:1} was {adj} beyond belief to see {Fname:2}
- X+ {adv} {vt:1;ing} the {n:1}, {vi;ing} {adv} as she {vt:1;pa}
- X+ it.}
- X+
- X+ {defsent
- X+ When I was but a {adj} lad, I went down to the {n} to watch the {n:1;p}
- X+ {vi;ing}. One day, a {n:1} landed on my {bodypart}, and {vt;pa} its
- X+ {bodypart:1}. I felt {adj}! What a {adj} sight! I'll never forget
- X+ that {n:1} or its {bodypart:1}.}
- X+
- X+ {defsent
- X {Art} {adj} {n} {vi;3s} {adv}.
- X }
- X
- X***************
- X*** 145,151 ****
- X {defsent Rm {vt;3s} one or more {n;p}. If a {n} was the {adj} {n}
- X to it, its {n;p} are {adj}.}
- X
- X! {defsent To {vt} a {n}, you must have {n} permission in its {n}.}
- X
- X {defsent It is forbidden to {vt} the {n} "{name}" to avoid the {adj}
- X consequences.}
- X--- 158,164 ----
- X {defsent Rm {vt;3s} one or more {n;p}. If a {n} was the {adj} {n}
- X to it, its {n;p} are {adj}.}
- X
- X! {defsent To {vt} a {n:1}, you must have {n} permission in the {n:1}'s {n}.}
- X
- X {defsent It is forbidden to {vt} the {n} "{name}" to avoid the {adj}
- X consequences.}
- X***************
- X*** 370,376 ****
- X angrily, anomalously, antagonistically, anxiously, apathetically,
- X apologetically, ardently, arrogantly, atrociously, attractively,
- X awkwardly, belligerently, benevolently, blasphemously, blatantly,
- X! bluntly, boisterously, calamitously, callously, calmy, carelessly,
- X cataclysmically, caustically, ceremoniously, cheaply, chivalrously,
- X circuitously, cogently, coherently, comically, complacently,
- X consciously, conspicuously, conspiratorially, constantly,
- X--- 383,389 ----
- X angrily, anomalously, antagonistically, anxiously, apathetically,
- X apologetically, ardently, arrogantly, atrociously, attractively,
- X awkwardly, belligerently, benevolently, blasphemously, blatantly,
- X! bluntly, boisterously, calamitously, callously, calmly, carelessly,
- X cataclysmically, caustically, ceremoniously, cheaply, chivalrously,
- X circuitously, cogently, coherently, comically, complacently,
- X consciously, conspicuously, conspiratorially, constantly,
- X***************
- X*** 425,445 ****
- X }
- X
- X {vi
- X! fly;3s=flies, whoosh;3s=!es, burp, explode, whimper, moan, growl,
- X! eat, die, kiss;3s=!es, scream, weep, bleed, exhale, sleep, flip,
- X! triumph, blow, flop, shiver, sink, breathe, choke, gasp, expire, fart,
- X! giggle, concentrate, fib, meditate, contemplate, regurgitate,
- X! exaggerate, wobble, dance, sing, swim, skate, float, collapse,
- X! mutate
- X }
- X
- X {vt
- X! kiss;3s=!es, lift, kill, beat, eat, whack, caress;3s=!es, hug, bore,
- X! hack, chop, nibble, lick, reason with;3s=reasons with, thrill, flatten,
- X! worry;3s=worries, berate, anger, throw, destroy, maim, heal,
- X! improve, help, mystify;3s=mystifies, split, stab, create, feel,
- X! enrage, please, whip, fry;3s=fries, mangle, absorb, enjoy,
- X! berate, console, injure, belittle
- X }
- X
- X {n
- X--- 438,473 ----
- X }
- X
- X {vi
- X! fly;3s=flies;pa=flew, whoosh;3s=!es, burp,
- X! explode;ing=exploding;pa=!d, whimper, moan, growl, eat;pa=ate,
- X! die;ing=dying;pa=!d, kiss;3s=!es, scream, weep;pa=wept, bleed;pa=bled,
- X! exhale;ing=exhaling;pa=!d, sleep;pa=slept, flip;ing=!ping;pa=!ped,
- X! triumph, blow;pa=blew, flop;ing=!ping;pa=!ped, shiver, sink;pa=sank,
- X! breathe;ing=breathing;pa=!d, choke;ing=choking;pa=!d, gasp,
- X! expire;ing=expiring;pa=!d, fart, giggle;ing=giggling;pa=!d,
- X! concentrate;ing=concentrating;pa=!d, fib;ing=!bing;pa=!bed,
- X! meditate;ing=meditating;pa=!d, contemplate;ing=contemplating;pa=!d,
- X! regurgitate;ing=regurgitating;pa=!d,
- X! exaggerate;ing=exaggerating;pa=!d, wobble;ing=wobbling;pa=!d,
- X! dance;ing=dancing;pa=!d, sing;pa=sang, swim;ing=!ming;pa=swam,
- X! skate;ing=skating;pa=!d, float, collapse;ing=collapsing;pa=!d,
- X! mutate;ing=mutating;pa=!d
- X }
- X
- X {vt
- X! kiss;3s=!es, lift, kill, beat;pa=!, eat;pa=ate, whack,
- X! caress;3s=!es, hug;ing=!ging;pa=!ged, bore;ing=boring;pa=!d,
- X! hack, chop;ing=!ping;pa=!ped, nibble;ing=nibbling;pa=!d, lick,
- X! reason with;3s=reasons with;ing=reasoning with;pa=reasoned with, thrill,
- X! flatten, worry;3s=worries;pa=worried, berate;ing=berating;pa=!d,
- X! anger, throw;pa=threw, destroy, maim, heal,
- X! improve;ing=improving;pa=!d, help, mystify;3s=mystifies;pa=mystified,
- X! split;ing=!ting;pa=!, stab;ing=!bing;pa=!bed,
- X! create;ing=creating;pa=!d, feel;pa=felt, enrage;ing=enraging;pa=!d,
- X! please;ing=pleasing;pa=!d, whip;ing=!ping;pa=!ped,
- X! fry;3s=fries;pa=fried, mangle;ing=mangling;pa=!d, absorb, enjoy,
- X! console;ing=consoling;pa=!d, injure;ing=injuring;pa=!d,
- X! belittle;ing=belittling;pa=!d
- X }
- X
- X {n
- X***************
- X*** 496,498 ****
- X--- 524,530 ----
- X Cindy, Alice, Debbie, Kathy, Linda, Mandy, Nancy, Patricia,
- X Sandy, Veronica, Barabara, Lori, Jenny, Sandra, Sally, Anne
- X }
- X+
- X+ {bodypart
- X+ leg, wing, breast, head, buttock, foot;p=feet, eye, ear, nose,
- X+ throat, thigh, hip, nostril}
- X#
- X# Update the man page for thoughtfile to reflect new features.
- X#
- X*** ../v1.0.1/thoughtfile.man Thu Jul 4 14:13:36 1991
- X--- ./thoughtfile.man Wed Aug 28 17:15:20 1991
- X***************
- X*** 129,135 ****
- X--- 129,181 ----
- X \fBThought\fP operates by reading an entire grammar file, picking a
- X sentence definition at random, substituting random words for each
- X tag reference, and displaying the result.
- X+ .SH IDENTIFIERS
- X+ Normally, \fBthought\fP will not "re-use" a particular word in a given
- X+ sentence. Thus, if your sentence definition is something like:
- X+ .PP
- X+ .nf
- X+ {defsent I prefer a {n} to {n;p}.}
- X+ .fi
- X+ .PP
- X+ possible results are:
- X+ .PP
- X+ .nf
- X+ I prefer a dog to cats.
- X+ I prefer an elephant to mice.
- X+ .fi
- X+ .PP
- X+ You'll never get "bad" sentences like:
- X+ .PP
- X+ .nf
- X+ I prefer a tree to trees.
- X+ .fi
- X+ .PP
- X+ However, sometimes it is desirable to "re-use" words to give sentences
- X+ more meanings. In this case, when you define a sentence, you add an
- X+ \fIidentifier\fP immediately after the tag name and prior to any modifier.
- X+ An identifier is simply a colon followed by an alphanumeric string, and
- X+ is case-insensitive. This ensures that appropriate words are re-used. For
- X+ example, consider the definition:
- X+ .PP
- X+ .nf
- X+ {defsent I tried a {n:1} once, but it was {adj:1}. {Adj:1}
- X+ {n:1;p} don't agree with me.}
- X+ .fi
- X+ .PP
- X+ In this case, the identifiers are simply numbers - you can use anything.
- X+ Possible results are:
- X+ .PP
- X+ .nf
- X+ I tried a dog once, but it was evil. Evil dogs don't agree
- X+ with me.
- X+ I tried an igloo once, but it was putrid. Putrid igloos don't
- X+ agree with me.
- X+ -- etc --
- X+ .fi
- X .SH ODDS AND ENDS
- X+ You can place a carriage return inside sentence definitions with the
- X+ sequence "\n".
- X+ .PP
- X If you want a substituted word to be capitalized, simply use a capital
- X letter as the first character of the tag reference. For example:
- X .PP
- X***************
- X*** 155,160 ****
- X--- 201,218 ----
- X .nf
- X {noun +hour, -unicorn}
- X .fi
- X+ .PP
- X+ As stated previously, \fBthought\fP will not re-use a word unless it is
- X+ given an identifier. This behaviour is a change from version 1.0.1 and
- X+ may not be desirable. If you wish to maintain the old behaviour, place
- X+ the command:
- X+ .PP
- X+ .nf
- X+ {reuse}
- X+ .fi
- X+ .PP
- X+ in the control file. (For an example of why this is useful, see the file
- X+ "rap.rc" supplied with \fBthought\fP.)
- X .SH HINTS
- X A judicious choice of literal text and word substitutions usually gives
- X good results. A sentence which consists mostly of word substitutions
- X#
- X# Update version.h
- X#
- X*** ../v1.0.1/version.h Thu Jul 25 15:44:43 1991
- X--- ./version.h Mon Aug 26 14:15:58 1991
- X***************
- X*** 15,18 ****
- X /***************************************************************/
- X
- X #define VERSION "1.0"
- X! #define PATCHLEVEL "1"
- X--- 15,18 ----
- X /***************************************************************/
- X
- X #define VERSION "1.0"
- X! #define PATCHLEVEL "2"
- SHAR_EOF
- $TOUCH -am 0829104991 Patch02 &&
- chmod 0600 Patch02 ||
- echo "restore of Patch02 failed"
- set `wc -c Patch02`;Wc_c=$1
- if test "$Wc_c" != "27303"; then
- echo original size 27303, current size $Wc_c
- fi
- fi
- # ============= rap.rc ==============
- if test X"$1" != X"-c" -a -f 'rap.rc'; then
- echo "File already exists: skipping 'rap.rc'"
- else
- echo "x - extracting rap.rc (Text)"
- sed 's/^X//' << 'SHAR_EOF' > rap.rc &&
- X{reuse}
- X{deftag lyric1}
- X{deftag lyric2}
- X{deftag lyric3}
- X{deftag bandname}
- X
- X{lyric1
- XMove it, Get up, Pump it up, Get down, Shake it, Pump the jam
- X}
- X
- X{lyric2
- Xto triple beat, get body heat, feel the beat, get around,
- Xthe joint is jumpin', feet are stompin'
- X}
- X
- X{lyric3
- Xin the city streets, you'll be humpin', till the night is over,
- Xshake your meat, I'm bustin' loose, with disco heat
- X}
- X
- X{bandname
- XThe Mixmastermeatbeaters,
- XSharp Al and the Dead Citizens,
- XThe Ghetto Blaster,
- XDr. Cool,
- XRapsody in Black
- X}
- X
- X{defsent
- X"{Lyric1:a}" by {Bandname}\n\n
- X{Lyric1} {lyric2} {lyric3}\n
- X{Lyric1} {lyric2} {lyric3}\n
- X{Lyric1} {lyric2} {lyric3}\n
- X{Lyric1} {lyric2} {lyric3}\n
- X\n(chorus)\n
- X{Lyric1:a} {lyric2:a} {lyric3:a}\n
- X{Lyric1:b} {lyric2:b} {lyric3:b}\n\n
- X{Lyric1} {lyric2} {lyric3}\n
- X{Lyric1} {lyric2} {lyric3}\n
- X{Lyric1} {lyric2} {lyric3}\n
- X{Lyric1} {lyric2} {lyric3}\n
- X\n(chorus)\n
- X{Lyric1:a} {lyric2:a} {lyric3:a}\n
- X{Lyric1:b} {lyric2:b} {lyric3:b}\n\n
- X{Lyric1:b} {lyric2:b} {lyric3:b}\n
- X{Lyric1:b} {lyric2:b} {lyric3:b}\n
- X{Lyric1:b} {lyric2:b} {lyric3:b}\n
- X{Lyric1:b} {lyric2:b} {lyric3:b}\n
- X{Lyric1:b} {lyric2:b} {lyric3:b}\n
- X{Lyric1:b} {lyric2:b} {lyric3:b}\n
- X{Lyric1:b} {lyric2:b} {lyric3:b}\n
- X{Lyric1:b} {lyric2:b} {lyric3:b}\n
- X}
- SHAR_EOF
- $TOUCH -am 0828170791 rap.rc &&
- chmod 0600 rap.rc ||
- echo "restore of rap.rc failed"
- set `wc -c rap.rc`;Wc_c=$1
- if test "$Wc_c" != "1226"; then
- echo original size 1226, current size $Wc_c
- fi
- fi
- exit 0
-
- exit 0 # Just in case...
-