summaryrefslogtreecommitdiff
path: root/regen/mg_vtable.pl
Commit message (Collapse)AuthorAgeFilesLines
* Split out study magic from pos magic.Nicholas Clark2011-07-011-2/+3
| | | | | | 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).
* [perl #92906] perl -d has non-functional b commandFather Chrysostomos2011-06-151-2/+3
| | | | | | | | | This fixes a regression introduced after 5.14.0. Commit 6f83ef0e5a4 got dbfile and dbline magic mixed up and ended up apply set-magic to the hash (dbfile), not to the element (dbline). The result was that debugger breakpoints simply did not work at all.
* Generate the table of core magic types in perlguts.pod using mg_vtable.plNicholas Clark2011-06-121-0/+42
| | | | | | | | | | | This fixes a couple of errors and omissions, and resorts the table in the same case insensitive order as the header files. It eliminates 1 overlong verbatim line of pod. As there's no good way to include component files into the core pods, and the regen scripts aren't designed to modify in place, generate this to STDOUT (if -g is added to the command line), to be hand edited into place. It would be nice to be able to automate this fully.
* In regen/mg_vtable.pl, move $longest inside the only block that uses it.Nicholas Clark2011-06-121-5/+5
|
* Sort magic and magic vtable names in files generated by mg_vtable.plNicholas Clark2011-06-111-8/+17
| | | | | Magic is sorted case insensitively, with upper case before lower case. vtable names are all lowercase letters.
* Generate magic_names in dump.c using mg_vtable.pl.Nicholas Clark2011-06-111-6/+10
|
* Generate the PERL_MAGIC_* defines using mg_vtable.pl.Nicholas Clark2011-06-111-2/+27
|
* In PL_magic_data flag whether magic can be added to a readonly value.Nicholas Clark2011-06-111-3/+8
| | | | | | | | | | | | | | | Use this to simplify the logic in Perl_sv_magic(). This introduces a small change of behaviour for error cases involving unknown magic types. Previously, if Perl_sv_magic() was passed a magic type unknown to it, it would 1: Croak "Modification of a read-only value attempted" if read only 2: Return without error if the SV happened to already have this magic 3: otherwise croak "Don't know how to handle magic of type \\%o" Now it will always croak "Don't know how to handle magic of type \\%o", even on read only values, or SVs which already have the unknown magic type.
* Store a flag for container/value magic in PL_magic_data.Nicholas Clark2011-06-111-22/+38
| | | | Use this to replace S_is_container_magic() in mg.c with a direct lookup.
* Create a lookup table for magic vtables from magic type, PL_magic_data.Nicholas Clark2011-06-111-12/+106
| | | | | | | | | | | 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
* Provide the names of the magic vtables in PL_magic_vtable_names[].Nicholas Clark2011-06-111-4/+13
| | | | | | 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.
* Replace references to PL_vtbl_{bm,fm} in the code with PL_vtbl_regexp.Nicholas Clark2011-06-111-1/+1
| | | | | Also, in Perl_sv_magic() merge the case for PERL_MAGIC_dbfile with the others that return a NULL vtable.
* PL_vtbl_{bm,fm} can be aliases to PL_vtbl_regexp, instead of copies.Nicholas Clark2011-06-111-3/+7
| | | | | 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-2/+3
| | | | 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-8/+24
| | | | | | 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/+11
|
* Move the work of MGVTBL_SET() from the C pre-processor to mg_vtable.plNicholas Clark2011-06-111-7/+8
| | | | | | 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-3/+5
| | | | | | 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/+102
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.