[svn:parrot] r47284 - trunk/examples/nci
NotFound at svn.parrot.org
NotFound at svn.parrot.org
Wed Jun 2 06:18:21 UTC 2010
Author: NotFound
Date: Wed Jun 2 06:18:21 2010
New Revision: 47284
URL: https://trac.parrot.org/parrot/changeset/47284
Log:
use a new 'FileHandle' and its methods instead of open and close opcodes in example xlib
Modified:
trunk/examples/nci/xlibtest.pir
Modified: trunk/examples/nci/xlibtest.pir
==============================================================================
--- trunk/examples/nci/xlibtest.pir Wed Jun 2 06:00:12 2010 (r47283)
+++ trunk/examples/nci/xlibtest.pir Wed Jun 2 06:18:21 2010 (r47284)
@@ -277,13 +277,14 @@
push_eh newfile
.local pmc handle
- handle = open filename, 'r'
+ handle = new 'FileHandle'
+ handle.'open'(filename, 'r')
pop_eh
push_eh failed
.local string jsonfile
jsonfile = handle.'readall'()
- close handle
+ handle.'close'()
load_language 'data_json'
.local pmc json, jsonobject, jsondata
@@ -322,10 +323,11 @@
.local string jsonfile
jsonfile = _json(jsondata)
.local pmc handle
- handle = open filename, 'w'
+ handle = new 'FileHandle'
+ handle.'open'(filename, 'w')
print handle, jsonfile
print handle, "\n"
- close handle
+ handle.'close'()
.return()
failed:
.local pmc exception
More information about the parrot-commits
mailing list