cvsuser     04/02/10 02:08:12

  Modified:    build_tools build_nativecall.pl ops2c.pl
               classes  unmanagedstruct.pmc
               dynclasses subproxy.pmc
               io       io.c io_unix.c
  Log:
  pmc-accessors-2: patches a-i
  s. '[PATCH] Unified PMC/PObj accessors phase 2' ff
  
  Courtesy of Gordon Henriksen
  
  Revision  Changes    Path
  1.40      +9 -9      parrot/build_tools/build_nativecall.pl
  
  Index: build_nativecall.pl
  ===================================================================
  RCS file: /cvs/public/parrot/build_tools/build_nativecall.pl,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -w -r1.39 -r1.40
  --- build_nativecall.pl       10 Feb 2004 09:38:55 -0000      1.39
  +++ build_nativecall.pl       10 Feb 2004 10:08:01 -0000      1.40
  @@ -1,7 +1,7 @@
   #! perl -w
   ################################################################################
   # Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
  -# $Id: build_nativecall.pl,v 1.39 2004/02/10 09:38:55 leo Exp $
  +# $Id: build_nativecall.pl,v 1.40 2004/02/10 10:08:01 leo Exp $
   ################################################################################
   
   =head1 NAME
  @@ -125,8 +125,8 @@
                       P => "REG_PMC(5) = return_data;",
                    v => "",
                    t => "final_destination = string_from_cstring(interpreter, 
return_data, 0);\nREG_STR(5) = final_destination;",
  -#                b => "final_destination->bufstart = return_data;\nREG_STR(5) = 
final_destination",
  -#                B => "final_destination->bufstart = *return_data;\nREG_STR(5) = 
final_destination",
  +#                b => "PObj_bufstart(final_destination) = return_data;\nREG_STR(5) 
= final_destination",
  +#                B => "PObj_bufstart(final_destination) = *return_data;\nREG_STR(5) 
