[comp.text] troff/nroff macros, index generates "Bad Storage Allocation"

karl@grebyn.UUCP (07/01/88)

The following input (modulo the leading XX) on Ultrix 2.2 nroff and troff
(with -me) generates a "Bad storage error" when trying to process the .  I'm
trying to do multiple indices (and even get them sorted!), without much
success.  Any suggestions as to what is going wrong here.  (I know that 'pi'
was a bad choice for a macro name, as it's already used, but why the
internal error?  Other hints, suggestions, and comments welcome.  Thanks.

XX.fo 'PAGE BOTTOM'%'PAGE BOTTOM'
XX.de pi
XX.(x p
XX\\$1
XX.)x \n%
XX..
XX.de ti
XX.(x t
XX\\$1
XX.)x \n%
XX..
XX.de vi
XX.(x v
XX\\$1
XX.)x \n%
XX..
XX.de oi
XX.(x o
XX\\$1
XX.)x \n%
XX..
XX.bp
XXSmith
XX.pi "Smith, James"
XX.oi "Smith, James"
XX.ti "Smith, James"
XX.vi "Smith, James"
XX.bp
XXJohnson
XX.pi "Johnson, James"
XX.oi "Johnson, James"
XX.ti "Johnson, James"
XX.vi "Johnson, James"
XX.bp
XXJones
XX.pi "Jones, James"
XX.oi "Jones, James"
XX.ti "Jones, James"
XX.vi "Jones, James"
XX.bp
XXP Index
XX.xp p
XX.bp
XXT Index
XX.xp t
XX.bp
XXV Index
XX.xp v
XX.bp
XXO Index
XX.xp o

eggert@sm.unisys.com (Paul Eggert) (07/08/88)

In article <10944@grebyn.COM> karl@grebyn.com (Karl A. Nyberg) gives sample
troff -me input that elicits the message "Bad storage error".  The problem
arises from the following definition in the input:

	.de ti
	.(x t
	\\$1
	.)x \n%
	..

This redefines the builtin troff ti (temporary indent) directive, which is used
by the )x macro.  An endless recursion between ti and )x would ensue, except
that -me here for other reasons removes the |X diversion, which (because of the
nested invocation) it is currently inside.  The "Bad storage error" in this
case means troff is trying to execute a diversion that has been removed.

Moral: don't redefine predeclared names.

If you want sorted indexes, your best bet is to use .tm to send the raw data to
a file, sort the file, and then run it off separately.