11.1Sglassm4 - macro processor 21.1Sglass 31.1SglassPD m4 is based on the macro tool distributed with the software 41.1Sglasstools (VOS) package, and described in the "SOFTWARE TOOLS" and 51.1Sglass"SOFTWARE TOOLS IN PASCAL" books. It has been expanded to include 61.1Sglassmost of the command set of SysV m4, the standard UN*X macro processor. 71.1Sglass 81.1SglassSince both PD m4 and UN*X m4 are based on SOFTWARE TOOLS macro, 91.1Sglassthere may be certain implementation similarities between 101.1Sglassthe two. The PD m4 was produced without ANY references to m4 111.1Sglasssources. 121.1Sglass 131.1Sglasswritten by: Ozan S. Yigit 141.1Sglass 151.1SglassReferences: 161.1Sglass 171.1Sglass Software Tools distribution: macro 181.1Sglass 191.1Sglass Kernighan, Brian W. and P. J. Plauger, SOFTWARE 201.1Sglass TOOLS IN PASCAL, Addison-Wesley, Mass. 1981 211.1Sglass 221.1Sglass Kernighan, Brian W. and P. J. Plauger, SOFTWARE 231.1Sglass TOOLS, Addison-Wesley, Mass. 1976 241.1Sglass 251.1Sglass Kernighan, Brian W. and Dennis M. Ritchie, 261.1Sglass THE M4 MACRO PROCESSOR, Unix Programmer's Manual, 271.1Sglass Seventh Edition, Vol. 2, Bell Telephone Labs, 1979 281.1Sglass 291.1Sglass System V man page for M4 301.1Sglass 311.1Sglass 321.1SglassImplementation Notes: 331.1Sglass 341.1Sglass[1] PD m4 uses a different (and simpler) stack mechanism than the one 351.1Sglass described in Software Tools and Software Tools in Pascal books. 361.1Sglass The triple stack thing is replaced with a single stack containing 371.1Sglass the call frames and the arguments. Each frame is back-linked to a 381.1Sglass previous stack frame, which enables us to rewind the stack after 391.1Sglass each nested call is completed. Each argument is a character pointer 401.1Sglass to the beginning of the argument string within the string space. 411.1Sglass The only exceptions to this are (*) arg 0 and arg 1, which are 421.1Sglass the macro definition and macro name strings, stored dynamically 431.1Sglass for the hash table. 441.1Sglass 451.1Sglass . . 461.1Sglass | . | <-- sp | . | 471.1Sglass +-------+ +-----+ 481.1Sglass | arg 3 ------------------------------->| str | 491.1Sglass +-------+ | . | 501.1Sglass | arg 2 --------------+ . 511.1Sglass +-------+ | 521.1Sglass * | | | 531.1Sglass +-------+ | +-----+ 541.1Sglass | plev | <-- fp +---------------->| str | 551.1Sglass +-------+ | . | 561.1Sglass | type | . 571.1Sglass +-------+ 581.1Sglass | prcf -----------+ plev: paren level 591.1Sglass +-------+ | type: call type 601.1Sglass | . | | prcf: prev. call frame 611.1Sglass . | 621.1Sglass +-------+ | 631.1Sglass | <----------+ 641.1Sglass +-------+ 65