-
Notifications
You must be signed in to change notification settings - Fork 0
/
automakehtml.in
executable file
·153 lines (123 loc) · 3.71 KB
/
automakehtml.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#! @PERL@
$, = ' '; # set output field separator
$\ = "\n"; # set output record separator
@files = @ARGV;
print <<'EOD';
<HTML>
<HEAD><TITLE>PGPLOT Subroutine Descriptions</TITLE></HEAD>
<BODY BGCOLOR="FFFFFF">
<H1>PGPLOT Subroutine Descriptions</H1>
<H2>Introduction</H2>
This appendix includes a list of all the PGPLOT subroutines,
and then gives detailed instructions for the use of each routine in
Fortran programs. The subroutine descriptions are in alphabetical order.
<H2>Arguments</H2>
The subroutine descriptions indicate the data type of each
argument. When arguments are described as ``input'', they may be
replaced with constants or expressions in the <CODE>CALL</CODE>
statement, but make sure that the constant or expression has the
correct data type.
<DL><DT><CODE>INTEGER</CODE> arguments:
<DD>these should be declared
<CODE>INTEGER</CODE> or <CODE>INTEGER*4</CODE> in the calling program,
not <CODE>INTEGER*2</CODE>.
<DT><CODE>REAL</CODE> arguments:
<DD>these should be declared
<CODE>REAL</CODE> or <CODE>REAL*4</CODE> in the calling program, not
<CODE>REAL*8</CODE> or <CODE>DOUBLE PRECISION</CODE>.
<DT><CODE>LOGICAL</CODE> arguments:
<DD>these should be declared
<CODE>LOGICAL</CODE> or <CODE>LOGICAL*4</CODE> in the calling program.
<DT><CODE>CHARACTER</CODE> arguments:
<DD> any valid Fortran
<CODE>CHARACTER</CODE> variable may be used (declared
<CODE>CHARACTER*n</CODE> for some integer <CODE>n</CODE>).
</DL>
<H2>Index of Routines</H2>
<EM>Version 5.2</EM><P>
EOD
# Extract documentation from pgplot source code: output index of routines
print '<UL>';
while (<>) {
chop; # strip record separator
if (/^C\*/) {
($module, $rest) = split (' ', $_, 2);
$module = substr($module, 2);
print "<LI><A HREF=\"#$module\">$module</A> $rest";
$ref{$module} = "<A href=\"#$module\">$module</A>";
push (@modules, $module);
}
}
# reverse sort so that modules with the same first few characters occur
# longest to shortest.
@modules = sort {length($b) <=> length($a)} @modules;
print '</UL>';
# Extract documentation from pgplot source code: output HTML code
@ARGV = @files;
while (<>)
{
s/\&/\&\;/g;
s/\>/\>\;/g;
s/\</\<\;/g;
chop; # strip record separator
/^C\*/ && do
{
print '';
print '<HR>';
($module, $rest) = split (' ', substr($_, 2), 2);
print "<H2><A NAME=\"$module\">$module</A> $rest</H2>";
next;
};
/^C\+/ && do
{
print '<PRE>' if $echo == 0;
$echo = 1;
print &Getline0();
next;
};
/^C--/ && do
{
print '</PRE>' if $echo == 1;
$echo = 0;
next;
};
next if ! $echo;
/^C/ && do
{
# replace module names with links. when a module name is recognized,
# it's replaced by a tag in the line to avoid multiple recognitions
# (by modules which have similar substrings). the tags are replaced
# by the actual links after all identifications have been made.
# it'd be cheaper to have the tags be variables that could be
# interpolated, but there's no guarantee that the rest of the text
# wouldn't be adversely affected. thus, a set of replacements is
# created and then eval'd
$line = substr($_, 2);
$reps = 0;
$repstr = '';
foreach $module (@modules)
{
$start = index($line, $module);
next if $start == -1;
$tag = sprintf("REPLACE<%04d>", $reps);
$line = join('', substr($line, 0, $start), $tag,
substr($line, $start+length($module)));
$repstr .= "\$line =~ s:$tag:$ref{$module}:;\n";
++$reps;
}
eval $repstr if $repstr ne '';
print $line;
next;
};
print;
}
print <<'EOD';
<HR>
</BODY></HTML>
EOD
sub Getline0 {
if ($getline_ok = (($_ = <>) ne '')) {
chop; # strip record separator
}
$_;
}