[pypy-commit] lang-smalltalk default: added fileplugin-writefileprimitive
lwassermann
noreply at buildbot.pypy.org
Tue Jun 18 16:04:26 CEST 2013
Author: Lars Wassermann <lars.wassermann at gmail.com>
Branch:
Changeset: r464:1aa209705f3a
Date: 2013-06-18 15:58 +0200
http://bitbucket.org/pypy/lang-smalltalk/changeset/1aa209705f3a/
Log: added fileplugin-writefileprimitive
diff --git a/spyvm/plugins/fileplugin.py b/spyvm/plugins/fileplugin.py
--- a/spyvm/plugins/fileplugin.py
+++ b/spyvm/plugins/fileplugin.py
@@ -134,6 +134,19 @@
space = interp.space
return space.wrap_list([space.wrap_int(fd) for fd in std_fds])
+ at FilePlugin.expose_primitive(unwrap_spec=[object, int, str, index1_0, int])
+def primitiveFileWrite(interp, s_frame, w_rcvr, fd, a_string, start, count):
+ space = interp.space
+ end = min(start + 1 + count, len(a_string))
+ if not (start >= 0 and end > start):
+ return space.wrap_int(0)
+ try:
+ written = os.write(fd, a_string[start:end])
+ except OSError:
+ raise PrimitiveFailedError
+ else:
+ return space.wrap_positive_32bit_int(rarithmetic.intmask(written))
+
@jit.elidable
def smalltalk_timestamp(space, sec_since_epoch):
import time
More information about the pypy-commit
mailing list