This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Generate the enum for want_vtbl_* with regen/mg_vtable.pl
authorNicholas Clark <nick@ccl4.org>
Fri, 13 May 2011 17:02:08 +0000 (18:02 +0100)
committerNicholas Clark <nick@ccl4.org>
Sat, 11 Jun 2011 08:12:18 +0000 (10:12 +0200)
mg_vtable.h
perl.h
regen/mg_vtable.pl

index 6353353..9ed872d 100644 (file)
@@ -6,6 +6,41 @@
  * Any changes made here will be lost!
  */
 
+enum {         /* pass one of these to get_vtbl */
+    want_vtbl_sv,
+    want_vtbl_env,
+    want_vtbl_envelem,
+    want_vtbl_sigelem,
+    want_vtbl_pack,
+    want_vtbl_packelem,
+    want_vtbl_dbline,
+    want_vtbl_isa,
+    want_vtbl_isaelem,
+    want_vtbl_arylen,
+    want_vtbl_arylen_p,
+    want_vtbl_mglob,
+    want_vtbl_nkeys,
+    want_vtbl_taint,
+    want_vtbl_substr,
+    want_vtbl_vec,
+    want_vtbl_pos,
+    want_vtbl_bm,
+    want_vtbl_fm,
+    want_vtbl_uvar,
+    want_vtbl_defelem,
+    want_vtbl_regexp,
+    want_vtbl_regdata,
+    want_vtbl_regdatum,
+    want_vtbl_amagic,
+    want_vtbl_amagicelem,
+    want_vtbl_backref,
+    want_vtbl_ovrld,
+    want_vtbl_utf8,
+    want_vtbl_collxfrm,
+    want_vtbl_hintselem,
+    want_vtbl_hints
+};
+
 /* These all need to be 0, not NULL, as NULL can be (void*)0, which is a
  * pointer to data, whereas we're assigning pointers to functions, which are
  * not the same beast. ANSI doesn't allow the assignment from one to the other.
diff --git a/perl.h b/perl.h
index af44fc5..9c00120 100644 (file)
--- a/perl.h
+++ b/perl.h
@@ -4803,41 +4803,6 @@ typedef enum {
     /* update exp_name[] in toke.c if adding to this enum */
 } expectation;
 
-enum {         /* pass one of these to get_vtbl */
-    want_vtbl_sv,
-    want_vtbl_env,
-    want_vtbl_envelem,
-    want_vtbl_sigelem,
-    want_vtbl_pack,
-    want_vtbl_packelem,
-    want_vtbl_dbline,
-    want_vtbl_isa,
-    want_vtbl_isaelem,
-    want_vtbl_arylen,
-    want_vtbl_mglob,
-    want_vtbl_nkeys,
-    want_vtbl_taint,
-    want_vtbl_substr,
-    want_vtbl_vec,
-    want_vtbl_pos,
-    want_vtbl_bm,
-    want_vtbl_fm,
-    want_vtbl_uvar,
-    want_vtbl_defelem,
-    want_vtbl_regexp,
-    want_vtbl_collxfrm,
-    want_vtbl_amagic,
-    want_vtbl_amagicelem,
-    want_vtbl_regdata,
-    want_vtbl_regdatum,
-    want_vtbl_backref,
-    want_vtbl_utf8,
-    want_vtbl_arylen_p,
-    want_vtbl_hintselem,
-    want_vtbl_hints
-};
-
-
 /* Hints are now stored in a dedicated U32, so the bottom 8 bits are no longer
    special and there is no need for HINT_PRIVATE_MASK for COPs
    However, bitops store HINT_INTEGER in their op_private.  */
index bd48545..2a88263 100644 (file)
@@ -61,6 +61,17 @@ my $h = open_new('mg_vtable.h', '>',
                 { by => 'regen/mg_vtable.pl', file => 'mg_vtable.h',
                   style => '*' });
 
+{
+    my @names = map {"want_vtbl_$_"} grep {!ref $_} @sig;
+    local $" = ",\n    ";
+    print $h <<"EOH";
+enum {         /* pass one of these to get_vtbl */
+    @names
+};
+
+EOH
+}
+
 print $h <<'EOH';
 /* These all need to be 0, not NULL, as NULL can be (void*)0, which is a
  * pointer to data, whereas we're assigning pointers to functions, which are