1*a7c89f0fSglassm4 - macro processor 2*a7c89f0fSglass 3*a7c89f0fSglassPD m4 is based on the macro tool distributed with the software 4*a7c89f0fSglasstools (VOS) package, and described in the "SOFTWARE TOOLS" and 5*a7c89f0fSglass"SOFTWARE TOOLS IN PASCAL" books. It has been expanded to include 6*a7c89f0fSglassmost of the command set of SysV m4, the standard UN*X macro processor. 7*a7c89f0fSglass 8*a7c89f0fSglassSince both PD m4 and UN*X m4 are based on SOFTWARE TOOLS macro, 9*a7c89f0fSglassthere may be certain implementation similarities between 10*a7c89f0fSglassthe two. The PD m4 was produced without ANY references to m4 11*a7c89f0fSglasssources. 12*a7c89f0fSglass 13*a7c89f0fSglasswritten by: Ozan S. Yigit 14*a7c89f0fSglass 15*a7c89f0fSglassReferences: 16*a7c89f0fSglass 17*a7c89f0fSglass Software Tools distribution: macro 18*a7c89f0fSglass 19*a7c89f0fSglass Kernighan, Brian W. and P. J. Plauger, SOFTWARE 20*a7c89f0fSglass TOOLS IN PASCAL, Addison-Wesley, Mass. 1981 21*a7c89f0fSglass 22*a7c89f0fSglass Kernighan, Brian W. and P. J. Plauger, SOFTWARE 23*a7c89f0fSglass TOOLS, Addison-Wesley, Mass. 1976 24*a7c89f0fSglass 25*a7c89f0fSglass Kernighan, Brian W. and Dennis M. Ritchie, 26*a7c89f0fSglass THE M4 MACRO PROCESSOR, Unix Programmer's Manual, 27*a7c89f0fSglass Seventh Edition, Vol. 2, Bell Telephone Labs, 1979 28*a7c89f0fSglass 29*a7c89f0fSglass System V man page for M4 30*a7c89f0fSglass 31*a7c89f0fSglass 32*a7c89f0fSglassImplementation Notes: 33*a7c89f0fSglass 34*a7c89f0fSglass[1] PD m4 uses a different (and simpler) stack mechanism than the one 35*a7c89f0fSglass described in Software Tools and Software Tools in Pascal books. 36*a7c89f0fSglass The triple stack thing is replaced with a single stack containing 37*a7c89f0fSglass the call frames and the arguments. Each frame is back-linked to a 38*a7c89f0fSglass previous stack frame, which enables us to rewind the stack after 39*a7c89f0fSglass each nested call is completed. Each argument is a character pointer 40*a7c89f0fSglass to the beginning of the argument string within the string space. 41*a7c89f0fSglass The only exceptions to this are (*) arg 0 and arg 1, which are 42*a7c89f0fSglass the macro definition and macro name strings, stored dynamically 43*a7c89f0fSglass for the hash table. 44*a7c89f0fSglass 45*a7c89f0fSglass . . 46*a7c89f0fSglass | . | <-- sp | . | 47*a7c89f0fSglass +-------+ +-----+ 48*a7c89f0fSglass | arg 3 ------------------------------->| str | 49*a7c89f0fSglass +-------+ | . | 50*a7c89f0fSglass | arg 2 --------------+ . 51*a7c89f0fSglass +-------+ | 52*a7c89f0fSglass * | | | 53*a7c89f0fSglass +-------+ | +-----+ 54*a7c89f0fSglass | plev | <-- fp +---------------->| str | 55*a7c89f0fSglass +-------+ | . | 56*a7c89f0fSglass | type | . 57*a7c89f0fSglass +-------+ 58*a7c89f0fSglass | prcf -----------+ plev: paren level 59*a7c89f0fSglass +-------+ | type: call type 60*a7c89f0fSglass | . | | prcf: prev. call frame 61*a7c89f0fSglass . | 62*a7c89f0fSglass +-------+ | 63*a7c89f0fSglass | <----------+ 64*a7c89f0fSglass +-------+ 65