summaryrefslogtreecommitdiff
path: root/mg_raw.h
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2011-05-15 13:21:09 +0100
committerNicholas Clark <nick@ccl4.org>2011-06-11 10:39:59 +0200
commit6f83ef0e5a45c465f83de3304c5818ba44492250 (patch)
tree6b5a754cde4ee86baf633e6415f18b5fd8e721ff /mg_raw.h
parent546efe9fbd6c3c651c39b369e97d0835230a0f9f (diff)
downloadperl-6f83ef0e5a45c465f83de3304c5818ba44492250.tar.gz
Create a lookup table for magic vtables from magic type, PL_magic_data.
Use it to eliminate the large switch statement in Perl_sv_magic(). As the table needs to be keyed on magic type, which is expressed as C character constants, the order depends on the compiler's character set. Frustratingly, EBCDIC variants don't agree on the code points for '~' and ']', which we use here. Instead of having (at least) 4 tables, get the local runtime to sort the table for us. Hence the regen script writes out the (unsorted) mg_raw.h, which generate_uudmap sorts to generate mg_data.h
Diffstat (limited to 'mg_raw.h')
-rw-r--r--mg_raw.h90
1 files changed, 90 insertions, 0 deletions
diff --git a/mg_raw.h b/mg_raw.h
new file mode 100644
index 0000000000..363e189b18
--- /dev/null
+++ b/mg_raw.h
@@ -0,0 +1,90 @@
+/* -*- buffer-read-only: t -*-
+ *
+ * mg_raw.h
+ * !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
+ * This file is built by regen/mg_vtable.pl.
+ * Any changes made here will be lost!
+ */
+
+ { '\0', "want_vtbl_sv",
+ "/* sv '\\0' Special scalar variable */" },
+ { 'A', "want_vtbl_amagic",
+ "/* overload 'A' %OVERLOAD hash */" },
+ { 'a', "want_vtbl_amagicelem",
+ "/* overload_elem 'a' %OVERLOAD hash element */" },
+ { 'c', "want_vtbl_ovrld",
+ "/* overload_table 'c' Holds overload table (AMT) on stash */" },
+ { 'B', "want_vtbl_regexp",
+ "/* bm 'B' Boyer-Moore (fast string search) */" },
+ { 'D', "want_vtbl_regdata",
+ "/* regdata 'D' Regex match position data (@+ and @- vars) */" },
+ { 'd', "want_vtbl_regdatum",
+ "/* regdatum 'd' Regex match position data element */" },
+ { 'E', "want_vtbl_env",
+ "/* env 'E' %ENV hash */" },
+ { 'e', "want_vtbl_envelem",
+ "/* envelem 'e' %ENV hash element */" },
+ { 'f', "want_vtbl_regdata",
+ "/* fm 'f' Formline ('compiled' format) */" },
+ { 'g', "want_vtbl_mglob",
+ "/* regex_global 'g' m//g target / study()ed string */" },
+ { 'H', "want_vtbl_hints",
+ "/* hints 'H' %^H hash */" },
+ { 'h', "want_vtbl_hintselem",
+ "/* hintselem 'h' %^H hash element */" },
+ { 'I', "want_vtbl_isa",
+ "/* isa 'I' @ISA array */" },
+ { 'i', "want_vtbl_isaelem",
+ "/* isaelem 'i' @ISA array element */" },
+ { 'k', "want_vtbl_nkeys",
+ "/* nkeys 'k' scalar(keys()) lvalue */" },
+ { 'L', "want_vtbl_dbline",
+ "/* dbfile 'L' Debugger %_<filename */" },
+ { 'l', "magic_vtable_max",
+ "/* dbline 'l' Debugger %_<filename element */" },
+ { 'o', "want_vtbl_collxfrm",
+ "/* collxfrm 'o' Locale transformation */" },
+ { 'P', "want_vtbl_pack",
+ "/* tied 'P' Tied array or hash */" },
+ { 'p', "want_vtbl_packelem",
+ "/* tiedelem 'p' Tied array or hash element */" },
+ { 'q', "want_vtbl_packelem",
+ "/* tiedscalar 'q' Tied scalar or handle */" },
+ { 'r', "want_vtbl_regexp",
+ "/* qr 'r' precompiled qr// regex */" },
+ { 'S', "magic_vtable_max",
+ "/* sig 'S' %SIG hash */" },
+ { 's', "want_vtbl_sigelem",
+ "/* sigelem 's' %SIG hash element */" },
+ { 't', "want_vtbl_taint",
+ "/* taint 't' Taintedness */" },
+ { 'U', "want_vtbl_uvar",
+ "/* uvar 'U' Available for use by extensions */" },
+ { 'v', "want_vtbl_vec",
+ "/* vec 'v' vec() lvalue */" },
+ { 'V', "magic_vtable_max",
+ "/* vstring 'V' SV was vstring literal */" },
+ { 'w', "want_vtbl_utf8",
+ "/* utf8 'w' Cached UTF-8 information */" },
+ { 'x', "want_vtbl_substr",
+ "/* substr 'x' substr() lvalue */" },
+ { 'y', "want_vtbl_defelem",
+ "/* defelem 'y' Shadow \"foreach\" iterator variable / smart parameter vivification */" },
+ { '#', "want_vtbl_arylen",
+ "/* arylen '#' Array length ($#ary) */" },
+ { '.', "want_vtbl_pos",
+ "/* pos '.' pos() lvalue */" },
+ { '<', "want_vtbl_backref",
+ "/* backref '<' for weak ref data */" },
+ { ':', "magic_vtable_max",
+ "/* symtab ':' extra data for symbol tables */" },
+ { '%', "magic_vtable_max",
+ "/* rhash '%' extra data for restricted hashes */" },
+ { '@', "magic_vtable_max",
+ "/* arylen_p '@' to move arylen out of XPVAV */" },
+ { '~', "magic_vtable_max",
+ "/* ext '~' Available for use by extensions */" },
+ { ']', "magic_vtable_max",
+ "/* checkcall ']' inlining/mutation of call to this CV */" },
+
+/* ex: set ro: */