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