annotate src/fftw-3.3.3/doc/FAQ/m-html.pl @ 10:37bf6b4a2645

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