= final_destination",
                    s => "REG_INT(5) = return_data;",
                      );
   
  @@ -162,7 +162,7 @@
   /* nci.c
    *  Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
    *  CVS Info
  - *     $Id: build_nativecall.pl,v 1.39 2004/02/10 09:38:55 leo Exp $
  + *     $Id: build_nativecall.pl,v 1.40 2004/02/10 10:08:01 leo Exp $
    *  Overview:
    *     Native Call Interface routines. The code needed to build a
    *     parrot to C call frame is in here
  @@ -309,10 +309,10 @@
               return "string_to_cstring(interpreter, REG_STR($regnum))";
                 };
       /b/ && do {my $regnum = $reg_ref->{s}++;
  -            return "REG_STR($regnum)->bufstart";
  +            return "PObj_bufstart(REG_STR($regnum))";
                 };
       /B/ && do {my $regnum = $reg_ref->{s}++;
  -            return "&(REG_STR($regnum)->bufstart)";
  +            return "(&PObj_bufstart(REG_STR($regnum)))";
                 };
       /I/ && do {
               return "interpreter";
  @@ -371,7 +371,7 @@
       $other_decl
       $extra_preamble
   
  -    pointer =  (func_t)D2FPTR(self->cache.struct_val);
  +    pointer =  (func_t)D2FPTR(PMC_struct_val(self));
       $return_assign ($ret_type)(*pointer)($call_params);
       $final_assign
       $extra_postamble
  @@ -387,7 +387,7 @@
       $other_decl
       $extra_preamble
   
  -    pointer =  ($ret_type (*)(void))D2FPTR(self->cache.struct_val);
  +    pointer =  ($ret_type (*)(void))D2FPTR(PMC_struct_val(self));
       $return_assign ($ret_type)(*pointer)();
       $final_assign
       $extra_postamble
  @@ -420,7 +420,7 @@
       $ret_type (*pointer)();
       $ret_type return_data;
   
  -    pointer = self->cache.struct_val;
  +    pointer = PMC_struct_val(self);
       return_data = ($ret_type)(*pointer)($params);
       $ret_reg  = return_data;
       REG_INT(0) = $stack_returns;
  
  
  
  1.68      +2 -2      parrot/build_tools/ops2c.pl
  
  Index: ops2c.pl
  ===================================================================
  RCS file: /cvs/public/parrot/build_tools/ops2c.pl,v
  retrieving revision 1.67
  retrieving revision 1.68
  diff -u -w -r1.67 -r1.68
  --- ops2c.pl  20 Jan 2004 19:01:35 -0000      1.67
  +++ ops2c.pl  10 Feb 2004 10:08:01 -0000      1.68
  @@ -1,7 +1,7 @@
   #! perl -w
   ################################################################################
   # Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
  -# $Id: ops2c.pl,v 1.67 2004/01/20 19:01:35 mikescott Exp $
  +# $Id: ops2c.pl,v 1.68 2004/02/10 10:08:01 leo Exp $
   ################################################################################
   
   =head1 NAME
  @@ -682,7 +682,7 @@
   $load_func(Parrot_Interp interpreter)
   {
       PMC *lib = pmc_new(interpreter, enum_class_ParrotLibrary);
  -    lib->cache.struct_val = (void *) $init_func;
  +    PMC_struct_val(lib) = (void *) $init_func;
       dynop_register(interpreter, lib);
       return lib;
   }
  
  
  
  1.35      +2 -2      parrot/classes/unmanagedstruct.pmc
  
  Index: unmanagedstruct.pmc
  ===================================================================
  RCS file: /cvs/public/parrot/classes/unmanagedstruct.pmc,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -w -r1.34 -r1.35
  --- unmanagedstruct.pmc       6 Feb 2004 15:46:54 -0000       1.34
  +++ unmanagedstruct.pmc       10 Feb 2004 10:08:05 -0000      1.35
  @@ -1,7 +1,7 @@
   /*
    *  Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
    *  CVS Info
  - *     $Id: unmanagedstruct.pmc,v 1.34 2004/02/06 15:46:54 leo Exp $
  + *     $Id: unmanagedstruct.pmc,v 1.35 2004/02/10 10:08:05 leo Exp $
    *  Overview:
    *     PMC class to hold structs that parrot's not responsible for
    *     disposing of.
  @@ -198,7 +198,7 @@
            /* now check if initializer has a signature attached */
            init = PMC_pmc_val(pmc);
            ptr = VTABLE_get_pmc_keyed_int(interpreter, init, idx*3);
  -         if (ptr->pmc_ext && ptr->metadata) {
  +         if (ptr->pmc_ext && PMC_metadata(ptr)) {
                PMC *sig = VTABLE_getprop(interpreter, ptr,
                        string_from_cstring(interpreter, "_signature", 0));
                if (VTABLE_defined(interpreter, sig)) {
  
  
  
  1.3       +1 -1      parrot/dynclasses/subproxy.pmc
  
  Index: subproxy.pmc
  ===================================================================
  RCS file: /cvs/public/parrot/dynclasses/subproxy.pmc,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -w -r1.2 -r1.3
  --- subproxy.pmc      15 Dec 2003 15:12:52 -0000      1.2
  +++ subproxy.pmc      10 Feb 2004 10:08:08 -0000      1.3
  @@ -48,7 +48,7 @@
                internal_exception(1, "SubProxy: sub not found");
   
            PObj_get_FLAGS(SELF) &= ~PObj_private0_FLAG;
  -         SELF->cache.struct_val = rsub->cache.struct_val;
  +         PMC_struct_val(SELF) = PMC_struct_val(rsub);
            ((parrot_sub_t)(PMC_sub(SELF))) ->seg =
                    ((parrot_sub_t)(PMC_sub(rsub))) ->seg;
            ((parrot_sub_t)(PMC_sub(SELF))) ->end =
  
  
  
  1.80      +16 -16    parrot/io/io.c
  
  Index: io.c
  ===================================================================
  RCS file: /cvs/public/parrot/io/io.c,v
  retrieving revision 1.79
  retrieving revision 1.80
  diff -u -w -r1.79 -r1.80
  --- io.c      4 Feb 2004 15:46:47 -0000       1.79
  +++ io.c      10 Feb 2004 10:08:12 -0000      1.80
  @@ -1,6 +1,6 @@
   /*
   Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
  -$Id: io.c,v 1.79 2004/02/04 15:46:47 mikescott Exp $
  +$Id: io.c,v 1.80 2004/02/10 10:08:12 leo Exp $
   
   =head1 NAME
   
  @@ -70,9 +70,9 @@
       PMC_data(new_pmc) = io;
       /* io could be NULL */
       if(io)
  -       new_pmc->cache.struct_val = io->stack;
  +       PMC_struct_val(new_pmc) = io->stack;
       else
  -       new_pmc->cache.struct_val = NULL;
  +       PMC_struct_val(new_pmc) = NULL;
       return new_pmc;
   }
   
  @@ -178,7 +178,7 @@
       }
       mem_sys_free(io);
       PMC_data(pmc) = NULL;
  -    pmc->cache.struct_val = NULL;
  +    PMC_struct_val(pmc) = NULL;
   }
   
   /*
  @@ -719,7 +719,7 @@
   INTVAL
   PIO_setbuf(theINTERP, PMC *pmc, size_t bufsize)
   {
  -    ParrotIOLayer *layer = pmc->cache.struct_val;
  +    ParrotIOLayer *layer = PMC_struct_val(pmc);
       ParrotIO *io = PMC_data(pmc);
       if(!io)
           return -1;
  @@ -742,7 +742,7 @@
   INTVAL
   PIO_setlinebuf(theINTERP, PMC *pmc)
   {
  -    ParrotIOLayer *l = pmc->cache.struct_val;
  +    ParrotIOLayer *l = PMC_struct_val(pmc);
       ParrotIO *io = PMC_data(pmc);
       if(!io)
           return -1;
  @@ -838,7 +838,7 @@
   PIO_close(theINTERP, PMC *pmc)
   {
       INTVAL res;
  -    ParrotIOLayer *l = pmc->cache.struct_val;
  +    ParrotIOLayer *l = PMC_struct_val(pmc);
       ParrotIO *io = PMC_data(pmc);
       if(!io)
           return -1;
  @@ -863,7 +863,7 @@
   void
   PIO_flush(theINTERP, PMC *pmc)
   {
  -    ParrotIOLayer *l = pmc->cache.struct_val;
  +    ParrotIOLayer *l = PMC_struct_val(pmc);
       ParrotIO *io = PMC_data(pmc);
       if(!io)
           return;
  @@ -885,7 +885,7 @@
   INTVAL
   PIO_read(theINTERP, PMC *pmc, void *buffer, size_t len)
   {
  -    ParrotIOLayer *l = pmc->cache.struct_val;
  +    ParrotIOLayer *l = PMC_struct_val(pmc);
       ParrotIO *io = PMC_data(pmc);
       if(!io)
           return -1;
  @@ -907,7 +907,7 @@
   INTVAL
   PIO_write(theINTERP, PMC *pmc, const void *buffer, size_t len)
   {
  -    ParrotIOLayer *l = pmc->cache.struct_val;
  +    ParrotIOLayer *l = PMC_struct_val(pmc);
       ParrotIO *io = PMC_data(pmc);
       if(!io)
           return -1;
  @@ -934,7 +934,7 @@
   PIOOFF_T
   PIO_seek(theINTERP, PMC *pmc, PIOOFF_T offset, INTVAL w)
   {
  -    ParrotIOLayer *l = pmc->cache.struct_val;
  +    ParrotIOLayer *l = PMC_struct_val(pmc);
       ParrotIO *io = PMC_data(pmc);
       if(!io)
           return -1;
  @@ -956,7 +956,7 @@
   PIOOFF_T
   PIO_tell(theINTERP, PMC *pmc)
   {
  -    ParrotIOLayer *l = pmc->cache.struct_val;
  +    ParrotIOLayer *l = PMC_struct_val(pmc);
       ParrotIO *io = PMC_data(pmc);
       if(!io)
           return -1;
  @@ -1340,7 +1340,7 @@
   INTVAL
   PIO_poll(theINTERP, PMC *pmc, INTVAL which, INTVAL sec, INTVAL usec)
   {
  -    ParrotIOLayer *l = pmc->cache.struct_val;
  +    ParrotIOLayer *l = PMC_struct_val(pmc);
       ParrotIO *io = PMC_data(pmc);
       return PIO_poll_down(interpreter, l, io, which, sec, usec);
   }
  @@ -1386,7 +1386,7 @@
   INTVAL
   PIO_recv(theINTERP, PMC *pmc, STRING **buf)
   {
  -    ParrotIOLayer *l = pmc->cache.struct_val;
  +    ParrotIOLayer *l = PMC_struct_val(pmc);
       ParrotIO *io = PMC_data(pmc);
       if(!io)
           return -1;
  @@ -1408,7 +1408,7 @@
   INTVAL
   PIO_send(theINTERP, PMC *pmc, STRING *buf)
   {
  -    ParrotIOLayer *l = pmc->cache.struct_val;
  +    ParrotIOLayer *l = PMC_struct_val(pmc);
       ParrotIO *io = PMC_data(pmc);
       if(!io)
           return -1;
  @@ -1430,7 +1430,7 @@
   INTVAL
   PIO_connect(theINTERP, PMC *pmc, STRING *address)
   {
  -    ParrotIOLayer *l = pmc->cache.struct_val;
  +    ParrotIOLayer *l = PMC_struct_val(pmc);
       ParrotIO *io = PMC_data(pmc);
       if(!io)
           return -1;
  
  
  
  1.46      +7 -7      parrot/io/io_unix.c
  
  Index: io_unix.c
  ===================================================================
  RCS file: /cvs/public/parrot/io/io_unix.c,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -w -r1.45 -r1.46
  --- io_unix.c 4 Feb 2004 15:46:47 -0000       1.45
  +++ io_unix.c 10 Feb 2004 10:08:12 -0000      1.46
  @@ -1,6 +1,6 @@
   /*
   Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
  -$Id: io_unix.c,v 1.45 2004/02/04 15:46:47 mikescott Exp $
  +$Id: io_unix.c,v 1.46 2004/02/10 10:08:12 leo Exp $
   
   =head1 NAME
   
  @@ -621,8 +621,8 @@
   
       /* XXX: Fixme, inet_addr obsolete, replace with inet_aton */
       char * s = string_to_cstring(interpreter, addr);
  -    /*if(inet_aton(s, &sa.sin_addr) != 0) {*/
  -    if(inet_pton(family, s, &sa.sin_addr) != 0) {
  +    if(inet_aton(s, &sa.sin_addr) != 0) {
  +    /*if(inet_pton(family, s, &sa.sin_addr) != 0) {*/
           /* Success converting numeric IP */
       }
       else {
  @@ -695,7 +695,7 @@
   {
       if(r) {
           struct sockaddr_in sa;
  -        memcpy(&sa, r->bufstart, sizeof(struct sockaddr));
  +        memcpy(&sa, PObj_bufstart(r), sizeof(struct sockaddr));
           io->remote.sin_addr.s_addr = sa.sin_addr.s_addr;
           io->remote.sin_port = sa.sin_port;
       }
  @@ -740,7 +740,7 @@
       struct sockaddr_in sa;
       if(!l) return -1;
   
  -    memcpy(&sa, l->bufstart, sizeof(struct sockaddr));
  +    memcpy(&sa, PObj_bufstart(l), sizeof(struct sockaddr));
       io->local.sin_addr.s_addr = sa.sin_addr.s_addr;
       io->local.sin_port = sa.sin_port;
   
  @@ -839,8 +839,8 @@
       /*
        * Ignore encoding issues for now.
        */
  -    if((error = send(io->fd, (char *)s->bufstart + byteswrote,
  -                            s->buflen, 0)) >= 0) {
  +    if((error = send(io->fd, (char *)PObj_bufstart(s) + byteswrote,
  +                            PObj_buflen(s), 0)) >= 0) {
           byteswrote += error;
           if(byteswrote >= bytes) {
               return byteswrote;
  
  
  

Reply via email to