newman (04/18/83)
I offer the following as a useful challenge for a nroff/troff utility that I think would be a worthwhile hack. Would it be possible to have a program to read in nroff or troff input and tell you what options to use when nroff/troffing it? E.g. it could tell you whether to use ms or me, whether you need tbl, col, eqn, etc and in what order to do this? People who don't use these programs a whole lot (like me) get a bit lost when they receive text for input to a formatter (like over the net) and there are no instructions for formatting it. Also these programs are very expensive to experiment with to get the right options. If you can whip something up, please post to net.sources. Thnx in advnx. Ken Newman Univ. of Toronto decvax!utzoo!utcsrgv!newman
kar (04/19/83)
Regarding the idea for the "here's a file, now what formatting options should I use to format it" utility: How about this variation on the theme: Each file that does not use the (installation dependent) "standard" options should begin with the following: .ig command required to format this file .. Then the only utility you'd need would be one that looked for the command and executed it. I've thought about doing this for my own use; I am not a novice with formatting but often forget what is needed for a file I've not looked at in a year or so. It's not enough of a bother for me (yet) to take the few min- utes it would require to write it. Ken Reek, Rochester Institute of Technology ucbvax!allegra!rochester!ritcv!kar
dan (04/20/83)
We too had countless problems trying to remember how to run an 'nroff' document. We (and our secretaries) have been using a little shell program called 'runoff' for some time now. By putting a special comment line at the beginning of an 'nroff' file, you can get it formatted by entering runoff <document> 'Runoff' expects the first line of the first file named on the command line to contain an nroff-style comment as follows: .\" <command line to format the document> The command can contain 'sh' variable substitutions, since it is executed by the shell that executes 'runoff'. Most importantly, "$1" is replaced by the first argument to 'runoff'. Most of our things document files begin something like this: .\" tbl $1 | nroff -mm | col Dan Forsyth (decvax!duke!mcnc!msdc!dan) Medical Systems Development Corp. ====================================== : # runoff --- format and print a document using its first # line as the command if CMD=`head -1 $1`; then : else exit fi if expr 0 = X"$CMD" : '^X\. *\\"' >/dev/null; then echo 'First line of document must be .\\" <command>' 1>&2 exit 1 fi NCMD=`echo "$CMD" | sed 's/^\. *\\\" *//'` eval "$NCMD" ======================================
dhb (04/21/83)
I have written a program called "format" which will read in nroff source files and determine which options are needed. The program actually goes one step further than what you suggested in that after it figures out what options to use it actually constructs the command and executes it. There is also an option to just report the result back to the user instead of executing them. The program is currently set up to be specific to nroff because we do not have a photo-typesetter, but with minor modifications can be made to handle troff. We plan to upgrade the program ourselves within the next few months because we are getting a laser printer (or some similar device) and will be wanting to use troff. The way we plan to do it is to make a second version of "format" called "tformat" which can handle the troff options (i.e. eqn instead of neqn). I will post the source and the manual page seperately to net.sources. The program will currently handle tbl, neqn, ms macros, me macros, man macros, and mm macros (PWB). It also recognizes .so requests, and .de requests which redefine standard macros. Dave Brierley ...!decvax!brunix!rayssd!dhb ...!foxvax1!brunix!rayssd!dhb ...!allegra!rayssd!dhb
bernie (04/25/83)
For that matter, it might be an idea to have ALL processors (compilers, assemblers, etc) look inside the first incoming comment line for options and suchlike; this would save a h*ll of a lot of typing and ease memory problems (mine, not the system's). --Bernie Roehl ...decvax!watmath!watarts!bernie
julian (04/28/83)
Having the first line of a file tell how to process it is a nice idea because it is a self documenting process. It does not, however, explain the relationships between that file and others it goes along with. For example, conditional compilation in C with one particular flag (e.g. -DHOHO) often applies to more than one source file at a time. Thus to be fully self documenting, each of those files must note that they are associated with all of the others, and if one is processed with -DHOHO, the others have to be also. Sounds pretty awkward to me. This is exactly one of the situations that make handles. Seems like a better idea when distributing files to distribute their makefiles also so others can see not only how to process the file but how it relates to other files. Julian Gomez Computer Graphics Research Group, Ohio State University ucbvax!cbosg!osu-cgrg!julian