#DOCUMENTATION by cg
authorClaus Gittinger <cg@exept.de>
Sun, 17 Mar 2019 14:53:39 +0100
changeset 23934 1f2b39449d6d
parent 23933 d2fd46589fe6
child 23935 41fa8c91253e
#DOCUMENTATION by cg class: ExternalStream changed: #nextPutInt16NATIVE: #nextPutInt32NATIVE:
ExternalStream.st
--- a/ExternalStream.st	Sun Mar 17 13:03:22 2019 +0100
+++ b/ExternalStream.st	Sun Mar 17 14:53:39 2019 +0100
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 1988 by Claus Gittinger
 	      All Rights Reserved
@@ -4578,7 +4580,7 @@
 
 nextPutInt16NATIVE:anIntegerOrCharacter
     "Write the argument, anIntegerOrCharacter as a short (two bytes) in native byte order.
-     This is the CPU-specific byte order (LSB on x86, MSB on sparc, VAX and possibly on ARM).
+     This is the CPU-specific byte order (LSB on x86 and VAX, MSB on sparc, and possibly on ARM).
      Notice that integers in the range 16r-8000 to +16rFFFF can be written
      (i.e. both signed and unsigned int32 values can be written.
      Works in both binary and text modes."
@@ -4587,8 +4589,8 @@
 %{
     int num;
     union {
-	char bytes[2];
-	short shortVal;
+        char bytes[2];
+        short shortVal;
     } u;
     OBJ fp;
 
@@ -4598,44 +4600,44 @@
      || (__INST(handleType) == @symbol(socketFilePointer))
      || (__INST(handleType) == @symbol(socketHandle))
      || (__INST(handleType) == @symbol(pipeFilePointer))) {
-	if (((fp = __INST(handle)) != nil)
-	 && (__INST(mode) != @symbol(readonly))
-	) {
-	    FILEPOINTER f = __FILEVal(fp);
-	    int _buffered = (__INST(buffered) == true);
-	    int cnt;
-
-	    if (__isSmallInteger(anIntegerOrCharacter)) {
-		num = __intVal(anIntegerOrCharacter);
-	    } else if (__isCharacter(anIntegerOrCharacter)) {
-		num = __smallIntegerVal(__characterVal(anIntegerOrCharacter));
-	    } else
-		goto out;
-
-	    u.shortVal = num;
-
-	    if (_buffered) {
-		__WRITING__(f)
-	    }
-	    __WRITEBYTES__(cnt, f, u.bytes, 2, _buffered, __INST(handleType));
-
-	    if (cnt == 2) {
-		if (__isSmallInteger(__INST(position))) {
-		    INT np = __intVal(__INST(position)) + 2;
-		    OBJ t;
-
-		    t = __MKINT(np); __INST(position) = t; __STORE(self, t);
-		} else {
-		    __INST(position) = nil; /* i.e. do not know */
-		}
-		RETURN ( self );
-	    }
-	    __INST(position) = nil; /* i.e. do not know */
+        if (((fp = __INST(handle)) != nil)
+         && (__INST(mode) != @symbol(readonly))
+        ) {
+            FILEPOINTER f = __FILEVal(fp);
+            int _buffered = (__INST(buffered) == true);
+            int cnt;
+
+            if (__isSmallInteger(anIntegerOrCharacter)) {
+                num = __intVal(anIntegerOrCharacter);
+            } else if (__isCharacter(anIntegerOrCharacter)) {
+                num = __smallIntegerVal(__characterVal(anIntegerOrCharacter));
+            } else
+                goto out;
+
+            u.shortVal = num;
+
+            if (_buffered) {
+                __WRITING__(f)
+            }
+            __WRITEBYTES__(cnt, f, u.bytes, 2, _buffered, __INST(handleType));
+
+            if (cnt == 2) {
+                if (__isSmallInteger(__INST(position))) {
+                    INT np = __intVal(__INST(position)) + 2;
+                    OBJ t;
+
+                    t = __MKINT(np); __INST(position) = t; __STORE(self, t);
+                } else {
+                    __INST(position) = nil; /* i.e. do not know */
+                }
+                RETURN ( self );
+            }
+            __INST(position) = nil; /* i.e. do not know */
 # ifdef __win32__
-	    __threadErrno = __WIN32_ERR(GetLastError());
+            __threadErrno = __WIN32_ERR(GetLastError());
 # endif
-	    error = __mkSmallInteger(__threadErrno);
-	}
+            error = __mkSmallInteger(__threadErrno);
+        }
     }
 out:;
 %}.
@@ -4643,6 +4645,7 @@
 
     "Modified: / 19-09-2017 / 16:32:40 / stefan"
     "Modified: / 22-11-2018 / 14:48:23 / Stefan Vogel"
+    "Modified: / 17-03-2019 / 14:52:06 / Claus Gittinger"
 !
 
 nextPutInt32:aNumber MSB:msbFlag
@@ -4774,42 +4777,42 @@
 
 nextPutInt32NATIVE:anInteger
     "Write the argument, anInteger as a long (four bytes) in native byte order.
