1# Like get_body_newcommand above, but for simple raw TeX \defs
2
3package main;
4
5$meta_cmd_rx =~ s/([\|\(])newcommand/$1\[egx\]?def\|newcommand/
6    unless $meta_cmd_rx =~ /[\|\)]def/;
7
8sub get_body_def {
9#    local(*_) = @_;
10    local($after_R) = @_;
11    local($_) = $$after_R;
12    my $argn,$cmd,$body,$is_simple_def,$tmp;
13    ($cmd,$tmp) = &get_next(2);
14    $cmd =~ s/^\s*\\//s;
15    if (/^\@/) { s/^(\@[\w\@]*)/$cmd.= $1;''/se } # @-letter
16
17    ($argn,$tmp) = &get_next(3);
18    $argn = 0 unless $argn;
19
20    ($body,$tmp) = &get_next(1);
21    $tmp = "do_cmd_$cmd";
22#    if ($is_simple_def && !defined (&$tmp))
23    if ($is_simple_def )
24	{ $new_command{$cmd} = join(':!:',$argn,$body,'}'); }
25    $$after_R = $_;
26    ''; # $_;
27}
28
29sub get_body_gdef { &get_body_def(@_) }
30sub get_body_edef { &get_body_def(@_) }
31sub get_body_xdef { &get_body_def(@_) }
32
33######################### Other Concessions to TeX #############################
34
35sub do_cmd_newdimen {
36    local($_) = @_;
37    local($name, $pat) = &get_next_tex_cmd;
38    &add_to_preamble("def", "\\newdimen$pat");
39    $_;
40}
41sub do_cmd_newbox {
42    local($_) = @_;
43    local($name, $pat) = &get_next_tex_cmd;
44    &add_to_preamble("def", "\\newbox$pat");
45    $_;
46}
47
48# JCL
49# Convert decimal, octal, hexadecimal, one letter and
50# one letter macro into char specification.
51#
52sub do_cmd_char {
53    local($_) = @_;
54# some special characters are already turned into l2h internal
55# representation.
56# Get its represention from the table and use it like as regexp form.
57    local($spmquot) = &escape_rx_chars($html_specials{'"'});
58# Get all internal special char representations as implied during
59# preprocessing.
60    local($spmrx) = join("\000",values %html_specials);
61# escape regexp special chars (not really necessary yet, but why not)
62    $spmrx =~ s:([\\(){}[\]\^\$*+?.|]):\\$1:g;
63    $spmrx =~ s/\000/|/g;
64    $spmrx = "(.)" unless $spmrx =~ s/(.+)/($1|.)/;
65
66    s/^[ \t]*(\d{1,3})[ \t]*/&#$1;/ &&
67	return($_);
68
69    s/^[ \t]*\'(\d{1,3})[ \t]*/"&#".oct($1).";"/e &&
70	return($_);
71
72    s/^[ \t]*$spmquot(\d{1,2})[ \t]*/"&#".hex($1).";"/e &&
73	return($_);
74
75# This is a kludge to work together with german.perl. Brrr.
76    s/^[ \t]*\'\'(\d{1,2})[ \t]*/"&#".hex($1).";"/e &&
77	return($_);
78
79# If l2h's special char marker represents more than one character,
80# it's already in the &#xxx; form. Else convert the single character
81# into &#xxx; with the ord() command.
82    s/^[ \t]*\`\\?$spmrx[ \t]*/
83	(length($html_specials_inv{$1}) > 1 ?
84	 $html_specials_inv{$1} : "&#".ord($html_specials_inv{$1}||$1).";")/e &&
85	     return($_);
86
87    &write_warnings(join('',
88			 "Could not find character number in \\char",
89			 (/\n/ ? $` : $_), " etc.\n"));
90    $_;
91}
92
93
94&ignore_commands( <<_IGNORED_CMDS_);
95vskip # &ignore_numeric_argument
96hskip # &ignore_numeric_argument
97kern # &ignore_numeric_argument
98#bgroup
99#egroup
100_IGNORED_CMDS_
101
102
1031; 		# Must be last line
104