cvs commit: ponie/src/pmc perl5cargo_cult.pmc

[email protected] (Nicholas Clark) 14 Oct 2004 14:50:28 -0000
Newsgroups perl.ponie.changes
Message-ID <[email protected]>
cvsuser     04/10/14 07:50:28

  Modified:    perl     sv.h
               src/pmc  perl5cargo_cult.pmc
  Log:
  Move SvOK() macros to PMC calls.
  
  Revision  Changes    Path
  1.28      +4 -5      ponie/perl/sv.h
  
  Index: sv.h
  ===================================================================
  RCS file: /cvs/public/ponie/perl/sv.h,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -w -r1.27 -r1.28
  --- sv.h	14 Oct 2004 13:59:12 -0000	1.27
  +++ sv.h	14 Oct 2004 14:50:28 -0000	1.28
  @@ -422,6 +422,7 @@
   } Ponie_pointers;
   
   typedef enum {
  +  Ponie_I_SVf_OK,
     Ponie_I_SVf_IOK,
     Ponie_I_SVp_IOK,
     Ponie_I_SVpf_IOK,
  @@ -580,11 +581,9 @@
   #define assert_not_ROK(sv)	
   #endif
   
  -#define SvOK(sv)		(SvFLAGS(sv) & SVf_OK)
  -#define SvOK_off(sv)		(assert_not_ROK(sv)			\
  -				 SvFLAGS(sv) &=	~(SVf_OK|SVf_AMAGIC|	\
  -						  SVf_IVisUV|SVf_UTF8),	\
  -							SvOOK_off(sv))
  +#define SvOK(sv)		((U32)Parrot_PMC_get_intval_intkey(PL_Parrot,MUMBLE(sv), Ponie_I_SVf_OK))
  +#define SvOK_off(sv)		Parrot_PMC_set_intval_intkey(PL_Parrot,MUMBLE(sv), Ponie_I_SVf_OK, 0)
  +
   #define SvOK_off_exc_UV(sv)	(assert_not_ROK(sv)			\
   				 SvFLAGS(sv) &=	~(SVf_OK|SVf_AMAGIC|	\
   						  SVf_UTF8),		\
  
  
  
  1.17      +13 -1     ponie/src/pmc/perl5cargo_cult.pmc
  
  Index: perl5cargo_cult.pmc
  ===================================================================
  RCS file: /cvs/public/ponie/src/pmc/perl5cargo_cult.pmc,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -w -r1.16 -r1.17
  --- perl5cargo_cult.pmc	14 Oct 2004 13:59:13 -0000	1.16
  +++ perl5cargo_cult.pmc	14 Oct 2004 14:50:28 -0000	1.17
  @@ -1,7 +1,7 @@
   /* Perl5QQQ.pmc -*- c -*-
    *  Copyright: 2001-2004 The Perl Foundation.  All Rights Reserved.
    *  CVS Info
  - *     $Id: perl5cargo_cult.pmc,v 1.16 2004/10/14 13:59:13 nicholas Exp $
  + *     $Id: perl5cargo_cult.pmc,v 1.17 2004/10/14 14:50:28 nicholas Exp $
    *  Overview:
    *     These are the vtable functions for the Perl5QQQ base class
    *  Data Structure and Algorithms:
  @@ -61,6 +61,10 @@
   
       INTVAL get_integer_keyed_int(INTVAL key) {
   	switch (key) {
  +	case Ponie_I_SVf_OK:
  +	    return ((struct STRUCT_SV *)PMC_struct_val(SELF))->sv_flags
  +			 & SVf_OK;
  +
   	case Ponie_I_SVp_IOK:
   	    return ((struct STRUCT_SV *)PMC_struct_val(SELF))->sv_flags
   			 & SVp_IOK;
  @@ -98,6 +102,14 @@
   
       void set_integer_keyed_int(INTVAL key, INTVAL value) {
   	switch (key) {
  +	case Ponie_I_SVf_OK:
  +	    if (!value) {
  +		/* Only legal thing to do is turn this off.  */
  +	      assert_not_ROK(MUMBLE(SELF)) 0;
  +	      (((struct STRUCT_SV *)PMC_struct_val(SELF))->sv_flags)
  +		&= ~(SVf_OK|SVf_AMAGIC|SVf_IVisUV|SVf_UTF8);
  +	      SvOOK_off(MUMBLE(SELF));
  +	    }
   	case Ponie_I_SVp_IOK:
   	    (((struct STRUCT_SV *)PMC_struct_val(SELF))->sv_flags) &= ~SVp_IOK;
   	    if (value) {