-     This is the CPU-specific byte order (LSB on x86, MSB on sparc, VAX and possibly on ARM).
+     This is the CPU-specific byte order (LSB on x86 and VAX, MSB on sparc and possibly on ARM).
      Notice that integers in the range 16r-80000000 to +16rFFFFFFFF can be written
      (i.e. both signed and unsigned int32 values can be written.
      Works in both binary and text modes.
      Notice: this message should not be sent explicitly by ANY program.
-	     the following implementation replaces the code of either nextPutInt32MSB or LSB
-	     dynamically (see #initialize on the class side)"
+             the following implementation replaces the code of either nextPutInt32MSB or LSB
+             dynamically (see #initialize on the class side)"
 
     |error|
 
 %{
     int num;
     union {
-	char bytes[4];
-	int intVal;
+        char bytes[4];
+        int intVal;
     } u;
     OBJ fp;
 
     __INST(lastErrorNumber) = nil;
     if (__isSmallInteger(anInteger)) {
-	num = __intVal(anInteger);
+        num = __intVal(anInteger);
     } else {
 #if __POINTER_SIZE__ == 8
-	// always more than 4-bytes
-	goto badArg;
+        // always more than 4-bytes
+        goto badArg;
 #else
-	num = __longIntVal(anInteger);
-	if (num == 0) {
-	    num = __signedLongIntVal(anInteger);
-	    if (num == 0) {
-		/* bad arg or out-of-range integer
-		 * (handled by the fallBack code)
-		 */
-		goto badArg;
-	    }
-	}
+        num = __longIntVal(anInteger);
+        if (num == 0) {
+            num = __signedLongIntVal(anInteger);
+            if (num == 0) {
+                /* bad arg or out-of-range integer
+                 * (handled by the fallBack code)
+                 */
+                goto badArg;
+            }
+        }
 #endif
     }
 
@@ -4818,36 +4821,36 @@
      || (__INST(handleType) == @symbol(socketFilePointer))
      || (__INST(handleType) == @symbol(socketHandle))
      || (__INST(handleType) == @symbol(pipeFilePointer))) {
-	if (((fp = __INST(handle)) != nil)
-	 && (__INST(mode) != @symbol(readonly))
-	) {
-	    int _buffered = (__INST(buffered) == true);
-	    FILEPOINTER f = __FILEVal(fp);
-	    int cnt;
-
-	    u.intVal = num;
-	    if (_buffered) {
-		__WRITING__(f)
-	    }
-	    __WRITEBYTES__(cnt, f, u.bytes, 4, _buffered, __INST(handleType));
-
-	    if (cnt == 4) {
-		if (__isSmallInteger(__INST(position))) {
-		    INT np = __intVal(__INST(position)) + 4;
-		    OBJ t;
-
-		    t = __MKINT(np); __INST(position) = t; __STORE(self, t);
-		} else {
-		    __INST(position) = nil; /* i.e. do not know */
-		}
-		RETURN ( self );
-	    }
-	    __INST(position) = nil; /* i.e. do not know */
+        if (((fp = __INST(handle)) != nil)
+         && (__INST(mode) != @symbol(readonly))
+        ) {
+            int _buffered = (__INST(buffered) == true);
+            FILEPOINTER f = __FILEVal(fp);
+            int cnt;
+
+            u.intVal = num;
+            if (_buffered) {
+                __WRITING__(f)
+            }
+            __WRITEBYTES__(cnt, f, u.bytes, 4, _buffered, __INST(handleType));
+
+            if (cnt == 4) {
+                if (__isSmallInteger(__INST(position))) {
+                    INT np = __intVal(__INST(position)) + 4;
+                    OBJ t;
+
+                    t = __MKINT(np); __INST(position) = t; __STORE(self, t);
+                } else {
+                    __INST(position) = nil; /* i.e. do not know */
+                }
+                RETURN ( self );
+            }
+            __INST(position) = nil; /* i.e. do not know */
 # ifdef __win32__
-	    __threadErrno = __WIN32_ERR(GetLastError());
+            __threadErrno = __WIN32_ERR(GetLastError());
 # endif
-	    error = __mkSmallInteger(__threadErrno);
-	}
+            error = __mkSmallInteger(__threadErrno);
+        }
     }
 badArg: ;
 %}.
@@ -4855,6 +4858,7 @@
 
     "Modified: / 19-09-2017 / 16:32:59 / stefan"
     "Modified: / 22-11-2018 / 14:48:41 / Stefan Vogel"
+    "Modified: / 17-03-2019 / 14:52:23 / Claus Gittinger"
 !
 
 nextPutUtf16:aCharacter
@@ -4866,7 +4870,7 @@
     "
 	(FileStream newTemporary
 	    nextPutUtf16:$B;
-	    nextPutUtf16:$Ä;
+	    nextPutUtf16:$Ä;
 	    nextPutUtf16:(Character codePoint:16r10CCCC);
 	    reset;
 	    binary;
@@ -6827,7 +6831,7 @@
     ].
 
     "
-	'Bönnigheim' asUnicode16String errorPrintCR
+	'Bönnigheim' asUnicode16String errorPrintCR
     "
 !