blob: 4674f9026e19a92c4db592c68abbaee8f34c8083 [file] [log] [blame]
Fred Drake6659c301998-03-03 22:02:19 +00001# python.perl by Fred L. Drake, Jr. <fdrake@acm.org> -*- perl -*-
2#
3# Heavily based on Guido van Rossum's myformat.perl (now obsolete).
4#
5# Extension to LaTeX2HTML for documents using myformat.sty.
6# Subroutines of the form do_cmd_<name> here define translations
7# for LaTeX commands \<name> defined in the corresponding .sty file.
8
9package main;
10
Fred Drake7a40c072000-10-02 14:43:38 +000011use File::Basename;
12
Fred Drake6659c301998-03-03 22:02:19 +000013
Fred Drake08932051998-04-17 02:15:42 +000014sub next_argument{
Fred Drakeccc62721999-01-05 22:16:29 +000015 my $param;
16 $param = missing_braces()
17 unless ((s/$next_pair_pr_rx/$param=$2;''/eo)
18 ||(s/$next_pair_rx/$param=$2;''/eo));
Fred Drake62e43691998-08-10 19:40:44 +000019 return $param;
Fred Drake08932051998-04-17 02:15:42 +000020}
21
22sub next_optional_argument{
23 my($param,$rx) = ('', "^\\s*(\\[([^]]*)\\])?");
Fred Drake5ccf3301998-04-17 20:04:09 +000024 s/$rx/$param=$2;''/eo;
Fred Drake62e43691998-08-10 19:40:44 +000025 return $param;
Fred Drake08932051998-04-17 02:15:42 +000026}
27
Fred Drake7a40c072000-10-02 14:43:38 +000028sub make_icon_filename($){
29 my($myname, $mydir, $myext) = fileparse(@_[0], '\..*');
30 chop $mydir;
31 if ($mydir eq '.') {
32 $mydir = $ICONSERVER;
33 }
34 $myext = ".$IMAGE_TYPE"
35 unless $myext;
36 return "$mydir$dd$myname$myext";
37}
38
Fred Drake7a40c072000-10-02 14:43:38 +000039sub get_link_icon($){
40 my $url = @_[0];
41 if ($OFF_SITE_LINK_ICON && ($url =~ /^[-a-zA-Z0-9.]+:/)) {
42 # absolute URL; assume it points off-site
43 my $icon = make_icon_filename($OFF_SITE_LINK_ICON);
44 return (" <img src='$icon'\n"
Fred Drake5f84c9b2000-10-03 06:05:25 +000045 . " border='0' class='offsitelink'"
46 . ($OFF_SITE_LINK_ICON_HEIGHT
47 ? " height='$OFF_SITE_LINK_ICON_HEIGHT'"
48 : '')
49 . ($OFF_SITE_LINK_ICON_WIDTH
50 ? " width='$OFF_SITE_LINK_ICON_WIDTH'"
51 : '')
52 . " alt='[off-site link]'\n"
Fred Drake7a40c072000-10-02 14:43:38 +000053 . " >");
54 }
55 return '';
56}
Fred Drakee16f6791998-05-15 04:28:37 +000057
58# This is a fairly simple hack; it supports \let when it is used to create
59# (or redefine) a macro to exactly be some other macro: \let\newname=\oldname.
Fred Drake5b73cdf1998-05-15 16:59:38 +000060# Many possible uses of \let aren't supported or aren't supported correctly.
Fred Drakee16f6791998-05-15 04:28:37 +000061#
62sub do_cmd_let{
63 local($_) = @_;
64 my $matched = 0;
Fred Drake7a4ad0f1998-05-15 13:45:54 +000065 s/[\\]([a-zA-Z]+)\s*(=\s*)?[\\]([a-zA-Z]*)/$matched=1; ''/e;
Fred Drakee16f6791998-05-15 04:28:37 +000066 if ($matched) {
67 my($new, $old) = ($1, $3);
68 eval "sub do_cmd_$new { do_cmd_$old" . '(@_); }';
69 print "\ndefining handler for \\$new using \\$old\n";
70 }
Fred Drake7a4ad0f1998-05-15 13:45:54 +000071 else {
72 s/[\\]([a-zA-Z]+)\s*(=\s*)?([^\\])/$matched=1; ''/es;
73 if ($matched) {
74 my($new, $char) = ($1, $3);
75 eval "sub do_cmd_$new { \"\\$char\" . \@_[0]; }";
76 print "\ndefining handler for \\$new to insert '$char'\n";
77 }
78 else {
79 write_warnings("Could not interpret \\let construct...");
80 }
81 }
Fred Drake62e43691998-08-10 19:40:44 +000082 return $_;
Fred Drakee16f6791998-05-15 04:28:37 +000083}
84
85
Fred Drakec3fd45f2000-06-15 22:41:48 +000086# the older version of LaTeX2HTML we use doesn't support this, but we use it:
87
88sub do_cmd_textasciitilde{ '~' . @_[0]; }
89
90
Fred Drake6659c301998-03-03 22:02:19 +000091# words typeset in a special way (not in HTML though)
92
93sub do_cmd_ABC{ 'ABC' . @_[0]; }
94sub do_cmd_UNIX{ 'Unix'. @_[0]; }
95sub do_cmd_ASCII{ 'ASCII' . @_[0]; }
96sub do_cmd_POSIX{ 'POSIX' . @_[0]; }
97sub do_cmd_C{ 'C' . @_[0]; }
98sub do_cmd_Cpp{ 'C++' . @_[0]; }
99sub do_cmd_EOF{ 'EOF' . @_[0]; }
Fred Drakee15956b2000-04-03 04:51:13 +0000100sub do_cmd_NULL{ '<tt class="constant">NULL</tt>' . @_[0]; }
Fred Drake6659c301998-03-03 22:02:19 +0000101
102sub do_cmd_e{ '&#92;' . @_[0]; }
103
Fred Draked07868a1998-05-14 21:00:28 +0000104$DEVELOPER_ADDRESS = '';
Fred Drake3cdb89d2000-09-14 20:17:23 +0000105$SHORT_VERSION = '';
Fred Draked04592a2000-10-25 16:15:13 +0000106$PACKAGE_VERSION = '';
Fred Drake6659c301998-03-03 22:02:19 +0000107
Fred Draked04592a2000-10-25 16:15:13 +0000108sub do_cmd_version{ $PACKAGE_VERSION . @_[0]; }
Fred Drake3cdb89d2000-09-14 20:17:23 +0000109sub do_cmd_shortversion{ $SHORT_VERSION . @_[0]; }
Fred Drake6659c301998-03-03 22:02:19 +0000110sub do_cmd_release{
111 local($_) = @_;
Fred Draked04592a2000-10-25 16:15:13 +0000112 $PACKAGE_VERSION = next_argument();
Fred Drake62e43691998-08-10 19:40:44 +0000113 return $_;
Fred Drake6659c301998-03-03 22:02:19 +0000114}
115
Fred Drake3cdb89d2000-09-14 20:17:23 +0000116sub do_cmd_setshortversion{
117 local($_) = @_;
118 $SHORT_VERSION = next_argument();
119 return $_;
120}
121
Fred Drake6659c301998-03-03 22:02:19 +0000122sub do_cmd_authoraddress{
123 local($_) = @_;
Fred Draked07868a1998-05-14 21:00:28 +0000124 $DEVELOPER_ADDRESS = next_argument();
Fred Drake62e43691998-08-10 19:40:44 +0000125 return $_;
Fred Drake6659c301998-03-03 22:02:19 +0000126}
127
Fred Drakee16f6791998-05-15 04:28:37 +0000128#sub do_cmd_developer{ do_cmd_author(@_[0]); }
129#sub do_cmd_developers{ do_cmd_author(@_[0]); }
130#sub do_cmd_developersaddress{ do_cmd_authoraddress(@_[0]); }
Fred Draked07868a1998-05-14 21:00:28 +0000131
Fred Drake6659c301998-03-03 22:02:19 +0000132sub do_cmd_hackscore{
133 local($_) = @_;
Fred Drake08932051998-04-17 02:15:42 +0000134 next_argument();
Fred Drake62e43691998-08-10 19:40:44 +0000135 return '_' . $_;
Fred Drake6659c301998-03-03 22:02:19 +0000136}
137
Fred Drake08932051998-04-17 02:15:42 +0000138sub use_wrappers{
139 local($_,$before,$after) = @_;
140 my $stuff = next_argument();
Fred Drake62e43691998-08-10 19:40:44 +0000141 return $before . $stuff . $after . $_;
Fred Drake08932051998-04-17 02:15:42 +0000142}
143
Fred Drake3cdb89d2000-09-14 20:17:23 +0000144$IN_DESC_HANDLER = 0;
Fred Drake6659c301998-03-03 22:02:19 +0000145sub do_cmd_optional{
Fred Drake3cdb89d2000-09-14 20:17:23 +0000146 if ($IN_DESC_HANDLER) {
147 return use_wrappers(@_[0], "</var><big>\[</big><var>",
148 "</var><big>\]</big><var>");
149 }
150 else {
151 return use_wrappers(@_[0], "<big>\[</big>", "<big>\]</big>");
152 }
Fred Drake6659c301998-03-03 22:02:19 +0000153}
154
Fred Drakec9a44381998-03-17 06:29:13 +0000155# Logical formatting (some based on texinfo), needs to be converted to
156# minimalist HTML. The "minimalist" is primarily to reduce the size of
157# output files for users that read them over the network rather than
158# from local repositories.
Fred Drake6659c301998-03-03 22:02:19 +0000159
Fred Drake2cafcbb1999-03-25 16:57:04 +0000160# \file and \samp are at the end of this file since they screw up fontlock.
161
Fred Drake2ff880e1999-02-05 18:31:29 +0000162sub do_cmd_pytype{ return @_[0]; }
Fred Drake3d5a04a2000-08-03 17:25:44 +0000163sub do_cmd_makevar{
164 return use_wrappers(@_[0], '<span class="makevar">', '</span>'); }
Fred Drake90fdda51999-02-16 20:27:42 +0000165sub do_cmd_code{
Fred Drakee15956b2000-04-03 04:51:13 +0000166 return use_wrappers(@_[0], '<code>', '</code>'); }
Fred Drake90fdda51999-02-16 20:27:42 +0000167sub do_cmd_module{
Fred Drakee15956b2000-04-03 04:51:13 +0000168 return use_wrappers(@_[0], '<tt class="module">', '</tt>'); }
Fred Drake90fdda51999-02-16 20:27:42 +0000169sub do_cmd_keyword{
Fred Drakee15956b2000-04-03 04:51:13 +0000170 return use_wrappers(@_[0], '<tt class="keyword">', '</tt>'); }
Fred Drake90fdda51999-02-16 20:27:42 +0000171sub do_cmd_exception{
Fred Drakee15956b2000-04-03 04:51:13 +0000172 return use_wrappers(@_[0], '<tt class="exception">', '</tt>'); }
Fred Drake90fdda51999-02-16 20:27:42 +0000173sub do_cmd_class{
Fred Drakee15956b2000-04-03 04:51:13 +0000174 return use_wrappers(@_[0], '<tt class="class">', '</tt>'); }
Fred Drake90fdda51999-02-16 20:27:42 +0000175sub do_cmd_function{
Fred Drakee15956b2000-04-03 04:51:13 +0000176 return use_wrappers(@_[0], '<tt class="function">', '</tt>'); }
Fred Drake90fdda51999-02-16 20:27:42 +0000177sub do_cmd_constant{
Fred Drakee15956b2000-04-03 04:51:13 +0000178 return use_wrappers(@_[0], '<tt class="constant">', '</tt>'); }
Fred Drake90fdda51999-02-16 20:27:42 +0000179sub do_cmd_member{
Fred Drakee15956b2000-04-03 04:51:13 +0000180 return use_wrappers(@_[0], '<tt class="member">', '</tt>'); }
Fred Drake90fdda51999-02-16 20:27:42 +0000181sub do_cmd_method{
Fred Drakee15956b2000-04-03 04:51:13 +0000182 return use_wrappers(@_[0], '<tt class="method">', '</tt>'); }
Fred Drake90fdda51999-02-16 20:27:42 +0000183sub do_cmd_cfunction{
Fred Drakee15956b2000-04-03 04:51:13 +0000184 return use_wrappers(@_[0], '<tt class="cfunction">', '</tt>'); }
Fred Drake90fdda51999-02-16 20:27:42 +0000185sub do_cmd_cdata{
Fred Drakee15956b2000-04-03 04:51:13 +0000186 return use_wrappers(@_[0], '<tt class="cdata">', '</tt>'); }
Fred Drake90fdda51999-02-16 20:27:42 +0000187sub do_cmd_ctype{
Fred Drakee15956b2000-04-03 04:51:13 +0000188 return use_wrappers(@_[0], '<tt class="ctype">', '</tt>'); }
Fred Drake90fdda51999-02-16 20:27:42 +0000189sub do_cmd_regexp{
Fred Drakee15956b2000-04-03 04:51:13 +0000190 return use_wrappers(@_[0], '<tt class="regexp">', '</tt>'); }
Fred Drake90fdda51999-02-16 20:27:42 +0000191sub do_cmd_character{
Fred Drakee15956b2000-04-03 04:51:13 +0000192 return use_wrappers(@_[0], '"<tt class="character">', '</tt>"'); }
Fred Drake90fdda51999-02-16 20:27:42 +0000193sub do_cmd_program{
Fred Drakee15956b2000-04-03 04:51:13 +0000194 return use_wrappers(@_[0], '<b class="program">', '</b>'); }
Fred Drakec9f5fe01999-11-09 16:59:42 +0000195sub do_cmd_programopt{
196 return use_wrappers(@_[0], '<b class="programopt">', '</b>'); }
Fred Drake0cd60212000-04-11 18:46:59 +0000197sub do_cmd_longprogramopt{
198 # note that the --- will be later converted to -- by LaTeX2HTML
199 return use_wrappers(@_[0], '<b class="programopt">---', '</b>'); }
Fred Drake90fdda51999-02-16 20:27:42 +0000200sub do_cmd_email{
Fred Drakee15956b2000-04-03 04:51:13 +0000201 return use_wrappers(@_[0], '<span class="email">', '</span>'); }
Fred Drake90fdda51999-02-16 20:27:42 +0000202sub do_cmd_mimetype{
Fred Drakee15956b2000-04-03 04:51:13 +0000203 return use_wrappers(@_[0], '<span class="mimetype">', '</span>'); }
Fred Drake90fdda51999-02-16 20:27:42 +0000204sub do_cmd_var{
205 return use_wrappers(@_[0], "<var>", "</var>"); }
206sub do_cmd_dfn{
Fred Drakee15956b2000-04-03 04:51:13 +0000207 return use_wrappers(@_[0], '<i class="dfn">', '</i>'); }
Fred Drake90fdda51999-02-16 20:27:42 +0000208sub do_cmd_emph{
Fred Drake38178fd2000-09-22 17:05:04 +0000209 return use_wrappers(@_[0], '<i>', '</i>'); }
Fred Drake90fdda51999-02-16 20:27:42 +0000210sub do_cmd_file{
Fred Drake3d5a04a2000-08-03 17:25:44 +0000211 return use_wrappers(@_[0], '<span class="file">', '</span>'); }
Fred Drakef74e5b71999-04-28 14:58:49 +0000212sub do_cmd_filenq{
Fred Drakee15956b2000-04-03 04:51:13 +0000213 return do_cmd_file(@_[0]); }
Fred Drake90fdda51999-02-16 20:27:42 +0000214sub do_cmd_samp{
Fred Drakee15956b2000-04-03 04:51:13 +0000215 return use_wrappers(@_[0], '"<tt class="samp">', '</tt>"'); }
Fred Drake90fdda51999-02-16 20:27:42 +0000216sub do_cmd_kbd{
217 return use_wrappers(@_[0], '<kbd>', '</kbd>'); }
218sub do_cmd_strong{
219 return use_wrappers(@_[0], '<b>', '</b>'); }
Fred Drake2cafcbb1999-03-25 16:57:04 +0000220sub do_cmd_textbf{
221 return use_wrappers(@_[0], '<b>', '</b>'); }
222sub do_cmd_textit{
223 return use_wrappers(@_[0], '<i>', '</i>'); }
224
Fred Drake3d5a04a2000-08-03 17:25:44 +0000225sub do_cmd_moreargs{
226 return '...' . @_[0]; }
227sub do_cmd_unspecified{
228 return '...' . @_[0]; }
229
Fred Drakec9a44381998-03-17 06:29:13 +0000230
Fred Drake25817041999-01-13 17:06:34 +0000231sub do_cmd_refmodule{
232 # Insert the right magic to jump to the module definition.
233 local($_) = @_;
234 my $key = next_optional_argument();
235 my $module = next_argument();
236 $key = $module
237 unless $key;
Fred Drakee15956b2000-04-03 04:51:13 +0000238 return "<tt class='module'><a href='module-$key.html'>$module</a></tt>"
239 . $_;
Fred Drake25817041999-01-13 17:06:34 +0000240}
241
Fred Drake1a7af391998-04-01 22:44:56 +0000242sub do_cmd_newsgroup{
243 local($_) = @_;
Fred Drake08932051998-04-17 02:15:42 +0000244 my $newsgroup = next_argument();
Fred Drake7a40c072000-10-02 14:43:38 +0000245 my $icon = get_link_icon("news:$newsgroup");
Fred Drakeafc7ce12001-01-22 17:33:24 +0000246 my $stuff = "<a class='newsgroup' href='news:$newsgroup'>"
247 . "$newsgroup$icon</a>";
Fred Drake62e43691998-08-10 19:40:44 +0000248 return $stuff . $_;
Fred Drake1a7af391998-04-01 22:44:56 +0000249}
Fred Drakefc16e781998-03-12 21:03:26 +0000250
251sub do_cmd_envvar{
252 local($_) = @_;
Fred Drakeccc62721999-01-05 22:16:29 +0000253 my $envvar = next_argument();
254 my($name,$aname,$ahref) = new_link_info();
Fred Drake166abba1998-04-08 23:10:54 +0000255 # The <tt> here is really to keep buildindex.py from making
256 # the variable name case-insensitive.
Fred Drakeafc7ce12001-01-22 17:33:24 +0000257 add_index_entry("environment variables!$envvar@<tt>$envvar</tt>",
Fred Drake166abba1998-04-08 23:10:54 +0000258 $ahref);
Fred Drakeafc7ce12001-01-22 17:33:24 +0000259 add_index_entry("$envvar (environment variable)", $ahref);
Fred Drakee15956b2000-04-03 04:51:13 +0000260 $aname =~ s/<a/<a class="envvar"/;
Fred Drakeafc7ce12001-01-22 17:33:24 +0000261 return "$aname$envvar</a>" . $_;
Fred Drakefc16e781998-03-12 21:03:26 +0000262}
263
Fred Drake6659c301998-03-03 22:02:19 +0000264sub do_cmd_url{
265 # use the URL as both text and hyperlink
266 local($_) = @_;
Fred Drake08932051998-04-17 02:15:42 +0000267 my $url = next_argument();
Fred Drake7a40c072000-10-02 14:43:38 +0000268 my $icon = get_link_icon($url);
Fred Drake6659c301998-03-03 22:02:19 +0000269 $url =~ s/~/&#126;/g;
Fred Drake7a40c072000-10-02 14:43:38 +0000270 return "<a class=\"url\" href=\"$url\">$url$icon</a>" . $_;
Fred Drake6659c301998-03-03 22:02:19 +0000271}
272
273sub do_cmd_manpage{
274 # two parameters: \manpage{name}{section}
275 local($_) = @_;
Fred Drake08932051998-04-17 02:15:42 +0000276 my $page = next_argument();
277 my $section = next_argument();
Fred Drakee15956b2000-04-03 04:51:13 +0000278 return "<span class='manpage'><i>$page</i>($section)</span>" . $_;
Fred Drake6659c301998-03-03 22:02:19 +0000279}
280
Fred Drakeafc7ce12001-01-22 17:33:24 +0000281$PEP_FORMAT = "http://python.sourceforge.net/peps/pep-XXXX.html";
282$RFC_FORMAT = "http://www.ietf.org/rfc/rfcXXXX.txt";
283
284sub get_rfc_url($$){
285 my($rfcnum, $format) = @_;
286 $rfcnum = sprintf("%04d", $rfcnum);
287 $format = "$format";
288 $format =~ s/XXXX/$rfcnum/;
289 return $format;
Fred Drake643d76d2000-09-09 06:07:37 +0000290}
291
292sub do_cmd_pep{
293 local($_) = @_;
294 my $rfcnumber = next_argument();
295 my $id = "rfcref-" . ++$global{'max_id'};
Fred Drakeafc7ce12001-01-22 17:33:24 +0000296 my $href = get_rfc_url($rfcnumber, $PEP_FORMAT);
Fred Drake7a40c072000-10-02 14:43:38 +0000297 my $icon = get_link_icon($href);
Fred Drake643d76d2000-09-09 06:07:37 +0000298 # Save the reference
299 my $nstr = gen_index_id("Python Enhancement Proposals!PEP $rfcnumber", '');
300 $index{$nstr} .= make_half_href("$CURRENT_FILE#$id");
Fred Drake7a40c072000-10-02 14:43:38 +0000301 return ("<a class=\"rfc\" name=\"$id\"\nhref=\"$href\">PEP $rfcnumber"
302 . "$icon</a>" . $_);
Fred Drake643d76d2000-09-09 06:07:37 +0000303}
304
Fred Drake6659c301998-03-03 22:02:19 +0000305sub do_cmd_rfc{
306 local($_) = @_;
Fred Drakeccc62721999-01-05 22:16:29 +0000307 my $rfcnumber = next_argument();
308 my $id = "rfcref-" . ++$global{'max_id'};
Fred Drakeafc7ce12001-01-22 17:33:24 +0000309 my $href = get_rfc_url($rfcnumber, $RFC_FORMAT);
Fred Drake7a40c072000-10-02 14:43:38 +0000310 my $icon = get_link_icon($href);
Fred Drake6659c301998-03-03 22:02:19 +0000311 # Save the reference
Fred Drake08932051998-04-17 02:15:42 +0000312 my $nstr = gen_index_id("RFC!RFC $rfcnumber", '');
Fred Drakeccc62721999-01-05 22:16:29 +0000313 $index{$nstr} .= make_half_href("$CURRENT_FILE#$id");
Fred Drake7a40c072000-10-02 14:43:38 +0000314 return ("<a class=\"rfc\" name=\"$id\"\nhref=\"$href\">RFC $rfcnumber"
315 . "$icon</a>" . $_);
Fred Drake6659c301998-03-03 22:02:19 +0000316}
317
Fred Drakec9f5fe01999-11-09 16:59:42 +0000318sub do_cmd_citetitle{
319 local($_) = @_;
320 my $url = next_optional_argument();
321 my $title = next_argument();
Fred Drake7a40c072000-10-02 14:43:38 +0000322 my $icon = get_link_icon($url);
Fred Drakec9f5fe01999-11-09 16:59:42 +0000323 my $repl = '';
324 if ($url) {
325 $repl = ("<em class='citetitle'><a\n"
326 . " href='$url'\n"
327 . " title='$title'\n"
Fred Drake7a40c072000-10-02 14:43:38 +0000328 . " >$title$icon</a></em>");
Fred Drakec9f5fe01999-11-09 16:59:42 +0000329 }
330 else {
331 $repl = "<em class='citetitle'\n >$title</em>";
332 }
333 return $repl . $_;
334}
335
Fred Drake6659c301998-03-03 22:02:19 +0000336sub do_cmd_deprecated{
337 # two parameters: \deprecated{version}{whattodo}
338 local($_) = @_;
Fred Drake08932051998-04-17 02:15:42 +0000339 my $release = next_argument();
340 my $reason = next_argument();
Fred Drakeafc7ce12001-01-22 17:33:24 +0000341 return ('<div class="versionnote">'
342 . "<b>Deprecated since release $release.</b>"
343 . "\n$reason</div><p>"
344 . $_);
Fred Drake6659c301998-03-03 22:02:19 +0000345}
346
Fred Drakec2b29d02001-04-18 03:11:04 +0000347sub versionnote{
348 # one or two parameters: \versionnote[explanation]{version}
349 my $type = @_[0];
350 local $_ = @_[1];
351 my $explanation = next_optional_argument();
Fred Drake897d12b1998-07-27 20:33:17 +0000352 my $release = next_argument();
Fred Drakec2b29d02001-04-18 03:11:04 +0000353 my $text = "$type in version $release.";
354 if ($explanation) {
355 $text = "$type in version $release:\n$explanation.";
356 }
357 return "\n<span class='versionnote'>$text</span>\n" . $_;
358}
359
360sub do_cmd_versionadded{
361 return versionnote('New', @_);
Fred Drake897d12b1998-07-27 20:33:17 +0000362}
363
364sub do_cmd_versionchanged{
Fred Drakec2b29d02001-04-18 03:11:04 +0000365 return versionnote('Changed', @_);
Fred Drake897d12b1998-07-27 20:33:17 +0000366}
367
Fred Drake557460c1999-03-02 16:05:35 +0000368#
Fred Drake2cafcbb1999-03-25 16:57:04 +0000369# These function handle platform dependency tracking.
Fred Drake557460c1999-03-02 16:05:35 +0000370#
371sub do_cmd_platform{
372 local($_) = @_;
373 my $platform = next_argument();
Fred Drakee15956b2000-04-03 04:51:13 +0000374 $ModulePlatforms{"<tt class='module'>$THIS_MODULE</tt>"} = $platform;
Fred Drake557460c1999-03-02 16:05:35 +0000375 $platform = "Macintosh"
Fred Drake085b8121999-04-21 14:00:29 +0000376 if $platform eq 'Mac';
Fred Drakee15956b2000-04-03 04:51:13 +0000377 return "\n<p class='availability'>Availability: <span"
378 . "\n class='platform'>$platform</span>.</p>\n" . $_;
Fred Drake557460c1999-03-02 16:05:35 +0000379}
380
Fred Drake557460c1999-03-02 16:05:35 +0000381$IGNORE_PLATFORM_ANNOTATION = '';
382sub do_cmd_ignorePlatformAnnotation{
383 local($_) = @_;
384 $IGNORE_PLATFORM_ANNOTATION = next_argument();
385 return $_;
386}
387
Fred Drake6659c301998-03-03 22:02:19 +0000388
389# index commands
390
391$INDEX_SUBITEM = "";
392
393sub get_indexsubitem{
Fred Drake7d45f6d1999-01-05 14:39:27 +0000394 return $INDEX_SUBITEM ? " $INDEX_SUBITEM" : '';
Fred Drake6659c301998-03-03 22:02:19 +0000395}
396
397sub do_cmd_setindexsubitem{
398 local($_) = @_;
Fred Drake2e1ee3e1999-02-10 21:17:04 +0000399 $INDEX_SUBITEM = next_argument();
Fred Drake62e43691998-08-10 19:40:44 +0000400 return $_;
Fred Drake6659c301998-03-03 22:02:19 +0000401}
402
Fred Drakefc16e781998-03-12 21:03:26 +0000403sub do_cmd_withsubitem{
Fred Drake7d45f6d1999-01-05 14:39:27 +0000404 # We can't really do the right thing, because LaTeX2HTML doesn't
Fred Drakefc16e781998-03-12 21:03:26 +0000405 # do things in the right order, but we need to at least strip this stuff
406 # out, and leave anything that the second argument expanded out to.
407 #
408 local($_) = @_;
Fred Drake7d45f6d1999-01-05 14:39:27 +0000409 my $oldsubitem = $INDEX_SUBITEM;
410 $INDEX_SUBITEM = next_argument();
Fred Drake08932051998-04-17 02:15:42 +0000411 my $stuff = next_argument();
Fred Drakeccc62721999-01-05 22:16:29 +0000412 my $br_id = ++$globals{'max_id'};
413 my $marker = "$O$br_id$C";
Fred Drake7d45f6d1999-01-05 14:39:27 +0000414 return
415 $stuff
Fred Drakeccc62721999-01-05 22:16:29 +0000416 . "\\setindexsubitem$marker$oldsubitem$marker"
Fred Drake7d45f6d1999-01-05 14:39:27 +0000417 . $_;
Fred Drakefc16e781998-03-12 21:03:26 +0000418}
419
Fred Drake08932051998-04-17 02:15:42 +0000420# This is the prologue macro which is required to start writing the
Fred Drakeab032151999-05-13 18:36:54 +0000421# mod\jobname.idx file; we can just ignore it. (Defining this suppresses
422# a warning that \makemodindex is unknown.)
Fred Drake08932051998-04-17 02:15:42 +0000423#
Fred Drake62e43691998-08-10 19:40:44 +0000424sub do_cmd_makemodindex{ return @_[0]; }
Fred Drakefc16e781998-03-12 21:03:26 +0000425
Fred Drake42b31a51998-03-27 05:16:10 +0000426# We're in the document subdirectory when this happens!
Fred Drake166abba1998-04-08 23:10:54 +0000427#
Fred Drake08932051998-04-17 02:15:42 +0000428open(IDXFILE, '>index.dat') || die "\n$!\n";
429open(INTLABELS, '>intlabels.pl') || die "\n$!\n";
Fred Drake166abba1998-04-08 23:10:54 +0000430print INTLABELS "%internal_labels = ();\n";
431print INTLABELS "1; # hack in case there are no entries\n\n";
432
433# Using \0 for this is bad because we can't use common tools to work with the
434# resulting files. Things like grep can be useful with this stuff!
435#
436$IDXFILE_FIELD_SEP = "\1";
437
Fred Drakeccc62721999-01-05 22:16:29 +0000438sub write_idxfile{
439 my ($ahref, $str) = @_;
440 print IDXFILE $ahref, $IDXFILE_FIELD_SEP, $str, "\n";
Fred Drake42b31a51998-03-27 05:16:10 +0000441}
442
Fred Drake42b31a51998-03-27 05:16:10 +0000443
444sub gen_link{
445 my($node,$target) = @_;
446 print INTLABELS "\$internal_labels{\"$target\"} = \"$URL/$node\";\n";
Fred Drakee15956b2000-04-03 04:51:13 +0000447 return "<a href='$node#$target'>";
Fred Drake42b31a51998-03-27 05:16:10 +0000448}
449
Fred Drake42b31a51998-03-27 05:16:10 +0000450sub add_index_entry{
451 # add an entry to the index structures; ignore the return value
452 my($str,$ahref) = @_;
453 $str = gen_index_id($str, '');
454 $index{$str} .= $ahref;
Fred Drakeccc62721999-01-05 22:16:29 +0000455 write_idxfile($ahref, $str);
Fred Drake42b31a51998-03-27 05:16:10 +0000456}
457
Fred Drakeccc62721999-01-05 22:16:29 +0000458sub new_link_info{
459 my $name = "l2h-" . ++$globals{'max_id'};
Fred Drakee15956b2000-04-03 04:51:13 +0000460 my $aname = "<a name='$name'>";
Fred Drake42b31a51998-03-27 05:16:10 +0000461 my $ahref = gen_link($CURRENT_FILE, $name);
462 return ($name, $aname, $ahref);
463}
464
Fred Drakeab032151999-05-13 18:36:54 +0000465$IndexMacroPattern = '';
466sub define_indexing_macro{
467 my $count = @_;
468 my $i = 0;
469 for (; $i < $count; ++$i) {
470 my $name = @_[$i];
471 my $cmd = "idx_cmd_$name";
472 die "\nNo function $cmd() defined!\n"
473 if (!defined &$cmd);
474 eval ("sub do_cmd_$name { return process_index_macros("
475 . "\@_[0], '$name'); }");
476 if (length($IndexMacroPattern) == 0) {
477 $IndexMacroPattern = "$name";
478 }
479 else {
480 $IndexMacroPattern .= "|$name";
481 }
482 }
483}
484
485$DEBUG_INDEXING = 0;
486sub process_index_macros{
Fred Drake42b31a51998-03-27 05:16:10 +0000487 local($_) = @_;
Fred Drakeab032151999-05-13 18:36:54 +0000488 my $cmdname = @_[1]; # This is what triggered us in the first place;
489 # we know it's real, so just process it.
Fred Drakeccc62721999-01-05 22:16:29 +0000490 my($name,$aname,$ahref) = new_link_info();
Fred Drakeab032151999-05-13 18:36:54 +0000491 my $cmd = "idx_cmd_$cmdname";
492 print "\nIndexing: \\$cmdname"
493 if $DEBUG_INDEXING;
494 &$cmd($ahref); # modifies $_ and adds index entries
495 while (/^[\s\n]*\\($IndexMacroPattern)</) {
496 $cmdname = "$1";
497 print " \\$cmdname"
498 if $DEBUG_INDEXING;
499 $cmd = "idx_cmd_$cmdname";
500 if (!defined &$cmd) {
501 last;
502 }
503 else {
504 s/^[\s\n]*\\$cmdname//;
505 &$cmd($ahref);
506 }
507 }
Fred Drakeafc7ce12001-01-22 17:33:24 +0000508 if (/^[ \t\r\n]/) {
509 $_ = substr($_, 1);
510 }
Fred Drake62e43691998-08-10 19:40:44 +0000511 return "$aname$anchor_invisible_mark</a>" . $_;
Fred Drake42b31a51998-03-27 05:16:10 +0000512}
513
Fred Drakeab032151999-05-13 18:36:54 +0000514define_indexing_macro('index');
515sub idx_cmd_index{
Fred Drakeccc62721999-01-05 22:16:29 +0000516 my $str = next_argument();
Fred Drakeab032151999-05-13 18:36:54 +0000517 add_index_entry("$str", @_[0]);
Fred Drake2e7edb81998-05-11 18:31:17 +0000518}
519
Fred Drakeab032151999-05-13 18:36:54 +0000520define_indexing_macro('kwindex');
521sub idx_cmd_kwindex{
522 my $str = next_argument();
523 add_index_entry("<tt>$str</tt>!keyword", @_[0]);
524 add_index_entry("keyword!<tt>$str</tt>", @_[0]);
525}
526
527define_indexing_macro('indexii');
528sub idx_cmd_indexii{
Fred Drakeccc62721999-01-05 22:16:29 +0000529 my $str1 = next_argument();
Fred Drake08932051998-04-17 02:15:42 +0000530 my $str2 = next_argument();
Fred Drakeab032151999-05-13 18:36:54 +0000531 add_index_entry("$str1!$str2", @_[0]);
532 add_index_entry("$str2!$str1", @_[0]);
Fred Drake6659c301998-03-03 22:02:19 +0000533}
534
Fred Drakeab032151999-05-13 18:36:54 +0000535define_indexing_macro('indexiii');
536sub idx_cmd_indexiii{
Fred Drakeccc62721999-01-05 22:16:29 +0000537 my $str1 = next_argument();
Fred Drake08932051998-04-17 02:15:42 +0000538 my $str2 = next_argument();
539 my $str3 = next_argument();
Fred Drakeab032151999-05-13 18:36:54 +0000540 add_index_entry("$str1!$str2 $str3", @_[0]);
541 add_index_entry("$str2!$str3, $str1", @_[0]);
542 add_index_entry("$str3!$str1 $str2", @_[0]);
Fred Drake6659c301998-03-03 22:02:19 +0000543}
544
Fred Drakeab032151999-05-13 18:36:54 +0000545define_indexing_macro('indexiv');
546sub idx_cmd_indexiv{
Fred Drakeccc62721999-01-05 22:16:29 +0000547 my $str1 = next_argument();
Fred Drake08932051998-04-17 02:15:42 +0000548 my $str2 = next_argument();
549 my $str3 = next_argument();
550 my $str4 = next_argument();
Fred Drakeab032151999-05-13 18:36:54 +0000551 add_index_entry("$str1!$str2 $str3 $str4", @_[0]);
552 add_index_entry("$str2!$str3 $str4, $str1", @_[0]);
553 add_index_entry("$str3!$str4, $str1 $str2", @_[0]);
554 add_index_entry("$str4!$$str1 $str2 $str3", @_[0]);
Fred Drake6659c301998-03-03 22:02:19 +0000555}
556
Fred Drakeab032151999-05-13 18:36:54 +0000557define_indexing_macro('ttindex');
558sub idx_cmd_ttindex{
Fred Drakeccc62721999-01-05 22:16:29 +0000559 my $str = next_argument();
560 my $entry = $str . get_indexsubitem();
Fred Drakeab032151999-05-13 18:36:54 +0000561 add_index_entry($entry, @_[0]);
Fred Drakec9a44381998-03-17 06:29:13 +0000562}
Fred Drake6659c301998-03-03 22:02:19 +0000563
564sub my_typed_index_helper{
Fred Drakeab032151999-05-13 18:36:54 +0000565 my($word,$ahref) = @_;
Fred Drakeccc62721999-01-05 22:16:29 +0000566 my $str = next_argument();
Fred Drake42b31a51998-03-27 05:16:10 +0000567 add_index_entry("$str $word", $ahref);
568 add_index_entry("$word!$str", $ahref);
Fred Drake6659c301998-03-03 22:02:19 +0000569}
570
Fred Drakeab032151999-05-13 18:36:54 +0000571define_indexing_macro('stindex', 'opindex', 'exindex', 'obindex');
572sub idx_cmd_stindex{ my_typed_index_helper('statement', @_[0]); }
573sub idx_cmd_opindex{ my_typed_index_helper('operator', @_[0]); }
574sub idx_cmd_exindex{ my_typed_index_helper('exception', @_[0]); }
575sub idx_cmd_obindex{ my_typed_index_helper('object', @_[0]); }
Fred Drake6659c301998-03-03 22:02:19 +0000576
Fred Drakeab032151999-05-13 18:36:54 +0000577define_indexing_macro('bifuncindex');
578sub idx_cmd_bifuncindex{
Fred Drakeccc62721999-01-05 22:16:29 +0000579 my $str = next_argument();
Fred Drakee15956b2000-04-03 04:51:13 +0000580 add_index_entry("<tt class='function'>$str()</tt> (built-in function)",
581 @_[0]);
Fred Drake6659c301998-03-03 22:02:19 +0000582}
583
584
Fred Drake6659c301998-03-03 22:02:19 +0000585sub make_mod_index_entry{
Fred Drakeccc62721999-01-05 22:16:29 +0000586 my($str,$define) = @_;
587 my($name,$aname,$ahref) = new_link_info();
Fred Drake42b31a51998-03-27 05:16:10 +0000588 # equivalent of add_index_entry() using $define instead of ''
Fred Drake2e1ee3e1999-02-10 21:17:04 +0000589 $ahref =~ s/\#[-_a-zA-Z0-9]*\"/\"/
590 if ($define eq 'DEF');
Fred Drake42b31a51998-03-27 05:16:10 +0000591 $str = gen_index_id($str, $define);
592 $index{$str} .= $ahref;
Fred Drakeccc62721999-01-05 22:16:29 +0000593 write_idxfile($ahref, $str);
Fred Drake42b31a51998-03-27 05:16:10 +0000594
Fred Drakec9a44381998-03-17 06:29:13 +0000595 if ($define eq 'DEF') {
Fred Drake42b31a51998-03-27 05:16:10 +0000596 # add to the module index
Fred Drakee15956b2000-04-03 04:51:13 +0000597 $str =~ /(<tt.*<\/tt>)/;
598 my $nstr = $1;
Fred Drake42b31a51998-03-27 05:16:10 +0000599 $Modules{$nstr} .= $ahref;
Fred Drake6659c301998-03-03 22:02:19 +0000600 }
Fred Drakeafc7ce12001-01-22 17:33:24 +0000601 return "$aname$anchor_invisible_mark2</a>";
Fred Drake6659c301998-03-03 22:02:19 +0000602}
603
Fred Drake557460c1999-03-02 16:05:35 +0000604
Fred Drakec9a44381998-03-17 06:29:13 +0000605$THIS_MODULE = '';
Fred Drake42b31a51998-03-27 05:16:10 +0000606$THIS_CLASS = '';
Fred Drakec9a44381998-03-17 06:29:13 +0000607
Fred Drakea0f4c941998-07-24 22:16:04 +0000608sub define_module{
609 my($word,$name) = @_;
Fred Drakec9a44381998-03-17 06:29:13 +0000610 my $section_tag = join('', @curr_sec_id);
Fred Drake3e4c6141999-05-17 15:00:32 +0000611 if ($word ne "built-in" && $word ne "extension"
612 && $word ne "standard" && $word ne "") {
613 write_warnings("Bad module type '$word'"
614 . " for \\declaremodule (module $name)");
615 $word = "";
616 }
Fred Drake6659c301998-03-03 22:02:19 +0000617 $word = "$word " if $word;
Fred Drakea0f4c941998-07-24 22:16:04 +0000618 $THIS_MODULE = "$name";
Fred Drake5942b432000-10-30 06:24:56 +0000619 $INDEX_SUBITEM = "(in module $name)";
Fred Drake2e1ee3e1999-02-10 21:17:04 +0000620 print "[$name]";
Fred Drakee15956b2000-04-03 04:51:13 +0000621 return make_mod_index_entry(
622 "<tt class='module'>$name</tt> (${word}module)", 'DEF');
Fred Drakea0f4c941998-07-24 22:16:04 +0000623}
624
625sub my_module_index_helper{
626 local($word, $_) = @_;
627 my $name = next_argument();
Fred Drake62e43691998-08-10 19:40:44 +0000628 return define_module($word, $name) . $_;
Fred Drake6659c301998-03-03 22:02:19 +0000629}
630
Fred Drake62e43691998-08-10 19:40:44 +0000631sub do_cmd_modindex{ return my_module_index_helper('', @_); }
632sub do_cmd_bimodindex{ return my_module_index_helper('built-in', @_); }
633sub do_cmd_exmodindex{ return my_module_index_helper('extension', @_); }
634sub do_cmd_stmodindex{ return my_module_index_helper('standard', @_); }
Fred Drake6659c301998-03-03 22:02:19 +0000635
Fred Drakeab032151999-05-13 18:36:54 +0000636sub ref_module_index_helper{
Fred Drake37cc0c02000-04-26 18:05:24 +0000637 my($word, $ahref) = @_;
Fred Drakeab032151999-05-13 18:36:54 +0000638 my $str = next_argument();
639 $word = "$word " if $word;
Fred Drakee15956b2000-04-03 04:51:13 +0000640 $str = "<tt class='module'>$str</tt> (${word}module)";
Fred Drakeab032151999-05-13 18:36:54 +0000641 # can't use add_index_entry() since the 2nd arg to gen_index_id() is used;
642 # just inline it all here
643 $str = gen_index_id($str, 'REF');
644 $index{$str} .= $ahref;
645 write_idxfile($ahref, $str);
646}
647
Fred Drake6659c301998-03-03 22:02:19 +0000648# these should be adjusted a bit....
Fred Drakeab032151999-05-13 18:36:54 +0000649define_indexing_macro('refmodindex', 'refbimodindex',
650 'refexmodindex', 'refstmodindex');
651sub idx_cmd_refmodindex{ return ref_module_index_helper('', @_); }
652sub idx_cmd_refbimodindex{ return ref_module_index_helper('built-in', @_); }
653sub idx_cmd_refexmodindex{ return ref_module_index_helper('extension', @_); }
654sub idx_cmd_refstmodindex{ return ref_module_index_helper('standard', @_); }
Fred Drake6659c301998-03-03 22:02:19 +0000655
Fred Drake62e43691998-08-10 19:40:44 +0000656sub do_cmd_nodename{ return do_cmd_label(@_); }
Fred Drake6659c301998-03-03 22:02:19 +0000657
658sub init_myformat{
Fred Drakeafc7ce12001-01-22 17:33:24 +0000659 $anchor_invisible_mark = '&nbsp;';
660 $anchor_invisible_mark2 = '';
Fred Drake6659c301998-03-03 22:02:19 +0000661 $anchor_mark = '';
662 $icons{'anchor_mark'} = '';
Fred Drake6659c301998-03-03 22:02:19 +0000663}
Fred Drake42b31a51998-03-27 05:16:10 +0000664init_myformat();
Fred Drake6659c301998-03-03 22:02:19 +0000665
Fred Drakeab032151999-05-13 18:36:54 +0000666# Create an index entry, but include the string in the target anchor
Fred Drake6659c301998-03-03 22:02:19 +0000667# instead of the dummy filler.
668#
669sub make_str_index_entry{
Fred Drakeccc62721999-01-05 22:16:29 +0000670 my($str) = @_;
671 my($name,$aname,$ahref) = new_link_info();
Fred Drake42b31a51998-03-27 05:16:10 +0000672 add_index_entry($str, $ahref);
Fred Drake62e43691998-08-10 19:40:44 +0000673 return "$aname$str</a>";
Fred Drake6659c301998-03-03 22:02:19 +0000674}
675
Fred Drakee15956b2000-04-03 04:51:13 +0000676$REFCOUNTS_LOADED = 0;
677
678sub load_refcounts{
679 $REFCOUNTS_LOADED = 1;
680
Fred Drakee15956b2000-04-03 04:51:13 +0000681 my $myname, $mydir, $myext;
682 ($myname, $mydir, $myext) = fileparse(__FILE__, '\..*');
683 chop $mydir; # remove trailing '/'
684 ($myname, $mydir, $myext) = fileparse($mydir, '\..*');
685 chop $mydir; # remove trailing '/'
686 $mydir = getcwd() . "$dd$mydir"
687 unless $mydir =~ s|^/|/|;
688 local $_;
689 my $filename = "$mydir${dd}api${dd}refcounts.dat";
690 open(REFCOUNT_FILE, "<$filename") || die "\n$!\n";
691 print "[loading API refcount data]";
692 while (<REFCOUNT_FILE>) {
Fred Drakec2578c52000-04-10 18:26:45 +0000693 if (/([a-zA-Z0-9_]+):PyObject\*:([a-zA-Z0-9_]*):(0|[-+]1|null):(.*)$/) {
Fred Drakee15956b2000-04-03 04:51:13 +0000694 my($func, $param, $count, $comment) = ($1, $2, $3, $4);
695 #print "\n$func($param) --> $count";
696 $REFCOUNTS{"$func:$param"} = $count;
697 }
698 }
699}
700
701sub get_refcount{
702 my ($func, $param) = @_;
703 load_refcounts()
704 unless $REFCOUNTS_LOADED;
705 return $REFCOUNTS{"$func:$param"};
706}
707
Fred Drake6659c301998-03-03 22:02:19 +0000708sub do_env_cfuncdesc{
709 local($_) = @_;
Fred Drake08932051998-04-17 02:15:42 +0000710 my $return_type = next_argument();
Fred Drakeccc62721999-01-05 22:16:29 +0000711 my $function_name = next_argument();
Fred Drake08932051998-04-17 02:15:42 +0000712 my $arg_list = next_argument();
Fred Drakee15956b2000-04-03 04:51:13 +0000713 my $idx = make_str_index_entry(
714 "<tt class='cfunction'>$function_name()</tt>" . get_indexsubitem());
Fred Drake08932051998-04-17 02:15:42 +0000715 $idx =~ s/ \(.*\)//;
Fred Drake241551c2000-08-11 20:04:19 +0000716 $idx =~ s/\(\)//; # ???? - why both of these?
Fred Drakee15956b2000-04-03 04:51:13 +0000717 my $result_rc = get_refcount($function_name, '');
718 my $rcinfo = '';
719 if ($result_rc eq '+1') {
Fred Drake241551c2000-08-11 20:04:19 +0000720 $rcinfo = 'New reference';
Fred Drakee15956b2000-04-03 04:51:13 +0000721 }
722 elsif ($result_rc eq '0') {
Fred Drake241551c2000-08-11 20:04:19 +0000723 $rcinfo = 'Borrowed reference';
Fred Drakee15956b2000-04-03 04:51:13 +0000724 }
Fred Drakec2578c52000-04-10 18:26:45 +0000725 elsif ($result_rc eq 'null') {
Fred Drake241551c2000-08-11 20:04:19 +0000726 $rcinfo = 'Always <tt class="constant">NULL</tt>';
Fred Drakec2578c52000-04-10 18:26:45 +0000727 }
Fred Drakee15956b2000-04-03 04:51:13 +0000728 if ($rcinfo ne '') {
Fred Drake241551c2000-08-11 20:04:19 +0000729 $rcinfo = ( "\n<div class=\"refcount-info\">"
730 . "\n <span class=\"label\">Return value:</span>"
731 . "\n <span class=\"value\">$rcinfo.</span>"
732 . "\n</div>");
Fred Drakee15956b2000-04-03 04:51:13 +0000733 }
Fred Drakec612a142001-03-29 18:24:08 +0000734 return "<dl><dt>$return_type <b>$idx</b>(<var>$arg_list</var>)\n<dd>"
Fred Drakee15956b2000-04-03 04:51:13 +0000735 . $rcinfo
Fred Drake62e43691998-08-10 19:40:44 +0000736 . $_
737 . '</dl>';
Fred Drake6659c301998-03-03 22:02:19 +0000738}
739
Fred Drakee15956b2000-04-03 04:51:13 +0000740sub do_env_csimplemacrodesc{
741 local($_) = @_;
742 my $name = next_argument();
743 my $idx = make_str_index_entry("<tt class='macro'>$name</tt>");
744 return "<dl><dt><b>$idx</b>\n<dd>"
745 . $_
746 . '</dl>'
747}
748
Fred Drake6659c301998-03-03 22:02:19 +0000749sub do_env_ctypedesc{
750 local($_) = @_;
Fred Drakee15956b2000-04-03 04:51:13 +0000751 my $index_name = next_optional_argument();
Fred Drakeccc62721999-01-05 22:16:29 +0000752 my $type_name = next_argument();
Fred Drakee15956b2000-04-03 04:51:13 +0000753 $index_name = $type_name
754 unless $index_name;
755 my($name,$aname,$ahref) = new_link_info();
756 add_index_entry("<tt class='ctype'>$index_name</tt> (C type)", $ahref);
757 return "<dl><dt><b><tt class='ctype'>$aname$type_name</a></tt></b>\n<dd>"
Fred Drake62e43691998-08-10 19:40:44 +0000758 . $_
759 . '</dl>'
Fred Drake6659c301998-03-03 22:02:19 +0000760}
761
762sub do_env_cvardesc{
763 local($_) = @_;
Fred Drake08932051998-04-17 02:15:42 +0000764 my $var_type = next_argument();
Fred Drakeccc62721999-01-05 22:16:29 +0000765 my $var_name = next_argument();
Fred Drakee15956b2000-04-03 04:51:13 +0000766 my $idx = make_str_index_entry("<tt class='cdata'>$var_name</tt>"
Fred Drake90fdda51999-02-16 20:27:42 +0000767 . get_indexsubitem());
Fred Drake08932051998-04-17 02:15:42 +0000768 $idx =~ s/ \(.*\)//;
Fred Drake62e43691998-08-10 19:40:44 +0000769 return "<dl><dt>$var_type <b>$idx</b>\n"
770 . '<dd>'
771 . $_
772 . '</dl>';
Fred Drake6659c301998-03-03 22:02:19 +0000773}
774
Fred Drake3cdb89d2000-09-14 20:17:23 +0000775sub convert_args($){
776 local($IN_DESC_HANDLER) = 1;
777 local($_) = @_;
778 return translate_commands($_);
779}
780
Fred Drake6659c301998-03-03 22:02:19 +0000781sub do_env_funcdesc{
782 local($_) = @_;
Fred Drake08932051998-04-17 02:15:42 +0000783 my $function_name = next_argument();
Fred Drake3cdb89d2000-09-14 20:17:23 +0000784 my $arg_list = convert_args(next_argument());
Fred Drakee15956b2000-04-03 04:51:13 +0000785 my $idx = make_str_index_entry("<tt class='function'>$function_name()</tt>"
Fred Drake08932051998-04-17 02:15:42 +0000786 . get_indexsubitem());
787 $idx =~ s/ \(.*\)//;
Fred Drakeccc62721999-01-05 22:16:29 +0000788 $idx =~ s/\(\)<\/tt>/<\/tt>/;
Fred Drakec612a142001-03-29 18:24:08 +0000789 return "<dl><dt><b>$idx</b>(<var>$arg_list</var>)\n<dd>" . $_ . '</dl>';
Fred Drake6659c301998-03-03 22:02:19 +0000790}
791
792sub do_env_funcdescni{
793 local($_) = @_;
Fred Drake08932051998-04-17 02:15:42 +0000794 my $function_name = next_argument();
Fred Drake3cdb89d2000-09-14 20:17:23 +0000795 my $arg_list = convert_args(next_argument());
Fred Drakee15956b2000-04-03 04:51:13 +0000796 return "<dl><dt><b><tt class='function'>$function_name</tt></b>"
Fred Drakec612a142001-03-29 18:24:08 +0000797 . "(<var>$arg_list</var>)\n"
Fred Drake90fdda51999-02-16 20:27:42 +0000798 . '<dd>'
799 . $_
800 . '</dl>';
Fred Drake6659c301998-03-03 22:02:19 +0000801}
802
803sub do_cmd_funcline{
804 local($_) = @_;
Fred Drake08932051998-04-17 02:15:42 +0000805 my $function_name = next_argument();
Fred Drake3cdb89d2000-09-14 20:17:23 +0000806 my $arg_list = convert_args(next_argument());
Fred Drakee15956b2000-04-03 04:51:13 +0000807 my $prefix = "<tt class='function'>$function_name()</tt>";
Fred Drakeca675e41999-04-21 15:58:58 +0000808 my $idx = make_str_index_entry($prefix . get_indexsubitem());
809 $prefix =~ s/\(\)//;
810
Fred Drakec612a142001-03-29 18:24:08 +0000811 return "<dt><b>$prefix</b>(<var>$arg_list</var>)\n<dd>" . $_;
Fred Drake6659c301998-03-03 22:02:19 +0000812}
813
Fred Drake6b3fb781999-07-12 16:50:09 +0000814sub do_cmd_funclineni{
815 local($_) = @_;
816 my $function_name = next_argument();
Fred Drake3cdb89d2000-09-14 20:17:23 +0000817 my $arg_list = convert_args(next_argument());
Fred Drakee15956b2000-04-03 04:51:13 +0000818 my $prefix = "<tt class='function'>$function_name</tt>";
Fred Drake6b3fb781999-07-12 16:50:09 +0000819
Fred Drakec612a142001-03-29 18:24:08 +0000820 return "<dt><b>$prefix</b>(<var>$arg_list</var>)\n<dd>" . $_;
Fred Drake6b3fb781999-07-12 16:50:09 +0000821}
822
Fred Drake6659c301998-03-03 22:02:19 +0000823# Change this flag to index the opcode entries. I don't think it's very
824# useful to index them, since they're only presented to describe the dis
825# module.
826#
827$INDEX_OPCODES = 0;
828
829sub do_env_opcodedesc{
830 local($_) = @_;
Fred Drake08932051998-04-17 02:15:42 +0000831 my $opcode_name = next_argument();
Fred Drakeccc62721999-01-05 22:16:29 +0000832 my $arg_list = next_argument();
Fred Drake08932051998-04-17 02:15:42 +0000833 my $idx;
834 if ($INDEX_OPCODES) {
Fred Drakee15956b2000-04-03 04:51:13 +0000835 $idx = make_str_index_entry("<tt class='opcode'>$opcode_name</tt>"
836 . " (byte code instruction)");
Fred Drake08932051998-04-17 02:15:42 +0000837 $idx =~ s/ \(byte code instruction\)//;
838 }
839 else {
Fred Drakee15956b2000-04-03 04:51:13 +0000840 $idx = "<tt class='opcode'>$opcode_name</tt>";
Fred Drake08932051998-04-17 02:15:42 +0000841 }
842 my $stuff = "<dl><dt><b>$idx</b>";
Fred Drake6659c301998-03-03 22:02:19 +0000843 if ($arg_list) {
844 $stuff .= "&nbsp;&nbsp;&nbsp;&nbsp;<var>$arg_list</var>";
845 }
Fred Drake62e43691998-08-10 19:40:44 +0000846 return $stuff . "\n<dd>" . $_ . '</dl>';
Fred Drake6659c301998-03-03 22:02:19 +0000847}
848
849sub do_env_datadesc{
850 local($_) = @_;
Fred Drakeccc62721999-01-05 22:16:29 +0000851 my $dataname = next_argument();
852 my $idx = make_str_index_entry("<tt>$dataname</tt>" . get_indexsubitem());
Fred Drake08932051998-04-17 02:15:42 +0000853 $idx =~ s/ \(.*\)//;
Fred Drake62e43691998-08-10 19:40:44 +0000854 return "<dl><dt><b>$idx</b>\n<dd>"
855 . $_
856 . '</dl>';
Fred Drake6659c301998-03-03 22:02:19 +0000857}
858
859sub do_env_datadescni{
860 local($_) = @_;
Fred Drake08932051998-04-17 02:15:42 +0000861 my $idx = next_argument();
862 if (! $STRING_INDEX_TT) {
863 $idx = "<tt>$idx</tt>";
Fred Drake6659c301998-03-03 22:02:19 +0000864 }
Fred Drake62e43691998-08-10 19:40:44 +0000865 return "<dl><dt><b>$idx</b>\n<dd>" . $_ . '</dl>';
Fred Drake6659c301998-03-03 22:02:19 +0000866}
867
868sub do_cmd_dataline{
869 local($_) = @_;
Fred Drakeccc62721999-01-05 22:16:29 +0000870 my $data_name = next_argument();
871 my $idx = make_str_index_entry("<tt>$data_name</tt>" . get_indexsubitem());
Fred Drake6659c301998-03-03 22:02:19 +0000872 $idx =~ s/ \(.*\)//;
Fred Drake62e43691998-08-10 19:40:44 +0000873 return "<dt><b>$idx</b><dd>" . $_;
Fred Drake6659c301998-03-03 22:02:19 +0000874}
875
Fred Drakeadb272c2000-04-10 17:47:14 +0000876sub do_cmd_datalineni{
877 local($_) = @_;
878 my $data_name = next_argument();
879 return "<dt><b><tt>$data_name</tt></b><dd>" . $_;
880}
881
Fred Drake42b31a51998-03-27 05:16:10 +0000882sub do_env_excdesc{
883 local($_) = @_;
Fred Drakeccc62721999-01-05 22:16:29 +0000884 my $excname = next_argument();
Fred Drakee15956b2000-04-03 04:51:13 +0000885 my $idx = make_str_index_entry("<tt class='exception'>$excname</tt>");
Fred Drakeab357ec2001-03-02 18:57:05 +0000886 return "<dl><dt><b>exception $idx</b>\n<dd>" . $_ . '</dl>'
Fred Drake42b31a51998-03-27 05:16:10 +0000887}
888
Fred Drake62e43691998-08-10 19:40:44 +0000889sub do_env_fulllineitems{ return do_env_itemize(@_); }
Fred Drake6659c301998-03-03 22:02:19 +0000890
891
Fred Drake643d76d2000-09-09 06:07:37 +0000892sub handle_classlike_descriptor{
893 local($_, $what) = @_;
Fred Drake08932051998-04-17 02:15:42 +0000894 $THIS_CLASS = next_argument();
Fred Drake3cdb89d2000-09-14 20:17:23 +0000895 my $arg_list = convert_args(next_argument());
Fred Drakeccc62721999-01-05 22:16:29 +0000896 $idx = make_str_index_entry(
Fred Drake643d76d2000-09-09 06:07:37 +0000897 "<tt class='$what'>$THIS_CLASS</tt> ($what in $THIS_MODULE)" );
Fred Drake08932051998-04-17 02:15:42 +0000898 $idx =~ s/ \(.*\)//;
Fred Drakec612a142001-03-29 18:24:08 +0000899 return ("<dl><dt><b>$what $idx</b>(<var>$arg_list</var>)\n<dd>"
Fred Drakeab357ec2001-03-02 18:57:05 +0000900 . $_
901 . '</dl>');
Fred Drakec9a44381998-03-17 06:29:13 +0000902}
903
Fred Drake643d76d2000-09-09 06:07:37 +0000904sub do_env_classdesc{
905 return handle_classlike_descriptor(@_[0], "class");
906}
907
908sub do_env_excclassdesc{
909 return handle_classlike_descriptor(@_[0], "exception");
910}
911
Fred Drake42b31a51998-03-27 05:16:10 +0000912
913sub do_env_methoddesc{
914 local($_) = @_;
Fred Drake08932051998-04-17 02:15:42 +0000915 my $class_name = next_optional_argument();
916 $class_name = $THIS_CLASS
917 unless $class_name;
Fred Drake5a0ca4e1999-01-12 04:16:51 +0000918 my $method = next_argument();
Fred Drake3cdb89d2000-09-14 20:17:23 +0000919 my $arg_list = convert_args(next_argument());
Fred Drake08932051998-04-17 02:15:42 +0000920 my $extra = '';
921 if ($class_name) {
922 $extra = " ($class_name method)";
Fred Drake42b31a51998-03-27 05:16:10 +0000923 }
Fred Drakee15956b2000-04-03 04:51:13 +0000924 my $idx = make_str_index_entry("<tt class='method'>$method()</tt>$extra");
Fred Drake08932051998-04-17 02:15:42 +0000925 $idx =~ s/ \(.*\)//;
926 $idx =~ s/\(\)//;
Fred Drakec612a142001-03-29 18:24:08 +0000927 return "<dl><dt><b>$idx</b>(<var>$arg_list</var>)\n<dd>" . $_ . '</dl>';
Fred Drake42b31a51998-03-27 05:16:10 +0000928}
929
930
Fred Drake7d45f6d1999-01-05 14:39:27 +0000931sub do_cmd_methodline{
932 local($_) = @_;
933 my $class_name = next_optional_argument();
934 $class_name = $THIS_CLASS
935 unless $class_name;
936 my $method = next_argument();
Fred Drake3cdb89d2000-09-14 20:17:23 +0000937 my $arg_list = convert_args(next_argument());
Fred Drake7d45f6d1999-01-05 14:39:27 +0000938 my $extra = '';
939 if ($class_name) {
940 $extra = " ($class_name method)";
941 }
Fred Drakee15956b2000-04-03 04:51:13 +0000942 my $idx = make_str_index_entry("<tt class='method'>$method()</tt>$extra");
Fred Drake7d45f6d1999-01-05 14:39:27 +0000943 $idx =~ s/ \(.*\)//;
944 $idx =~ s/\(\)//;
Fred Drakec612a142001-03-29 18:24:08 +0000945 return "<dt><b>$idx</b>(<var>$arg_list</var>)\n<dd>"
Fred Drake7d45f6d1999-01-05 14:39:27 +0000946 . $_;
947}
948
949
Fred Draked64a40d1998-09-10 18:59:13 +0000950sub do_cmd_methodlineni{
951 local($_) = @_;
952 next_optional_argument();
953 my $method = next_argument();
Fred Drake3cdb89d2000-09-14 20:17:23 +0000954 my $arg_list = convert_args(next_argument());
Fred Drakec612a142001-03-29 18:24:08 +0000955 return "<dt><b>$method</b>(<var>$arg_list</var>)\n<dd>"
Fred Draked64a40d1998-09-10 18:59:13 +0000956 . $_;
957}
958
Fred Drake42b31a51998-03-27 05:16:10 +0000959sub do_env_methoddescni{
960 local($_) = @_;
Fred Drake08932051998-04-17 02:15:42 +0000961 next_optional_argument();
962 my $method = next_argument();
Fred Drake3cdb89d2000-09-14 20:17:23 +0000963 my $arg_list = convert_args(next_argument());
Fred Drakec612a142001-03-29 18:24:08 +0000964 return "<dl><dt><b>$method</b>(<var>$arg_list</var>)\n<dd>"
Fred Drake62e43691998-08-10 19:40:44 +0000965 . $_
966 . '</dl>';
Fred Drake42b31a51998-03-27 05:16:10 +0000967}
968
969
970sub do_env_memberdesc{
971 local($_) = @_;
Fred Drake08932051998-04-17 02:15:42 +0000972 my $class = next_optional_argument();
Fred Drakeccc62721999-01-05 22:16:29 +0000973 my $member = next_argument();
Fred Drake42b31a51998-03-27 05:16:10 +0000974 $class = $THIS_CLASS
975 unless $class;
Fred Drake08932051998-04-17 02:15:42 +0000976 my $extra = '';
Fred Drake085b8121999-04-21 14:00:29 +0000977 $extra = " ($class attribute)"
978 if ($class ne '');
Fred Drakee15956b2000-04-03 04:51:13 +0000979 my $idx = make_str_index_entry("<tt class='member'>$member</tt>$extra");
Fred Drake42b31a51998-03-27 05:16:10 +0000980 $idx =~ s/ \(.*\)//;
981 $idx =~ s/\(\)//;
Fred Drake62e43691998-08-10 19:40:44 +0000982 return "<dl><dt><b>$idx</b>\n<dd>" . $_ . '</dl>';
Fred Drake42b31a51998-03-27 05:16:10 +0000983}
984
985
Fred Drake5ccf3301998-04-17 20:04:09 +0000986sub do_cmd_memberline{
987 local($_) = @_;
988 my $class = next_optional_argument();
Fred Drakeccc62721999-01-05 22:16:29 +0000989 my $member = next_argument();
Fred Drake5ccf3301998-04-17 20:04:09 +0000990 $class = $THIS_CLASS
991 unless $class;
992 my $extra = '';
Fred Drake085b8121999-04-21 14:00:29 +0000993 $extra = " ($class attribute)"
994 if ($class ne '');
Fred Drakee15956b2000-04-03 04:51:13 +0000995 my $idx = make_str_index_entry("<tt class='member'>$member</tt>$extra");
Fred Drake5ccf3301998-04-17 20:04:09 +0000996 $idx =~ s/ \(.*\)//;
997 $idx =~ s/\(\)//;
Fred Drake62e43691998-08-10 19:40:44 +0000998 return "<dt><b>$idx</b><dd>" . $_;
Fred Drake5ccf3301998-04-17 20:04:09 +0000999}
1000
Fred Drake42b31a51998-03-27 05:16:10 +00001001sub do_env_memberdescni{
1002 local($_) = @_;
Fred Drake08932051998-04-17 02:15:42 +00001003 next_optional_argument();
1004 my $member = next_argument();
Fred Drakee15956b2000-04-03 04:51:13 +00001005 return "<dl><dt><b><tt class='member'>$member</tt></b>\n<dd>"
1006 . $_
1007 . '</dl>';
Fred Drake42b31a51998-03-27 05:16:10 +00001008}
1009
1010
Fred Drake5ccf3301998-04-17 20:04:09 +00001011sub do_cmd_memberlineni{
1012 local($_) = @_;
1013 next_optional_argument();
1014 my $member = next_argument();
Fred Drakee15956b2000-04-03 04:51:13 +00001015 return "<dt><b><tt class='member'>$member</tt></b><dd>" . $_;
Fred Drake5ccf3301998-04-17 20:04:09 +00001016}
1017
Fred Drakee15956b2000-04-03 04:51:13 +00001018@col_aligns = ('<td>', '<td>', '<td>', '<td>');
Fred Drake6659c301998-03-03 22:02:19 +00001019
Fred Drakef74e5b71999-04-28 14:58:49 +00001020sub fix_font{
1021 # do a little magic on a font name to get the right behavior in the first
1022 # column of the output table
1023 my $font = @_[0];
1024 if ($font eq 'textrm') {
1025 $font = '';
1026 }
1027 elsif ($font eq 'file' || $font eq 'filenq') {
Fred Drakee15956b2000-04-03 04:51:13 +00001028 $font = 'tt class="file"';
1029 }
1030 elsif ($font eq 'member') {
1031 $font = 'tt class="member"';
Fred Drakef74e5b71999-04-28 14:58:49 +00001032 }
Fred Drakee463f8e2000-11-30 07:17:27 +00001033 elsif ($font eq 'class') {
1034 $font = 'tt class="class"';
1035 }
Fred Drake7388f732000-06-28 21:06:08 +00001036 elsif ($font eq 'constant') {
1037 $font = 'tt class="constant"';
1038 }
Fred Drakecb0fc9c2000-08-09 13:45:04 +00001039 elsif ($font eq 'kbd') {
1040 $font = 'kbd';
1041 }
Fred Draked04592a2000-10-25 16:15:13 +00001042 elsif ($font eq 'programopt') {
1043 $font = 'b';
1044 }
Fred Drakeafc7ce12001-01-22 17:33:24 +00001045 elsif ($font eq 'exception') {
1046 $font = 'tt class="exception"';
1047 }
Fred Drakef74e5b71999-04-28 14:58:49 +00001048 return $font;
1049}
1050
Fred Drakee15956b2000-04-03 04:51:13 +00001051sub figure_column_alignment{
1052 my $a = @_[0];
1053 my $mark = substr($a, 0, 1);
1054 my $r = '';
1055 if ($mark eq 'c')
1056 { $r = ' align="center"'; }
1057 elsif ($mark eq 'r')
1058 { $r = ' align="right"'; }
1059 elsif ($mark eq 'l')
1060 { $r = ' align="left"'; }
1061 elsif ($mark eq 'p')
1062 { $r = ' align="left"'; }
1063 return $r;
1064}
1065
Fred Drake6659c301998-03-03 22:02:19 +00001066sub setup_column_alignments{
1067 local($_) = @_;
Fred Drakee15956b2000-04-03 04:51:13 +00001068 my($s1,$s2,$s3,$s4) = split(/[|]/,$_);
1069 my $a1 = figure_column_alignment($s1);
1070 my $a2 = figure_column_alignment($s2);
1071 my $a3 = figure_column_alignment($s3);
1072 my $a4 = figure_column_alignment($s4);
1073 $col_aligns[0] = "<td$a1 valign=\"baseline\">";
1074 $col_aligns[1] = "<td$a2>";
1075 $col_aligns[2] = "<td$a3>";
1076 $col_aligns[3] = "<td$a4>";
Fred Drake79189b51999-04-28 13:54:30 +00001077 # return the aligned header start tags
Fred Drakee15956b2000-04-03 04:51:13 +00001078 return ("<th$a1>", "<th$a2>", "<th$a3>", "<th$a4>");
1079}
1080
1081sub get_table_col1_fonts{
1082 my $font = $globals{'lineifont'};
1083 my ($sfont,$efont) = ('', '');
1084 if ($font) {
1085 $sfont = "<$font>";
1086 $efont = "</$font>";
1087 $efont =~ s/ .*>/>/;
1088 }
Fred Drakee463f8e2000-11-30 07:17:27 +00001089 return ($sfont, $efont);
Fred Drake6659c301998-03-03 22:02:19 +00001090}
1091
1092sub do_env_tableii{
1093 local($_) = @_;
Fred Drakea0f4c941998-07-24 22:16:04 +00001094 my($th1,$th2,$th3,$th4) = setup_column_alignments(next_argument());
Fred Drakef74e5b71999-04-28 14:58:49 +00001095 my $font = fix_font(next_argument());
Fred Drake08932051998-04-17 02:15:42 +00001096 my $h1 = next_argument();
1097 my $h2 = next_argument();
Fred Drakef74e5b71999-04-28 14:58:49 +00001098 s/[\s\n]+//;
Fred Drake08932051998-04-17 02:15:42 +00001099 $globals{'lineifont'} = $font;
Fred Drakee15956b2000-04-03 04:51:13 +00001100 my $a1 = $col_aligns[0];
1101 my $a2 = $col_aligns[1];
1102 s/\\lineii</\\lineii[$a1|$a2]</g;
1103 return '<table border align="center" style="border-collapse: collapse">'
Fred Drake351960d2000-10-26 20:14:58 +00001104 . "\n <thead>"
1105 . "\n <tr class=\"tableheader\">"
Fred Drakee15956b2000-04-03 04:51:13 +00001106 . "\n $th1<b>$h1</b>\&nbsp;</th>"
1107 . "\n $th2<b>$h2</b>\&nbsp;</th>"
Fred Drake351960d2000-10-26 20:14:58 +00001108 . "\n </tr>"
Fred Drakef74e5b71999-04-28 14:58:49 +00001109 . "\n </thead>"
Fred Drakee15956b2000-04-03 04:51:13 +00001110 . "\n <tbody valign='baseline'>"
Fred Drake351960d2000-10-26 20:14:58 +00001111 . $_
Fred Drakef74e5b71999-04-28 14:58:49 +00001112 . "\n </tbody>"
1113 . "\n</table>";
Fred Drake6659c301998-03-03 22:02:19 +00001114}
1115
Fred Drakeda72b932000-09-21 15:58:02 +00001116sub do_env_longtableii{
1117 return do_env_tableii(@_);
1118}
1119
Fred Drake6659c301998-03-03 22:02:19 +00001120sub do_cmd_lineii{
1121 local($_) = @_;
Fred Drakee15956b2000-04-03 04:51:13 +00001122 my $aligns = next_optional_argument();
Fred Drake08932051998-04-17 02:15:42 +00001123 my $c1 = next_argument();
1124 my $c2 = next_argument();
Fred Drakef74e5b71999-04-28 14:58:49 +00001125 s/[\s\n]+//;
Fred Drakee463f8e2000-11-30 07:17:27 +00001126 my($sfont,$efont) = get_table_col1_fonts();
Fred Drakee15956b2000-04-03 04:51:13 +00001127 $c2 = '&nbsp;' if ($c2 eq '');
1128 my($c1align,$c2align) = split('\|', $aligns);
1129 my $padding = '';
Fred Drakee463f8e2000-11-30 07:17:27 +00001130 if ($c1align =~ /align="right"/ || $c1 eq '') {
Fred Drakee15956b2000-04-03 04:51:13 +00001131 $padding = '&nbsp;';
Fred Drake58b2bfd1998-04-02 20:14:04 +00001132 }
Fred Drakee15956b2000-04-03 04:51:13 +00001133 return "\n <tr>$c1align$sfont$c1$efont$padding</td>\n"
1134 . " $c2align$c2</td>"
Fred Drake62e43691998-08-10 19:40:44 +00001135 . $_;
Fred Drake6659c301998-03-03 22:02:19 +00001136}
1137
1138sub do_env_tableiii{
1139 local($_) = @_;
Fred Drakea0f4c941998-07-24 22:16:04 +00001140 my($th1,$th2,$th3,$th4) = setup_column_alignments(next_argument());
Fred Drakef74e5b71999-04-28 14:58:49 +00001141 my $font = fix_font(next_argument());
Fred Drake08932051998-04-17 02:15:42 +00001142 my $h1 = next_argument();
1143 my $h2 = next_argument();
1144 my $h3 = next_argument();
Fred Drakef74e5b71999-04-28 14:58:49 +00001145 s/[\s\n]+//;
Fred Drake08932051998-04-17 02:15:42 +00001146 $globals{'lineifont'} = $font;
Fred Drakee15956b2000-04-03 04:51:13 +00001147 my $a1 = $col_aligns[0];
1148 my $a2 = $col_aligns[1];
1149 my $a3 = $col_aligns[2];
1150 s/\\lineiii</\\lineiii[$a1|$a2|$a3]</g;
1151 return '<table border align="center" style="border-collapse: collapse">'
Fred Drake351960d2000-10-26 20:14:58 +00001152 . "\n <thead>"
1153 . "\n <tr class=\"tableheader\">"
Fred Drakee15956b2000-04-03 04:51:13 +00001154 . "\n $th1<b>$h1</b>\&nbsp;</th>"
1155 . "\n $th2<b>$h2</b>\&nbsp;</th>"
1156 . "\n $th3<b>$h3</b>\&nbsp;</th>"
Fred Drake351960d2000-10-26 20:14:58 +00001157 . "\n </tr>"
Fred Drakef74e5b71999-04-28 14:58:49 +00001158 . "\n </thead>"
Fred Drakee15956b2000-04-03 04:51:13 +00001159 . "\n <tbody valign='baseline'>"
Fred Drake62e43691998-08-10 19:40:44 +00001160 . $_
Fred Drakef74e5b71999-04-28 14:58:49 +00001161 . "\n </tbody>"
1162 . "\n</table>";
Fred Drake6659c301998-03-03 22:02:19 +00001163}
1164
Fred Drakeda72b932000-09-21 15:58:02 +00001165sub do_env_longtableiii{
1166 return do_env_tableiii(@_);
1167}
1168
Fred Drake6659c301998-03-03 22:02:19 +00001169sub do_cmd_lineiii{
1170 local($_) = @_;
Fred Drakee15956b2000-04-03 04:51:13 +00001171 my $aligns = next_optional_argument();
Fred Drake08932051998-04-17 02:15:42 +00001172 my $c1 = next_argument();
1173 my $c2 = next_argument();
1174 my $c3 = next_argument();
Fred Drakef74e5b71999-04-28 14:58:49 +00001175 s/[\s\n]+//;
Fred Drakee463f8e2000-11-30 07:17:27 +00001176 my($sfont,$efont) = get_table_col1_fonts();
Fred Drakee15956b2000-04-03 04:51:13 +00001177 $c3 = '&nbsp;' if ($c3 eq '');
1178 my($c1align,$c2align,$c3align) = split('\|', $aligns);
1179 my $padding = '';
Fred Drakee463f8e2000-11-30 07:17:27 +00001180 if ($c1align =~ /align="right"/ || $c1 eq '') {
Fred Drakee15956b2000-04-03 04:51:13 +00001181 $padding = '&nbsp;';
Fred Drake58b2bfd1998-04-02 20:14:04 +00001182 }
Fred Drakee15956b2000-04-03 04:51:13 +00001183 return "\n <tr>$c1align$sfont$c1$efont$padding</td>\n"
Fred Drakef74e5b71999-04-28 14:58:49 +00001184 . " $c2align$c2</td>\n"
Fred Drakee15956b2000-04-03 04:51:13 +00001185 . " $c3align$c3</td>"
Fred Drake62e43691998-08-10 19:40:44 +00001186 . $_;
Fred Drake6659c301998-03-03 22:02:19 +00001187}
1188
Fred Drakea0f4c941998-07-24 22:16:04 +00001189sub do_env_tableiv{
1190 local($_) = @_;
1191 my($th1,$th2,$th3,$th4) = setup_column_alignments(next_argument());
Fred Drakef74e5b71999-04-28 14:58:49 +00001192 my $font = fix_font(next_argument());
Fred Drakea0f4c941998-07-24 22:16:04 +00001193 my $h1 = next_argument();
1194 my $h2 = next_argument();
1195 my $h3 = next_argument();
1196 my $h4 = next_argument();
Fred Drakef74e5b71999-04-28 14:58:49 +00001197 s/[\s\n]+//;
Fred Drakea0f4c941998-07-24 22:16:04 +00001198 $globals{'lineifont'} = $font;
Fred Drakee15956b2000-04-03 04:51:13 +00001199 my $a1 = $col_aligns[0];
1200 my $a2 = $col_aligns[1];
1201 my $a3 = $col_aligns[2];
1202 my $a4 = $col_aligns[3];
1203 s/\\lineiv</\\lineiv[$a1|$a2|$a3|$a4]</g;
1204 return '<table border align="center" style="border-collapse: collapse">'
Fred Drake351960d2000-10-26 20:14:58 +00001205 . "\n <thead>"
1206 . "\n <tr class=\"tableheader\">"
Fred Drakee15956b2000-04-03 04:51:13 +00001207 . "\n $th1<b>$h1</b>\&nbsp;</th>"
1208 . "\n $th2<b>$h2</b>\&nbsp;</th>"
1209 . "\n $th3<b>$h3</b>\&nbsp;</th>"
1210 . "\n $th4<b>$h4</b>\&nbsp;</th>"
Fred Drake351960d2000-10-26 20:14:58 +00001211 . "\n </tr>"
Fred Drakef74e5b71999-04-28 14:58:49 +00001212 . "\n </thead>"
Fred Drakee15956b2000-04-03 04:51:13 +00001213 . "\n <tbody valign='baseline'>"
Fred Drake62e43691998-08-10 19:40:44 +00001214 . $_
Fred Drakef74e5b71999-04-28 14:58:49 +00001215 . "\n </tbody>"
1216 . "\n</table>";
Fred Drake6659c301998-03-03 22:02:19 +00001217}
1218
Fred Drakeda72b932000-09-21 15:58:02 +00001219sub do_env_longtableiv{
1220 return do_env_tableiv(@_);
1221}
1222
Fred Drakea0f4c941998-07-24 22:16:04 +00001223sub do_cmd_lineiv{
Fred Drake6659c301998-03-03 22:02:19 +00001224 local($_) = @_;
Fred Drakee15956b2000-04-03 04:51:13 +00001225 my $aligns = next_optional_argument();
Fred Drakea0f4c941998-07-24 22:16:04 +00001226 my $c1 = next_argument();
1227 my $c2 = next_argument();
1228 my $c3 = next_argument();
1229 my $c4 = next_argument();
Fred Drakef74e5b71999-04-28 14:58:49 +00001230 s/[\s\n]+//;
Fred Drakee463f8e2000-11-30 07:17:27 +00001231 my($sfont,$efont) = get_table_col1_fonts();
Fred Drakee15956b2000-04-03 04:51:13 +00001232 $c4 = '&nbsp;' if ($c4 eq '');
1233 my($c1align,$c2align,$c3align,$c4align) = split('\|', $aligns);
1234 my $padding = '';
Fred Drakee463f8e2000-11-30 07:17:27 +00001235 if ($c1align =~ /align="right"/ || $c1 eq '') {
Fred Drakee15956b2000-04-03 04:51:13 +00001236 $padding = '&nbsp;';
Fred Drakea0f4c941998-07-24 22:16:04 +00001237 }
Fred Drakee15956b2000-04-03 04:51:13 +00001238 return "\n <tr>$c1align$sfont$c1$efont$padding</td>\n"
Fred Drakef74e5b71999-04-28 14:58:49 +00001239 . " $c2align$c2</td>\n"
1240 . " $c3align$c3</td>\n"
Fred Drakee15956b2000-04-03 04:51:13 +00001241 . " $c4align$c4</td>"
Fred Drake62e43691998-08-10 19:40:44 +00001242 . $_;
Fred Drake6659c301998-03-03 22:02:19 +00001243}
1244
Fred Drake3be20742000-08-31 06:22:54 +00001245
1246# These can be used to control the title page appearance;
1247# they need a little bit of documentation.
1248#
1249# If $TITLE_PAGE_GRAPHIC is set, it should be the name of a file in the
1250# $ICONSERVER directory, or include path information (other than "./"). The
1251# default image type will be assumed if an extension is not provided.
1252#
1253# If specified, the "title page" will contain two colums: one containing the
1254# title/author/etc., and the other containing the graphic. Use the other
1255# four variables listed here to control specific details of the layout; all
1256# are optional.
1257#
1258# $TITLE_PAGE_GRAPHIC = "my-company-logo";
1259# $TITLE_PAGE_GRAPHIC_COLWIDTH = "30%";
1260# $TITLE_PAGE_GRAPHIC_WIDTH = 150;
1261# $TITLE_PAGE_GRAPHIC_HEIGHT = 150;
1262# $TITLE_PAGE_GRAPHIC_ON_RIGHT = 0;
1263
1264sub make_my_titlepage() {
1265 my $the_title = "";
Fred Drake6659c301998-03-03 22:02:19 +00001266 if ($t_title) {
Fred Drake90fdda51999-02-16 20:27:42 +00001267 $the_title .= "\n<h1>$t_title</h1>";
Fred Drake3be20742000-08-31 06:22:54 +00001268 }
1269 else {
1270 write_warnings("\nThis document has no title.");
1271 }
Fred Drake6659c301998-03-03 22:02:19 +00001272 if ($t_author) {
1273 if ($t_authorURL) {
Fred Drake08932051998-04-17 02:15:42 +00001274 my $href = translate_commands($t_authorURL);
Fred Drake2d1f81e1999-02-09 16:03:31 +00001275 $href = make_named_href('author', $href,
1276 "<b><font size='+2'>$t_author</font></b>");
Fred Drakec9a44381998-03-17 06:29:13 +00001277 $the_title .= "\n<p>$href</p>";
Fred Drake3be20742000-08-31 06:22:54 +00001278 }
1279 else {
Fred Drake2d1f81e1999-02-09 16:03:31 +00001280 $the_title .= ("\n<p><b><font size='+2'>$t_author</font></b></p>");
Fred Drake6659c301998-03-03 22:02:19 +00001281 }
Fred Drake3be20742000-08-31 06:22:54 +00001282 }
1283 else {
1284 write_warnings("\nThere is no author for this document.");
1285 }
Fred Drake6659c301998-03-03 22:02:19 +00001286 if ($t_institute) {
Fred Drake3be20742000-08-31 06:22:54 +00001287 $the_title .= "\n<p>$t_institute</p>";
1288 }
Fred Draked07868a1998-05-14 21:00:28 +00001289 if ($DEVELOPER_ADDRESS) {
Fred Drake3be20742000-08-31 06:22:54 +00001290 $the_title .= "\n<p>$DEVELOPER_ADDRESS</p>";
1291 }
Fred Drake6659c301998-03-03 22:02:19 +00001292 if ($t_affil) {
Fred Drake3be20742000-08-31 06:22:54 +00001293 $the_title .= "\n<p><i>$t_affil</i></p>";
1294 }
Fred Drake6659c301998-03-03 22:02:19 +00001295 if ($t_date) {
Fred Drakede77bc52000-12-14 18:36:12 +00001296 $the_title .= "\n<p>";
Fred Draked04592a2000-10-25 16:15:13 +00001297 if ($PACKAGE_VERSION) {
Fred Drakede77bc52000-12-14 18:36:12 +00001298 $the_title .= "<strong>Release $PACKAGE_VERSION</strong><br>\n";
Fred Drake3be20742000-08-31 06:22:54 +00001299 }
Fred Drakede77bc52000-12-14 18:36:12 +00001300 $the_title .= "<strong>$t_date</strong></p>"
Fred Drake6659c301998-03-03 22:02:19 +00001301 }
1302 if ($t_address) {
Fred Drakec9a44381998-03-17 06:29:13 +00001303 $the_title .= "\n<p>$t_address</p>";
Fred Drake3be20742000-08-31 06:22:54 +00001304 }
1305 else {
1306 $the_title .= "\n<p>";
1307 }
Fred Drake6659c301998-03-03 22:02:19 +00001308 if ($t_email) {
Fred Drakec9a44381998-03-17 06:29:13 +00001309 $the_title .= "\n<p>$t_email</p>";
Fred Drake3be20742000-08-31 06:22:54 +00001310 }
1311 return $the_title;
1312}
1313
Fred Drake3be20742000-08-31 06:22:54 +00001314sub make_my_titlegraphic() {
Fred Drake7a40c072000-10-02 14:43:38 +00001315 my $filename = make_icon_filename($TITLE_PAGE_GRAPHIC);
Fred Drake3be20742000-08-31 06:22:54 +00001316 my $graphic = "<td class=\"titlegraphic\"";
1317 $graphic .= " width=\"$TITLE_PAGE_GRAPHIC_COLWIDTH\""
1318 if ($TITLE_PAGE_GRAPHIC_COLWIDTH);
1319 $graphic .= "><img";
1320 $graphic .= " width=\"$TITLE_PAGE_GRAPHIC_WIDTH\""
1321 if ($TITLE_PAGE_GRAPHIC_WIDTH);
1322 $graphic .= " height=\"$TITLE_PAGE_GRAPHIC_HEIGHT\""
1323 if ($TITLE_PAGE_GRAPHIC_HEIGHT);
Fred Drake5f84c9b2000-10-03 06:05:25 +00001324 $graphic .= "\n src=\"$filename\"></td>\n";
Fred Drake3be20742000-08-31 06:22:54 +00001325 return $graphic;
1326}
1327
1328sub do_cmd_maketitle {
1329 local($_) = @_;
1330 my $the_title = "\n<div class=\"titlepage\">";
1331 if ($TITLE_PAGE_GRAPHIC) {
1332 if ($TITLE_PAGE_GRAPHIC_ON_RIGHT) {
1333 $the_title .= ("\n<table border=\"0\" width=\"100%\">"
1334 . "<tr align=\"right\">\n<td>"
1335 . make_my_titlepage()
1336 . "</td>\n"
1337 . make_my_titlegraphic()
1338 . "</tr>\n</table>");
1339 }
1340 else {
1341 $the_title .= ("\n<table border=\"0\" width=\"100%\"><tr>\n"
1342 . make_my_titlegraphic()
1343 . "<td>"
1344 . make_my_titlepage()
1345 . "</td></tr>\n</table>");
1346 }
1347 }
1348 else {
1349 $the_title .= ("\n<center>"
1350 . make_my_titlepage()
1351 . "\n</center>");
1352 }
1353 $the_title .= "\n</div>";
1354 return $the_title . $_;
Fred Drake90fdda51999-02-16 20:27:42 +00001355 $the_title .= "\n</center></div>";
Fred Drake62e43691998-08-10 19:40:44 +00001356 return $the_title . $_ ;
Fred Drake6659c301998-03-03 22:02:19 +00001357}
1358
1359
Fred Drake885215c1998-05-20 21:32:09 +00001360#
Fred Drakea0f4c941998-07-24 22:16:04 +00001361# Module synopsis support
1362#
1363
1364require SynopsisTable;
1365
Fred Drakef7685d71998-07-25 03:31:46 +00001366sub get_chapter_id(){
1367 my $id = do_cmd_thechapter('');
Fred Drake45f26011998-08-04 22:07:18 +00001368 $id =~ s/<SPAN CLASS="arabic">(\d+)<\/SPAN>/\1/;
1369 $id =~ s/\.//;
Fred Drakef7685d71998-07-25 03:31:46 +00001370 return $id;
Fred Drakea0f4c941998-07-24 22:16:04 +00001371}
1372
Fred Drake643d76d2000-09-09 06:07:37 +00001373# 'chapter' => 'SynopsisTable instance'
1374%ModuleSynopses = ();
Fred Drakef7685d71998-07-25 03:31:46 +00001375
1376sub get_synopsis_table($){
1377 my($chap) = @_;
Fred Drakef7685d71998-07-25 03:31:46 +00001378 my $key;
1379 foreach $key (keys %ModuleSynopses) {
1380 if ($key eq $chap) {
1381 return $ModuleSynopses{$chap};
1382 }
Fred Drakea0f4c941998-07-24 22:16:04 +00001383 }
Fred Drake643d76d2000-09-09 06:07:37 +00001384 my $st = SynopsisTable->new();
Fred Drakef7685d71998-07-25 03:31:46 +00001385 $ModuleSynopses{$chap} = $st;
Fred Drakea0f4c941998-07-24 22:16:04 +00001386 return $st;
1387}
1388
Fred Drake62e43691998-08-10 19:40:44 +00001389sub do_cmd_moduleauthor{
1390 local($_) = @_;
1391 next_argument();
1392 next_argument();
1393 return $_;
1394}
1395
1396sub do_cmd_sectionauthor{
1397 local($_) = @_;
1398 next_argument();
1399 next_argument();
1400 return $_;
1401}
1402
Fred Drakea0f4c941998-07-24 22:16:04 +00001403sub do_cmd_declaremodule{
1404 local($_) = @_;
1405 my $key = next_optional_argument();
1406 my $type = next_argument();
1407 my $name = next_argument();
1408 my $st = get_synopsis_table(get_chapter_id());
1409 #
1410 $key = $name unless $key;
1411 $type = 'built-in' if $type eq 'builtin';
1412 $st->declare($name, $key, $type);
1413 define_module($type, $name);
Fred Drake62e43691998-08-10 19:40:44 +00001414 return anchor_label("module-$key",$CURRENT_FILE,$_)
Fred Drakea0f4c941998-07-24 22:16:04 +00001415}
1416
1417sub do_cmd_modulesynopsis{
1418 local($_) = @_;
1419 my $st = get_synopsis_table(get_chapter_id());
Fred Drake1cc58991999-04-13 22:08:59 +00001420 $st->set_synopsis($THIS_MODULE, translate_commands(next_argument()));
Fred Drake62e43691998-08-10 19:40:44 +00001421 return $_;
Fred Drakea0f4c941998-07-24 22:16:04 +00001422}
1423
1424sub do_cmd_localmoduletable{
1425 local($_) = @_;
Fred Drakea0f4c941998-07-24 22:16:04 +00001426 my $chap = get_chapter_id();
Fred Drake643d76d2000-09-09 06:07:37 +00001427 my $st = get_synopsis_table($chap);
1428 $st->set_file("$CURRENT_FILE");
Fred Drake557460c1999-03-02 16:05:35 +00001429 return "<tex2html-localmoduletable><$chap>\\tableofchildlinks[off]" . $_;
Fred Drakea0f4c941998-07-24 22:16:04 +00001430}
1431
1432sub process_all_localmoduletables{
Fred Drake643d76d2000-09-09 06:07:37 +00001433 my $key;
1434 my $st, $file;
1435 foreach $key (keys %ModuleSynopses) {
1436 $st = $ModuleSynopses{$key};
1437 $file = $st->get_file();
1438 if ($file) {
1439 process_localmoduletables_in_file($file);
1440 }
1441 else {
1442 print "\nsynopsis table $key has no file association";
1443 }
1444 }
1445}
1446
1447sub process_localmoduletables_in_file{
1448 my $file = @_[0];
1449 open(MYFILE, "<$file");
1450 local($_);
1451 sysread(MYFILE, $_, 1024*1024);
1452 close(MYFILE);
1453 # need to get contents of file in $_
Fred Drake557460c1999-03-02 16:05:35 +00001454 while (/<tex2html-localmoduletable><(\d+)>/) {
Fred Drakef7685d71998-07-25 03:31:46 +00001455 my $match = $&;
Fred Drakea0f4c941998-07-24 22:16:04 +00001456 my $chap = $1;
1457 my $st = get_synopsis_table($chap);
1458 my $data = $st->tohtml();
Fred Drakef7685d71998-07-25 03:31:46 +00001459 s/$match/$data/;
Fred Drakea0f4c941998-07-24 22:16:04 +00001460 }
Fred Drake643d76d2000-09-09 06:07:37 +00001461 open(MYFILE,">$file");
1462 print MYFILE $_;
1463 close(MYFILE);
Fred Drakea0f4c941998-07-24 22:16:04 +00001464}
Fred Drake557460c1999-03-02 16:05:35 +00001465sub process_python_state{
1466 process_all_localmoduletables();
Fred Drake557460c1999-03-02 16:05:35 +00001467}
Fred Drakea0f4c941998-07-24 22:16:04 +00001468
1469
1470#
1471# "See also:" -- references placed at the end of a \section
1472#
1473
1474sub do_env_seealso{
Fred Drakee15956b2000-04-03 04:51:13 +00001475 return "<div class='seealso'>\n "
1476 . "<p class='heading'><b>See Also:</b></p>\n"
Fred Drake90fdda51999-02-16 20:27:42 +00001477 . @_[0]
1478 . '</div>';
Fred Drakea0f4c941998-07-24 22:16:04 +00001479}
1480
1481sub do_cmd_seemodule{
1482 # Insert the right magic to jump to the module definition. This should
1483 # work most of the time, at least for repeat builds....
1484 local($_) = @_;
1485 my $key = next_optional_argument();
1486 my $module = next_argument();
1487 my $text = next_argument();
Fred Drake84bd6f31999-05-11 15:42:51 +00001488 my $period = '.';
Fred Drakea0f4c941998-07-24 22:16:04 +00001489 $key = $module
1490 unless $key;
Fred Drake84bd6f31999-05-11 15:42:51 +00001491 if ($text =~ /\.$/) {
1492 $period = '';
1493 }
Fred Drakee15956b2000-04-03 04:51:13 +00001494 return '<dl compact class="seemodule">'
1495 . "\n <dt>Module <b><tt class='module'><a href='module-$key.html'>"
Fred Drake84bd6f31999-05-11 15:42:51 +00001496 . "$module</a></tt>:</b>"
1497 . "\n <dd>$text$period\n </dl>"
Fred Drake90fdda51999-02-16 20:27:42 +00001498 . $_;
Fred Drakea0f4c941998-07-24 22:16:04 +00001499}
1500
Fred Drakee0197bf2001-04-12 04:03:22 +00001501sub strip_html_markup($){
1502 my $str = @_[0];
1503 my $s = "$str";
1504 $s =~ s/<[a-zA-Z0-9]+(\s+[a-zA-Z0-9]+(\s*=\s*(\'[^\']*\'|\"[^\"]*\"|[a-zA-Z0-9]+))?)*\s*>//g;
1505 $s =~ s/<\/[a-zA-Z0-9]+>//g;
1506 return $s;
1507}
1508
Fred Drake643d76d2000-09-09 06:07:37 +00001509sub handle_rfclike_reference{
Fred Drakeafc7ce12001-01-22 17:33:24 +00001510 local($_, $what, $format) = @_;
Fred Drake37cc0c02000-04-26 18:05:24 +00001511 my $rfcnum = next_argument();
1512 my $title = next_argument();
1513 my $text = next_argument();
Fred Drakeafc7ce12001-01-22 17:33:24 +00001514 my $url = get_rfc_url($rfcnum, $format);
Fred Drake7a40c072000-10-02 14:43:38 +00001515 my $icon = get_link_icon($url);
Fred Drakee0197bf2001-04-12 04:03:22 +00001516 my $attrtitle = strip_html_markup($title);
Fred Drake37cc0c02000-04-26 18:05:24 +00001517 return '<dl compact class="seerfc">'
1518 . "\n <dt><a href=\"$url\""
Fred Drakee0197bf2001-04-12 04:03:22 +00001519 . "\n title=\"$attrtitle\""
Fred Drake5f84c9b2000-10-03 06:05:25 +00001520 . "\n >$what $rfcnum, <em>$title</em>$icon</a>"
Fred Drake37cc0c02000-04-26 18:05:24 +00001521 . "\n <dd>$text\n </dl>"
1522 . $_;
1523}
1524
Fred Drake643d76d2000-09-09 06:07:37 +00001525sub do_cmd_seepep{
Fred Drakeafc7ce12001-01-22 17:33:24 +00001526 return handle_rfclike_reference(@_[0], "PEP", $PEP_FORMAT);
Fred Drake643d76d2000-09-09 06:07:37 +00001527}
1528
1529sub do_cmd_seerfc{
Fred Drakeafc7ce12001-01-22 17:33:24 +00001530 return handle_rfclike_reference(@_[0], "RFC", $RFC_FORMAT);
Fred Drake643d76d2000-09-09 06:07:37 +00001531}
1532
Fred Drake48449982000-09-12 17:52:33 +00001533sub do_cmd_seetitle{
1534 local($_) = @_;
1535 my $url = next_optional_argument();
1536 my $title = next_argument();
1537 my $text = next_argument();
1538 if ($url) {
Fred Drake5f84c9b2000-10-03 06:05:25 +00001539 my $icon = get_link_icon($url);
Fred Drake48449982000-09-12 17:52:33 +00001540 return '<dl compact class="seetitle">'
1541 . "\n <dt><em class=\"citetitle\"><a href=\"$url\""
Fred Drake7a40c072000-10-02 14:43:38 +00001542 . "\n >$title$icon</a></em>"
Fred Drake48449982000-09-12 17:52:33 +00001543 . "\n <dd>$text\n </dl>"
1544 . $_;
1545 }
1546 return '<dl compact class="seetitle">'
1547 . "\n <dt><em class=\"citetitle\""
1548 . "\n >$title</em>"
1549 . "\n <dd>$text\n </dl>"
1550 . $_;
1551}
1552
Fred Drakeef4d1112000-05-09 16:17:51 +00001553sub do_cmd_seeurl{
1554 local($_) = @_;
1555 my $url = next_argument();
1556 my $text = next_argument();
Fred Drake7a40c072000-10-02 14:43:38 +00001557 my $icon = get_link_icon($url);
Fred Drakeef4d1112000-05-09 16:17:51 +00001558 return '<dl compact class="seeurl">'
1559 . "\n <dt><a href=\"$url\""
Fred Drake7a40c072000-10-02 14:43:38 +00001560 . "\n class=\"url\">$url$icon</a>"
Fred Drakeef4d1112000-05-09 16:17:51 +00001561 . "\n <dd>$text\n </dl>"
1562 . $_;
1563}
1564
Fred Drakea0f4c941998-07-24 22:16:04 +00001565sub do_cmd_seetext{
Fred Drake79189b51999-04-28 13:54:30 +00001566 local($_) = @_;
1567 my $content = next_argument();
Fred Drakee15956b2000-04-03 04:51:13 +00001568 return '<div class="seetext"><p>' . $content . '</div>' . $_;
Fred Drakea0f4c941998-07-24 22:16:04 +00001569}
1570
1571
1572#
Fred Drake885215c1998-05-20 21:32:09 +00001573# Definition list support.
1574#
1575
1576sub do_env_definitions{
Fred Drake37cc0c02000-04-26 18:05:24 +00001577 return "<dl class='definitions'>" . @_[0] . "</dl>\n";
Fred Drake885215c1998-05-20 21:32:09 +00001578}
1579
1580sub do_cmd_term{
1581 local($_) = @_;
Fred Drakeccc62721999-01-05 22:16:29 +00001582 my $term = next_argument();
1583 my($name,$aname,$ahref) = new_link_info();
Fred Drake885215c1998-05-20 21:32:09 +00001584 # could easily add an index entry here...
Fred Drake62e43691998-08-10 19:40:44 +00001585 return "<dt><b>$aname" . $term . "</a></b>\n<dd>" . $_;
Fred Drake885215c1998-05-20 21:32:09 +00001586}
1587
1588
Fred Drake38178fd2000-09-22 17:05:04 +00001589# I don't recall exactly why this was needed, but it was very much needed.
1590# We'll see if anything breaks when I move the "code" line out -- some
1591# things broke with it in.
1592
1593#code # {}
Fred Drake2ff880e1999-02-05 18:31:29 +00001594process_commands_wrap_deferred(<<_RAW_ARG_DEFERRED_CMDS_);
Fred Drake2e1ee3e1999-02-10 21:17:04 +00001595declaremodule # [] # {} # {}
1596memberline # [] # {}
1597methodline # [] # {} # {}
1598modulesynopsis # {}
Fred Drake557460c1999-03-02 16:05:35 +00001599platform # {}
Fred Drake2ff880e1999-02-05 18:31:29 +00001600samp # {}
Fred Drake2e1ee3e1999-02-10 21:17:04 +00001601setindexsubitem # {}
Fred Drakef32834c1999-02-12 22:06:32 +00001602withsubitem # {} # {}
Fred Drake2ff880e1999-02-05 18:31:29 +00001603_RAW_ARG_DEFERRED_CMDS_
1604
1605
Fred Drake86333602001-04-10 17:13:39 +00001606$alltt_start = '<dl><dd><pre class="verbatim">';
1607$alltt_end = '</pre></dl>';
1608
1609sub do_env_alltt {
1610 local ($_) = @_;
1611 local($closures,$reopens,@open_block_tags);
1612
1613 # get the tag-strings for all open tags
1614 local(@keep_open_tags) = @$open_tags_R;
1615 ($closures,$reopens) = &preserve_open_tags() if (@$open_tags_R);
1616
1617 # get the tags for text-level tags only
1618 $open_tags_R = [ @keep_open_tags ];
1619 local($local_closures, $local_reopens);
1620 ($local_closures, $local_reopens,@open_block_tags)
1621 = &preserve_open_block_tags
1622 if (@$open_tags_R);
1623
1624 $open_tags_R = [ @open_block_tags ];
1625
1626 do {
1627 local($open_tags_R) = [ @open_block_tags ];
1628 local(@save_open_tags) = ();
1629
1630 local($cnt) = ++$global{'max_id'};
1631 $_ = join('',"$O$cnt$C\\tt$O", ++$global{'max_id'}, $C
1632 , $_ , $O, $global{'max_id'}, "$C$O$cnt$C");
1633
1634 $_ = &translate_environments($_);
1635 $_ = &translate_commands($_) if (/\\/);
1636
1637 # preserve space-runs, using &nbsp;
1638 while (s/(\S) ( +)/$1$2;SPMnbsp;/g){};
1639 s/(<BR>) /$1;SPMnbsp;/g;
1640
1641 $_ = join('', $closures, $alltt_start, $local_reopens
1642 , $_
1643 , &balance_tags() #, $local_closures
1644 , $alltt_end, $reopens);
1645 undef $open_tags_R; undef @save_open_tags;
1646 };
1647 $open_tags_R = [ @keep_open_tags ];
1648 $_;
1649}
1650
1651
Fred Drake6659c301998-03-03 22:02:19 +000016521; # This must be the last line