dont access stdout on WIN32
authorClaus Gittinger <cg@exept.de>
Tue, 25 Jun 1996 21:37:23 +0200
changeset 1486 60c770ac10eb
parent 1485 3e0f164f3f70
child 1487 349bf72ca044
dont access stdout on WIN32
String.st
--- a/String.st	Tue Jun 25 10:14:04 1996 +0200
+++ b/String.st	Tue Jun 25 21:37:23 1996 +0200
@@ -19,8 +19,10 @@
 
 !String primitiveDefinitions!
 %{
-#include <stdio.h>
-#define _STDIO_H_INCLUDED_
+#ifndef WIN32
+# include <stdio.h>
+# define _STDIO_H_INCLUDED_
+#endif
 
 #include <ctype.h>
 
@@ -74,11 +76,11 @@
     so your program may become unportable if you do so.
 
     [author:]
-        Claus Gittinger
+	Claus Gittinger
 
     [see also:]
-        Text StringCollection TwoByteString JISEncodedString
-        Symbol
+	Text StringCollection TwoByteString JISEncodedString
+	Symbol
 "
 ! !
 
@@ -322,34 +324,34 @@
     slf = self;
 
     if (__isString(slf)) {
-        if (__isCharacter(aCharacter)) {
-            value = __intVal(_characterVal(aCharacter));
-            if (((unsigned)value <= 0xFF)
-             && __isSmallInteger(index)) {
-                indx = __intVal(index) - 1;
-                if ((unsigned)indx < (unsigned)(__stringSize(slf))) {
-                    __stringVal(slf)[indx] = value;
-                    RETURN ( aCharacter );
-                }
-            }
-        }
+	if (__isCharacter(aCharacter)) {
+	    value = __intVal(_characterVal(aCharacter));
+	    if (((unsigned)value <= 0xFF)
+	     && __isSmallInteger(index)) {
+		indx = __intVal(index) - 1;
+		if ((unsigned)indx < (unsigned)(__stringSize(slf))) {
+		    __stringVal(slf)[indx] = value;
+		    RETURN ( aCharacter );
+		}
+	    }
+	}
     }
 %}.
     (self isMemberOf:String) ifFalse:[
-        ^ super at:index put:aCharacter
+	^ super at:index put:aCharacter
     ].
 
     (aCharacter isMemberOf:Character) ifFalse:[
-        "
-         tried to store something which is not a character
-        "
-        ^ self elementNotCharacter
+	"
+	 tried to store something which is not a character
+	"
+	^ self elementNotCharacter
     ].
     (aCharacter asciiValue between:1 and:255) ifFalse:[
-        "
-         tried to store a multibyte character
-        "
-        ^ self elementBoundsError
+	"
+	 tried to store a multibyte character
+	"
+	^ self elementBoundsError
     ].
     "
      invalid index
@@ -397,31 +399,31 @@
     slf = self;
 
     if (__isCharacter(aCharacter)) {
-        value = __intVal(_characterVal(aCharacter));
-        if (((unsigned)value <= 0xFF)
-         && __isSmallInteger(index)) {
-            indx = __intVal(index) - 1;
-            cls = __qClass(slf);
-            if (cls != String)
-                indx += __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
-            if ((unsigned)indx < (unsigned)(__stringSize(slf))) {
-                __stringVal(slf)[indx] = value;
-                RETURN ( aCharacter );
-            }
-        }
+	value = __intVal(_characterVal(aCharacter));
+	if (((unsigned)value <= 0xFF)
+	 && __isSmallInteger(index)) {
+	    indx = __intVal(index) - 1;
+	    cls = __qClass(slf);
+	    if (cls != String)
+		indx += __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
+	    if ((unsigned)indx < (unsigned)(__stringSize(slf))) {
+		__stringVal(slf)[indx] = value;
+		RETURN ( aCharacter );
+	    }
+	}
     }
 %}.
     (aCharacter isMemberOf:Character) ifFalse:[
-        "
-         tried to store something which is not a character
-        "
-        ^ self elementNotCharacter
+	"
+	 tried to store something which is not a character
+	"
+	^ self elementNotCharacter
     ].
     (aCharacter asciiValue between:1 and:255) ifFalse:[
-        "
-         tried to store a multibyte character
-        "
-        ^ self elementBoundsError
+	"
+	 tried to store a multibyte character
+	"
+	^ self elementBoundsError
     ].
     "
      invalid index
