perl.cvs.parrot
[Top] [All Lists]

[svn:parrot] r28780 - in branches/gsoc_pdd09: . languages/perl6/src/clas

Subject: [svn:parrot] r28780 - in branches/gsoc_pdd09: . languages/perl6/src/classes languages/perl6/src/parser languages/plumhead/config/makefiles languages/plumhead/pmc languages/plumhead/src/common languages/plumhead/src/pct languages/plumhead/src/phc languages/plumhead/src/pmc languages/plumhead/t/php src/dynpmc src/gc src/pmc
From:
Date: Sat, 28 Jun 2008 06:58:02 -0700 PDT
Newsgroups: perl.cvs.parrot

Author: Whiteknight
Date: Sat Jun 28 06:58:01 2008
New Revision: 28780

Added:
   branches/gsoc_pdd09/languages/plumhead/src/pmc/phparray.pmc
      - copied unchanged from r28779, 
/trunk/languages/plumhead/src/pmc/phparray.pmc
   branches/gsoc_pdd09/languages/plumhead/t/php/basic.t
      - copied unchanged from r28779, /trunk/languages/plumhead/t/php/basic.t
Removed:
   branches/gsoc_pdd09/languages/plumhead/pmc/
Modified:
   branches/gsoc_pdd09/MANIFEST
   branches/gsoc_pdd09/MANIFEST.SKIP
   branches/gsoc_pdd09/languages/perl6/src/classes/Array.pir
   branches/gsoc_pdd09/languages/perl6/src/classes/List.pir
   branches/gsoc_pdd09/languages/perl6/src/parser/actions.pm
   branches/gsoc_pdd09/languages/plumhead/config/makefiles/root.in
   branches/gsoc_pdd09/languages/plumhead/src/common/builtins.pir
   branches/gsoc_pdd09/languages/plumhead/src/common/php_API.pir
   branches/gsoc_pdd09/languages/plumhead/src/common/php_MACRO.pir
   branches/gsoc_pdd09/languages/plumhead/src/common/php_basic.pir
   branches/gsoc_pdd09/languages/plumhead/src/common/php_builtin.pir
   branches/gsoc_pdd09/languages/plumhead/src/common/php_math.pir
   branches/gsoc_pdd09/languages/plumhead/src/common/php_md5.pir
   branches/gsoc_pdd09/languages/plumhead/src/common/php_string.pir
   branches/gsoc_pdd09/languages/plumhead/src/common/php_type.pir
   branches/gsoc_pdd09/languages/plumhead/src/common/php_var.pir
   branches/gsoc_pdd09/languages/plumhead/src/common/plumhead.pir
   branches/gsoc_pdd09/languages/plumhead/src/pct/actions.pm
   branches/gsoc_pdd09/languages/plumhead/src/pct/grammar.pg
   branches/gsoc_pdd09/languages/plumhead/src/phc/phc_xml_to_past_xml.xsl
   branches/gsoc_pdd09/languages/plumhead/src/pmc/php.pmc
   branches/gsoc_pdd09/languages/plumhead/src/pmc/php_private.h
   branches/gsoc_pdd09/languages/plumhead/t/php/arithmetics.t
   branches/gsoc_pdd09/languages/plumhead/t/php/base64.t
   branches/gsoc_pdd09/languages/plumhead/t/php/builtin.t
   branches/gsoc_pdd09/languages/plumhead/t/php/ctype.t
   branches/gsoc_pdd09/languages/plumhead/t/php/hello.t
   branches/gsoc_pdd09/languages/plumhead/t/php/info.t
   branches/gsoc_pdd09/languages/plumhead/t/php/math.t
   branches/gsoc_pdd09/languages/plumhead/t/php/md5.t
   branches/gsoc_pdd09/languages/plumhead/t/php/rand.t
   branches/gsoc_pdd09/languages/plumhead/t/php/relops.t
   branches/gsoc_pdd09/languages/plumhead/t/php/string.t
   branches/gsoc_pdd09/languages/plumhead/t/php/strings.t
   branches/gsoc_pdd09/languages/plumhead/t/php/superglobals.t
   branches/gsoc_pdd09/languages/plumhead/t/php/type.t
   branches/gsoc_pdd09/src/dynpmc/gdbmhash.pmc
   branches/gsoc_pdd09/src/gc/memory.c
   branches/gsoc_pdd09/src/pmc/closure.pmc

Log:
[gsoc_pdd09] update to trunk from r28740

Modified: branches/gsoc_pdd09/MANIFEST
==============================================================================
--- branches/gsoc_pdd09/MANIFEST        (original)
+++ branches/gsoc_pdd09/MANIFEST        Sat Jun 28 06:58:01 2008
@@ -1,7 +1,7 @@
 # ex: set ro:
 # $Id$
 #
-# generated by tools/dev/mk_manifest_and_skip.pl Fri Jun 27 01:45:45 2008 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Sat Jun 28 09:06:27 2008 UT
 #
 # See tools/dev/install_files.pl for documentation on the
 # format of this file.
@@ -2172,6 +2172,7 @@
 languages/plumhead/src/phc/phc_xml_to_past_xml.xsl          [plumhead]
 languages/plumhead/src/pmc/php.pmc                          [plumhead]
 languages/plumhead/src/pmc/php_private.h                    [plumhead]
+languages/plumhead/src/pmc/phparray.pmc                     [plumhead]
 languages/plumhead/src/pmc/phpboolean.pmc                   [plumhead]
 languages/plumhead/src/pmc/phpfloat.pmc                     [plumhead]
 languages/plumhead/src/pmc/phpinteger.pmc                   [plumhead]
@@ -2181,6 +2182,7 @@
 languages/plumhead/t/php/arithmetics.t                      [plumhead]
 languages/plumhead/t/php/array.t                            [plumhead]
 languages/plumhead/t/php/base64.t                           [plumhead]
+languages/plumhead/t/php/basic.t                            [plumhead]
 languages/plumhead/t/php/builtin.t                          [plumhead]
 languages/plumhead/t/php/control_flow.t                     [plumhead]
 languages/plumhead/t/php/ctype.t                            [plumhead]

Modified: branches/gsoc_pdd09/MANIFEST.SKIP
==============================================================================
--- branches/gsoc_pdd09/MANIFEST.SKIP   (original)
+++ branches/gsoc_pdd09/MANIFEST.SKIP   Sat Jun 28 06:58:01 2008
@@ -1,6 +1,6 @@
 # ex: set ro:
 # $Id$
-# generated by tools/dev/mk_manifest_and_skip.pl Thu Jun 26 19:51:46 2008 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Sat Jun 28 09:06:27 2008 UT
 #
 # This file should contain a transcript of the svn:ignore properties
 # of the directories in the Parrot subversion repository. (Needed for
@@ -1056,31 +1056,6 @@
 ^languages/plumhead/plumhead\.pbc/
 ^languages/plumhead/plumhead_pct\.pbc$
 ^languages/plumhead/plumhead_pct\.pbc/
-# generated from svn:ignore of 'languages/plumhead/pmc/'
-^languages/plumhead/pmc/.*\.bundle$
-^languages/plumhead/pmc/.*\.bundle/
-^languages/plumhead/pmc/.*\.c$
-^languages/plumhead/pmc/.*\.c/
-^languages/plumhead/pmc/.*\.dll$
-^languages/plumhead/pmc/.*\.dll/
-^languages/plumhead/pmc/.*\.dump$
-^languages/plumhead/pmc/.*\.dump/
-^languages/plumhead/pmc/.*\.exp$
-^languages/plumhead/pmc/.*\.exp/
-^languages/plumhead/pmc/.*\.h$
-^languages/plumhead/pmc/.*\.h/
-^languages/plumhead/pmc/.*\.ilk$
-^languages/plumhead/pmc/.*\.ilk/
-^languages/plumhead/pmc/.*\.lib$
-^languages/plumhead/pmc/.*\.lib/
-^languages/plumhead/pmc/.*\.manifest$
-^languages/plumhead/pmc/.*\.manifest/
-^languages/plumhead/pmc/.*\.obj$
-^languages/plumhead/pmc/.*\.obj/
-^languages/plumhead/pmc/.*\.pdb$
-^languages/plumhead/pmc/.*\.pdb/
-^languages/plumhead/pmc/.*\.so$
-^languages/plumhead/pmc/.*\.so/
 # generated from svn:ignore of 'languages/plumhead/src/antlr3/'
 ^languages/plumhead/src/antlr3/.*\.class$
 ^languages/plumhead/src/antlr3/.*\.class/

Modified: branches/gsoc_pdd09/languages/perl6/src/classes/Array.pir
==============================================================================
--- branches/gsoc_pdd09/languages/perl6/src/classes/Array.pir   (original)
+++ branches/gsoc_pdd09/languages/perl6/src/classes/Array.pir   Sat Jun 28 
06:58:01 2008
@@ -12,7 +12,6 @@
     .local pmc p6meta, arrayproto
     p6meta = get_hll_global ['Perl6Object'], '$!P6META'
     arrayproto = p6meta.'new_class'('Perl6Array', 'parent'=>'List', 
'name'=>'Array')
-    p6meta.'new_class'('Arrayref', 'parent'=>arrayproto, 
'protoobject'=>arrayproto)
 
     $P0 = get_hll_namespace ['Perl6Array']
     '!EXPORT'('delete exists pop push shift unshift', 'from'=>$P0)
