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