From ca298f7d2a54eb2838d5931d3aac12d5f3209356 Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Fri, 13 May 2011 18:02:08 +0100 Subject: Generate the enum for want_vtbl_* with regen/mg_vtable.pl --- mg_vtable.h | 35 +++++++++++++++++++++++++++++++++++ perl.h | 35 ----------------------------------- regen/mg_vtable.pl | 11 +++++++++++ 3 files changed, 46 insertions(+), 35 deletions(-) diff --git a/mg_vtable.h b/mg_vtable.h index 635335384a..9ed872db1a 100644 --- a/mg_vtable.h +++ b/mg_vtable.h @@ -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 af44fc542e..9c0012022f 100644 --- 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. */ diff --git a/regen/mg_vtable.pl b/regen/mg_vtable.pl index bd48545191..2a88263ec2 100644 --- a/regen/mg_vtable.pl +++ b/regen/mg_vtable.pl @@ -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 -- cgit v1.2.1