summaryrefslogtreecommitdiff
path: root/mg_raw.h
Commit message (Collapse)AuthorAgeFilesLines
* Correct fm vtable in perlguts.podFather Chrysostomos2012-09-251-1/+1
| | | | | | fm magic uses want_vtbl_fm, which is #defined as want_vtbl_regexp. The definition in regen/mg_vtable.pl does not affect anything except the documentation. It was listed as using regdata which was wrong.
* Add proto magic typeFather Chrysostomos2012-09-151-0/+2
| | | | | | | | This will be used for storing the prototype CV of a ‘my’ sub. The clone needs to occupy the pad entry so that padcv ops will be able to find it. That means the clone has to displace its prototype. In case the same sub is called recursively, we still need to be able to access the prototype.
* Flatten vstrings modified in placeFather Chrysostomos2012-07-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A substitution forces its target to a string upon successful substitu- tion, even if the substitution did nothing: $ ./perl -Ilib -le '$a = *f; $a =~ s/f/f/; print ref \$a' SCALAR Notice that $a is no longer a glob after s///. But vstrings are different: $ ./perl -Ilib -le '$a = v102; $a =~ s/f/f/; print ref \$a' VSTRING I fixed this in 5.16 (1e6bda93) for those cases where the vstring ends up with a value that doesn’t correspond to the actual string: $ ./perl -Ilib -le '$a = v102; $a =~ s/f/o/; print ref \$a' SCALAR It works through vstring set-magic, that does the check and removes the magic if it doesn’t match. I did it that way because I couldn’t think of any other way to fix bug #29070, and I didn’t realise at the time that I hadn’t fixed all the bugs. By making SvTHINKFIRST true on a vstring, we force it through sv_force_normal before any in-place string operations. We can also make sv_force_normal handle vstrings as well. This fixes all the lin- gering-vstring-magic bugs in just two lines, making the vstring set- magic (which is also slow) redundant. It also allows the special case in sv_setsv_flags to be removed. Or at least that was what I had hoped. It turns out that pp_subst, twists and turns in tortuous ways, and needs special treatment for things like this. And do_trans functions wasn’t checking SvTHINKFIRST when arguably it should have. I tweaked sv_2pv{utf8,byte} to avoid copying magic variables that do not need copying.
* Expunge study magicFather Chrysostomos2012-05-291-2/+0
| | | | I’m running out of synonyms for ‘remove’.
* Annihilate ‘A’ magicFather Chrysostomos2012-05-211-4/+0
| | | | | | | | | How ironic! Overloading is called ‘A’ magic internally all over the place, because of the letter used as its magic type. But now it does not even use that magic. I left a comment in mg_vtable.pl, so that future maintainers will have some clue as to what AMAGIC means.
* Copy call checker when cloning closure prototypeFather Chrysostomos2012-05-211-1/+1
| | | | | Otherwise cv_set_call_checker has no effect inside an attribute han- dler for a closure.
* [perl #29070] Add vstring set-magicFather Chrysostomos2011-12-231-1/+1
| | | | | | | | | | | | 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/+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/+2
| | | | | | | | | 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.
* Sort magic and magic vtable names in files generated by mg_vtable.plNicholas Clark2011-06-111-18/+18
| | | | | Magic is sorted case insensitively, with upper case before lower case. vtable names are all lowercase letters.
* In PL_magic_data flag whether magic can be added to a readonly value.Nicholas Clark2011-06-111-5/+5
| | | | | | | | | | | | | | | 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-20/+20
| | | | 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-0/+90
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