Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7c4cba8

Browse files
committed
Added handler for opcodedesc environment.
Fixed weird index behavior.
1 parent f2d7e55 commit 7c4cba8

1 file changed

Lines changed: 67 additions & 41 deletions

File tree

Doc/myformat.perl

Lines changed: 67 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -27,74 +27,64 @@ package main;
2727

2828
sub do_cmd_optional{
2929
local($_) = @_;
30-
s/$any_next_pair_pr_rx/<\/VAR><BIG>\[<\/BIG><VAR>\2<\/VAR><BIG>\]<\/BIG><VAR>/;
30+
s/$any_next_pair_pr_rx/<\/var><big>\[<\/big><var>\2<\/var><big>\]<\/big><var>/;
3131
$_;
3232
}
3333

3434
sub do_cmd_varvars{
3535
local($_) = @_;
36-
s/$any_next_pair_pr_rx/<VAR>\2<\/VAR>/;
36+
s/$any_next_pair_pr_rx/<var>\2<\/var>/;
3737
$_;
3838
}
3939

4040
# texinfo-like formatting commands: \code{...} etc.
4141

4242
sub do_cmd_code{
4343
local($_) = @_;
44-
s/$any_next_pair_pr_rx/<CODE>\2<\/CODE>/;
44+
s/$any_next_pair_pr_rx/<code>\2<\/code>/;
4545
$_;
4646
}
4747

4848
sub do_cmd_sectcode{ &do_cmd_code(@_); }
4949

5050
sub do_cmd_kbd{
5151
local($_) = @_;
52-
s/$any_next_pair_pr_rx/<KBD>\2<\/KBD>/;
52+
s/$any_next_pair_pr_rx/<kbd>\2<\/kbd>/;
5353
$_;
5454
}
5555

5656
sub do_cmd_key{
5757
local($_) = @_;
58-
s/$any_next_pair_pr_rx/<TT>\2<\/TT>/;
59-
$_;
60-
}
61-
62-
sub do_cmd_samp{
63-
local($_) = @_;
64-
s/$any_next_pair_pr_rx/`<SAMP>\2<\/SAMP>'/;
58+
s/$any_next_pair_pr_rx/<tt>\2<\/tt>/;
6559
$_;
6660
}
6761

6862
sub do_cmd_var{
6963
local($_) = @_;
70-
s/$any_next_pair_pr_rx/<VAR>\2<\/VAR>/;
71-
$_;
72-
}
73-
74-
sub do_cmd_file{
75-
local($_) = @_;
76-
s/$any_next_pair_pr_rx/`<CODE>\2<\/CODE>'/;
64+
s/$any_next_pair_pr_rx/<var>\2<\/var>/;
7765
$_;
7866
}
7967

8068
sub do_cmd_dfn{
8169
local($_) = @_;
82-
s/$any_next_pair_pr_rx/<I><DFN>\2<\/DFN><\/I>/;
70+
s/$any_next_pair_pr_rx/<i><dfn>\2<\/dfn><\/i>/;
8371
$_;
8472
}
8573

8674
sub do_cmd_emph{
8775
local($_) = @_;
88-
s/$any_next_pair_pr_rx/<EM>\2<\/EM>/;
76+
s/$any_next_pair_pr_rx/<em>\2<\/em>/;
8977
$_;
9078
}
9179

9280
sub do_cmd_strong{
9381
local($_) = @_;
94-
s/$any_next_pair_pr_rx/<STRONG>\2<\/STRONG>/;
82+
s/$any_next_pair_pr_rx/<strong>\2<\/strong>/;
9583
$_;
9684
}
9785

86+
# file and samp are at the end of this file since they screw up fontlock.
87+
9888
# index commands
9989

