Author: bernhard
Date: Thu Dec 11 11:56:32 2008
New Revision: 33805
Modified:
trunk/languages/pipp/src/common/php_API.pir
trunk/languages/pipp/src/common/php_file.pir
trunk/languages/pipp/src/common/php_md5.pir
trunk/languages/pipp/src/common/php_sha1.pir
trunk/languages/pipp/t/php/builtin.t
trunk/languages/pipp/t/php/file.t
Log:
[Pipp] Use FileHandle class for PHP streams, still some failures
Modified: trunk/languages/pipp/src/common/php_API.pir
==============================================================================
--- trunk/languages/pipp/src/common/php_API.pir (original)
+++ trunk/languages/pipp/src/common/php_API.pir Thu Dec 11 11:56:32 2008
@@ -429,7 +429,10 @@
.param string mode
.param int options
.param pmc context :optional
- $P0 = open path, mode
+
+ $P0 = new 'FileHandle'
+ $P0.'open'( path, mode )
+
.return ($P0)
.end
Modified: trunk/languages/pipp/src/common/php_file.pir
==============================================================================
--- trunk/languages/pipp/src/common/php_file.pir (original)
+++ trunk/languages/pipp/src/common/php_file.pir Thu Dec 11 11:56:32 2008
@@ -13,7 +13,7 @@
=cut
-.const string STREAM_PMC = 'ParrotIO'
+.const string STREAM_PMC = 'FileHandle'
.const int SEEK_SET = 0
.const int SEEK_CUR = 1
@@ -226,6 +226,7 @@
.sub 'file_get_contents'
.param pmc args :slurpy
+
.local string filename
.local int use_include_path
.local pmc context
@@ -249,11 +250,11 @@
unless use_include_path goto L3
$I0 |= USE_PATH
L3:
- stream = stream_open(filename, '<', $I0, context)
+ stream = stream_open(filename, 'r', $I0, context)
if stream goto L4
.RETURN_FALSE()
L4:
- $S0 = stream.'slurp'('')
+ $S0 = stream.'readall'()
close stream
.RETURN_STRING($S0)
.end
Modified: trunk/languages/pipp/src/common/php_md5.pir
==============================================================================
--- trunk/languages/pipp/src/common/php_md5.pir (original)
+++ trunk/languages/pipp/src/common/php_md5.pir Thu Dec 11 11:56:32 2008
@@ -85,7 +85,7 @@
L1:
.local pmc f, md, res
$I0 = REPORT_ERRORS | ENFORCE_SAFE_MODE
- f = stream_open(filename, '<', $I0)
+ f = stream_open(filename, 'r', $I0)
unless f goto L2
new md, 'MD5'
md.'Init'()
Modified: trunk/languages/pipp/src/common/php_sha1.pir
==============================================================================
--- trunk/languages/pipp/src/common/php_sha1.pir (original)
+++ trunk/languages/pipp/src/common/php_sha1.pir Thu Dec 11 11:56:32 2008
@@ -85,7 +85,7 @@
L1:
.local pmc f, md, res
$I0 = REPORT_ERRORS | ENFORCE_SAFE_MODE
- f = stream_open(filename, '<', $I0)
+ f = stream_open(filename, 'r', $I0)
unless f goto L2
new md, 'SHA1'
md.'Init'()
Modified: trunk/languages/pipp/t/php/builtin.t
==============================================================================
--- trunk/languages/pipp/t/php/builtin.t (original)
+++ trunk/languages/pipp/t/php/builtin.t Thu Dec 11 11:56:32 2008
@@ -34,7 +34,7 @@
echo get_resource_type($fp);
?>
CODE
-/^(stream|ParrotIO)$/
+/^(stream|FileHandle)$/
OUT
unlink 'pipp/file.txt' if (-f 'pipp/file.txt');
Modified: trunk/languages/pipp/t/php/file.t
==============================================================================
--- trunk/languages/pipp/t/php/file.t (original)
+++ trunk/languages/pipp/t/php/file.t Thu Dec 11 11:56:32 2008
@@ -103,7 +103,7 @@
fclose('bad');
?>
CODE
-/fclose\(\): supplied argument is not a valid (stream|ParrotIO) resource/
+/fclose\(\): supplied argument is not a valid (stream|FileHandle) resource/
OUT
language_output_is( 'Pipp', <<'CODE', <<'OUT', 'fpassthru()' );