author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Mon, 01 Jul 2013 22:14:20 +0100 | |
branch | jv |
changeset 18070 | d262e3aecaca |
parent 18069 | ca546dabc513 (current diff) |
parent 15450 | 2d6de3f90129 (diff) |
child 18071 | 009cf668b0ed |
--- a/.hgtags Fri Jun 28 11:29:14 2013 +0100 +++ b/.hgtags Mon Jul 01 22:14:20 2013 +0100 @@ -3,20 +3,20 @@ 03969c4b3ea2db785c7d82d8f792c6edbdc6cbd4 expeccoNET_1_8_0_0 03f1bd57c0016b7761c5a4828408b27157788075 rel4_1_7 03f1bd57c0016b7761c5a4828408b27157788075 release -11e0080d4ef94eb6eedf7718651cf93b8cfb0248 expecco_2_5_1 135cee5b1fe83574ef2e1336d17930bea5d8fb63 expecco_2_4_1 187baeafc381324b2be71399be1263af19f79b1a rel5_2_8 27fb4984e97ba85d254d442042a0a57688f8f586 expecco_1_7_0rc8 288a01786ed5f59915047167fba6c00b36226c4a expeccoNET_1_5_1rc1 28ef0472cf2f08acd9c2056a517e1fae4bc8033d expecco_2_2_5 +2a27aa34e65bdbf5d9af53c6ccc467549e8b00c0 stable 2f39b0b6f4e6ecc84a698e16accec417b27b0da4 expecco_1_3_4 373af30a15cafccd184b57b8492979e1969af65f rel3_4_1_1 3816e831f5f3ed00876f38adbfaf1a25ad010ed7 rel2_10_8_6_last_before_vmData_change 471ed2bb3bf16111afbf2e0d6dfb422d78294aca expecco_1_0_3 520c27f8cae267240021277e257e013b60b9cdb8 rel5_2_2 54dd825d531c7adec355b2ffbdd6b66d00d4678a expecco_1_6_0rc5 +56edc9d911403e8f3b20c97f3c89e5da01cea0d5 expecco_2_5_1 5fcd709c7fd282e9c55d8642d1a6b1d5d77baf5e expecco_2_5_0 -5fcd709c7fd282e9c55d8642d1a6b1d5d77baf5e stable 615c4fe0f449a6be077b11450d39fb6560b1695a rel4_1_3_1 62ff001533901d30b624539b2f404d73f01db468 expecco_1_6_0 664991bb352e0a9f98bd7d36ec1c0b6a75e649eb rel5_4_6
--- a/Bag.st Fri Jun 28 11:29:14 2013 +0100 +++ b/Bag.st Mon Jul 01 22:14:20 2013 +0100 @@ -435,6 +435,12 @@ ^ (self occurrencesOf:anObject) > 0 ! +isFixedSize + "return true if the receiver cannot grow" + + ^ false +! + occurrencesOf:anObject "return how many times anObject is in the receiver" @@ -444,10 +450,10 @@ !Bag class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libbasic/Bag.st,v 1.44 2013-03-25 21:27:48 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/Bag.st,v 1.45 2013-06-25 11:23:48 cg Exp $' ! version_CVS - ^ '$Header: /cvs/stx/stx/libbasic/Bag.st,v 1.44 2013-03-25 21:27:48 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/Bag.st,v 1.45 2013-06-25 11:23:48 cg Exp $' ! !
--- a/CharacterArray.st Fri Jun 28 11:29:14 2013 +0100 +++ b/CharacterArray.st Mon Jul 01 22:14:20 2013 +0100 @@ -14,7 +14,7 @@ UninterpretedBytes variableByteSubclass:#CharacterArray instanceVariableNames:'' classVariableNames:'PreviousMatch DecoderTables EncoderTables DecodingFailedSignal - EncodingFailedSignal LastString LastShiftTable' + EncodingFailedSignal' poolDictionaries:'' category:'Collections-Text' ! @@ -2564,64 +2564,64 @@ |aTextSeparatorChar items scanningWord inStream element lastIsFieldSeparator sz| aTextSeparatorOrNil isNil ifTrue:[ - ^ self asCollectionOfSubstringsSeparatedByAll: aFieldSeparatorString + ^ self asCollectionOfSubstringsSeparatedByAll: aFieldSeparatorString ]. sz := aTextSeparatorOrNil size. sz = 0 ifTrue:[ - aTextSeparatorChar := aTextSeparatorOrNil + aTextSeparatorChar := aTextSeparatorOrNil ] ifFalse:[sz = 1 ifTrue:[ - "this is a String. Fetch the first character - compatibility to older expecco libs" - aTextSeparatorChar := aTextSeparatorOrNil first. + "this is a String. Fetch the first character - compatibility to older expecco libs" + aTextSeparatorChar := aTextSeparatorOrNil first. ] ifFalse:[ - self error:'textSeparatoSize > 1'. + self error:'textSeparatoSize > 1'. ]]. items := OrderedCollection new. inStream := ReadStream on:self. [ - inStream skipSeparators. - inStream atEnd + inStream skipSeparators. + inStream atEnd ] whileFalse:[ - lastIsFieldSeparator := false. - inStream peek == aTextSeparatorChar ifTrue:[ - inStream next. - element := ''. - scanningWord := true. - [ inStream atEnd not and:[scanningWord] ] whileTrue:[ - element := element , (inStream upTo:aTextSeparatorChar). - (inStream peek == aTextSeparatorChar) ifTrue:[ - element := element , aTextSeparatorChar . - inStream next. - ] ifFalse:[ - scanningWord := false. - ]. - ]. - inStream upToAll:aFieldSeparatorString. - ] ifFalse:[ - element := inStream upToAll:aFieldSeparatorString - ]. - items add:element. - lastIsFieldSeparator := (inStream skipThroughAll:aFieldSeparatorString) notNil. + lastIsFieldSeparator := false. + inStream peek == aTextSeparatorChar ifTrue:[ + inStream next. + element := ''. + scanningWord := true. + [ scanningWord and:[inStream atEnd not] ] whileTrue:[ + element := element , (inStream upTo:aTextSeparatorChar). + (inStream peek == aTextSeparatorChar) ifTrue:[ + element := element , aTextSeparatorChar . + inStream next. + ] ifFalse:[ + scanningWord := false. + ]. + ]. + inStream upToAll:aFieldSeparatorString. + ] ifFalse:[ + element := inStream upToAll:aFieldSeparatorString + ]. + items add:element. + lastIsFieldSeparator := (inStream skipThroughAll:aFieldSeparatorString) notNil. ]. lastIsFieldSeparator ifTrue:[ - "empty element at the end of the line" - items add:''. + "empty element at the end of the line" + items add:''. ]. ^ items " self assert:(('#First#, #Second,SecondAdd#, #Third#' asCollectionOfSubstringsSeparatedBy:',' textSeparator: $#) - sameContentsAs:#('First' 'Second,SecondAdd' 'Third')). + sameContentsAs:#('First' 'Second,SecondAdd' 'Third')). self assert:(('#Fir##st#, #Second,SecondAdd#, #Third#' asCollectionOfSubstringsSeparatedBy:',' textSeparator: $#) - sameContentsAs:#('Fir#st' 'Second,SecondAdd' 'Third')). + sameContentsAs:#('Fir#st' 'Second,SecondAdd' 'Third')). self assert:(('#Fir##st#, Second,SecondAdd, #Third#' asCollectionOfSubstringsSeparatedBy:',' textSeparator: $#) - sameContentsAs:#('Fir#st' 'Second' 'SecondAdd' 'Third')). + sameContentsAs:#('Fir#st' 'Second' 'SecondAdd' 'Third')). self assert:(('First,Second,Third,,' asCollectionOfSubstringsSeparatedBy:',' textSeparator:nil) - sameContentsAs:#('First' 'Second' 'Third' '' '')). + sameContentsAs:#('First' 'Second' 'Third' '' '')). self assert:(('First,Second,Third,,' asCollectionOfSubstringsSeparatedBy:',' textSeparator:'#') - sameContentsAs:#('First' 'Second' 'Third' '' '')). + sameContentsAs:#('First' 'Second' 'Third' '' '')). " "Modified: / 07-04-2011 / 13:23:19 / cg" @@ -5991,46 +5991,45 @@ subSize := subString size. subSize == 0 ifTrue:[ - subString isString ifFalse:[ - self error:'non string argument' mayProceed:true. - ]. - "empty string does not match" - ^ 0. - "empty string matches" - ^ index + subString isString ifFalse:[ + self error:'non string argument' mayProceed:true. + ]. + "empty string does not match" + ^ 0. + "empty string matches" +"/ ^ index ]. - tester := caseSensitive - ifTrue:[ [:c1 :c2 | c1 = c2 ] ] - ifFalse:[ [:c1 :c2 | c1 sameAs: c2 ] ]. mySize := self size. firstChar := subString at:1. caseSensitive ifTrue:[ - startIndex := self indexOf:firstChar startingAt:index. + tester := [:c1 :c2 | c1 = c2 ]. + startIndex := self indexOf:firstChar startingAt:index. ] ifFalse:[ - startIndex := self findFirst:[:c | c sameAs:firstChar] startingAt:index. + tester := [:c1 :c2 | c1 sameAs: c2 ]. + startIndex := self findFirst:[:c | c sameAs:firstChar] startingAt:index. ]. [startIndex == 0] whileFalse:[ - runIdx := startIndex. - found := true. - 1 to:subSize do:[:i | - runIdx > mySize ifTrue:[ - found := false - ] ifFalse:[ - (tester value:(subString at:i) value:(self at:runIdx)) ifFalse:[ - found := false - ] - ]. - runIdx := runIdx + 1 - ]. - found ifTrue:[ - ^ startIndex - ]. - caseSensitive ifTrue:[ - startIndex := self indexOf:firstChar startingAt:(startIndex + 1) - ] ifFalse:[ - startIndex := self findFirst:[:c | c sameAs:firstChar] startingAt:(startIndex + 1). - ]. + runIdx := startIndex. + found := true. + 1 to:subSize do:[:i | + runIdx > mySize ifTrue:[ + found := false + ] ifFalse:[ + (tester value:(subString at:i) value:(self at:runIdx)) ifFalse:[ + found := false + ] + ]. + runIdx := runIdx + 1 + ]. + found ifTrue:[ + ^ startIndex + ]. + caseSensitive ifTrue:[ + startIndex := self indexOf:firstChar startingAt:(startIndex + 1) + ] ifFalse:[ + startIndex := self findFirst:[:c | c sameAs:firstChar] startingAt:(startIndex + 1). + ]. ]. ^ exceptionBlock value @@ -6418,11 +6417,11 @@ !CharacterArray class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.504 2013-06-19 06:36:14 stefan Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.506 2013-06-26 07:59:54 stefan Exp $' ! version_CVS - ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.504 2013-06-19 06:36:14 stefan Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.506 2013-06-26 07:59:54 stefan Exp $' ! !
--- a/ClassBuilder.st Fri Jun 28 11:29:14 2013 +0100 +++ b/ClassBuilder.st Mon Jul 01 22:14:20 2013 +0100 @@ -21,8 +21,7 @@ newPoolDictionaries classVarChange instVarChange poolChange recompileGlobalAccessTo oldClassToBecomeNew oldClassInstVars newClassInstVars' - classVariableNames:'LastNamespace LastNamespaceName LastClassesInNameSpace - LastClassNamesInNameSpace' + classVariableNames:'LastNamespaceName LastClassNamesInNameSpace' poolDictionaries:'' category:'Kernel-Support' ! @@ -202,7 +201,7 @@ copyInvalidatedMethodsFrom:oldClass for:newClass accessingAny:setOfNames orSuper:superBoolean "copy all methods from oldClass to newClass. Those methods accessing a variable in setOfNames will be copied as invalid method, - leading to a trap when its executed. If superBoolean is true, this is also done + leading to a trap when executed. If superBoolean is true, this is also done for methods accessing super. This is used when a class has changed its layout for all methods which are affected by the change." @@ -1060,7 +1059,7 @@ "/ dont allow built-in classes to be modified - (oldClass notNil and:[oldClass isBuiltInClass and:[instVarChange]]) ifTrue:[ + (instVarChange and:[oldClass notNil and:[oldClass isBuiltInClass]]) ifTrue:[ ClassBuildError raiseErrorString:'The layout of this class is fixed - you cannot change it.'. AbortSignal raise ]. @@ -1270,8 +1269,8 @@ Class flushSubclassInfoFor:oldSuperClass. Class flushSubclassInfoFor:newSuperClass. - "/ dont allow built-in classes to be modified this way - (oldClass notNil and:[oldClass isBuiltInClass and:[superClassChange]]) ifTrue:[ + "/ don't allow built-in classes to be modified this way + (superClassChange and:[oldClass notNil and:[oldClass isBuiltInClass]]) ifTrue:[ ClassBuildError raiseErrorString:'the inheritance of this class is fixed - you cannot change it'. ^ oldClass ]. @@ -1696,7 +1695,7 @@ (it might have been a global/undeclared before ...) " - addedNames := newNames reject:[:nm | oldNames includes:nm ]. + addedNames := newNames copyFrom:oldNames size + 1. "/ newNames reject:[:nm | oldNames includes:nm ]. "/ Smalltalk silentLoading ifFalse:[ "/ Transcript showCR:'recompiling class methods of ' , newMetaclass name , @@ -1707,7 +1706,7 @@ newMetaclass recompileMethodsAccessingAny:addedNames. ] ifFalse:[ " - create the changeSet; thats the set of class instvar names + create the changeSet; that's the set of class instvar names which have changed their position or are new " offset := 0. oldOffsets := Dictionary new. @@ -2373,11 +2372,11 @@ !ClassBuilder class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libbasic/ClassBuilder.st,v 1.123 2013-04-16 15:58:40 stefan Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/ClassBuilder.st,v 1.126 2013-06-30 06:57:34 cg Exp $' ! version_CVS - ^ '$Header: /cvs/stx/stx/libbasic/ClassBuilder.st,v 1.123 2013-04-16 15:58:40 stefan Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/ClassBuilder.st,v 1.126 2013-06-30 06:57:34 cg Exp $' ! !
--- a/ClassDescription.st Fri Jun 28 11:29:14 2013 +0100 +++ b/ClassDescription.st Mon Jul 01 22:14:20 2013 +0100 @@ -820,7 +820,6 @@ "Created: / 28.3.1998 / 21:21:52 / cg" ! ! - !ClassDescription methodsFor:'Compatibility-V''Age'! categoriesFor:aSelector are:listOfCategories @@ -935,20 +934,12 @@ ]. ! -instVarIndexFor:aVariableName - "alias for #instVarOffsetOf: for VW compatibility." - - ^ self instVarOffsetOf:aVariableName - - "Created: / 27-03-2007 / 08:37:31 / cg" -! - instVarIndexFor:aVariableName ifAbsent:exceptionValue "alias for #instVarOffsetOf: for VW compatibility." |idx| - idx := self instVarOffsetOf:aVariableName. + idx := self instVarIndexFor:aVariableName. idx isNil ifTrue:[ ^ exceptionValue value ]. ^ idx @@ -1013,6 +1004,32 @@ ^ self allInstanceVariableNames at:index ! +instVarIndexFor:aVariableName + "return the index (as used in instVarAt:/instVarAt:put:) of a named instance + variable (1..instSize) for valid variable names, nil for illegal names." + + |i cls vars| + + cls := self. + [cls notNil] whileTrue:[ + vars := cls instVarNames. + i := vars indexOf:aVariableName. + i ~~ 0 ifTrue:[ + ^ (cls superclass instSize) + i + ]. + cls := cls superclass + ]. + ^ nil + + " + Point instVarIndexFor:'x' + View instVarIndexFor:'paint' + Button instVarIndexFor:'logo' + " + + "Modified: 23.8.1997 / 16:59:15 / cg" +! + instVarNames "return a collection of the instance variable name-strings" @@ -1036,21 +1053,11 @@ instVarOffsetOf:aVariableName "return the index (as used in instVarAt:/instVarAt:put:) of a named instance - variable. The returned number is 1..instSize for valid variable names, nil for - illegal names." - - |i cls vars| - - cls := self. - [cls notNil] whileTrue:[ - vars := cls instVarNames. - i := vars indexOf:aVariableName. - i ~~ 0 ifTrue:[ - ^ (cls superclass instSize) + i - ]. - cls := cls superclass - ]. - ^ nil + variable (1..instSize) for valid variable names, nil for illegal names. + This was the original ST/X's method for this functionality; senders have been changed to use instVarIndexFor:. + Kept for backward compatibility; please use instVarIndexFor: for VW and Squeak compatibility" + + ^ self instVarIndexFor:aVariableName " Point instVarOffsetOf:'x' @@ -1834,7 +1841,8 @@ "{ Pragma: +optSpace }" "recompile all methods accessing a variable from setOfNames, - or super (if superBoolean is true)" + or super (if superBoolean is true). + Also recompiles methods with possibly inlined instVarIndexFor:" |p| @@ -1860,8 +1868,9 @@ mustCompile isNil ifTrue:[ p := self parserClass parseMethod:source in:self. (p isNil + or:[(aMethod sendsAny:#( instVarIndexFor: instVarOffsetOf: )) or:[(p usedVars includesAny:setOfNames) - or:[superBoolean and:[p usesSuper]]]) ifTrue:[ + or:[superBoolean and:[p usesSuper]]]]) ifTrue:[ mustCompile := true ] ]. @@ -1938,22 +1947,21 @@ "{ Pragma: +optSpace }" "recompile all methods which have non-dynamic machineCode - (i.e. those, which were loaded from a classLibrary)" + (i.e. those, which were loaded from a compiled classLibrary)" self selectorsAndMethodsDo:[:aSelector :oldMethod | - |newMethod| - - oldMethod isLazyMethod ifFalse:[ - oldMethod byteCode isNil ifTrue:[ - self recompile:aSelector. - newMethod := self compiledMethodAt:aSelector. - oldMethod ~~ newMethod ifTrue:[ - newMethod sourceFilename:(oldMethod getSource) position:(oldMethod getSourcePosition) - ] - ]. - ]. + |newMethod| + + oldMethod isLazyMethod ifFalse:[ + oldMethod byteCode isNil ifTrue:[ + self recompile:aSelector. + newMethod := self compiledMethodAt:aSelector. + oldMethod ~~ newMethod ifTrue:[ + newMethod sourceFilename:(oldMethod getSource) position:(oldMethod getSourcePosition) + ] + ]. + ]. ]. - ! recompileUsingCompilerClass:aCompilerClass @@ -4282,11 +4290,11 @@ !ClassDescription class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libbasic/ClassDescription.st,v 1.240 2013-06-19 06:42:05 stefan Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/ClassDescription.st,v 1.241 2013-06-30 06:55:40 cg Exp $' ! version_CVS - ^ '$Header: /cvs/stx/stx/libbasic/ClassDescription.st,v 1.240 2013-06-19 06:42:05 stefan Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/ClassDescription.st,v 1.241 2013-06-30 06:55:40 cg Exp $' ! !
--- a/Collection.st Fri Jun 28 11:29:14 2013 +0100 +++ b/Collection.st Mon Jul 01 22:14:20 2013 +0100 @@ -259,7 +259,6 @@ ^ self withSize:n ! ! - !Collection class methodsFor:'Signal constants'! emptyCollectionSignal @@ -531,7 +530,6 @@ ]. ! ! - !Collection methodsFor:'accessing'! anElement @@ -2477,6 +2475,18 @@ This is a utility helper for collection printers (for example, to print a space between elements)." +"/ could do the more hackish: +"/ +"/ |b| +"/ +"/ b := [ b := betweenBlock ]. +"/ self do:[:element | +"/ b value. +"/ aBlock value:element +"/ ]. +"/ +"/ but that creates a block, whereas the following does not. + |first| first := true. @@ -4812,11 +4822,11 @@ !Collection class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.306 2013-06-20 11:29:55 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.307 2013-06-29 09:34:33 cg Exp $' ! version_CVS - ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.306 2013-06-20 11:29:55 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.307 2013-06-29 09:34:33 cg Exp $' ! !
--- a/ExternalStream.st Fri Jun 28 11:29:14 2013 +0100 +++ b/ExternalStream.st Mon Jul 01 22:14:20 2013 +0100 @@ -127,7 +127,7 @@ # define WIN32_LEAN_AND_MEAN # include <windows.h> -# include <winsock2.h> +# include <winsock2.h> # ifdef __DEF_Array # define Array __DEF_Array @@ -199,7 +199,7 @@ # define DEBUGBUFFER(buf) \ if (((char *)(buf) >= __survStartPtr) \ && ((char *)(buf) < __survEndPtr)) { \ - __fatal0("read into survivor\n"); \ + __fatal0("read into survivor\n"); \ } #else @@ -226,69 +226,69 @@ # define READ(ret,f, cp, n, handleType) \ { int __res;\ - HANDLE h; \ - h = _get_osfhandle(fileno(f)); \ - if ((handleType == @symbol(socketFilePointer)) \ - || ((handleType == nil) && (ioctlsocket((SOCKET)h,FIONREAD,&__res)==0))) { \ - (ret) = __STX_WSA_NOINT_CALL4("recv", recv, h, (cp), (n), 0);\ - } else { \ - (ret) = __STX_C_NOINT_CALL3("_rtl_read", _rtl_read, fileno(f), (cp), (n));\ - } \ + HANDLE h; \ + h = _get_osfhandle(fileno(f)); \ + if ((handleType == @symbol(socketFilePointer)) \ + || ((handleType == nil) && (ioctlsocket((SOCKET)h,FIONREAD,&__res)==0))) { \ + (ret) = __STX_WSA_NOINT_CALL4("recv", recv, h, (cp), (n), 0);\ + } else { \ + (ret) = __STX_C_NOINT_CALL3("_rtl_read", _rtl_read, fileno(f), (cp), (n));\ + } \ } # define WRITE(ret,f, cp, n, handleType) \ { int __res;\ - HANDLE h; \ - h = _get_osfhandle(fileno(f)); \ - if ((handleType == @symbol(socketFilePointer)) \ - || ((handleType == nil) && (ioctlsocket((SOCKET)h,FIONREAD,&__res)==0))) { \ - (ret) = __STX_WSA_NOINT_CALL4("send", send, h, (cp), (n), 0);\ - } else { \ - (ret) = __STX_C_NOINT_CALL3("_rtl_write", _rtl_write, fileno(f), (cp), (n));\ - } \ + HANDLE h; \ + h = _get_osfhandle(fileno(f)); \ + if ((handleType == @symbol(socketFilePointer)) \ + || ((handleType == nil) && (ioctlsocket((SOCKET)h,FIONREAD,&__res)==0))) { \ + (ret) = __STX_WSA_NOINT_CALL4("send", send, h, (cp), (n), 0);\ + } else { \ + (ret) = __STX_C_NOINT_CALL3("_rtl_write", _rtl_write, fileno(f), (cp), (n));\ + } \ } # else /* MSC */ # define READ(ret,f, cp, n, handleType) \ { int __res;\ - int fd; \ - HANDLE h; \ - fd = fileno(f); \ - if ((handleType == @symbol(socketFileDescriptor)) \ - || ((handleType == nil) && (ioctlsocket((SOCKET)fd,FIONREAD,&__res)==0))) { \ - (ret) = __STX_WSA_NOINT_CALL4("recv", recv, fd, (cp), (n), 0);\ - } else { \ - h = _get_osfhandle(fd); \ - if ((handleType == @symbol(socketFilePointer)) \ - || ((handleType == nil) && (ioctlsocket((SOCKET)h,FIONREAD,&__res)==0))) { \ - (ret) = __STX_WSA_NOINT_CALL4("recv", recv, h, (cp), (n), 0);\ - } else { \ - (ret) = __STX_API_NOINT_CALL5("ReadFile", ReadFile, h, (cp), (n), &__res, 0);\ - if (ret) \ - ret = __res; \ - } \ - } \ + int fd; \ + HANDLE h; \ + fd = fileno(f); \ + if ((handleType == @symbol(socketFileDescriptor)) \ + || ((handleType == nil) && (ioctlsocket((SOCKET)fd,FIONREAD,&__res)==0))) { \ + (ret) = __STX_WSA_NOINT_CALL4("recv", recv, fd, (cp), (n), 0);\ + } else { \ + h = _get_osfhandle(fd); \ + if ((handleType == @symbol(socketFilePointer)) \ + || ((handleType == nil) && (ioctlsocket((SOCKET)h,FIONREAD,&__res)==0))) { \ + (ret) = __STX_WSA_NOINT_CALL4("recv", recv, h, (cp), (n), 0);\ + } else { \ + (ret) = __STX_API_NOINT_CALL5("ReadFile", ReadFile, h, (cp), (n), &__res, 0);\ + if (ret) \ + ret = __res; \ + } \ + } \ } # define WRITE(ret,f, cp, n, handleType) \ { int __res;\ - int fd; \ - HANDLE h; \ - fd = fileno(f); \ - if ((handleType == @symbol(socketFileDescriptor)) \ - || ((handleType == nil) && (ioctlsocket((SOCKET)fd,FIONREAD,&__res)==0))) { \ - (ret) = __STX_WSA_NOINT_CALL4("send", send, fd, (cp), (n), 0);\ - } else {\ - h = _get_osfhandle(fd); \ - if ((handleType == @symbol(socketFilePointer)) \ - || ((handleType == nil) && (ioctlsocket((SOCKET)h,FIONREAD,&__res)==0))) { \ - (ret) = __STX_WSA_NOINT_CALL4("send", send, h, (cp), (n), 0);\ - } else {\ - (ret) = __STX_API_NOINT_CALL5("WriteFile", WriteFile, h, (cp), (n), &__res, 0);\ - if (ret) \ - ret = __res; \ - } \ - } \ + int fd; \ + HANDLE h; \ + fd = fileno(f); \ + if ((handleType == @symbol(socketFileDescriptor)) \ + || ((handleType == nil) && (ioctlsocket((SOCKET)fd,FIONREAD,&__res)==0))) { \ + (ret) = __STX_WSA_NOINT_CALL4("send", send, fd, (cp), (n), 0);\ + } else {\ + h = _get_osfhandle(fd); \ + if ((handleType == @symbol(socketFilePointer)) \ + || ((handleType == nil) && (ioctlsocket((SOCKET)h,FIONREAD,&__res)==0))) { \ + (ret) = __STX_WSA_NOINT_CALL4("send", send, h, (cp), (n), 0);\ + } else {\ + (ret) = __STX_API_NOINT_CALL5("WriteFile", WriteFile, h, (cp), (n), &__res, 0);\ + if (ret) \ + ret = __res; \ + } \ + } \ } # endif /* MSC */ @@ -300,56 +300,56 @@ # define __READING__(f) \ if ((__INST(didWrite) != false) \ && (__INST(mode) == @symbol(readwrite))) { \ - __INST(didWrite) = false; \ - OPT_FSEEK(f, 0L, SEEK_CUR); /* needed in stdio */ \ + __INST(didWrite) = false; \ + OPT_FSEEK(f, 0L, SEEK_CUR); /* needed in stdio */ \ } # define __WRITING__(f) \ if ((__INST(didWrite) != true) \ && (__INST(mode) == @symbol(readwrite))) { \ - __INST(didWrite) = true; \ - OPT_FSEEK(f, 0L, SEEK_CUR); /* needed in stdio */ \ + __INST(didWrite) = true; \ + OPT_FSEEK(f, 0L, SEEK_CUR); /* needed in stdio */ \ } # define __UNGETC__(c, f, isBuffered) \ if (isBuffered) { \ - ungetc((c), (f)); \ + ungetc((c), (f)); \ } else { \ __INST(readAhead) = __mkSmallInteger((c)); \ } # define __READBYTE__(ret, f, buf, isBuffered, handleType) \ if (isBuffered) { \ - for (;;) { \ - CLEAR_ERRNO; \ - (ret) = getc(f); \ - if ((ret) >= 0) { \ - *(buf) = (ret); \ - (ret) = 1; \ - } else if (ferror(f)) { \ - if (__threadErrno == EINTR) { \ - clearerr(f); \ - continue; \ - } \ - } else { \ - (ret) = 0; \ - } \ - break; \ - } \ + for (;;) { \ + CLEAR_ERRNO; \ + (ret) = getc(f); \ + if ((ret) >= 0) { \ + *(buf) = (ret); \ + (ret) = 1; \ + } else if (ferror(f)) { \ + if (__threadErrno == EINTR) { \ + clearerr(f); \ + continue; \ + } \ + } else { \ + (ret) = 0; \ + } \ + break; \ + } \ } else { \ - OBJ rA = __INST(readAhead); \ - if (rA != nil) { \ - *(buf) = (char)__intVal(rA); \ - __INST(readAhead) = nil; \ - (ret) = 1; \ - } else { \ - for (;;) { \ - CLEAR_ERRNO; \ - READ(ret,f, buf, 1, handleType); \ - if ((ret) >= 0 || __threadErrno != EINTR) \ - break; \ - } \ - } \ + OBJ rA = __INST(readAhead); \ + if (rA != nil) { \ + *(buf) = (char)__intVal(rA); \ + __INST(readAhead) = nil; \ + (ret) = 1; \ + } else { \ + for (;;) { \ + CLEAR_ERRNO; \ + READ(ret,f, buf, 1, handleType); \ + if ((ret) >= 0 || __threadErrno != EINTR) \ + break; \ + } \ + } \ } /* @@ -359,120 +359,120 @@ # define __READBYTES__(ret, f, buf, cnt, isBuffered, handleType) \ (ret) = 0; \ if (isBuffered) { \ - int __offs = 0; \ - while (__offs < (cnt)) { \ - CLEAR_ERRNO; \ - (ret) = getc(f); \ - if ((ret) < 0) { \ - if (ferror(f)) { \ - if (__threadErrno == EINTR) { \ - clearerr(f); \ - continue; \ - } \ - } else { \ - (ret) = 0; \ - } \ - break; \ - } \ - (buf)[__offs++] = (ret); \ - } \ - if (__offs > 0) \ - (ret) = __offs; \ + int __offs = 0; \ + while (__offs < (cnt)) { \ + CLEAR_ERRNO; \ + (ret) = getc(f); \ + if ((ret) < 0) { \ + if (ferror(f)) { \ + if (__threadErrno == EINTR) { \ + clearerr(f); \ + continue; \ + } \ + } else { \ + (ret) = 0; \ + } \ + break; \ + } \ + (buf)[__offs++] = (ret); \ + } \ + if (__offs > 0) \ + (ret) = __offs; \ } else { \ - int __offs = 0; \ - \ - while (__offs < (cnt)) { \ - OBJ rA = __INST(readAhead); \ - if (rA != nil) { \ - (buf)[__offs] = __intVal(rA); \ - __INST(readAhead) = nil; \ - (ret) = 1; \ - } else { \ - CLEAR_ERRNO; \ - READ(ret,f, (buf)+__offs, (cnt)-__offs, handleType); \ - if ((ret) <= 0) { \ - if ((ret) < 0 && __threadErrno == EINTR) { \ - continue; \ - } \ - break; \ - } \ - } \ - __offs += (ret); \ - } \ - if (__offs > 0) \ - (ret) = __offs; \ + int __offs = 0; \ + \ + while (__offs < (cnt)) { \ + OBJ rA = __INST(readAhead); \ + if (rA != nil) { \ + (buf)[__offs] = __intVal(rA); \ + __INST(readAhead) = nil; \ + (ret) = 1; \ + } else { \ + CLEAR_ERRNO; \ + READ(ret,f, (buf)+__offs, (cnt)-__offs, handleType); \ + if ((ret) <= 0) { \ + if ((ret) < 0 && __threadErrno == EINTR) { \ + continue; \ + } \ + break; \ + } \ + } \ + __offs += (ret); \ + } \ + if (__offs > 0) \ + (ret) = __offs; \ } # define __READAVAILBYTES__(ret, f, buf, cnt, isBuffered, handleType) \ { \ int __offs = 0; \ int oldFlags; \ - \ + \ (ret) = 0; \ if (isBuffered) { \ - while (__offs < (cnt)) { \ - CLEAR_ERRNO; \ - (ret) = getc(f); \ - if ((ret) < 0) { \ - if (ferror(f)) { \ - if (__threadErrno == EINTR) { \ - clearerr(f); \ - continue; \ - } \ - } else { \ - (ret) = 0; \ - } \ - break; \ - } \ - (buf)[__offs++] = (ret); \ - } \ - if (__offs > 0) \ - (ret) = __offs; \ + while (__offs < (cnt)) { \ + CLEAR_ERRNO; \ + (ret) = getc(f); \ + if ((ret) < 0) { \ + if (ferror(f)) { \ + if (__threadErrno == EINTR) { \ + clearerr(f); \ + continue; \ + } \ + } else { \ + (ret) = 0; \ + } \ + break; \ + } \ + (buf)[__offs++] = (ret); \ + } \ + if (__offs > 0) \ + (ret) = __offs; \ } else { \ - while (__offs < (cnt)) { \ - OBJ rA = __INST(readAhead); \ - if (rA != nil) { \ - (buf)[__offs] = __intVal(rA); \ - __INST(readAhead) = nil; \ - (ret) = 1; \ - __offs += (ret); \ - continue; \ - } \ - CLEAR_ERRNO; \ - { \ - int res; \ - if ((handleType == @symbol(socketFilePointer)) \ - || ((handleType == nil) && (ioctlsocket((SOCKET)_get_osfhandle(fileno(f)),FIONREAD,&res)==0))) { \ - if (res > 0) { \ - if (res > ((cnt)-__offs)) \ - res = (cnt)-__offs; \ - READ(ret,f, (buf)+__offs, res, handleType); \ - } else { \ - (ret) = 0; \ - } \ - } else if ((handleType == @symbol(pipeFilePointer)) \ - || ((handleType == nil) && (PeekNamedPipe((HANDLE)_get_osfhandle(fileno(f)),0, 0,0,&res,0)))) { \ - if (res > 0) { \ - if (res > ((cnt)-__offs)) \ - res = (cnt)-__offs; \ - READ(ret,f, (buf)+__offs, res, handleType); \ - } else \ - ret = 0; \ - } else { \ - READ(ret,f, (buf)+__offs, (cnt)-__offs, handleType); \ - } \ - } \ - if ((ret) < 0) { \ - if (__threadErrno == EINTR) { \ - continue; \ - } \ - break; \ - } \ - __offs += (ret); \ - break; \ - } \ - if (__offs > 0) \ - (ret) = __offs; \ + while (__offs < (cnt)) { \ + OBJ rA = __INST(readAhead); \ + if (rA != nil) { \ + (buf)[__offs] = __intVal(rA); \ + __INST(readAhead) = nil; \ + (ret) = 1; \ + __offs += (ret); \ + continue; \ + } \ + CLEAR_ERRNO; \ + { \ + int res; \ + if ((handleType == @symbol(socketFilePointer)) \ + || ((handleType == nil) && (ioctlsocket((SOCKET)_get_osfhandle(fileno(f)),FIONREAD,&res)==0))) { \ + if (res > 0) { \ + if (res > ((cnt)-__offs)) \ + res = (cnt)-__offs; \ + READ(ret,f, (buf)+__offs, res, handleType); \ + } else { \ + (ret) = 0; \ + } \ + } else if ((handleType == @symbol(pipeFilePointer)) \ + || ((handleType == nil) && (PeekNamedPipe((HANDLE)_get_osfhandle(fileno(f)),0, 0,0,&res,0)))) { \ + if (res > 0) { \ + if (res > ((cnt)-__offs)) \ + res = (cnt)-__offs; \ + READ(ret,f, (buf)+__offs, res, handleType); \ + } else \ + ret = 0; \ + } else { \ + READ(ret,f, (buf)+__offs, (cnt)-__offs, handleType); \ + } \ + } \ + if ((ret) < 0) { \ + if (__threadErrno == EINTR) { \ + continue; \ + } \ + break; \ + } \ + __offs += (ret); \ + break; \ + } \ + if (__offs > 0) \ + (ret) = __offs; \ } \ } @@ -483,63 +483,63 @@ int __ooffs = obj_offs; \ int __offs = 0; \ char *buf = (char *)(obj); \ - \ + \ (ret) = 0; \ if (isBuffered) { \ - while (__offs < (cnt)) { \ - CLEAR_ERRNO; \ - (ret) = getc(f); \ - if ((ret) < 0) { \ - if (ferror(f)) { \ - if (__threadErrno == EINTR) { \ - clearerr(f); \ - /* refetch */ \ - buf = (char *)(obj); \ - continue; \ - } \ - } else { \ - (ret) = 0; \ - } \ - break; \ - } \ - (buf)[__ooffs+__offs] = (ret); \ - __offs++; \ - } \ - if (__offs > 0) \ - (ret) = __offs; \ + while (__offs < (cnt)) { \ + CLEAR_ERRNO; \ + (ret) = getc(f); \ + if ((ret) < 0) { \ + if (ferror(f)) { \ + if (__threadErrno == EINTR) { \ + clearerr(f); \ + /* refetch */ \ + buf = (char *)(obj); \ + continue; \ + } \ + } else { \ + (ret) = 0; \ + } \ + break; \ + } \ + (buf)[__ooffs+__offs] = (ret); \ + __offs++; \ + } \ + if (__offs > 0) \ + (ret) = __offs; \ } else { \ - while (__offs < (cnt)) { \ - char __buf[IO_BUFFER_SIZE]; \ - OBJ rA = __INST(readAhead); \ - if (rA != nil) { \ - (buf)[__ooffs+__offs] = __intVal(rA); \ - __INST(readAhead) = nil; \ - (ret) = 1; \ - } else { \ - int l; \ - CLEAR_ERRNO; \ - l = (cnt)-__offs; \ - if ( l > IO_BUFFER_SIZE) \ - l = IO_BUFFER_SIZE; \ - READ(ret,f, __buf, l, handleType); \ - if ((ret) <= 0) { \ - if ((ret) < 0 && __threadErrno == EINTR) { \ - continue; \ - } \ - break; \ - } \ - } \ - if( (ret) > 0 ) { \ - /* refetch */ \ - buf = (char *)(obj); \ - memcpy((buf)+__ooffs+__offs,__buf,(ret)); \ - __offs += (ret); \ - } else { \ - (ret) = 0; \ - } \ - } \ - if (__offs > 0) \ - (ret) = __offs; \ + while (__offs < (cnt)) { \ + char __buf[IO_BUFFER_SIZE]; \ + OBJ rA = __INST(readAhead); \ + if (rA != nil) { \ + (buf)[__ooffs+__offs] = __intVal(rA); \ + __INST(readAhead) = nil; \ + (ret) = 1; \ + } else { \ + int l; \ + CLEAR_ERRNO; \ + l = (cnt)-__offs; \ + if ( l > IO_BUFFER_SIZE) \ + l = IO_BUFFER_SIZE; \ + READ(ret,f, __buf, l, handleType); \ + if ((ret) <= 0) { \ + if ((ret) < 0 && __threadErrno == EINTR) { \ + continue; \ + } \ + break; \ + } \ + } \ + if( (ret) > 0 ) { \ + /* refetch */ \ + buf = (char *)(obj); \ + memcpy((buf)+__ooffs+__offs,__buf,(ret)); \ + __offs += (ret); \ + } else { \ + (ret) = 0; \ + } \ + } \ + if (__offs > 0) \ + (ret) = __offs; \ } \ } @@ -548,147 +548,147 @@ int __ooffs = obj_offs; \ int __offs = 0; \ char *buf = (char *)(obj); \ - \ + \ (ret) = 0; \ if (isBuffered) { \ - while (__offs < (cnt)) { \ - CLEAR_ERRNO; \ - (ret) = getc(f); \ - if ((ret) < 0) { \ - if (ferror(f)) { \ - if (__threadErrno == EINTR) { \ - clearerr(f); \ - /* refetch */ \ - buf = (char *)(obj);\ - continue; \ - } \ - } else { \ - (ret) = 0; \ - } \ - break; \ - } \ - (buf)[__ooffs+__offs] = (ret); \ - __offs++; \ - } \ - if (__offs > 0) \ - (ret) = __offs; \ + while (__offs < (cnt)) { \ + CLEAR_ERRNO; \ + (ret) = getc(f); \ + if ((ret) < 0) { \ + if (ferror(f)) { \ + if (__threadErrno == EINTR) { \ + clearerr(f); \ + /* refetch */ \ + buf = (char *)(obj);\ + continue; \ + } \ + } else { \ + (ret) = 0; \ + } \ + break; \ + } \ + (buf)[__ooffs+__offs] = (ret); \ + __offs++; \ + } \ + if (__offs > 0) \ + (ret) = __offs; \ } else { \ - while (__offs < (cnt)) { \ - char __buf[IO_BUFFER_SIZE]; \ - OBJ rA = __INST(readAhead); \ - if (rA != nil) { \ - (buf)[__ooffs+__offs] = __intVal(rA);\ - __INST(readAhead) = nil; \ - (ret) = 1; \ - __offs += (ret); \ - continue; \ - } \ - { \ - int l; \ - int res; \ - CLEAR_ERRNO; \ - l = (cnt)-__offs; \ - if ( l > IO_BUFFER_SIZE) \ - l = IO_BUFFER_SIZE; \ - if (ioctlsocket((SOCKET)_get_osfhandle(fileno(f)),FIONREAD,&res)==0) { \ - if (res > 0) { \ - if (res > l) \ - res = l; \ - READ(ret,f, __buf, res, handleType); \ - } else { \ - (ret) = 0; \ - } \ - } else if (PeekNamedPipe((HANDLE)_get_osfhandle(fileno(f)),0, 0,0,&res,0)) { \ - if (res > 0) { \ - if (res > l) \ - res = l; \ - READ(ret,f, __buf, res, handleType); \ - } else \ - (ret) = 0; \ - } else { \ - READ(ret,f, __buf, l, handleType); \ - } \ - if ((ret) < 0 && __threadErrno == EINTR) { \ - continue; \ - } \ - } \ - if( (ret) > 0 ) { \ - /* refetch */ \ - buf = (char *)(obj); \ - memcpy((buf)+__ooffs+__offs,__buf,(ret)); \ - __offs += (ret); \ - } else { \ - (ret) = 0; \ - } \ - break; \ - } \ - if (__offs > 0) \ - (ret) = __offs; \ + while (__offs < (cnt)) { \ + char __buf[IO_BUFFER_SIZE]; \ + OBJ rA = __INST(readAhead); \ + if (rA != nil) { \ + (buf)[__ooffs+__offs] = __intVal(rA);\ + __INST(readAhead) = nil; \ + (ret) = 1; \ + __offs += (ret); \ + continue; \ + } \ + { \ + int l; \ + int res; \ + CLEAR_ERRNO; \ + l = (cnt)-__offs; \ + if ( l > IO_BUFFER_SIZE) \ + l = IO_BUFFER_SIZE; \ + if (ioctlsocket((SOCKET)_get_osfhandle(fileno(f)),FIONREAD,&res)==0) { \ + if (res > 0) { \ + if (res > l) \ + res = l; \ + READ(ret,f, __buf, res, handleType); \ + } else { \ + (ret) = 0; \ + } \ + } else if (PeekNamedPipe((HANDLE)_get_osfhandle(fileno(f)),0, 0,0,&res,0)) { \ + if (res > 0) { \ + if (res > l) \ + res = l; \ + READ(ret,f, __buf, res, handleType); \ + } else \ + (ret) = 0; \ + } else { \ + READ(ret,f, __buf, l, handleType); \ + } \ + if ((ret) < 0 && __threadErrno == EINTR) { \ + continue; \ + } \ + } \ + if( (ret) > 0 ) { \ + /* refetch */ \ + buf = (char *)(obj); \ + memcpy((buf)+__ooffs+__offs,__buf,(ret)); \ + __offs += (ret); \ + } else { \ + (ret) = 0; \ + } \ + break; \ + } \ + if (__offs > 0) \ + (ret) = __offs; \ } \ } # define __WRITEBYTE__(ret, f, buf, isBuffered, handleType) \ if (isBuffered) { \ - for (;;) { \ - CLEAR_ERRNO; \ - ret = putc(*(buf), f); \ - if ((ret) >= 0) { \ - (ret) = 1; \ - } else if (ferror(f)) { \ - if (__threadErrno == EINTR) { \ - clearerr(f); \ - continue; \ - } \ - } else \ - (ret) = 0; \ - break; \ - } \ + for (;;) { \ + CLEAR_ERRNO; \ + ret = putc(*(buf), f); \ + if ((ret) >= 0) { \ + (ret) = 1; \ + } else if (ferror(f)) { \ + if (__threadErrno == EINTR) { \ + clearerr(f); \ + continue; \ + } \ + } else \ + (ret) = 0; \ + break; \ + } \ } else { \ - for (;;) { \ - CLEAR_ERRNO; \ - WRITE(ret,f, buf, 1, handleType); \ - if ((ret) >= 0 || __threadErrno != EINTR) \ - break; \ - } \ + for (;;) { \ + CLEAR_ERRNO; \ + WRITE(ret,f, buf, 1, handleType); \ + if ((ret) >= 0 || __threadErrno != EINTR) \ + break; \ + } \ } # define __WRITEBYTES__(ret, f, buf, cnt, isBuffered, handleType) \ (ret) = 0; \ if (isBuffered) { \ - int __offs = 0; \ - while (__offs < (cnt)) { \ - CLEAR_ERRNO; \ - ret = fwrite((buf)+__offs, 1, (cnt)-__offs, f);\ - if ((ret) <= 0) { \ - if (ferror(f)) { \ - if (__threadErrno == EINTR) { \ - clearerr(f); \ - continue; \ - } \ - break; \ - } else { \ - (ret) = 0; \ - } \ - } \ - __offs += (ret); \ - } \ - if (__offs > 0) \ - (ret) = __offs; \ + int __offs = 0; \ + while (__offs < (cnt)) { \ + CLEAR_ERRNO; \ + ret = fwrite((buf)+__offs, 1, (cnt)-__offs, f);\ + if ((ret) <= 0) { \ + if (ferror(f)) { \ + if (__threadErrno == EINTR) { \ + clearerr(f); \ + continue; \ + } \ + break; \ + } else { \ + (ret) = 0; \ + } \ + } \ + __offs += (ret); \ + } \ + if (__offs > 0) \ + (ret) = __offs; \ } else { \ - int __offs = 0; \ - while (__offs < (cnt)) { \ - CLEAR_ERRNO; \ - WRITE(ret,f, (buf)+__offs, (cnt)-__offs, handleType); \ - if (ret <= 0) { \ - if (ret < 0 && __threadErrno == EINTR) { \ - continue; \ - } \ - break; \ - } \ - __offs += (ret); \ - } \ - if (__offs > 0) \ - (ret) = __offs; \ + int __offs = 0; \ + while (__offs < (cnt)) { \ + CLEAR_ERRNO; \ + WRITE(ret,f, (buf)+__offs, (cnt)-__offs, handleType); \ + if (ret <= 0) { \ + if (ret < 0 && __threadErrno == EINTR) { \ + continue; \ + } \ + break; \ + } \ + __offs += (ret); \ + } \ + if (__offs > 0) \ + (ret) = __offs; \ } # define __WRITEBYTES_OBJ__(ret, f, obj, obj_offs, cnt, isBuffered, handleType) \ @@ -696,51 +696,51 @@ int __ooffs = obj_offs; \ int __offs = 0; \ char *buf = (char *)(obj); \ - \ + \ (ret) = 0; \ if (isBuffered) { \ - while (__offs < (cnt)) { \ - CLEAR_ERRNO; \ - ret = fwrite((buf)+__ooffs+__offs, 1, (cnt)-__offs, f); \ - if ((ret) <= 0) { \ - if (ferror(f)) { \ - if (__threadErrno == EINTR) { \ - /* refetch */ \ - buf = (char *)(obj); \ - clearerr(f); \ - continue; \ - } \ - break; \ - } else { \ - (ret) = 0; \ - } \ - } \ - __offs += (ret); \ - } \ - if (__offs > 0) \ - (ret) = __offs; \ + while (__offs < (cnt)) { \ + CLEAR_ERRNO; \ + ret = fwrite((buf)+__ooffs+__offs, 1, (cnt)-__offs, f); \ + if ((ret) <= 0) { \ + if (ferror(f)) { \ + if (__threadErrno == EINTR) { \ + /* refetch */ \ + buf = (char *)(obj); \ + clearerr(f); \ + continue; \ + } \ + break; \ + } else { \ + (ret) = 0; \ + } \ + } \ + __offs += (ret); \ + } \ + if (__offs > 0) \ + (ret) = __offs; \ } else { \ - while (__offs < (cnt)) { \ - char __buf[IO_BUFFER_SIZE]; \ - int l; \ - CLEAR_ERRNO; \ - l = (cnt)-__offs; \ - if ( l > IO_BUFFER_SIZE) \ - l = IO_BUFFER_SIZE; \ - /* refetch */ \ - buf = (char *)(obj); \ - memcpy(__buf,(buf)+__ooffs+__offs,l); \ - WRITE(ret,f, __buf, l, handleType); \ - if (ret <= 0) { \ - if (ret < 0 && __threadErrno == EINTR) { \ - continue; \ - } \ - break; \ - } \ - __offs += (ret); \ - } \ - if (__offs > 0) \ - (ret) = __offs; \ + while (__offs < (cnt)) { \ + char __buf[IO_BUFFER_SIZE]; \ + int l; \ + CLEAR_ERRNO; \ + l = (cnt)-__offs; \ + if ( l > IO_BUFFER_SIZE) \ + l = IO_BUFFER_SIZE; \ + /* refetch */ \ + buf = (char *)(obj); \ + memcpy(__buf,(buf)+__ooffs+__offs,l); \ + WRITE(ret,f, __buf, l, handleType); \ + if (ret <= 0) { \ + if (ret < 0 && __threadErrno == EINTR) { \ + continue; \ + } \ + break; \ + } \ + __offs += (ret); \ + } \ + if (__offs > 0) \ + (ret) = __offs; \ } \ } @@ -749,15 +749,15 @@ # define __READING__(f) \ if ((__INST(didWrite) != false) \ && (__INST(mode) == @symbol(readwrite))) { \ - __INST(didWrite) = false; \ - OPT_FSEEK(f, 0L, SEEK_CUR); /* needed in stdio */ \ + __INST(didWrite) = false; \ + OPT_FSEEK(f, 0L, SEEK_CUR); /* needed in stdio */ \ } # define __WRITING__(f) \ if ((__INST(didWrite) != true) \ && (__INST(mode) == @symbol(readwrite))) { \ - __INST(didWrite) = true; \ - OPT_FSEEK(f, 0L, SEEK_CUR); /* needed in stdio */ \ + __INST(didWrite) = true; \ + OPT_FSEEK(f, 0L, SEEK_CUR); /* needed in stdio */ \ } @@ -767,69 +767,69 @@ # else /* use STDIO */ # define __UNGETC__(c, f, isBuffered) \ if (isBuffered) { \ - ungetc((c), (f)); \ + ungetc((c), (f)); \ } else { \ - __INST(readAhead) = __mkSmallInteger((c)); \ + __INST(readAhead) = __mkSmallInteger((c)); \ } # endif /* use STDIO */ # ifdef NO_STDIO # define __READBYTE__(ret, f, buf, isBuffered, handleType) \ { \ - OBJ rA = __INST(readAhead); \ - if (rA != nil) { \ - *(buf) = __intVal(rA); \ - DEBUGBUFFER(buf); \ - __INST(readAhead) = nil; \ - (ret) = 1; \ - } else { \ - for (;;) { \ - CLEAR_ERRNO; \ - (ret) = READ(f, buf, 1, handleType); \ - DEBUGBUFFER(buf); \ - if ((ret) >= 0 || __threadErrno != EINTR) \ - break; \ - __HANDLE_INTERRUPTS__; \ - } \ - } \ + OBJ rA = __INST(readAhead); \ + if (rA != nil) { \ + *(buf) = __intVal(rA); \ + DEBUGBUFFER(buf); \ + __INST(readAhead) = nil; \ + (ret) = 1; \ + } else { \ + for (;;) { \ + CLEAR_ERRNO; \ + (ret) = READ(f, buf, 1, handleType); \ + DEBUGBUFFER(buf); \ + if ((ret) >= 0 || __threadErrno != EINTR) \ + break; \ + __HANDLE_INTERRUPTS__; \ + } \ + } \ } # else /* use STDIO */ # define __READBYTE__(ret, f, buf, isBuffered, handleType) \ if (isBuffered) { \ - for (;;) { \ - CLEAR_ERRNO; \ - (ret) = getc(f); \ - if ((ret) >= 0) { \ - DEBUGBUFFER(buf); \ - *(buf) = (ret); \ - (ret) = 1; \ - } else if (ferror(f)) { \ - if (__threadErrno == EINTR) { \ - __HANDLE_INTERRUPTS__; \ - clearerr(f); \ - continue; \ - } \ - } else \ - (ret) = 0; \ - break; \ - } \ + for (;;) { \ + CLEAR_ERRNO; \ + (ret) = getc(f); \ + if ((ret) >= 0) { \ + DEBUGBUFFER(buf); \ + *(buf) = (ret); \ + (ret) = 1; \ + } else if (ferror(f)) { \ + if (__threadErrno == EINTR) { \ + __HANDLE_INTERRUPTS__; \ + clearerr(f); \ + continue; \ + } \ + } else \ + (ret) = 0; \ + break; \ + } \ } else { \ - OBJ rA = __INST(readAhead); \ - if (rA != nil) { \ - *(buf) = __intVal(rA); \ - DEBUGBUFFER(buf); \ - __INST(readAhead) = nil; \ - (ret) = 1; \ - } else { \ - for (;;) { \ - CLEAR_ERRNO; \ - (ret) = read(fileno(f), buf, 1); \ - DEBUGBUFFER(buf); \ - if ((ret) >= 0 || __threadErrno != EINTR) \ - break; \ - __HANDLE_INTERRUPTS__; \ - } \ - } \ + OBJ rA = __INST(readAhead); \ + if (rA != nil) { \ + *(buf) = __intVal(rA); \ + DEBUGBUFFER(buf); \ + __INST(readAhead) = nil; \ + (ret) = 1; \ + } else { \ + for (;;) { \ + CLEAR_ERRNO; \ + (ret) = read(fileno(f), buf, 1); \ + DEBUGBUFFER(buf); \ + if ((ret) >= 0 || __threadErrno != EINTR) \ + break; \ + __HANDLE_INTERRUPTS__; \ + } \ + } \ } # endif /* use STDIO */ @@ -840,84 +840,84 @@ # ifdef NO_STDIO # define __READBYTES__(ret, f, buf, cnt, isBuffered, handleType) \ { \ - int __offs = 0, __cnt; \ - \ - while (__offs < (cnt)) { \ - OBJ rA = __INST(readAhead); \ - if (rA != nil) { \ - (buf)[__offs] = __intVal(rA); \ - DEBUGBUFFER(buf); \ - __INST(readAhead) = nil; \ - __offs++; \ - } else { \ - CLEAR_ERRNO; \ - __cnt = READ(f, (buf)+__offs, (cnt)-__offs, handleType); \ - DEBUGBUFFER(buf); \ - if (__cnt <= 0) { \ - if (__cnt < 0 && __threadErrno == EINTR) { \ - __HANDLE_INTERRUPTS__; \ - continue; \ - } \ - break; \ - } \ - __offs += __cnt; \ - } \ - } \ - if (__offs > 0) \ - (ret) = __offs; \ + int __offs = 0, __cnt; \ + \ + while (__offs < (cnt)) { \ + OBJ rA = __INST(readAhead); \ + if (rA != nil) { \ + (buf)[__offs] = __intVal(rA); \ + DEBUGBUFFER(buf); \ + __INST(readAhead) = nil; \ + __offs++; \ + } else { \ + CLEAR_ERRNO; \ + __cnt = READ(f, (buf)+__offs, (cnt)-__offs, handleType); \ + DEBUGBUFFER(buf); \ + if (__cnt <= 0) { \ + if (__cnt < 0 && __threadErrno == EINTR) { \ + __HANDLE_INTERRUPTS__; \ + continue; \ + } \ + break; \ + } \ + __offs += __cnt; \ + } \ + } \ + if (__offs > 0) \ + (ret) = __offs; \ } # else /* use STDIO */ # define __READBYTES__(ret, f, buf, cnt, isBuffered, handleType) \ (ret) = 0; \ if (isBuffered) { \ - int __offs = 0; \ - while (__offs < (cnt)) { \ - CLEAR_ERRNO; \ - (ret) = getc(f); \ - if ((ret) < 0) { \ - if (ferror(f)) { \ - if (__threadErrno == EINTR) { \ - __HANDLE_INTERRUPTS__; \ - clearerr(f); \ - continue; \ - } \ - } else { \ - (ret) = 0; \ - } \ - break; \ - } \ - DEBUGBUFFER(buf); \ - (buf)[__offs++] = (ret); \ - } \ - if (__offs > 0) \ - (ret) = __offs; \ + int __offs = 0; \ + while (__offs < (cnt)) { \ + CLEAR_ERRNO; \ + (ret) = getc(f); \ + if ((ret) < 0) { \ + if (ferror(f)) { \ + if (__threadErrno == EINTR) { \ + __HANDLE_INTERRUPTS__; \ + clearerr(f); \ + continue; \ + } \ + } else { \ + (ret) = 0; \ + } \ + break; \ + } \ + DEBUGBUFFER(buf); \ + (buf)[__offs++] = (ret); \ + } \ + if (__offs > 0) \ + (ret) = __offs; \ } else { \ - int __offs = 0, __cnt; \ - int fd = fileno(f); \ - \ - while (__offs < (cnt)) { \ - OBJ rA = __INST(readAhead); \ - if (rA != nil) { \ - DEBUGBUFFER(buf); \ - (buf)[__offs] = __intVal(rA); \ - __INST(readAhead) = nil; \ - __offs++; \ - } else { \ - CLEAR_ERRNO; \ - __cnt = read(fd, (buf)+__offs, (cnt)-__offs); \ - DEBUGBUFFER(buf); \ - if (__cnt <= 0) { \ - if (__cnt < 0 && __threadErrno == EINTR) { \ - __HANDLE_INTERRUPTS__; \ - continue; \ - } \ - break; \ - } \ - __offs += __cnt; \ - } \ - } \ - if (__offs > 0) \ - (ret) = __offs; \ + int __offs = 0, __cnt; \ + int fd = fileno(f); \ + \ + while (__offs < (cnt)) { \ + OBJ rA = __INST(readAhead); \ + if (rA != nil) { \ + DEBUGBUFFER(buf); \ + (buf)[__offs] = __intVal(rA); \ + __INST(readAhead) = nil; \ + __offs++; \ + } else { \ + CLEAR_ERRNO; \ + __cnt = read(fd, (buf)+__offs, (cnt)-__offs); \ + DEBUGBUFFER(buf); \ + if (__cnt <= 0) { \ + if (__cnt < 0 && __threadErrno == EINTR) { \ + __HANDLE_INTERRUPTS__; \ + continue; \ + } \ + break; \ + } \ + __offs += __cnt; \ + } \ + } \ + if (__offs > 0) \ + (ret) = __offs; \ } @@ -927,7 +927,7 @@ # if defined(F_GETFL) && defined(F_SETFL) && (defined(O_NONBLOCK) || defined(O_NDELAY) || defined(FNDELAY)) # define SETFLAGS(fd, flags) \ - fcntl(fd, F_SETFL, flags) + fcntl(fd, F_SETFL, flags) # if defined(O_NONBLOCK) # define __STX_NONBLOCK_FLAG O_NONBLOCK @@ -940,13 +940,13 @@ # endif # define SETNONBLOCKING(fd, oldFlags) \ - { \ - int flags = fcntl(fd, F_GETFL, 0); \ - if (flags >= 0) { \ - fcntl(fd, F_SETFL, flags | __STX_NONBLOCK_FLAG); \ - } \ - oldFlags = flags; \ - } + { \ + int flags = fcntl(fd, F_GETFL, 0); \ + if (flags >= 0) { \ + fcntl(fd, F_SETFL, flags | __STX_NONBLOCK_FLAG); \ + } \ + oldFlags = flags; \ + } # else # define SETFLAGS(fd, flags) /* nothing */ # define SETNONBLOCKING(fd, oldFlags) /* nothing */ @@ -956,52 +956,52 @@ { \ int __offs = 0, __cnt; \ int oldFlags; \ - \ + \ (ret) = 0; \ SETNONBLOCKING(fileno(f), oldFlags); \ if (isBuffered) { \ - while (__offs < (cnt)) { \ - CLEAR_ERRNO; \ - (ret) = getc(f); \ - if ((ret) < 0) { \ - if (ferror(f)) { \ - if (__threadErrno == EINTR) { \ - (ret) = 0; \ - clearerr(f); \ - break; \ - } \ - } else { \ - (ret) = 0; \ - } \ - break; \ - } \ - (buf)[__offs++] = (ret); \ - DEBUGBUFFER(buf); \ - } \ - if (__offs > 0) \ - (ret) = __offs; \ + while (__offs < (cnt)) { \ + CLEAR_ERRNO; \ + (ret) = getc(f); \ + if ((ret) < 0) { \ + if (ferror(f)) { \ + if (__threadErrno == EINTR) { \ + (ret) = 0; \ + clearerr(f); \ + break; \ + } \ + } else { \ + (ret) = 0; \ + } \ + break; \ + } \ + (buf)[__offs++] = (ret); \ + DEBUGBUFFER(buf); \ + } \ + if (__offs > 0) \ + (ret) = __offs; \ } else { \ - int fd = fileno(f); \ - \ - while (__offs < (cnt)) { \ - OBJ rA = __INST(readAhead); \ - if (rA != nil) { \ - (buf)[__offs] = __intVal(rA); \ - DEBUGBUFFER(buf); \ - __INST(readAhead) = nil; \ - __offs++; \ - continue; \ - } \ - CLEAR_ERRNO; \ - __cnt = read(fd, (buf)+__offs, (cnt)-__offs); \ - DEBUGBUFFER(buf); \ - if (__cnt > 0) { \ - __offs += __cnt; \ - } \ - break; \ - } \ - if (__offs > 0) \ - (ret) = __offs; \ + int fd = fileno(f); \ + \ + while (__offs < (cnt)) { \ + OBJ rA = __INST(readAhead); \ + if (rA != nil) { \ + (buf)[__offs] = __intVal(rA); \ + DEBUGBUFFER(buf); \ + __INST(readAhead) = nil; \ + __offs++; \ + continue; \ + } \ + CLEAR_ERRNO; \ + __cnt = read(fd, (buf)+__offs, (cnt)-__offs); \ + DEBUGBUFFER(buf); \ + if (__cnt > 0) { \ + __offs += __cnt; \ + } \ + break; \ + } \ + if (__offs > 0) \ + (ret) = __offs; \ } \ SETFLAGS(fileno(f), oldFlags); \ } @@ -1019,34 +1019,34 @@ int __offs = 0; \ int __cnt; \ char *buf = (char *)(obj); \ - \ + \ (ret) = 0; \ { \ - while (__offs < (cnt)) { \ - OBJ rA = __INST(readAhead); \ - if (rA != nil) { \ - (buf)[__ooffs+__offs] = __intVal(rA); \ - DEBUGBUFFER(buf); \ - __INST(readAhead) = nil; \ - __offs++; \ - } else { \ - CLEAR_ERRNO; \ - __cnt = READ(f, (buf)+__ooffs+__offs, (cnt)-__offs, handleType); \ - DEBUGBUFFER(buf); \ - if (__cnt <= 0) { \ - if (__cnt < 0 && __threadErrno == EINTR) { \ - __HANDLE_INTERRUPTS__; \ - /* refetch */ \ - buf = (char *)(obj); \ - continue; \ - } \ - break; \ - } \ - __offs += __cnt; \ - } \ - } \ - if (__offs > 0) \ - (ret) = __offs; \ + while (__offs < (cnt)) { \ + OBJ rA = __INST(readAhead); \ + if (rA != nil) { \ + (buf)[__ooffs+__offs] = __intVal(rA); \ + DEBUGBUFFER(buf); \ + __INST(readAhead) = nil; \ + __offs++; \ + } else { \ + CLEAR_ERRNO; \ + __cnt = READ(f, (buf)+__ooffs+__offs, (cnt)-__offs, handleType); \ + DEBUGBUFFER(buf); \ + if (__cnt <= 0) { \ + if (__cnt < 0 && __threadErrno == EINTR) { \ + __HANDLE_INTERRUPTS__; \ + /* refetch */ \ + buf = (char *)(obj); \ + continue; \ + } \ + break; \ + } \ + __offs += __cnt; \ + } \ + } \ + if (__offs > 0) \ + (ret) = __offs; \ } \ } @@ -1058,61 +1058,61 @@ int __offs = 0; \ int __cnt; \ char *buf = (char *)(obj); \ - \ + \ (ret) = 0; \ if (isBuffered) { \ - while (__offs < (cnt)) { \ - CLEAR_ERRNO; \ - (ret) = getc(f); \ - if ((ret) < 0) { \ - if (ferror(f)) { \ - if (__threadErrno == EINTR) { \ - __HANDLE_INTERRUPTS__; \ - clearerr(f); \ - /* refetch */ \ - buf = (char *)(obj); \ - DEBUGBUFFER(buf); \ - continue; \ - } \ - } else { \ - (ret) = 0; \ - } \ - break; \ - } \ - (buf)[__ooffs+__offs] = (ret); \ - DEBUGBUFFER(buf); \ - __offs++; \ - } \ - if (__offs > 0) \ - (ret) = __offs; \ + while (__offs < (cnt)) { \ + CLEAR_ERRNO; \ + (ret) = getc(f); \ + if ((ret) < 0) { \ + if (ferror(f)) { \ + if (__threadErrno == EINTR) { \ + __HANDLE_INTERRUPTS__; \ + clearerr(f); \ + /* refetch */ \ + buf = (char *)(obj); \ + DEBUGBUFFER(buf); \ + continue; \ + } \ + } else { \ + (ret) = 0; \ + } \ + break; \ + } \ + (buf)[__ooffs+__offs] = (ret); \ + DEBUGBUFFER(buf); \ + __offs++; \ + } \ + if (__offs > 0) \ + (ret) = __offs; \ } else { \ - int fd = fileno(f); \ - \ - while (__offs < (cnt)) { \ - OBJ rA = __INST(readAhead); \ - if (rA != nil) { \ - (buf)[__ooffs+__offs] = __intVal(rA); \ - DEBUGBUFFER(buf); \ - __INST(readAhead) = nil; \ - __offs++; \ - } else { \ - CLEAR_ERRNO; \ - __cnt = read(fd, (buf)+__ooffs+__offs, (cnt)-__offs); \ - DEBUGBUFFER(buf); \ - if (__cnt <= 0) { \ - if (__cnt < 0 && __threadErrno == EINTR) { \ - __HANDLE_INTERRUPTS__; \ - /* refetch */ \ - buf = (char *)(obj); \ - continue; \ - } \ - break; \ - } \ - __offs += __cnt; \ - } \ - } \ - if (__offs > 0) \ - (ret) = __offs; \ + int fd = fileno(f); \ + \ + while (__offs < (cnt)) { \ + OBJ rA = __INST(readAhead); \ + if (rA != nil) { \ + (buf)[__ooffs+__offs] = __intVal(rA); \ + DEBUGBUFFER(buf); \ + __INST(readAhead) = nil; \ + __offs++; \ + } else { \ + CLEAR_ERRNO; \ + __cnt = read(fd, (buf)+__ooffs+__offs, (cnt)-__offs); \ + DEBUGBUFFER(buf); \ + if (__cnt <= 0) { \ + if (__cnt < 0 && __threadErrno == EINTR) { \ + __HANDLE_INTERRUPTS__; \ + /* refetch */ \ + buf = (char *)(obj); \ + continue; \ + } \ + break; \ + } \ + __offs += __cnt; \ + } \ + } \ + if (__offs > 0) \ + (ret) = __offs; \ } \ } @@ -1123,56 +1123,56 @@ int __cnt; \ char *buf = (char *)(obj); \ int oldFlags; \ - \ + \ (ret) = 0; \ SETNONBLOCKING(fileno(f), oldFlags); \ - \ + \ if (isBuffered) { \ - while (__offs < (cnt)) { \ - CLEAR_ERRNO; \ - (ret) = getc(f); \ - if ((ret) < 0) { \ - if (ferror(f)) { \ - if (__threadErrno == EINTR) { \ - clearerr(f); \ - /* refetch */ \ - buf = (char *)(obj); \ - (ret) = 0; \ - break; \ - } \ - } else { \ - (ret) = 0; \ - } \ - break; \ - } \ - (buf)[__ooffs+__offs] = (ret); \ - DEBUGBUFFER(buf); \ - __offs++; \ - } \ - if (__offs > 0) \ - (ret) = __offs; \ + while (__offs < (cnt)) { \ + CLEAR_ERRNO; \ + (ret) = getc(f); \ + if ((ret) < 0) { \ + if (ferror(f)) { \ + if (__threadErrno == EINTR) { \ + clearerr(f); \ + /* refetch */ \ + buf = (char *)(obj); \ + (ret) = 0; \ + break; \ + } \ + } else { \ + (ret) = 0; \ + } \ + break; \ + } \ + (buf)[__ooffs+__offs] = (ret); \ + DEBUGBUFFER(buf); \ + __offs++; \ + } \ + if (__offs > 0) \ + (ret) = __offs; \ } else { \ - int fd = fileno(f); \ - \ - while (__offs < (cnt)) { \ - OBJ rA = __INST(readAhead); \ - if (rA != nil) { \ - (buf)[__ooffs+__offs] = __intVal(rA); \ - DEBUGBUFFER(buf); \ - __INST(readAhead) = nil; \ - __offs++; \ - continue; \ - } \ - CLEAR_ERRNO; \ - __cnt = read(fd, (buf)+__ooffs+__offs, (cnt)-__offs); \ - DEBUGBUFFER(buf); \ - if (__cnt > 0) { \ - __offs += __cnt; \ - } \ - break; \ - } \ - if (__offs > 0) \ - (ret) = __offs; \ + int fd = fileno(f); \ + \ + while (__offs < (cnt)) { \ + OBJ rA = __INST(readAhead); \ + if (rA != nil) { \ + (buf)[__ooffs+__offs] = __intVal(rA); \ + DEBUGBUFFER(buf); \ + __INST(readAhead) = nil; \ + __offs++; \ + continue; \ + } \ + CLEAR_ERRNO; \ + __cnt = read(fd, (buf)+__ooffs+__offs, (cnt)-__offs); \ + DEBUGBUFFER(buf); \ + if (__cnt > 0) { \ + __offs += __cnt; \ + } \ + break; \ + } \ + if (__offs > 0) \ + (ret) = __offs; \ } \ SETFLAGS(fileno(f), oldFlags); \ } @@ -1182,40 +1182,40 @@ # ifdef NO_STDIO # define __WRITEBYTE__(ret, f, buf, isBuffered, handleType) \ - for (;;) { \ - CLEAR_ERRNO; \ - (ret) = WRITE(f, buf, 1, handleType); \ - if ((ret) >= 0 || __threadErrno != EINTR) \ - break; \ - __HANDLE_INTERRUPTS__; \ - } + for (;;) { \ + CLEAR_ERRNO; \ + (ret) = WRITE(f, buf, 1, handleType); \ + if ((ret) >= 0 || __threadErrno != EINTR) \ + break; \ + __HANDLE_INTERRUPTS__; \ + } # else /* use STDIO */ # define __WRITEBYTE__(ret, f, buf, isBuffered, handleType) \ if (isBuffered) { \ - for (;;) { \ - CLEAR_ERRNO; \ - ret = putc(*(buf), f); \ - if ((ret) >= 0) { \ - (ret) = 1; \ - } else if (ferror(f)) { \ - /* SOLARIS/SPARC (2.6) generates spurious errors with errno = 0 */ \ - if (__threadErrno == EINTR || __threadErrno == 0) { \ - __HANDLE_INTERRUPTS__; \ - clearerr(f); \ - continue; \ - } \ - } else \ - (ret) = 0; \ - break; \ - } \ + for (;;) { \ + CLEAR_ERRNO; \ + ret = putc(*(buf), f); \ + if ((ret) >= 0) { \ + (ret) = 1; \ + } else if (ferror(f)) { \ + /* SOLARIS/SPARC (2.6) generates spurious errors with errno = 0 */ \ + if (__threadErrno == EINTR || __threadErrno == 0) { \ + __HANDLE_INTERRUPTS__; \ + clearerr(f); \ + continue; \ + } \ + } else \ + (ret) = 0; \ + break; \ + } \ } else { \ - for (;;) { \ - CLEAR_ERRNO; \ - (ret) = write(fileno(f), buf, 1); \ - if ((ret) >= 0 || __threadErrno != EINTR) \ - break; \ - __HANDLE_INTERRUPTS__; \ - } \ + for (;;) { \ + CLEAR_ERRNO; \ + (ret) = write(fileno(f), buf, 1); \ + if ((ret) >= 0 || __threadErrno != EINTR) \ + break; \ + __HANDLE_INTERRUPTS__; \ + } \ } # endif /* use STDIO */ @@ -1227,62 +1227,62 @@ # define __WRITEBYTES__(ret, f, buf, cnt, isBuffered, handleType) \ (ret) = 0; \ { \ - int __offs = 0; \ - while (__offs < (cnt)) { \ - CLEAR_ERRNO; \ - ret = WRITE(f, (buf)+__offs, (cnt)-__offs, handleType); \ - if (ret <= 0) { \ - if (ret < 0 && __threadErrno == EINTR) { \ - __HANDLE_INTERRUPTS__; \ - continue; \ - } \ - break; \ - } \ - __offs += (ret); \ - } \ - if (__offs > 0) \ - (ret) = __offs; \ + int __offs = 0; \ + while (__offs < (cnt)) { \ + CLEAR_ERRNO; \ + ret = WRITE(f, (buf)+__offs, (cnt)-__offs, handleType); \ + if (ret <= 0) { \ + if (ret < 0 && __threadErrno == EINTR) { \ + __HANDLE_INTERRUPTS__; \ + continue; \ + } \ + break; \ + } \ + __offs += (ret); \ + } \ + if (__offs > 0) \ + (ret) = __offs; \ } # else /* use STDIO */ # define __WRITEBYTES__(ret, f, buf, cnt, isBuffered, handleType) \ (ret) = 0; \ if (isBuffered) { \ - int __offs = 0; \ - while (__offs < (cnt)) { \ - CLEAR_ERRNO; \ - ret = fwrite((buf)+__offs, 1, (cnt)-__offs, f);\ - if ((ret) <= 0) { \ - if (ferror(f)) { \ - if (__threadErrno == EINTR) { \ - __HANDLE_INTERRUPTS__; \ - clearerr(f); \ - continue; \ - } \ - break; \ - } else { \ - (ret) = 0; \ - } \ - } \ - __offs += (ret); \ - } \ - if (__offs > 0) \ - (ret) = __offs; \ + int __offs = 0; \ + while (__offs < (cnt)) { \ + CLEAR_ERRNO; \ + ret = fwrite((buf)+__offs, 1, (cnt)-__offs, f);\ + if ((ret) <= 0) { \ + if (ferror(f)) { \ + if (__threadErrno == EINTR) { \ + __HANDLE_INTERRUPTS__; \ + clearerr(f); \ + continue; \ + } \ + break; \ + } else { \ + (ret) = 0; \ + } \ + } \ + __offs += (ret); \ + } \ + if (__offs > 0) \ + (ret) = __offs; \ } else { \ - int __offs = 0; \ - while (__offs < (cnt)) { \ - CLEAR_ERRNO; \ - ret = write(fileno(f), (buf)+__offs, (cnt)-__offs);\ - if (ret <= 0) { \ - if (ret < 0 && __threadErrno == EINTR) { \ - __HANDLE_INTERRUPTS__; \ - continue; \ - } \ - break; \ - } \ - __offs += (ret); \ - } \ - if (__offs > 0) \ - (ret) = __offs; \ + int __offs = 0; \ + while (__offs < (cnt)) { \ + CLEAR_ERRNO; \ + ret = write(fileno(f), (buf)+__offs, (cnt)-__offs);\ + if (ret <= 0) { \ + if (ret < 0 && __threadErrno == EINTR) { \ + __HANDLE_INTERRUPTS__; \ + continue; \ + } \ + break; \ + } \ + __offs += (ret); \ + } \ + if (__offs > 0) \ + (ret) = __offs; \ } # endif /* use STDIO */ @@ -1296,25 +1296,25 @@ int __ooffs = obj_offs; \ int __offs = 0; \ char *buf = (char *)(obj); \ - \ + \ (ret) = 0; \ { \ - while (__offs < (cnt)) { \ - CLEAR_ERRNO; \ - ret = WRITE(f, (buf)+__ooffs+__offs, (cnt)-__offs, handleType); \ - if (ret <= 0) { \ - if (ret < 0 && __threadErrno == EINTR) { \ - __HANDLE_INTERRUPTS__; \ - /* refetch */ \ - buf = (char *)(obj); \ - continue; \ - } \ - break; \ - } \ - __offs += (ret); \ - } \ - if (__offs > 0) \ - (ret) = __offs; \ + while (__offs < (cnt)) { \ + CLEAR_ERRNO; \ + ret = WRITE(f, (buf)+__ooffs+__offs, (cnt)-__offs, handleType); \ + if (ret <= 0) { \ + if (ret < 0 && __threadErrno == EINTR) { \ + __HANDLE_INTERRUPTS__; \ + /* refetch */ \ + buf = (char *)(obj); \ + continue; \ + } \ + break; \ + } \ + __offs += (ret); \ + } \ + if (__offs > 0) \ + (ret) = __offs; \ } \ } # else /* use STDIO */ @@ -1323,47 +1323,47 @@ int __ooffs = obj_offs; \ int __offs = 0; \ char *buf = (char *)(obj); \ - \ + \ (ret) = 0; \ if (isBuffered) { \ - while (__offs < (cnt)) { \ - CLEAR_ERRNO; \ - ret = fwrite((buf)+__ooffs+__offs, 1, (cnt)-__offs, f); \ - if ((ret) <= 0) { \ - if (ferror(f)) { \ - if (__threadErrno == EINTR) { \ - __HANDLE_INTERRUPTS__; \ - /* refetch */ \ - buf = (char *)(obj); \ - clearerr(f); \ - continue; \ - } \ - break; \ - } else { \ - (ret) = 0; \ - } \ - } \ - __offs += (ret); \ - } \ - if (__offs > 0) \ - (ret) = __offs; \ + while (__offs < (cnt)) { \ + CLEAR_ERRNO; \ + ret = fwrite((buf)+__ooffs+__offs, 1, (cnt)-__offs, f); \ + if ((ret) <= 0) { \ + if (ferror(f)) { \ + if (__threadErrno == EINTR) { \ + __HANDLE_INTERRUPTS__; \ + /* refetch */ \ + buf = (char *)(obj); \ + clearerr(f); \ + continue; \ + } \ + break; \ + } else { \ + (ret) = 0; \ + } \ + } \ + __offs += (ret); \ + } \ + if (__offs > 0) \ + (ret) = __offs; \ } else { \ - while (__offs < (cnt)) { \ - CLEAR_ERRNO; \ - ret = write(fileno(f), (buf)+__ooffs+__offs, (cnt)-__offs); \ - if (ret <= 0) { \ - if (ret < 0 && __threadErrno == EINTR){ \ - __HANDLE_INTERRUPTS__; \ - /* refetch */ \ - buf = (char *)(obj); \ - continue; \ - } \ - break; \ - } \ - __offs += (ret); \ - } \ - if (__offs > 0) \ - (ret) = __offs; \ + while (__offs < (cnt)) { \ + CLEAR_ERRNO; \ + ret = write(fileno(f), (buf)+__ooffs+__offs, (cnt)-__offs); \ + if (ret <= 0) { \ + if (ret < 0 && __threadErrno == EINTR){ \ + __HANDLE_INTERRUPTS__; \ + /* refetch */ \ + buf = (char *)(obj); \ + continue; \ + } \ + break; \ + } \ + __offs += (ret); \ + } \ + if (__offs > 0) \ + (ret) = __offs; \ } \ } # endif /* use STDIO */ @@ -3029,29 +3029,29 @@ || (__INST(handleType) == @symbol(filePointer)) || (__INST(handleType) == @symbol(socketFilePointer)) || (__INST(handleType) == @symbol(pipeFilePointer))) { - if ((fp = __INST(handle)) != nil) { - f = __FILEVal(fp); + if ((fp = __INST(handle)) != nil) { + f = __FILEVal(fp); #ifdef WIN32 - __threadErrno = 0; - ret = __STX_API_NOINT_CALL1( "FlushFileBuffers", FlushFileBuffers, _get_osfhandle(fileno(f))); - if (ret) { - RETURN (self); - } + __threadErrno = 0; + ret = __STX_API_NOINT_CALL1( "FlushFileBuffers", FlushFileBuffers, _get_osfhandle(fileno(f))); + if (ret) { + RETURN (self); + } #else - __BEGIN_INTERRUPTABLE__ - do { - __threadErrno = 0; - ret = fsync(fileno(f)); - } while ((ret < 0) && (__threadErrno == EINTR)); - __END_INTERRUPTABLE__ - - if (ret >= 0) { - RETURN (self); - } + __BEGIN_INTERRUPTABLE__ + do { + __threadErrno = 0; + ret = fsync(fileno(f)); + } while ((ret < 0) && (__threadErrno == EINTR)); + __END_INTERRUPTABLE__ + + if (ret >= 0) { + RETURN (self); + } #endif /* ! WIN32 */ - __INST(lastErrorNumber) = __mkSmallInteger(__threadErrno); - } + __INST(lastErrorNumber) = __mkSmallInteger(__threadErrno); + } } #endif /* ! __openVMS__ */ %}. @@ -3059,9 +3059,9 @@ handle isNil ifTrue:[^ self errorNotOpen]. " - |f| - f := 'x' asFilename writeStream. - f nextPutAll:'hallo'; sync; syncData; close + |f| + f := 'x' asFilename writeStream. + f nextPutAll:'hallo'; sync; syncData; close " ! @@ -3082,32 +3082,32 @@ || (__INST(handleType) == @symbol(filePointer)) || (__INST(handleType) == @symbol(socketFilePointer)) || (__INST(handleType) == @symbol(pipeFilePointer))) { - OBJ fp; - FILEPOINTER f; - - if ((fp = __INST(handle)) != nil) { - f = __FILEVal(fp); + OBJ fp; + FILEPOINTER f; + + if ((fp = __INST(handle)) != nil) { + f = __FILEVal(fp); #ifdef WIN32 - __threadErrno = 0; - ret = __STX_API_NOINT_CALL1( "FlushFileBuffers", FlushFileBuffers, _get_osfhandle(fileno(f))); - if (ret) { - RETURN (self); - } + __threadErrno = 0; + ret = __STX_API_NOINT_CALL1( "FlushFileBuffers", FlushFileBuffers, _get_osfhandle(fileno(f))); + if (ret) { + RETURN (self); + } #else - __BEGIN_INTERRUPTABLE__ - do { - __threadErrno = 0; - ret = fdatasync(fileno(f)); - } while ((ret < 0) && (__threadErrno == EINTR)); - __END_INTERRUPTABLE__ - - if (ret >= 0) { - RETURN (self); - } + __BEGIN_INTERRUPTABLE__ + do { + __threadErrno = 0; + ret = fdatasync(fileno(f)); + } while ((ret < 0) && (__threadErrno == EINTR)); + __END_INTERRUPTABLE__ + + if (ret >= 0) { + RETURN (self); + } #endif /* ! WIN32 */ - __INST(lastErrorNumber) = __mkSmallInteger(__threadErrno); - } + __INST(lastErrorNumber) = __mkSmallInteger(__threadErrno); + } } #endif /* ! __openVMS__ */ %}. @@ -3118,9 +3118,9 @@ self sync. " - |f| - f := 'x' asFilename writeStream. - f nextPutAll:'hallo'; sync; syncData; close + |f| + f := 'x' asFilename writeStream. + f nextPutAll:'hallo'; sync; syncData; close " ! @@ -3302,94 +3302,94 @@ || (__INST(handleType) == @symbol(filePointer)) || (__INST(handleType) == @symbol(socketFilePointer)) || (__INST(handleType) == @symbol(pipeFilePointer))) { - if (((fp = __INST(handle)) != nil) - && (__INST(mode) != @symbol(writeonly)) - && __bothSmallInteger(count, start) - ) { - f = __FILEVal(fp); - - cnt = __intVal(count); - offs = __intVal(start) - 1; - - 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; - - oClass = __Class(anObject); - switch (__intVal(__ClassInstPtr(oClass)->c_flags) & ARRAYMASK) { - case BYTEARRAY: - case WORDARRAY: - case LONGARRAY: - case SWORDARRAY: - case SLONGARRAY: - case FLOATARRAY: - case DOUBLEARRAY: - break; - default: - goto bad; - } - extPtr = (char *)0; - nInstVars = __intVal(__ClassInstPtr(oClass)->c_ninstvars); - nInstBytes = OHDR_SIZE + __OBJS2BYTES__(nInstVars); - objSize = __Size(anObject) - nInstBytes; - } - - if ((offs >= 0) && (cnt >= 0) && (objSize >= (cnt + offs))) { - _buffered = (__INST(buffered) == true); - if (_buffered) { - __READING__(f); - } - - if (extPtr) { - __READAVAILBYTES__(ret, f, extPtr+offs, cnt, _buffered, __INST(handleType)); - } else { - /* - * on interrupt, anObject may be moved to another location. - * So we pass (char *)__InstPtr(anObject) + nInstBytes + offs to the macro __READ_BYTES__, - * to get a new address. - */ - offs += nInstBytes; - __READAVAILBYTES_OBJ__(ret, f, anObject, offs, cnt, _buffered, __INST(handleType)); - } + if (((fp = __INST(handle)) != nil) + && (__INST(mode) != @symbol(writeonly)) + && __bothSmallInteger(count, start) + ) { + f = __FILEVal(fp); + + cnt = __intVal(count); + offs = __intVal(start) - 1; + + 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; + + oClass = __Class(anObject); + switch (__intVal(__ClassInstPtr(oClass)->c_flags) & ARRAYMASK) { + case BYTEARRAY: + case WORDARRAY: + case LONGARRAY: + case SWORDARRAY: + case SLONGARRAY: + case FLOATARRAY: + case DOUBLEARRAY: + break; + default: + goto bad; + } + extPtr = (char *)0; + nInstVars = __intVal(__ClassInstPtr(oClass)->c_ninstvars); + nInstBytes = OHDR_SIZE + __OBJS2BYTES__(nInstVars); + objSize = __Size(anObject) - nInstBytes; + } + + if ((offs >= 0) && (cnt >= 0) && (objSize >= (cnt + offs))) { + _buffered = (__INST(buffered) == true); + if (_buffered) { + __READING__(f); + } + + if (extPtr) { + __READAVAILBYTES__(ret, f, extPtr+offs, cnt, _buffered, __INST(handleType)); + } else { + /* + * on interrupt, anObject may be moved to another location. + * So we pass (char *)__InstPtr(anObject) + nInstBytes + offs to the macro __READ_BYTES__, + * to get a new address. + */ + offs += nInstBytes; + __READAVAILBYTES_OBJ__(ret, f, anObject, offs, cnt, _buffered, __INST(handleType)); + } #ifdef PRE_22_jan_2000 - if (ret > 0) + if (ret > 0) #else - /* 0 is NOT an EOF condition here ... */ - if (ret >= 0) + /* 0 is NOT an EOF condition here ... */ + if (ret >= 0) #endif - { - if (__isSmallInteger(__INST(position))) { - INT np = __intVal(__INST(position)) + ret; - OBJ t; - - t = __MKINT(np); __INST(position) = t; __STORE(self, t); - } else { - __INST(position) = nil; /* i.e. do not know */ - } - RETURN (__mkSmallInteger(ret)); - } + { + if (__isSmallInteger(__INST(position))) { + INT np = __intVal(__INST(position)) + ret; + OBJ t; + + t = __MKINT(np); __INST(position) = t; __STORE(self, t); + } else { + __INST(position) = nil; /* i.e. do not know */ + } + RETURN (__mkSmallInteger(ret)); + } #ifdef PRE_22_jan_2000 - if (ret == 0) { - __INST(hitEOF) = true; - } else /* ret < 0 */ + if (ret == 0) { + __INST(hitEOF) = true; + } else /* ret < 0 */ #endif - { - __INST(position) = nil; - __INST(lastErrorNumber) = __mkSmallInteger(__threadErrno); - } - } - } + { + __INST(position) = nil; + __INST(lastErrorNumber) = __mkSmallInteger(__threadErrno); + } + } + } } bad: ; %}. @@ -4309,7 +4309,7 @@ f = __FILEVal(fp); if (@global(FileOpenTrace) == true) { - fprintf(stderr, "fclose [ExternalStream] %x\n", f); + fprintf(stderr, "fclose [ExternalStream] %"_lx_"\n", (INT)f); } #ifdef WIN32 if (__INST(mode) != @symbol(readonly)) { @@ -4381,59 +4381,59 @@ if (__isStringLike(openmode)) { #ifdef WIN32 - __stxWrapApiEnterCritical(); + __stxWrapApiEnterCritical(); #endif - if (__isSmallInteger(aFileDescriptor)) { - fd = __intVal(aFileDescriptor); - } + if (__isSmallInteger(aFileDescriptor)) { + fd = __intVal(aFileDescriptor); + } #ifdef WIN32 - else if (__isExternalAddressLike(aFileDescriptor)) { - fd = _open_osfhandle((long)__externalAddressVal(aFileDescriptor), O_BINARY); - if (fd < 0) { - if (__threadErrno == 0) { - // no more file descriptors - __threadErrno = EMFILE; - } - error = __mkSmallInteger(__threadErrno); - __stxWrapApiLeaveCritical(); - goto out; - } - } + else if (__isExternalAddressLike(aFileDescriptor)) { + fd = _open_osfhandle((long)__externalAddressVal(aFileDescriptor), O_BINARY); + if (fd < 0) { + if (__threadErrno == 0) { + // no more file descriptors + __threadErrno = EMFILE; + } + error = __mkSmallInteger(__threadErrno); + __stxWrapApiLeaveCritical(); + goto out; + } + } #endif - f = (FILEPOINTER) fdopen(fd, (char *)__stringVal(openmode)); + f = (FILEPOINTER) fdopen(fd, (char *)__stringVal(openmode)); #ifdef WIN32 - __stxWrapApiLeaveCritical(); + __stxWrapApiLeaveCritical(); #endif - if (f == NULL) { - error =__mkSmallInteger(__threadErrno); - } else { - if (@global(FileOpenTrace) == true) { - fprintf(stderr, "fdopen [ExternalStream] %d (%x) -> %x\n", fd, fd, f); - } - - fp = __MKFILEPOINTER(f); __INST(handle) = fp; __STORE(self, fp); - retVal = self; - } + if (f == NULL) { + error =__mkSmallInteger(__threadErrno); + } else { + if (@global(FileOpenTrace) == true) { + fprintf(stderr, "fdopen [ExternalStream] %d (%"_lx_") -> %x\n", fd, fd, (INT)f); + } + + fp = __MKFILEPOINTER(f); __INST(handle) = fp; __STORE(self, fp); + retVal = self; + } } out:; %}. retVal notNil ifTrue:[ - position := 0. - buffered isNil ifTrue:[ - buffered := true. "default is buffered" - ]. - handleType := handleTypeSymbol. - Lobby register:self. - ^ retVal + position := 0. + buffered isNil ifTrue:[ + buffered := true. "default is buffered" + ]. + handleType := handleTypeSymbol. + Lobby register:self. + ^ retVal ]. error notNil ifTrue:[ - OperatingSystem closeFd:aFileDescriptor. - lastErrorNumber := error. - position := nil. - " - the open failed for some reason ... - " - ^ self openError:error + OperatingSystem closeFd:aFileDescriptor. + lastErrorNumber := error. + position := nil. + " + the open failed for some reason ... + " + ^ self openError:error ]. ! @@ -4482,36 +4482,36 @@ # if 1 f = fopen((char *) __stringVal(aPath), (char *) __stringVal(openModeString)); # else - __BEGIN_INTERRUPTABLE__ - do { - f = fopen((char *) __stringVal(aPath), (char *) __stringVal(openModeString)); - } while ((f == NULL) && (__threadErrno == EINTR)); - __END_INTERRUPTABLE__ + __BEGIN_INTERRUPTABLE__ + do { + f = fopen((char *) __stringVal(aPath), (char *) __stringVal(openModeString)); + } while ((f == NULL) && (__threadErrno == EINTR)); + __END_INTERRUPTABLE__ # endif #else /* UNIX */ - __BEGIN_INTERRUPTABLE__ - do { - f = fopen((char *) __stringVal(aPath), (char *) __stringVal(openModeString)); - } while ((f == NULL) && (__threadErrno == EINTR)); - __END_INTERRUPTABLE__ + __BEGIN_INTERRUPTABLE__ + do { + f = fopen((char *) __stringVal(aPath), (char *) __stringVal(openModeString)); + } while ((f == NULL) && (__threadErrno == EINTR)); + __END_INTERRUPTABLE__ #endif /* UNIX */ - if (f == NULL) { - __INST(lastErrorNumber) = __mkSmallInteger(__threadErrno); - } else { - if (@global(FileOpenTrace) == true) { - fprintf(stderr, "fopen %s [ExternalStream] -> %x\n", __stringVal(aPath), f); - } - fp = __MKFILEPOINTER(f); __INST(handle) = fp; __STORE(self, fp); - __INST(handleType) = @symbol(filePointer); - ok = true; - } + if (f == NULL) { + __INST(lastErrorNumber) = __mkSmallInteger(__threadErrno); + } else { + if (@global(FileOpenTrace) == true) { + fprintf(stderr, "fopen %s [ExternalStream] -> %"_lx_"\n", __stringVal(aPath), (INT)f); + } + fp = __MKFILEPOINTER(f); __INST(handle) = fp; __STORE(self, fp); + __INST(handleType) = @symbol(filePointer); + ok = true; + } } %}. ok ifFalse:[ - " - the open failed for some reason ... - " - ^ self openError:lastErrorNumber. + " + the open failed for some reason ... + " + ^ self openError:lastErrorNumber. ]. position := 0. Lobby register:self. @@ -4595,7 +4595,7 @@ #endif if (f != NULL) { if (@global(FileOpenTrace) == true) { - fprintf(stderr, "fdopen [ExternalStream] %d -> %x\n", fd, f); + fprintf(stderr, "fdopen [ExternalStream] %d -> %"_lx_"\n", fd, (INT)f); } fp = __MKFILEPOINTER(f); __INST(handle) = fp; __STORE(self, fp); __INST(handleType) = @symbol(filePointer); @@ -5745,11 +5745,11 @@ This is needed, so that you can do ('something' asUnicode16String errorPrintCR)" aString do:[:eachCharacter| - self nextPutUtf8:eachCharacter. + self nextPutUtf8:eachCharacter. ]. " - 'Bönnigheim' asUnicode16String errorPrintCR + 'Bönnigheim' asUnicode16String errorPrintCR " ! @@ -5762,11 +5762,11 @@ !ExternalStream class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.364 2013-06-03 18:41:42 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.365 2013-06-26 11:04:06 cg Exp $' ! version_CVS - ^ '$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.364 2013-06-03 18:41:42 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.365 2013-06-26 11:04:06 cg Exp $' ! !
--- a/LinkedList.st Fri Jun 28 11:29:14 2013 +0100 +++ b/LinkedList.st Mon Jul 01 22:14:20 2013 +0100 @@ -421,6 +421,12 @@ ^ firstLink isNil ! +isFixedSize + "return true if the receiver cannot grow" + + ^ false +! + notEmpty "return true, if the collection is not empty" @@ -430,9 +436,10 @@ !LinkedList class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libbasic/LinkedList.st,v 1.41 2011-09-27 09:42:48 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/LinkedList.st,v 1.42 2013-06-25 11:23:45 cg Exp $' ! version_CVS - ^ '$Header: /cvs/stx/stx/libbasic/LinkedList.st,v 1.41 2011-09-27 09:42:48 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/LinkedList.st,v 1.42 2013-06-25 11:23:45 cg Exp $' ! ! +
--- a/Method.st Fri Jun 28 11:29:14 2013 +0100 +++ b/Method.st Mon Jul 01 22:14:20 2013 +0100 @@ -1910,151 +1910,6 @@ "Modified: / 22-10-2010 / 12:07:25 / cg" ! -printStringForBrowserWithSelector:selector inClass:aClass - "return a printString to represent myself to the user in a browser. - Defined here to allow for browsers to deal with nonStandard pseudoMethods" - - |s privInfo moreInfo p info n cls ns currentChangeSet isInChangeSet mthdPackage - userPreferences shownSelector suppressPackage timeRounded shadowsOrNot - overAllCount counts| - - moreInfo := ''. - privInfo := ''. - userPreferences := UserPreferences current. - - ns := self nameSpace. - (ns notNil and:[ns isNameSpace]) ifTrue:[ - moreInfo := moreInfo , - ((' < %1 >' bindWith: ns name) asText emphasisAllAdd: - userPreferences emphasisForNamespacedCode) - - ]. - - self isWrapped ifTrue:[ - (MessageTracer isCounting:self) ifTrue:[ - (MessageTracer isCountingByReceiverClass:self) ifTrue:[ - overAllCount := (MessageTracer executionCountOfMethod:self). - moreInfo := moreInfo , (' (cnt: %1' bindWith:overAllCount printString allBold). - overAllCount ~~ 0 ifTrue:[ - counts := MessageTracer executionCountsByReceiverClassOfMethod:self. - (counts keysSorted:[:a :b | (counts at:a) < (counts at:b)]) reverseDo:[:cls | - |cnt clsName percentage| - - clsName := cls name. - cnt := counts at:cls. - percentage := ((cnt / overAllCount) * 100) rounded. - moreInfo := moreInfo , ('; %1->%2%%' bindWith:clsName with:percentage). - ]. - ]. - moreInfo := moreInfo , ')'. - ] ifFalse:[ - (MessageTracer isCountingMemoryUsage:self) ifTrue:[ - moreInfo := moreInfo , (' (mem: %1 bytes avg)' bindWith:(MessageTracer memoryUsageOfMethod:self) printString allBold). - ] ifFalse:[ - moreInfo := moreInfo , (' (cnt: %1)' bindWith:(MessageTracer executionCountOfMethod:self) printString allBold). - ] - ]. - ] ifFalse:[ - (MessageTracer isTiming:self) ifTrue:[ - info := MessageTracer executionTimesOfMethod:self. - ((n := info count) == 0) ifTrue:[ - moreInfo := moreInfo , (' (cnt: %1)' bindWith:n) - ] ifFalse:[ - timeRounded := [:millis | - |rnd| - rnd := (millis > 100) - ifTrue:[ 1 ] - ifFalse:[ - (millis > 10) - ifTrue:[ 0.1 ] - ifFalse:[ - (millis > 1) - ifTrue:[ 0.01 ] - ifFalse:[ 0.001 ]]]. - millis roundTo:rnd - ]. - - (n == 1 or:[ info avgTimeRounded = info minTimeRounded ]) ifTrue:[ - moreInfo := moreInfo , - (' (t: %1ms cnt: %2)' - bindWith:((timeRounded value:info avgTimeRounded) printString allBold) - with:n) - ] ifFalse:[ - moreInfo := moreInfo , - (' (avg: %1ms min: %2 max: %3 cnt: %4)' - bindWith:((timeRounded value:info avgTimeRounded) printString allBold) - with:((timeRounded value:info minTimeRounded) printString) - with:((timeRounded value:info maxTimeRounded) printString) - with:n) - ]. - ]. - ] ifFalse:[ - moreInfo := ' !!' - ] - ]. - ]. - p := self privacy. - - p ~~ #public ifTrue:[ - privInfo := (' (* ' , p , ' *)') allItalic. - ]. - -"/ self isInvalid ifTrue:[ -"/ moreInfo := ' (** not executable **)'. -"/ ]. - - (self isLazyMethod not and:[self isUnloaded]) ifTrue:[ - moreInfo := ' (** unloaded **)' - ]. - - privInfo size ~~ 0 ifTrue:[ - moreInfo := privInfo , ' ' , moreInfo - ]. - - s := shownSelector := (self selectorPrintStringInBrowserFor:selector class:aClass). - - (cls := aClass) isNil ifTrue:[ - cls := self containingClass - ]. - - currentChangeSet := ChangeSet current. - isInChangeSet := currentChangeSet includesChangeForClass:cls selector:selector. - - isInChangeSet ifTrue:[ - s := s asText emphasisAllAdd:(userPreferences emphasisForChangedCode) - ]. - - (cls isNil or:[(mthdPackage := self package) ~= cls package]) ifTrue:[ - suppressPackage := false. - mthdPackage = PackageId noProjectID ifTrue:[ - mthdPackage := '+'. - "/ suppressPackage := true - ]. - suppressPackage ifFalse:[ - shadowsOrNot := (self isShadowingExtension) - ifTrue:[' shadowed' ] - ifFalse:[ '' ]. - p := ' [' , ((mthdPackage ? '?'), shadowsOrNot allBold) allItalic , '] '. - p := p asText emphasisAllAdd:(userPreferences emphasisForDifferentPackage). - s := s , ' ' , p - ]. - ]. - - moreInfo size == 0 ifTrue:[^ s]. - - s := shownSelector , moreInfo. - - self isInvalid ifTrue:[ - s := s asText emphasizeAllWith:(userPreferences emphasisForObsoleteCode). - ]. - ^ s - - "Modified: / 23-01-1998 / 13:15:15 / stefan" - "Created: / 05-02-2000 / 22:55:56 / cg" - "Modified: / 05-03-2007 / 16:18:53 / cg" - "Modified: / 20-07-2010 / 15:39:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" -! - whoString "return a string as className>>selector, if this is not an unbound method. Otherwise return 'unbound'. Used with debugging." @@ -2833,8 +2688,9 @@ myClass := myClass theNonMetaclass. ^ myClass notNil and:[ package ~= myClass package + and:[ package ~= PackageId noProjectID and:[ (myProjectDefinition := myClass projectDefinitionClass) notNil - and:[ (myProjectDefinition savedOverwrittenMethodForClass:self mclass selector:self selector) notNil ]]] + and:[ (myProjectDefinition savedOverwrittenMethodForClass:self mclass selector:self selector) notNil ]]]] ! isSynthetic @@ -3086,6 +2942,13 @@ "Modified: 4.11.1996 / 22:28:17 / cg" ! +modifiedInstVars + "returns a collection of instance variables which are modified by this method. + Uses parser (for now); could look at bytecode as well here..." + + ^ self parse:#'parseMethodSilent:in:' with:self mclass return:#modifiedInstVars or:#(). +! + name "for compatibility with javaMethods" @@ -3163,10 +3026,12 @@ parser := parserClass perform:parseSelector with:sourceString. ]. (parser isNil or:[parser == #Error]) ifTrue:[^ valueIfNoSource]. - LastParseTreeCache isNil ifTrue:[ - LastParseTreeCache := CacheDictionary new:500. + self mclass notNil ifTrue:[ + LastParseTreeCache isNil ifTrue:[ + LastParseTreeCache := CacheDictionary new:500. + ]. + LastParseTreeCache at:self put:(ParserCacheEntry new parserClass:parserClass method:self parser:parser). ]. - LastParseTreeCache at:self put:(ParserCacheEntry new parserClass:parserClass method:self parser:parser). ^ parser perform:accessSelector ]. ^ valueIfNoSource @@ -3980,11 +3845,11 @@ !Method class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.417 2013-06-20 23:00:55 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.420 2013-06-29 11:28:21 cg Exp $' ! version_CVS - ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.417 2013-06-20 23:00:55 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.420 2013-06-29 11:28:21 cg Exp $' ! version_HG
--- a/Object.st Fri Jun 28 11:29:14 2013 +0100 +++ b/Object.st Mon Jul 01 22:14:20 2013 +0100 @@ -1547,7 +1547,7 @@ |idx| - idx := self class instVarOffsetOf:name. + idx := self class instVarIndexFor:name. idx isNil ifTrue:[ ^ self errorKeyNotFound:name. ]. @@ -1574,7 +1574,7 @@ |idx| - idx := self class instVarOffsetOf:name. + idx := self class instVarIndexFor:name. idx isNil ifTrue:[^ exceptionBlock value]. ^ self instVarAt:idx @@ -1599,7 +1599,7 @@ |idx| - idx := self class instVarOffsetOf:name. + idx := self class instVarIndexFor:name. idx isNil ifTrue:[ ^ self errorKeyNotFound:name. ]. @@ -1626,7 +1626,7 @@ |idx| - idx := self class instVarOffsetOf:name. + idx := self class instVarIndexFor:name. idx isNil ifTrue:[^ exceptionBlock value]. ^ self instVarAt:idx put:anObject. @@ -9103,8 +9103,8 @@ ! isRealNameSpace - "return true, if the receiver is really a nameSpace (i.e. a NameSpace, but not Smalltalk). - False is returned here - the method is only redefined in Namespace." + "return true, if the receiver is a nameSpace, but not Smalltalk (which is also a class). + False is returned here - the method is redefined in Namespace and Smalltalk." ^ false @@ -9675,11 +9675,11 @@ !Object class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libbasic/Object.st,v 1.726 2013-06-19 06:43:15 stefan Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/Object.st,v 1.728 2013-06-30 07:40:12 cg Exp $' ! version_CVS - ^ '$Header: /cvs/stx/stx/libbasic/Object.st,v 1.726 2013-06-19 06:43:15 stefan Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/Object.st,v 1.728 2013-06-30 07:40:12 cg Exp $' ! version_SVN
--- a/ObjectMemory.st Fri Jun 28 11:29:14 2013 +0100 +++ b/ObjectMemory.st Mon Jul 01 22:14:20 2013 +0100 @@ -1288,29 +1288,29 @@ lbl origin:(0.0@0.0) corner:(1.0@0.0). h := lbl preferredHeight. lbl - topInset:5; - bottomInset:(h+5) negated; - leftInset:5; - rightInset:5. + topInset:5; + bottomInset:(h+5) negated; + leftInset:5; + rightInset:5. progress := ProgressIndicator in:top. progress origin:(0.0@45) corner:(1.0@45). progress level:-1. h := progress preferredHeight. progress - topInset:(h // 2) negated; - bottomInset:(h // 2) negated; - leftInset:5; - rightInset:5. + topInset:(h // 2) negated; + bottomInset:(h // 2) negated; + leftInset:5; + rightInset:5. progress beInvisible. listV := HVScrollableView for:SelectionInListView in:top. listV origin:(0.0@55) corner:(1.0@1.0). listV - topInset:(h // 2); - bottomInset:40; - leftInset:5; - rightInset:5. + topInset:(h // 2); + bottomInset:40; + leftInset:5; + rightInset:5. listV beInvisible. panel := HorizontalPanelView in:top. @@ -1349,247 +1349,247 @@ firstRound := true. [done] whileFalse:[ - anyShown := false. - - progress percentage:0. - firstRound ifTrue:[ - firstRound := false. - ] ifFalse:[ - lbl label:'compressing garbage ...'. - self garbageCollect. - ]. - - lbl label:('searching level ' - , levels size printString - , ' (' , objects size printString , ' refs) ...'). - nAll := objects size. - nDone := 0. - - objectArray := objects asArray. - - owners := "Weak"IdentitySet new. - - numObjectsDone := 0. - found := false. - - AbortSignal handle:[] - do:[ - [self allObjectsIncludingContextsDo:[:o | - |inPrevLevel isOwner| - - stop ifTrue:[AbortSignal raise]. - stop ifFalse:[ - isOwner := false. - (o referencesAny:objectArray) ifTrue:[ - o isBehavior ifTrue:[ - o == Smalltalk ifTrue:[ - found := true. - ] ifFalse:[ - "/ only add it if it has classInstVars - o instSize ~~ Class instSize ifTrue:[ - isOwner := true. - ] - ] - ] ifFalse:[ - o class ~~ WeakArray ifTrue:[ - isOwner := true. - ] - ]. - ]. - - isOwner ifTrue:[ - (objects includesIdentical:o) ifFalse:[ - inPrevLevel := false. - levels do:[:lColl | - lColl == o ifTrue:[ - inPrevLevel := true - ] ifFalse:[ - (lColl includesIdentical:o) ifTrue:[inPrevLevel := true]. - ] - ]. - inPrevLevel ifFalse:[ - owners add:o. - (limitOrNil notNil and:[owners size >= limitOrNil]) ifTrue:[ - AbortSignal raise - ]. - ] - ] - ]. - - numObjectsDone := numObjectsDone + 1. - numObjects notNil ifTrue:[ - numObjectsDone \\ 1000 == 0 ifTrue:[ - progress percentage:(numObjectsDone / numObjects * 100). - Processor yield. - ] - ] - ] - ]] whileFalse. - ]. - progress percentage:100. - - numObjects isNil ifTrue:[ - numObjects := numObjectsDone. - ]. - - owners remove:aCollection ifAbsent:nil. - owners remove:thisContext ifAbsent:nil. - owners remove:objectArray ifAbsent:nil. - owners remove:objects keyArray ifAbsent:nil. - owners remove:owners keyArray ifAbsent:nil. + anyShown := false. + + progress percentage:0. + firstRound ifTrue:[ + firstRound := false. + ] ifFalse:[ + lbl label:'compressing garbage ...'. + self garbageCollect. + ]. + + lbl label:('searching level ' + , levels size printString + , ' (' , objects size printString , ' refs) ...'). + nAll := objects size. + nDone := 0. + + objectArray := objects asArray. + + owners := "Weak"IdentitySet new. + + numObjectsDone := 0. + found := false. + + AbortSignal handle:[] + do:[ + [self allObjectsIncludingContextsDo:[:o | + |inPrevLevel isOwner| + + stop ifTrue:[AbortSignal raise]. + stop ifFalse:[ + isOwner := false. + (o referencesAny:objectArray) ifTrue:[ + o isBehavior ifTrue:[ + o == Smalltalk ifTrue:[ + found := true. + ] ifFalse:[ + "/ only add it if it has classInstVars + o instSize ~~ Class instSize ifTrue:[ + isOwner := true. + ] + ] + ] ifFalse:[ + o class ~~ WeakArray ifTrue:[ + isOwner := true. + ] + ]. + ]. + + isOwner ifTrue:[ + (objects includesIdentical:o) ifFalse:[ + inPrevLevel := false. + levels do:[:lColl | + lColl == o ifTrue:[ + inPrevLevel := true + ] ifFalse:[ + (lColl includesIdentical:o) ifTrue:[inPrevLevel := true]. + ] + ]. + inPrevLevel ifFalse:[ + owners add:o. + (limitOrNil notNil and:[owners size >= limitOrNil]) ifTrue:[ + AbortSignal raise + ]. + ] + ] + ]. + + numObjectsDone := numObjectsDone + 1. + numObjects notNil ifTrue:[ + numObjectsDone \\ 1000 == 0 ifTrue:[ + progress percentage:(numObjectsDone / numObjects * 100). + Processor yield. + ] + ] + ] + ]] whileFalse. + ]. + progress percentage:100. + + numObjects isNil ifTrue:[ + numObjects := numObjectsDone. + ]. + + owners remove:aCollection ifAbsent:nil. + owners remove:thisContext ifAbsent:nil. + owners remove:objectArray ifAbsent:nil. + owners remove:objects keyArray ifAbsent:nil. + owners remove:owners keyArray ifAbsent:nil. "/ 'done with level: ' print. levels size print. ' found ' print. owners size print. ' refs' printCR. - owners isEmpty ifTrue:[ - found ifFalse:[ - stop := true. - ] - ]. - - stop ifFalse:[ - done := found or:[(owners includesIdentical:Smalltalk)]. - done ifTrue:[ - moreChainsOnThisLevel := true. - temporaryRemoved := IdentitySet new. - - levels size > 0 ifTrue:[ - "/ show what we found so far. - levels last add:Smalltalk. - levels reverse. - ]. - - chains := OrderedCollection new. - - tLevels := levels collect:[:lColl | lColl copy]. - - lbl label:('building refchains ...'). - - nAll := aCollection size. - nDone := 0. - aCollection do:[:anObject | |theseChains| - stop ifFalse:[ - theseChains := self - refChainsFrom:Smalltalk - to:anObject - inRefSets:tLevels - startingAt:1. - - theseChains size > 0 ifTrue:[ - chains addAll:theseChains - ]. - nDone := nDone + 1. - progress percentage:(nDone / nAll * 100). - ] - ]. - - tLevels := nil. - - levels size > 0 ifTrue:[ - levels reverse. - levels last remove:Smalltalk. - ]. - - [stop not - and:[chains size > 0]] whileTrue:[ - chain := chains first. - chains removeFirst. - - lbl label:('found a reference chain.'). - progress beInvisible. - - chain addFirst:Smalltalk. - list := OrderedCollection withSize:chain size. - 1 to:chain size-1 do:[:i | - list - at:i - put:(self refNameFor:(chain at:i+1) in:(chain at:i)) - ]. - list at:list size put:(chain last classNameWithArticle). - - "/ hide the VMProcesses stuff from the user ... - (list at:1) string = 'Smalltalk:__VMProcesses__' ifTrue:[ - list at:1 put:'__VMProcesses__ (a hidden VM reference)'. - list removeIndex:2. - chain at:1 put:nil. - chain removeIndex:2. - ]. - - listV list:list. - - listV beVisible. - listV doubleClickAction:[:idx | |o| - (o := chain at:idx) notNil ifTrue:[ - o inspect. - ] - ]. - moreButton beVisible. - anyShown := anyShownInAnyLevel := true. - showMore := false. - - "/ kludge - wait for some user action - - [showMore or:[stop or:[top realized not]]] whileFalse:[ - Delay waitForSeconds:0.1 - ]. - - chain := nil. - - top realized ifFalse:[ - stop := true - ] ifTrue:[ - listV doubleClickAction:nil. - showMore ifFalse:[ - stop := true. - ]. - ]. - done := false. - - stop ifFalse:[ - progress beVisible. - listV beInvisible. - moreButton beInvisible. - - chain := nil. - ] - ]. - levels size > 0 ifTrue:[ - levels last addAll:temporaryRemoved. - ] - ]. - ]. - - owners remove:Smalltalk ifAbsent:nil. - owners remove:(owners keyArray) ifAbsent:nil. - owners remove:objectArray ifAbsent:nil. - levels do:[:lColl | - owners remove:lColl ifAbsent:nil - ]. - - levels add:owners. - - objects := owners. - - objects size == 0 ifTrue:[ - stop := true - ]. - - stop ifTrue:[ - Smalltalk at:#'__VMProcesses__' put:nil. - top destroy. - anyShown ifFalse:[ - userStop ifFalse:[ - self information:(anyShownInAnyLevel ifTrue:['no more references'] ifFalse:['no references']). - ] - ]. - ^ self. - ]. + owners isEmpty ifTrue:[ + found ifFalse:[ + stop := true. + ] + ]. + + stop ifFalse:[ + done := found or:[(owners includesIdentical:Smalltalk)]. + done ifTrue:[ + moreChainsOnThisLevel := true. + temporaryRemoved := IdentitySet new. + + levels size > 0 ifTrue:[ + "/ show what we found so far. + levels last add:Smalltalk. + levels reverse. + ]. + + chains := OrderedCollection new. + + tLevels := levels collect:[:lColl | lColl copy]. + + lbl label:('building refchains ...'). + + nAll := aCollection size. + nDone := 0. + aCollection do:[:anObject | |theseChains| + stop ifFalse:[ + theseChains := self + refChainsFrom:Smalltalk + to:anObject + inRefSets:tLevels + startingAt:1. + + theseChains size > 0 ifTrue:[ + chains addAll:theseChains + ]. + nDone := nDone + 1. + progress percentage:(nDone / nAll * 100). + ] + ]. + + tLevels := nil. + + levels size > 0 ifTrue:[ + levels reverse. + levels last remove:Smalltalk. + ]. + + [stop not + and:[chains size > 0]] whileTrue:[ + chain := chains first. + chains removeFirst. + + lbl label:('found a reference chain.'). + progress beInvisible. + + chain addFirst:Smalltalk. + list := OrderedCollection withSize:chain size. + 1 to:chain size-1 do:[:i | + list + at:i + put:(self refNameFor:(chain at:i+1) in:(chain at:i)) + ]. + list at:list size put:(chain last classNameWithArticle). + + "/ hide the VMProcesses stuff from the user ... + (list at:1) string = 'Smalltalk:__VMProcesses__' ifTrue:[ + list at:1 put:'__VMProcesses__ (a hidden VM reference)'. + list removeIndex:2. + chain at:1 put:nil. + chain removeIndex:2. + ]. + + listV list:list. + + listV beVisible. + listV doubleClickAction:[:idx | |o| + (o := chain at:idx) notNil ifTrue:[ + o inspect. + ] + ]. + moreButton beVisible. + anyShown := anyShownInAnyLevel := true. + showMore := false. + + "/ kludge - wait for some user action + + [showMore or:[stop or:[top realized not]]] whileFalse:[ + Delay waitForSeconds:0.1 + ]. + + chain := nil. + + top realized ifFalse:[ + stop := true + ] ifTrue:[ + listV doubleClickAction:nil. + showMore ifFalse:[ + stop := true. + ]. + ]. + done := false. + + stop ifFalse:[ + progress beVisible. + listV beInvisible. + moreButton beInvisible. + + chain := nil. + ] + ]. + levels size > 0 ifTrue:[ + levels last addAll:temporaryRemoved. + ] + ]. + ]. + + owners remove:Smalltalk ifAbsent:nil. + owners remove:(owners keyArray) ifAbsent:nil. + owners remove:objectArray ifAbsent:nil. + levels do:[:lColl | + owners remove:lColl ifAbsent:nil + ]. + + levels add:owners. + + objects := owners. + + objects size == 0 ifTrue:[ + stop := true + ]. + + stop ifTrue:[ + Smalltalk at:#'__VMProcesses__' put:nil. + top destroy. + anyShown ifFalse:[ + userStop ifFalse:[ + self information:(anyShownInAnyLevel ifTrue:['no more references'] ifFalse:['no references']). + ] + ]. + ^ self. + ]. ]. anyShown ifTrue:[ - userStop ifFalse:[ - self information:'no more references'. - ] + userStop ifFalse:[ + self information:'no more references'. + ] ]. Smalltalk at:#'__VMProcesses__' put:nil. ^ self @@ -3207,9 +3207,9 @@ you may want to increase this limit." %{ /* NOCONTEXT */ - extern unsigned __compressingGCLimit(); - - RETURN (__MKUINT( __compressingGCLimit((unsigned int)-1) )); + extern unsigned INT __compressingGCLimit(); + + RETURN (__MKUINT( __compressingGCLimit((unsigned INT)-1) )); %}. ^ 0 " @@ -3229,10 +3229,10 @@ |result| %{ - extern unsigned __compressingGCLimit(); + extern unsigned INT __compressingGCLimit(); if (__isInteger(amount)) { - result = __MKUINT( __compressingGCLimit(__unsignedLongIntVal(amount)) ); + result = __MKUINT( __compressingGCLimit((unsigned INT)__unsignedLongIntVal(amount)) ); } %}. result isNil ifTrue:[ @@ -3254,9 +3254,9 @@ and there is no need to change it." %{ /* NOCONTEXT */ - extern unsigned __oldSpaceIncrement(); - - RETURN (__MKUINT( __oldSpaceIncrement((unsigned int)-1) )); + extern unsigned INT __oldSpaceIncrement(); + + RETURN (__MKUINT( __oldSpaceIncrement((unsigned INT)-1) )); %}. ^ 0 " @@ -3274,10 +3274,10 @@ |result| %{ - extern unsigned __oldSpaceIncrement(); + extern unsigned INT __oldSpaceIncrement(); if (__isInteger(amount)) { - result = __MKUINT( __oldSpaceIncrement(__unsignedLongIntVal(amount)) ); + result = __MKUINT( __oldSpaceIncrement((unsigned INT)__unsignedLongIntVal(amount)) ); } %}. result isNil ifTrue:[ @@ -3958,10 +3958,10 @@ int prev; prev = __optimizeContexts(aBoolean == true - ? 1 - : (aBoolean == false) - ? 0 - : -1); + ? 1 + : (aBoolean == false) + ? 0 + : -1); RETURN (prev ? true : false); %} " @@ -4318,13 +4318,13 @@ aCollection := OrderedCollection new. self allObjectsIncludingContextsDo:[:o | - (aBlock value:o) ifTrue:[ - aCollection add:o - ] + (aBlock value:o) ifTrue:[ + aCollection add:o + ] ]. (aCollection size == 0) ifTrue:[ - "actually this cannot happen - there is always one" - ^ nil + "actually this cannot happen - there is always one" + ^ nil ]. ^ aCollection ! @@ -5504,7 +5504,7 @@ !ObjectMemory class methodsFor:'documentation'! version_CVS - ^ '$Header: /cvs/stx/stx/libbasic/ObjectMemory.st,v 1.268 2013-05-11 17:42:41 stefan Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/ObjectMemory.st,v 1.269 2013-06-27 21:01:21 cg Exp $' ! version_SVN
--- a/OrderedCollection.st Fri Jun 28 11:29:14 2013 +0100 +++ b/OrderedCollection.st Mon Jul 01 22:14:20 2013 +0100 @@ -479,6 +479,31 @@ ^ aCollection ! +addAll:aCollection afterIndex:index + "insert the argument, anObject to become located after index. + Return the receiver (sigh - ST-80 compatibility)." + + ^ self addAll:aCollection beforeIndex:(index + 1) + + " + |c| + c := #(4 3 2 1) asOrderedCollection. + c addAll:#(10 20 30) afterIndex:2 + " + " + |c| + c := #(4 3 2 1) asOrderedCollection. + c addAll:#(10 20 30) afterIndex:4 + " + " + |c| + c := #(4 3 2 1) asOrderedCollection. + c addAll:#(10 20 30) afterIndex:0 + " + + "Modified: 12.4.1996 / 13:52:41 / cg" +! + addAll:aCollection beforeIndex:index "insert all elements of the argument, anObject to become located at index. The collection may be unordered, but then order of the sliced-in elements @@ -1419,6 +1444,7 @@ ! ! + !OrderedCollection methodsFor:'private'! initContents:size @@ -1967,6 +1993,6 @@ !OrderedCollection class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libbasic/OrderedCollection.st,v 1.106 2013-06-17 21:15:10 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/OrderedCollection.st,v 1.107 2013-06-28 08:35:54 cg Exp $' ! !
--- a/PipeStream.st Fri Jun 28 11:29:14 2013 +0100 +++ b/PipeStream.st Mon Jul 01 22:14:20 2013 +0100 @@ -521,28 +521,28 @@ int retVal; if ((fp = __INST(handle)) != nil) { - __INST(handle) = nil; - f = __FILEVal(fp); - if (@global(FileOpenTrace) == true) { - console_fprintf(stderr, "close [PipeStream] %x fd=%d\n", f, fileno(f)); - } + __INST(handle) = nil; + f = __FILEVal(fp); + if (@global(FileOpenTrace) == true) { + console_fprintf(stderr, "close [PipeStream] %"_lx_" fd=%d\n", (INT)f, fileno(f)); + } #ifdef WIN32 - do { - __threadErrno = 0; - retVal = __STX_C_NOINT_CALL1( "close", (void*)close, (void*)fileno(f) ); - } while ((retVal < 0) && (__threadErrno == EINTR)); + do { + __threadErrno = 0; + retVal = __STX_C_NOINT_CALL1( "close", (void*)close, (void*)fileno(f) ); + } while ((retVal < 0) && (__threadErrno == EINTR)); #else - __BEGIN_INTERRUPTABLE__ - close(fileno(f)); - __END_INTERRUPTABLE__ + __BEGIN_INTERRUPTABLE__ + close(fileno(f)); + __END_INTERRUPTABLE__ #endif } #endif /* not transputer */ %}. exitAction notNil ifTrue:[ - action := exitAction. - exitAction := nil. - action value. + action := exitAction. + exitAction := nil. + action value. ] ! @@ -569,17 +569,17 @@ realCmd execDirectory tmpComFile nullOutput resultPid errorNumber| handle notNil ifTrue:[ - "the pipe was already open ... - this should (can) not happen." - ^ self errorAlreadyOpen + "the pipe was already open ... + this should (can) not happen." + ^ self errorAlreadyOpen ]. rwMode = #r ifTrue:[ - mode := #readonly. didWrite := false. + mode := #readonly. didWrite := false. ] ifFalse:[rwMode = #'r+' ifTrue:[ - mode := #readwrite. didWrite := true. + mode := #readwrite. didWrite := true. ] ifFalse:[ - mode := #writeonly. didWrite := true. + mode := #writeonly. didWrite := true. ]]. lastErrorNumber := nil. @@ -591,79 +591,79 @@ execFdArray := #(0 1 2) copy. OperatingSystem isVMSlike ifTrue:[ - "/ - "/ the generated COM-file includes a 'set default' - "/ - tmpComFile := OperatingSystem createCOMFileForVMSCommand:aCommandString in:aDirectory. - realCmd := '@' , tmpComFile osName. - execDirectory := nil. + "/ + "/ the generated COM-file includes a 'set default' + "/ + tmpComFile := OperatingSystem createCOMFileForVMSCommand:aCommandString in:aDirectory. + realCmd := '@' , tmpComFile osName. + execDirectory := nil. - mbx := OperatingSystem createMailBox. - mbx isNil ifTrue:[ - lastErrorNumber := errorNumber := OperatingSystem currentErrorNumber. - tmpComFile delete. - ^ self openError:errorNumber. - ]. - mbxName := OperatingSystem mailBoxNameOf:mbx. + mbx := OperatingSystem createMailBox. + mbx isNil ifTrue:[ + lastErrorNumber := errorNumber := OperatingSystem currentErrorNumber. + tmpComFile delete. + ^ self openError:errorNumber. + ]. + mbxName := OperatingSystem mailBoxNameOf:mbx. - "/ 'mailBox is ' print. mbx print. ' name is ' print. mbxName printCR. - shellPath := ''. - shellArgs := realCmd. + "/ 'mailBox is ' print. mbx print. ' name is ' print. mbxName printCR. + shellPath := ''. + shellArgs := realCmd. - rwMode = #r ifTrue:[ - "redirect stdout of subprocess to write to mailbox" - execFdArray at:2 put:mbx. - ] ifFalse:[ - "redirect stdin of subprocess to read from mailbox" - execFdArray at:1 put:mbx. - ]. + rwMode = #r ifTrue:[ + "redirect stdout of subprocess to write to mailbox" + execFdArray at:2 put:mbx. + ] ifFalse:[ + "redirect stdin of subprocess to read from mailbox" + execFdArray at:1 put:mbx. + ]. ] ifFalse:[ - shellAndArgs := OperatingSystem commandAndArgsForOSCommand:realCmd. - shellPath := shellAndArgs at:1. - shellArgs := shellAndArgs at:2. + shellAndArgs := OperatingSystem commandAndArgsForOSCommand:realCmd. + shellPath := shellAndArgs at:1. + shellArgs := shellAndArgs at:2. - mode == #readwrite ifTrue:[ - pipeFdArray := OperatingSystem makeBidirectionalPipe. - pipeFdArray isNil ifTrue:[ - lastErrorNumber := errorNumber := OperatingSystem currentErrorNumber. - ^ self openError:errorNumber. - ]. - myFd := pipeFdArray at:1. - execFd := pipeFdArray at:2. - execFdArray at:1 put:execFd. - execFdArray at:2 put:execFd. - ] ifFalse:[ - pipeFdArray := OperatingSystem makePipe. - pipeFdArray isNil ifTrue:[ - lastErrorNumber := errorNumber := OperatingSystem currentErrorNumber. - ^ self openError:errorNumber. - ]. + mode == #readwrite ifTrue:[ + pipeFdArray := OperatingSystem makeBidirectionalPipe. + pipeFdArray isNil ifTrue:[ + lastErrorNumber := errorNumber := OperatingSystem currentErrorNumber. + ^ self openError:errorNumber. + ]. + myFd := pipeFdArray at:1. + execFd := pipeFdArray at:2. + execFdArray at:1 put:execFd. + execFdArray at:2 put:execFd. + ] ifFalse:[ + pipeFdArray := OperatingSystem makePipe. + pipeFdArray isNil ifTrue:[ + lastErrorNumber := errorNumber := OperatingSystem currentErrorNumber. + ^ self openError:errorNumber. + ]. - mode == #readonly ifTrue:[ - "redirect stdout of subprocess to write to pipe" - myFd := pipeFdArray at:1. - execFd := pipeFdArray at:2. - execFdArray at:2 put:execFd. - ] ifFalse:[ - "redirect stdin of subprocess to read from pipe" - myFd := pipeFdArray at:2. - execFd := pipeFdArray at:1. - execFdArray at:1 put:execFd. - ]. - ]. + mode == #readonly ifTrue:[ + "redirect stdout of subprocess to write to pipe" + myFd := pipeFdArray at:1. + execFd := pipeFdArray at:2. + execFdArray at:2 put:execFd. + ] ifFalse:[ + "redirect stdin of subprocess to read from pipe" + myFd := pipeFdArray at:2. + execFd := pipeFdArray at:1. + execFdArray at:1 put:execFd. + ]. + ]. ]. errorDisposition == #discard ifTrue:[ - nullOutput := Filename nullDevice writeStream. - execFdArray at:3 put:nullOutput fileDescriptor + nullOutput := Filename nullDevice writeStream. + execFdArray at:3 put:nullOutput fileDescriptor ] ifFalse:[ - (errorDisposition == #inline or:[errorDisposition == #stdout]) ifTrue:[ - execFdArray at:3 put:1 - ] ifFalse:[ + (errorDisposition == #inline or:[errorDisposition == #stdout]) ifTrue:[ + execFdArray at:3 put:1 + ] ifFalse:[ "/ errorDisposition isStream ifTrue:[ "/self halt. "/ ]. - ]. + ]. ]. "/ must block here, to avoid races due to early finishing @@ -673,84 +673,84 @@ "beware: pid may change if subprocess is fast" pid := resultPid := Processor - monitor:[ - OperatingSystem - exec:shellPath - withArguments:shellArgs - environment:nil - fileDescriptors:execFdArray - fork:true - newPgrp:true - inDirectory:execDirectory. - ] - action:[:status | - status stillAlive ifFalse:[ - exitStatus := status. + monitor:[ + OperatingSystem + exec:shellPath + withArguments:shellArgs + environment:nil + fileDescriptors:execFdArray + fork:true + newPgrp:true + inDirectory:execDirectory. + ] + action:[:status | + status stillAlive ifFalse:[ + exitStatus := status. - "writing doesn't make sense - there is no reader any longer" - mode == #readwrite ifTrue:[ - "... but allow to read the rest of the command's output" - self shutDownOutput. - ] ifFalse:[mode == #writeonly ifTrue:[ - self closeFileDescriptor. - ]]. + "writing doesn't make sense - there is no reader any longer" + mode == #readwrite ifTrue:[ + "... but allow to read the rest of the command's output" + self shutDownOutput. + ] ifFalse:[mode == #writeonly ifTrue:[ + self closeFileDescriptor. + ]]. - OperatingSystem closePid:pid. - pid := nil. - exitSema signal. - ]. - ]. + OperatingSystem closePid:pid. + pid := nil. + exitSema signal. + ]. + ]. "subprocess has been created. close unused filedescriptors" execFd notNil ifTrue:[ - OperatingSystem closeFd:execFd. + OperatingSystem closeFd:execFd. ]. nullOutput notNil ifTrue:[ - nullOutput close + nullOutput close ]. resultPid notNil ifTrue:[ - "successfull creation of subprocesss" - OperatingSystem isVMSlike ifTrue:[ - "/ - "/ reopen the mailbox as a file ... - "/ - mbxName := OperatingSystem mailBoxNameOf:mbx. - mbxName notNil ifTrue:[ - super open:mbxName withMode:rwMode. - exitAction := [tmpComFile delete]. - ]. - ] ifFalse:[ - self setFileDescriptor:myFd mode:rwMode. - handleType := #pipeFilePointer. - ] + "successfull creation of subprocesss" + OperatingSystem isVMSlike ifTrue:[ + "/ + "/ reopen the mailbox as a file ... + "/ + mbxName := OperatingSystem mailBoxNameOf:mbx. + mbxName notNil ifTrue:[ + super open:mbxName withMode:rwMode. + exitAction := [tmpComFile delete]. + ]. + ] ifFalse:[ + self setFileDescriptor:myFd mode:rwMode. + handleType := #pipeFilePointer. + ] ] ifFalse:[ - "creation of subprocesss failed" - lastErrorNumber := OperatingSystem currentErrorNumber. - OperatingSystem isVMSlike ifTrue:[ - OperatingSystem destroyMailBox:mbx. - tmpComFile delete. - ] ifFalse:[ - OperatingSystem closeFd:myFd. - ]. + "creation of subprocesss failed" + lastErrorNumber := OperatingSystem currentErrorNumber. + OperatingSystem isVMSlike ifTrue:[ + OperatingSystem destroyMailBox:mbx. + tmpComFile delete. + ] ifFalse:[ + OperatingSystem closeFd:myFd. + ]. ]. blocked ifFalse:[ - OperatingSystem unblockInterrupts + OperatingSystem unblockInterrupts ]. (resultPid isNil or:[lastErrorNumber notNil]) ifTrue:[ - " - the pipe open failed for some reason ... - ... this may be either due to an invalid command string, - or due to the system running out of memory (when forking - the unix process) - " - exitAction value. - ^ self openError:lastErrorNumber. + " + the pipe open failed for some reason ... + ... this may be either due to an invalid command string, + or due to the system running out of memory (when forking + the unix process) + " + exitAction value. + ^ self openError:lastErrorNumber. ]. commandString := realCmd. @@ -796,11 +796,11 @@ !PipeStream class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libbasic/PipeStream.st,v 1.113 2013-06-03 18:40:56 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/PipeStream.st,v 1.114 2013-06-26 11:05:12 cg Exp $' ! version_CVS - ^ '$Header: /cvs/stx/stx/libbasic/PipeStream.st,v 1.113 2013-06-03 18:40:56 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/PipeStream.st,v 1.114 2013-06-26 11:05:12 cg Exp $' ! !
--- a/ProcessorScheduler.st Fri Jun 28 11:29:14 2013 +0100 +++ b/ProcessorScheduler.st Mon Jul 01 22:14:20 2013 +0100 @@ -637,7 +637,7 @@ handle all timeout actions " anyTimeouts ifTrue:[ - self evaluateTimeouts + self evaluateTimeouts ]. "first do a quick check for semaphores using checkActions - this is needed for @@ -650,42 +650,42 @@ any := false. nActions := readCheckArray size. 1 to:nActions do:[:index | - checkBlock := readCheckArray at:index. - (checkBlock notNil and:[checkBlock value]) ifTrue:[ - sema := readSemaphoreArray at:index. - sema notNil ifTrue:[ - sema signalOnce. - ]. - any := true. - ] + checkBlock := readCheckArray at:index. + (checkBlock notNil and:[checkBlock value]) ifTrue:[ + sema := readSemaphoreArray at:index. + sema notNil ifTrue:[ + sema signalOnce. + ]. + any := true. + ] ]. nActions := writeCheckArray size. 1 to:nActions do:[:index | - checkBlock := writeCheckArray at:index. - (checkBlock notNil and:[checkBlock value]) ifTrue:[ - sema := writeSemaphoreArray at:index. - sema notNil ifTrue:[ - sema signalOnce. - ]. - any := true. - ] + checkBlock := writeCheckArray at:index. + (checkBlock notNil and:[checkBlock value]) ifTrue:[ + sema := writeSemaphoreArray at:index. + sema notNil ifTrue:[ + sema signalOnce. + ]. + any := true. + ] ]. "now, someone might be runnable ..." p := self highestPriorityRunnableProcess. p isNil ifTrue:[ - "/ no one runnable, hard wait for event or timeout - "/ Trace ifTrue:['w' printCR.]. - self waitForEventOrTimeout. - - "/ check for OS process termination - gotChildSignalInterrupt ifTrue:[ - gotChildSignalInterrupt := false. - self handleChildSignalInterrupt - ]. - wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. - ^ self + "/ no one runnable, hard wait for event or timeout + "/ Trace ifTrue:['w' printCR.]. + self waitForEventOrTimeout. + + "/ check for OS process termination + gotChildSignalInterrupt ifTrue:[ + gotChildSignalInterrupt := false. + self handleChildSignalInterrupt + ]. + wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. + ^ self ]. pri := p priority. @@ -716,13 +716,13 @@ " pri < TimingPriority ifTrue:[ - anyTimeouts ifTrue:[ - millis := self timeToNextTimeout. - millis == 0 ifTrue:[ - wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. - ^ self - ] - ] + anyTimeouts ifTrue:[ + millis := self timeToNextTimeout. + millis == 0 ifTrue:[ + wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. + ^ self + ] + ] ]. " @@ -735,60 +735,60 @@ pri < UserInterruptPriority ifTrue:[ "comment out this if above is uncommented" - anyTimeouts ifTrue:[ - millis := self timeToNextTimeout. - millis == 0 ifTrue:[ - wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. - ^ self - ]. - ]. + anyTimeouts ifTrue:[ + millis := self timeToNextTimeout. + millis == 0 ifTrue:[ + wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. + ^ self + ]. + ]. "---" - useIOInterrupts ifTrue:[ + useIOInterrupts ifTrue:[ "/ readFdArray do:[:fd | "/ (fd notNil and:[fd >= 0]) ifTrue:[ "/ OperatingSystem enableIOInterruptsOn:fd "/ ]. "/ ]. - ] ifFalse:[ - millis notNil ifTrue:[ - millis := millis min:EventPollingInterval - ] ifFalse:[ - millis := EventPollingInterval - ] - ] + ] ifFalse:[ + millis notNil ifTrue:[ + millis := millis min:EventPollingInterval + ] ifFalse:[ + millis := EventPollingInterval + ] + ] ]. millis notNil ifTrue:[ - "/ Trace ifTrue:['C' print. millis printCR.]. - "schedule a clock interrupt after millis milliseconds" - OperatingSystem enableTimer:millis rounded. + "/ Trace ifTrue:['C' print. millis printCR.]. + "schedule a clock interrupt after millis milliseconds" + OperatingSystem enableTimer:millis rounded. ]. scheduledProcesses notNil ifTrue:[ - scheduledProcesses add:p + scheduledProcesses add:p ]. " now let the process run - will come back here by reschedule - from ioInterrupt or timerInterrupt ... (running at max+1) + from ioInterrupt, scheduler or timerInterrupt ... (running at max+1) " "/ Trace ifTrue:['->' print. p printCR.]. self threadSwitch:p. "/ Trace ifTrue:['<-' printCR.]. "... when we arrive here, we are back on stage. - Either by an ALARM or IO signal, or by a suspend of another process + Either by an ALARM or IO signal, or by a suspend of another process " millis notNil ifTrue:[ - OperatingSystem disableTimer. + OperatingSystem disableTimer. ]. "/ check for OS process termination gotChildSignalInterrupt ifTrue:[ - gotChildSignalInterrupt := false. - self handleChildSignalInterrupt + gotChildSignalInterrupt := false. + self handleChildSignalInterrupt ]. "/ check for new input @@ -796,8 +796,8 @@ OperatingSystem unblockInterrupts. (gotIOInterrupt or:[useIOInterrupts not]) ifTrue:[ - gotIOInterrupt := false. - self checkForIOWithTimeout:0. + gotIOInterrupt := false. + self checkForIOWithTimeout:0. ]. wasBlocked ifTrue:[OperatingSystem blockInterrupts]. @@ -825,7 +825,7 @@ "/ (thanks to stefans objectAllocation monitor, "/ this safes a bit of memory allocation in the scheduler) - dispatchAction := [self dispatch]. + dispatchAction := [ [dispatching] whileTrue:[ self dispatch ] ]. handlerAction := [:ex | ('Processor [info]: ignored signal (', ex creator printString, ')') infoPrintCR. @@ -2415,34 +2415,50 @@ wasBlocked := OperatingSystem blockInterrupts. aFileDescriptor isNil ifTrue:[ - (readCheckArray identityIndexOf:aBlock startingAt:1) == 0 ifTrue:[ - idx := readFdArray identityIndexOf:nil startingAt:1. - idx ~~ 0 ifTrue:[ - readFdArray at:idx put:aFileDescriptor. - readSemaphoreArray at:idx put:aSemaphore. - readCheckArray at:idx put:aBlock - ] ifFalse:[ - readFdArray := readFdArray copyWith:nil. - readSemaphoreArray := readSemaphoreArray copyWith:aSemaphore. - readCheckArray := readCheckArray copyWith:aBlock. - ] - ] + (readCheckArray identityIndexOf:aSemaphore startingAt:1) == 0 ifTrue:[ + idx := readFdArray identityIndexOf:nil startingAt:1. + idx ~~ 0 ifTrue:[ + readFdArray at:idx put:aFileDescriptor. + readSemaphoreArray at:idx put:aSemaphore. + readCheckArray at:idx put:aBlock + ] ifFalse:[ + readFdArray := readFdArray copyWith:nil. + readSemaphoreArray := readSemaphoreArray copyWith:aSemaphore. + readCheckArray := readCheckArray copyWith:aBlock. + ] + ] ifFalse:[ + (readCheckArray at:idx) notNil ifTrue:[ + (readCheckArray at:idx) ~~ aBlock ifTrue:[ + 'ouch - checkblock changed for read-check' infoPrintCR. + readCheckArray at:idx put:aBlock. + ] + ]. + ] ] ifFalse:[ - (readFdArray identityIndexOf:aFileDescriptor startingAt:1) == 0 ifTrue:[ - idx := readFdArray identityIndexOf:nil startingAt:1. - idx ~~ 0 ifTrue:[ - readFdArray at:idx put:aFileDescriptor. - readSemaphoreArray at:idx put:aSemaphore. - readCheckArray at:idx put:aBlock - ] ifFalse:[ - readFdArray := readFdArray copyWith:aFileDescriptor. - readSemaphoreArray := readSemaphoreArray copyWith:aSemaphore. - readCheckArray := readCheckArray copyWith:aBlock. - ]. - useIOInterrupts ifTrue:[ - OperatingSystem enableIOInterruptsOn:aFileDescriptor - ]. - ] + (readFdArray identityIndexOf:aFileDescriptor startingAt:1) == 0 ifTrue:[ + idx := readFdArray identityIndexOf:nil startingAt:1. + idx ~~ 0 ifTrue:[ + readFdArray at:idx put:aFileDescriptor. + readSemaphoreArray at:idx put:aSemaphore. + readCheckArray at:idx put:aBlock + ] ifFalse:[ + readFdArray := readFdArray copyWith:aFileDescriptor. + readSemaphoreArray := readSemaphoreArray copyWith:aSemaphore. + readCheckArray := readCheckArray copyWith:aBlock. + ]. + useIOInterrupts ifTrue:[ + OperatingSystem enableIOInterruptsOn:aFileDescriptor + ]. + ] ifFalse:[ + (readSemaphoreArray at:idx) ~~ aSemaphore ifTrue:[ + 'ouch - sema changed for read-check' infoPrintCR. + readSemaphoreArray at:idx put:aSemaphore. + ]. + (readCheckArray at:idx) ~~ aBlock ifTrue:[ + 'ouch - checkblock changed for read-check' infoPrintCR. + readCheckArray at:idx put:aBlock. + ]. + ] ]. wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. @@ -3361,11 +3377,11 @@ !ProcessorScheduler class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.269 2013-06-17 21:18:07 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.270 2013-06-27 09:49:11 cg Exp $' ! version_CVS - ^ '$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.269 2013-06-17 21:18:07 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.270 2013-06-27 09:49:11 cg Exp $' ! !
--- a/SequenceableCollection.st Fri Jun 28 11:29:14 2013 +0100 +++ b/SequenceableCollection.st Mon Jul 01 22:14:20 2013 +0100 @@ -368,7 +368,6 @@ ^ self == SequenceableCollection ! ! - !SequenceableCollection methodsFor:'Compatibility-Squeak'! allButFirst @@ -688,7 +687,6 @@ ^ self replaceFrom:start to:stop with:anArray startingAt:repStart ! ! - !SequenceableCollection methodsFor:'accessing'! after:anObject @@ -4369,23 +4367,25 @@ "evaluate the argument, aBlock for every element in the collection. Between each element (i.e. not before the first element and not after the last element), evaluate sepBlock. - This supports printing of collections with elements separated by some - string." + This supports printing of collections with elements separated by some string." |stop "{ Class:SmallInteger }"| + "/ redefined to use an inlinable to:do: + "/ to avoid creation of another block + stop := self size. stop < 1 ifTrue:[^ self]. aBlock value:(self at:1). 2 to:stop do:[:index | - sepBlock value. - aBlock value:(self at:index) + sepBlock value. + aBlock value:(self at:index) ]. " #(one two three four five six) - do:[:each | Transcript show:each] - separatedBy:[Transcript show:' , '] + do:[:each | Transcript show:each] + separatedBy:[Transcript show:' , '] " ! @@ -6816,7 +6816,6 @@ "Created: 14.2.1997 / 16:13:03 / cg" ! ! - !SequenceableCollection methodsFor:'searching'! detect:aBlock startingAt:startIndex @@ -8967,11 +8966,11 @@ !SequenceableCollection class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.339 2013-05-29 11:31:27 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.340 2013-06-29 09:35:21 cg Exp $' ! version_CVS - ^ '$Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.339 2013-05-29 11:31:27 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.340 2013-06-29 09:35:21 cg Exp $' ! !
--- a/SmallInteger.st Fri Jun 28 11:29:14 2013 +0100 +++ b/SmallInteger.st Mon Jul 01 22:14:20 2013 +0100 @@ -808,7 +808,6 @@ ! ! - !SmallInteger methodsFor:'bit operators'! bitAnd:anInteger @@ -4018,16 +4017,27 @@ %{ /* NOCONTEXT */ if (__bothSmallInteger(min, max)) { - REGISTER INT selfVal; - - selfVal = __intVal(self); - if (selfVal < __intVal(min)) { - RETURN ( false ); - } - if (selfVal > __intVal(max)) { - RETURN ( false ); - } - RETURN ( true ); +#if TAG_INT == 1 + // tag bit does not change the magnitude order + if ((INT)self < (INT)(min)) { + RETURN ( false ); + } + if ((INT)self > (INT)(max)) { + RETURN ( false ); + } + RETURN ( true ); +#else + REGISTER INT selfVal; + + selfVal = __intVal(self); + if (selfVal < __intVal(min)) { + RETURN ( false ); + } + if (selfVal > __intVal(max)) { + RETURN ( false ); + } + RETURN ( true ); +#endif } %}. (self < min) ifTrue:[^ false]. @@ -4222,11 +4232,11 @@ !SmallInteger class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libbasic/SmallInteger.st,v 1.207 2013-05-27 08:12:49 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/SmallInteger.st,v 1.208 2013-06-25 20:37:31 cg Exp $' ! version_CVS - ^ '$Header: /cvs/stx/stx/libbasic/SmallInteger.st,v 1.207 2013-05-27 08:12:49 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/SmallInteger.st,v 1.208 2013-06-25 20:37:31 cg Exp $' ! !
--- a/String.st Fri Jun 28 11:29:14 2013 +0100 +++ b/String.st Mon Jul 01 22:14:20 2013 +0100 @@ -3070,8 +3070,8 @@ %{ /* NOCONTEXT */ - if (__qIsStringLike(self)) { - if (@global(Stderr) == nil) { + if (@global(Stderr) == nil) { + if (__qIsStringLike(self)) { console_fprintf(stderr, "%s" , __stringVal(self)); console_fflush(stderr); RETURN (self); @@ -3095,8 +3095,8 @@ %{ /* NOCONTEXT */ - if (__qIsStringLike(self)) { - if (@global(Stderr) == nil) { + if (@global(Stderr) == nil) { + if (__qIsStringLike(self)) { console_fprintf(stderr, "%s\n" , __stringVal(self)); console_fflush(stderr); RETURN (self); @@ -3113,8 +3113,8 @@ %{ /* NOCONTEXT */ - if (__qIsStringLike(self)) { - if (@global(Stdout) == nil) { + if (@global(Stdout) == nil) { + if (__qIsStringLike(self)) { console_fprintf(stdout, "%s" , __stringVal(self)); console_fflush(stdout); RETURN (self); @@ -3131,8 +3131,8 @@ %{ /* NOCONTEXT */ - if (__qIsStringLike(self)) { - if (@global(Stdout) == nil) { + if (@global(Stdout) == nil) { + if (__qIsStringLike(self)) { console_fprintf(stdout, "%s\n" , __stringVal(self)); console_fflush(stdout); RETURN (self); @@ -3895,10 +3895,10 @@ !String class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libbasic/String.st,v 1.305 2013-05-21 20:44:47 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/String.st,v 1.306 2013-06-27 21:01:02 cg Exp $' ! version_CVS - ^ '$Header: /cvs/stx/stx/libbasic/String.st,v 1.305 2013-05-21 20:44:47 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/String.st,v 1.306 2013-06-27 21:01:02 cg Exp $' ! !
--- a/UserPreferences.st Fri Jun 28 11:29:14 2013 +0100 +++ b/UserPreferences.st Mon Jul 01 22:14:20 2013 +0100 @@ -3378,6 +3378,10 @@ !UserPreferences methodsFor:'accessing-prefs-code view'! +assignmentBackgroundColorForNavigationService + ^ (Color rgbValue:16rFFDBDB) +! + codeView2AutoPrettyPrint ^self at:#codeView2AutoPrettyPrint ifAbsent: false @@ -3853,7 +3857,15 @@ "if true, the transcript raises itself automatically when new messages appear. The default is false" - self at:#autoRaiseTranscript put:aBoolean + |transcript| + + self at:#autoRaiseTranscript put:aBoolean. + (self == UserPreferences current) ifTrue:[ + transcript := Transcript current. + (transcript notNil and:[transcript isExternalStream not]) ifTrue:[ + transcript autoRaise:aBoolean. + ]. + ]. " UserPreferences current autoRaiseTranscript:true @@ -4379,11 +4391,11 @@ !UserPreferences class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libbasic/UserPreferences.st,v 1.333 2013-06-21 08:07:43 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/UserPreferences.st,v 1.335 2013-06-24 14:50:16 cg Exp $' ! version_CVS - ^ '$Header: /cvs/stx/stx/libbasic/UserPreferences.st,v 1.333 2013-06-21 08:07:43 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/UserPreferences.st,v 1.335 2013-06-24 14:50:16 cg Exp $' ! version_SVN