10090
sub do_cmd_indexii{
@@ -182,19 +172,20 @@ sub get_indexsubitem{
182172

183173
sub do_env_cfuncdesc{
184174
local($_) = @_;
185-
local($return_type,$function_name,$arg_list) = ('', '', '');
175+
local($return_type,$function_name,$arg_list,$idx) = ('', '', '', '');
186176
local($cfuncdesc_rx) =
187177
"$next_pair_rx$any_next_pair_rx3$any_next_pair_rx5";
188178
$* = 1;
189179
if (/$cfuncdesc_rx/o) {
190180
$return_type = "$2";
191181
$function_name = "$4";
192182
$arg_list = "$6";
193-
&make_index_entry($3,"<TT>$function_name</TT> " . &get_indexsubitem);
183+
$idx = &make_str_index_entry($3,
184+
"<tt>$function_name</tt> " . &get_indexsubitem);
194185
}
195186
$* = 0;
196-
"<DL><DT>$return_type <STRONG><A NAME=\"$3\">$function_name</A></STRONG>" .
197-
"(<VAR>$arg_list</VAR>)\n<DD>$'\n</DL>"
187+
"<dl><dt>$return_type <strong>$idx</strong>" .
188+
"(<var>$arg_list</var>)\n<dd>$'\n</dl>"
198189
}
199190

200191
sub do_env_ctypedesc{
@@ -205,68 +196,89 @@ sub do_env_ctypedesc{
205196
$* = 1;
206197
if (/$cfuncdesc_rx/o) {
207198
$type_name = "$2";
208-
&make_index_entry($1,"<TT>$var_name</TT> " . &get_indexsubitem);
199+
$idx = &make_str_index_entry($1,
200+
"<tt>$type_name</tt> " . &get_indexsubitem);
209201
}
210202
$* = 0;
211-
"<DL><DT><STRONG><A NAME=\"$1\">$type_name</A></STRONG>\n<DD>$'\n</DL>"
203+
"<dl><dt><strong>$idx</strong>\n<dd>$'\n</dl>"
212204
}
213205

214206
sub do_env_cvardesc{
215207
local($_) = @_;
216-
local($var_type,$var_name) = ('', '');
208+
local($var_type,$var_name,$idx) = ('', '', '');
217209
local($cfuncdesc_rx) =
218210
"$next_pair_rx$any_next_pair_rx3";
219211
$* = 1;
220212
if (/$cfuncdesc_rx/o) {
221213
$var_type = "$2";
222214
$var_name = "$4";
223-
&make_index_entry($3,"<TT>$var_name</TT> " . &get_indexsubitem);
215+
$idx = &make_str_index_entry($3,"<tt>$var_name</tt> " . &get_indexsubitem);
224216
}
225217
$* = 0;
226-
"<DL><DT>$var_type <STRONG><A NAME=\"$3\">$var_name</A></STRONG>\n" .
227-
"<DD>$'\n</DL>"
218+
"<dl><dt>$var_type <strong>$idx</strong>\n" .
219+
"<dd>$'\n</dl>";
228220
}
229221

230222
sub do_env_funcdesc{
231223
local($_) = @_;
232-
local($function_name,$arg_list) = ('', '');
224+
local($function_name,$arg_list,$idx) = ('', '', '');
233225
local($funcdesc_rx) = "$next_pair_rx$any_next_pair_rx3";
234226
$* = 1;
235227
if (/$funcdesc_rx/o) {
236228
$function_name = "$2";
237229
$arg_list = "$4";
238-
&make_index_entry($1,"<TT>$function_name</TT> " . &get_indexsubitem);
230+
$idx = &make_str_index_entry($3,
231+
"<tt>$function_name</tt> " . &get_indexsubitem);
232+
}
233+
$* = 0;
234+
"<dl><dt><strong>$idx</strong> (<var>$arg_list</var>)\n<dd>$'\n</dl>";
235+
}
236+
237+
sub do_env_opcodedesc{
238+
local($_) = @_;
239+
local($opcode_name,$arg_list,$stuff,$idx) = ('', '', '', '');
240+
local($opcodedesc_rx) = "$next_pair_rx$any_next_pair_rx3";
241+
$* = 1;
242+
if (/$opcodedesc_rx/o) {
243+
$opcode_name = "$2";
244+
$arg_list = "$4";
245+
$idx = &make_str_index_entry($3,
246+
"<tt>$opcode_name</tt> (byte code instruction)");
239247
}
240248
$* = 0;
241-
"<DL><DT><STRONG><A NAME=\"$3\">$function_name</A></STRONG>" .
242-
"(<VAR>$arg_list</VAR>)\n<DD>$'\n</DL>"
249+
$stuff = "<dl><dt><strong>$idx</strong>";
250+
if ($arg_list) {
251+
$stuff = "$stuff&nbsp;&nbsp;&nbsp;&nbsp;<var>$arg_list</var>";
252+
}
253+
$stuff . "\n<dd>$'\n</dl>";
243254
}
244255

245256
sub do_env_datadesc{
246257
local($_) = @_;
247-
local($data_name) = ('', '');
258+
local($data_name,$idx) = ('', '');
248259
local($datadesc_rx) = "$next_pair_rx";
249260
$* = 1;
250261
if (/$datadesc_rx/o) {
251262
$data_name = "$2";
252-
&make_index_entry($1,"<TT>$data_name</TT> " . &get_indexsubitem);
263+
$idx = &make_str_index_entry($3,
264+
"<tt>$data_name</tt> " . &get_indexsubitem);
253265
}
254266
$* = 0;
255-
"<DL><DT><STRONG><A NAME=\"$3\">$data_name</A></STRONG>" .
256-
"\n<DD>$'\n</DL>"
267+
"<dl><dt><strong>$idx</strong>" .
268+
"\n<dd>$'\n</dl>"
257269
}
258270

259271
sub do_env_excdesc{ &do_env_datadesc(@_); }
260272

261273
sub do_env_seealso{
262274
local($_) = @_;
263-
"<P><B>See Also:</B></P>\n" . $_;
275+
"<p><b>See Also:</b></p>\n" . $_;
264276
}
265277

266278
sub do_cmd_seemodule{
267279
local($_) = @_;
268280
local($any_next_pair_pr_rx3) = "$OP(\\d+)$CP([\\s\\S]*)$OP\\3$CP";
269-
s/$next_pair_pr_rx$any_next_pair_pr_rx3/<P><CODE><B>\2<\/B><\/CODE> (\4)<\/P>/;
281+
s/$next_pair_pr_rx$any_next_pair_pr_rx3/<p><code><b>\2<\/b><\/code> (\4)<\/p>/;
270282
$_;
271283
}
272284

@@ -275,4 +287,18 @@ sub do_cmd_seetext{
275287
"<p>" . $_;
276288
}
277289

290+
# These are located down here since they screw up fontlock.
291+
292+
sub do_cmd_file{
293+
local($_) = @_;
294+
s/$any_next_pair_pr_rx/`<code>\2<\/code>'/;
295+
$_;
296+
}
297+
298+
sub do_cmd_samp{
299+
local($_) = @_;
300+
s/$any_next_pair_pr_rx/`<samp>\2<\/samp>'/;
301+
$_;
302+
}
303+
278304
1; # This must be the last line

0 commit comments

Comments
 (0)