summaryrefslogtreecommitdiff
path: root/regen/regcomp.pl
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2013-06-22 18:16:36 +0200
committerYves Orton <demerphq@gmail.com>2013-06-22 18:19:52 +0200
commit337ff3078c4082e843af19536e11f70d3d14bfe9 (patch)
treed4ccd9328e88abe69772d4b945e14519dd98e8af /regen/regcomp.pl
parent80e09529483332d99472e6944c1f7b1abc89c89c (diff)
downloadperl-337ff3078c4082e843af19536e11f70d3d14bfe9.tar.gz
Show intflags as well as extflags
Diffstat (limited to 'regen/regcomp.pl')
-rw-r--r--regen/regcomp.pl47
1 files changed, 46 insertions, 1 deletions
diff --git a/regen/regcomp.pl b/regen/regcomp.pl
index 97719b00ec..4a8b9d52ab 100644
--- a/regen/regcomp.pl
+++ b/regen/regcomp.pl
@@ -245,6 +245,10 @@ print $out <<EOP;
};
#endif /* DOINIT */
+EOP
+
+{
+print $out <<EOP;
/* PL_reg_extflags_name[] - Opcode/state names in string form, for debugging */
#ifndef DOINIT
@@ -263,7 +267,7 @@ foreach my $file ("op_reg_common.h", "regexp.h") {
# optional leading '_'. Return symbol in $1, and strip it from
# rest of line
- if (s/ \# \s* define \s+ ( _? RXf_ \w+ ) \s+ //xi) {
+ if (s/^ \# \s* define \s+ ( _? RXf_ \w+ ) \s+ //xi) {
chomp;
my $define = $1;
my $orig= $_;
@@ -335,6 +339,47 @@ print $out <<EOP;
#endif /* DOINIT */
EOP
+}
+{
+print $out <<EOP;
+/* PL_reg_intflags_name[] - Opcode/state names in string form, for debugging */
+
+#ifndef DOINIT
+EXTCONST char * PL_reg_intflags_name[];
+#else
+EXTCONST char * const PL_reg_intflags_name[] = {
+EOP
+
+my %rxfv;
+my %definitions; # Remember what the symbol definitions are
+my $val = 0;
+my %reverse;
+foreach my $file ("regcomp.h") {
+ open my $fh, "<", $file or die "Can't read $file: $!";
+ while (<$fh>) {
+ # optional leading '_'. Return symbol in $1, and strip it from
+ # rest of line
+ if (m/^ \# \s* define \s+ ( PREGf_ ( \w+ ) ) \s+ 0x([0-9a-f]+)(?:\s*\/\*(.*)\*\/)?/xi) {
+ chomp;
+ my $define = $1;
+ my $abbr= $2;
+ my $hex= $3;
+ my $comment= $4;
+ my $val= hex($hex);
+ $comment= $comment ? " - $comment" : "";
+
+ printf $out qq(\t%-30s/* 0x%08x - %s%s */\n), qq("$abbr",), $val, $define, $comment;
+ }
+ }
+}
+
+print $out <<EOP;
+};
+#endif /* DOINIT */
+
+EOP
+}
+
print $out process_flags('V', 'varies', <<'EOC');
/* The following have no fixed length. U8 so we can do strchr() on it. */