projects
/
rfk-inform.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
2893c71
)
Modified for multiple input files.
author
David Griffith
<dave@661.org>
Thu, 21 Mar 2013 01:10:14 +0000
(18:10 -0700)
committer
David Griffith
<dave@661.org>
Thu, 21 Mar 2013 01:10:14 +0000
(18:10 -0700)
nki2inf.pl
patch
|
blob
|
history
diff --git
a/nki2inf.pl
b/nki2inf.pl
index 5b9f3c0b2368587b0b2f4801c55bc65cb3772b29..9f11bc3165c19a89d2cc2dd88391de0a18919317 100755
(executable)
--- a/
nki2inf.pl
+++ b/
nki2inf.pl
@@
-11,13
+11,15
@@
# This script automatically takes care of '`', '\', and '@' by replacing
# them with '@@126', '@@92', and '@@64' respectively.
# This script automatically takes care of '`', '\', and '@' by replacing
# them with '@@126', '@@92', and '@@64' respectively.
-my $infile = $ARGV[0];
+foreach my $infile (@ARGV) {
+ if (! -r $infile) { die "$0: Unable to read $infile\n"; }
+}
+
my $count = 0;
my $line;
my $count = 0;
my $line;
-if (!$
infile) { die "Usage: $0 foobar.nki
> nki.inf\n"; }
+if (!$
ARGV[0]) { die "Usage: $0 <files>
> nki.inf\n"; }
-open (INFILE, "< $infile") || die "$0: Cannot open $infile\n";
print "! The following code was automatically generated by nki2inf.pl\n";
print "! Do not edit this file.\n";
print "! The following code was automatically generated by nki2inf.pl\n";
print "! Do not edit this file.\n";
@@
-34,15
+36,19
@@
print "! \@ --> \@\@64\n\n";
print "[ lookup_msg num;\n";
print "\tswitch(num) {\n";
print "[ lookup_msg num;\n";
print "\tswitch(num) {\n";
-while (<INFILE>) {
- $count++;
- next if /^\s*($|#|!)/;
- chomp;
- $line = $_;
- $line =~ s/"/~/g;
- $line =~ s/@/\@\@64/g;
- $line =~ s/\\/\@\@92/g;
- print "$count:\treturn \"$line\";\n";
+foreach my $infile (@ARGV) {
+ open (INFILE, "< $infile") || die "$0: Cannot open $infile\n";
+
+ while (<INFILE>) {
+ $count++;
+ next if /^\s*($|#|!)/;
+ chomp;
+ $line = $_;
+ $line =~ s/"/~/g;
+ $line =~ s/@/\@\@64/g;
+ $line =~ s/\\/\@\@92/g;
+ print "$count:\treturn \"$line\";\n";
+ }
}
print "default: return \"Unknown NKI (this should not happen)\";\n\t}\n];\n";
print "Constant MESSAGE_NUM $count;\n";
}
print "default: return \"Unknown NKI (this should not happen)\";\n\t}\n];\n";
print "Constant MESSAGE_NUM $count;\n";