Subversion Repositories shark

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 pj 1
## Info output
2
# Copyright (C) 1993-1995 Ian Jackson.
3
 
4
# This file is free software; you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation; either version 2, or (at your option)
7
# any later version.
8
 
9
# It is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
# GNU General Public License for more details.
13
 
14
# You should have received a copy of the GNU General Public License
15
# along with GNU Emacs; see the file COPYING.  If not, write to
16
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17
# Boston, MA 02111-1307, USA.
18
 
19
# (Note: I do not consider works produced using these BFNN processing
20
# tools to be derivative works of the tools, so they are NOT covered
21
# by the GPL.  However, I would appreciate it if you credited me if
22
# appropriate in any documents you format using BFNN.)
23
 
24
sub info_init {
25
    open(INFO,">$prefix.info");
26
    print INFO <<END;
27
Info file: $prefix.info,    -*-Text-*-
28
produced by bfnnconv.pl from the Bizarre Format With No Name.
29
 
30
END
31
}
32
 
33
sub info_heading {
34
    # refstring  Node  Next  Previous Up
35
    print INFO "\nFile: $prefix.info, Node: $_[1]";
36
    print INFO ", Next: $_[2]" if length($_[2]);
37
    print INFO ", Previous: $_[3]" if length($_[3]);
38
    print INFO ", Up: $_[4]" if length($_[4]);
39
    print INFO "\n\n";
40
    $info_status= '';
41
}
42
 
43
sub info_startmajorheading {
44
    return if $_[0] eq '0';
45
    &info_heading('s_'.$_[0],@_[1..$#_],'Top');
46
}
47
 
48
sub info_startminorheading {
49
    &info_heading(@_);
50
}
51
 
52
sub info_italic { &info_text('*'); }
53
sub info_enditalic { $info_para .= '*'; }
54
 
55
sub info_email { &info_text('<'); } sub info_endemail { &info_text('>'); }
56
 
57
sub info_ftpon { } sub info_endftpon { }
58
sub info_ftpin { } sub info_endftpin { }
59
sub info_docref { } sub info_enddocref { }
60
sub info_courier { } sub info_endcourier { }
61
sub info_newsgroup { }  sub info_endnewsgroup { }
62
sub info_ftpsilent { $info_ignore++; }
63
sub info_endftpsilent { $info_ignore--; }
64
 
65
sub info_text {
66
    return if $info_ignore;
67
    if ($info_status eq '') {
68
        $info_status= 'p';
69
    }
70
    $info_para .= $_[0];
71
}
72
 
73
sub info_tab {
74
    local ($n) = $_[0]-length($info_para);
75
    $info_para .= ' 'x$n if $n>0;
76
}
77
 
78
sub info_newline {
79
    return unless $info_status eq 'p';
80
    print INFO &info_writepara;
81
}
82
 
83
sub info_writepara {
84
    local ($thisline, $thisword, $rest, $output);
85
    for (;;) {
86
        last unless $info_para =~ m/\S/;
87
        $thisline= $info_indentstring;
88
        for (;;) {
89
            last unless $info_para =~ m/^(\s*\S+)/;
90
            unless (length($1) + length($thisline) < 75 ||
91
                    length($thisline) == length($info_indentstring)) {
92
                last;
93
            }
94
            $thisline .= $1;
95
            $info_para= $';
96
        }
97
        $info_para =~ s/^\s*//;
98
        $output.= $thisline."\n";
99
        $info_indentstring= $info_nextindent;
100
        last unless length($info_para);
101
    }
102
    $info_status= '';  $info_para= '';
103
    return $output;
104
}    
105
 
106
sub info_endpara {
107
    return unless $info_status eq 'p';
108
    print INFO &info_writepara;
109
    print INFO "\n";
110
}
111
 
112
sub info_endheading {
113
    $info_para =~ s/\s*$//;
114
    print INFO "$info_para\n\n";
115
    $info_status= '';
116
    $info_para= '';
117
}
118
 
119
sub info_endmajorheading { &info_endheading(@_); }
120
sub info_endminorheading { &info_endheading(@_); }
121
 
122
sub info_startverbatim {
123
    print INFO &info_writepara;
124
}
125
 
126
sub info_verbatim {
127
    print INFO $_[0],"\n";
128
}
129
 
130
sub info_endverbatim {
131
    $info_status= $info_vstatus;
132
}
133
 
134
sub info_finish {
135
    close(INFO);
136
}
137
 
138
sub info_startindex {
139
    &info_endpara;
140
    $info_moredetail= '';
141
    $info_status= '';
142
}
143
 
144
sub info_endindex {
145
    print INFO "$info_moredetail\n" if length($info_moredetail);
146
}
147
 
148
sub info_endindexitem {
149
    $info_indentstring= sprintf("* %-17s ",$info_label.'::');
150
    $info_nextindent= ' 'x20;
151
    local ($txt);
152
    $txt= &info_writepara;
153
    if ($info_main) {
154
        print INFO $label.$txt;
155
        $txt =~ s/^.{20}//;
156
        $info_moredetail.= $txt;
157
    } else {
158
        $info_moredetail.= $label.$txt;
159
    }
160
    $info_indentstring= $info_nextindent= '';
161
    $info_status='p';
162
}
163
 
164
sub info_startindexitem {
165
    print INFO "* Menu:\n" if $info_status eq '';
166
    $info_status= '';
167
    $info_label= $_[2];
168
    $info_main= 0;
169
}
170
 
171
sub info_startindexmainitem {
172
    print INFO "* Menu:\n" if $info_status eq '';
173
    $info_label= $_[2];
174
    $info_main= 1;
175
    $info_moredetail .= "\n$_[2], ";
176
    $info_status= '';
177
}
178
 
179
sub info_startindent {
180
    $info_istatus= $info_status;
181
    print INFO &info_writepara;
182
    $info_indentstring= "   $info_indentstring";
183
    $info_nextindent= "   $info_nextindent";
184
}
185
 
186
sub info_endindent {
187
    $info_indentstring =~ s/^   //;
188
    $info_nextindent =~ s/^   //;
189
    $info_status= $info_istatus;
190
}
191
 
192
sub info_startpackedlist { $info_plc=0; }
193
sub info_endpackedlist { &info_newline if !$info_plc; }
194
sub info_packeditem {
195
    &info_newline if !$info_plc;
196
    &info_tab($info_plc*40+5);
197
    $info_plc= !$info_plc;
198
}
199
 
200
sub info_startlist {
201
    $info_istatus= $info_status;
202
    print INFO &info_writepara;
203
    $info_indentstring= "  $info_indentstring";
204
    $info_nextindent= "  $info_nextindent";
205
}
206
 
207
sub info_endlist {
208
    $info_indentstring =~ s/^  //;
209
    $info_nextindent =~ s/^  //;
210
    $info_status= $info_lstatus;
211
}
212
 
213
sub info_item {
214
    &info_newline;
215
    $info_indentstring =~ s/  $/* /;
216
}
217
 
218
sub info_pageref {
219
    &info_text("*Note Question $_[1]:: \`");
220
}
221
 
222
sub info_endpageref {
223
    &info_text("'");
224
}
225
 
226
1;