summaryrefslogtreecommitdiffstats
path: root/contrib/hdtbl/examples
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/hdtbl/examples')
-rw-r--r--contrib/hdtbl/examples/chess_board.roff64
-rw-r--r--contrib/hdtbl/examples/col_rowspan_colors.roff82
-rw-r--r--contrib/hdtbl/examples/color_boxes.roff52
-rw-r--r--contrib/hdtbl/examples/color_nested_tables.roff60
-rw-r--r--contrib/hdtbl/examples/color_table_cells.roff54
-rw-r--r--contrib/hdtbl/examples/color_transitions.roff58
-rw-r--r--contrib/hdtbl/examples/common.roff295
-rw-r--r--contrib/hdtbl/examples/fonts_n.in149
-rw-r--r--contrib/hdtbl/examples/fonts_x.in160
-rw-r--r--contrib/hdtbl/examples/mixed_pickles.roff104
-rw-r--r--contrib/hdtbl/examples/rainbow.roff86
-rw-r--r--contrib/hdtbl/examples/short_reference.roff86
-rw-r--r--contrib/hdtbl/examples/test-hdtbl.sh.in47
13 files changed, 1297 insertions, 0 deletions
diff --git a/contrib/hdtbl/examples/chess_board.roff b/contrib/hdtbl/examples/chess_board.roff
new file mode 100644
index 0000000..171d95e
--- /dev/null
+++ b/contrib/hdtbl/examples/chess_board.roff
@@ -0,0 +1,64 @@
+.ig
+chess_board.roff
+
+This file is part of groff, the GNU roff type-setting system.
+
+Copyright (C) 2005-2020 Free Software Foundation, Inc.
+written by Joachim Walsdorff <Joachim.Walsdorff@urz.uni-heidelberg.de>.
+
+groff is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+groff is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+..
+.
+.if !d sopath \
+. ds sopath
+.
+.so \*[sopath]examples/common.roff
+.
+.
+.nr *x 8
+.de r1
+.TR height=1.6c
+.TD hl= val=m hal=r \\\\n(*x
+.PN 4 ".TD bgc=wheat" ".TD bgc=tan3"
+.TD hl= val=m hal=l \\\\n(*x
+.nr *x -1
+..
+.de r2
+.TR height=1.6c
+.TD hl= val=m hal=r \\\\n(*x
+.PN 4 ".TD bgc=tan3" ".TD bgc=wheat"
+.TD hl= val=m hal=l \\\\n(*x
+.nr *x -1
+..
+.af *y a
+.H Chessboard
+.TBL border=0 csp=.05n bgc= cols=10 width=1.6c tal=c
+.TR vl= hal=c\" height=1c
+.TD hl=
+.nr *y 0
+.PN 8 .TD ".nr *y +1" \\\\n(*y
+.TD hl=
+.PN 4 .r1 .r2
+.TR vl= hal=c
+.TD
+.nr *y 0
+.PN 8 .TD ".nr *y +1" \\\\n(*y
+.TD
+.ETB
+.
+.\" Local Variables:
+.\" mode: nroff
+.\" fill-column: 72
+.\" End:
+.\" vim: set filetype=groff textwidth=72:
diff --git a/contrib/hdtbl/examples/col_rowspan_colors.roff b/contrib/hdtbl/examples/col_rowspan_colors.roff
new file mode 100644
index 0000000..90f2e7a
--- /dev/null
+++ b/contrib/hdtbl/examples/col_rowspan_colors.roff
@@ -0,0 +1,82 @@
+.ig
+col_rowspan_colors.roff
+
+This file is part of groff, the GNU roff type-setting system.
+
+Copyright (C) 2005-2020 Free Software Foundation, Inc.
+written by Joachim Walsdorff <Joachim.Walsdorff@urz.uni-heidelberg.de>.
+
+groff is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+groff is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+..
+.
+.if !d sopath \
+. ds sopath
+.
+.so \*[sopath]examples/common.roff
+.
+.\" Seed the random number generator for reproducible builds.
+.random-seed 131545532 19201711
+.de color#
+.nr # +1
+.random#
+.defcolor c\\n# rgb \\*[#random]
+..
+.
+.de brt
+.nr # 0
+.color#
+.if \\n[t*cols\\n[t*#]]/2*2=\\n[t*cols\\n[t*#]] \{ .
+. tmc \\n(.F:\\n(.c: cols was even (\\n[t*cols\\n[t*#]]),
+. nr t*cols\\n[t*#] +1
+. tm1 " increased by one col to \\n[t*cols\\n[t*#]].
+. t*cl \\*[width]
+. ie "\\*[tal]"r" .nr in\\n[t*#] -\\*[width]\" recalculate cell widths etc.
+. el .if "\\*[tal]"c" .nr in\\n[t*#] -\\*[width]/2
+.\}
+.nr N \\n[t*cols\\n[t*#]]-1 \" N must be even
+.nr W 1c\"\\*[width]
+.ds html "".TR height=\\nW" ".TD bgc=c\\n#"
+.nr I 0 2
+.while \\nN>=\\n+I \{ .
+. ds help "\\*[html]
+. pops * help
+. color#
+. ds html "".TR height=\\nW" ".TD colspan=\\nI bgc=c\\n#"
+. color#
+. as html " ".TD rowspan=\\nI bgc=c\\n#"
+. color#
+. as html " ".TR height=\\nW" ".TD rowspan=\\nI bgc=c\\n#"
+. color#
+. as html " \\*[help] ".TR height=\\nW" ".TD colspan=\\nI bgc=c\\n#"
+.\}
+.t*P1 \\*[html]
+..
+.
+.t*pv 1.2 1.2 "" x
+.PN 10 Text before table.
+.in 1c
+.PN 8 Indented text before table.
+*** *** ***
+.TBL width=90% border=1n csp=1n cpd=1n bgc=wheat tal=c .TR .TD
+.TBL border= cols=11 width=1c tal=c csp=0 cpd=0 \"cols must be odd
+.CPTN val=b Randomly Colored Table Cells with Colspan/\%Rowspan
+.brt
+.ETB .ETB
+.PN 15 Text after table.
+.
+.\" Local Variables:
+.\" mode: nroff
+.\" fill-column: 72
+.\" End:
+.\" vim: set filetype=groff textwidth=72:
diff --git a/contrib/hdtbl/examples/color_boxes.roff b/contrib/hdtbl/examples/color_boxes.roff
new file mode 100644
index 0000000..65538a7
--- /dev/null
+++ b/contrib/hdtbl/examples/color_boxes.roff
@@ -0,0 +1,52 @@
+.ig
+color_boxes.roff
+
+This file is part of groff, the GNU roff type-setting system.
+
+Copyright (C) 2005-2020 Free Software Foundation, Inc.
+written by Joachim Walsdorff <Joachim.Walsdorff@urz.uni-heidelberg.de>.
+
+groff is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+groff is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+..
+.
+.if !d sopath \
+. ds sopath
+.
+.so \*[sopath]examples/common.roff
+.
+.\" Seed the random number generator for reproducible builds.
+.random-seed 131545532 19201711
+.
+.H Horizontal Rules and Boxes .br with Randomly Colored Border and Background
+.PN 25 Text before horizontal rule.
+.TBL border=.5n bc=green bgc=red width=7c tal=c csp=.2n cpd=.3n .TR .TD .ETB
+.PN 10 Text after horizontal rule and before table.
+.de ctab
+.nr ? 0 1
+.PN 5 .random# ".defcolor color\En+? rgb \E*[#random]"
+.TD ".TBL border=1c bc=color1 csp=0 cpd=0 height=3c bgc=color2" .TR .TD .ETB
+..
+.
+.TBL tal=c border= csp=0 cpd=0 cols=5 width=3c
+.PN 2 .TR ".PN 5 .ctab"
+.ETB
+.PN 15 Text after table.
+.TBL border=.5n bc=color1 bgc=color2 width=15c tal=c csp=.2n cpd=.3n .TR .TD .ETB
+.PN 25 Text after horizontal rule.
+.
+.\" Local Variables:
+.\" mode: nroff
+.\" fill-column: 72
+.\" End:
+.\" vim: set filetype=groff textwidth=72:
diff --git a/contrib/hdtbl/examples/color_nested_tables.roff b/contrib/hdtbl/examples/color_nested_tables.roff
new file mode 100644
index 0000000..946d297
--- /dev/null
+++ b/contrib/hdtbl/examples/color_nested_tables.roff
@@ -0,0 +1,60 @@
+.ig
+
+color_nested_tables.roff
+
+This file is part of groff, the GNU roff type-setting system.
+
+Copyright (C) 2005-2020 Free Software Foundation, Inc.
+written by Joachim Walsdorff <Joachim.Walsdorff@urz.uni-heidelberg.de>.
+
+groff is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+groff is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+..
+.
+.if !d sopath \
+. ds sopath
+.
+.so \*[sopath]examples/common.roff
+.
+.
+.\" Seed the random number generator for reproducible builds.
+.random-seed 131545532 19201711
+.
+.PN 15 Text before first table.
+.nr # 0 1
+*****
+.PN 39 .random# ".defcolor c\\n[#] rgb \\\\*[#random] " \
+ ".TBL csp=0 cpd=0 border=1n bc=c\\n[#]" \
+ ".if \\\\n+#=1 .CPTN val=b Nested Tables with Randomly Colored Border" \
+ .TR .TD
+.PN 39 .ETB
+.PN 15 Text after first table.
+.
+.bp
+.
+.PN 15 Text before second table.
+*****
+.nr # 0 1
+.PN 39 .random# ".defcolor c\\n[#] rgb \\\\*[#random] " \
+ ".TBL csp=0 cpd=1n border= bgc=c\\n[#]" \
+ ".if \\\\n+#=1 .CPTN val=b Nested Tables with Randomly Colored Background" \
+ .TR .TD
+.PN 39 .ETB
+.PN 25 Text after second table.
+.
+.\" Local Variables:
+.\" mode: nroff
+.\" fill-column: 72
+.\" End:
+.\" vim: set filetype=groff textwidth=72:
diff --git a/contrib/hdtbl/examples/color_table_cells.roff b/contrib/hdtbl/examples/color_table_cells.roff
new file mode 100644
index 0000000..65489cb
--- /dev/null
+++ b/contrib/hdtbl/examples/color_table_cells.roff
@@ -0,0 +1,54 @@
+.ig
+
+color_table_cells.roff
+
+This file is part of groff, the GNU roff type-setting system.
+
+Copyright (C) 2005-2020 Free Software Foundation, Inc.
+written by Joachim Walsdorff <Joachim.Walsdorff@urz.uni-heidelberg.de>.
+
+groff is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+groff is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+..
+.
+.if !d sopath \
+. ds sopath
+.
+.so \*[sopath]examples/common.roff
+.
+.\" Seed the random number generator for reproducible builds.
+.random-seed 131545532 19201711
+.
+.H Horizontal Rules and Randomly Colored Table Cells
+.PN 15 Text before HR.
+.TBL border=.5n bc=green bgc=red width=7c tal=c csp=.2n cpd=.3n .TR .TD .ETB
+.PN 10 Text after HR and before Table.
+.
+.nr ? 0 1
+.de ctab
+.TR height=\nl/10
+.PN 8 .random# ".defcolor c\\\\n+? rgb \E*[#random]" ".TD bgc=c\\\\n?"
+..
+.TBL tal=c border= csp=0 cpd=0 cols=8 width=\nl/10
+.PN 8 .ctab
+.ETB
+.PN 10 Text after table.
+.TBL border=.5n bc=c1 bgc=c2 width=15c tal=c csp=.2n cpd=.3n .TR .TD .ETB
+.PN 15 Text after HR.
+.
+.\" Local Variables:
+.\" mode: nroff
+.\" fill-column: 72
+.\" End:
+.\" vim: set filetype=groff textwidth=72:
diff --git a/contrib/hdtbl/examples/color_transitions.roff b/contrib/hdtbl/examples/color_transitions.roff
new file mode 100644
index 0000000..be69b7c
--- /dev/null
+++ b/contrib/hdtbl/examples/color_transitions.roff
@@ -0,0 +1,58 @@
+.ig
+
+color_transitions.roff
+
+This file is part of groff, the GNU roff type-setting system.
+
+Copyright (C) 2005-2020 Free Software Foundation, Inc.
+written by Joachim Walsdorff <Joachim.Walsdorff@urz.uni-heidelberg.de>.
+
+groff is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+groff is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+..
+.
+.if !d sopath \
+. ds sopath
+.
+.so \*[sopath]examples/common.roff
+.
+.de ctab
+.nr #cc 0
+.PN 21 ".nr #cc +.05f" ".defcolor \En[t*#] rgb \\$1 \\$2 \\$3" ".TBL border= csp=0 cpd=.5n bgc=\\\\n[t*#] bc=" .TR .TD
+.PN 21 .ETB
+..
+.PN 30 Before table.
+.TBL cols=3 width=33% border= csp=0 cpd=0 bgc=
+.CPTN val=b Color Transitions
+.TR
+.TD ".ctab 0+\En[#cc]u \En[#cc]u \En[#cc]u" \" black -> white
+.TD ".ctab 1f-\En[#cc]u 1f-\En[#cc]u 1f-\En[#cc]u"\" white -> black
+.TD ".ctab 1f \En[#cc]u \En[#cc]u" \" red -> white
+.TR
+.TD ".ctab 0 1f-\En[#cc]u \En[#cc]u" \" green -> blue
+.TD ".ctab 1f 1f-\En[#cc]u 1f" \" white -> magenta
+.TD ".ctab 1f \En[#cc]u 1f" \" magenta -> white
+.TR
+.TD ".ctab 0+\En[#cc]u \En[#cc]u 1f-\En[#cc]u" \" blue -> yellow
+.TD ".ctab 1f-\En[#cc]u 1f-\En[#cc]u \En[#cc]u" \" yellow -> blue
+.TD ".ctab 1f 0+\En[#cc]u 0" \" red -> yellow
+.xTD ".ctab 0+\En[#cc]u 1f-\En[#cc]u 1f-\En[#cc]u"\" cyan -> red
+.ETB
+.PN 30 After table.
+.
+.\" Local Variables:
+.\" mode: nroff
+.\" fill-column: 72
+.\" End:
+.\" vim: set filetype=groff textwidth=72:
diff --git a/contrib/hdtbl/examples/common.roff b/contrib/hdtbl/examples/common.roff
new file mode 100644
index 0000000..a9c02a0
--- /dev/null
+++ b/contrib/hdtbl/examples/common.roff
@@ -0,0 +1,295 @@
+.ig
+
+common.roff
+
+This file is part of groff, the GNU roff type-setting system.
+
+Copyright (C) 2010-2020 Free Software Foundation, Inc.
+written by Joachim Walsdorff <Joachim.Walsdorff@urz.uni-heidelberg.de>.
+
+groff is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+groff is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+..
+.
+.
+.ds common common.roff\" name for diagnostic messages
+.mso hdtbl.tmac\" load table macros
+.
+.\" ******************************************************************
+.\" ** Some macros and the page setup used by the examples **
+.\" ******************************************************************
+.
+.\" ******************************************************************
+.\" ** Header macro for the examples **
+.\" ******************************************************************
+.de H
+. nr *w* (17 * \w\\$* / 10 + 4n)
+. TBL border=1n \
+ bc=yellow \
+ bgc=red4 \
+ fgc=yellow \
+ csp=0 \
+ fst=TB \
+ "fsz=1.7 1.5" \
+ hal=c \
+ tal=c \
+ "width=(\\n[*w*]+4n)<?\n[.l]"
+. TR .TD
+. t*P1 \\$*
+. ETB
+. SP
+..
+.
+.
+.\" ******************************************************************
+.\" ** Perform n-times all the arbitrary arguments **
+.\" ** .PN n a2 a3 ... **
+.\" ** PN is nestable **
+.\" ******************************************************************
+.de PN
+. nr *pn +1
+. nr PN\\n[*pn] (\\$1 + 1) 1
+. shift
+.
+. while \\n-[PN\\n[*pn]] \
+. t*P1 \\$@
+.
+. nr *pn -1
+..
+.
+.
+.\" Utility macro: .d2x decimal_number [base [string_name]]
+.\"
+.\" Convert 'decimal_number' to another base 'base' (in the
+.\" range 1..16) and store the result in string 'string_name'.
+.\" If 'base' is missing or empty, convert to a hexadecimal
+.\" number. If 'string_name' is missing or empty, return value
+.\" in string 'hex#', otherwise return the value in both
+.\" 'string_name' and 'hex#'.
+.\"
+.\" The base value 1 is handled specially: The returned
+.\" string contains the character '|' 'decimal_number' times
+.\" (for example, input value 4 yields '||||').
+.ds d2x-0 0\"
+.ds d2x-1 1\"
+.ds d2x-2 2\"
+.ds d2x-3 3\"
+.ds d2x-4 4\"
+.ds d2x-5 5\"
+.ds d2x-6 6\"
+.ds d2x-7 7\"
+.ds d2x-8 8\"
+.ds d2x-9 9\"
+.ds d2x-10 A\"
+.ds d2x-11 B\"
+.ds d2x-12 C\"
+.ds d2x-13 D\"
+.ds d2x-14 E\"
+.ds d2x-15 F\"
+.
+.
+.de d2x
+. if !\B\\$1 \{\
+. tmc \\*[common]: \\n[.F]:\\n[.c]: d2x: invalid or missing first
+. tm argument
+. tm \\*[common]: usage: '.d2x decimal_number [base [string_name]]'
+. return
+. \}
+.
+. nr i# (-1) 1
+. nr j# 1
+. ds hex#
+. nr dec# (\\$1) 1
+.
+. if !\\$1 \
+. nr dec# (-\\n[dec#])
+.
+. ie !"\\$2"" \{\
+. ie !\B\\$2 \
+. tm \\*[common]: \\n[.F]:\\n[.c]: d2x: invalid base '\\$2'
+. el \
+. ie ((\\$2 < 1) : (\\$2 > 16)) \
+. tm \\*[common]: \\n[.F]:\\n[.c]: d2x: invalid base '\\$2'
+. el \
+. nr b# \\$2
+. \}\}
+. el \
+. nr b# 16
+.
+. nr xb# 1
+.
+. ie (\\n[b#] == 1) \{\
+. nr dec# +1
+. while \\n-[dec#] \
+. as hex# |\"
+. \}
+. el \{\
+. while (\\n[dec#] - \\n[xb#]) \{\
+. nr xb# (\\n[xb#] * \\n[b#])
+. nr j# +1
+. \}
+.
+. while (\\n+[i#] < \\n[j#]) \{\
+. nr ** (\\n[dec#] / \\n[xb#])
+. as hex# \\*[d2x-\\n[**]]\"
+. nr dec# (\\n[dec#] - (\\n[xb#] * \\n[**]))
+. nr xb# (\\n[xb#] / \\n[b#])
+. \}
+. \}
+.
+. \" strip leading zero, if any
+. ds * \\*[hex#]\"
+. substring * 0 0
+. if "\\*[*]"0" \
+. substring hex# 1 -1
+.
+. if (\\$1 < 0) \
+. ds hex# -\\*[hex#]\"
+.
+. if !"\\$3"" \{\
+. ie !\A\\$3 \
+. tm \\*[common]: \\n[.F]:\\n[.c]: d2x: invalid string name '\\$3'
+. el \
+. ds \\$3 \\*[hex#]\"
+. \}
+..
+.
+.
+.\" Utility macro: .random#
+.\" .random-seed seed1 seed2
+.\"
+.\" Return pseudo-random numbers in the range 0..0xFFFFFF,
+.\" represented as the concatenation of '#' and six
+.\" hexadecimal digits, in the string '#random'. The
+.\" macro 'random-seed' can be used to set seed values,
+.\" which should be integers in the range 1..2147483562 and
+.\" 1..2147483398 for 'seed1' and 'seed2', respectively
+.\" (the macro applies a modulo operation to assure this
+.\" range). If 'random-seed' isn't called the registers
+.\" start at some constant, arbitrary values.
+.\"
+.\" The used generator is presented in L'Ecuyer's 1988 paper
+.\" 'Efficient and Portable Combined Random Number
+.\" Generators', which combines two Multiplicative Linear
+.\" Congruential Generators (MLCGs) to achieve a period of
+.\" 2.3*10^18.
+.\"
+.\" Since this just generates example output,
+.\" we don't need good randomness.
+.
+.de random-seed
+. if !(\\n[.$] == 2) \{\
+. tm \\*[common]: random-seed: Invalid number of arguments.
+. tm \\*[common]: usage: '.random-seed seed1 seed2'
+. return
+. \}
+.
+. nr random-s1 (\\$1 % 2147483562)
+. nr random-s2 (\\$2 % 2147483398)
+..
+.random-seed 131545532 19201711
+.
+.
+.de random#
+. nr * (\\n[random-s1] / 53668)
+. nr random-s1 (40014 * (\\n[random-s1] - (\\n[*] * 53668)) \
+ - (\\n[*] * 12211))
+. if !\\n[random-s1] \
+. nr random-s1 +2147483563
+.
+. nr * (\\n[random-s2] / 52774)
+. nr random-s2 (40692 * (\\n[random-s2] - (\\n[*] * 52774)) \
+ - (\\n[*] * 3791))
+. if !\\n[random-s2] \
+. nr random-s2 +2147483399
+.
+. nr * (\\n[random-s1] - \\n[random-s2])
+. if (\\n[*] < 1) \
+. nr * +2147483562
+.
+. \" reduce the result to the leftmost 24 bits
+. nr * (\\n[*] / 128)
+.
+. d2x \\n[*]
+. ds hex# 000000\\*[hex#]\"
+. substring hex# -6
+. ds #random #\\*[hex#]\"
+..
+.
+.
+.\" ******************************************************************
+.\" ** minimal Page setup **
+.\" ******************************************************************
+.
+.nr s \n[.ps]
+.nr v \n[.v]
+.nr p \n[.p]
+.nr o \n[.o]
+.nr l 6.6i \" set text width
+.ll \n[t*l]u
+.nr o 2c \" set offset
+.po \n[o]u
+.nr p 29.7c \" set paper length (A4)
+.pl \n[p]u
+.nr tH 1i \" set top margin
+.sp |\n[tH]u
+.
+.ds t*HM //arbitrary text for page header, except on the first page//\"
+.ds t*BM //arbitrary text for page footer, except on the last page/\\n[%]/\"
+.
+.ev 99
+.lt \n[t*l]u
+.ev
+.
+.
+.de HM
+. sp |.5i \" print header in top margin
+. tl \\*[t*HM]
+. sp |\\n[tH]u
+. ev
+..
+.
+.
+.de BM
+. ev 99
+. sp |(\\n[p]u - .5i) \" print footer in bottom margin
+. tl \\*[t*BM]
+. bp
+..
+.
+.
+.de EM
+. rm BM \" no page number at bottom of last page
+. t*EM
+..
+.
+.
+.wh 0 HM
+.wh 0-1.5i BM
+.em EM
+.
+.\" Some packages (-mm) define their own .SP macro.
+.\" Use ours if another one isn't already available.
+.if !d SP .als SP t*SP
+.
+.if "\n[.m]"" \
+. gcolor black
+.if "\n[.M]"" \
+. fcolor white
+.
+.\" Local Variables:
+.\" mode: nroff
+.\" fill-column: 72
+.\" End:
+.\" vim: set filetype=groff textwidth=72:
diff --git a/contrib/hdtbl/examples/fonts_n.in b/contrib/hdtbl/examples/fonts_n.in
new file mode 100644
index 0000000..c953fa4
--- /dev/null
+++ b/contrib/hdtbl/examples/fonts_n.in
@@ -0,0 +1,149 @@
+.ig
+
+font_n.roff
+
+This file is part of groff, the GNU roff type-setting system.
+
+Copyright (C) 2005-2020 Free Software Foundation, Inc.
+written by Joachim Walsdorff <Joachim.Walsdorff@urz.uni-heidelberg.de>.
+
+groff is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+groff is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+..
+.
+.
+.\" ******************************************************************
+.\" ** groff glyphs vs. character codes: **
+.\" ** .fontdump [font1 font2 ...] **
+.\" ** Print glyphs of font1, font2, ..., versus **
+.\" ** character code. **
+.\" ** 'all' as fontname prints all fonts in the **
+.\" ** specified string 'fontpath'. **
+.\" ** without arg: glyphs and codes of active font. **
+.\" ******************************************************************
+.
+.ds fonts_n fonts_n.roff\" name for diagnostic messages
+.
+.if !d sopath \
+. ds sopath
+.
+.so \*[sopath]examples/common.roff
+.
+.if !d fontpath \
+. ds fontpath @fontdir@
+.
+.tm \*[fonts_n]: listing fonts in \*[fontpath]/dev\*[.T]
+.
+.de fontdump
+. ie \\n[.$] \
+. ds *args \\$*
+. el \
+. ds *args \\n[.fn]
+.
+. pso sh -c \
+ "printf '%s' '.ds *f ' ; \
+ ls \\*[fontpath]/dev\*[.T] \
+ | tr '[:cntrl:]' '[ *]'"
+. \" This dummy line is necessary; the preceding line eats it.
+.
+. while !"\\*[*args]"" \{\
+. pops *$1 *args
+.
+. if "\\*[*$1]"all" \{\
+. ds *args \\*[*f] \\*[*args]
+. pops *$1 *args
+. nr *all 1
+. \}
+.
+. if \\n[*all] \{\
+. if "\\*[*$1]"." \
+. nr *all 0
+. if !F \\*[*$1] \
+. continue
+. \}
+.
+. t*index "\\*[*f]" \\*[*$1]
+.
+. ie (\\n[.y] > 18) \
+. if !F \\*[*$1] \{\
+. tm \\*[fonts_n]: \\n[.F]:\\n[.c]: Font \\*[*$1] not found.
+. continue
+. \}
+. el \{\
+. if !\\n[t*index] \{\
+. tm \\*[fonts_n]: \\n[.F]:\\n[.c]: Font \\*[*$1] not found.
+. continue
+. \}
+.
+. nr * \\n[.f]
+. ft \\*[*$1]
+. nr ** \\n[.f]
+. ft
+.
+. if (\\n[**] == \\n[*]) \
+. continue
+. \}
+.
+. if \\n[t*cptn] \
+. bp
+.
+. tm \\*[fonts_n]: listing font '\\*[*$1]'...
+.
+. TBL border=.1n bc=red cpd=0 csp=.1n bgc=
+. CPTN groff font \\*[*$1] \
+ .br \
+ val=b ".pso @EGREP@ internalname \\*[fontpath]/dev\*[.T]/\\*[*$1]"
+. TR
+. TD
+. TBL cols=12 border=.1n bc=red csp=.1n cpd=.2n fgc=red4 bgc=beige \
+ hal=c fsz='1.2 1.2' fst=\\*[*$1]
+. nr c# 0-1 1
+. nr y# 0-1 1
+. TR fst=HB fgc=blue
+. TD
+. nr x# 0-1 1
+. \" following 4 'PN's instead of 4 while-loops as in
+. \" font_x.roff; short and easy to write, but a little
+. \" bit slower.
+. PN 10 .TD \
+ \&..\\\\n+[x#]
+. TD
+.
+. PN 27 .TR \
+ ".TD fgc=blue fst=HB" \
+ \\\\n+[y#]. \
+ ".PN 10 .TD \
+ "".if c \N'\En+[c#]' \
+ \N'\En[c#]'""" \
+ ".TD fgc=blue fst=HB" \
+ \\\\n[y#].
+.
+. TR fst=HB fgc=blue
+. TD
+. nr x# 0-1 1
+. PN 10 .TD \
+ \&..\\\\n+[x#]
+. TD
+. ETB
+. ETB
+. \}
+..
+.
+.fontdump all
+.
+.\" Local Variables:
+.\" mode: nroff
+.\" fill-column: 72
+.\" End:
+.\" vim: set filetype=groff textwidth=72:
diff --git a/contrib/hdtbl/examples/fonts_x.in b/contrib/hdtbl/examples/fonts_x.in
new file mode 100644
index 0000000..c183c7c
--- /dev/null
+++ b/contrib/hdtbl/examples/fonts_x.in
@@ -0,0 +1,160 @@
+.ig
+
+font_x.roff
+
+This file is part of groff, the GNU roff type-setting system.
+
+Copyright (C) 2005-2020 Free Software Foundation, Inc.
+written by Joachim Walsdorff <Joachim.Walsdorff@urz.uni-heidelberg.de>.
+
+groff is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+groff is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+..
+.
+.
+.\" ******************************************************************
+.\" ** groff glyphs vs. character codes: **
+.\" ** .fontdump [font1 font2 ...] **
+.\" ** Print glyphs of font1, font2, ..., versus **
+.\" ** character code. **
+.\" ** 'all' as fontname prints all fonts in the **
+.\" ** specified string 'fontpath'. **
+.\" ** without arg: glyphs and codes of active font. **
+.\" ******************************************************************
+.
+.ds fonts_x fonts_x.roff\" name for diagnostic messages
+.
+.if !d sopath \
+. ds sopath
+.
+.so \*[sopath]examples/common.roff
+.
+.if !d fontpath \
+. ds fontpath @fontdir@
+.
+.tm \*[fonts_x]: listing fonts in \*[fontpath]/dev\*[.T]
+.
+.de fontdump
+. ie \\n[.$] \
+. ds *args \\$*
+. el \
+. ds *args \\n[.fn]
+.
+. pso sh -c \
+ "printf '%s' '.ds *f ' ; \
+ ls \\*[fontpath]/dev\*[.T] \
+ | tr '[:cntrl:]' '[ *]'"
+. \" This dummy line is necessary; the preceding line eats it.
+.
+. while !"\\*[*args]"" \{\
+. pops *$1 *args
+.
+. if "\\*[*$1]"all" \{\
+. ds *args \\*[*f] \\*[*args]
+. pops *$1 *args
+. nr *all 1
+. \}
+.
+. if \\n[*all] \{\
+. if "\\*[*$1]"." \
+. nr *all 0
+. if !F \\*[*$1] \
+. continue
+. \}
+.
+. t*index "\\*[*f]" \\*[*$1]
+.
+. ie (\\n[.y] > 18) \
+. if !F \\*[*$1] \{\
+. tm \\*[fonts_x]: \\n[.F]:\\n[.c]: Font \\*[*$1] not found.
+. continue
+. \}
+. el \{\
+. if !\\n[t*index] \{\
+. tm \\*[fonts_x]: \\n[.F]:\\n[.c]: Font \\*[*$1] not found.
+. continue
+. \}
+.
+. nr * \\n[.f]
+. ft \\*[*$1]
+. nr ** \\n[.f]
+. ft
+.
+. if (\\n[**] == \\n[*]) \
+. continue
+. \}
+.
+. if \\n[t*cptn] \
+. bp
+.
+. tm \\*[fonts_x]: listing font '\\*[*$1]'...
+.
+. TBL border=.1n bc=red cpd=0 csp=.1n bgc=
+. CPTN groff font \\*[*$1] \
+ .br \
+ val=b ".pso @EGREP@ internalname \\*[fontpath]/dev\*[.T]/\\*[*$1]"
+. TR
+. TD
+. TBL cols=18 border=.1n bc=red csp=.1n cpd=.2n fgc=red4 bgc=beige \
+ hal=c fsz='1.2 1.7' fst=\\*[*$1]
+. nr c# 0-1 1
+. nr y# 0 1
+. TR fst=HB fgc=blue
+. TD
+. nr x# 0-1 1
+. while (\\n+[x#] < 16) \{\
+. d2x \\n[x#]
+. TD
+. nop \&.\\*[hex#]
+. \}
+. TD
+.
+. nr y# -1
+. while (\\n+[y#] < 17) \{\
+. TR
+. TD fgc=blue fst=HB
+. d2x \\n[y#]
+. nop \\*[hex#].
+. nr x# 0-1 1
+. while (\\n+[x#] < 16) \{\
+. TD
+. if c \N'\\n+[c#]' \
+. nop \N'\\n[c#]'
+. \}
+. TD fgc=blue fst=HB
+. d2x \\n[y#]
+. nop \\*[hex#].
+. \}
+.
+. TR fst=HB fgc=blue
+. TD
+. nr x# 0-1 1
+. while (\\n+[x#] < 16) \{\
+. d2x \\n[x#]
+. TD
+. nop \&..\\*[hex#]
+. \}
+. TD
+. ETB
+. ETB
+. \}
+..
+.
+.fontdump all
+.
+.\" Local Variables:
+.\" mode: nroff
+.\" fill-column: 72
+.\" End:
+.\" vim: set filetype=groff textwidth=72:
diff --git a/contrib/hdtbl/examples/mixed_pickles.roff b/contrib/hdtbl/examples/mixed_pickles.roff
new file mode 100644
index 0000000..1c909e9
--- /dev/null
+++ b/contrib/hdtbl/examples/mixed_pickles.roff
@@ -0,0 +1,104 @@
+.ig
+
+mixed_pickles.roff
+
+This file is part of groff, the GNU roff type-setting system.
+
+Copyright (C) 2005-2020 Free Software Foundation, Inc.
+written by Joachim Walsdorff <Joachim.Walsdorff@urz.uni-heidelberg.de>.
+
+groff is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+groff is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+..
+.
+.am pspic*error-hook
+. ab \\n[.F]:\\n[.c]: fatal error: PSPIC failed to include '\\$1'
+..
+.
+.if !d sopath \
+. ds sopath
+.
+.so \*[sopath]examples/common.roff
+.
+.H Table with Mixed Content: \
+ .br \
+ EPS Image, eqn Equation, tbl Table, and pic Picture
+.
+Call groff with options \-t, \-e, and \-p!
+.
+.TBL width=90% tal=c csp=.2n cpd=0
+. TR
+. TD
+. TBL width='25% 75%' csp=.5n cpd=.5n hal=c
+. TR
+. TD hl=d vl=d rowspan=2 bgc=red4 fgc=linen fsz=1.2 fst=HB val=m
+. PSPIC -I -\\n[.l]u gnu.eps
+. sp .5
+. nop eps image with \fI.PSPIC\fP
+. TD bgc=linen
+.
+.EQ
+int from 0 to 1 {( ln x ) sup 2} over {sqrt {1 - x sup 2}} dx approx 0.245
+.EN
+.
+. nop \0\0\0\0\0equation with \fIeqn\fP
+.
+. TR
+. TD hl=d
+.
+.TS
+tab(@), center, doublebox, nospaces;
+c c c | c c c
+r rI lB | r rI lB.
+Bit @ Code @ Warning @ Bit @ Code @ Warning
+=
+0 @ 1 @ char @ 10 @ 1024 @ reg
+1 @ 2 @ number @ 11 @ 2048 @ tab
+2 @ 4 @ break @ 12 @ 4096 @ right-brace
+3 @ 8 @ delim @ 13 @ 8192 @ missing
+4 @ 16 @ el @ 14 @ 16384 @ input
+5 @ 32 @ scale @ 15 @ 32768 @ escape
+6 @ 64 @ range @ 16 @ 65536 @ space
+7 @ 128 @ syntax @ 17 @ 131072 @ font
+8 @ 256 @ di @ 18 @ 262144 @ ig
+9 @ 512 @ mac @ 19 @ 524288 @ color
+.TE
+.
+. sp .5
+. nop table with \fItbl\fP
+. TR
+. TD colspan=2 bgc=azure2 fgc=blue4
+.
+.PS
+ellipse "document";
+arrow 0.42;
+box width 0.6 "\fIgpic\/\fP(1)"
+arrow 0.42;
+box width 1.25 "\fIgtbl\/\fP(1) or \fIgeqn\/\fP(1)" "(optional)" dashed;
+arrow 0.42;
+box width 0.65 "\fIgtroff\/\fP(1)";
+arrow 0.42;
+ellipse "PostScript"
+.PE
+.
+. sp .5
+. nop picture with \fIpic\fP
+. ETB
+.ETB
+.
+.\" Local Variables:
+.\" mode: nroff
+.\" fill-column: 72
+.\" End:
+.\" vim: set filetype=groff textwidth=72:
diff --git a/contrib/hdtbl/examples/rainbow.roff b/contrib/hdtbl/examples/rainbow.roff
new file mode 100644
index 0000000..ecd59f5
--- /dev/null
+++ b/contrib/hdtbl/examples/rainbow.roff
@@ -0,0 +1,86 @@
+.ig
+
+rainbow.roff
+
+This file is part of groff, the GNU roff type-setting system.
+
+Copyright (C) 2005-2020 Free Software Foundation, Inc.
+written by Joachim Walsdorff <Joachim.Walsdorff@urz.uni-heidelberg.de>.
+
+groff is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+groff is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+..
+.
+.if !d sopath \
+. ds sopath
+.
+.so \*[sopath]examples/common.roff
+.
+.nr *n 25
+.nr *# 0 1
+.
+.de ctab
+. nr #cc 0
+. PN \\$1 \
+ ".nr #cc +(1f / \\$1)" \
+ ".defcolor \En[t*#] rgb \\$2 \\$3 \\$4" \
+ ".TBL csp=\n[t*l]/(12*\\$1+2) border= cpd=0 bgc=\\\\n[t*#] bc=" \
+ ".if (\\\\n+[*#] == 1) \
+ .CPTN Rainbow Colors \[em] Nested Tables with Colored Backgrounds \
+ val=b" \
+ .TR \
+ .TD
+..
+.
+.ctab \n[*n] 1 0 \En[#cc]u \" rot -> magenta
+.ctab \n[*n] 1-\En[#cc]u 0 1 \" magenta -> blue
+.ctab \n[*n] 0 \En[#cc]u 1 \" blue -> cyan
+.ctab \n[*n] 0 1 1-\En[#cc]u \" cyan -> green
+.ctab \n[*n] \En[#cc]u 1 0 \" green -> yellow
+.ctab \n[*n] 1 1-\En[#cc]u 0 \" yellow -> red
+.
+.PN 6*\n[*n] .ETB
+.
+.bp
+.
+.nr *n 25
+.nr *# 0 1
+.
+.de ctab
+. nr #cc 0
+. PN \\$1 \
+ ".nr #cc +(1f / \\$1)" \
+ ".defcolor \En[t*#] rgb \\$2 \\$3 \\$4" \
+ ".TBL border=\n[t*l]/(12*\\$1+2) csp=0 cpd=0 bc=\\\\n[t*#] bgc=" \
+ ".if (\\\\n+[*#] == 1) \
+ .CPTN Rainbow Colors \[em] Nested Tables with Colored Borders \
+ val=b" \
+ .TR \
+ .TD
+..
+.
+.ctab \n[*n] 1 \En[#cc]u 0 \" red -> yellow
+.ctab \n[*n] 1-\En[#cc]u 1 0 \" yellow -> green
+.ctab \n[*n] 0 1 \En[#cc]u \" green -> cyan
+.ctab \n[*n] 0 1-\En[#cc]u 1 \" cyan -> blue
+.ctab \n[*n] \En[#cc]u 0 1 \" blue -> magenta
+.ctab \n[*n] 1 0 1-\En[#cc]u \" magenta -> red
+.
+.PN 6*\n[*n] .ETB
+.
+.\" Local Variables:
+.\" mode: nroff
+.\" fill-column: 72
+.\" End:
+.\" vim: set filetype=groff textwidth=72:
diff --git a/contrib/hdtbl/examples/short_reference.roff b/contrib/hdtbl/examples/short_reference.roff
new file mode 100644
index 0000000..62b3bcd
--- /dev/null
+++ b/contrib/hdtbl/examples/short_reference.roff
@@ -0,0 +1,86 @@
+.ig
+
+short_reference.roff
+
+This file is part of groff, the GNU roff type-setting system.
+
+Copyright (C) 2005-2020 Free Software Foundation, Inc.
+written by Joachim Walsdorff <Joachim.Walsdorff@urz.uni-heidelberg.de>.
+
+groff is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+groff is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+..
+.
+.if !d sopath \
+. ds sopath
+.
+.so \*[sopath]examples/common.roff
+.
+.t*pv 1.2 1.2 "" x
+.H Short Reference for the HDtbl-Macros
+This Short Reference describes the Heidelberger Table Macros
+using the macros themselves.
+.br
+.nr t*csp .3n
+.nr t*cpd .3n
+.ds t*ff HN
+.ds t*val m
+.ds t*hal l
+.xig
+.TBL "width=10% 40% 25% 25%" border= "fsz=1 .8"
+.CPTN Base- Optional- and Utility-Macros val=b
+.TR
+.TH Macro .TH Description .TH Predecessors .TH Successors
+.TR
+.TD \&.TBL .TD Begin a new table .TD \&.TD \&.TH \%.ETB cell content
+.TD \&.CPTN \&.TR
+.TR
+.TD \&.CPTN .TD Optional numbered or unnumbered table caption
+.TD \&.TBL .TD \&.TR
+.TR
+.TD \&.TR .TD Begin a new table row .TD \&.TBL \&.CPTN cell content
+.TD \&.TD \&.TR
+.TR
+.TD \&.TH .TD Optional begin table header cell
+.TD \&.TR \&.TD \&.TH \%.ETB cell content
+.TD \&.TD \&.TH \&.TR \%.ETB cell content
+.TR
+.TD \&.TD .TD Begin table data cell .TD \&.TR \&.TD \&.TH \%.ETB cell content
+.TD \&.TD \&.TH \&.TR \%.ETB cell content
+.TR
+.TD \&.ETB .TD Finish and print table .TD \&.TD \&.TH \%.ETB cell content
+.TD \&.TBL \&.TR \&.TD \&.TH \%.ETB cell content
+.TR
+.TD \&.t*free
+.TD colspan=3 val=t Utility macro to free held tables. Use it outside any table.
+.ETB
+.bp
+.x.
+.TBL "fsz=1 .8" "width=20% 32% 8% 8% 8% 8% 8% 8%" border=
+.TR
+.TH Argument .TH Value .TH \&.TBL .TH \&.CPT .TH \&.TR .TH \&.TH .TH \&.TD .TH \&.ETB
+.TR
+.TD border=\fI[n]\fP
+.TD border thickness .TD .ce X .TD .TD .TD .TD .TD
+.TR
+.TD bc=\fI[c]\fP
+.TD color of border and cellseperatorlines .TD .ce X .TD .TD .ce X .TD .ce X .TD .ce X .TD
+.ETB
+.H ------ incomplete -------
+.
+.\" Local Variables:
+.\" mode: nroff
+.\" fill-column: 72
+.\" End:
+.\" vim: set filetype=groff textwidth=72:
diff --git a/contrib/hdtbl/examples/test-hdtbl.sh.in b/contrib/hdtbl/examples/test-hdtbl.sh.in
new file mode 100644
index 0000000..5e81bf7
--- /dev/null
+++ b/contrib/hdtbl/examples/test-hdtbl.sh.in
@@ -0,0 +1,47 @@
+#!/bin/sh
+#
+# Copyright (C) 2018- Free Software Foundation, Inc.
+#
+# This file is part of groff.
+#
+# groff is free software; you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# groff is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+# Test generated files 'font_n.ps' and 'font_x.ps'. Both should have
+# 38 pages.
+
+builddir="@abs_top_builddir@"
+gs_program="@GHOSTSCRIPT@"
+ret=0
+
+if test "$gs_program" = "missing"; then
+ echo "ghostscript program missing, can't check hdtbl examples"
+ exit 77
+fi
+
+# $1 file, $2 expected number of pages
+check_number_pages()
+{
+ echo "Checking $1"
+ res=`$gs_program -o /dev/null/ -sDEVICE=bbox "$1" 2>&1 | grep HiResBoundingBox | wc -l`
+ if test $res != $2; then
+ echo " Error: expected $2 pages, found $res pages"
+ ret=255
+ fi
+}
+
+check_number_pages $builddir/contrib/hdtbl/examples/fonts_n.ps 38
+check_number_pages $builddir/contrib/hdtbl/examples/fonts_x.ps 38
+
+exit $ret