@@ -445,7 +447,7 @@
 	RETURN ( __MKSMALLINT(__stringSize(slf)) );
     }
     RETURN ( __MKSMALLINT(__stringSize(slf)
-	                  - __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars))));
+			  - __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars))));
 %}
 !
 
@@ -900,7 +902,7 @@
      LC_COLLATE, which is initialized from the environment.
 
      STUPID:
-        #after has a completely different meaning in SeqColl ..."
+	#after has a completely different meaning in SeqColl ..."
 
     ^ (self compareCollatingWith:aString) > 0
 
@@ -929,40 +931,40 @@
 
     if (__isNonNilObject(s)
      && (((cls = __qClass(s)) == String) || (cls == Symbol) || (cls == __qClass(self)))) {
-        cp1 = (char *) __stringVal(self);
+	cp1 = (char *) __stringVal(self);
 
-        /*
-         * care for instances of subclasses ...
-         */
-        if (__qClass(self) != String) {
-            int n = __OBJS2BYTES__(__intVal(__ClassInstPtr(__qClass(self))->c_ninstvars));
+	/*
+	 * care for instances of subclasses ...
+	 */
+	if (__qClass(self) != String) {
+	    int n = __OBJS2BYTES__(__intVal(__ClassInstPtr(__qClass(self))->c_ninstvars));
 
-            cp1 += n;
-        }
+	    cp1 += n;
+	}
 
-        cp2 = (char *) __stringVal(s);
-        /*
-         * care for instances of subclasses ...
-         */
-        if (cls != String) {
-            int n = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
+	cp2 = (char *) __stringVal(s);
+	/*
+	 * care for instances of subclasses ...
+	 */
+	if (cls != String) {
+	    int n = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
 
-            cp2 += n;
-        }
+	    cp2 += n;
+	}
 
 #ifdef HAS_STRCOLL
-        cmp = strcoll(cp1, cp2);
+	cmp = strcoll(cp1, cp2);
 #else
-        cmp = strcmp(cp1, cp2);
+	cmp = strcmp(cp1, cp2);
 #endif
 
-        if (cmp > 0) {
-            RETURN ( __MKSMALLINT(1) );
-        }
-        if (cmp < 0) {
-            RETURN ( __MKSMALLINT(-1) );
-        }
-        RETURN ( __MKSMALLINT(0) );
+	if (cmp > 0) {
+	    RETURN ( __MKSMALLINT(1) );
+	}
+	if (cmp < 0) {
+	    RETURN ( __MKSMALLINT(-1) );
+	}
+	RETURN ( __MKSMALLINT(0) );
     }
 %}.
     "
@@ -1863,7 +1865,11 @@
 %{  /* NOCONTEXT */
 
     if (__qClass(self) == String) {
+#ifdef WIN32
+	printf("%s" , __stringVal(self));
+#else
 	fputs(__stringVal(self), stdout); fflush(stdout);
+#endif
 	RETURN (self);
     }
 %}
@@ -2083,7 +2089,7 @@
     REGISTER int j;
     int i;
     int iW, cW, sW, dW;
-#   define FASTSIZE 30	/* increase STACK if you increase this ... */
+#   define FASTSIZE 30  /* increase STACK if you increase this ... */
     unsigned short fastData[(FASTSIZE + 1) * (FASTSIZE + 1)];
 
     if ((__isString(self) || __isSymbol(self))
@@ -2209,5 +2215,5 @@
 !String class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/String.st,v 1.81 1996-05-15 00:13:33 werner Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/String.st,v 1.82 1996-06-25 19:37:23 cg Exp $'
 ! !