summaryrefslogtreecommitdiff
path: root/graphics/asymptote/doc/FAQ/m-info.pl
blob: cfa2515ae11c7806eb7f309a2fbbbaed3f64fbe3 (plain)
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
## Info output
# Copyright (C) 1993-1995 Ian Jackson.

# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.

# It is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with GNU Emacs; see the file COPYING.  If not, write to
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.

# (Note: I do not consider works produced using these BFNN processing
# tools to be derivative works of the tools, so they are NOT covered
# by the GPL.  However, I would appreciate it if you credited me if
# appropriate in any documents you format using BFNN.)

sub info_init {
    open(INFO,">$prefix.info");
    print INFO <<END;
Info file: $prefix.info,    -*-Text-*-
produced by bfnnconv.pl from the Bizarre Format With No Name.

END
}

sub info_heading {
    # refstring  Node  Next  Previous Up
    print INFO "\nFile: $prefix.info, Node: $_[1]";
    print INFO ", Next: $_[2]" if length($_[2]);
    print INFO ", Previous: $_[3]" if length($_[3]);
    print INFO ", Up: $_[4]" if length($_[4]);
    print INFO "\n\n";
    $info_status= '';
}

sub info_startmajorheading {
    return if $_[0] eq '0';
    &info_heading('s_'.$_[0],@_[1..$#_],'Top');
}

sub info_startminorheading {
    &info_heading(@_);
}

sub info_italic { &info_text('*'); }
sub info_enditalic { $info_para .= '*'; }

sub info_email { &info_text('<'); } sub info_endemail { &info_text('>'); }

sub info_ftpon { } sub info_endftpon { }
sub info_ftpin { } sub info_endftpin { }
sub info_docref { } sub info_enddocref { }
sub info_courier { } sub info_endcourier { }
sub info_newsgroup { }  sub info_endnewsgroup { }
sub info_ftpsilent { $info_ignore++; }
sub info_endftpsilent { $info_ignore--; }

sub info_text {
    return if $info_ignore;
    if ($info_status eq '') {
        $info_status= 'p';
    }
    $info_para .= $_[0];
}

sub info_tab {
    local ($n) = $_[0]-length($info_para);
    $info_para .= ' 'x$n if $n>0;
}

sub info_newline {
    return unless $info_status eq 'p';
    print INFO &info_writepara;
}

sub info_writepara {
    local ($thisline, $thisword, $rest, $output);
    for (;;) {
        last unless $info_para =~ m/\S/;
        $thisline= $info_indentstring;
        for (;;) {
            last unless $info_para =~ m/^(\s*\S+)/;
            unless (length($1) + length($thisline) < 75 ||
                    length($thisline) == length($info_indentstring)) {
                last;
            }
            $thisline .= $1;
            $info_para= $';
        }
        $info_para =~ s/^\s*//;
        $output.= $thisline."\n";
        $info_indentstring= $info_nextindent;
        last unless length($info_para);
    }
    $info_status= '';  $info_para= '';
    return $output;
}    

sub info_endpara {
    return unless $info_status eq 'p';
    print INFO &info_writepara;
    print INFO "\n";
}

sub info_endheading {
    $info_para =~ s/\s*$//;
    print INFO "$info_para\n\n";
    $info_status= '';
    $info_para= '';
}

sub info_endmajorheading { &info_endheading(@_); }
sub info_endminorheading { &info_endheading(@_); }

sub info_startverbatim {
    print INFO &info_writepara;
}

sub info_verbatim {
    print INFO $_[0],"\n";
}

sub info_endverbatim {
    $info_status= $info_vstatus;
}

sub info_finish {
    close(INFO);
}

sub info_startindex {
    &info_endpara;
    $info_moredetail= '';
    $info_status= '';
}

sub info_endindex {
    print INFO "$info_moredetail\n" if length($info_moredetail);
}

sub info_endindexitem {
    $info_indentstring= sprintf("* %-17s ",$info_label.'::');
    $info_nextindent= ' 'x20;
    local ($txt);
    $txt= &info_writepara;
    if ($info_main) {
        print INFO $label.$txt;
        $txt =~ s/^.{20}//;
        $info_moredetail.= $txt;
    } else {
        $info_moredetail.= $label.$txt;
    }
    $info_indentstring= $info_nextindent= '';
    $info_status='p';
}

sub info_startindexitem {
    print INFO "* Menu:\n" if $info_status eq '';
    $info_status= '';
    $info_label= $_[2];
    $info_main= 0;
}

sub info_startindexmainitem {
    print INFO "* Menu:\n" if $info_status eq '';
    $info_label= $_[2];
    $info_main= 1;
    $info_moredetail .= "\n$_[2], ";
    $info_status= '';
}

sub info_startindent {
    $info_istatus= $info_status;
    print INFO &info_writepara;
    $info_indentstring= "   $info_indentstring";
    $info_nextindent= "   $info_nextindent";
}

sub info_endindent {
    $info_indentstring =~ s/^   //;
    $info_nextindent =~ s/^   //;
    $info_status= $info_istatus;
}

sub info_startpackedlist { $info_plc=0; }
sub info_endpackedlist { &info_newline if !$info_plc; }
sub info_packeditem {
    &info_newline if !$info_plc;
    &info_tab($info_plc*40+5);
    $info_plc= !$info_plc;
}

sub info_startlist {
    $info_istatus= $info_status;
    print INFO &info_writepara;
    $info_indentstring= "  $info_indentstring";
    $info_nextindent= "  $info_nextindent";
}

sub info_endlist {
    $info_indentstring =~ s/^  //;
    $info_nextindent =~ s/^  //;
    $info_status= $info_lstatus;
}

sub info_item {
    &info_newline;
    $info_indentstring =~ s/  $/* /;
}

sub info_pageref {
    &info_text("*Note Question $_[1]:: \`");
}

sub info_endpageref {
    &info_text("'");
}

1;