cvsuser     04/10/14 02:07:09

  Modified:    classes  perlstring.pmc
               lib/Parrot Pmc2c.pm
               t/pmc    perlstring.t
  Log:
  cleanup 31975
  * create prototypes for methods
  * remove warnings
  * rewrite SELF, INTERP in methods
  * short test
  
  Revision  Changes    Path
  1.89      +2 -2      parrot/classes/perlstring.pmc
  
  Index: perlstring.pmc
  ===================================================================
  RCS file: /cvs/public/parrot/classes/perlstring.pmc,v
  retrieving revision 1.88
  retrieving revision 1.89
  diff -u -w -r1.88 -r1.89
  --- perlstring.pmc    14 Oct 2004 08:11:44 -0000      1.88
  +++ perlstring.pmc    14 Oct 2004 09:07:07 -0000      1.89
  @@ -1,6 +1,6 @@
   /*
   Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
  -$Id: perlstring.pmc,v 1.88 2004/10/14 08:11:44 leo Exp $
  +$Id: perlstring.pmc,v 1.89 2004/10/14 09:07:07 leo Exp $
   
   =head1 NAME
   
  @@ -37,7 +37,7 @@
   */
   
       METHOD PMC* lower() {
  -        STRING *s = string_downcase(interpreter, PMC_str_val(pmc));
  +        STRING *s = string_downcase(interpreter, PMC_str_val(SELF));
           PMC *ret = pmc_new(interpreter, enum_class_PerlString);
           string_set(interpreter, PMC_str_val(ret), s);
           return ret;
  
  
  
  1.43      +11 -2     parrot/lib/Parrot/Pmc2c.pm
  
  Index: Pmc2c.pm
  ===================================================================
  RCS file: /cvs/public/parrot/lib/Parrot/Pmc2c.pm,v
  retrieving revision 1.42
  retrieving revision 1.43
  diff -u -w -r1.42 -r1.43
  --- Pmc2c.pm  14 Oct 2004 08:11:46 -0000      1.42
  +++ Pmc2c.pm  14 Oct 2004 09:07:08 -0000      1.43
  @@ -1,5 +1,5 @@
   # Copyright: 2004 The Perl Foundation.  All Rights Reserved.
  -# $Id: Pmc2c.pm,v 1.42 2004/10/14 08:11:46 leo Exp $
  +# $Id: Pmc2c.pm,v 1.43 2004/10/14 09:07:08 leo Exp $
   
   =head1 NAME
   
  @@ -269,7 +269,8 @@
            push @{ $const->{methods} }, {
                meth => "$meth",
                type => $entry->{type},
  -             parameters => $entry->{parameters}
  +             parameters => $entry->{parameters},
  +                loc => $entry->{loc}
            };
        }
           else {
  @@ -449,6 +450,10 @@
   sub rewrite_nci_method ($$$) {
       my ($class, $method) = @_;
       local $_ = $_[2];
  +    # Rewrite SELF -> pmc, INTERP -> interpreter
  +    s/SELF/pmc/g;
  +    s/\bINTERP\b/interpreter/g;
  +
       return $_;
   }
   
  @@ -900,6 +905,10 @@
               $hout .= $self->decl($classname, $meth, 1);
           }
       }
  +    foreach my $method (@{ $self->{methods}} ) {
  +        next unless $method->{loc} eq 'nci';
  +        $hout .= $self->decl($classname, $method, 1);
  +    }
       # class init decl
       $hout .= <<"EOC";
   void Parrot_${classname}_class_init(Parrot_Interp, int, int);
  
  
  
  1.28      +14 -2     parrot/t/pmc/perlstring.t
  
  Index: perlstring.t
  ===================================================================
  RCS file: /cvs/public/parrot/t/pmc/perlstring.t,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -w -r1.27 -r1.28
  --- perlstring.t      1 Oct 2004 21:16:52 -0000       1.27
  +++ perlstring.t      14 Oct 2004 09:07:09 -0000      1.28
  @@ -1,6 +1,6 @@
   #! perl -w
   # Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
  -# $Id: perlstring.t,v 1.27 2004/10/01 21:16:52 jrieks Exp $
  +# $Id: perlstring.t,v 1.28 2004/10/14 09:07:09 leo Exp $
   
   =head1 NAME
   
  @@ -16,7 +16,7 @@
   
   =cut
   
  -use Parrot::Test tests => 40;
  +use Parrot::Test tests => 41;
   use Test::More; # Included for skip().
   
   my $fp_equality_macro = <<'ENDOFMACRO';
  @@ -1248,3 +1248,15 @@
   0
   OUTPUT
   
  +output_is(<< 'CODE', << 'OUTPUT', "lower method");
  +##PIR##
  +.sub _main @MAIN
  +    .local pmc pmc1
  +    pmc1 = new PerlString
  +    pmc1 = "ABCdef\n"
  +    $P0 = pmc1."lower"()
  +    print $P0
  +.end
  +CODE
  +abcdef
  +OUTPUT
  
  
  

Reply via email to