@@ -30,6 +29,19 @@
 .end
 
 
+.namespace []
+.sub 'circumfix:[ ]'
+    .param pmc values          :slurpy
+    $P0 = new 'Perl6Array'
+    $I0 = elements values
+    splice $P0, values, 0, $I0
+    $P0.'!flatten'()
+    $P1 = new 'Perl6Scalar'
+    assign $P1, $P0
+    .return ($P1)
+.end
+
+
 =head2 Array methods
 
 =over 4
@@ -96,6 +108,29 @@
 .end
 
 
+=item item()
+
+Return Array in item context (i.e., self)
+
+=cut
+
+.sub 'item' :method
+    .return (self)
+.end
+
+
+=item list()
+
+Return Array in list context (i.e., a List containing self)
+
+=cut
+
+.sub 'list' :method
+    $P0 = get_hll_global 'list'
+    .return $P0(self)
+.end
+
+
 =item pop()
 
 Remove the last item from the array and return it.
@@ -161,45 +196,6 @@
 .end
 
 
-=back
-
-=head1  Arrayref
-
-=cut
-
-.namespace []
-
-.sub '!Arrayref'
-    .param pmc args            :slurpy
-    .local pmc result, iter
-    args = 'list'(args)
-    result = new 'Arrayref'
-    iter = args.'iterator'()
-  iter_loop:
-    unless iter goto iter_end
-    $P0 = shift iter
-    $P0 = clone $P0
-    push result, $P0
-    goto iter_loop
-  iter_end:
-    .return (result)
-.end
-
-
-.namespace ['Arrayref']
-
-.sub 'item' :method
-    .return (self)
-.end
-
-
-.sub 'list' :method
-    $P0 = new 'List'
-    push $P0, self
-    .return ($P0)
-.end
-
-
 # Local Variables:
 #   mode: pir
 #   fill-column: 100

Modified: branches/gsoc_pdd09/languages/perl6/src/classes/List.pir
==============================================================================
--- branches/gsoc_pdd09/languages/perl6/src/classes/List.pir    (original)
+++ branches/gsoc_pdd09/languages/perl6/src/classes/List.pir    Sat Jun 28 
06:58:01 2008
@@ -104,12 +104,14 @@
 
 =item item()
 
-Return the List invocant in scalar context (i.e., an Arrayref).
+Return the List invocant in scalar context (i.e., an Array).
 
 =cut
 
 .sub 'item' :method
-    .return '!Arrayref'(self)
+    $P0 = new 'Perl6Array'
+    splice $P0, self, 0, 0
+    .return ($P0)
 .end
 
 
@@ -194,7 +196,7 @@
     elem = self[i]
     $I0 = defined elem
     unless $I0 goto flat_next
-    $I0 = isa elem, 'Arrayref'
+    $I0 = isa elem, 'Perl6Scalar'
     if $I0 goto flat_next
     $I0 = isa elem, 'Range'
     unless $I0 goto not_range
@@ -224,7 +226,7 @@
 
 =cut
 
-.sub 'elems' :method :multi('ResizablePMCArray')
+.sub 'elems' :method :multi('ResizablePMCArray') :vtable('get_number')
     self.'!flatten'()
     $I0 = elements self
     .return ($I0)

