cvs commit: ponie/src/pmc perl5cargo_cult.pmc

[email protected] (Nicholas Clark) 22 Jun 2004 16:19:49 -0000
Newsgroups perl.ponie.changes
Message-ID <[email protected]>
cvsuser     04/06/22 09:19:48

  Modified:    src/pmc  perl5cargo_cult.pmc
  Log:
  Get the RV's location via a get_pointer_intkey call on the PMC.
  
  Revision  Changes    Path
  1.9       +18 -5     ponie/src/pmc/perl5cargo_cult.pmc
  
  Index: perl5cargo_cult.pmc
  ===================================================================
  RCS file: /cvs/public/ponie/src/pmc/perl5cargo_cult.pmc,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -w -r1.8 -r1.9
  --- perl5cargo_cult.pmc	22 Jun 2004 15:19:44 -0000	1.8
  +++ perl5cargo_cult.pmc	22 Jun 2004 16:19:48 -0000	1.9
  @@ -1,7 +1,7 @@
   /* Perl5QQQ.pmc -*- c -*-
    *  Copyright: 2001-2004 The Perl Foundation.  All Rights Reserved.
    *  CVS Info
  - *     $Id: perl5cargo_cult.pmc,v 1.8 2004/06/22 15:19:44 nicholas Exp $
  + *     $Id: perl5cargo_cult.pmc,v 1.9 2004/06/22 16:19:48 nicholas Exp $
    *  Overview:
    *     These are the vtable functions for the Perl5QQQ base class
    *  Data Structure and Algorithms:
  @@ -22,19 +22,32 @@
       void init () {	
           PObj_active_destroy_SET(SELF);
   	PMC_struct_val(SELF) = malloc(sizeof(struct STRUCT_SV));
  +	PMC_pmc_val(SELF) = NULL;
  +    }
  +
  +    void destroy () {
  +        free(PMC_struct_val(SELF));
       }
   
       void init_pmc (PMC* initializer) {
   	abort();
       }
   
  -
       void* get_pointer() {
           return PMC_struct_val(SELF);
       }
   
  -    void destroy () {
  -        free(PMC_struct_val(SELF));
  +    void* get_pointer_keyed_int(INTVAL key) {
  +	switch (key) {
  +	case Ponie_P_ANY:
  +	    return PMC_struct_val(SELF);
  +	case Ponie_P_RV:
  +	    /*return &(PMC_pmc_val(SELF));*/
  +	    return &(((struct xrv*)((struct STRUCT_SV *)PMC_struct_val(SELF))->sv_any)->xrv_rv);
  +	    /*default:
  +	      Can't easily croak.  */
  +	    /*croak ("Out of range key %d (max is %d)", key, Ponie_P_MAX - 1);*/
  +	}
  +	return 0;
       }
  -
   }