--- a/Array.st Sat May 02 07:04:02 2015 +0200
+++ b/Array.st Mon May 04 07:11:22 2015 +0200
@@ -1957,7 +1957,6 @@
not portable (i.e. other smalltalks do not offer this)"
%{ /* NOCONTEXT */
-
REGISTER INT index;
REGISTER OBJ o, el1, el2;
REGISTER OBJ *op;
@@ -2108,6 +2107,21 @@
- reimplemented for speed when searching in OrderedCollections"
%{ /* NOCONTEXT */
+#ifdef __SCHTEAM__
+ if (start.isSmallInteger()
+ && stop.isSmallInteger()) {
+ if (self.isVector()) {
+ int _start = start.intValue() - 1;
+ int _stop = stop.intValue() - 1;
+ for (int i=_start; i<=_stop; i++) {
+ if (self.vectorRef(i) == anElement) {
+ return context._RETURN(i+1);
+ }
+ }
+ return context._RETURN(STInteger._0);
+ }
+ }
+#else
REGISTER INT index;
REGISTER OBJ el;
@@ -2191,6 +2205,7 @@
}
RETURN ( __mkSmallInteger(0) );
}
+#endif /*not SCHTEAM */
%}.
^ super identityIndexOf:anElement startingAt:start endingAt:stop
@@ -2672,10 +2687,9 @@
!Array class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Array.st,v 1.169 2015-04-26 11:30:22 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Array.st,v 1.170 2015-05-03 12:38:00 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/Array.st,v 1.169 2015-04-26 11:30:22 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Array.st,v 1.170 2015-05-03 12:38:00 cg Exp $'
! !
-
--- a/ExternalStream.st Sat May 02 07:04:02 2015 +0200
+++ b/ExternalStream.st Mon May 04 07:11:22 2015 +0200
@@ -1534,39 +1534,39 @@
initialize
OpenErrorSignal isNil ifTrue:[
- OpenErrorSignal := OpenError.
- OpenErrorSignal notifierString:'open error'.
-
- InvalidReadSignal := InvalidReadError.
- InvalidReadSignal notifierString:'stream does not support reading'.
-
- InvalidWriteSignal := InvalidWriteError.
- InvalidWriteSignal notifierString:'stream does not support writing'.
-
- InvalidModeSignal := InvalidModeError.
- InvalidModeSignal notifierString:'binary/text mode mismatch'.
-
- InvalidOperationSignal := InvalidOperationError.
- InvalidOperationSignal notifierString:'unsupported file operation'.
-
- StreamNotOpenSignal := StreamNotOpenError.
- StreamNotOpenSignal notifierString:'stream is not open'.
-
- StreamIOErrorSignal := StreamIOError.
- StreamIOErrorSignal notifierString:'I/O error'.
+ OpenErrorSignal := OpenError.
+ OpenErrorSignal notifierString:'open error'.
+
+ InvalidReadSignal := InvalidReadError.
+ InvalidReadSignal notifierString:'stream does not support reading'.
+
+ InvalidWriteSignal := InvalidWriteError.
+ InvalidWriteSignal notifierString:'stream does not support writing'.
+
+ InvalidModeSignal := InvalidModeError.
+ InvalidModeSignal notifierString:'binary/text mode mismatch'.
+
+ InvalidOperationSignal := InvalidOperationError.
+ InvalidOperationSignal notifierString:'unsupported file operation'.
+
+ StreamNotOpenSignal := StreamNotOpenError.
+ StreamNotOpenSignal notifierString:'stream is not open'.
+
+ StreamIOErrorSignal := StreamIOError.
+ StreamIOErrorSignal notifierString:'I/O error'.
].
Lobby isNil ifTrue:[
- Lobby := Registry new.
-
- "want to get informed when returning from snapshot"
- ObjectMemory addDependent:self
+ Lobby := Registry new.
+
+ "want to get informed when returning from snapshot"
+ ObjectMemory addDependent:self
].
DefaultEOLMode isNil ifTrue:[
- self initDefaultEOLMode.
+ self initDefaultEOLMode.
].
ReadMode isNil ifTrue:[
- self initModeStrings.
+ self initModeStrings.
].
"Modified: / 21.5.1998 / 16:33:53 / cg"
!
@@ -2082,6 +2082,11 @@
notice: this one returns the underlying OSs fileDescriptor -
this may not be available on all platforms (i.e. non unix systems)."
+%{
+#ifdef __SCHTEAM__
+ return context._RETURN(handle);
+#endif
+%}.
self primitiveFailed
!
@@ -2899,10 +2904,10 @@
|bufferSize|
OperatingSystem isMSDOSlike ifTrue:[
- "/ mhmh - NT hangs, when copying bigger blocks to a network drive - why ?
- bufferSize := 1 * 1024.
+ "/ mhmh - NT hangs, when copying bigger blocks to a network drive - why ?
+ bufferSize := 1 * 1024.
] ifFalse:[
- bufferSize := 8 * 1024.
+ bufferSize := 8 * 1024.
].
^ inStream copyToEndInto:self bufferSize:bufferSize
@@ -3392,7 +3397,7 @@
readCount := self nextBytes:count into:aCollection startingAt:start.
readCount = count ifTrue:[
- ^ aCollection.
+ ^ aCollection.
].
^ aCollection copyFrom:1 to:start+readCount-1.
!
@@ -5983,7 +5988,7 @@
I don't know how to write non-bytes to a external stream, but let superclass handle this."
buffer isByteCollection ifTrue:[
- ^ self nextPutBytes:initialWriteCount from:buffer startingAt:initialOffset.
+ ^ self nextPutBytes:initialWriteCount from:buffer startingAt:initialOffset.
].
^ super nextPutAll:initialWriteCount from:buffer startingAt:initialOffset
@@ -6197,13 +6202,24 @@
Use with care - non object oriented i/o.
Warning:
- in general, you cannot use this method to pass non-byte data to other
- architectures (unless you prepared the buffer with care),
- since it does not care for byte order or float representation."
+ in general, you cannot use this method to pass non-byte data to other
+ architectures (unless you prepared the buffer with care),
+ since it does not care for byte order or float representation."
|error|
%{
+#ifdef __SCHTEAM__
+ char[] chars;
+ byte[] bytes;
+ STObject handle = self.instVarAt(I_handle);
+
+ if (anObject.isSTString()) {
+ chars = anObject.asSTString().characters;
+ handle.writeCharacters(chars, start.intValue(), count.intValue());
+ return context._RETURN(count);
+ }
+#else
FILEPOINTER f;
int cnt, len, offs, ret;
int objSize, nInstBytes, _buffered;
@@ -6216,117 +6232,118 @@
|| (__INST(handleType) == @symbol(socketFilePointer))
|| (__INST(handleType) == @symbol(socketHandle))
|| (__INST(handleType) == @symbol(pipeFilePointer))) {
- if (((fp = __INST(handle)) != nil)
- && (__INST(mode) != @symbol(readonly))
- && __bothSmallInteger(count, start)
- ) {
- len = __intVal(count);
- offs = __intVal(start) - 1;
- f = __FILEVal(fp);
-
- if (__isExternalBytesLike(anObject)) {
- OBJ sz;
-
- nInstBytes = 0;
- extPtr = (char *)__externalBytesAddress(anObject);
- if (extPtr == NULL) goto bad;
- sz = __externalBytesSize(anObject);
- if (__isSmallInteger(sz)) {
- objSize = __intVal(sz);
- } else {
- objSize = 0; /* unknown */
- }
- } else {
- OBJ oClass = __Class(anObject);
- int nInstVars = __intVal(__ClassInstPtr(oClass)->c_ninstvars);
-
- nInstBytes = OHDR_SIZE + __OBJS2BYTES__(nInstVars);
- switch (__intVal(__ClassInstPtr(oClass)->c_flags) & ARRAYMASK) {
- case BYTEARRAY:
- case WORDARRAY:
- case LONGARRAY:
- case SWORDARRAY:
- case SLONGARRAY:
- case FLOATARRAY:
- break;
- case DOUBLEARRAY:
-#ifdef __NEED_DOUBLE_ALIGN
- nInstBytes = (nInstBytes-1+__DOUBLE_ALIGN) &~ (__DOUBLE_ALIGN-1);
-#endif
- break;
- case LONGLONGARRAY:
- case SLONGLONGARRAY:
-#ifdef __NEED_LONGLONG_ALIGN
- nInstBytes = (nInstBytes-1+__LONGLONG_ALIGN) &~ (__LONGLONG_ALIGN-1);
-#endif
- break;
- default:
- goto bad;
- }
- extPtr = (char *)0;
- objSize = __Size(anObject) - nInstBytes;
- }
- if ( (offs >= 0) && (len >= 0) && (objSize >= (len + offs)) ) {
- if (_buffered = (__INST(buffered) == true)) {
- __WRITING__(f)
- }
-
- if (extPtr) {
-#ifdef WIN32
- if ((f == __win32_stdout()) || (f == __win32_stderr())) {
- cnt = __win32_fwrite(extPtr+offs, 1, len, f);
- } else
-#endif
- {
- __WRITEBYTES__(cnt, f, extPtr+offs, len, _buffered, __INST(handleType));
- }
- } else {
- /*
- * on interrupt, anObject may be moved to another location.
- * So we pass anObject, and the offset to the __WRITEBYTES_OBJ__ macro.
- */
- offs += nInstBytes;
-#ifdef WIN32
- if ((f == __win32_stdout()) || (f == __win32_stderr())) {
- cnt = __win32_fwrite((char *)anObject+offs, 1, len, f);
- } else
-#endif
- {
- __WRITEBYTES_OBJ__(cnt, f, anObject, offs, len, _buffered, __INST(handleType));
- }
- }
-
- if (cnt >= 0) {
- if (__isSmallInteger(__INST(position))) {
- INT np = __intVal(__INST(position)) + cnt;
- OBJ t;
-
- t = __MKINT(np); __INST(position) = t; __STORE(self, t);
- } else {
- __INST(position) = nil; /* i.e. do not know */
- }
- RETURN ( __mkSmallInteger(cnt) );
- } else /* cnt < 0 */ {
- if (
-#ifdef EWOULDBLOCK
- (__threadErrno == EWOULDBLOCK) ||
-#endif
- (__threadErrno == EAGAIN)
- ) {
- RETURN ( __mkSmallInteger(0) );
- }
- __INST(position) = nil; /* i.e. do not know */
- error = __mkSmallInteger(__threadErrno);
- }
- }
- }
+ if (((fp = __INST(handle)) != nil)
+ && (__INST(mode) != @symbol(readonly))
+ && __bothSmallInteger(count, start)
+ ) {
+ len = __intVal(count);
+ offs = __intVal(start) - 1;
+ f = __FILEVal(fp);
+
+ if (__isExternalBytesLike(anObject)) {
+ OBJ sz;
+
+ nInstBytes = 0;
+ extPtr = (char *)__externalBytesAddress(anObject);
+ if (extPtr == NULL) goto bad;
+ sz = __externalBytesSize(anObject);
+ if (__isSmallInteger(sz)) {
+ objSize = __intVal(sz);
+ } else {
+ objSize = 0; /* unknown */
+ }
+ } else {
+ OBJ oClass = __Class(anObject);
+ int nInstVars = __intVal(__ClassInstPtr(oClass)->c_ninstvars);
+
+ nInstBytes = OHDR_SIZE + __OBJS2BYTES__(nInstVars);
+ switch (__intVal(__ClassInstPtr(oClass)->c_flags) & ARRAYMASK) {
+ case BYTEARRAY:
+ case WORDARRAY:
+ case LONGARRAY:
+ case SWORDARRAY:
+ case SLONGARRAY:
+ case FLOATARRAY:
+ break;
+ case DOUBLEARRAY:
+# ifdef __NEED_DOUBLE_ALIGN
+ nInstBytes = (nInstBytes-1+__DOUBLE_ALIGN) &~ (__DOUBLE_ALIGN-1);
+# endif
+ break;
+ case LONGLONGARRAY:
+ case SLONGLONGARRAY:
+# ifdef __NEED_LONGLONG_ALIGN
+ nInstBytes = (nInstBytes-1+__LONGLONG_ALIGN) &~ (__LONGLONG_ALIGN-1);
+# endif
+ break;
+ default:
+ goto bad;
+ }
+ extPtr = (char *)0;
+ objSize = __Size(anObject) - nInstBytes;
+ }
+ if ( (offs >= 0) && (len >= 0) && (objSize >= (len + offs)) ) {
+ if (_buffered = (__INST(buffered) == true)) {
+ __WRITING__(f)
+ }
+
+ if (extPtr) {
+# ifdef WIN32
+ if ((f == __win32_stdout()) || (f == __win32_stderr())) {
+ cnt = __win32_fwrite(extPtr+offs, 1, len, f);
+ } else
+# endif
+ {
+ __WRITEBYTES__(cnt, f, extPtr+offs, len, _buffered, __INST(handleType));
+ }
+ } else {
+ /*
+ * on interrupt, anObject may be moved to another location.
+ * So we pass anObject, and the offset to the __WRITEBYTES_OBJ__ macro.
+ */
+ offs += nInstBytes;
+# ifdef WIN32
+ if ((f == __win32_stdout()) || (f == __win32_stderr())) {
+ cnt = __win32_fwrite((char *)anObject+offs, 1, len, f);
+ } else
+# endif
+ {
+ __WRITEBYTES_OBJ__(cnt, f, anObject, offs, len, _buffered, __INST(handleType));
+ }
+ }
+
+ if (cnt >= 0) {
+ if (__isSmallInteger(__INST(position))) {
+ INT np = __intVal(__INST(position)) + cnt;
+ OBJ t;
+
+ t = __MKINT(np); __INST(position) = t; __STORE(self, t);
+ } else {
+ __INST(position) = nil; /* i.e. do not know */
+ }
+ RETURN ( __mkSmallInteger(cnt) );
+ } else /* cnt < 0 */ {
+ if (
+# ifdef EWOULDBLOCK
+ (__threadErrno == EWOULDBLOCK) ||
+# endif
+ (__threadErrno == EAGAIN)
+ ) {
+ RETURN ( __mkSmallInteger(0) );
+ }
+ __INST(position) = nil; /* i.e. do not know */
+ error = __mkSmallInteger(__threadErrno);
+ }
+ }
+ }
}
bad: ;
+#endif /* not SCHTEAM */
%}.
error notNil ifTrue:[
- lastErrorNumber := error.
- self writeError:error.
- ^ 0
+ lastErrorNumber := error.
+ self writeError:error.
+ ^ 0
].
handle isNil ifTrue:[self errorNotOpen. ^ 0].
(mode == #readonly) ifTrue:[self errorReadOnly. ^ 0].
@@ -6468,11 +6485,11 @@
!ExternalStream class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.416 2015-04-15 20:33:16 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.417 2015-05-03 12:38:52 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.416 2015-04-15 20:33:16 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.417 2015-05-03 12:38:52 cg Exp $'
! !
--- a/NonPositionableExternalStream.st Sat May 02 07:04:02 2015 +0200
+++ b/NonPositionableExternalStream.st Mon May 04 07:11:22 2015 +0200
@@ -348,10 +348,14 @@
"return a stderr handle"
%{
-#ifdef WIN32
+#ifdef __SCHTEAM__
+ return context._RETURN( StandardErrorStream );
+#else
+# ifdef WIN32
RETURN ( __MKEXTERNALADDRESS( __win32_stderr() ));
-#else
+# else
RETURN ( __MKEXTERNALADDRESS(stderr) );
+# endif
#endif
%}
!
@@ -362,10 +366,14 @@
"return a stdin handle"
%{
-#ifdef WIN32
+#ifdef __SCHTEAM__
+ return context._RETURN( StandardInputStream );
+#else
+# ifdef WIN32
RETURN ( __MKEXTERNALADDRESS( __win32_stdin() ));
-#else
+# else
RETURN ( __MKEXTERNALADDRESS(stdin) );
+# endif
#endif
%}
!
@@ -376,10 +384,14 @@
"return a stdout handle"
%{
-#ifdef WIN32
+#ifdef __SCHTEAM__
+ return context._RETURN( StandardOutputStream );
+#else
+# ifdef WIN32
RETURN ( __MKEXTERNALADDRESS( __win32_stdout() ));
-#else
+# else
RETURN ( __MKEXTERNALADDRESS(stdout) );
+# endif
#endif
%}
!
@@ -549,8 +561,8 @@
count := stop-start+1.
count ~= (self nextPutBytes:count from:aCollection startingAt:start) ifTrue:[
- "incomplete write"
- self writeError.
+ "incomplete write"
+ self writeError.
].
!
@@ -564,16 +576,16 @@
wasBlocking := self blocking:false.
[remaining ~~ 0] whileTrue:[
- |count|
+ |count|
- count := super nextPutBytes:remaining from:buffer startingAt:offset.
+ count := super nextPutBytes:remaining from:buffer startingAt:offset.
- remaining := remaining - count.
- offset := offset + count.
- remaining ~~ 0 ifTrue:[
- "Transcript showCR:'writeWait'."
- self writeWait.
- ].
+ remaining := remaining - count.
+ offset := offset + count.
+ remaining ~~ 0 ifTrue:[
+ "Transcript showCR:'writeWait'."
+ self writeWait.
+ ].
].
wasBlocking ifTrue:[self blocking:true].
@@ -583,10 +595,10 @@
!NonPositionableExternalStream class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/NonPositionableExternalStream.st,v 1.73 2015-03-24 16:17:21 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/NonPositionableExternalStream.st,v 1.74 2015-05-03 12:39:22 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/NonPositionableExternalStream.st,v 1.73 2015-03-24 16:17:21 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/NonPositionableExternalStream.st,v 1.74 2015-05-03 12:39:22 cg Exp $'
! !
--- a/UnixOperatingSystem.st Sat May 02 07:04:02 2015 +0200
+++ b/UnixOperatingSystem.st Mon May 04 07:11:22 2015 +0200
@@ -11031,19 +11031,23 @@
Return the previous blocking state."
%{ /* NOCONTEXT */
+#ifdef __SCHTEAM__
+ // TODO
+ return context._RETURN(0);
+#else
int ret = 0, flags;
-#if defined(F_GETFL) && defined(F_SETFL)
-# undef DELAY_FLAG
-# if defined(O_NONBLOCK)
-# define DELAY_FLAG O_NONBLOCK
-# elif defined(O_NDELAY)
-# define DELAY_FLAG O_NDELAY
-# elif defined(FNDELAY)
-# define DELAY_FLAG FNDELAY
-# endif
-# if defined(DELAY_FLAG)
+# if defined(F_GETFL) && defined(F_SETFL)
+# undef DELAY_FLAG
+# if defined(O_NONBLOCK)
+# define DELAY_FLAG O_NONBLOCK
+# elif defined(O_NDELAY)
+# define DELAY_FLAG O_NDELAY
+# elif defined(FNDELAY)
+# define DELAY_FLAG FNDELAY
+# endif
+# if defined(DELAY_FLAG)
if (__isSmallInteger(fd)) {
int f = __intVal(fd);
@@ -11057,9 +11061,10 @@
RETURN ((flags & DELAY_FLAG) ? false : true );
}
}
-# undef DELAY_FLAG
-# endif
-#endif
+# undef DELAY_FLAG
+# endif
+# endif
+#endif /* not SCHTEAM */
%}.
"
fd argument not integer or bad return code
@@ -11819,17 +11824,21 @@
|err|
%{
+#ifdef __SCHTEAM__
+ // TODO
+ return context._RETURN(0);
+#else
int ret, flags;
-#if defined(F_GETFL) && defined(F_SETFL)
-# if defined(O_NDELAY)
-# define DELAY_FLAG O_NDELAY
-# else
-# if defined(FNDELAY)
-# define DELAY_FLAG FNDELAY
-# endif
-# endif
-# if defined(DELAY_FLAG)
+# if defined(F_GETFL) && defined(F_SETFL)
+# if defined(O_NDELAY)
+# define DELAY_FLAG O_NDELAY
+# else
+# if defined(FNDELAY)
+# define DELAY_FLAG FNDELAY
+# endif
+# endif
+# if defined(DELAY_FLAG)
if (__isSmallInteger(__INST(fd))) {
int f = __intVal(__INST(fd));
@@ -11845,13 +11854,15 @@
err = __mkSmallInteger(errno);
}
}
-# undef DELAY_FLAG
-# endif /* DELAY_FLAG */
-#endif
+# undef DELAY_FLAG
+# endif /* DELAY_FLAG */
+# endif
+#endif /* not SCHTEAM */
%}.
err notNil ifTrue:[
self error:err
].
+
"
fd argument not integer
"
@@ -14274,11 +14285,11 @@
!UnixOperatingSystem class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/UnixOperatingSystem.st,v 1.437 2015-04-24 08:17:57 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/UnixOperatingSystem.st,v 1.438 2015-05-03 12:39:48 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/UnixOperatingSystem.st,v 1.437 2015-04-24 08:17:57 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/UnixOperatingSystem.st,v 1.438 2015-05-03 12:39:48 cg Exp $'
! !