develooper Front page | perl.cvs.parrot | Postings from January 2009

[svn:parrot] r35918 - in trunk/languages/pipp: . src/common t/php

From:
bernhard
Date:
January 23, 2009 12:23
Subject:
[svn:parrot] r35918 - in trunk/languages/pipp: . src/common t/php
Message ID:
20090123202331.42DDCCB9AE@x12.develooper.com
Author: bernhard
Date: Fri Jan 23 12:23:30 2009
New Revision: 35918

Modified:
   trunk/languages/pipp/pipp.pir
   trunk/languages/pipp/src/common/php_dir.pir
   trunk/languages/pipp/src/common/php_info.pir
   trunk/languages/pipp/t/php/constant.t

Log:
[Pipp] Register constants 'DIRECTORY_SEPARATOR' and 'PATH_SEPARATOR'

Modified: trunk/languages/pipp/pipp.pir
==============================================================================
--- trunk/languages/pipp/pipp.pir	(original)
+++ trunk/languages/pipp/pipp.pir	Fri Jan 23 12:23:30 2009
@@ -88,7 +88,7 @@
 
     # import PGE::Util::die into Pipp::Grammar
     $P0 = get_root_global ['parrot';'PGE';'Util'], 'die'
-    set_hll_global ['Pipp';'Grammar'], 'die', $P0
+    set_hll_global ['Pipp'; 'Grammar'], 'die', $P0
     set_hll_global ['Pipp'], 'die', $P0
 
     # Initialize the stack @?BLOCK

Modified: trunk/languages/pipp/src/common/php_dir.pir
==============================================================================
--- trunk/languages/pipp/src/common/php_dir.pir	(original)
+++ trunk/languages/pipp/src/common/php_dir.pir	Fri Jan 23 12:23:30 2009
@@ -1,4 +1,4 @@
-# Copyright (C) 2008, The Perl Foundation.
+# Copyright (C) 2008-2009, The Perl Foundation.
 # $Id$
 
 =head1 NAME
@@ -13,6 +13,18 @@
 
 =cut
 
+.sub '__init' :anon :load :init
+    # get some config info
+    .local pmc cfg
+    $P0 = get_root_global ['parrot'], '_config'
+    cfg  = $P0()
+    .local string slash
+    slash = cfg['slash']
+
+    .REGISTER_STRING_CONSTANT('DIRECTORY_SEPARATOR', slash)
+    .REGISTER_STRING_CONSTANT('PATH_SEPARATOR', slash)
+.end
+
 =item C<bool chdir(string directory)>
 
 Change the current directory

Modified: trunk/languages/pipp/src/common/php_info.pir
==============================================================================
--- trunk/languages/pipp/src/common/php_info.pir	(original)
+++ trunk/languages/pipp/src/common/php_info.pir	Fri Jan 23 12:23:30 2009
@@ -1,4 +1,4 @@
-# Copyright (C) 2008, The Perl Foundation.
+# Copyright (C) 2008-2009, The Perl Foundation.
 # $Id$
 
 =head1 NAME
@@ -37,7 +37,6 @@
     # register NULL
     new $P0, 'PhpNull'
     set_hll_global 'NULL', $P0
-
 .end
 
 .sub 'logo_guid' :anon

Modified: trunk/languages/pipp/t/php/constant.t
==============================================================================
--- trunk/languages/pipp/t/php/constant.t	(original)
+++ trunk/languages/pipp/t/php/constant.t	Fri Jan 23 12:23:30 2009
@@ -1,4 +1,4 @@
-# Copyright (C) 2008, The Perl Foundation.
+# Copyright (C) 2008-2009, The Perl Foundation.
 # $Id$
 
 =head1 NAME
@@ -22,7 +22,7 @@
 use FindBin;
 use lib "$FindBin::Bin/../../../../lib", "$FindBin::Bin/../../lib";
 
-use Parrot::Test   tests => 23;
+use Parrot::Test   tests => 25;
 use Parrot::Config qw( %PConfig );
 
 language_output_is( 'Pipp', <<'CODE', <<'OUT', 'define() and constant(), string' );
@@ -137,7 +137,7 @@
 /Couldn't find constant UNDEF_CST/
 OUT
 
-# predefined constants
+# predefined constants of the info extension
 
 language_output_is( 'Pipp', <<'CODE', $PConfig{osname}, 'PHP_OS' );
 <?php
@@ -196,6 +196,18 @@
 echo DEFAULT_INCLUDE_PATH;
 CODE
 
+# predefined constants of the dir extension
+
+language_output_is( 'Pipp', <<'CODE', $PConfig{slash}, 'DIRECTORY_SEPARATOR' );
+<?php
+echo constant("DIRECTORY_SEPARATOR");
+CODE
+
+language_output_is( 'Pipp', <<'CODE', $PConfig{slash}, 'PATH_SEPARATOR' );
+<?php
+echo constant("PATH_SEPARATOR");
+CODE
+
 # Local Variables:
 #   mode: cperl
 #   cperl-indent-level: 4



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About