From: Mike Guy Date: Mon, 14 Aug 2000 15:26:55 +0000 (+0100) Subject: Re: [PATCH] @+, @- readonly X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a29d06eddb19ab1d6c524328bb98500ebb28dcdb;p=p5sagit%2Fp5-mst-13.2.git Re: [PATCH] @+, @- readonly Message-Id: p4raw-id: //depot/perl@6620 --- diff --git a/embed.h b/embed.h index d40e270..ced6e9d 100644 --- a/embed.h +++ b/embed.h @@ -361,6 +361,7 @@ #define magic_nextpack Perl_magic_nextpack #define magic_regdata_cnt Perl_magic_regdata_cnt #define magic_regdatum_get Perl_magic_regdatum_get +#define magic_regdatum_set Perl_magic_regdatum_set #define magic_set Perl_magic_set #define magic_setamagic Perl_magic_setamagic #define magic_setarylen Perl_magic_setarylen @@ -1820,6 +1821,7 @@ #define magic_nextpack(a,b,c) Perl_magic_nextpack(aTHX_ a,b,c) #define magic_regdata_cnt(a,b) Perl_magic_regdata_cnt(aTHX_ a,b) #define magic_regdatum_get(a,b) Perl_magic_regdatum_get(aTHX_ a,b) +#define magic_regdatum_set(a,b) Perl_magic_regdatum_set(aTHX_ a,b) #define magic_set(a,b) Perl_magic_set(aTHX_ a,b) #define magic_setamagic(a,b) Perl_magic_setamagic(aTHX_ a,b) #define magic_setarylen(a,b) Perl_magic_setarylen(aTHX_ a,b) @@ -3569,6 +3571,8 @@ #define magic_regdata_cnt Perl_magic_regdata_cnt #define Perl_magic_regdatum_get CPerlObj::Perl_magic_regdatum_get #define magic_regdatum_get Perl_magic_regdatum_get +#define Perl_magic_regdatum_set CPerlObj::Perl_magic_regdatum_set +#define magic_regdatum_set Perl_magic_regdatum_set #define Perl_magic_set CPerlObj::Perl_magic_set #define magic_set Perl_magic_set #define Perl_magic_setamagic CPerlObj::Perl_magic_setamagic diff --git a/embed.pl b/embed.pl index 3e4c7d5..9353435 100755 --- a/embed.pl +++ b/embed.pl @@ -1680,6 +1680,7 @@ p |int |magic_mutexfree|SV* sv|MAGIC* mg p |int |magic_nextpack |SV* sv|MAGIC* mg|SV* key p |U32 |magic_regdata_cnt|SV* sv|MAGIC* mg p |int |magic_regdatum_get|SV* sv|MAGIC* mg +p |int |magic_regdatum_set|SV* sv|MAGIC* mg p |int |magic_set |SV* sv|MAGIC* mg p |int |magic_setamagic|SV* sv|MAGIC* mg p |int |magic_setarylen|SV* sv|MAGIC* mg diff --git a/mg.c b/mg.c index 0614099..95f20ad 100644 --- a/mg.c +++ b/mg.c @@ -373,13 +373,19 @@ Perl_magic_regdatum_get(pTHX_ SV *sv, MAGIC *mg) i = t; else /* @- */ i = s; - SvREADONLY_on(sv); sv_setiv(sv,i); } } return 0; } +int +Perl_magic_regdatum_set(pTHX_ SV *sv, MAGIC *mg) +{ + dTHR; + Perl_croak(aTHX_ PL_no_modify); +} + U32 Perl_magic_len(pTHX_ SV *sv, MAGIC *mg) { diff --git a/perl.h b/perl.h index 48e8801..1ab2d82 100644 --- a/perl.h +++ b/perl.h @@ -2852,7 +2852,8 @@ EXT MGVTBL PL_vtbl_defelem = {MEMBER_TO_FPTR(Perl_magic_getdefelem),MEMBER_TO_FP EXT MGVTBL PL_vtbl_regexp = {0,0,0,0, MEMBER_TO_FPTR(Perl_magic_freeregexp)}; EXT MGVTBL PL_vtbl_regdata = {0, 0, MEMBER_TO_FPTR(Perl_magic_regdata_cnt), 0, 0}; -EXT MGVTBL PL_vtbl_regdatum = {MEMBER_TO_FPTR(Perl_magic_regdatum_get), 0, 0, 0, 0}; +EXT MGVTBL PL_vtbl_regdatum = {MEMBER_TO_FPTR(Perl_magic_regdatum_get), + MEMBER_TO_FPTR(Perl_magic_regdatum_set), 0, 0, 0}; #ifdef USE_LOCALE_COLLATE EXT MGVTBL PL_vtbl_collxfrm = {0, diff --git a/proto.h b/proto.h index b3e5f99..841e32a 100644 --- a/proto.h +++ b/proto.h @@ -427,6 +427,7 @@ PERL_CALLCONV int Perl_magic_mutexfree(pTHX_ SV* sv, MAGIC* mg); PERL_CALLCONV int Perl_magic_nextpack(pTHX_ SV* sv, MAGIC* mg, SV* key); PERL_CALLCONV U32 Perl_magic_regdata_cnt(pTHX_ SV* sv, MAGIC* mg); PERL_CALLCONV int Perl_magic_regdatum_get(pTHX_ SV* sv, MAGIC* mg); +PERL_CALLCONV int Perl_magic_regdatum_set(pTHX_ SV* sv, MAGIC* mg); PERL_CALLCONV int Perl_magic_set(pTHX_ SV* sv, MAGIC* mg); PERL_CALLCONV int Perl_magic_setamagic(pTHX_ SV* sv, MAGIC* mg); PERL_CALLCONV int Perl_magic_setarylen(pTHX_ SV* sv, MAGIC* mg);