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