summaryrefslogtreecommitdiff
path: root/doc/rdsrc.pl
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-09-30 17:12:19 -0700
committerH. Peter Anvin <hpa@zytor.com>2008-09-30 17:12:19 -0700
commit2aa72b64a6963a81532926a8b5ad0033d22d05a8 (patch)
treef2f6908a54e6581ab821ae1ac650a51cbe358f2b /doc/rdsrc.pl
parente232d9a6bf7713dbeaa4724d8cf3c99bf57eb6c4 (diff)
downloadnasm-2aa72b64a6963a81532926a8b5ad0033d22d05a8.tar.gz
nasm-2aa72b64a6963a81532926a8b5ad0033d22d05a8.tar.bz2
nasm-2aa72b64a6963a81532926a8b5ad0033d22d05a8.zip
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>
Diffstat (limited to 'doc/rdsrc.pl')
-rw-r--r--doc/rdsrc.pl21
1 files changed, 21 insertions, 0 deletions
diff --git a/doc/rdsrc.pl b/doc/rdsrc.pl
index c4069b1..ab85af8 100644
--- a/doc/rdsrc.pl
+++ b/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+)/) {