annotate src/fftw-3.3.8/doc/FAQ/m-html.pl @ 84:08ae793730bd

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