summaryrefslogtreecommitdiff
path: root/macros.pl
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2002-05-04 03:57:52 +0000
committerH. Peter Anvin <hpa@zytor.com>2002-05-04 03:57:52 +0000
commite87613b14e9ab6f71936c0aa032f508af78d835e (patch)
treecda54955c913b5edbeebfd0d0fa620c810d1de2f /macros.pl
parent788abaf55a2c308425da56f6080cfe85070f509f (diff)
downloadnasm-e87613b14e9ab6f71936c0aa032f508af78d835e.tar.gz
nasm-e87613b14e9ab6f71936c0aa032f508af78d835e.tar.bz2
nasm-e87613b14e9ab6f71936c0aa032f508af78d835e.zip
Make all version information come from the single file "version".
Introduce new standard __NASM_SUBMINOR__ and __NASM_VER__ macros.
Diffstat (limited to 'macros.pl')
-rw-r--r--macros.pl53
1 files changed, 28 insertions, 25 deletions
diff --git a/macros.pl b/macros.pl
index 15739f5..6d69a17 100644
--- a/macros.pl
+++ b/macros.pl
@@ -11,35 +11,38 @@
my $fname;
my $line = 0;
-my $index = 0;
+my $index = 0;
+my $tasm_count;
-$fname = "standard.mac" unless $fname = $ARGV[0];
-open INPUT,$fname || die "unable to open $fname\n";
-open OUTPUT,">macros.c" || die "unable to open macros.c\n";
+undef $tasm_count;
+open OUTPUT,">macros.c" || die "unable to open macros.c\n";
+
print OUTPUT "/* This file auto-generated from standard.mac by macros.pl" .
- " - don't edit it */\n\n#include <stddef.h>\n\nstatic char *stdmac[] = {\n";
-
-while (<INPUT>) {
+" - don't edit it */\n\n#include <stddef.h>\n\nstatic char *stdmac[] = {\n";
+
+foreach $fname ( @ARGV ) {
+ open INPUT,$fname || die "unable to open $fname\n";
+ while (<INPUT>) {
$line++;
chomp;
- if (m/^\s*((\s*([^"';\s]+|"[^"]*"|'[^']*'))*)\s*(;.*)?$/) {
- $_ = $1;
- s/\\/\\\\/g;
- s/"/\\"/g;
- if (length > 0) {
- print OUTPUT " \"$_\",\n";
- if ($index >= 0) {
- if (m/__NASM_MAJOR__/) {
- $index = -$index;
- } else {
- $index++;
- }
- }
- }
- } else {
- die "$fname:$line: error unterminated quote";
+ if (m/^\s*\*END\*TASM\*MACROS\*\s*$/) {
+ $tasm_count = $index;
+ } elsif (m/^\s*((\s*([^\"\';\s]+|\"[^\"]*\"|\'[^\']*\'))*)\s*(;.*)?$/) {
+ $_ = $1;
+ s/\\/\\\\/g;
+ s/"/\\"/g;
+ if (length > 0) {
+ print OUTPUT " \"$_\",\n";
+ $index++;
+ }
+ } else {
+ die "$fname:$line: error unterminated quote";
}
+ }
+ close(INPUT);
}
-$index = -$index;
-print OUTPUT " NULL\n};\n#define TASM_MACRO_COUNT $index\n"
+print OUTPUT " NULL\n};\n";
+$tasm_count = $index unless ( defined($tasm_count) );
+print OUTPUT "#define TASM_MACRO_COUNT $tasm_count\n";
+close(OUTPUT);