11590Srgrimesm4 - macro processor
21590Srgrimes
31590SrgrimesPD m4 is based on the macro tool distributed with the software 
41590Srgrimestools (VOS) package, and described in the "SOFTWARE TOOLS" and 
51590Srgrimes"SOFTWARE TOOLS IN PASCAL" books. It has been expanded to include 
61590Srgrimesmost of the command set of SysV m4, the standard UN*X macro processor.
71590Srgrimes
81590SrgrimesSince both PD m4 and UN*X m4 are based on SOFTWARE TOOLS macro,
91590Srgrimesthere may be certain implementation similarities between
101590Srgrimesthe two. The PD m4 was produced without ANY references to m4
111590Srgrimessources.
121590Srgrimes
131590Srgrimeswritten by: Ozan S. Yigit
141590Srgrimes
151590SrgrimesReferences:
161590Srgrimes
171590Srgrimes	Software Tools distribution: macro
181590Srgrimes
191590Srgrimes	Kernighan, Brian W. and P. J. Plauger, SOFTWARE
201590Srgrimes	TOOLS IN PASCAL, Addison-Wesley, Mass. 1981
211590Srgrimes
221590Srgrimes	Kernighan, Brian W. and P. J. Plauger, SOFTWARE
231590Srgrimes	TOOLS, Addison-Wesley, Mass. 1976
241590Srgrimes
251590Srgrimes	Kernighan, Brian W. and Dennis M. Ritchie,
261590Srgrimes	THE M4 MACRO PROCESSOR, Unix Programmer's Manual,
271590Srgrimes	Seventh Edition, Vol. 2, Bell Telephone Labs, 1979
281590Srgrimes
291590Srgrimes	System V man page for M4
301590Srgrimes
311590Srgrimes
321590SrgrimesImplementation Notes:
331590Srgrimes
341590Srgrimes[1]	PD m4 uses a different (and simpler) stack mechanism than the one 
351590Srgrimes	described in Software Tools and Software Tools in Pascal books. 
361590Srgrimes	The triple stack thing is replaced with a single stack containing 
371590Srgrimes	the call frames and the arguments. Each frame is back-linked to a 
381590Srgrimes	previous stack frame, which enables us to rewind the stack after 
391590Srgrimes	each nested call is completed. Each argument is a character pointer 
401590Srgrimes	to the beginning of the argument string within the string space.
411590Srgrimes	The only exceptions to this are (*) arg 0 and arg 1, which are
421590Srgrimes	the macro definition and macro name strings, stored dynamically
431590Srgrimes	for the hash table.
441590Srgrimes
451590Srgrimes	    .					   .
461590Srgrimes	|   .	|  <-- sp			|  .  |
471590Srgrimes	+-------+				+-----+
481590Srgrimes	| arg 3 ------------------------------->| str |
491590Srgrimes	+-------+				|  .  |
501590Srgrimes	| arg 2 --------------+ 		   .
511590Srgrimes	+-------+	      |
521590Srgrimes	    *		      |			|     |
531590Srgrimes	+-------+	      | 		+-----+
541590Srgrimes	| plev	|  <-- fp     +---------------->| str |
551590Srgrimes	+-------+				|  .  |
561590Srgrimes	| type	|				   .
571590Srgrimes	+-------+
581590Srgrimes	| prcf	-----------+		plev: paren level
591590Srgrimes	+-------+  	   |		type: call type
601590Srgrimes	|   .	| 	   |		prcf: prev. call frame
611590Srgrimes	    .	   	   |
621590Srgrimes	+-------+	   |
631590Srgrimes	|	<----------+
641590Srgrimes	+-------+
65