aboutsummaryrefslogtreecommitdiff
path: root/tmac/tmac.tbl
blob: e09ae5fd5431a0248d2a4bae52e8c9b155c845d2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
.\" A macro package for simple tables
.\"
.\" This package creates simple tables, without using the tbl
.\" preprocessor.  The main macros are as follows:
.\"
.\" .tblbeg colwid1 colwid2 ...
.\"   This macro begins a table.  Its arguments are the widths of the
.\"   columns.  At most seven columns are supported.  The width of the
.\"   last column can be 0 to expand it to the end of the line.
.\"
.\" .tblbox all row col
.\"   Specifies whether to draw box around the table (when all is 1),
.\"   between the rows (when row is 1), or between its columns (when
.\"   col is 1).
.\"
.\" .tblrow "column #1" "column #2" ...
.\"   Starts a new row.  Parameters provide a compact way of
.\"   specifying  the contents of a table row (instead of calling
.\"   .tblcol for every column).
.\"
.\" .tblcol col
.\"   Begins column number col for the current row.
.\"
.\" .tblmac mac1 mac2 ...
.\"   Before writing the contents of each column, the corresponding
.\"   macro in the list of the arguments of this macro is invoked (e.g.,
.\"   mac2 is called when starting column #2).
.\"
.\" .tblrst
.\"   This macro is called just before switching to new rows and columns
.\"   and drawing the table.  It should reset the indentation (and other
.\"   variables such as fonts, if necessary).
.\"
.\" .tblrec
.\"   Reconfigures table columns; expects the same arguments as .tblbeg
.\"   (can be used for multi-column cells).
.\"
.\" .tblend
.\"   Ends a table.
.\"
.nr tblgap 1n
.nr tblboxall 0
.nr tblboxrow 0
.nr tblboxcol 0
.nr tblbrdrsz 30	\" border point size
.nr tblvertsz 16	\" vertical line point size
.nr tblhorisz 16	\" horizontal line point size
.nr tblcolrev 0		\" reverse .tblcol column number (R2L tables)
.ds tblboxclr "0
.de tblrst
.	in 0
..
.de tblrec
.	if \\n[tblrow.ok] .tblrowend 0
.	nr tblwid1 0\\$1
.	if "\\$1"0" .nr tblwid1 \\n(.l
.	nr tblwid2 0\\$2
.	if "\\$2"0" .nr tblwid2 \\n(.l-\\n[tblwid1]
.	nr tblwid3 0\\$3
.	if "\\$3"0" .nr tblwid3 \\n(.l-\\n[tblwid1]-\\n[tblwid2]
.	nr tblwid4 0\\$4
.	if "\\$4"0" .nr tblwid4 \\n(.l-\\n[tblwid1]-\\n[tblwid2]-\\n[tblwid3]
.	nr tblwid5 0\\$5
.	if "\\$5"0" .nr tblwid5 \\n(.l-\\n[tblwid1]-\\n[tblwid2]-\\n[tblwid3]-\\n[tblwid4]
.	nr tblwid6 0\\$6
.	if "\\$6"0" .nr tblwid6 \\n(.l-\\n[tblwid1]-\\n[tblwid2]-\\n[tblwid3]-\\n[tblwid4]-\\n[tblwid5]
.	nr tblwid7 0\\$7
.	if "\\$7"0" .nr tblwid7 \\n(.l-\\n[tblwid1]-\\n[tblwid2]-\\n[tblwid3]-\\n[tblwid4]-\\n[tblwid5]-\\n[tblwid6]
.	nr tblcnt \\n(.$
.	nr tblwid \\n[tblwid1]+\\n[tblwid2]+\\n[tblwid3]+\\n[tblwid4]+\\n[tblwid5]+\\n[tblwid6]+\\n[tblwid7]
..
.de tblbeg
.	tblrst
.	tblrec \\$^
.	nr tblrow.cnt 0
..
.de tblmac
.	ds tblrst1 "\\$1
.	ds tblrst2 "\\$2
.	ds tblrst3 "\\$3
.	ds tblrst4 "\\$4
.	ds tblrst5 "\\$5
.	ds tblrst6 "\\$6
.	ds tblrst7 "\\$7
..
.de tblbox
.	if \\n[tblrow.ok] .tblrowend 0
.	nr tblboxall 0\\$1
.	nr tblboxrow 0\\$2
.	nr tblboxcol 0\\$3
..
.de tblcolbeg
.	nr tblcol.ok 1
.	sp |\\n[tblrow.top]u
.	tblrst
.	nr tblcur \\$1
.	if \\n[tblcolrev] .nr tblcur \\n[tblcnt]-\\$1+1
.	if \\n[tblcur]=1 .in +0u
.	if \\n[tblcur]=2 .in +\\n[tblwid1]u
.	if \\n[tblcur]=3 .in +\\n[tblwid1]u+\\n[tblwid2]u
.	if \\n[tblcur]=4 .in +\\n[tblwid1]u+\\n[tblwid2]u+\\n[tblwid3]u
.	if \\n[tblcur]=5 .in +\\n[tblwid1]u+\\n[tblwid2]u+\\n[tblwid3]u+\\n[tblwid4]u
.	if \\n[tblcur]=6 .in +\\n[tblwid1]u+\\n[tblwid2]u+\\n[tblwid3]u+\\n[tblwid4]u+\\n[tblwid5]u
.	if \\n[tblcur]=7 .in +\\n[tblwid1]u+\\n[tblwid2]u+\\n[tblwid3]u+\\n[tblwid4]u+\\n[tblwid5]u+\\n[tblwid6]u
.	ll \\n(.iu+\\n[tblwid\\n[tblcur]]u
.	in +\\n[tblgap]u
.	ll -\\n[tblgap]u
.	\\*[tblrst\\n[tblcur]]
..
.de tblcolend
.	br
.	nr tblcol.ok 0
.	if \\n(.d>\\n[tblrow.bot] .nr tblrow.bot \\n(.d
..
.de tblrowbeg
.	tblrst
.	if (\\n[tblboxall]+\\n[tblboxrow])&(\\n[tblrow.cnt]=0) \m[\\*[tblboxclr]]\s[\\n[tblbrdrsz]]\D'l \\n[tblwid]u 0'\s[]\m[]
.	br
.	nr tblrow.cnt +1
.	nr tblrow.ok 1
.	mk tblrow.top
.	mk tblrow.bot
..
.de tblrowend
.	if \\n[tblcol.ok] .tblcolend \\$1
.	nr tblrow.ok 0
.	tblrst
.	sp |\\n[tblrow.bot]u
.	nr tblht \\n[tblrow.bot]u-\\n[tblrow.top]u+.5v
.	sp -.5v
.	cl \\*[tblboxclr]
.	if \\n[tblboxall]:\\n[tblboxcol] \{\
.		ps \\n[tblbrdrsz]
\h'|0'\D'l 0 -\\n[tblht]u'\v'\\n[tblht]u'\
\h'|\\n[tblwid]u'\D'l 0 -\\n[tblht]u'\v'\\n[tblht]u'
.		ps
.		sp -1
.	\}
.	if \\n[tblboxcol] \{\
.		ps \\n[tblvertsz]
\h'|\\n[tblwid1]u'\D'l 0 -\\n[tblht]u'\v'\\n[tblht]u'\
\h'|\\n[tblwid1]u+\\n[tblwid2]u'\D'l 0 -\\n[tblht]u'\v'\\n[tblht]u'\
\h'|\\n[tblwid1]u+\\n[tblwid2]u+\\n[tblwid3]u'\D'l 0 -\\n[tblht]u'\v'\\n[tblht]u'\
\h'|\\n[tblwid1]u+\\n[tblwid2]u+\\n[tblwid3]u+\\n[tblwid4]u'\D'l 0 -\\n[tblht]u'\v'\\n[tblht]u'\
\h'|\\n[tblwid1]u+\\n[tblwid2]u+\\n[tblwid3]u+\\n[tblwid4]u+\\n[tblwid5]u'\D'l 0 -\\n[tblht]u'\v'\\n[tblht]u'\
\h'|\\n[tblwid1]u+\\n[tblwid2]u+\\n[tblwid3]u+\\n[tblwid4]u+\\n[tblwid5]u+\\n[tblwid6]u'\D'l 0 -\\n[tblht]u'\v'\\n[tblht]u'
.		ps
.		sp -1
.	\}
.	if \\n[tblboxrow]:(\\n[tblboxall]&\\$1) \{\
.		ie \\$1 .ps \\n[tblbrdrsz]
.		el .ps \\n[tblhorisz]
\h'|0'\D'l \\n[tblwid]u 0'
.		ps
.		sp -1
.	\}
.	cl
.	sp
..
.de tblcol
.	br
.	if \\n[tblcol.ok] .tblcolend \\$1
.	tblcolbeg \\$1
.	if \\n(.$>=2 \\$2
..
.de tblrow
.	if \\n[tblrow.ok] .tblrowend 0
.	tblrowbeg
.	if \\n(.$>=1 .tblcol 1
.	if \\n(.$>=1 \\$1
.	if \\n(.$>=2 .tblcol 2
.	if \\n(.$>=2 \\$2
.	if \\n(.$>=3 .tblcol 3
.	if \\n(.$>=3 \\$3
.	if \\n(.$>=4 .tblcol 4
.	if \\n(.$>=4 \\$4
.	if \\n(.$>=5 .tblcol 5
.	if \\n(.$>=5 \\$5
.	if \\n(.$>=6 .tblcol 6
.	if \\n(.$>=6 \\$6
.	if \\n(.$>=7 .tblcol 7
.	if \\n(.$>=7 \\$7
..
.de tblend
.	br
.	if \\n[tblcol.ok] .tblcolend
.	if \\n[tblrow.ok] .tblrowend 1
.	tblrst
..