cvsuser     04/10/18 18:25:36

  Modified:    classes  integer.pmc undef.pmc
               t/pmc    undef.t
  Log:
  I have started a test script for the Integer PMC. In that process I found
  strangeness in get_string(). set_integer_native() can be inherited from the
  Scalar PMC.
  
  For the Undef PMC I fixed an error in set_number_native().
  
  Courtesy of Bernhard Schmalhofer <[EMAIL PROTECTED]>
  
  Revision  Changes    Path
  1.18      +5 -8      parrot/classes/integer.pmc
  
  Index: integer.pmc
  ===================================================================
  RCS file: /cvs/public/parrot/classes/integer.pmc,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -w -r1.17 -r1.18
  --- integer.pmc       3 Jul 2004 19:50:13 -0000       1.17
  +++ integer.pmc       19 Oct 2004 01:25:35 -0000      1.18
  @@ -1,6 +1,6 @@
   /*
   Copyright: 2003 The Perl Foundation.  All Rights Reserved.
  -$Id: integer.pmc,v 1.17 2004/07/03 19:50:13 leo Exp $
  +$Id: integer.pmc,v 1.18 2004/10/19 01:25:35 dan Exp $
   
   =head1 NAME
   
  @@ -94,20 +94,17 @@
   
   /*
   
  -=item C<void set_integer_native(INTVAL value)>
  +=item C<void init()>
  +
  +Initializes the integer.
   
   =cut
   
   */
  -
       void init () {
           PMC_int_val(SELF) = 0;
       }
   
  -    void set_integer_native(INTVAL value) {
  -        PMC_int_val(SELF) = value;
  -    }
  -
   /*
   
   =item C<void set_number_native(FLOATVAL value)>
  @@ -204,7 +201,7 @@
   */
   
       STRING* get_string() {
  -        return string_from_num(INTERP, PMC_int_val(SELF));
  +        return string_from_int(INTERP, PMC_int_val(SELF));
       }
   
   /*
  
  
  
  1.10      +2 -2      parrot/classes/undef.pmc
  
  Index: undef.pmc
  ===================================================================
  RCS file: /cvs/public/parrot/classes/undef.pmc,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -w -r1.9 -r1.10
  --- undef.pmc 29 Aug 2004 23:01:55 -0000      1.9
  +++ undef.pmc 19 Oct 2004 01:25:35 -0000      1.10
  @@ -1,6 +1,6 @@
   /*
   Copyright: 2004 The Perl Foundation.  All Rights Reserved.
  -$Id: undef.pmc,v 1.9 2004/08/29 23:01:55 dan Exp $
  +$Id: undef.pmc,v 1.10 2004/10/19 01:25:35 dan Exp $
   
   =head1 NAME
   
  @@ -61,7 +61,7 @@
   
     void set_number_native(FLOATVAL value) {
       VTABLE_morph(INTERP, SELF, enum_class_Float);
  -    VTABLE_set_integer_native(INTERP, SELF, value);
  +    VTABLE_set_number_native(INTERP, SELF, value);
     }
   
     STRING* get_string() {
  
  
  
  1.4       +46 -2     parrot/t/pmc/undef.t
  
  Index: undef.t
  ===================================================================
  RCS file: /cvs/public/parrot/t/pmc/undef.t,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -w -r1.3 -r1.4
  --- undef.t   29 Aug 2004 23:01:57 -0000      1.3
  +++ undef.t   19 Oct 2004 01:25:36 -0000      1.4
  @@ -1,6 +1,6 @@
   #! perl -w
   # Copyright: 2001-2004 The Perl Foundation.  All Rights Reserved.
  -# $Id: undef.t,v 1.3 2004/08/29 23:01:57 dan Exp $
  +# $Id: undef.t,v 1.4 2004/10/19 01:25:36 dan Exp $
   
   =head1 NAME
   
  @@ -16,7 +16,7 @@
   
   =cut
   
  -use Parrot::Test tests => 8;
  +use Parrot::Test tests => 10;
   use Test::More qw(skip);
   
   output_is(<<'CODE', <<'OUTPUT', "morph to string");
  @@ -121,6 +121,50 @@
   OUTPUT
   
   
  +output_is(<<'CODE', <<'OUTPUT', "morph to float");
  +##PIR##
  +.sub _main
  +    .local pmc pmc1
  +    pmc1 = new Undef
  +    .local int int1
  +    int1 = pmc1
  +    .local num float1
  +    float1 = -7777777e-3
  +    float1 += int1
  +    print float1
  +    print "\n"
  +    end
  +.end
  +CODE
  +-7777.777000
  +OUTPUT
  +
  +
  +output_is(<<'CODE', <<'OUTPUT', "set_integer_native");
  +##PIR##
  +.sub _main
  +    .local pmc pmc1
  +    pmc1 = new Undef
  +    pmc1 = -88888888
  +    print pmc1
  +    print "\n"
  +
  +    .local int pmc1_is_a
  +    pmc1_is_a = isa pmc1, "Integer"
  +    print "After assignment pmc1 is "
  +    if pmc1_is_a goto PMC1_IS_A_INTEGER
  +      print "not "
  +    PMC1_IS_A_INTEGER:
  +    print "an Integer.\n"
  +
  +    end
  +.end
  +CODE
  +-88888888
  +After assignment pmc1 is an Integer.
  +OUTPUT
  +
  +
   output_is(<<'CODE', <<'OUTPUT', "isa");
   ##PIR##
   .sub _main
  
  
  

Reply via email to