annotate src/fftw-3.3.8/doc/FAQ/m-html.pl @ 168:ceec0dd9ec9c

Replace these with versions built using an older toolset (so as to avoid ABI compatibilities when linking on Ubuntu 14.04 for packaging purposes)
author Chris Cannam <cannam@all-day-breakfast.com>
date Fri, 07 Feb 2020 11:51:13 +0000
parents bd3cc4d1df30
children
rev   line source
cannam@167 1 ## HTML output
cannam@167 2 # Copyright (C) 1993-1995 Ian Jackson.
cannam@167 3
cannam@167 4 # This file is free software; you can redistribute it and/or modify
cannam@167 5 # it under the terms of the GNU General Public License as published by
cannam@167 6 # the Free Software Foundation; either version 2, or (at your option)
cannam@167 7 # any later version.
cannam@167 8
cannam@167 9 # It is distributed in the hope that it will be useful,
cannam@167 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
cannam@167 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
cannam@167 12 # GNU General Public License for more details.
cannam@167 13
cannam@167 14 # You should have received a copy of the GNU General Public License
cannam@167 15 # along with GNU Emacs; see the file COPYING. If not, write to
cannam@167 16 # the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
cannam@167 17 # Boston, MA 02111-1307, USA.
cannam@167 18
cannam@167 19 # (Note: I do not consider works produced using these BFNN processing
cannam@167 20 # tools to be derivative works of the tools, so they are NOT covered
cannam@167 21 # by the GPL. However, I would appreciate it if you credited me if
cannam@167 22 # appropriate in any documents you format using BFNN.)
cannam@167 23
cannam@167 24 %saniarray= ('<','lt', '>','gt', '&','amp', '"','quot');
cannam@167 25
cannam@167 26 sub html_init {
cannam@167 27 $html_prefix = './'.$prefix;
cannam@167 28 $html_prefix =~ s:^\.//:/:;
cannam@167 29 system('rm','-r',"$html_prefix.html");
cannam@167 30 system('mkdir',"$html_prefix.html");
cannam@167 31 open(HTML,">$html_prefix.html/index.html");
cannam@167 32 print HTML "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\">\n";
cannam@167 33 print HTML "<html>\n";
cannam@167 34 $html_needpara= -1;
cannam@167 35 $html_end='';
cannam@167 36 chop($html_date=`date '+%d %B %Y'`);
cannam@167 37 chop($html_year=`date '+%Y'`);
cannam@167 38 }
cannam@167 39
cannam@167 40 sub html_startup {
cannam@167 41 print HTML <<END;
cannam@167 42 <head><title>
cannam@167 43 $user_title
cannam@167 44 </title>
cannam@167 45 <link rev="made" href="mailto:$user_authormail">
cannam@167 46 <link rel="Contents" href="index.html">
cannam@167 47 <link rel="Start" href="index.html">
cannam@167 48 <META name="description"
cannam@167 49 content="Frequently asked questions and answers (FAQ) for FFTW.">
cannam@167 50 <link rel="Bookmark" title="FFTW FAQ" href="index.html">
cannam@167 51 <LINK rel="Bookmark" title="FFTW Home Page"
cannam@167 52 href="http://www.fftw.org">
cannam@167 53 <LINK rel="Bookmark" title="FFTW Manual"
cannam@167 54 href="http://www.fftw.org/doc/">
cannam@167 55 </head><body text="#000000" bgcolor="#FFFFFF"><h1>
cannam@167 56 $user_title
cannam@167 57 </h1>
cannam@167 58 END
cannam@167 59 &html_readrefs($_[0]);
cannam@167 60 if (length($user_copyrightref)) {
cannam@167 61 local ($refn) = $qrefn{$user_copyrightref};
cannam@167 62 if (!length($refn)) {
cannam@167 63 warn "unknown question (copyright) `$user_copyrightref'";
cannam@167 64 }
cannam@167 65 $refn =~ m/(\d+)\.(\d+)/;
cannam@167 66 local ($s,$n) = ($1,$2);
cannam@167 67 $html_copyrighthref= ($s == $html_sectionn)?'':"section$s.html";
cannam@167 68 $html_copyrighthref.= "#$qn2ref{$s,$n}";
cannam@167 69 }
cannam@167 70 }
cannam@167 71
cannam@167 72 sub html_close {
cannam@167 73 print HTML $html_end,"<address>\n$user_author\n";
cannam@167 74 print HTML "- $html_date\n</address><br>\n";
cannam@167 75 print HTML "Extracted from $user_title,\n";
cannam@167 76 print HTML "<A href=\"$html_copyrighthref\">" if length($html_copyrighthref);
cannam@167 77 print HTML "Copyright &copy; $html_year $user_copyholder.";
cannam@167 78 print HTML "</A>" if length($html_copyrighthref);
cannam@167 79 print HTML "\n</body></html>\n";
cannam@167 80 close(HTML);
cannam@167 81 }
cannam@167 82
cannam@167 83 sub html_startmajorheading {
cannam@167 84 local ($ref, $this,$next,$back) = @_;
cannam@167 85 local ($nextt,$backt);
cannam@167 86 $this =~ s/^Section /section/; $html_sectionn= $ref;
cannam@167 87 $next =~ s/^Section /section/ && ($nextt= $sn2title{$'});
cannam@167 88 $back =~ s/^Section /section/ ? ($backt= $sn2title{$'}) : ($back='');
cannam@167 89 if ($html_sectionn) {
cannam@167 90 &html_close;
cannam@167 91 open(HTML,">$html_prefix.html/$this.html");
cannam@167 92 print HTML "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\">\n";
cannam@167 93 print HTML "<html>\n";
cannam@167 94 $html_end= "<hr>\n";
cannam@167 95 $html_end.= "Next: <a href=\"$next.html\" rel=precedes>$nextt</a>.<br>\n"
cannam@167 96 if $next;
cannam@167 97 $html_end.= "Back: <a href=\"$back.html\" rev=precedes>$backt</a>.<br>\n"
cannam@167 98 if $back;
cannam@167 99 $html_end.= "<a href=\"index.html\" rev=subdocument>";
cannam@167 100 $html_end.= "Return to contents</a>.<p>\n";
cannam@167 101 print HTML <<END;
cannam@167 102 <head><title>
cannam@167 103 $user_brieftitle - Section $html_sectionn
cannam@167 104 </title>
cannam@167 105 <link rev="made" href="mailto:$user_authormail">
cannam@167 106 <link rel="Contents" href="index.html">
cannam@167 107 <link rel="Start" href="index.html">
cannam@167 108 END
cannam@167 109 print HTML "<link rel=\"Next\" href=\"$next.html\">" if $next;
cannam@167 110 print HTML "<link rel=\"Previous\" href=\"$back.html\">" if $back;
cannam@167 111 print HTML <<END;
cannam@167 112 <link rel="Bookmark" title="FFTW FAQ" href="index.html">
cannam@167 113 </head><body text="#000000" bgcolor="#FFFFFF"><h1>
cannam@167 114 $user_brieftitle - Section $html_sectionn <br>
cannam@167 115 END
cannam@167 116 $html_needpara= -1;
cannam@167 117 }
cannam@167 118 else {
cannam@167 119 print HTML "\n<h1>\n";
cannam@167 120 $html_needpara=-1;
cannam@167 121 }
cannam@167 122 }
cannam@167 123
cannam@167 124 sub html_endmajorheading {
cannam@167 125 print HTML "\n</h1>\n\n";
cannam@167 126 $html_needpara=-1;
cannam@167 127 }
cannam@167 128
cannam@167 129 sub html_startminorheading {
cannam@167 130 local ($ref, $this) = @_;
cannam@167 131 $html_needpara=0;
cannam@167 132 $this =~ m/^Question (\d+)\.(\d+)/;
cannam@167 133 local ($s,$n) = ($1,$2);
cannam@167 134 print HTML "\n<h2><A name=\"$qn2ref{$s,$n}\">\n";
cannam@167 135 }
cannam@167 136
cannam@167 137 sub html_endminorheading {
cannam@167 138 print HTML "\n</A></h2>\n\n";
cannam@167 139 $html_needpara=-1;
cannam@167 140 }
cannam@167 141
cannam@167 142 sub html_newsgroup { &arg('newsgroup'); }
cannam@167 143 sub html_endnewsgroup { &endarg('newsgroup'); }
cannam@167 144 sub html_do_newsgroup {
cannam@167 145 print HTML "<A href=\"news:$_[0]\"><code>$_[0]</code></A>";
cannam@167 146 }
cannam@167 147
cannam@167 148 sub html_email { &arg('email'); }
cannam@167 149 sub html_endemail { &endarg('email'); }
cannam@167 150 sub html_do_email {
cannam@167 151 print HTML "<A href=\"mailto:$_[0]\"><code>$_[0]</code></A>";
cannam@167 152 }
cannam@167 153
cannam@167 154 sub html_courier { print HTML "<code>" ; }
cannam@167 155 sub html_endcourier { print HTML "</code>"; }
cannam@167 156 sub html_italic { print HTML "<i>" ; }
cannam@167 157 sub html_enditalic { print HTML "</i>" ; }
cannam@167 158
cannam@167 159 sub html_docref { &arg('docref'); }
cannam@167 160 sub html_enddocref { &endarg('docref'); }
cannam@167 161 sub html_do_docref {
cannam@167 162 if (!defined($html_refval{$_[0]})) {
cannam@167 163 warn "undefined HTML reference $_[0]";
cannam@167 164 $html_refval{$n}='UNDEFINED';
cannam@167 165 }
cannam@167 166 print HTML "<A href=\"$html_refval{$_[0]}\">";
cannam@167 167 &recurse($_[0]);
cannam@167 168 print HTML "</A>";
cannam@167 169 }
cannam@167 170
cannam@167 171 sub html_readrefs {
cannam@167 172 local ($p);
cannam@167 173 open(HTMLREFS,"<$_[0]") || (warn("failed to open HTML refs $_[0]: $!"),return);
cannam@167 174 while(<HTMLREFS>) {
cannam@167 175 next if m/^\\\s/;
cannam@167 176 s/\s*\n$//;
cannam@167 177 if (s/^\\prefix\s*//) {
cannam@167 178 $p= $'; next;
cannam@167 179 } elsif (s/^\s*(\S.*\S)\s*\\\s*//) {
cannam@167 180 $_=$1; $v=$';
cannam@167 181 s/\\\\/\\/g;
cannam@167 182 $html_refval{$_}= $p.$v;
cannam@167 183 } else {
cannam@167 184 warn("ununderstood line in HTML refs >$_<");
cannam@167 185 }
cannam@167 186 }
cannam@167 187 close(HTMLREFS);
cannam@167 188 }
cannam@167 189
cannam@167 190 sub html_ftpsilent { &arg('ftpsilent'); }
cannam@167 191 sub html_endftpsilent { &endarg('ftpsilent'); }
cannam@167 192 sub html_do_ftpsilent {
cannam@167 193 if ($_[0] =~ m/:/) {
cannam@167 194 $html_ftpsite= $`;
cannam@167 195 $html_ftpdir= $'.'/';
cannam@167 196 } else {
cannam@167 197 $html_ftpsite= $_[0];
cannam@167 198 $html_ftpdir= '';
cannam@167 199 }
cannam@167 200 }
cannam@167 201
cannam@167 202 sub html_ftpon { &arg('ftpon'); }
cannam@167 203 sub html_endftpon { &endarg('ftpon'); }
cannam@167 204 sub html_do_ftpon {
cannam@167 205 #print STDERR "ftpon($_[0])\n";
cannam@167 206 $html_ftpsite= $_[0]; $html_ftpdir= '';
cannam@167 207 print HTML "<code>";
cannam@167 208 &recurse($_[0]);
cannam@167 209 print HTML "</code>";
cannam@167 210 }
cannam@167 211
cannam@167 212 sub html_ftpin { &arg('ftpin'); }
cannam@167 213 sub html_endftpin { &endarg('ftpin'); }
cannam@167 214 sub html_do_ftpin {
cannam@167 215 #print STDERR "ftpin($_[0])\n";
cannam@167 216 print HTML "<A href=\"ftp://$html_ftpsite$html_ftpdir$_[0]\"><code>";
cannam@167 217 &recurse($_[0]);
cannam@167 218 print HTML "</code></A>";
cannam@167 219 }
cannam@167 220
cannam@167 221 sub html_text {
cannam@167 222 print HTML "\n<p>\n" if $html_needpara > 0;
cannam@167 223 $html_needpara=0;
cannam@167 224 $html_stuff= &html_sanitise($_[0]);
cannam@167 225 while ($html_stuff =~ s/^(.{40,70}) //) {
cannam@167 226 print HTML "$1\n";
cannam@167 227 }
cannam@167 228 print HTML $html_stuff;
cannam@167 229 }
cannam@167 230
cannam@167 231 sub html_tab {
cannam@167 232 $htmltabignore++ || warn "html tab ignored";
cannam@167 233 }
cannam@167 234
cannam@167 235 sub html_newline { print HTML "<br>\n" ; }
cannam@167 236 sub html_startverbatim { print HTML "<pre>\n" ; }
cannam@167 237 sub html_verbatim { print HTML &html_sanitise($_[0]),"\n"; }
cannam@167 238 sub html_endverbatim { print HTML "</pre>\n" ; $html_needpara= -1; }
cannam@167 239
cannam@167 240 sub html_endpara {
cannam@167 241 $html_needpara || $html_needpara++;
cannam@167 242 }
cannam@167 243
cannam@167 244 sub html_finish {
cannam@167 245 &html_close;
cannam@167 246 }
cannam@167 247
cannam@167 248 sub html_startindex {
cannam@167 249 print HTML "<ul>\n";
cannam@167 250 }
cannam@167 251
cannam@167 252 sub html_endindex {
cannam@167 253 print HTML "</ul><hr>\n";
cannam@167 254 }
cannam@167 255
cannam@167 256 sub html_startindexitem {
cannam@167 257 local ($ref,$qval) = @_;
cannam@167 258 $qval =~ m/Q(\d+)\.(\d+)/;
cannam@167 259 local ($s,$n) = ($1,$2);
cannam@167 260 print HTML "<li><a href=\"";
cannam@167 261 print HTML ($s == $html_sectionn)?'':"section$s.html";
cannam@167 262 print HTML "#$qn2ref{$s,$n}\" rel=subdocument>Q$s.$n. ";
cannam@167 263 $html_indexunhead='';
cannam@167 264 }
cannam@167 265
cannam@167 266 sub html_startindexmainitem {
cannam@167 267 local ($ref,$s) = @_;
cannam@167 268 $s =~ m/\d+/; $s= $&;
cannam@167 269 print HTML "<br><br>" if ($s > 1);
cannam@167 270 print HTML "<li><b><font size=\"+2\"><a href=\"section$s.html\" rel=subdocument>Section $s. ";
cannam@167 271 $html_indexunhead='</font></b>';
cannam@167 272 }
cannam@167 273
cannam@167 274 sub html_endindexitem {
cannam@167 275 print HTML "</a>$html_indexunhead\n";
cannam@167 276 }
cannam@167 277
cannam@167 278 sub html_startlist {
cannam@167 279 print HTML "\n";
cannam@167 280 $html_itemend="<ul>";
cannam@167 281 }
cannam@167 282
cannam@167 283 sub html_endlist {
cannam@167 284 print HTML "$html_itemend\n</ul>\n";
cannam@167 285 $html_needpara=-1
cannam@167 286 }
cannam@167 287
cannam@167 288 sub html_item {
cannam@167 289 print HTML "$html_itemend\n<li>";
cannam@167 290 $html_itemend="";
cannam@167 291 $html_needpara=-1;
cannam@167 292 }
cannam@167 293
cannam@167 294 sub html_startpackedlist {
cannam@167 295 print HTML "\n";
cannam@167 296 $html_itemend="<dir>";
cannam@167 297 }
cannam@167 298
cannam@167 299 sub html_endpackedlist {
cannam@167 300 print HTML "$html_itemend\n</dir>\n";
cannam@167 301 $html_needpara=-1;
cannam@167 302 }
cannam@167 303
cannam@167 304 sub html_packeditem {
cannam@167 305 print HTML "$html_itemend\n<li>";
cannam@167 306 $html_itemend="";
cannam@167 307 $html_needpara=-1;
cannam@167 308 }
cannam@167 309
cannam@167 310 sub html_startindent { print HTML "<blockquote>\n"; }
cannam@167 311 sub html_endindent { print HTML "</blockquote>\n"; }
cannam@167 312
cannam@167 313 sub html_pageref {
cannam@167 314 local ($ref,$sq) = @_;
cannam@167 315 $sq =~ m/(\d+)\.(\d+)/;
cannam@167 316 local ($s,$n) = ($1,$2);
cannam@167 317 print HTML "<A href=\"";
cannam@167 318 print HTML ($s == $html_sectionn)?'':"section$s.html";
cannam@167 319 print HTML "#$qn2ref{$s,$n}\">Q$sq \`";
cannam@167 320 }
cannam@167 321
cannam@167 322 sub html_endpageref {
cannam@167 323 print HTML "'</A>";
cannam@167 324 }
cannam@167 325
cannam@167 326 sub html_sanitise {
cannam@167 327 local ($in) = @_;
cannam@167 328 local ($out);
cannam@167 329 while ($in =~ m/[<>&"]/) {
cannam@167 330 $out.= $`. '&'. $saniarray{$&}. ';';
cannam@167 331 $in=$';
cannam@167 332 }
cannam@167 333 $out.= $in;
cannam@167 334 $out;
cannam@167 335 }
cannam@167 336
cannam@167 337 1;