[comp.text] drawing activation records

budd@mist.cs.orst.edu (Tim Budd) (02/28/89)

I frequently need to draw Activation Records.  I can speak both LaTex and
Troff, but I haven't found a good way to do this in either language.

I need to draw a stack of boxed activation records, with pointers and
offsets off to the left side (frame pointer, top of stack) and commentary 
off to the right.  
The inside the ar can be centered text to describe various fields.
Pointers that go to other fields ofthe AR can also be described pictorially.
Prefereable, but not entirely necessary, would be the ability to have a
large curly brace appear on the right hand side to denote a section of the
stack, such as the entire activation record for a given procedure.

Here is a rough approximation

       sp ->				current top of stack
		-----------------
            -20 |		|	this is the activation record
	    -16 |		|	for procedure foo.
	    -12	|  array x      |	note how it contains pointers to
	     -8 |  variable b	|	the previous AR.
	     -4	|  variable a   |
	fp ->	|    old fp ----|-|
		|return address | |
            +8  | first param   | |
		----------------- |
            	|		| |	
            	|		| |	
            	|		| |	
            	|		| |	
            	|		| |	
            	|	<-------|-|	

Does anybody know of a relatively EASY way to produce these sorts of
pictures in either LaTeX or Troff?

--tim budd, oregon state university (budd@cs.orst.edu)