ExternalStream.st
changeset 826 b271ea453f6a
parent 820 6d934f5d6cbc
child 849 033900f9b217
--- a/ExternalStream.st	Wed Jan 03 18:29:56 1996 +0100
+++ b/ExternalStream.st	Thu Jan 04 00:25:58 1996 +0100
@@ -10,6 +10,8 @@
  hereby transferred.
 "
 
+'From Smalltalk/X, Version:2.10.8 on 29-dec-1995 at 00:15:30'                   !
+
 ReadWriteStream subclass:#ExternalStream
 	 instanceVariableNames:'filePointer mode buffered binary useCRLF hitEOF didWrite
 		lastErrorNumber'
@@ -387,6 +389,28 @@
     ^ self errorNotOpen
 !
 
+fileDescriptor:anInteger withMode:openMode
+    "set the filePointer from the receiver based on the fileDescriptor-
+     notice: this one is based on the underlying OSs fileDescriptor -
+     this may not be available on all platforms (i.e. non unix systems)."
+
+%{  /* NOCONTEXT */
+
+    FILE *f;
+    OBJ fp;
+
+    if (__isSmallInteger(anInteger) &&
+        __isString(openMode) &&
+        (f = fdopen(__intVal(anInteger), __stringVal(openMode))) != 0
+    ) {
+        _INST(filePointer) = fp = __MKOBJ((int)f); __STORE(self, fp);
+        RETURN (self);
+    }
+%}
+.
+    ^ self primitiveFailed
+!
+
 filePointer
     "return the filePointer of the receiver -
      notice: for portability stdio is used; this means you will get
@@ -3431,6 +3455,6 @@
 !ExternalStream class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.81 1995-12-23 19:05:00 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.82 1996-01-03 23:25:58 stefan Exp $'
 ! !
 ExternalStream initialize!