cvsuser     04/05/07 03:33:41

  Modified:    classes  compiler.pmc nci.pmc unmanagedstruct.pmc
               ops      core.ops
               src      inter_misc.c
               t/pmc    nci.t
  Log:
  fix NCI related DOD problem
  
  Revision  Changes    Path
  1.18      +2 -2      parrot/classes/compiler.pmc
  
  Index: compiler.pmc
  ===================================================================
  RCS file: /cvs/public/parrot/classes/compiler.pmc,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -w -r1.17 -r1.18
  --- compiler.pmc      22 Feb 2004 17:48:41 -0000      1.17
  +++ compiler.pmc      7 May 2004 10:33:26 -0000       1.18
  @@ -1,6 +1,6 @@
   /*
   Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
  -$Id: compiler.pmc,v 1.17 2004/02/22 17:48:41 mikescott Exp $
  +$Id: compiler.pmc,v 1.18 2004/05/07 10:33:26 leo Exp $
   
   =head1 NAME
   
  
  
  
  1.27      +8 -8      parrot/classes/nci.pmc
  
  Index: nci.pmc
  ===================================================================
  RCS file: /cvs/public/parrot/classes/nci.pmc,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -w -r1.26 -r1.27
  --- nci.pmc   22 Feb 2004 17:48:41 -0000      1.26
  +++ nci.pmc   7 May 2004 10:33:26 -0000       1.27
  @@ -1,6 +1,6 @@
   /*
   Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
  -$Id: nci.pmc,v 1.26 2004/02/22 17:48:41 mikescott Exp $
  +$Id: nci.pmc,v 1.27 2004/05/07 10:33:26 leo Exp $
   
   =head1 NAME
   
  @@ -43,18 +43,18 @@
   
   /*
   
  -=item C<void set_string_keyed(PMC *func, STRING *value)>
  +=item C<void set_pointer_keyed_str(STRING *key, void *func)>
   
  -Sets the specified function pointer and signature (C<*value>).
  +Sets the specified function pointer and signature (C<*key>).
   
   =cut
   
   */
   
  -    void set_string_keyed (PMC* func, STRING* value) {
  -        /* key = func_ptr, value = signature */
  -        PMC_struct_val(SELF) = (DPOINTER *)func;
  -        PMC_data(SELF) = build_call_func(INTERP, SELF, value);
  +    void set_pointer_keyed_str(STRING *key, void *func) {
  +        /* key = signature */
  +        PMC_struct_val(SELF) = func;
  +        PMC_data(SELF) = build_call_func(INTERP, SELF, key);
       }
   
   /*
  
  
  
  1.43      +23 -23    parrot/classes/unmanagedstruct.pmc
  
  Index: unmanagedstruct.pmc
  ===================================================================
  RCS file: /cvs/public/parrot/classes/unmanagedstruct.pmc,v
  retrieving revision 1.42
  retrieving revision 1.43
  diff -u -w -r1.42 -r1.43
  --- unmanagedstruct.pmc       6 May 2004 15:07:06 -0000       1.42
  +++ unmanagedstruct.pmc       7 May 2004 10:33:26 -0000       1.43
  @@ -1,6 +1,6 @@
   /*
   Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
  -$Id: unmanagedstruct.pmc,v 1.42 2004/05/06 15:07:06 leo Exp $
  +$Id: unmanagedstruct.pmc,v 1.43 2004/05/07 10:33:26 leo Exp $
   
   =head1 NAME
   
  @@ -318,8 +318,8 @@
                   if (VTABLE_defined(interpreter, sig)) {
                       STRING *sig_str = VTABLE_get_string(interpreter, sig);
                       ret = pmc_new(interpreter, enum_class_NCI);
  -                    VTABLE_set_string_keyed(interpreter, ret,
  -                        *(PMC**)p, sig_str);
  +                    VTABLE_set_pointer_keyed_str(interpreter, ret, sig_str,
  +                            *(PMC**)p);
                   }
               }
               return ret;
  @@ -333,7 +333,7 @@
              if (ptr->pmc_ext && PMC_metadata( ptr ))
                        {
                   ret = VTABLE_getprop( interpreter, ptr,
  -                    string_from_cstring(interpreter, "_struct", 0 ));
  +                        const_string(interpreter, "_struct"));
                        }
                        else
                        {
  
  
  
  1.360     +1 -1      parrot/ops/core.ops
  
  Index: core.ops
  ===================================================================
  RCS file: /cvs/public/parrot/ops/core.ops,v
  retrieving revision 1.359
  retrieving revision 1.360
  diff -u -w -r1.359 -r1.360
  --- core.ops  23 Apr 2004 09:21:08 -0000      1.359
  +++ core.ops  7 May 2004 10:33:35 -0000       1.360
  @@ -1120,7 +1120,7 @@
     }
     else {
         $1 = nci = pmc_new(interpreter, enum_class_NCI);
  -      nci->vtable->set_string_keyed(interpreter, nci, (PMC*)F2DPTR(p), $4);
  +      nci->vtable->set_pointer_keyed_str(interpreter, nci, $4, F2DPTR(p));
     }
     string_cstring_free(name);
     goto NEXT();
  
  
  
  1.2       +6 -5      parrot/src/inter_misc.c
  
  Index: inter_misc.c
  ===================================================================
  RCS file: /cvs/public/parrot/src/inter_misc.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -w -r1.1 -r1.2
  --- inter_misc.c      5 May 2004 13:10:35 -0000       1.1
  +++ inter_misc.c      7 May 2004 10:33:39 -0000       1.2
  @@ -1,6 +1,6 @@
   /*
   Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
  -$Id: inter_misc.c,v 1.1 2004/05/05 13:10:35 leo Exp $
  +$Id: inter_misc.c,v 1.2 2004/05/07 10:33:39 leo Exp $
   
   =head1 NAME
   
  @@ -66,9 +66,10 @@
       method_table = table[type];
   
       method = pmc_new(interpreter, enum_class_NCI);
  -    VTABLE_set_string_keyed(interpreter, method, func,
  +    VTABLE_set_pointer_keyed_str(interpreter, method,
               string_make(interpreter, proto, strlen(proto),
  -                "iso-8859-1", PObj_constant_FLAG|PObj_external_FLAG));
  +                "iso-8859-1", PObj_constant_FLAG|PObj_external_FLAG),
  +            func);
       VTABLE_set_pmc_keyed_str(interpreter, method_table,
               string_make(interpreter, name,
                   strlen(name), "iso-8859-1",
  @@ -103,8 +104,8 @@
       nci = pmc_new(interpreter, enum_class_Compiler);
       VTABLE_set_pmc_keyed_str(interpreter, hash, type, nci);
       /* build native call interface fir the C sub in "func" */
  -    VTABLE_set_string_keyed(interpreter, nci, func,
  -            string_from_cstring(interpreter, "pIt", 0));
  +    VTABLE_set_pointer_keyed_str(interpreter, nci,
  +            const_string(interpreter, "pIt"), func);
   }
   
   
  
  
  
  1.42      +2 -30     parrot/t/pmc/nci.t
  
  Index: nci.t
  ===================================================================
  RCS file: /cvs/public/parrot/t/pmc/nci.t,v
  retrieving revision 1.41
  retrieving revision 1.42
  diff -u -w -r1.41 -r1.42
  --- nci.t     6 May 2004 15:07:15 -0000       1.41
  +++ nci.t     7 May 2004 10:33:41 -0000       1.42
  @@ -1,6 +1,6 @@
   #! perl -w
   # Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
  -# $Id: nci.t,v 1.41 2004/05/06 15:07:15 leo Exp $
  +# $Id: nci.t,v 1.42 2004/05/07 10:33:41 leo Exp $
   
   =head1 NAME
   
  @@ -17,7 +17,7 @@
   
   =cut
   
  -use Parrot::Test tests => 34;
  +use Parrot::Test tests => 33;
   use Parrot::Config;
   
   SKIP: {
  @@ -655,34 +655,6 @@
   77
   OUTPUT
   
  -output_is(<<'CODE', <<'OUTPUT', "nci_p_i - func_ptr*");
  -  loadlib P1, "libnci"
  -  dlfunc P0, P1, "nci_pi", "pi"
  -  # this test function returns a struct { int (*f)(char *) }
  -  set I5, 5
  -  invoke
  -  new P2, .PerlArray
  -.include "datatypes.pasm"
  -  push P2, .DATATYPE_FUNC_PTR
  -  push P2, 0
  -  push P2, 0
  -  assign P5, P2
  -  # P1 isnt a real PMC, its only suited for passing on to
  -  # the NCI PMC as a Key
  -  set P1, P5[0]
  -  # if no signatur was given, do it manually
  -  # s. below for another method
  -  new P0, .NCI
  -  set P0[P1], "it"
  -  set S5, "hello call_back"
  -  invoke
  -  print I5
  -  print "\n"
  -  end
  -CODE
  -hello call_back
  -4711
  -OUTPUT
   
   output_is(<<'CODE', <<'OUTPUT', "nci_p_i - func_ptr* with signature");
     loadlib P1, "libnci"
  
  
  

Reply via email to