Author: Lars Wassermann <[email protected]>
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])
[email protected]_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
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit