mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-07-24 10:25:42 -04:00
rdsrc.pl: handle tabs in the input
It is just to painful to keep the source files tab-free. Handle tabs in the input as required. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
parent
e232d9a6bf
commit
2aa72b64a6
21
doc/rdsrc.pl
21
doc/rdsrc.pl
@ -104,6 +104,7 @@ $pname = "para000000";
|
||||
@pnames = @pflags = ();
|
||||
$para = undef;
|
||||
while (defined($_ = <STDIN>)) {
|
||||
$_ = &untabify($_);
|
||||
&check_include($_);
|
||||
}
|
||||
&got_para($para);
|
||||
@ -151,6 +152,26 @@ if ($out_format eq 'txt') {
|
||||
die "$0: unknown output format: $out_format\n";
|
||||
}
|
||||
|
||||
sub untabify($) {
|
||||
my($s) = @_;
|
||||
my $o = '';
|
||||
my($c, $i, $p);
|
||||
|
||||
$p = 0;
|
||||
for ($i = 0; $i < length($s); $i++) {
|
||||
$c = substr($s, $i, 1);
|
||||
if ($c eq "\t") {
|
||||
do {
|
||||
$o .= ' ';
|
||||
$p++;
|
||||
} while ($p & 7);
|
||||
} else {
|
||||
$o .= $c;
|
||||
$p++;
|
||||
}
|
||||
}
|
||||
return $o;
|
||||
}
|
||||
sub check_include {
|
||||
local $_ = shift;
|
||||
if (/\\& (\S+)/) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user