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

[svn:parrot] r28743 - in branches/libs4php/languages/plumhead: src/commo

Subject: [svn:parrot] r28743 - in branches/libs4php/languages/plumhead: src/common src/phc t/php
From:
Date: Fri, 27 Jun 2008 06:22:55 -0700 PDT
Newsgroups: perl.cvs.parrot

Author: fperrad
Date: Fri Jun 27 06:22:55 2008
New Revision: 28743

Modified:
   branches/libs4php/languages/plumhead/src/common/php_type.pir
   branches/libs4php/languages/plumhead/src/common/php_var.pir
   branches/libs4php/languages/plumhead/src/common/plumhead.pir
   branches/libs4php/languages/plumhead/src/phc/phc_xml_to_past_xml.xsl
   branches/libs4php/languages/plumhead/t/php/type.t

Log:
[php] now use PhpString

Modified: branches/libs4php/languages/plumhead/src/common/php_type.pir
==============================================================================
--- branches/libs4php/languages/plumhead/src/common/php_type.pir        
(original)
+++ branches/libs4php/languages/plumhead/src/common/php_type.pir        Fri Jun 
27 06:22:55 2008
@@ -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/libs4php/languages/plumhead/src/common/php_var.pir
==============================================================================
--- branches/libs4php/languages/plumhead/src/common/php_var.pir (original)
+++ branches/libs4php/languages/plumhead/src/common/php_var.pir Fri Jun 27 
06:22:55 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

Modified: branches/libs4php/languages/plumhead/src/common/plumhead.pir
==============================================================================
--- branches/libs4php/languages/plumhead/src/common/plumhead.pir        
(original)
+++ branches/libs4php/languages/plumhead/src/common/plumhead.pir        Fri Jun 
27 06:22:55 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/libs4php/languages/plumhead/src/phc/phc_xml_to_past_xml.xsl
==============================================================================
--- branches/libs4php/languages/plumhead/src/phc/phc_xml_to_past_xml.xsl        
(original)
+++ branches/libs4php/languages/plumhead/src/phc/phc_xml_to_past_xml.xsl        
Fri Jun 27 06:22:55 2008
@@ -159,7 +159,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/libs4php/languages/plumhead/t/php/type.t
==============================================================================
--- branches/libs4php/languages/plumhead/t/php/type.t   (original)
+++ branches/libs4php/languages/plumhead/t/php/type.t   Fri Jun 27 06:22:55 2008
@@ -80,10 +80,6 @@
 double
 OUTPUT
 
-TODO:
-{
-    local $TODO = 'update compiler';
-
 language_output_is( 'Plumhead', <<'CODE', <<'OUTPUT', 'gettype("str")' );
 <?php
   echo gettype('str'), "\n";
@@ -92,8 +88,6 @@
 string
 OUTPUT
 
-}
-
 language_output_is( 'Plumhead', <<'CODE', <<'OUTPUT', 'gettype($array)' );
 <?php
   $hello['world'] = 'hi';

<Prev in Thread] Current Thread [Next in Thread>
  • [svn:parrot] r28743 - in branches/libs4php/languages/plumhead: src/common src/phc t/php, fperrad <=