Modified: branches/gsoc_pdd09/languages/perl6/src/parser/actions.pm
==============================================================================
--- branches/gsoc_pdd09/languages/perl6/src/parser/actions.pm   (original)
+++ branches/gsoc_pdd09/languages/perl6/src/parser/actions.pm   Sat Jun 28 
06:58:01 2008
@@ -1818,7 +1818,7 @@
                      !! PAST::Op.new(:name('list'));
     }
     if $key eq '[ ]' {
-        $past := PAST::Op.new(:name('!Arrayref'), :node($/) );
+        $past := PAST::Op.new(:name('circumfix:[ ]'), :node($/) );
         if $<statementlist><statement> { $past.push( $( $<statementlist> ) ); }
     }
     elsif $key eq '{ }' {
@@ -1826,7 +1826,6 @@
     }
     elsif $key eq '$( )' {
         my $method := process_contextualizer($/, $<sigil>);
-
         $past := PAST::Op.new(
             :pasttype('callmethod'),
             :name($method),

Modified: branches/gsoc_pdd09/languages/plumhead/config/makefiles/root.in
==============================================================================
--- branches/gsoc_pdd09/languages/plumhead/config/makefiles/root.in     
(original)
+++ branches/gsoc_pdd09/languages/plumhead/config/makefiles/root.in     Sat Jun 
28 06:58:01 2008
@@ -21,6 +21,7 @@
 
 PMCS = \
  php \
+ phparray \
  phpboolean \
  phpfloat \
  phpinteger \
@@ -29,6 +30,7 @@
 
 PMC_SOURCES = \
  $(PMCDIR)/php.pmc \
+ $(PMCDIR)/phparray.pmc \
  $(PMCDIR)/phpboolean.pmc \
  $(PMCDIR)/phpfloat.pmc \
  $(PMCDIR)/phpinteger.pmc \
@@ -113,7 +115,7 @@
        @echo "                     Current this has nothing to do."
        @echo "  build-antlr3       Build support for variant 'Plumhead 
antlr3'."
        @echo "                     Needs javac and a proper CLASSPATH."
-       @echo "  pmc                            Build all PMCs."
+       @echo "  pmc                Build all PMCs."
        @echo ""
        @echo "Testing:"
        @echo "  test:              Run the test suite for 'Plumhead pct'."
@@ -186,7 +188,7 @@
 
 pmc: $(PHP_GROUP)
 
-$(PHP_GROUP): $(PARROT) $(PMC_FILES)
+$(PHP_GROUP): $(PARROT) $(PMC_SOURCES)
        @cd $(PMCDIR) && $(PMCBUILD) generate $(PMCS)
        @cd $(PMCDIR) && $(PMCBUILD) compile $(PMCS)
        @cd $(PMCDIR) && $(PMCBUILD) linklibs $(PMCS)
@@ -211,7 +213,7 @@
 test-pmc:
        - $(PERL) -I../../lib t/pmc/*t
 
-clean: clean-common clean-pct clean-antlr3 clean-test
+clean: clean-common clean-pct clean-antlr3 clean-test clean-pmc
 
 clean-common: clean-pmc
        $(RM_F) \

Modified: branches/gsoc_pdd09/languages/plumhead/src/common/builtins.pir
==============================================================================
--- branches/gsoc_pdd09/languages/plumhead/src/common/builtins.pir      
(original)
+++ branches/gsoc_pdd09/languages/plumhead/src/common/builtins.pir      Sat Jun 
28 06:58:01 2008
@@ -2,12 +2,14 @@
 
 .loadlib 'php_group'
 
+.include 'languages/plumhead/src/common/php_MACRO.pir'
+
 # steal builtins from Perl6
 .sub 'print'
     .param pmc list            :slurpy
     .local pmc iter
 
-    iter = new .Iterator, list
+    iter = new 'Iterator', list
   iter_loop:
     unless iter goto iter_end
     $P0 = shift iter
@@ -24,7 +26,7 @@
     .param pmc list            :slurpy
 
     .local pmc iter
-    iter = new .Iterator, list
+    iter = new 'Iterator', list
   iter_loop:
     unless iter goto iter_end
     $P0 = shift iter
@@ -35,225 +37,269 @@
     .return (1)
 .end
 
-.sub 'prefix:-' :multi(Float)
+## autoincrement
+.sub 'postfix:++'
     .param pmc a
+    $P0 = clone a
+    inc a
+    .return ($P0)
+.end
 
-    $N0 = a
-    $N0 = neg $N0
+.sub 'postfix:--'
+    .param pmc a
+    $P0 = clone a
+    dec a
+    .return ($P0)
+.end
 
-    .return ($N0)
+.sub 'prefix:++'
+    .param pmc a
+    inc a
+    .return (a)
 .end
 
-.sub 'prefix:-' :multi(Integer)
-    .param int a
+.sub 'prefix:--'
+    .param pmc a
+    dec a
+    .return (a)
+.end
 
-    $I0 = neg a
 
-    .return ($I0)
+## symbolic unary
+.sub 'prefix:-'
+    .param pmc a
+    $P1 = a.'to_number'()
+    neg $P1
+    .return ($P1)
 .end
 
-.sub 'prefix:-' :multi(PMC)
+.sub 'prefix:~' :multi(PhpString)
     .param pmc a
+    bnots $P1
+    .return ($P1)
+.end
 
-    $N0 = a
-    $N0 = neg $N0
+.sub 'prefix:~' :multi(_)
+    .param int a
+    $I0 = bnot a
+    .RETURN_LONG($I0)
+.end
 
-    .return ($N0)
+.sub 'prefix:!'
+    .param pmc a
+    $I0 = isfalse a
+    .RETURN_BOOL($I0)
 .end
 
 
-.sub 'infix:+&'
-    .param int a
-    .param int b
+## multiplicative
+.sub 'infix:*'
+    .param pmc a
+    .param pmc b
+    $P1 = a.'to_number'()
+    $P2 = b.'to_number'()
+    $P0 = mul $P1, $P2
+    .return ($P0)
+.end
 
-    $I0 = band a, b
+.sub 'infix:/'
+    .param pmc a
+    .param pmc b
+    $P1 = a.'to_number'()
+    $P2 = b.'to_number'()
+    $P0 = div $P1, $P2
+    .return ($P0)
+.end
 
-    .return ($I0)
+.sub 'infix:%'
+    .param pmc a
+    .param pmc b
+    $P1 = a.'to_number'()
+    $P2 = b.'to_number'()
+    $P0 = mod $P1, $P2
+    .return ($P0)
 .end
 
-.sub 'infix:+|'
+.sub 'infix:&' :multi(PhpString,PhpString)
+    .param pmc a
+    .param pmc b
+    $P0 = bands $P1, $P2
+    .return ($P0)
+.end
+
+.sub 'infix:&' :multi(_,_)
     .param int a
     .param int b
-
-    $I0 = bor a, b
-
-    .return ($I0)
+    $I0 = band a, b
+    .RETURN_LONG($I0)
 .end
 
-.sub 'infix:+^'
+.sub 'infix:>>'
     .param int a
     .param int b
+    $I0 = shr a, b
+    .RETURN_LONG($I0)
+.end
 
-    $I0 = bxor a, b
-
-    .return ($I0)
+.sub 'infix:<<'
+    .param int a
+    .param int b
+    $I0 = shl a, b
+    .RETURN_LONG($I0)
 .end
 
 
-.sub 'infix:<'
+## additive
+.sub 'infix:+'
     .param pmc a
     .param pmc b
-
-    $I0 = cmp_num a, b
-    $I0 = islt $I0, 0
-
-    .return ($I0)
+    $P1 = a.'to_number'()
+    $P2 = b.'to_number'()
+    $P0 = add $P1, $P2
+    .return ($P0)
 .end
 
-
-.sub 'infix:<='
+.sub 'infix:-'
     .param pmc a
     .param pmc b
-
-    $I0 = cmp_num a, b
-    $I0 = isle $I0, 0
-
-    .return ($I0)
+    $P1 = a.'to_number'()
+    $P2 = b.'to_number'()
+    $P0 = sub $P1, $P2
+    .return ($P0)
 .end
 
-.sub 'infix:=='
+.sub 'infix:.'
     .param pmc a
     .param pmc b
-
-    $I0 = cmp_num a, b
-    $I0 = iseq $I0, 0
-
-    .return ($I0)
+    $S1 = a
+    $S2 = b
+    $S0 = concat $S1, $S2
+    .RETURN_STRING($S0)
 .end
 
-.sub 'infix:!='
+.sub 'infix:|' :multi(PhpString,PhpString)
     .param pmc a
     .param pmc b
+    $P0 = bors $P1, $P2
+    .return ($P0)
+.end
 
-    $I0 = cmp_num a, b
-    $I0 = isne $I0, 0
-
-    .return ($I0)
+.sub 'infix:|' :multi(_,_)
+    .param int a
+    .param int b
+    $I0 = bor a, b
+    .RETURN_LONG($I0)
 .end
 
-.sub 'infix:eq'
+.sub 'infix:^' :multi(PhpString,PhpString)
     .param pmc a
     .param pmc b
+    $P0 = bxors $P1, $P2
+    .return ($P0)
+.end
 
-    $I0 = cmp_str a, b
-    $I0 = iseq $I0, 0
-
-    .return ($I0)
+.sub 'infix:^' :multi(_,_)
+    .param int a
+    .param int b
+    $I0 = bxor a, b
+    .RETURN_LONG($I0)
 .end
 
-.sub 'infix:ne'
+
+## logical
+.sub 'infix:AND'
     .param pmc a
     .param pmc b
-
-    $I0 = cmp_str a, b
-    $I0 = isne $I0, 0
-
-    .return ($I0)
+    $I1 = istrue a
+    $I2 = istrue b
+    $I0 = band $I1, $I2
+    .RETURN_BOOL($I0)
 .end
 
-.sub 'infix:>='
+.sub 'infix:OR'
     .param pmc a
     .param pmc b
-
-    $I0 = cmp_num a, b
-    $I0 = isge $I0, 0
-
-    .return ($I0)
+    $I1 = istrue a
+    $I2 = istrue b
+    $I0 = bor $I1, $I2
+    .RETURN_BOOL($I0)
 .end
 
-
-.sub 'infix:>'
+.sub 'infix:XOR'
     .param pmc a
     .param pmc b
-
-    $I0 = cmp_num a, b
-    $I0 = isgt $I0, 0
-
-    .return ($I0)
+    $I1 = istrue a
+    $I2 = istrue b
+    $I0 = bxor $I1, $I2
+    .RETURN_BOOL($I0)
 .end
 
 
-.sub 'infix:!='
+## comparison
+.sub 'infix:<'
     .param pmc a
     .param pmc b
-
-    $I0 = cmp_num a, b
-    $I0 = isne $I0, 0
-
-    .return ($I0)
+    $I0 = islt a, b
+    .RETURN_BOOL($I0)
 .end
 
-.sub 'infix:.' :multi( PMC, PMC )
+.sub 'infix:<='
     .param pmc a
     .param pmc b
-
-    .local pmc c
-    c = new 'String'
-    c = concat a, b
-
-    .return (c)
+    $I0 = isle a, b
+    .RETURN_BOOL($I0)
 .end
 
-.sub 'infix:.' :multi( PMC, String )
+.sub 'infix:=='
     .param pmc a
-    .param string b
-
-    .local pmc c
-    c = new 'String'
-    c = concat a, b
-    #c = 'multi PMC, String'
-
-    .return (c)
+    .param pmc b
+    $I0 = iseq a, b
+    .RETURN_BOOL($I0)
 .end
 
-.sub 'infix:.' :multi( PMC )
+.sub 'infix:!='
     .param pmc a
-
-    .return (a)
-.end
-
-.sub 'infix:.' :multi( String, PMC )
-    .param string a
     .param pmc b
-
-    .local pmc c, d
-    c = new 'String'
-    c = a
-    d = new 'String'
-    d = concat c, b
-
-    .return (d)
+    $I0 = isne a, b
+    .RETURN_BOOL($I0)
 .end
 
-.sub 'infix:|'
-    .param int a
-    .param int b
-
-    $I0 = bor a, b
-
-    .return ($I0)
+.sub 'infix:>'
+    .param pmc a
+    .param pmc b
+    $I0 = isgt a, b
+    .RETURN_BOOL($I0)
 .end
 
-.sub 'infix:&'
-    .param int a
-    .param int b
-
-    $I0 = band a, b
-
-    .return ($I0)
+.sub 'infix:>='
+    .param pmc a
+    .param pmc b
+    $I0 = isge a, b
+    .RETURN_BOOL($I0)
 .end
 
-.sub 'infix:~'
-    .param string a
-    .param string b
-
-    $S0 = concat a, b
-
-    .return ($S0)
+.sub 'infix:==='
+    .param pmc a
+    .param pmc b
+    $S1 = typeof a
+    $S2 = typeof b
+    if $S1 == $S2 goto L1
+    .RETURN_FALSE()
+  L1:
+    $I0 = iseq a, b
+    .RETURN_BOOL($I0)
 .end
 
-.sub 'error_reporting'
-  .return()
+.sub 'infix:!=='
+    .param pmc a
+    .param pmc b
+    $S1 = typeof a
+    $S2 = typeof b
+    if $S1 != $S2 goto L1
+    .RETURN_TRUE()
+  L1:
+    $I0 = isne a, b
+    .RETURN_BOOL($I0)
 .end
 
 

Modified: branches/gsoc_pdd09/languages/plumhead/src/common/php_API.pir
==============================================================================
--- branches/gsoc_pdd09/languages/plumhead/src/common/php_API.pir       
(original)
+++ branches/gsoc_pdd09/languages/plumhead/src/common/php_API.pir       Sat Jun 
28 06:58:01 2008
@@ -13,12 +13,14 @@
 
 =cut
 
+.include 'languages/plumhead/src/common/php_MACRO.pir'
 
 =item C<error>
 
 =cut
 
 .sub 'error'
+    .param int level
     .param string msg
     printerr msg
 .end
@@ -56,7 +58,7 @@
 .sub 'wrong_param_count'
     .local string msg
     msg = 'Wrong parameter count for '
-    error(msg)
+    error(E_WARNING, msg)
 .end
 
 

Modified: branches/gsoc_pdd09/languages/plumhead/src/common/php_MACRO.pir
==============================================================================
--- branches/gsoc_pdd09/languages/plumhead/src/common/php_MACRO.pir     
(original)
+++ branches/gsoc_pdd09/languages/plumhead/src/common/php_MACRO.pir     Sat Jun 
28 06:58:01 2008
@@ -13,6 +13,23 @@
 
 =cut
 
+.const int E_ERROR = 0x0001
+.const int E_WARNING = 0x0002
+.const int E_PARSE = 0x0004
+.const int E_NOTICE    = 0x0008
+.const int E_CORE_ERROR = 0x0010
+.const int E_CORE_WARNING = 0x0020
+.const int E_COMPILE_ERROR = 0x0040
+.const int E_COMPILE_WARNING = 0x0080
+.const int E_USER_ERROR = 0x0100
+.const int E_USER_WARNING = 0x0200
+.const int E_USER_NOTICE = 0x0400
+.const int E_STRICT = 0x0800
+.const int E_RECOVERABLE_ERROR = 0x1000
+
+.const int E_ALL = 0x1fff
+.const int E_CORE = 0x0030
+
 
 =item C<.RETURN_BOOL( val )>
 

Modified: branches/gsoc_pdd09/languages/plumhead/src/common/php_basic.pir
==============================================================================
--- branches/gsoc_pdd09/languages/plumhead/src/common/php_basic.pir     
(original)
+++ branches/gsoc_pdd09/languages/plumhead/src/common/php_basic.pir     Sat Jun 
28 06:58:01 2008
@@ -197,12 +197,28 @@
 
 Get the value of an environment variable
 
-NOT IMPLEMENTED.
+STILL INCOMPLETE.
 
 =cut
 
 .sub 'getenv'
-    not_implemented()
+    .param pmc args :slurpy
+    .local pmc varname
+    ($I0, varname) = parse_parameters('s', args :flat)
+    if $I0 goto L1
+    .RETURN_NULL()
+  L1:
+    $S1 = varname
+#    $S0 = sapi_getenv($S1)
+#    unless $S0 goto L2
+#    .RETURN_STRING($S0)
+#  L2:
+    new $P0, 'Env'
+    $S0 = $P0[$S1]
+    unless $S0 goto L3
+    .RETURN_STRING($S0)
+  L3:
+    .RETURN_FALSE()
 .end
 
 =item C<array getopt(string options [, array longopts])>
@@ -545,12 +561,17 @@
 
 Delay for a given number of seconds
 
-NOT IMPLEMENTED.
-
 =cut
 
 .sub 'sleep'
-    not_implemented()
+    .param pmc args :slurpy
+    .local pmc seconds
+    ($I0, seconds) = parse_parameters('l', args :flat)
+    if $I0 goto L1
+    .RETURN_NULL()
+  L1:
+    $I1 = seconds
+    sleep $I1
 .end
 
 =item C<array sys_getloadavg()>

Modified: branches/gsoc_pdd09/languages/plumhead/src/common/php_builtin.pir
==============================================================================
--- branches/gsoc_pdd09/languages/plumhead/src/common/php_builtin.pir   
(original)
+++ branches/gsoc_pdd09/languages/plumhead/src/common/php_builtin.pir   Sat Jun 
28 06:58:01 2008
@@ -13,6 +13,8 @@
 
 =cut
 
+.include 'languages/plumhead/src/common/php_MACRO.pir'
+
 =item C<bool class_exists(string classname [, bool autoload])>
 
 Checks if the class exists
@@ -101,12 +103,12 @@
 
 Return the current error_reporting level, and if an argument was passed - 
change to the new level
 
-NOT IMPLEMENTED.
+DUMMY IMPLEMENTATION.
 
 =cut
 
 .sub 'error_reporting'
-    not_implemented()
+    .RETURN_LONG(0)
 .end
 
 =item C<bool extension_loaded(string extension_name)>

Modified: branches/gsoc_pdd09/languages/plumhead/src/common/php_math.pir
==============================================================================
--- branches/gsoc_pdd09/languages/plumhead/src/common/php_math.pir      
(original)
+++ branches/gsoc_pdd09/languages/plumhead/src/common/php_math.pir      Sat Jun 
28 06:58:01 2008
@@ -243,14 +243,14 @@
     if $I2 > 36 goto L2
     goto L3
   L2:
-    error("Invalid `from base' (", $I2, ")")
+    error(E_WARNING, "Invalid `from base' (", $I2, ")")
     .RETURN_FALSE()
   L3:
     if $I3 < 2 goto L4
     if $I3 > 36 goto L4
     goto L5
   L4:
-    error("Invalid `to base' (", $I3, ")")
+    error(E_WARNING, "Invalid `to base' (", $I3, ")")
     .RETURN_FALSE()
   L5:
     $P0 = $P1.'to_base'($I2)
@@ -639,7 +639,7 @@
     $P2 = shift args
     $N2 = $P2
     unless $N2 <= 0.0 goto L3
-    error("base must be greater than 0")
+    error(E_WARNING, "base must be greater than 0")
     .RETURN_FALSE()
   L3:
     $N1 = ln $N1

Modified: branches/gsoc_pdd09/languages/plumhead/src/common/php_md5.pir
==============================================================================
--- branches/gsoc_pdd09/languages/plumhead/src/common/php_md5.pir       
(original)
+++ branches/gsoc_pdd09/languages/plumhead/src/common/php_md5.pir       Sat Jun 
28 06:58:01 2008
@@ -73,6 +73,8 @@
 
 Calculate the md5 hash of given filename
 
+STILL INCOMPLETE (needs stream for URL).
+
 =cut
 
 .sub 'md5_file'
@@ -84,10 +86,9 @@
     .RETURN_NULL()
   L1:
     .local pmc f, md, res
-    push_eh _handler
     $S1 = filename
     f = open $S1, '<'
-    if null f goto L2
+    unless f goto L2
     new md, 'MD5'
     md.'Init'()
   L3:
@@ -106,7 +107,6 @@
     $S0 = make_digest($S0)
   L6:
     .RETURN_STRING($S0)
-  _handler:
   L2:
     .RETURN_FALSE()
 .end

Modified: branches/gsoc_pdd09/languages/plumhead/src/common/php_string.pir
==============================================================================
--- branches/gsoc_pdd09/languages/plumhead/src/common/php_string.pir    
(original)
+++ branches/gsoc_pdd09/languages/plumhead/src/common/php_string.pir    Sat Jun 
28 06:58:01 2008
@@ -446,7 +446,7 @@
     $P2 = shift args
     $I2 = $P2
     unless $I2 < 0 goto L2
-    error("Second argument has to be greater than or equal to 0")
+    error(E_WARNING, "Second argument has to be greater than or equal to 0")
     .RETURN_NULL()
   L2:
     $S0 = repeat $S1, $I2
@@ -683,12 +683,12 @@
     if $I3 > $I1 goto L4
     goto L5
   L4:
-    error("Offset not contained in string")
+    error(E_WARNING, "Offset not contained in string")
     .RETURN_FALSE()
   L5:
     $S2 = $P2
     unless $S2 == '' goto L6
-    error("Empty delimiter")
+    error(E_WARNING, "Empty delimiter")
     .RETURN_FALSE()
   L6:
     $I0 = index $S1, $S2, $I3
@@ -777,7 +777,7 @@
     $P2 = shift args
     $S2 = $P2
     unless $S2 == '' goto L2
-    error("Empty delimiter")
+    error(E_WARNING, "Empty delimiter")
     .RETURN_FALSE()
   L2:
     $I0 = index $S1, $S2

Modified: branches/gsoc_pdd09/languages/plumhead/src/common/php_type.pir
==============================================================================
--- branches/gsoc_pdd09/languages/plumhead/src/common/php_type.pir      
(original)
+++ branches/gsoc_pdd09/languages/plumhead/src/common/php_type.pir      Sat Jun 
28 06:58:01 2008
@@ -17,7 +17,7 @@
     .local int argc
     argc = .args
     unless argc != 1 goto L1
-    error('Only one argument expected')
+    error(E_WARNING, 'Only one argument expected')
     .RETURN_FALSE()
   L1:
     $P1 = shift .args
@@ -169,11 +169,8 @@
     if $I0 goto L2
     $I0 = isa $P1, 'PhpInteger'
     if $I0 goto L2
-    $I0 = isa $P1, 'String'
+    $I0 = isa $P1, 'PhpString'
     unless $I0 goto L3
-    $S0 = $P1 ###
-    new $P1, 'PhpString' ###
-    set $P1, $S0 ###
     $I0 = $P1.'is_numeric'()
     .RETURN_BOOL($I0)
   L3:
@@ -227,7 +224,7 @@
     if $I0 goto L2
     $I0 = isa $P1, 'PhpInteger'
     if $I0 goto L2
-    $I0 = isa $P1, 'String'
+    $I0 = isa $P1, 'PhpString'
     if $I0 goto L2
     .RETURN_FALSE()
   L2:
@@ -242,7 +239,7 @@
 
 .sub 'is_string'
     .param pmc args :slurpy
-    .IS_TYPE('String', args)
+    .IS_TYPE('PhpString', args)
 .end
 
 =item C<bool settype(mixed var, string type)>

Modified: branches/gsoc_pdd09/languages/plumhead/src/common/php_var.pir
==============================================================================
--- branches/gsoc_pdd09/languages/plumhead/src/common/php_var.pir       
(original)
+++ branches/gsoc_pdd09/languages/plumhead/src/common/php_var.pir       Sat Jun 
28 06:58:01 2008
@@ -89,7 +89,7 @@
     .local string type_of_pmc
     type_of_pmc = typeof a
 
-    ne type_of_pmc, 'String', not_a_string
+    ne type_of_pmc, 'string', not_a_string
         .local int string_len
 
         string_len = elements a
@@ -104,7 +104,7 @@
 
 not_a_string:
 
-    ne type_of_pmc, 'Hash', not_a_hash
+    ne type_of_pmc, 'array', not_a_hash
 
         .local int num_elements
         num_elements = elements a
@@ -147,7 +147,7 @@
 
 not_a_hash:
 
-    ne type_of_pmc, 'Integer', not_a_integer
+    ne type_of_pmc, 'integer', not_a_integer
 
         print 'int('
         print a

Modified: branches/gsoc_pdd09/languages/plumhead/src/common/plumhead.pir
==============================================================================
--- branches/gsoc_pdd09/languages/plumhead/src/common/plumhead.pir      
(original)
+++ branches/gsoc_pdd09/languages/plumhead/src/common/plumhead.pir      Sat Jun 
28 06:58:01 2008
@@ -49,6 +49,20 @@
 
 =cut
 
+
+.namespace [ 'PAST::Compiler' ]
+
+.sub '__onload' :anon :load :init
+    load_bytecode 'PCT.pbc'
+
+    ##  %valflags specifies when PAST::Val nodes are allowed to
+    ##  be used as a constant.  The 'e' flag indicates that the
+    ##  value must be quoted+escaped in PIR code.
+    .local pmc valflags
+    valflags = get_global '%valflags'
+    valflags['PhpString']   = 's~*e'
+.end
+
 .namespace [ 'Plumhead' ]
 
 .const string VERSION = "0.0.1"
@@ -60,8 +74,6 @@
     load_bytecode 'PGE/Util.pbc'
     load_bytecode 'PGE/Dumper.pbc'
 
-    load_bytecode 'PCT.pbc'
-
     load_bytecode 'languages/plumhead/src/common/plumheadlib.pbc'
     load_bytecode 'languages/plumhead/src/common/php_ctype.pbc'
 

Modified: branches/gsoc_pdd09/languages/plumhead/src/pct/actions.pm
==============================================================================
--- branches/gsoc_pdd09/languages/plumhead/src/pct/actions.pm   (original)
+++ branches/gsoc_pdd09/languages/plumhead/src/pct/actions.pm   Sat Jun 28 
06:58:01 2008
@@ -35,7 +35,7 @@
     make PAST::Op.new(
              PAST::Val.new(
                  :value(~$/),
-                 :returns('String')
+                 :returns('PhpString')
              ),
              :name('echo'),
              :node($/)
@@ -63,7 +63,7 @@
    make PAST::Op.new(
             PAST::Val.new(
                 :value(~$<SEA_empty_allowed>),
-                :returns('String')
+                :returns('PhpString')
             ),
             :name('echo'),
             :node($/)
@@ -71,20 +71,10 @@
 }
 
 method echo_statement($/) {
-     if $/[0]<expression> {
-         make PAST::Op.new(
-                  $( $/[0]<expression> ),
-                  :name('echo'),
-                  :node($/)
-              );
-     }
-     elsif $/[0]<function_call> {
-         make PAST::Op.new(
-                  $( $/[0]<function_call> ),
-                  :name('echo'),
-                  :node($/)
-              );
-     }
+    my $past := $( $<arguments> );
+    $past.name( ~$<ECHO> );
+
+    make $past;
 }
 
 method function_call($/) {
@@ -95,7 +85,10 @@
 }
 
 method arguments($/) {
-    my $past := PAST::Op.new( :pasttype('call'), :node($/) );
+    my $past := PAST::Op.new(
+                    :pasttype('call'),
+                    :node($/)
+                );
     for $<expression> {
         $past.push($($_));
     }
@@ -140,7 +133,7 @@
 method array_elem($/) {
     my $past_var_name := $( $<VAR_NAME> );
     $past_var_name.scope('package');
-    $past_var_name.viviself('Hash');
+    $past_var_name.viviself('PhpArray');
 
     make PAST::Var.new(
              $past_var_name,
@@ -296,7 +289,7 @@
 method INTEGER($/) {
     make PAST::Val.new(
              :value( ~$/ ),
-             :returns('Integer'),
+             :returns('PhpInteger'),
              :node($/)
          );
 }
@@ -304,7 +297,7 @@
 method NUMBER($/) {
     make PAST::Val.new(
              :value( +$/ ),
-             :returns('Float'),
+             :returns('PhpFloat'),
              :node($/)
          );
 }
@@ -312,7 +305,7 @@
 method SINGLEQUOTE_STRING($/) {
     make PAST::Val.new(
              :value( $( $<string_literal> ) ),
-             :returns('String'),
+             :returns('PhpString'),
              :node($/)
          );
 }
@@ -320,7 +313,7 @@
 method DOUBLEQUOTE_STRING($/) {
     make PAST::Val.new(
              :value( $( $<string_literal> ) ),
-             :returns('String'),
+             :returns('PhpString'),
              :node($/)
          );
 }

Modified: branches/gsoc_pdd09/languages/plumhead/src/pct/grammar.pg
==============================================================================
--- branches/gsoc_pdd09/languages/plumhead/src/pct/grammar.pg   (original)
+++ branches/gsoc_pdd09/languages/plumhead/src/pct/grammar.pg   Sat Jun 28 
06:58:01 2008
@@ -16,26 +16,23 @@
 
 rule  statements              { <statement>*           {*} }
 rule  statement               { <echo_statement>       {*} 
<statement_delimiter>  #= echo_statement
-                              | <function_call>        {*} 
<statement_delimiter>  #= function_call
+                              | <expression>           {*} 
<statement_delimiter>  #= expression
                               | <if_statement>         {*}                     
   #= if_statement
                               | <inline_sea>           {*}                     
   #= inline_sea
                               | <scalar_assign>        {*} 
<statement_delimiter>  #= scalar_assign
                               | <array_assign>         {*} 
<statement_delimiter>  #= array_assign
                               }
 rule  statement_delimiter     { ';' | <before \? > | $ }
-rule  echo_statement          { <ECHO>
-                                ( <expression> | <function_call> )
-                                {*}
-                              }
-rule  function_call           { <FUNCTION_NAME> <.PAREN_OPEN> <arguments> 
<.PAREN_CLOSE> {*} }
-rule  arguments               { <expression>*  {*} }
+rule  echo_statement          { <ECHO> <arguments> {*} }
+rule  function_call           { <FUNCTION_NAME> <.PAREN_OPEN> <arguments> 
<.PAREN_CLOSE>  {*} }
+rule  arguments               {  [ <expression> [',' <expression>]* ]?         
           {*} }
 rule  if_statement            { <IF> <.PAREN_OPEN> <relational_expression> 
<.PAREN_CLOSE>
                                 \{ <statements> \}
                                 <else_clause>?
                                 {*}
                               }
-token inline_sea              { <.CODE_END> <SEA_empty_allowed> <.CODE_START> 
{*} }
-rule  scalar_assign           { <var> <ASSIGN_OP> <expression>        {*} }
+token inline_sea              { <.CODE_END> <SEA_empty_allowed> <.CODE_START>  
           {*} }
+rule  scalar_assign           { <var> <ASSIGN_OP> <expression>                 
           {*} }
 rule  array_assign            { <array_elem> <ASSIGN_OP> <expression> {*} }
 
 token ECHO                    { 'echo' }
@@ -71,6 +68,7 @@
 
 token expression              { <concat_expression>       {*}  #= 
concat_expression
                               | <bitwise_expression>      {*}  #= 
bitwise_expression
+                              | <function_call>           {*}  #= function_call
                               }
 
 rule  array_elem              { <VAR_NAME> '[' <array_key> ']' {*} }

Modified: branches/gsoc_pdd09/languages/plumhead/src/phc/phc_xml_to_past_xml.xsl
==============================================================================
--- branches/gsoc_pdd09/languages/plumhead/src/phc/phc_xml_to_past_xml.xsl      
(original)
+++ branches/gsoc_pdd09/languages/plumhead/src/phc/phc_xml_to_past_xml.xsl      
Sat Jun 28 06:58:01 2008
@@ -101,9 +101,8 @@
             <xsl:when test="phc:Token_op/phc:value = 'Jg=='" 
>infix:&amp;</xsl:when>
           </xsl:choose>
         </xsl:when>
-        <xsl:when test="phc:Token_op/phc:value = '==' and phc:Token_string" 
>infix:eq</xsl:when>
-        <xsl:when test="phc:Token_op/phc:value = '!=' and phc:Token_string" 
>infix:ne</xsl:when>
-        <xsl:when test="phc:Token_op/phc:value = '^'" >infix:+^</xsl:when>
+        <xsl:when test="phc:Token_op/phc:value = '&amp;&amp;'" 
>infix:AND</xsl:when>
+        <xsl:when test="phc:Token_op/phc:value = '||'" >infix:OR</xsl:when>
         <xsl:otherwise>
           <xsl:value-of select="concat('infix:', phc:Token_op/phc:value)" />
         </xsl:otherwise>
@@ -169,7 +168,7 @@
         </past:Var>
       </xsl:when>
       <xsl:otherwise>
-        <past:Var viviself="Hash" scope="package" lvalue="1" >
+        <past:Var viviself="PhpArray" scope="package" lvalue="1" >
           <xsl:attribute name="name" ><xsl:value-of select="concat( '$', 
phc:Token_variable_name/phc:value )" /></xsl:attribute>
         </past:Var>
       </xsl:otherwise>
@@ -180,7 +179,7 @@
 </xsl:template>
 
 <xsl:template match="phc:Token_string" >
-  <past:Val returns="String" >
+  <past:Val returns="PhpString" >
     <xsl:attribute name="encoding" ><xsl:value-of select="phc:value/@encoding" 
/></xsl:attribute>
     <xsl:attribute name="value" ><xsl:value-of select="phc:value" 
/></xsl:attribute>
   </past:Val>

Modified: branches/gsoc_pdd09/languages/plumhead/src/pmc/php.pmc
==============================================================================
--- branches/gsoc_pdd09/languages/plumhead/src/pmc/php.pmc      (original)
+++ branches/gsoc_pdd09/languages/plumhead/src/pmc/php.pmc      Sat Jun 28 
06:58:01 2008
@@ -20,6 +20,7 @@
 
 #include "php_private.h"
 
+INTVAL dynpmc_PhpArray;
 INTVAL dynpmc_PhpBoolean;
 INTVAL dynpmc_PhpFloat;
 INTVAL dynpmc_PhpInteger;
@@ -41,6 +42,8 @@
         Php_PMC = NULL;
 
         if (pass) {
+            dynpmc_PhpArray = pmc_type(INTERP,
+              const_string(INTERP, "PhpArray"));
             dynpmc_PhpBoolean = pmc_type(INTERP,
               const_string(INTERP, "PhpBoolean"));
             dynpmc_PhpFloat = pmc_type(INTERP,

Modified: branches/gsoc_pdd09/languages/plumhead/src/pmc/php_private.h
==============================================================================
--- branches/gsoc_pdd09/languages/plumhead/src/pmc/php_private.h        
(original)
+++ branches/gsoc_pdd09/languages/plumhead/src/pmc/php_private.h        Sat Jun 
28 06:58:01 2008
@@ -8,6 +8,7 @@
 
 #include "parrot/parrot.h"
 
+extern INTVAL dynpmc_PhpArray;
 extern INTVAL dynpmc_PhpBoolean;
 extern INTVAL dynpmc_PhpFloat;
 extern INTVAL dynpmc_PhpInteger;

Modified: branches/gsoc_pdd09/languages/plumhead/t/php/arithmetics.t
==============================================================================
--- branches/gsoc_pdd09/languages/plumhead/t/php/arithmetics.t  (original)
+++ branches/gsoc_pdd09/languages/plumhead/t/php/arithmetics.t  Sat Jun 28 
06:58:01 2008
@@ -113,10 +113,10 @@
     [ '2 * 2 + .4', '4.4', ],
     [ '.1 - 6 / 2', '-2.9', ],
     # TODO [ '-1.0000001', '-1.0000001', 'probably limited precission of Float 
PMC', ],
-    [ '1 & 3', '1', 'bitwise and', ],
-    [ '2 & 2 + 8', '2', 'bitwise and, less precedence than +', ],
-    [ '1 | 2', '3', 'bitwise or', ],
-    [ '6 ^ 5', '3', 'bitwise xor', ],
+    # TODO [ '1 & 3', '1', 'bitwise and', ],
+    # TODO [ '2 & 2 + 8', '2', 'bitwise and, less precedence than +', ],
+    # TODO [ '1 | 2', '3', 'bitwise or', ],
+    # TODO [ '6 ^ 5', '3', 'bitwise xor', ],
     # TODO [ '010', 8, 'octal' ],
     # TODO [ '0x10', 16, 'hex' ],
 );

Modified: branches/gsoc_pdd09/languages/plumhead/t/php/base64.t
==============================================================================
--- branches/gsoc_pdd09/languages/plumhead/t/php/base64.t       (original)
+++ branches/gsoc_pdd09/languages/plumhead/t/php/base64.t       Sat Jun 28 
06:58:01 2008
@@ -26,13 +26,8 @@
 use lib "$FindBin::Bin/../../lib";
 
 use Test::More     tests => 2;
-
-TODO: {
-    local $TODO = 'awaiting compiler changes';
-
 use Parrot::Test;
 
-
 language_output_is( 'Plumhead', <<'CODE', <<'OUTPUT', 'base64_encode(str)' );
 <?php
   echo base64_encode('Plum Headed Parakeet'), "\n";
@@ -49,8 +44,6 @@
 Plum Headed Parakeet
 OUTPUT
 
-}
-
 # Local Variables:
 #   mode: cperl
 #   cperl-indent-level: 4

Modified: branches/gsoc_pdd09/languages/plumhead/t/php/builtin.t
==============================================================================
--- branches/gsoc_pdd09/languages/plumhead/t/php/builtin.t      (original)
+++ branches/gsoc_pdd09/languages/plumhead/t/php/builtin.t      Sat Jun 28 
06:58:01 2008
@@ -27,9 +27,6 @@
 
 use Test::More     tests => 5;
 
-TODO: {
-    local $TODO = 'awaiting compiler changes';
-
 use Parrot::Test;
 
 
@@ -77,9 +74,6 @@
 /Wrong parameter count for/
 OUTPUT
 
-
-}
-
 # Local Variables:
 #   mode: cperl
 #   cperl-indent-level: 4

Modified: branches/gsoc_pdd09/languages/plumhead/t/php/ctype.t
==============================================================================
--- branches/gsoc_pdd09/languages/plumhead/t/php/ctype.t        (original)
+++ branches/gsoc_pdd09/languages/plumhead/t/php/ctype.t        Sat Jun 28 
06:58:01 2008
@@ -27,9 +27,6 @@
 
 use Test::More     tests => 3;
 
-TODO: {
-    local $TODO = 'awaiting compiler changes';
-
 use Parrot::Test;
 
 
@@ -57,8 +54,6 @@
 
 OUTPUT
 
-}
-
 # Local Variables:
 #   mode: cperl
 #   cperl-indent-level: 4

Modified: branches/gsoc_pdd09/languages/plumhead/t/php/hello.t
==============================================================================
--- branches/gsoc_pdd09/languages/plumhead/t/php/hello.t        (original)
+++ branches/gsoc_pdd09/languages/plumhead/t/php/hello.t        Sat Jun 28 
06:58:01 2008
@@ -168,7 +168,7 @@
 END_EXPECTED
 
 
-language_output_is( 'Plumhead', <<'END_CODE', <<'END_EXPECTED', 'concatenation 
of two strings' );
+language_output_is( 'Plumhead', <<'END_CODE', <<'END_EXPECTED', 'concatenation 
of two strings', todo => 'currently broken' );
 <?php
 echo 'Hello, ' . "World!\n"
 ?>
@@ -177,7 +177,7 @@
 END_EXPECTED
 
 
-language_output_is( 'Plumhead', <<'END_CODE', <<'END_EXPECTED', 'concatenation 
of four strings' );
+language_output_is( 'Plumhead', <<'END_CODE', <<'END_EXPECTED', 'concatenation 
of four strings', todo => 'currently broken' );
 <?php
 echo 'Hell' . 'o, ' . 'World!' . "\n"
 ?>

Modified: branches/gsoc_pdd09/languages/plumhead/t/php/info.t
==============================================================================
--- branches/gsoc_pdd09/languages/plumhead/t/php/info.t (original)
+++ branches/gsoc_pdd09/languages/plumhead/t/php/info.t Sat Jun 28 06:58:01 2008
@@ -28,10 +28,6 @@
 use Test::More     tests => 8;
 use Parrot::Test;
 
-TODO: {
-    local $TODO = 'awaiting compiler updates';
-
-
 language_output_is( 'Plumhead', <<'CODE', <<'OUTPUT', 'php_egg_logo_guid()' );
 <?php
   echo php_egg_logo_guid(), "\n";
@@ -96,8 +92,6 @@
 PHPE9568F35-D428-11d2-A769-00AA001ACF42
 OUTPUT
 
-}
-
 # Local Variables:
 #   mode: cperl
 #   cperl-indent-level: 4

Modified: branches/gsoc_pdd09/languages/plumhead/t/php/math.t
==============================================================================
--- branches/gsoc_pdd09/languages/plumhead/t/php/math.t (original)
+++ branches/gsoc_pdd09/languages/plumhead/t/php/math.t Sat Jun 28 06:58:01 2008
@@ -28,10 +28,7 @@
 use Test::More     tests => 32;
 use Parrot::Test;
 
-TODO: {
-    local $TODO = 'awaiting compiler updates';
-
-language_output_is( 'Plumhead', <<'CODE', <<'OUTPUT', 'abs' );
+language_output_is( 'Plumhead', <<'CODE', <<'OUTPUT', 'abs', todo => 'broken 
in PCT variant' );
 <?php
   echo abs(-3), "\n";
   echo abs(-3.14), "\n";
@@ -298,7 +295,6 @@
 CODE
 /^0\.462/
 OUTPUT
-}
 
 # Local Variables:
 #   mode: cperl

Modified: branches/gsoc_pdd09/languages/plumhead/t/php/md5.t
==============================================================================
--- branches/gsoc_pdd09/languages/plumhead/t/php/md5.t  (original)
+++ branches/gsoc_pdd09/languages/plumhead/t/php/md5.t  Sat Jun 28 06:58:01 2008
@@ -29,10 +29,6 @@
 
 use Parrot::Test;
 
-TODO: {
-    local $TODO = 'awaiting compiler changes';
-
-
 language_output_is( 'Plumhead', <<'CODE', <<'OUTPUT', 'md5(msg)' );
 <?php
   echo md5('message digest'), "\n";
@@ -41,7 +37,7 @@
 f96b697d7cb7938d525a2f31aaf161d0
 OUTPUT
 
-language_output_is( 'Plumhead', <<'CODE', <<'OUTPUT', 'md5(msg, FALSE)' );
+language_output_is( 'Plumhead', <<'CODE', <<'OUTPUT', 'md5(msg, FALSE)', todo 
=> 'booleans not supported yet in PCT variant' );
 <?php
   echo md5('message digest', FALSE), "\n";
 ?>
@@ -49,11 +45,7 @@
 f96b697d7cb7938d525a2f31aaf161d0
 OUTPUT
 
-TODO:
-{
-    local $TODO = 'update compiler';
-
-language_output_is( 'Plumhead', <<'CODE', <<'OUTPUT', 'md5(msg, TRUE)' );
+language_output_is( 'Plumhead', <<'CODE', <<'OUTPUT', 'md5(msg, TRUE)', todo 
=> 'booleans not supported yet in PCT variant' );
 <?php
   $md = md5('message digest', TRUE);
   echo gettype($md), "\n";
@@ -63,7 +55,6 @@
 string
 16
 OUTPUT
-}
 
 unlink '../file.txt' if (-f '../file.txt');
 open my $X, '>', '../file.txt';
@@ -80,20 +71,13 @@
 
 unlink '../file.txt' if (-f '../file.txt');
 
-}
-
-TODO:
-{
-    local $TODO = 'handle no file';
-
-language_output_like( 'Plumhead', <<'CODE', <<'OUTPUT', 'md5_file(nofile)' );
+language_output_is( 'Plumhead', <<'CODE', <<'OUTPUT', 'md5_file(nofile)' );
 <?php
   echo md5_file('nofile.txt'), "\n";
 ?>
 CODE
-/md5_file/
+
 OUTPUT
-}
 
 # Local Variables:
 #   mode: cperl

Modified: branches/gsoc_pdd09/languages/plumhead/t/php/rand.t
==============================================================================
--- branches/gsoc_pdd09/languages/plumhead/t/php/rand.t (original)
+++ branches/gsoc_pdd09/languages/plumhead/t/php/rand.t Sat Jun 28 06:58:01 2008
@@ -27,12 +27,8 @@
 
 use Test::More     tests => 11;
 
-TODO: {
-    local $TODO = 'awaiting compiler changes';
-
 use Parrot::Test;
 
-
 language_output_is( 'Plumhead', <<'CODE', <<'OUTPUT', 'getrandmax()' );
 <?php
   echo getrandmax(), "\n";
@@ -117,8 +113,6 @@
 CODE
 OUTPUT
 
-}
-
 # Local Variables:
 #   mode: cperl
 #   cperl-indent-level: 4

Modified: branches/gsoc_pdd09/languages/plumhead/t/php/relops.t
==============================================================================
--- branches/gsoc_pdd09/languages/plumhead/t/php/relops.t       (original)
+++ branches/gsoc_pdd09/languages/plumhead/t/php/relops.t       Sat Jun 28 
06:58:01 2008
@@ -81,7 +81,7 @@
 END_CODE
 
 
-language_output_is( 'Plumhead', <<'END_CODE', $expected, 'equal' );
+language_output_is( 'Plumhead', <<'END_CODE', $expected, 'equal', todo => 
'currently broken' );
 <?php
 if ( 1 == 1 )
 {
@@ -135,7 +135,7 @@
 END_CODE
 
 
-language_output_is( 'Plumhead', <<'END_CODE', $expected, 'unequal' );
+language_output_is( 'Plumhead', <<'END_CODE', $expected, 'unequal', todo => 
'currently broken' );
 <?php
 if ( 1 != 2 )
 {
@@ -190,7 +190,7 @@
 END_CODE
 
 
-language_output_is( 'Plumhead', <<'END_CODE', $expected, 'not equal' );
+language_output_is( 'Plumhead', <<'END_CODE', $expected, 'not equal', todo => 
'currently broken' );
 <?php
 if ( 1 == 2 )
 {
@@ -244,7 +244,7 @@
 END_CODE
 
 
-language_output_is( 'Plumhead', <<'END_CODE', $expected, 'not unequal' );
+language_output_is( 'Plumhead', <<'END_CODE', $expected, 'not unequal', todo 
=> 'currently broken' );
 <?php
 if ( 1 != 1 )
 {

Modified: branches/gsoc_pdd09/languages/plumhead/t/php/string.t
==============================================================================
--- branches/gsoc_pdd09/languages/plumhead/t/php/string.t       (original)
+++ branches/gsoc_pdd09/languages/plumhead/t/php/string.t       Sat Jun 28 
06:58:01 2008
@@ -28,10 +28,6 @@
 use Test::More     tests => 11;
 use Parrot::Test;
 
-TODO: {
-    local $TODO = 'awaiting compiler updates';
-
-
 language_output_is( 'Plumhead', <<'CODE', <<'OUTPUT', 'bin2hex' );
 <?php
   echo bin2hex('Ab3'), "\n";
@@ -142,8 +138,6 @@
 Abc
 OUTPUT
 
-}
-
 # Local Variables:
 #   mode: cperl
 #   cperl-indent-level: 4

Modified: branches/gsoc_pdd09/languages/plumhead/t/php/strings.t
==============================================================================
--- branches/gsoc_pdd09/languages/plumhead/t/php/strings.t      (original)
+++ branches/gsoc_pdd09/languages/plumhead/t/php/strings.t      Sat Jun 28 
06:58:01 2008
@@ -24,7 +24,7 @@
 use Parrot::Test;
 
 
-language_output_is( 'Plumhead', <<'END_CODE', <<'END_EXPECTED', '== for equal 
strings' );
+language_output_is( 'Plumhead', <<'END_CODE', <<'END_EXPECTED', '== for equal 
strings', todo => 'currently broken' );
 <?php
 if ( 'asdf' == 'asdf' )
 {
@@ -36,7 +36,7 @@
 END_EXPECTED
 
 
-language_output_is( 'Plumhead', <<'END_CODE', <<'END_EXPECTED', '== for 
unequal strings' );
+language_output_is( 'Plumhead', <<'END_CODE', <<'END_EXPECTED', '== for 
unequal strings', todo => 'currently broken' );
 <?php
 if ( 'asdf' == 'jklÃ' )
 {
@@ -52,7 +52,7 @@
 END_EXPECTED
 
 
-language_output_is( 'Plumhead', <<'END_CODE', <<'END_EXPECTED', '!= for equal 
strings' );
+language_output_is( 'Plumhead', <<'END_CODE', <<'END_EXPECTED', '!= for equal 
strings', todo => 'currently broken' );
 <?php
 if ( 'asdf' != 'asdf' )
 {
@@ -68,7 +68,7 @@
 END_EXPECTED
 
 
-language_output_is( 'Plumhead', <<'END_CODE', <<'END_EXPECTED', '!= for 
unequal strings' );
+language_output_is( 'Plumhead', <<'END_CODE', <<'END_EXPECTED', '!= for 
unequal strings', todo => 'currently broken' );
 <?php
 if ( 'asdf' != 'jklÃ' )
 {

Modified: branches/gsoc_pdd09/languages/plumhead/t/php/superglobals.t
==============================================================================
--- branches/gsoc_pdd09/languages/plumhead/t/php/superglobals.t (original)
+++ branches/gsoc_pdd09/languages/plumhead/t/php/superglobals.t Sat Jun 28 
06:58:01 2008
@@ -42,7 +42,7 @@
 df
 END_EXPECTED
 
-language_output_is( 'Plumhead', <<'END_CODE', <<'END_EXPECTED', 'var_dump( 
$_GET )' );
+language_output_is( 'Plumhead', <<'END_CODE', <<'END_EXPECTED', 'var_dump( 
$_GET )', todo => 'currently broken' );
 <?php
 var_dump( $_GET );
 echo "\n";

Modified: branches/gsoc_pdd09/languages/plumhead/t/php/type.t
==============================================================================
--- branches/gsoc_pdd09/languages/plumhead/t/php/type.t (original)
+++ branches/gsoc_pdd09/languages/plumhead/t/php/type.t Sat Jun 28 06:58:01 2008
@@ -25,13 +25,10 @@
 use FindBin;
 use lib "$FindBin::Bin/../../lib";
 
-use Test::More     tests => 17;
+use Test::More     tests => 18;
 use Parrot::Test;
 
-TODO: {
-    local $TODO = 'await compiler changes';
-
-language_output_is( 'Plumhead', <<'CODE', <<'OUTPUT', 'floatval()' );
+language_output_is( 'Plumhead', <<'CODE', <<'OUTPUT', 'floatval()', todo => 
'broken in PCT variant' );
 <?php
   echo floatval(TRUE), "\n";
   echo floatval(NULL), "\n";
@@ -51,7 +48,7 @@
 0
 OUTPUT
 
-language_output_is( 'Plumhead', <<'CODE', <<'OUTPUT', 'gettype(TRUE)' );
+language_output_is( 'Plumhead', <<'CODE', <<'OUTPUT', 'gettype(TRUE)', todo => 
'broken in PCT variant' );
 <?php
   echo gettype(TRUE), "\n";
 ?>
@@ -59,7 +56,7 @@
 boolean
 OUTPUT
 
-language_output_is( 'Plumhead', <<'CODE', <<'OUTPUT', 'gettype(NULL)' );
+language_output_is( 'Plumhead', <<'CODE', <<'OUTPUT', 'gettype(NULL)', todo => 
'broken in PCT variant' );
 <?php
   echo gettype(NULL), "\n";
 ?>
@@ -83,10 +80,6 @@
 double
 OUTPUT
 
-TODO:
-{
-    local $TODO = 'update compiler';
-
 language_output_is( 'Plumhead', <<'CODE', <<'OUTPUT', 'gettype("str")' );
 <?php
   echo gettype('str'), "\n";
@@ -95,9 +88,17 @@
 string
 OUTPUT
 
-}
+language_output_is( 'Plumhead', <<'CODE', <<'OUTPUT', 'gettype($array)' );
+<?php
+  $hello['world'] = 'hi';
+  echo gettype($hello), "\n";
+?>
+CODE
+array
+OUTPUT
 
-language_output_is( 'Plumhead', <<'CODE', <<'OUTPUT', 'intval()' );
+
+language_output_is( 'Plumhead', <<'CODE', <<'OUTPUT', 'intval()', todo => 
'broken in PCT variant' );
 <?php
   echo intval(TRUE), "\n";
   echo intval(NULL), "\n";
@@ -131,7 +132,7 @@
 /Only one argument expected/
 OUTPUT
 
-language_output_is( 'Plumhead', <<'CODE', <<'OUTPUT', 'is_bool(TRUE)' );
+language_output_is( 'Plumhead', <<'CODE', <<'OUTPUT', 'is_bool(TRUE)', todo => 
'broken in PCT variant' );
 <?php
   echo is_bool(TRUE), "\n";
 ?>
@@ -155,7 +156,7 @@
 1
 OUTPUT
 
-language_output_is( 'Plumhead', <<'CODE', <<'OUTPUT', 'is_null(NULL)' );
+language_output_is( 'Plumhead', <<'CODE', <<'OUTPUT', 'is_null(NULL)', todo => 
'broken in PCT variant' );
 <?php
   echo is_null(NULL), "\n";
 ?>
@@ -163,7 +164,7 @@
 1
 OUTPUT
 
-language_output_is( 'Plumhead', <<'CODE', <<'OUTPUT', 'is_numeric()' );
+language_output_is( 'Plumhead', <<'CODE', <<'OUTPUT', 'is_numeric()', todo => 
'broken in PCT variant' );
 <?php
   echo is_numeric(3), "\n";
   echo is_numeric(3.14), "\n";
@@ -189,7 +190,7 @@
 
 OUTPUT
 
-language_output_is( 'Plumhead', <<'CODE', <<'OUTPUT', 'is_scalar()' );
+language_output_is( 'Plumhead', <<'CODE', <<'OUTPUT', 'is_scalar()', todo => 
'broken in PCT variant' );
 <?php
   echo is_scalar(NULL), "\n";
   echo is_scalar(TRUE), "\n";
@@ -230,7 +231,7 @@
 
 }
 
-language_output_is( 'Plumhead', <<'CODE', <<'OUTPUT', 'strval(TRUE)' );
+language_output_is( 'Plumhead', <<'CODE', <<'OUTPUT', 'strval(TRUE)', todo => 
'broken in PCT variant' );
 <?php
   echo strval(TRUE), "\n";
 ?>
@@ -238,8 +239,6 @@
 1
 OUTPUT
 
-}
-
 # Local Variables:
 #   mode: cperl
 #   cperl-indent-level: 4

Modified: branches/gsoc_pdd09/src/dynpmc/gdbmhash.pmc
==============================================================================
--- branches/gsoc_pdd09/src/dynpmc/gdbmhash.pmc (original)
+++ branches/gsoc_pdd09/src/dynpmc/gdbmhash.pmc Sat Jun 28 06:58:01 2008
@@ -25,8 +25,6 @@
 =head2 store
 
 PMC insert values are converted to STRINGs.
-RT#46387: Integer insert values are converted to STRINGs.
-RT#46389: Number insert values are converted to STRINGs.
 
 =head2 fetch
 
@@ -35,7 +33,6 @@
 
 When a PMC is requested, a String PMC is returned.
 
-RT#46391: return None PMC for nonexisting keys.
 
 =head2 Functions
 
@@ -224,8 +221,8 @@
         GDBM_FILE dbf = (GDBM_FILE)PMC_struct_val(SELF);
         datum key_gdbm, val_gdbm;
 
-        if (!key) return NULL;
-        if (!dbf) return NULL;
+        if (!key) return PMCNULL;
+        if (!dbf) return PMCNULL;
         keystr = make_hash_key(interp, key);
 
         key_gdbm.dsize = keystr->strlen;

Modified: branches/gsoc_pdd09/src/gc/memory.c
==============================================================================
--- branches/gsoc_pdd09/src/gc/memory.c (original)
+++ branches/gsoc_pdd09/src/gc/memory.c Sat Jun 28 06:58:01 2008
@@ -242,6 +242,34 @@
     return ptr;
 }
 
+#if 0
+
+PARROT_MALLOC
+PARROT_CANNOT_RETURN_NULL
+void *
+mem__internal_realloc_zeroed(ARGFREE(void *from), size_t size, size_t old_size,
+    ARGIN(const char *file), int line)
+{
+    void * const ptr = realloc(from, size);
+#ifdef DETAIL_MEMORY_DEBUG
+    fprintf(stderr, "internal free of %p (realloc -- %i bytes) (%s/%d)\n",
+            from, size, file, line);
+    fprintf(stderr, "Internal malloc %i at %p (%s/%d)\n",
+            size, ptr, file, line);
+#else
+    UNUSED(file);
+    UNUSED(line);
+#endif
+    if (!ptr)
+        PANIC(NULL, "Out of mem");
+    if (size > old_size)
+        memset((char*)ptr + old_size, 0, size - old_size);
+
+    return ptr;
+}
+
+#endif
+
 /*
 
 =item C<void mem_sys_free>

Modified: branches/gsoc_pdd09/src/pmc/closure.pmc
==============================================================================
--- branches/gsoc_pdd09/src/pmc/closure.pmc     (original)
+++ branches/gsoc_pdd09/src/pmc/closure.pmc     Sat Jun 28 06:58:01 2008
@@ -91,7 +91,12 @@
         opcode_t   *next      = SUPER(in_next);
         PMC        *outer_sub = sub->outer_sub;
 
-        if (sub->outer_ctx) {
+        if (sub->ctx->caller_ctx->current_sub == outer_sub) {
+            /* Being called from outer sub, in which case our outer is its
+             * context. */
+            sub->outer_ctx = sub->ctx->outer_ctx = PMC_sub(outer_sub)->ctx;
+        }
+        else if (sub->outer_ctx) {
             /* during newclosure, outer's ctx was stored in sub->outer_ctx */
             sub->ctx->outer_ctx = sub->outer_ctx;
         }

<Prev in Thread] Current Thread [Next in Thread>
  • [svn:parrot] r28780 - in branches/gsoc_pdd09: . languages/perl6/src/classes languages/perl6/src/parser languages/plumhead/config/makefiles languages/plumhead/pmc languages/plumhead/src/common languages/plumhead/src/pct languages/plumhead/src/phc languages/plumhead/src/pmc languages/plumhead/t/php src/dynpmc src/gc src/pmc, Whiteknight <=