chomp; s/\s+$//;
next if m/^\s*\#/;
next if !m/\S/;
- s/\t/ ' 'x(8-(length $`) % 8) /eg;
+ while (s/\t/ ' 'x(8 - (length $`) % 8) /e) { }
s/^\s*//;
$this_indent= length $&;
$pa_body .= " if (!objc--) goto end_optional;\n";
$any_optl= 1;
} else {
+ die if $any_optl;
$any_mand++;
}
$paarg= "&a_$n";
push @do_aa, "a_$n";
}
if (exists $r_entry->{V}) {
+ if ($any_mand) {
+ $pa_body .= " objc -= $any_mand;\n";
+ }
$va= $r_entry->{V};
push @do_al, subst_in_decl("${va}c", 'int @');
push @do_al, subst_in_decl("${va}v", 'Tcl_Obj *const *@');
- push @do_aa, "objc-1", "objv+1";
+ push @do_aa, "objc+1", "objv-1";
} else {
- $pa_body .= " if (--objc) { e=\"too many args\"; goto e_err; }\n";
- $any_eerr= 1;
+ if (!$any_optl) {
+ $pa_argc .= " if (objc != $any_mand) {".
+ " e=\"wrong number of args\"; goto e_err; }\n";
+ $any_eerr= 1;
+ }
}
if ($any_optl) {
$pa_body .= "end_optional:\n";