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