[svn:languages] r116 - forth/trunk
fperrad at svn.parrot.org
fperrad at svn.parrot.org
Fri May 28 15:58:20 UTC 2010
Author: fperrad
Date: Fri May 28 15:58:20 2010
New Revision: 116
URL: https://trac.parrot.org/languages/changeset/116
Log:
[forth] fix after ops massacre
Modified:
forth/trunk/forth.pir
forth/trunk/test.pir
Modified: forth/trunk/forth.pir
==============================================================================
--- forth/trunk/forth.pir Mon May 10 14:58:52 2010 (r115)
+++ forth/trunk/forth.pir Fri May 28 15:58:20 2010 (r116)
@@ -1,4 +1,6 @@
+.loadlib 'io_ops'
+
.sub 'main' :main
.param pmc args
$S0 = shift args
@@ -22,9 +24,10 @@
.param string filename
.local string source
- $P0 = open filename
+ $P0 = new 'FileHandle'
+ $P0.'open'(filename)
source = $P0.'readall'()
- close $P0
+ $P0.'close'()
.local pmc forth
forth = compreg 'forth'
@@ -42,7 +45,7 @@
loop:
print "> "
- $S0 = readline stdin
+ $S0 = stdin.'readline'()
unless stdin goto end
push_eh exception
Modified: forth/trunk/test.pir
==============================================================================
--- forth/trunk/test.pir Mon May 10 14:58:52 2010 (r115)
+++ forth/trunk/test.pir Fri May 28 15:58:20 2010 (r116)
@@ -1,4 +1,6 @@
+.loadlib 'io_ops'
+
# this is the test program for the forth implementation targeting parrot.
# this script can be passed the names of any number of test files. each test is
# a series of input/output pairs, with optional comments that start with #s.
@@ -34,7 +36,8 @@
.param string filename
.local pmc file
- file = open filename
+ file = new 'FileHandle'
+ file.'open'(filename)
.local string input, expected
.local int num_of_tests
@@ -55,7 +58,7 @@
print "1.."
print num_of_tests
print "\n"
- close file
+ file.'close'()
.return()
missing_output:
@@ -70,7 +73,7 @@
.param pmc file
.local string line
next_line:
- line = readline file
+ line = file.'readline'()
if line == '' goto end_of_file
$S0 = substr line, 0, 1
if $S0 == "\n" goto next_line
@@ -123,7 +126,7 @@
stack = $P0()
pop_eh
setstdout stdout
- output = readline fh
+ output = fh.'readline'()
if output != "" goto compare
output = join " ", stack
goto compare
More information about the parrot-commits
mailing list