Initial import of binutils 2.22 on the new vendor branch
[dragonfly.git] / contrib / groff / tmac / www.tmac
1 .ig
2 www.tmac - macro package for adding HTML elements to roff documents.
3
4 File position: <groff_source_top>/tmac/www.tmac
5 Installed position: groff's main macro directory.
6
7 ------------------------------------------------------------------------
8     Legalize
9 ------------------------------------------------------------------------
10
11 This file is part of groff, the GNU roff type-setting system.
12
13 Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009
14   Free Software Foundation, Inc.
15 written by Gaius Mulley <gaius@glam.ac.uk>, with additions by
16 Werner Lemberg <wl@gnu.org> and Bernd Warken <bwarken@mayn.de>.
17
18 groff is free software; you can redistribute it and/or modify it under
19 the terms of the GNU General Public License as published by the Free
20 Software Foundation, either version 3 of the License, or
21 (at your option) any later version.
22
23 groff is distributed in the hope that it will be useful, but WITHOUT
24 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
25 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
26 for more details.
27
28 You should have received a copy of the GNU General Public License
29 along with this program. If not, see <http://www.gnu.org/licenses/>.
30
31
32 ------------------------------------------------------------------------
33     Description
34 ------------------------------------------------------------------------
35
36 A simple set of macros to provide HTML (or XHTML) documents with basic
37 www functionality.  It should work with any macro set.  In the following,
38 HTML always denotes XHTML also.
39 ..
40 .
41 .
42 .\" --------------------------------------------------------------------
43 .\" Setup
44 .\" --------------------------------------------------------------------
45 .
46 .do if d www:lenstr .nx
47 .
48 .do mso devtag.tmac
49 .
50 .nr _C \n(.C
51 .cp 0
52 .
53 .
54 .ie r xhtml \
55 .  ds www-> />\"
56 .el \
57 .  ds www-> >\"
58 .
59 .nr www-html 0
60 .if '\*[.T]'html' \
61 .  nr www-html 1
62 .
63 .\" set up www-image-template
64 .
65 .if !d www-image-template \
66 .  ds www-image-template
67 .
68 .if r ps4html \{\
69 .  \" remove the title command when we are generating images for HTML
70 .  \" (stops a title accidentally appearing inside an image)
71 .  di www-notitle
72 .  tl ''''
73 .  di
74 .  rm tl
75 .  de tl
76 .  .
77 .\}
78 .
79 .
80 .\" --------------------------------------------------------------------
81 .\" Test for `.substring'; result in register `www.substring_ok'.
82 .\" The automated break points in .URL addresses are only added if
83 .\" this register is non-zero.
84 .\"
85 .nr www:substring_ok 0
86 .de www:@test_substring
87 .  if !d substring \
88 .    return
89 .  ds \\$0:s abcdefg\"
90 .  substring \\$0:s 1 1
91 .  if !'\\*[\\$0:s]'b' \{\
92 .    rm \\$0:s
93 .    return
94 .  \}
95 .  ds \\$0:s abcdefg\"
96 .  substring \\$0:s 0 0
97 .  if !'\\*[\\$0:s]'a' \{\
98 .    rm \\$0:s
99 .    return
100 .  \}
101 .  ds \\$0:s abcdefg\"
102 .  substring \\$0:s 1 -1
103 .  if !'\\*[\\$0:s]'bcdefg' \{\
104 .    rm \\$0:s
105 .    return
106 .  \}
107 .  nr www:substring_ok 1
108 .  rm \\$0:s
109 ..
110 .www:@test_substring
111 .rm www:@test_substring
112 .
113 .
114 .\" --------------------------------------------------------------------
115 .\" Local Macros
116 .\" --------------------------------------------------------------------
117 .
118 .\" --------------------------------------------------------------------
119 .\" www:paraspace
120 .\"
121 .\" Space before paragraph. Use \n[PD] if it exists.
122 .\"
123 .nr www:pd 0.5v
124 .
125 .de www:paraspace
126 .  ie r PD \
127 .    sp \\n[PD]u
128 .  el \
129 .    sp \\n[www:pd]u
130 ..
131 .
132 .\" --------------------------------------------------------------------
133 .\" www:error (<test>...)
134 .\"
135 .\" Print error message.
136 .\"
137 .de www-error
138 .  tm \\n[.F]:\\n[.c]: macro error: \\$*
139 ..
140 .
141 .als www:error www-error
142 .
143 .\" --------------------------------------------------------------------
144 .\" www:lenstr (<register_name> <string_name>)
145 .\"
146 .\" Store length of string named <string_name> into register named
147 .\" <register_name>.
148 .\"
149 .de www:lenstr
150 .  if !(\\n[.$] == 2) \{\
151 .    tm .\\$0 expects 2 arguments.
152 .    ab
153 .  \}
154 .  length \\$0:n x\\*[\\$2]
155 .  nr \\$1 (\\n[\\$0:n] - 1)
156 .  rr \\$0:n
157 ..
158 .
159 .\" --------------------------------------------------------------------
160 .\" www:splitstr (<name>)
161 .\"
162 .\" Add a space character between any two adjacent characters in string
163 .\" <name> and restore result into the string variable <name>; space
164 .\" characters are first replaced by the word `space'.
165 .\"
166 .de www:splitstr
167 .  if !(\\n[.$] == 1) \
168 .    www:error .\\$0 expects 1 argument.
169 .  if '\\*[\\$1]'' \
170 .    return
171 .  ds \\$0:r "\\*[\\$1]\"
172 .  ds \\$0:s
173 .  while 1 \{\
174 .    ds \\$0:c "\\*[\\$0:r]\"
175 .    substring \\$0:c 0 0
176 .    ie '\\*[\\$0:c]' ' \
177 .      as \\$0:s " space\"
178 .    el \
179 .      as \\$0:s " \\*[\\$0:c]\"
180 .    www:lenstr \\$0:n \\$0:r
181 .    if (\\n[\\$0:n] <= 1) \
182 .      break
183 .    substring \\$0:r 1 -1
184 .  \}
185 .  if !'\\*[\\$0:s]'' \
186 .    substring \\$0:s 1 -1 
187 .  ds \\$1 \\*[\\$0:s]\"
188 .  rm \\$0:c
189 .  rr \\$0:n
190 .  rm \\$0:r
191 .  rm \\$0:s
192 ..
193 .
194 .\" --------------------------------------------------------------------
195 .\" www:url_breaks (<string_name>)
196 .\"
197 .\" Add `\:' (possible break point) within URL strings after `/'.
198 .\"
199 .\" Smart about multiple `/', existing `\:', and space characters;
200 .\" does not set a break point if less than 5 characters would go to
201 .\" the next line.
202 .\"
203 .de www:url_breaks
204 .  if !(\\n[.$] == 1) \
205 .    www:error .\\$0 expects 1 argument.
206 .  if !\n[www:substring_ok] \
207 .    return
208 .  ds \\$0:s "\\*[\\$1]\"
209 .  www:splitstr \\$0:s
210 .  www:url_breaks_split \\$0:s \\*[\\$0:s]
211 .  ds \\$1 "\\*[\\$0:s]\"
212 .  rm \\$0:s
213 ..
214 .
215 .\" --------------------------------------------------------------------
216 .\" www:url_breaks_split (<result> <char> [<char>...])
217 .\"
218 .\" Add `\:' within URL strings, but arguments are a split string.
219 .\"
220 .\" Arguments: >=2: <result> <char> [<char>...]
221 .\"
222 .de www:url_breaks_split
223 .  nr \\$0:min 5             \" minimal number of characters for next line
224 .  if (\\n[.$] < 2) \
225 .    www:error .\\$0 expects at least 2 arguments.
226 .  ds \\$0:res \\$1\"
227 .  shift
228 .  ds \\$0:s
229 .  nr \\$0:done 0
230 .  while !\\n[\\$0:done] \{\
231 .    if (\\n[.$] <= 0) \
232 .      break
233 .    if '\\$1'space' \{\
234 .      as \\$0:s " \"
235 .      shift
236 .      continue
237 .    \}
238 .    if (\\n[.$] < \\n[\\$0:min]) \{\
239 .      as \\$0:s "\\$1\"
240 .      shift
241 .      continue
242 .    \}
243 .    if !'\\$1'/' \{\
244 .      as \\$0:s "\\$1\"
245 .      shift
246 .      continue
247 .    \}
248 .    \" we are at a `/' character
249 .    while '\\$1'/' \{\
250 .      as \\$0:s /\"
251 .      if (\\n[.$] == 0) \{\
252 .        nr \\$0:done 1
253 .        break
254 .      \}
255 .      shift
256 .    \}
257 .    if \\n[\\$0:done] \
258 .      break
259 .    if (\\n[.$] < \\n[\\$0:min]) \
260 .      continue
261 .    if '\\$1'\:' \
262 .      shift
263 .    as \\$0:s \:\"
264 .  \}
265 .  ds \\*[\\$0:res] \\*[\\$0:s]\"
266 .  rm \\$0:res
267 .  rm \\$0:s
268 ..
269 .
270 .
271 .\" --------------------------------------------------------------------
272 .\" User Interface
273 .\" --------------------------------------------------------------------
274 .
275 .\" --------------------------------------------------------------------
276 .\" HTML
277 .\"
278 .\" The main auxiliary macro for the HTML interface.
279 .\"
280 .de HTML
281 .  if \\n[www-html] \{\
282 .    \" was implemented via .nop \&\X^html:\\$*^ but
283 .    \" is now implemented using HTML-NS to utilize code factoring.
284 .    \"
285 .    \" the `\&' makes the vertical mode leave, so to say
286 .    \"
287 .    nop \&\c
288 .    HTML-NS \\$*
289 .    nop \&
290 .  \}
291 ..
292 .
293 .\"
294 .\" An auxiliary macro for HTML (without following space).
295 .\"
296 .de HTML-NS
297 .  nop \X^html:\\$*^\c
298 ..
299 .
300 .\"
301 .\" Emit an HTML tag after shutting down a (possibly open) paragraph.
302 .\"
303 .de HTML</p>
304 .  ie \\n[www-html] \{\
305 .    \" the `\&' makes the vertical mode leave, so to say
306 .    nop \&\X^html</p>:\\$*^
307 .  \}
308 .  el \
309 .    www:paraspace
310 ..
311 .
312 .\"
313 .\" Emit an HTML tag.  If text has been written in the paragraph
314 .\"                    then do not shut the paragraph down.
315 .\"                    If text was not written, remove the empty
316 .\"                    paragraph tag and emit the desired HTML tag.
317 .\"
318 .de HTML<?p>
319 .  if \\n[www-html] \
320 .    nop \&\X^html<?p>:\\$*^
321 ..
322 .
323 .\"
324 .\" Emit a MATH tag.  If text has been written in the paragraph
325 .\"                   then do not shut the paragraph down.
326 .\"                   If text was not written, remove the empty
327 .\"                   paragraph tag and emit the desired math tag.
328 .\"
329 .de MATH<?p>
330 .  if \\n[www-html] \
331 .    nop \&\X^math<?p>:\\$*^
332 ..
333 .
334 .\" --------------------------------------------------------------------
335 .\" HX n
336 .\"
337 .\"   Automatic heading level cut off.
338 .\"
339 .\"   N is the depth limit of automatically linked headings.  So a depth
340 .\"   of 2 would cause grohtml to generate a list of links for `.NH 1'
341 .\"   and `.NH 2' but not for `.NH 3'.
342 .\"
343 .de HX
344 .  if \\n[www-html] \
345 .    nop \X^index:\\$*^
346 ..
347 .
348 .\" --------------------------------------------------------------------
349 .\" BCL foreground background active not-visited visited
350 .\"
351 .de BCL
352 .  HTML <body "text=""\\$1""" \
353               "bgcolor=""\\$2""" \
354               "link=""\\$3""" \
355               "alink=""\\$4""" \
356               "vlink=""\\$5"">"
357 ..
358 .
359 .\" --------------------------------------------------------------------
360 .\" BGIMG imagefile
361 .\"
362 .de BGIMG
363 .  HTML <body "background=""\\$1"">"
364 ..
365 .
366 .\" www:url_check_tag str
367 .\"    If url named by \*[str] is internal (starts with #), 
368 .\"    redefine \*[str] to be the value of the string TAG_url.
369 .
370 .de www:url_check_tag
371 .  ds \\$0:tmp \\*[\\$1]\"
372 .  substring \\$0:tmp 0 0
373 .  if '\\*[\\$0:tmp]'#' \{\
374 .    ds \\$0:tmp \\*[\\$1]\"
375 .    substring \\$0:tmp 1
376 .    ds \\$0:tmp TAG_\\*[\\$0:tmp]\"
377 .
378 .    ie d \\*[\\$0:tmp] \
379 .      ds \\$1 \\*[\\*[\\$0:tmp]]\"
380 .    el \
381 .      ds \\$1 see below\"
382 .  \} 
383 .  rm \\$0:tmp
384 ..
385 .
386 .\" --------------------------------------------------------------------
387 .\" URL url [description] [after]
388 .\"
389 .\"   If description is absent then the url becomes the anchor text.
390 .\"
391 .de URL
392 .  if !'\\$1'' \{\
393 .    ds \\$0:adr \\$1\"
394 .    www:url_check_tag \\$0:adr
395 .    if !\\n[www-html] \
396 .      www:url_breaks \\$0:adr
397 .  \}
398 .  ie \\n[www-html] \{\
399 .    ie '\\$3'' \
400 .      ds \\$0:after \&\"
401 .    el \
402 .      ds \\$0:after \&\\$3\"
403 .
404 .    ie '\\$2'' \
405 .       HTML-NS <a "href=""\\$1"">\\*[\\$0:adr]</a>"
406 .    el \
407 .       HTML-NS <a "href=""\\$1"">\\$2</a>"
408 .
409 .    nop \\*[\\$0:after]
410 .    rm \\$0:after
411 .  \}
412 .  el \{\
413 .    if !r ps4html \
414 .      ad l
415 .
416 .    ie '\\$2'' \{\
417 .      ie '\\$1'' \{\
418 .        if !'\\$3'' \
419 .          nop \\$3
420 .      \}
421 .      el \{\
422 .        ie \\n[.color] \
423 .          nop \%\\*[www:open]\m[\\*[www:color]]\f[\\*[www:fontstyle]]\\*[\\$0:adr]\f[]\m[]\\*[www:close]\\$3
424 .        el \
425 .          nop \%\\*[www:open]\f[\\*[www:fontstyle]]\\*[\\$0:adr]\f[]\\*[www:close]\\$3
426 .      \}
427 .    \}
428 .    el \{\
429 .      ie '\\$1'' \{\
430 .        ie \\n[.color] \
431 .          nop \m[\\*[www:color]]\\$2\m[]\\$3
432 .        el \
433 .          nop \f[\\*[www:fontstyle]]\\$2\f[]\\$3
434 .      \}
435 .      el \{\
436 .        ie \\n[.color] \{\
437 .          nop \m[\\*[www:color]]\\$2\m[]
438 .          nop \%\\*[www:open]\f[\\*[www:fontstyle]]\\*[\\$0:adr]\f[]\\*[www:close]\\$3
439 .        \}
440 .        el \{\
441 .          nop \f[\\*[www:fontstyle]]\\$2\f[]
442 .          nop \%\\*[www:open]\f[\\*[www:fontstyle]]\\*[\\$0:adr]\f[]\\*[www:close]\\$3
443 .        \}
444 .      \}
445 .    \}
446 .
447 .    if !r ps4html \
448 .      ad
449 .  \}
450 .  rm \\$0:adr
451 ..
452 .
453 .\" --------------------------------------------------------------------
454 .\" FTP url description [after]
455 .\"
456 .\"   Same as URL.
457 .\"
458 .als FTP URL
459 .
460 .\" --------------------------------------------------------------------
461 .\" MTO address description [after]
462 .\"
463 .\"   ADDRESS is the email address (without the `mailto:' prefix).
464 .\"
465 .\"   DESCRIPTION is the optional name.  If an empty argument is given,
466 .\"   ADDRESS is used instead.
467 .\"
468 .\"   AFTER is optional stuff printed immediately after ADDRESS
469 .\"   (resp. DESCRIPTION).
470 .\"
471 .\"     Example:
472 .\"
473 .\"       Foobar has been written by
474 .\"       .MTO fred@foo.bar "Fredrick Bloggs" .
475 .\"
476 .de MTO
477 .  ie \\n[www-html] \{\
478 .    ie '\\$2'' \
479 .      URL mailto:\\$1 \\$1 "\\$3"
480 .    el \
481 .      URL mailto:\\$1 "\\$2" "\\$3"
482 .  \}
483 .  el \{\
484 .    ie '\\$2'' \{\
485 .      ie '\\$1'' \{\
486 .        ie !'\\$3'' \
487 .          nop \\$3
488 .      \}
489 .      el \{\
490 .        ie \\n[.color] \
491 .          nop \%\m[\\*[www:color]]\f[\\*[www:fontstyle]]\\$1\f[]\m[]\\$3
492 .        el \
493 .          nop \%\f[\\*[www:fontstyle]]\\$1\f[]\\$3
494 .      \}
495 .    \}
496 .    el \{\
497 .      ie '\\$1'' \{\
498 .        ie \\n[.color] \
499 .          nop \m[\\*[www:color]]\\$2\m[]\\$3
500 .        el \
501 .          nop \f[\\*[www:fontstyle]]\\$2\f[]\\$3
502 .      \}
503 .      el \{\
504 .        ie \\n[.color] \{\
505 .          nop \m[\\*[www:color]]\\$2\m[]
506 .          nop \%\\*[www:open]\f[\\*[www:fontstyle]]\\$1\f[]\\*[www:close]\\$3
507 .        \}
508 .        el \{\
509 .          nop \f[\\*[www:fontstyle]]\\$2\f[]
510 .          nop \%\\*[www:open]\f[\\*[www:fontstyle]]\\$1\f[]\\*[www:close]\\$3
511 .        \}
512 .      \}
513 .    \}
514 .  \}
515 ..
516 .
517 .\" --------------------------------------------------------------------
518 .\" TAG name [text]
519 .\"
520 .\"   Generate an HTML name NAME.
521 .\"   Define string TAG_NAME to TEXT, if present, otherwise to \n[PN].
522 .\"
523 .de TAG
524 .  HTML <a "name=""\\$1""></a>"
525 .  ie '\\$2'' \
526 .    ds TAG_\\$1 \\n[PN]\"
527 .  el \
528 .    ds TAG_\\$1 \\$2\"
529 ..
530 .
531 .\" --------------------------------------------------------------------
532 .\" IMG [-R|-L|-C] filename [width] [height]
533 .\"
534 .\"   Include an image of any type (only works for -Thtml).
535 .\"
536 .\"   Alignment is centered by default (-C).
537 .\"   Default value for WIDTH is 1i.
538 .\"   If HEIGHT is not given, WIDTH is used as the height.
539 .\"
540 .de IMG
541 .  ie \\n[www-html] \{\
542 .    ie '\\$2'-R' \
543 .      DEVTAG .right-image
544 .    el \{\
545 .      ie '\\$2'-L' \
546 .        DEVTAG .left-image
547 .      el \
548 .        DEVTAG .centered-image
549 .    \}
550 .    nr www-width 100
551 .    if !'\\$3'' \
552 .      nr www-width \\$3
553 .    nr www-height \\n[www-width]
554 .    if !'\\$4'' \
555 .      nr www-height \\$4
556 .    HTML <img "src=""\\$1""" \
557                "alt=""Image \\$1""" \
558                "width=""\\n[www-width]""" \
559                "height=""\\n[www-height]""\\*[www->]"
560 .  \}
561 .  el \
562 .    nop \\*[www:open]\f[\\*[www:fontstyle]]\\$1\f[]\\*[www:close]
563 ..
564 .
565 .\" --------------------------------------------------------------------
566 .\" PIMG  [-R|-L|-C] filename [width] [height]
567 .\"
568 .\"   Include a PNG image.  It works for -Tps and -Thtml.
569 .\"   The default value for WIDTH and HEIGHT is zero; the default
570 .\"   alignment is centering (-C).
571 .\"
572 .\" Note: This macro can only be used with the `-U' option of groff,
573 .\"       activating unsafe mode, if not used with -Thtml; the PNG image
574 .\"       is then converted to the EPS format using netpbm utilities.
575 .\"
576 .de PIMG
577 .  ds www-pic-align -C\"
578 .  ie '\\$1'-R' \{\
579 .    ds www-pic-align -R\"
580 .    shift
581 .  \}
582 .  el \{\
583 .    if '\\$1'-L' \{\
584 .      ds www-pic-align -L\"
585 .      shift
586 .    \}
587 .  \}
588 .  if '\\$1'-C' \
589 .    shift
590 .
591 .  ie \\n[www-html] \{\
592 .    ds www-htmlalign align="center"\"
593 .    if '\\*[www-pic-align]'-R' \
594 .      ds www-htmlalign align="right"\"
595 .    if '\\*[www-pic-align]'-L' \
596 .      ds www-htmlalign align="left"\"
597 .
598 .    nr www-width 0
599 .    nr www-height 0
600 .    if !'\\$2'' \
601 .      nr www-width (\\$3 * 100 / 240)
602 .    if !'\\$3'' \
603 .      nr www-height (\\$4 * 100 / 240)
604 .    ie (\\n[www-width] == 0) \{\
605 .      ie (\\n[www-height] == 0) \
606 .        HTML</p> <p \\*[www-htmlalign]><img "src=""\\$1""" \
607                                              "alt=""Image \\$1""\\*[www->]</p>"
608 .      el \
609 .        HTML</p> <p \\*[www-htmlalign]><img "src=""\\$1""" \
610                                              "alt=""Image \\$1""" \
611                                              "height=""\\n[www-height]""\\*[www->]</p>"
612 .    \}
613 .    el \{\
614 .      ie (\\n[www-height] == 0) \
615 .        HTML</p> <p \\*[www-htmlalign]><img "src=""\\$1""" \
616                                              "alt=""Image \\$1""" \
617                                              "width=""\\n[www-width]""\\*[www->]</p>"
618 .      el \
619 .        HTML</p> <p \\*[www-htmlalign]><img "src=""\\$1""" \
620                                              "alt=""Image \\$1""" \
621                                              "width=""\\n[www-width]""" \
622                                              "height=""\\n[www-height]""\\*[www->]</p>"
623 .    \}
624 .  \}
625 .  el \{\
626 .    if !r ps4html \{\
627 .      www-make-unique-name
628 .      sy pngtopnm \\$1 \
629           | pnmcrop -white \
630           | @PNMTOPS_NOSETPAGE@ -noturn \
631           > \\*[www-unique-name].eps
632 .      shift
633 .      PSPIC \\*[www-pic-align] \\*[www-unique-name].eps \\$*
634 .    \}
635 .  \}
636 ..
637 .
638 .\" --------------------------------------------------------------------
639 .\" auxiliary definitions for MPIMG
640 .\"
641 .nr www-left-ll-trap 0
642 .nr www-left-po-trap 0
643 .nr www-right-ll-trap 0
644 .
645 .de www-finish-left-po
646 .  po -(\\n[www-left-indent]u + \\n[www-image-gap]u)
647 .  wh \\n[www-left-po-trap]u
648 .  nr www-left-indent 0
649 ..
650 .
651 .\" called when the -R picture is finished
652 .de www-finish-right-ll
653 .  ll +(\\n[www-right-indent]u + \\n[www-image-gap]u)
654 .
655 .  \" now check whether we need to inline www-finish-left-ll
656 .  if (\\n[www-left-ll-trap]u > 0) \
657 .    if ((\\n[www-right-ll-trap]u + 1v) >= \\n[www-left-ll-trap]u) \{\
658 .      mk www-left-po-trap
659 .      nr www-left-po-trap +1v
660 .      wh \\n[www-left-po-trap]u www-finish-left-po
661 .      ll +\\n[www-left-indent]u
662 .      wh \\n[www-left-ll-trap]u
663 .      nr www-left-ll-trap 0
664 .    \}
665 .
666 .  \" and check whether we need to inline www-finish-left-po
667 .  if (\\n[www-left-po-trap]u > 0) \
668 .    if ((\\n[www-right-ll-trap]u + 1v) >= \\n[www-left-po-trap]u) \{\
669 .      po -\\n[www-left-indent]u
670 .      wh \\n[www-left-po-trap]u
671 .      nr www-left-indent 0
672 .    \}
673 .
674 .  wh \\n[www-right-ll-trap]u
675 .  nr www-right-ll-trap 0
676 ..
677 .
678 .de www-finish-left-ll
679 .  if (\\n[www-right-ll-trap] > 0) \
680 .    if ((\\n[www-left-ll-trap] + 1v) >= \\n[www-right-ll-trap]) \{\
681 .      ll +\\n[www-right-indent]u
682 .      nr www-right-ll-trap 0
683 .    \}
684 .
685 .  mk www-left-po-trap
686 .  nr www-left-po-trap +1v
687 .  wh \\n[www-left-po-trap]u www-finish-left-po
688 .  ll +(\\n[www-left-indent]u + \\n[www-image-gap]u)
689 .  wh \\n[www-left-ll-trap]u
690 .  nr www-left-ll-trap 0
691 ..
692 .
693 .\" www-handle-percent arg N1 N2 S1
694 .\"                    arg - input string (number or number%)
695 .\"                    output parameters:
696 .\"                    N1 - name of number register 1=absolute 0=percentage
697 .\"                    N2 - number register name for absolute value
698 .\"                    S1 - string register name for percentage value
699 .\"
700 .de www-handle-percent 
701 .  ds www-percent \\$1\"
702 .  substring www-percent -1 -1
703 .
704 .  ie '\\*[www-percent]'%' \{\
705 .    ds www-abs \\$1\"
706 .    substring www-abs 0 -2
707 .    nr \\$2 0
708 .    nr \\$3 \\*[www-abs]
709 .    ds \\$4 \\$1\"
710 .  \}
711 .  el \{\
712 .    nr \\$2 1
713 .    nr \\$3 \\$1
714 .    ds \\$4 none\"
715 .  \}
716 ..
717 .
718 .\" --------------------------------------------------------------------
719 .\" MPIMG [-R|-L] [-G gap] filename [width [height]]
720 .\"
721 .\"   Include a PNG image and wrap text around it.  It works for
722 .\"   -Tps and -Thtml.  The default value for WIDTH is 1i; default value
723 .\"   for HEIGHT is WIDTH; the default alignment is left (-L).
724 .\"   -G is used to insert a gap between the text and the image.
725 .\"   The height and width can also be given as a percentage.
726 .\"   The PostScript device converts the percentage width into an
727 .\"   absolute value by using \\n[.l], and the height by using \\n[.p].
728 .\"   
729 .\"
730 .\" Note: This macro can only be used with the `-U' option of groff,
731 .\"       activating unsafe mode, if not used with -Thtml; the PNG image
732 .\"       is then converted to the EPS format using netpbm utilities.
733 .\"
734 .nr www-htmlimage-gap 0
735 .
736 .de MPIMG
737 .  nr www-image-just 1
738 .  nr www-image-gap 0
739 .  while (\\n[.$] > 0) \{\
740 .    if '-L'\\$1' \{\
741 .      nr www-image-just 1
742 .      shift
743 .      continue
744 .    \}
745 .    if '-R'\\$1' \{\
746 .      nr www-image-just 0
747 .      shift
748 .      continue
749 .    \}
750 .    if '-G'\\$1' \{\
751 .      nr www-image-gap \\$2
752 .      nr www-htmlimage-gap (\\$2 * 100 / 240)
753 .      shift 2
754 .      continue
755 .    \}
756 .    break
757 .  \}
758 .
759 .  nr www-width 1i
760 .  nr www-height 1i
761 .  ds www-size-specs width="\\n[www-width]" height="\\n[www-height]"\"
762 .  ie !'\\$2'' \{\
763 .    nr www-is-absolute 0
764 .    nr www-absolute 0
765 .    ds www-percentage none\"
766 .    www-handle-percent \\$2 www-is-absolute www-absolute www-percentage
767 .    ie !\\n[www-is-absolute] \{\
768 .      \" percentage of linelength requested
769 .      nr www-width (\\n[www-absolute] * \\n[.l] / 100)
770 .      if \\n[www-html] \
771 .        nr www-width (\\n[www-width] * 100 / 240)
772 .      ds www-size-specs width="\\*[www-percentage]"\"
773 .    \}
774 .    el \{\
775 .      nr www-width \\n[www-absolute]
776 .      if \\n[www-html] \
777 .        nr www-width (\\n[www-width] * 100 / 240)
778 .      ds www-size-specs width="\\n[www-width]"\"
779 .    \}
780 .
781 .    nr www-height \\n[www-width]
782 .    ie !'\\$3'' \{\
783 .      nr www-is-absolute 0
784 .      nr www-absolute 0
785 .      ds www-percentage none\"
786 .      www-handle-percent \\$3 www-is-absolute www-absolute www-percentage
787 .      ie !\\n[www-is-absolute] \{\
788 .        \" percentage of pagelength requested
789 .        nr www-height (\\n[www-absolute] * \\n[.p] / 100)
790 .        if \\n[www-html] \
791 .           nr www-height (\\n[www-height] * 100 / 240)
792 .        ds www-size-specs "\\*[www-size-specs] height="\\*[www-percentage]"\"
793 .      \}
794 .      el \{\
795 .        nr www-height \\n[www-absolute]
796 .        if \\n[www-html] \
797 .           nr www-height (\\n[www-height] * 100 / 240)
798 .        ds www-size-specs "\\*[www-size-specs] height="\\*[www-height]"\"
799 .      \}
800 .    \}
801 .  \}
802 .  el \{\
803 .    \" height not specified; use width value
804 .    ie !\\n[www-is-absolute] \{\
805 .       \" percentage value
806 .       ds www-size-specs "\\*[www-size-specs] height="\\*[www-percentage]"\"
807 .       nr www-height \\n[www-width]
808 .    \}
809 .    el \{\
810 .       ds www-size-specs "\\*[www-size-specs] height="\\*[www-width]"\"
811 .       nr www-height \\n[www-width]
812 .    \}
813 .  \}
814 .
815 .  ie \\n[www-html] \{\
816 .    ie !\\n[www-image-just] \
817 .      HTML <img "src=""\\$1""" \
818                  "alt=""Image \\$1""" \
819                  "hspace=""\\n[www-htmlimage-gap]""" \
820                  "align=""right""" \
821                  "\\*[www-size-specs]\\*[www->]"
822 .    el \
823 .      HTML <img "src=""\\$1""" \
824                  "alt=""Image \\$1""" \
825                  "hspace=""\\n[www-htmlimage-gap]""" \
826                  "align=""left""" \
827                  "\\*[www-size-specs]\\*[www->]"
828 .  \}
829 .  el \{\
830 .    tm www-width is \\n[www-width]
831 .    tm www-height is \\n[www-height]
832 .    if !r ps4html \{\
833 .      www-make-unique-name
834 .      sy pngtopnm \\$1 \
835           | pnmcrop -white \
836           | @PNMTOPS_NOSETPAGE@ -noturn \
837           > \\*[www-unique-name].eps
838 .      ie !\\n[www-image-just] \{\
839 .        \" we must now disable a possible left image trap
840 .        sp -1
841 .        if (\\n[www-left-ll-trap] > 0) \
842 .          wh \\n[www-left-ll-trap]u
843 .        if (\\n[www-left-po-trap] > 0) \
844 .          wh \\n[www-left-po-trap]u
845 .        PSPIC -R \\*[www-unique-name].eps \\n[www-width]u \\n[www-height]u
846 .        sp -\\n[ps-desht]u
847 .
848 .        nr www-right-indent \\n[ps-deswid]u
849 .        \" we want to have some space between text and image,
850 .        \" so the line length must be shorter
851 .        ll -(\\n[www-right-indent]u + \\n[www-image-gap]u)
852 .        mk www-right-ll-trap
853 .        nr www-right-ll-trap +(\\n[ps-desht]u - 1v)
854 .        wh \\n[www-right-ll-trap]u www-finish-right-ll
855 .
856 .        \" now restore possible left trap
857 .        if (\\n[www-left-ll-trap] > 0) \
858 .          wh \\n[www-left-ll-trap]u www-finish-left-ll
859 .        if (\\n[www-left-po-trap] > 0) \
860 .          wh \\n[www-left-po-trap]u
861 .      \}
862 .      el \{\
863 .        \" we must now disable a possible right image trap
864 .        if (\\n[www-right-ll-trap] > 0) \
865 .          wh \\n[www-right-ll-trap]u
866 .        PSPIC -L \\*[www-unique-name].eps \\n[www-width]u \\n[www-height]u
867 .        sp -\\n[ps-desht]u
868 .
869 .        nr www-left-indent \\n[ps-deswid]u
870 .        \" increase offset by gap
871 .        po +(\\n[www-left-indent]u + \\n[www-image-gap]u)
872 .        \" decrease line length by gap
873 .        ll -(\\n[www-left-indent]u + \\n[www-image-gap]u)
874 .        mk www-left-ll-trap
875 .        nr www-left-ll-trap +(\\n[ps-desht]u - 1v)
876 .        wh \\n[www-left-ll-trap]u www-finish-left-ll
877 .
878 .        \" now restore possible right trap
879 .        if (\\n[www-right-ll-trap] > 0) \
880 .          wh \\n[www-right-ll-trap]u www-finish-right-ll
881 .      \}
882 .    \}
883 .  \}
884 ..
885 .
886 .\" --------------------------------------------------------------------
887 .\" HnS n
888 .\"
889 .\"   Begin heading.  Heading level is N.
890 .\"
891 .\" HnE
892 .\"
893 .\"   End heading.
894 .\"
895 .\" If your heading contains URL, FTP, MTO macros you might wish to
896 .\" disable automatic links to headings.  This can be done via `-P-l'
897 .\" from the command line or by using a cakk to `.HX 0'.
898 .\"
899 .nr www-heading-no -1
900 .
901 .de HnS
902 .  ie '\\$1'' \
903 .    nr www-heading-no 1
904 .  el \
905 .    nr www-heading-no \\$1
906 .  DEVTAG-NH \\n[www-heading-no]
907 ..
908 .
909 .de HnE
910 .  if (\\n[www-heading-no] == -1) \
911 .    www-error HnE found without a corresponding HnS
912 .  DEVTAG-EO-H
913 ..
914 .
915 .\" --------------------------------------------------------------------
916 .\" LK
917 .\"
918 .\"   Emit the automatically collected links derived from
919 .\"   section/numbered headings at this position.
920 .\"
921 .de LK
922 .  DEVTAG .links
923 ..
924 .
925 .\" --------------------------------------------------------------------
926 .\" HR
927 .\"
928 .\"   Produce a horizontal line.
929 .\"
930 .de HR
931 .  HTML</p> <hr\\*[www->]
932 ..
933 .
934 .\" --------------------------------------------------------------------
935 .\" NHR
936 .\"
937 .\"  Suppress the generation of the top and bottom rules which grohtml
938 .\"  emits by default.
939 .\"
940 .de NHR
941 .  DEVTAG .no-auto-rule
942 ..
943 .
944 .\"
945 .\" www-end-nowhere - end of input trap called to finish diversion.
946 .\"
947 .de www-end-nowhere
948 .  if !\\n[www-html] \
949 .    di
950 .  DEVTAG-EO-TL
951 ..
952 .
953 .\" --------------------------------------------------------------------
954 .\" HTL
955 .\"
956 .\"   Generate an HTML title only.  This differs from the -ms .TL macro
957 .\"   which generates both an HTML title and an H1 heading.
958 .\"
959 .\"   This is useful when an author wishes to use an HTML title as search
960 .\"   engine fodder but a graphic title in the document.
961 .\"
962 .\"   The macro terminates when a space or break is seen (.sp, .br).
963 .\"
964 .de HTL
965 .  DEVTAG .html-tl
966 .  if !\\n[www-html] \
967 .    di www-nowhere
968 .  it 2 www-end-nowhere
969 ..
970 .
971 .\" --------------------------------------------------------------------
972 .\" auxiliary definitions for lists
973 .\"
974 .ds www-ul-level1 \[bu]\ \ \"
975 .ds www-ul-level2 \[sq]\ \ \"
976 .ds www-ul-level3 \[ci]\ \ \"
977 .nr www-ul-level 0
978 .
979 .ds www-ol-level1 decimal\"
980 .ds www-ol-level2 lower-alpha\"
981 .ds www-ol-level3 lower-roman\"
982 .ds www-ol-tmp 00\ \ \"
983 .nr www-ol-ctr1 0 1
984 .nr www-ol-ctr2 0 1
985 .nr www-ol-ctr3 0 1
986 .af www-ol-ctr2 a
987 .af www-ol-ctr3 i
988 .nr www-ol-level 0
989 .
990 .nr www-dl-level 0
991 .nr www-dl-shift 5n
992 .
993 .\"
994 .\" allow nested lists
995 .\"
996 .nr www-depth 0
997 .nr www-li-indent \n[.i]
998 .ds www-level0 nop\"
999 .ds www-level1
1000 .ds www-level2
1001 .ds www-level3
1002 .ds www-level4
1003 .ds www-level5
1004 .ds www-level6
1005 .ds www-level7
1006 .ds www-level8
1007 .ds www-level9
1008 .
1009 .\" which macro to use for LI
1010 .de www-push-li
1011 .  nr www-depth +1
1012 .  ds www-level\\n[www-depth] \\$1\"
1013 .  ds www-ltag\\n[www-depth]
1014 .  als LI \\$1
1015 ..
1016 .
1017 .de www-pop-li
1018 .  nr www-depth -1
1019 .  als LI \\*[www-level\\n[www-depth]]
1020 ..
1021 .
1022 .\" www-emit-ltag - shut down a previous open list tag
1023 .\"                 before issuing a new tag \\$1.
1024 .\"                 It then records tag \\$1 is open.
1025 .
1026 .de www-emit-ltag
1027 .  if !'\\*[www-ltag\\n[www-depth]]'' \
1028 .    HTML-NS </\\*[www-ltag\\n[www-depth]]>
1029 .  if !'\\$1'' \
1030 .    HTML-NS <\\$1>
1031 .  ds www-ltag\\n[www-depth] \\$1\"
1032 ..
1033 .
1034 .\"
1035 .\" Auxiliary macro for ULS.
1036 .\"
1037 .de www-push-ul-level
1038 .  nr www-ul-level +1
1039 .  if (\\n[www-ul-level] > 3) \
1040 .    www-error ULS: too many levels of indentation (\\n[www-ul-level])
1041 ..
1042 .\"
1043 .\" Auxiliary macro for ULE.
1044 .\"
1045 .de www-pop-ul-level
1046 .  if !\\n[www-ul-level] \
1047 .    www-error ULE: trying to terminate a list which does not exist
1048 .  nr www-ul-level -1
1049 ..
1050 .
1051 .\"
1052 .\" Auxiliary macro for OLS.
1053 .\"
1054 .de www-push-ol-level
1055 .  nr www-ol-level +1
1056 .  if (\\n[www-ol-level] > 3) \
1057 .    www-error OLS: too many levels of indentation (\\n[www-ol-level])
1058 ..
1059 .
1060 .\"
1061 .\" Auxiliary macro for OLE.
1062 .\"
1063 .de www-pop-ol-level
1064 .  if !\\n[www-ol-level] \
1065 .    www-error OLE: trying to terminate a list which does not exist
1066 .  nr www-ol-level -1
1067 ..
1068 .
1069 .\" --------------------------------------------------------------------
1070 .\" ULS
1071 .\"
1072 .\"   Start an unordered list.
1073 .\"
1074 .de ULS
1075 .  www-push-li www-li-ul
1076 .  www-push-ul-level
1077 .  ie \\n[www-html] \{\
1078 .    www-emit-ltag
1079 .    HTML</p> <ul>
1080 .  \}
1081 .  el \
1082 .    nr www-li-indent +\w'\\*[www-ul-level\\n[www-ul-level]]'u
1083 ..
1084 .
1085 .\" --------------------------------------------------------------------
1086 .\" ULE
1087 .\"
1088 .\"   End an unordered list.
1089 .\"
1090 .de ULE
1091 .  ie \\n[www-html] \{\
1092 .    www-emit-ltag
1093 .    HTML</p> </ul>
1094 .  \}
1095 .  el \{\
1096 .    nr www-li-indent -\w'\\*[www-ul-level\\n[www-ul-level]]'u
1097 .    in \\n[www-li-indent]u
1098 .  \}
1099 .  www-pop-ul-level
1100 .  www-pop-li
1101 ..
1102 .
1103 .\" --------------------------------------------------------------------
1104 .\" OLS
1105 .\"
1106 .\"   Start an ordered list.
1107 .\"
1108 .de OLS
1109 .  www-push-li www-li-ol
1110 .  www-push-ol-level
1111 .  ie \\n[www-html] \{\
1112 .    www-emit-ltag
1113 .    HTML</p> <ol "style=""list-style-type:" \
1114                            "\\*[www-ol-level\\n[www-ol-level]]"">"
1115 .  \}
1116 .  el \
1117 .    nr www-li-indent +\w'\\*[www-ol-tmp]'u
1118 ..
1119 .
1120 .\" --------------------------------------------------------------------
1121 .\" OLE
1122 .\"
1123 .\"   End an ordered list.
1124 .\"
1125 .de OLE
1126 .  ie \\n[www-html] \{\
1127 .    www-emit-ltag
1128 .    HTML </ol>
1129 .  \}
1130 .  el \{\
1131 .    nr www-li-indent -\w'\\*[www-ol-tmp]'u
1132 .    in \\n[www-li-indent]u
1133 .    nr www-ol-ctr\\n[www-ol-level] 0 1
1134 .  \}
1135 .  www-pop-ol-level
1136 .  www-pop-li
1137 ..
1138 .
1139 .\" --------------------------------------------------------------------
1140 .\" DLS
1141 .\"
1142 .\"   Start a definition list.
1143 .\"
1144 .de DLS
1145 .  www-push-li www-li-dl
1146 .  nr www-dl-level +1
1147 .  ie \\n[www-html] \{\
1148 .    www-emit-ltag
1149 .    HTML</p> <dl>
1150 .  \}
1151 .  el \{\
1152 .    nr www-li-indent +\\n[www-dl-shift]u
1153 .    in \\n[www-li-indent]u
1154 .  \}
1155 ..
1156 .
1157 .\" --------------------------------------------------------------------
1158 .\" DLE
1159 .\"
1160 .\"   End a definition list.
1161 .\"
1162 .de DLE
1163 .  ie \\n[www-html] \{\
1164 .    www-emit-ltag
1165 .    HTML </dl>
1166 .  \}
1167 .  el \{\
1168 .    nr www-li-indent -\\n[www-dl-shift]u
1169 .    in \\n[www-li-indent]u
1170 .  \}
1171 .  nr www-dl-level -1
1172 .  www-pop-li
1173 ..
1174 .
1175 .\" --------------------------------------------------------------------
1176 .\" LI
1177 .\"
1178 .\"   Insert a list item.
1179 .\"
1180 .
1181 .\" ********
1182 .\" www-li-ul - bulleted list item
1183 .\"
1184 .de www-li-ul
1185 .  ie \\n[www-html] \
1186 .    www-emit-ltag li
1187 .  el \{\
1188 .    www:paraspace
1189 .    in \\n[www-li-indent]u
1190 .    ti -\w'\\*[www-ul-level\\n[www-ul-level]]'u
1191 .    nop \\*[www-ul-level\\n[www-ul-level]]\c
1192 .  \}
1193 ..
1194 .
1195 .\" ********
1196 .\" www-li-ol - numbered list item
1197 .\"
1198 .de www-li-ol
1199 .  ie \\n[www-html] \
1200 .    www-emit-ltag li
1201 .  el \{\
1202 .    www:paraspace
1203 .    in \\n[www-li-indent]u
1204 .    ti -\w'\\n[www-ol-ctr\\n[www-ol-level]]\ \ 'u
1205 .    nop \\n+[www-ol-ctr\\n[www-ol-level]]\ \ \c
1206 .  \}
1207 ..
1208 .
1209 .\" ********
1210 .\" www-li-dl - definition list item
1211 .\"
1212 .de www-li-dl
1213 .  ie \\n[www-html] \{\
1214 .    HTML <dt>\\$1</dt>
1215 .    www-emit-ltag dd
1216 .  \}
1217 .  el \{\
1218 .    www:paraspace
1219 .    in \\n[www-li-indent]u
1220 .    ti -\\n[www-dl-shift]u
1221 .    nop \&\\$1
1222 .    br
1223 .  \}
1224 ..
1225 .
1226 .\" --------------------------------------------------------------------
1227 .\" DC l text [color]
1228 .\"
1229 .\"   L is the letter to be dropped and enlarged.
1230 .\"
1231 .\"   TEXT is the following text whose height the first letter should not
1232 .\"   exceed.
1233 .\"
1234 .\"   COLOR is the optional color of the dropped letter (default black).
1235 .\"
1236 .de DC
1237 .  ds www-dropcolor black\"
1238 .  if !'\\$3'' \
1239 .    ds www-dropcolor \\$3\"
1240 .  ie '\*[.T]'html' \{\
1241 .    www-make-unique-name
1242 .    nr www-drop-width (100u * \\n[.v]u * 3u / \\n[.l]u)
1243 .    MPIMG -L \\*[www-unique-name].png \\n[www-drop-width]%
1244 .  \}
1245 .  el \{\
1246 .    ie r ps4html \{\
1247 .      www-make-unique-name
1248 .      \" To avoid interferences with another DC macro call which is located
1249 .      \" very near to the current one, we draw the glyph on a separate page.
1250 .      \" Otherwise it could theoretically happen that the dropped capital
1251 .      \" glyphs overlap.
1252 .      bp
1253 .      ev www-DC
1254 .      vs 320p
1255 .      nop \O[5i\\*[www-unique-name].png]\O[1]
1256 .      nop \m[\\*[www-dropcolor]]\s[160]\O[3]\\$1\O[4]
1257 .      nop \O[2]\O[0]
1258 .      br
1259 .      ev
1260 .      bp
1261 .    \}
1262 .    el \{\
1263 .      ie n \
1264 .        nop \\$1\c
1265 .      el \{\
1266 .        nr dummy \w'\\$1'u
1267 .        nr dcht ((\\n[.v] + \\n[rst]) * \\n[.ps] / \\n[rst])
1268 .        char \[dcap] \m[\\*[www-dropcolor]]\s'\\n[dcht]u'\\$1
1269 .        nop \v'\\n[.v]u'\\[dcap]\v'-\\n[.v]u'\c
1270 '        ti \w'\\[dcap]'u
1271 .      \}
1272 .    \}
1273 .  \}
1274 .  nop \\$2
1275 ..
1276 .
1277 .\"
1278 .\" supplementary macros used by other macro sets
1279 .\"
1280 .\" here are some tags specially for -Tps or -Thtml when invoked by
1281 .\" pre-html to generate PNG images from postscript.
1282 .
1283 .\" --------------------------------------------------------------------
1284 .\" HTML-DO-IMAGE - tell troff to issue an image marker which can be
1285 .\"                 read back by pre-html
1286 .\"
1287 .de HTML-DO-IMAGE
1288 .  if r ps4html \
1289 .    nop \O[5\\$2\\$1.png]\O[1]\O[3]
1290 .  if \\n[www-html] \
1291 .    nop \O[5\\$2\\$1.png]\O[0]\O[3]
1292 ..
1293 .
1294 .\" --------------------------------------------------------------------
1295 .\" HTML-IMAGE-END - terminate an image for HTML
1296 .\"
1297 .de HTML-IMAGE-END
1298 .  if r ps4html \
1299 .    nop \O[4]\O[2]\O[0]
1300 .  if \\n[www-html] \
1301 .    nop \O[4]\O[2]\O[1]
1302 ..
1303 .
1304 .nr www-png-no 0
1305 .
1306 .\" --------------------------------------------------------------------
1307 .\" www-make-unique-name - generate another unique name in string
1308 .\"                        `www-unique-name'
1309 .\"
1310 .de www-make-unique-name
1311 .  nr www-png-no +1
1312 .  ds www-unique-name \\*[www-image-template]\\n[www-png-no]\"
1313 ..
1314 .
1315 .\" --------------------------------------------------------------------
1316 .\" HTML-IMAGE and friends tell grohtml that this region of text needs
1317 .\"            to be rendered as an image.
1318 .\"
1319 .de HTML-IMAGE
1320 .  \" generates a centered image
1321 .  www-make-unique-name
1322 .  HTML-DO-IMAGE \\*[www-unique-name] c
1323 ..
1324 .
1325 .de HTML-IMAGE-RIGHT
1326 .  www-make-unique-name
1327 .  HTML-DO-IMAGE \\*[www-unique-name] r
1328 ..
1329 .
1330 .de HTML-IMAGE-LEFT
1331 .  www-make-unique-name
1332 .  HTML-DO-IMAGE \\*[www-unique-name] l
1333 ..
1334 .
1335 .de HTML-IMAGE-INLINE
1336 .  www-make-unique-name
1337 .  HTML-DO-IMAGE \\*[www-unique-name] i
1338 ..
1339 .
1340 .\"  EQN-HTML-IMAGE and friends check to see whether the equation is
1341 .\"                 not in an image, in which case it allows HTML
1342 .\"                 (mathml) to be generated (if -Txhtml was specified).
1343 .
1344 .de EQN-HTML-IMAGE
1345 .  \" generates a centered image
1346 .  www-make-unique-name
1347 .  EQN-HTML-DO-IMAGE \\*[www-unique-name] c
1348 ..
1349 .
1350 .de EQN-HTML-IMAGE-RIGHT
1351 .  www-make-unique-name
1352 .  EQN-HTML-DO-IMAGE \\*[www-unique-name] r
1353 ..
1354 .
1355 .de EQN-HTML-IMAGE-LEFT
1356 .  www-make-unique-name
1357 .  EQN-HTML-DO-IMAGE \\*[www-unique-name] l
1358 ..
1359 .
1360 .de EQN-HTML-IMAGE-INLINE
1361 .  www-make-unique-name
1362 .  EQN-HTML-DO-IMAGE \\*[www-unique-name] i
1363 ..
1364 .
1365 .\" --------------------------------------------------------------------
1366 .\" EQN-HTML-DO-IMAGE - tell troff to issue an image marker which can be
1367 .\"                     read back by pre-html
1368 .\"
1369 .de EQN-HTML-DO-IMAGE
1370 .  ie r xhtml \{\
1371 .    if !(\\n[.O] == 0) \{\
1372 .      if r ps4html \
1373 .        nop \O[5\\$2\\$1.png]\O[1]\O[3]
1374 .      if \\n[www-html] \
1375 .        nop \O[5\\$2\\$1.png]\O[0]\O[3]
1376 .    \}
1377 .  \}
1378 .  el \
1379 .    HTML-DO-IMAGE \\$*
1380 ..
1381 .
1382 .\" --------------------------------------------------------------------
1383 .\" EQN-HTML-IMAGE-END - terminate an image for HTML
1384 .\"
1385 .de EQN-HTML-IMAGE-END
1386 .  ie r xhtml \{\
1387 .    if !(\\n[.O] == 0) \{\
1388 .      if r ps4html \
1389 .        nop \O[4]\O[2]\O[0]
1390 .      if \\n[www-html] \
1391 .        nop \O[4]\O[2]\O[1]
1392 .    \}
1393 .  \}
1394 .  el \
1395 .    HTML-IMAGE-END
1396 ..
1397 .
1398 .\" --------------------------------------------------------------------
1399 .\" Setup around HTML-IMAGE and friends
1400 .\"
1401 .\" now set up TS, TE, EQ, EN default macros
1402 .\"
1403 .\" we must not use `.als': the definition of .TE in s.tmac, for example,
1404 .\" calls .HTML-IMAGE-END, which would refer to itself due to the alias,
1405 .\" causing an endless loop
1406 .\"
1407 .if !d TS \{\
1408 .  de TS
1409 .    HTML-IMAGE \\$@
1410 .    if \\n[www-html] \{\
1411 .      nr www-TS-ll \\n[.l]
1412 .      ll 1000n
1413 .    \}
1414 .  .
1415 .\}
1416 .if !d TE \{\
1417 .  de TE
1418 .    if \\n[www-html] \
1419 .      ll \\n[www-TS-ll]u
1420 .    HTML-IMAGE-END \\$@
1421 .  .
1422 .\}
1423 .if !d EQ \{\
1424 .  de EQ
1425 .    EQN-HTML-IMAGE \\$@
1426 .    if \\n[www-html] \{\
1427 .      nr www-EQ-ll \\n[.l]
1428 .      ll 1000n
1429 .    \}
1430 .  .
1431 .\}
1432 .if !d EN \{\
1433 .  de EN
1434 .    if \\n[www-html] \
1435 .      ll \\n[www-EQ-ll]u
1436 .    EQN-HTML-IMAGE-END \\$@
1437 .  .
1438 .\}
1439 .
1440 .\" --------------------------------------------------------------------
1441 .\" JOBNAME
1442 .\"
1443 .\"   Generate multiple output files containing the HTML.
1444 .\"   A file is split whenever a .SH or .NH 1 is encountered.
1445 .\"   The argument to JOBNAME is the file stem for future output files.
1446 .\"
1447 .de JOBNAME
1448 .  DEVTAG .job-name \\$1
1449 ..
1450 .
1451 .\" --------------------------------------------------------------------
1452 .\" HEAD
1453 .\"
1454 .\"   Add information to the <head> </head> section of the HTML
1455 .\"   document
1456 .\"
1457 .de HEAD
1458 .  DEVTAG .head "\\$*"
1459 ..
1460 .
1461 .\" --------------------------------------------------------------------
1462 .\" start of some code
1463 .\"
1464 .de CDS
1465 .  ft C
1466 .  nf
1467 ..
1468 .
1469 .\" --------------------------------------------------------------------
1470 .\" end of some code
1471 .\"
1472 .de CDE
1473 .  fi
1474 .  ft P
1475 ..
1476 .
1477 .ds www-nav-colour #eeeeee\"
1478 .nr www-nav-width-left 30
1479 .nr www-nav-width-right 70
1480 .
1481 .\" --------------------------------------------------------------------
1482 .\" LNS - left navigation start
1483 .\"
1484 .de LNS
1485 .  HTML</p> <table><tr><td "valign=""top""" \
1486                            "width=""\\n[www-nav-width-left]%""" \
1487                            "bgcolor=""\\*[www-nav-colour]"">"
1488 .  LK
1489 .  HTML</p> </td><td "valign=""top""" \
1490                      "width=""\\n[www-nav-width-right]%"">"
1491 .  nr SH-open 1
1492 ..
1493 .
1494 .\" --------------------------------------------------------------------
1495 .\" LNE - left navigation end
1496 .\"
1497 .de LNE
1498 .  HTML</p> </td></tr></table>
1499 .  HR
1500 ..
1501 .
1502 .nr SH-open 0
1503 .nr needs-begin 0
1504 .
1505 .\"
1506 .\" some auxiliary macros for left navigation lists
1507 .\"
1508 .de www-SH
1509 .  if (0\\$1 == 0) \{\
1510 .    if (\\n[SH-open] == 1) \
1511 .      LNE
1512 .    nr needs-begin 1
1513 .    @SH-old
1514 .  \}
1515 ..
1516 .
1517 .de www-NH
1518 .  if (0\\$1 <= 1) \{\
1519 .    if (\\n[SH-open] == 1) \
1520 .      LNE
1521 .    nr needs-begin 1
1522 .    @NH-old
1523 .  \}
1524 ..
1525 .
1526 .de www-LP
1527 .  @LP-old
1528 .  if (\\n[needs-begin] == 1) \{\
1529 .    HR
1530 .    LNS
1531 .  \}
1532 .  nr needs-begin 0
1533 ..
1534 .
1535 .\" --------------------------------------------------------------------
1536 .\" ALN [colour] [left width percentage]
1537 .\"
1538 .\"   Turn on automatic left navigation.  This macro should only be
1539 .\"   called once (normally at the start of the document) as it
1540 .\"   indicates that all top-level section headings form a navigation
1541 .\"   list on the left of the main text.
1542 .\"
1543 .de ALN
1544 .  if '\*[.T]'html' \{\
1545 .    if !'\\$1'' \
1546 .      ds www-nav-colour \\$1\"
1547 .    if (0\\$2 > 0) \{\
1548 .      nr www-nav-width-left \\$2
1549 .      nr www-nav-width-right (100 - \\$2)
1550 .    \}
1551 .    rn @SH @SH-old
1552 .    rn www-SH @SH
1553 .    rn @NH @NH-old
1554 .    rn www-NH @NH
1555 .    rn @LP @LP-old
1556 .    rn www-LP @LP
1557 .  \}
1558 ..
1559 .
1560 .\" --------------------------------------------------------------------
1561 .\" LINKSTYLE color [fontstyle [openglyph closeglyph]]
1562 .\"
1563 .\"   Initialize www.tmac so that when this macro set is used with
1564 .\"   non-HTML devices the urls are rendered the user defined attributes.
1565 .\"   For example:
1566 .\"
1567 .\"   LINKSTYLE blue CR < >
1568 .\"
1569 .de LINKSTYLE
1570 .  if (\\n[.$] < 1) \
1571 .    www:error .\\$0 expects at least 1 argument.
1572 .  ds www:color \\$1\"
1573 .  shift
1574 .  if (\\n[.$] < 1) \
1575 .    return
1576 .  ds www:fontstyle \\$1\"
1577 .  shift
1578 .  if (\\n[.$] < 1) \
1579 .    www:error .\\$0 expects that both the open and close glyph is specified
1580 .  ds www:open \\$1\"
1581 .  ds www:close \\$2\"
1582 ..
1583 .
1584 .\" MATHML - enable eqn mathml output to pass through to the device
1585 .\"          driver
1586 .
1587 .de MATHML
1588 .  if (\\n[.O] == 0) \
1589 .    MATH<?p> \\$*
1590 ..
1591 .
1592 .\" --------------------------------------------------------------------
1593 .\" final setup
1594 .\" --------------------------------------------------------------------
1595 .
1596 .LINKSTYLE blue C \[la] \[ra]
1597 .
1598 .if \n[www-html] \{\
1599 .  nh
1600 .  nr HY 0
1601 .\}
1602 .
1603 .if r ps4html .nop \O[0]
1604 .cp \n(_C
1605 .
1606 .\" now set
1607 .
1608 .\" --------------------------------------------------------------------
1609 .\" Emacs settings
1610 .\" --------------------------------------------------------------------
1611 .
1612 .\" Local Variables:
1613 .\" mode: nroff
1614 .\" End:
1615 .\" EOF