summaryrefslogtreecommitdiff
path: root/mg_vtable.h
Commit message (Collapse)AuthorAgeFilesLines
* [perl #29070] Add vstring set-magicFather Chrysostomos2011-12-231-2/+6
| | | | | | | | | | | | Some operators, like pp_complement, assign their argument to TARG (which copies vstring magic), modify it in place, and then call set- magic. That’s supposed to work, but vstring magic was remaining as it was, such that ~v7 would still be treated as "v7" by vstring-aware code, even though the resulting string is not "\7". This commit adds vstring set-magic that checks to see whether the pv still matches the vstring. It cannot simply free the vstring magic, as that would prevent $x=v0 from working.
* Split out study magic from pos magic.Nicholas Clark2011-07-011-1/+2
| | | | | | study uses magic to call SvSCREAM_off() if the scalar is modified. Allocate it its own magic type ('G' for now - pos magic is 'g'). Share the same "set" routine and vtable as regexp/bm/fm (setregxp and vtbl_regexp).
* Sort magic and magic vtable names in files generated by mg_vtable.plNicholas Clark2011-06-111-73/+73
| | | | | Magic is sorted case insensitively, with upper case before lower case. vtable names are all lowercase letters.
* Generate the PERL_MAGIC_* defines using mg_vtable.pl.Nicholas Clark2011-06-111-0/+52
|
* Provide the names of the magic vtables in PL_magic_vtable_names[].Nicholas Clark2011-06-111-0/+37
| | | | | | As it's a 1 to 1 mapping with the vtables in PL_magic_vtables[], refactor Perl_do_magic_dump() to index into it directly to find the name for an arbitrary mg_virtual, avoiding a long switch statement.
* PL_vtbl_{bm,fm} can be aliases to PL_vtbl_regexp, instead of copies.Nicholas Clark2011-06-111-4/+3
| | | | | They became copies in 488344d27a84a21a, which merged Perl_magic_setbm() and Perl_magic_setfm() into Perl_magic_setregexp().
* Refactor Perl_get_vtbl() to a small array lookup from a large switch statement.Nicholas Clark2011-06-111-3/+4
| | | | Provide magic_vtable_max, the number of elements in PL_magic_vtables[].
* Replace PL_vtbl_* with an array PL_magic_vtables.Nicholas Clark2011-06-111-222/+73
| | | | | | Define each PL_vtbl_* name as a macro which expands to the correct array element. Using a single array instead of multiple named variables will allow the simplification of various pieces of code.
* Generate the enum for want_vtbl_* with regen/mg_vtable.plNicholas Clark2011-06-111-0/+35
|
* Move the work of MGVTBL_SET() from the C pre-processor to mg_vtable.plNicholas Clark2011-06-111-385/+224
| | | | | | Generating mg_vtable.h with MGVTBL_SET() effectively pre-expanded makes things clearer. This eliminates use of the macro MGVTBL_SET(), which can be deleted as nothing outside the core is relying on it.
* Move the cast for a magic vtable with const get into mg_vtable.hNicholas Clark2011-06-111-2/+2
| | | | | | Putting the cast inside the initialiser (the only initialiser using it) eliminates use of the macro MGVTBL_SET_CONST_MAGIC_GET(), which can be deleted as nothing outside the core is relying on it.
* Generate the definitions for magic vtables from data in a regen script.Nicholas Clark2011-06-111-0/+416
Previously perl.h contained a long section of MGVTBL_SET() macros declaring the core's various magic vtables. Convert the information into data structures in a new script regen/mg_table.pl, and use this to generate a new file mg_vtable.h, included by perl.h This is the first step in reducing the number of places that data relating to magic vtables is declared (and has to be kept in sync), and will allow more flexibility in parts of the core's implementation.