|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T n
Length: 3259 (0xcbb) Types: TextFile Names: »ncode.1«
└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987 └─⟦this⟧ »EUUGD18/General/Ncode/ncode.1«
.TH NCODE 1 "Pixar" .SH NAME ncode - stochastic text construction .SH SYNOPSIS .B ncode [-n number] [-g groupname] codefile .SH DESCRIPTION .I Ncode reads in a file of a certain format and randomly constructs text based on the organization of the file. Other files may be recursively included by putting #include pathname on any line of the file. This is useful when you want to use a file of basic definitions, or groups, in different configurations. The -n flag is used to run the program through the main loop multiple times. A "group" name is defined as the word on the first line of the file and, more commonly, the word on each line following a line starting with "%". The members of a group are all lines between the group name and the next "%". When a group name is encountered, surrounded by any of a set of characters called "white space" in this context, it is randomly expanded into one of its members. Group names are not allowed to contain any white space, to prevent terminal confusion on the part of the program. The -g flag allows you to start the expanding process on a group name other than the default, which is "CODE". The argument may be a group name, or an entire string including group names, just as if it were a line in the file. It is legal to start on any group in the file, and groups may be referenced before or after the place in the file where they are defined. In the case of duplicate group definitions, the first one occurring is the only one used. For example, here is a sample group definition: .nf NOUN lamp house car % .fi The line "See the NOUN." could be randomly expanded to say "See the lamp." The characters considered "white" for the purpose of bounding a group name, besides what is normally considered white space, are currently: | \\ . - : ; , ! ? [ ] { } () ' " ` Two of those characters have special meanings to .I ncode. The "|" symbol allows you to "splice" things to a group name. When it is encountered, no character is printed on output. The "\\" causes a newline to be printed on output. The simplest application would be for a "fortune" program, but .I ncode could also be used for more complex things such as a rumor generating file. The group definitions will be left as an exercise for the reader, but the following example should prove illuminating: .nf CODE It was rumored today that COMPANY will be bought by COMPANY for PRICE\\. PERSON, POSITION of COMPANY, said that PRODUCT will be announced DATE\\. .fi Note that every string to be expanded must be on only one line of the file. The program now dynamically allocates memory in a very general way, so the total size of your input files and the length of the lines in the files is limited only by how much memory you can get. The only hard limit is that a group name can't be over 4096 characters long. If you can't come up with a unique group name in fewer characters then don't blame me. .SH BUGS No bugs. Only features that you haven't figured out how to use yet. A recent improvement makes it tolerant of blank lines following the last % in a #include file. .SH DIAGNOSTICS Standard perror() stuff. Pretty self explanatory. A bogus input file might benignly yield cryptic results. .SH AUTHOR Craig Good