summaryrefslogtreecommitdiff
path: root/pptok.pl
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2007-09-12 02:12:07 +0000
committerH. Peter Anvin <hpa@zytor.com>2007-09-12 02:12:07 +0000
commit9bf0aa7c5285c82a40d22a9a86e7dbbaaf480dc1 (patch)
treeda7a000b3d37c6d19c325cc6478b0dfd7f3bd126 /pptok.pl
parent9e1c202b69144c5b98baa365f74ea92f043247b3 (diff)
downloadnasm-9bf0aa7c5285c82a40d22a9a86e7dbbaaf480dc1.tar.gz
nasm-9bf0aa7c5285c82a40d22a9a86e7dbbaaf480dc1.tar.bz2
nasm-9bf0aa7c5285c82a40d22a9a86e7dbbaaf480dc1.zip
Generate automatically correct tests for %if and %elif
Automatically generate macros to test for %if and %elif variants, which are guaranteed to be correct across future changes.
Diffstat (limited to 'pptok.pl')
-rwxr-xr-xpptok.pl14
1 files changed, 14 insertions, 0 deletions
diff --git a/pptok.pl b/pptok.pl
index df64cde..8fe0415 100755
--- a/pptok.pl
+++ b/pptok.pl
@@ -27,6 +27,10 @@ while (defined($line = <IN>)) {
}
close(IN);
+@cctok = sort @cctok;
+@cond = sort @cond;
+
+# Generate the expanded list including conditionals
foreach $ct (@cctok) {
foreach $cc (@cond) {
push(@pptok, $ct.$cc);
@@ -52,6 +56,16 @@ if ($what eq 'h') {
}
print OUT " PP_INVALID = -1\n";
print OUT "};\n";
+ print OUT "\n";
+
+ $first_cc = $cond[0];
+ $last_cc = $cond[(scalar @cond)-1];
+
+ foreach $ct (@cctok) {
+ (my $cx = $ct) =~ s/\%//g;
+ print OUT "#define IS_PP_\U$cx\E(x) ((x) >= PP_\U$cx$first_cc\E && ";
+ print OUT "(x) <= PP_\U$cx$last_cc\E)\n";
+ }
}
#