--- a/.hgtags Wed Nov 20 15:12:13 2013 +0000
+++ b/.hgtags Mon Nov 25 10:37:44 2013 +0000
@@ -20,6 +20,7 @@
62ff001533901d30b624539b2f404d73f01db468 expecco_1_6_0
664991bb352e0a9f98bd7d36ec1c0b6a75e649eb rel5_4_6
66c9ab533baa6c668c01fda982432655a764ca67 rel3_4_1_2
+685e1bb32c318e85171381c21d81e6272eef9f48 expecco_2_6_0
6dcd44bc2ff92d95c87750dece318217585ea275 expecco_1_7_0b1
6dcd44bc2ff92d95c87750dece318217585ea275 expecco_1_7_0b2
700a73103ea1d350d9367d1318cf2250c587c80a ecpecco_1_6_0
--- a/AutoDeletedFilename.st Wed Nov 20 15:12:13 2013 +0000
+++ b/AutoDeletedFilename.st Mon Nov 25 10:37:44 2013 +0000
@@ -109,7 +109,7 @@
"when copying, return a real filename
(to avoid mutiple removals)"
- ^ Filename named:nameString
+ ^ self species named:nameString
"
'blaFaselQall.mist' asFilename asAutoDeletedFilename copy
@@ -135,6 +135,14 @@
].
! !
+!AutoDeletedFilename methodsFor:'queries'!
+
+species
+ "filenames derived from me should not be autodeleted themself"
+
+ ^ Filename concreteClass.
+! !
+
!AutoDeletedFilename methodsFor:'removing'!
recursiveRemove
@@ -160,6 +168,6 @@
!AutoDeletedFilename class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/AutoDeletedFilename.st,v 1.10 2013-07-05 12:32:08 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/AutoDeletedFilename.st,v 1.11 2013-11-13 10:39:12 stefan Exp $'
! !
--- a/CharacterArray.st Wed Nov 20 15:12:13 2013 +0000
+++ b/CharacterArray.st Mon Nov 25 10:37:44 2013 +0000
@@ -1937,6 +1937,40 @@
^ (self compareCollatingWith:aString) > 0
!
+compareAsVersionNumberWith:aStringOrCollection
+ "Compare the receiver with the argument and return 1 if the receiver is
+ greater, 0 if equal and -1 if less than the argument in a sorted list.
+ Compare as version numbers in the form a.b.c... ."
+
+ |rev1 rev2|
+
+ rev1 := self asCollectionOfSubstringsSeparatedBy:$..
+ aStringOrCollection isString ifTrue:[
+ rev2 := aStringOrCollection asCollectionOfSubstringsSeparatedBy:$..
+ ].
+ rev1 := rev1 collect:[:each| each asInteger].
+ rev2 := rev2 collect:[:each| each asInteger].
+
+ ^ rev1 compareWith:rev2
+
+ "
+ self assert:('1' compareAsVersionNumberWith:'2') < 0.
+ self assert:('2' compareAsVersionNumberWith:'1') > 0.
+ self assert:('1.1' compareAsVersionNumberWith:'2.1.2') < 0.
+ self assert:('2.1' compareAsVersionNumberWith:'1.2.3') > 0.
+ self assert:('1' compareAsVersionNumberWith:'1.1') < 0.
+ self assert:('1.1' compareAsVersionNumberWith:'1') > 0.
+ self assert:('1.1' compareAsVersionNumberWith:'1.2') < 0.
+ self assert:('1.10' compareAsVersionNumberWith:'1.2') > 0.
+ self assert:('1.2.3.4' compareAsVersionNumberWith:'1.2.3.5') < 0.
+ self assert:('1.2.3.4' compareAsVersionNumberWith:'1.2.3.3') > 0.
+ self assert:('1.2.3.4' compareAsVersionNumberWith:'1.2.3') > 0.
+ self assert:('1.2.3.4' compareAsVersionNumberWith:'1.2.3.4') = 0.
+ self assert:('1.2.3.4' compareAsVersionNumberWith:'01.002.03.004') = 0.
+ self assert:('1.2.3.4' compareAsVersionNumberWith:#(1 2 3 4)) = 0.
+ "
+!
+
compareCaselessWith:aString
"Compare the receiver against the argument, ignoreing case.
Return 1 if the receiver is greater, 0 if equal and -1 if less than the argument.
@@ -1992,26 +2026,13 @@
'foo' compareWith: 'Foo' will return 1.
while 'foo' sameAs:'Foo' will return true"
- |mySize "{ Class: SmallInteger }"
- otherSize "{ Class: SmallInteger }"
- n "{ Class: SmallInteger }"
- c1 c2|
-
- mySize := self size.
- otherSize := aString string size.
- n := mySize min:otherSize.
-
- 1 to:n do:[:index |
- c1 := self at:index.
- c2 := aString at:index.
- c1 > c2 ifTrue:[^ 1].
- c1 < c2 ifTrue:[^ -1].
+ |s|
+
+ s := self string.
+ s ~~ self ifTrue:[
+ ^ s compareWith:aString string.
].
- mySize > otherSize ifTrue:[^ 1].
- mySize < otherSize ifTrue:[^ -1].
- ^ 0
-
- "Modified: 22.4.1996 / 15:56:07 / cg"
+ ^ super compareWith:aString string.
!
endsWith:aStringOrCharacter
@@ -6826,11 +6847,11 @@
!CharacterArray class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.517 2013-10-22 11:15:25 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.518 2013-11-14 15:33:24 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.517 2013-10-22 11:15:25 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/CharacterArray.st,v 1.518 2013-11-14 15:33:24 stefan Exp $'
!
version_HG
--- a/Class.st Wed Nov 20 15:12:13 2013 +0000
+++ b/Class.st Mon Nov 25 10:37:44 2013 +0000
@@ -2598,7 +2598,6 @@
needRename ifTrue:[
fileExists ifTrue:[
savFilename := filename addSuffix:'.sav~'.
- savFilename delete.
filename renameTo:savFilename.
].
outStream fileName renameTo:filename.
@@ -5645,11 +5644,11 @@
!Class class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Class.st,v 1.631 2013-10-22 11:16:02 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Class.st,v 1.632 2013-11-21 15:02:57 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/Class.st,v 1.631 2013-10-22 11:16:02 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Class.st,v 1.632 2013-11-21 15:02:57 stefan Exp $'
!
version_HG
--- a/Collection.st Wed Nov 20 15:12:13 2013 +0000
+++ b/Collection.st Mon Nov 25 10:37:44 2013 +0000
@@ -1223,21 +1223,32 @@
|removedElements|
removedElements := OrderedCollection new.
- self do:[:element |
- (aBlock value:element) ifTrue: [
- removedElements add:element
+ self do:[:eachElement |
+ (aBlock value:eachElement) ifTrue: [
+ removedElements add:eachElement
]
].
- self removeAll:removedElements.
+ self removeAllIdenticalFoundIn:removedElements.
^ removedElements
"
|coll|
- coll := #(1 2 3 4 5 6 7 8 9 10) asOrderedCollection.
+ coll := #(1 2 2 3 4 5 6 7 8 9 10) asOrderedCollection.
coll removeAllSuchThat:[:el | el even].
coll
"
+
+ "
+ |coll bla|
+
+ bla := 'bla' copy.
+ coll := #(1 'bla' 3 4 5 6 7 8 9 10) asOrderedCollection.
+ coll add:bla.
+ coll removeAllSuchThat:[:el | el == bla].
+ coll
+ "
+
"
|coll|
@@ -1245,7 +1256,6 @@
coll removeAllSuchThat:[:el | el even].
coll
"
-
!
removeFirst
@@ -1433,6 +1443,79 @@
"Modified: / 23-08-2010 / 18:19:42 / cg"
! !
+!Collection methodsFor:'comparing'!
+
+identicalContentsAs:aCollection
+ "return true if the receiver and aCollection represent collections
+ with identical contents. This is much like #sameContentsAs:, but compares
+ elements using #== instead of #=."
+
+ aCollection size ~~ self size ifTrue:[
+ ^ false
+ ].
+
+ ^ aCollection conform:[:e | (self includesIdentical:e)]
+
+ "
+ #(1 2 3 4 5) = #(1 2 3 4 5)
+ #(1 2 3 4 5) = #(1.0 2 3 4.0 5)
+ #($1 $2 $3 $4 $5) = '12345'
+
+ #(1 2 3 4 5) identicalContentsAs:#(1 2 3 4 5)
+ #(1 2 3 4 5) identicalContentsAs: #(1.0 2 3 4.0 5)
+ #($1 $2 $3 $4 $5) identicalContentsAs: '12345'
+ "
+
+ "Modified: / 31.10.2001 / 11:30:18 / cg"
+!
+
+sameContentsAs:aCollection
+ "answer true, if all the elements in self and aCollection
+ are common. This is not defined as #=, since we cannot redefine #hash
+ for aCollection."
+
+ aCollection size ~~ self size ifTrue:[
+ ^ false
+ ].
+
+ ^ aCollection conform:[:e | (self includes:e)]
+
+ "
+ #(1 2 3) asSet sameContentsAs: #(1 2 3)
+ #(1 2 3 4) asSet sameContentsAs: #(1 2 3)
+ #(1 2 3) asSet sameContentsAs: #(1 2 3 3)
+ #(1 2 3 'aa') asSet sameContentsAs: #(1 2 3 'aa')
+ #(1 2 3 'aa') asIdentitySet sameContentsAs: #(1 2 3 'aa')
+ #(1 2 3 #aa) asIdentitySet sameContentsAs: #(1 2 3 #aa)
+ "
+!
+
+sameContentsAs:aCollection whenComparedWith:compareBlock
+ "answer true, if all the elements in self and aCollection
+ are common. This is not defined as #=, since we cannot redefine #hash
+ for aCollection."
+
+ aCollection size ~~ self size ifTrue:[
+ ^ false
+ ].
+
+ ^ aCollection conform:[:otherElement |
+ self contains:[:myElement |
+ compareBlock value:myElement value:otherElement
+ ].
+ ].
+
+ "
+ #(1 2 3 4 5) asSet sameContentsAs: #(1 2 3 4 5) whenComparedWith:[:a :b | a = b]
+ #(1 2 3 4 5) sameContentsAs: #(1 2 3 4 5) asSet whenComparedWith:[:a :b | a = b]
+ #(1 2 3 4 5) asSet sameContentsAs: #(1 2 3 4 5) whenComparedWith:[:a :b | a == b]
+ #(1 2 3 4 5) asSet sameContentsAs: #(1.0 2 3 4.0 5) whenComparedWith:[:a :b | a = b]
+ #(1 2 3 4 5) asSet sameContentsAs: #(1.0 2 3 4.0 5) whenComparedWith:[:a :b | a == b]
+
+ #('Hello' 'ABC' 'worlD') asSet sameContentsAs: #('Hello' 'ABC' 'worlD') whenComparedWith:[:a :b | a sameAs:b]
+ "
+! !
+
!Collection methodsFor:'converting'!
asArray
@@ -4903,11 +4986,11 @@
!Collection class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.316 2013-09-10 07:35:52 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.318 2013-11-14 15:30:58 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.316 2013-09-10 07:35:52 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.318 2013-11-14 15:30:58 stefan Exp $'
! !
--- a/Dictionary.st Wed Nov 20 15:12:13 2013 +0000
+++ b/Dictionary.st Mon Nov 25 10:37:44 2013 +0000
@@ -50,10 +50,10 @@
[Instance variables:]
- keyArray <Array> (from Set) the keys
+ keyArray <Array> (from Set) the keys
- valueArray <Array> the values ('valueArray at:index' corresponds
- to the value stored under 'keyArray at:index')
+ valueArray <Array> the values ('valueArray at:index' corresponds
+ to the value stored under 'keyArray at:index')
Performance hints:
since the dictionary does not really store associations internally,
@@ -73,17 +73,15 @@
Special note:
in previous versions, nil was not allowed as valid key
- (due to the inheritance from Set, which still does not allow for
- nil elements).
This has been changed; internally, a special nil-key is used,
which is converted back to nil whenever keys are accessed.
[See also:]
- Set, IdentityDictionary, IdentitySet, WeakIdentitySet and
- WeakIdentityDictionary
+ Set, IdentityDictionary, IdentitySet, WeakIdentitySet and
+ WeakIdentityDictionary
[author:]
- Claus Gittinger
+ Claus Gittinger
"
!
@@ -2092,10 +2090,10 @@
!Dictionary class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Dictionary.st,v 1.115 2013-10-17 14:03:39 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Dictionary.st,v 1.116 2013-11-08 09:26:18 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/Dictionary.st,v 1.115 2013-10-17 14:03:39 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Dictionary.st,v 1.116 2013-11-08 09:26:18 stefan Exp $'
! !
--- a/Filename.st Wed Nov 20 15:12:13 2013 +0000
+++ b/Filename.st Mon Nov 25 10:37:44 2013 +0000
@@ -533,7 +533,7 @@
|tempdir|
- tempdir := Filename newTemporaryIn:aDirectoryOrNil.
+ tempdir := self newTemporaryIn:aDirectoryOrNil.
tempdir exists ifTrue:[
tempdir recursiveRemove.
].
@@ -1643,7 +1643,7 @@
self species == aFilename species ifTrue:[
str := aFilename asString.
- self class isCaseSensitive ifTrue:[
+ self species isCaseSensitive ifTrue:[
^ nameString = str
].
^ nameString sameAs:str
@@ -1791,7 +1791,7 @@
hash
"return an integer useful as a hash-key"
- self class isCaseSensitive ifFalse:[
+ self species isCaseSensitive ifFalse:[
^ nameString asUppercase hash
].
^ nameString hash
@@ -1863,7 +1863,7 @@
"return the receiver converted to a filename with
an absolute pathname."
- ^ self class named:self pathName
+ ^ self species named:self pathName
"
'.' asFilename
@@ -1884,7 +1884,7 @@
"return the receiver converted to a filename without intermediate ..'s and .'s
(similar to an absolute pathname, but symlinks are not resolved)."
- ^ self class named:(self class canonicalize:nameString)
+ ^ self species named:(self species canonicalize:nameString)
"
'c:\test\work' asFilename asCanonicalizedFilename
@@ -1923,7 +1923,7 @@
"return the receivers filename components - that is the name of each directory
along the pathName (that DOES include the root directory)"
- ^ self class components:self name
+ ^ self species components:self name
"
'.' asFilename asAbsoluteFilename components
@@ -2748,10 +2748,6 @@
|inStream outStream outStreamToClose|
inStream := self readStream.
- inStream isNil ifTrue:[
- ^ self fileNotFoundError:self
- ].
-
[
newNameOrStream isStream ifTrue:[
outStream := newNameOrStream.
@@ -2802,18 +2798,16 @@
newName asAbsoluteFilename = self asAbsoluteFilename ifTrue: [ ^ self ].
inStream := self readStream.
- inStream isNil ifTrue:[
- ^ self fileNotFoundError:self
- ].
-
[
newNameAlreadyExists := newName exists.
outStream := newName writeStream.
- outStream isNil ifTrue:[
- ^ self fileCreationError:newName
- ].
newNameAlreadyExists ifFalse:[
- newName accessRights:self accessRights.
+ [
+ "would be nice to keep the access rights of the original test suite"
+ newName accessRights:self accessRights.
+ ] on:OperatingSystem accessDeniedErrorSignal do:[:ex|
+ "ignore the error - may occure when copying to a network drive"
+ ].
].
inStream binary.
outStream binary.
@@ -2851,10 +2845,6 @@
].
inStream := self readStream.
- inStream isNil ifTrue:[
- ^ self fileNotFoundError:self
- ].
-
[
inStream binary.
resetBinary := false.
@@ -2942,7 +2932,7 @@
ex creator == OperatingSystem fileNotFoundErrorSignal ifTrue:[
ex reject
].
- self copyTo:newName.
+ self safeCopyTo:newName.
self remove
].
@@ -2980,7 +2970,7 @@
self isDirectory ifTrue:[
self recursiveMoveDirectoryTo:newName.
] ifFalse:[
- self copyTo:newName.
+ self safeCopyTo:newName.
self remove.
].
].
@@ -3310,48 +3300,10 @@
"
!
-renameOrCopyTo:newName
- "rename or copy the file - the argument must be convertable to a String.
- Raises an exception if not successful.
- This does basically the same as #renameTo:, with one exception:
- if, under unix, the new fileName is on another device, a rename operation
- fails, and #renameTo: raises an exception;
- in contrast, this method falls back to copying the file."
-
- |newFilename|
-
- newFilename := newName asFilename.
-
- (OperatingSystem
- renameFile:(self osNameForFile)
- to:(newFilename osNameForFile)
- ) ifFalse:[
- self exists ifFalse:[
- ^ self fileNotFoundError:self
- ].
-
- OperatingSystem isUNIXlike ifTrue:[
- OperatingSystem lastErrorSymbol == #EXDEV ifTrue:[
- "/ try to copy - and remove the original
- "/ this helps with cross-device renames.
-
- self copyTo:newName.
- ^ self
- ].
- ].
- ^ self accessDeniedError:newName asFilename.
- ].
-
- "
- '/tmp/foo' asFilename renameTo:'/tmp/bar'
- "
-
- "Modified: / 5.5.1999 / 13:41:27 / cg"
-!
-
renameTo:newName
"rename the file - the argument must be convertable to a String.
- Raises an exception if not successful."
+ Raises an exception if not successful.
+ If newName already exists, it will be replaced by myself."
|errno|
@@ -3376,6 +3328,60 @@
"Modified: / 5.5.1999 / 13:41:27 / cg"
!
+safeCopyTo:newNameArg
+ "Copy the files contents into another file.
+ Do it safe in an atomic operation shich makes sure that no partially written file appears.
+ The argument must be convertable to a filename.
+ Raises an exception, if an error occurs."
+
+ |newName inStream accessRights tempStream|
+
+ newName := newNameArg asFilename.
+
+ "Contents is not copied if newName represent same file as me."
+ newName asAbsoluteFilename = self asAbsoluteFilename ifTrue: [ ^ self ].
+
+ inStream := self readStream.
+ newName exists ifTrue:[
+ accessRights := newName accessRights.
+ ] ifFalse:[
+ accessRights := self accessRights.
+ ].
+
+ [
+ "let the temp filename start with a ~ to make it invisible"
+ tempStream := FileStream newTemporaryIn:newName directory nameTemplate:'~%1_%2'.
+ [
+ "would be nice to keep the access rights of the original test suite"
+ tempStream fileName accessRights:accessRights.
+ ] on:OperatingSystem accessDeniedErrorSignal do:[:ex|
+ "ignore the error - may occure when copying to a network drive"
+ ].
+
+ inStream binary.
+ tempStream binary.
+ [
+ inStream copyToEndInto:tempStream.
+ ] on:Error do:[:ex|
+ ^ self fileCreationError:newName
+ ].
+ tempStream syncData.
+ ] ensure:[
+ inStream close.
+ tempStream notNil ifTrue:[tempStream close].
+ ].
+ tempStream fileName renameTo:newName.
+
+ "
+ 'Make.proto' asFilename safeCopyTo:'/tmp/Makefile.foo'
+ 'Make.proto' asFilename safeCopyTo:'/'
+ 'smalltalk' asFilename safeCopyTo:'/xxxxxxxxxxxxxxxx/bla'
+ "
+
+ "Modified: / 10-09-2004 / 09:49:28 / janfrog"
+ "Modified: / 29-09-2006 / 16:26:32 / cg"
+!
+
truncateTo:newSize
"change the files size.
This may not be supported on all operating systems
@@ -3789,7 +3795,7 @@
|constructedName|
constructedName := self constructString:subname.
- ^ self class named:constructedName.
+ ^ self species named:constructedName.
"
'/tmp' asFilename construct:'foo'
@@ -3809,7 +3815,7 @@
"same as #construct: on most systems.
(may allow different/relaxed name syntax of the argument on some systems)"
- ^ self class named:(self constructDirectoryString:subname)
+ ^ self species named:(self constructDirectoryString:subname)
!
constructDirectoryString:subName
@@ -3830,7 +3836,7 @@
|sepString sub|
sub := subName asString.
- sepString := self class separatorString.
+ sepString := self species separatorString.
nameString size == 0 ifTrue:[
^ sub
].
@@ -3883,7 +3889,7 @@
This method differs from #construct:, by not permitting subName
to navigate above (via ..) the current filename."
- ^ self class named:(self secureConstructString:subname)
+ ^ self species named:(self secureConstructString:subname)
"
'/tmp' asFilename secureConstruct:'foo'
@@ -3915,7 +3921,7 @@
|sepString sub normalizedPath pathStream|
- sepString := self class separatorString.
+ sepString := self species separatorString.
sub := subName asString.
sub := sub asCollectionOfSubstringsSeparatedByAll:sepString.
@@ -3988,7 +3994,7 @@
The code below works for UNIX & MSDOS;
other filename classes (i.e. VMS) may want to redefine this method."
- nameString := self class canonicalize:nameString.
+ nameString := self species canonicalize:nameString.
"
'/tmp/bla' asFilename canonicalize.
@@ -4097,8 +4103,8 @@
filenamesMatching:aPattern
"VW compatibility"
- ^ (self filesMatching:aPattern) asOrderedCollection
- collect:[:eachName | self construct:eachName]
+ ^ (self filesMatching:aPattern)
+ collect:[:eachName | self construct:eachName].
"
'/etc' asFilename filenamesMatching:'a*;c*'
@@ -4117,7 +4123,7 @@
|matchers caseSensitive|
matchers := aPattern asCollectionOfSubstringsSeparatedBy:$;.
- caseSensitive := self class isCaseSensitive.
+ caseSensitive := self species isCaseSensitive.
^ self directoryContents
select:[:name |
(matchers detect:[:p | p match:name caseSensitive:caseSensitive] ifNone:0) ~~ 0
@@ -4141,7 +4147,7 @@
|matchers caseSensitive|
matchers := aPattern asCollectionOfSubstringsSeparatedBy:$;.
- caseSensitive := self class isCaseSensitive.
+ caseSensitive := self species isCaseSensitive.
^ self directoryContents
select:[:name |
@@ -4302,32 +4308,40 @@
separator
"return the directory-separator character"
- ^ self class separator
+ ^ self species separator
"Modified: 29.2.1996 / 20:52:01 / cg"
!
species
- ^ Filename concreteClass
+ "create only new instances of the concrete OS specific class.
+ Redefined in AutoDeletedFilename, to not create AutoDeleted instances
+ per default (from directories etc.)"
+
+ self == Filename ifTrue:[
+ ^ ConcreteClass.
+ ] ifFalse:[
+ ^ self class.
+ ].
!
withSpecialExpansions
"return a new filename, expanding any OS specific macros.
- Here, a ~\ prefix is expanded to the users home dir (as in csh)"
+ Here, a ~/ prefix is expanded to the users home dir (as in bash)"
|newName|
- newName := self class nameWithSpecialExpansions:nameString.
- newName ~= nameString ifTrue:[
- ^ newName asFilename.
+ newName := self species nameWithSpecialExpansions:nameString.
+ newName = nameString ifTrue:[
+ ^ self.
].
- ^ self.
+ ^ self species named:newName.
"
'~' asFilename withSpecialExpansions
- '~\work' asFilename withSpecialExpansions
- '~sv'asFilename withSpecialExpansions
- '~sv\work' asFilename withSpecialExpansions
+ '~/Desktop' asFilename withSpecialExpansions
+ '~stefan' asFilename withSpecialExpansions
+ '~stefan/Desktop' asFilename withSpecialExpansions
"
! !
@@ -4530,7 +4544,7 @@
(this is almost equivalent to #directoryName or #head, but returns
a Filename instance instead of a string )."
- ^ self class named:(self directoryName)
+ ^ self species named:(self directoryName)
"
'/foo/bar' asFilename directory
@@ -4600,7 +4614,7 @@
^ p copyTo:index-1.
].
(rest = '..') ifTrue:[
- ^ (self class named:(p copyTo:(index-1))) directoryName
+ ^ (self species named:(p copyTo:(index-1))) directoryName
].
index == 1 ifTrue:[
^ '/'
@@ -4636,7 +4650,7 @@
the receiver is contained in.
See also: #pathName, #directoryName, #directory and #baseName"
- ^ (self class named:self pathName) directoryName
+ ^ (self species named:self pathName) directoryName
"
'/foo/bar/' asFilename directoryPathName
@@ -4699,16 +4713,18 @@
containing the fully expanded filename and the receiver's name is changed to it.
An empty baseName pattern (i.e. giving the name of a directory) will also return an empty matchset."
- |dir baseName matching matchLen try allMatching
+ |mySpecies dir baseName matching matchLen try allMatching
sepString parentString prefix nMatch nm caseless lcBaseName|
- caseless := self class isCaseSensitive not.
+ mySpecies := self species.
+
+ caseless := mySpecies isCaseSensitive not.
matching := OrderedCollection new.
- nm := self class nameWithSpecialExpansions:nameString.
- nm := self class canonicalize:nm.
-
- sepString := self class separatorString.
+ nm := mySpecies nameWithSpecialExpansions:nameString.
+ nm := mySpecies canonicalize:nm.
+
+ sepString := mySpecies separatorString.
(nm endsWith:sepString) ifTrue:[
"/ two exceptions here:
"/ if there is only one file in the directory, that one must be it.
@@ -4739,7 +4755,7 @@
^ #()
].
- parentString := self class parentDirectoryName.
+ parentString := mySpecies parentDirectoryName.
baseName := self baseName.
baseName ~= nm ifTrue:[
prefix := self directoryName.
@@ -4883,7 +4899,7 @@
"return true, if the receiver represents an absolute pathname
(in contrast to one relative to the current directory)."
- ((nameString startsWith:self class separator) or:[nameString startsWith:'~']) ifTrue:[^ true].
+ ((nameString startsWith:self species separator) or:[nameString startsWith:'~']) ifTrue:[^ true].
^ self isVolumeAbsolute
"
@@ -5058,7 +5074,7 @@
"/ ^ nameString
"/ ]
"/ ].
- ^ OperatingSystem pathNameOf:(self class nameWithSpecialExpansions:nameString).
+ ^ OperatingSystem pathNameOf:(self species nameWithSpecialExpansions:nameString).
"
'/foo/bar' asFilename pathName
@@ -5121,7 +5137,7 @@
path asFilename isAbsolute ifTrue:[
t := path asFilename
] ifFalse:[
- t := (self class named:t directoryName) construct:path.
+ t := (self species named:t directoryName) construct:path.
].
info := t linkInfo.
info isNil ifTrue:[
@@ -5169,7 +5185,7 @@
|sep components tail start|
- sep := self class separator.
+ sep := self species separator.
components := self components.
start := components size - nComponents + 1.
start < 1 ifTrue:[
@@ -5675,7 +5691,7 @@
^ nameString.
].
- ^ self class nameWithSpecialExpansions:nameString.
+ ^ self species nameWithSpecialExpansions:nameString.
! !
!Filename methodsFor:'suffixes'!
@@ -5690,12 +5706,12 @@
prefixName := self name.
aSuffix isEmptyOrNil ifTrue:[
- ^ self class named:prefixName
+ ^ self species named:prefixName
].
- ^ self class named:
+ ^ self species named:
(prefixName
- , self class suffixSeparator asString
+ , self species suffixSeparator asString
, aSuffix asString)
"
@@ -5731,7 +5747,7 @@
|mySuffix|
mySuffix := self suffix.
- self class isCaseSensitive ifTrue:[
+ self species isCaseSensitive ifTrue:[
^ mySuffix = aSuffixString
].
^ mySuffix asLowercase = aSuffixString asLowercase
@@ -5754,7 +5770,7 @@
|nm idx idxFromEnd|
nm := self baseName.
- idx := nm lastIndexOf:(self class suffixSeparator).
+ idx := nm lastIndexOf:(self species suffixSeparator).
(idx == 0) ifTrue:[^ nameString].
"/ be careful: if the name consists only of suffix (i.e '.foo'),
"/ the suffix is considered empty.
@@ -5828,7 +5844,7 @@
|nm idx|
nm := self baseName.
- idx := nm lastIndexOf:(self class suffixSeparator).
+ idx := nm lastIndexOf:(self species suffixSeparator).
"/ be careful: if the name consists only of suffix (i.e '.foo'),
"/ the suffix is considered empty.
((idx == 1) or:[ idx == 0 ]) ifTrue:[
@@ -5883,10 +5899,10 @@
prefixName := self nameWithoutSuffix.
aSuffix isEmptyOrNil ifTrue:[
- ^ self class named:prefixName
+ ^ self species named:prefixName
].
- ^ self class named:
+ ^ self species named:
(prefixName
, self class suffixSeparator asString
, aSuffix asString)
@@ -5928,7 +5944,7 @@
n := self nameWithoutSuffix.
n = nameString ifTrue:[^ self].
- ^ self class named:n
+ ^ self species named:n
"
'abc.st' asFilename withoutSuffix
@@ -6050,11 +6066,11 @@
!Filename class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Filename.st,v 1.403 2013-08-31 19:30:24 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Filename.st,v 1.407 2013-11-21 15:58:10 ca Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/Filename.st,v 1.403 2013-08-31 19:30:24 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Filename.st,v 1.407 2013-11-21 15:58:10 ca Exp $'
! !
--- a/IdentitySet.st Wed Nov 20 15:12:13 2013 +0000
+++ b/IdentitySet.st Mon Nov 25 10:37:44 2013 +0000
@@ -62,8 +62,14 @@
!IdentitySet methodsFor:'adding & removing'!
-removeIdentical:anObject ifAbsent:exceptionBlock
- ^ super remove:anObject ifAbsent:exceptionBlock
+removeIdentical:oldObject ifAbsent:exceptionBlock
+ "remove oldObject from the collection and return it.
+ If it was not in the collection return the value of exceptionBlock.
+ Uses identity compare (==) to search for an occurrence.
+
+ WARNING: do not remove elements while iterating over the receiver."
+
+ ^ self remove:oldObject ifAbsent:exceptionBlock
! !
!IdentitySet methodsFor:'converting'!
@@ -160,6 +166,12 @@
]
!
+findIdentical:key ifAbsent:aBlock
+ "IdentitySet does identity compare anyway..."
+
+ ^ self find:key ifAbsent:aBlock
+!
+
findKeyOrNil:key
"Look for the key in the receiver.
If it is found, return return the index of the first unused slot.
@@ -271,6 +283,6 @@
!IdentitySet class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/IdentitySet.st,v 1.36 2013-04-03 09:11:25 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/IdentitySet.st,v 1.37 2013-11-12 18:10:56 stefan Exp $'
! !
--- a/NonPositionableExternalStream.st Wed Nov 20 15:12:13 2013 +0000
+++ b/NonPositionableExternalStream.st Mon Nov 25 10:37:44 2013 +0000
@@ -513,6 +513,13 @@
^ super next
!
+nextLine
+ "Redefined, to wait on pipes and sockets"
+
+ self readWait.
+ ^ super nextLine
+!
+
nextOrNil
"like #next, this returns the next element, if available.
If nothing is available, this does never raise a read-beyond end signal.
@@ -568,10 +575,10 @@
!NonPositionableExternalStream class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/NonPositionableExternalStream.st,v 1.63 2013-08-29 09:51:47 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/NonPositionableExternalStream.st,v 1.64 2013-10-28 17:28:00 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/NonPositionableExternalStream.st,v 1.63 2013-08-29 09:51:47 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/NonPositionableExternalStream.st,v 1.64 2013-10-28 17:28:00 stefan Exp $'
! !
--- a/OSXOperatingSystem.st Wed Nov 20 15:12:13 2013 +0000
+++ b/OSXOperatingSystem.st Mon Nov 25 10:37:44 2013 +0000
@@ -20,27 +20,13 @@
"Modified: / 5.6.1998 / 18:35:18 / cg"
! !
-!OSXOperatingSystem class methodsFor:'users & groups'!
-
-getDesktopDirectory
- "{ Pragma: +optSpace }"
-
- "return the name of the user's desktop directory."
-
- ^ self getHomeDirectory,'/Desktop'
-
- "
- OperatingSystem getDesktopDirectory
- "
-! !
-
!OSXOperatingSystem class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/OSXOperatingSystem.st,v 1.2 2013-09-25 18:41:05 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/OSXOperatingSystem.st,v 1.3 2013-11-12 11:18:08 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/OSXOperatingSystem.st,v 1.2 2013-09-25 18:41:05 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/OSXOperatingSystem.st,v 1.3 2013-11-12 11:18:08 stefan Exp $'
! !
--- a/Object.st Wed Nov 20 15:12:13 2013 +0000
+++ b/Object.st Mon Nov 25 10:37:44 2013 +0000
@@ -3283,7 +3283,7 @@
"Modified: / 28-08-2013 / 21:41:54 / cg"
!
-tracePoint:someKey message:message
+tracePoint:someKey message:messageBlockOrString
"{ Pragma: +optSpace }"
"Like transcript show, but disabled by default.
@@ -3294,17 +3294,18 @@
"Example: nil tracePoint:#stefan"
(self isBreakPointEnabled:someKey) ifTrue:[
- ^ Transcript showCR:('Tracepoint: %4 (at %1 for %3 from %2)'
+ Transcript showCR:('Tracepoint: %4 (at %1 for %3 from %2)'
bindWith:(Timestamp now printString)
with:(thisContext sender printString)
with:someKey
- with:message)
- ].
-
- "
- nil tracePoint:#stefan
- nil tracePoint:#stefan message:'Hello'
+ with:messageBlockOrString value)
+ ].
+
+ "
Smalltalk enableBreakPoint:#stefan.
+ nil tracePoint:#stefan.
+ nil tracePoint:#stefan message:'Hello'.
+ nil tracePoint:#stefan message:['Hello from block'].
Smalltalk disableBreakPoint:#stefan.
"
@@ -6662,6 +6663,70 @@
}
%}.
^ self perform:aSelector withArguments:#()
+!
+
+returnablePerform:aSelector with:arg
+ "send the one-arg-message aSelector to the receiver.
+ This is the same as #perform:with: but the context can return."
+
+ <context: #return>
+%{
+ REGISTER OBJ sel = aSelector;
+
+ if (InterruptPending == nil) {
+ struct inlineCache *pIlc;
+ /* JV @ 2010-22-07: To improve performance I use 256 ILCs instead
+ of default 4. For details, see comment in perform: */
+
+#define SEL_AND_ILC_INIT_1(l) { nil , __ILCPERF1(l) }
+#define SEL_AND_ILC_INIT_2(l) SEL_AND_ILC_INIT_1(l) , SEL_AND_ILC_INIT_1(l)
+#define SEL_AND_ILC_INIT_4(l) SEL_AND_ILC_INIT_2(l) , SEL_AND_ILC_INIT_2(l)
+#define SEL_AND_ILC_INIT_8(l) SEL_AND_ILC_INIT_4(l) , SEL_AND_ILC_INIT_4(l)
+#define SEL_AND_ILC_INIT_16(l) SEL_AND_ILC_INIT_8(l) , SEL_AND_ILC_INIT_8(l)
+#define SEL_AND_ILC_INIT_32(l) SEL_AND_ILC_INIT_16(l) , SEL_AND_ILC_INIT_16(l)
+#define SEL_AND_ILC_INIT_32(l) SEL_AND_ILC_INIT_16(l) , SEL_AND_ILC_INIT_16(l)
+#define SEL_AND_ILC_INIT_64(l) SEL_AND_ILC_INIT_32(l) , SEL_AND_ILC_INIT_32(l)
+#define SEL_AND_ILC_INIT_128(l) SEL_AND_ILC_INIT_64(l) , SEL_AND_ILC_INIT_64(l)
+#define SEL_AND_ILC_INIT_256(l) SEL_AND_ILC_INIT_128(l) , SEL_AND_ILC_INIT_128(l)
+#define nilcs 256
+
+ static struct { OBJ sel; struct inlineCache ilc; } sel_and_ilc[nilcs] = { SEL_AND_ILC_INIT_256(29) };
+
+#undef SEL_AND_ILC_INIT_1
+#undef SEL_AND_ILC_INIT_2
+#undef SEL_AND_ILC_INIT_4
+#undef SEL_AND_ILC_INIT_8
+#undef SEL_AND_ILC_INIT_16
+#undef SEL_AND_ILC_INIT_32
+#undef SEL_AND_ILC_INIT_64
+#undef SEL_AND_ILC_INIT_128
+#undef SEL_AND_ILC_INIT_256
+
+ static flip = 0;
+ int i;
+ for (i = 0; i < nilcs; i++) {
+ if (sel == sel_and_ilc[i].sel) {
+ pIlc = &sel_and_ilc[i].ilc;
+ goto perform1_send_and_return;
+ }
+ }
+ /*printf("Object >> #perform: #%s with: arg --> no PIC found\n", __symbolVal(aSelector));*/
+ pIlc = &sel_and_ilc[flip].ilc;
+ sel_and_ilc[flip].sel = sel;
+ flip = (flip + 1) % nilcs;
+ pIlc->ilc_func = __SEND1ADDR__;
+ if (pIlc->ilc_poly) {
+ __flushPolyCache(pIlc->ilc_poly);
+ pIlc->ilc_poly = 0;
+ }
+perform1_send_and_return:
+ RETURN ( (*(pIlc->ilc_func))(self, sel, nil, pIlc, arg) );
+ } else {
+ static struct inlineCache ilc1 = __DUMMYILCSELF1(@line+1);
+ RETURN (_SEND1(self, aSelector, nil, &ilc1, arg));
+ }
+%}.
+ ^ self perform:aSelector withArguments:(Array with:arg)
! !
!Object methodsFor:'object persistency'!
@@ -9862,11 +9927,11 @@
!Object class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Object.st,v 1.739 2013-10-11 17:18:12 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Object.st,v 1.741 2013-11-12 18:09:57 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/Object.st,v 1.739 2013-10-11 17:18:12 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Object.st,v 1.741 2013-11-12 18:09:57 stefan Exp $'
!
version_HG
--- a/OrderedDictionary.st Wed Nov 20 15:12:13 2013 +0000
+++ b/OrderedDictionary.st Mon Nov 25 10:37:44 2013 +0000
@@ -73,6 +73,7 @@
[author:]
Ifor Wyn Williams <ifor@uk.ac.man.cs>
+ Changed by: exept
[see also:]
OrderedCollection Dictionary
@@ -144,17 +145,21 @@
!OrderedDictionary methodsFor:'accessing'!
-after: anAssociation
+after:anAssociation
"Return the association after anAssociation in the order.
- If anAssociation is the last association in the order, return nil.
+ If anAssociation is the last association in the order, return nil.
If anAssociation is not found, invoke an error notifier"
- 1 to: order size - 1 do: [:index | (self associationAt: (order at: index))
- = anAssociation ifTrue: [^self associationAt: (order at: index + 1)]].
- (self associationAt: (order last))
- = anAssociation
- ifTrue: [^nil]
- ifFalse: [^self error: 'not found']
+ |sz "{ Class:SmallInteger }"|
+
+ sz := order size.
+ 1 to:sz do:[:index |
+ (self associationAt:(order at:index)) = anAssociation ifTrue:[
+ index == sz ifTrue:[^ nil].
+ ^ self associationAt:(order at:index + 1)
+ ]
+ ].
+ ^ self errorNotFound:anAssociation.
!
associations
@@ -164,23 +169,17 @@
!
at:aKey ifAbsentPut:valueBlock
- |val|
-
- ^ self at:aKey ifAbsent:[ self at:aKey put:valueBlock value ]
+ ^ self at:aKey ifAbsent:[self at:aKey put:valueBlock value]
!
-at: key put: anObject
+at:key put:anObject
"Set the value at key to be anObject.
If key is not found, create a new entry for key and set its value to anObject.
If key is already present, the order remains unchanged.
Return anObject."
- "/ claus: super can check this much faster ...
- "/ (super includesKey:key)
- "/ ... but that leads to trouble in add:* methods. (sigh)
-
- (order includes: key) ifFalse: [order add: key].
- ^ super at: key put: anObject
+ (self includesKey: key) ifFalse:[order add: key].
+ ^ super at:key put:anObject
!
atAll:indexCollection put: anObject
@@ -193,7 +192,7 @@
atAllPut: anObject
"Put anObject into the value field of every association in the dictionary"
- order do: [:key | self at: key put: anObject]
+ order do:[:key | super at: key put:anObject]
!
atIndex:index
@@ -211,7 +210,7 @@
!
atIndex:index put:anAssociation
- "put an association to a given index. remove the old associatioan at this index"
+ "put an association to a given index. remove the old association at this index"
|key|
key := anAssociation key.
@@ -220,22 +219,27 @@
].
super removeKey:(order at:index) ifAbsent:[].
order at:index put:key.
- ^ super add:anAssociation.
+ super at:key put:anAssociation value.
+ ^ anAssociation.
"Created: 28.9.1995 / 16:30:15 / stefan"
!
-before: anAssociation
+before:anAssociation
"Return the association before anAssociation in the order.
- If anAssociation is the first association in the order, return nil.
+ If anAssociation is the first association in the order, return nil.
If anAssociation is not found, invoke an error notifier"
+
+ |sz "{ Class:SmallInteger }"|
- 2 to:order size do:[:index |
- (self associationAt:(order at:index)) = anAssociation
- ifTrue:[ ^ self associationAt:(order at:index - 1)]
+ sz := order size.
+ 1 to:sz do:[:index |
+ (self associationAt:(order at:index)) = anAssociation ifTrue:[
+ index == 1 ifTrue:[^ nil].
+ ^ self associationAt:(order at:index - 1)
+ ]
].
- (self associationAt:order first) = anAssociation ifTrue: [^ nil].
- ^ self error: 'not found'
+ ^ self errorNotFound:anAssociation.
!
first
@@ -307,7 +311,7 @@
valueAt:index
"get the value at the given index"
- ^ super at:(order at:index).
+ ^ self at:(order at:index).
"
|s|
@@ -321,58 +325,52 @@
values
"Return a OrderedCollection containing the receiver's values."
- ^ order collect: [:key | (self at: key) ].
+ ^ order collect:[:key | self at:key].
! !
!OrderedDictionary methodsFor:'adding'!
-add: anAssociation
- "add anAssociation to the dictionary.
- If anAssociation is already present in the dictionary,
- the order will not be changed. (See also: #addLast:)"
-
- | key |
-
- key := anAssociation key.
- (super includesKey: key) ifFalse: [order add: key].
- ^ super add: anAssociation
-!
-
add: anAssociation after: oldAssociation
"Add the argument, anAssociation, as an element of the dictionary. Put it
in the position just succeeding oldAssociation. Return anAssociation."
- | index |
+ | index key |
index := self indexOfAssociation: oldAssociation
- ifAbsent: [self error: 'association not found'].
- self removeFromOrder: anAssociation key.
- order add: anAssociation key after: (order at: index).
- super add: anAssociation.
+ ifAbsent: [^ self errorNotFound:anAssociation].
+ key := anAssociation key.
+ order remove:key ifAbsent:[].
+ order add:key after:(order at: index).
+ super at:key put:anAssociation value.
^ anAssociation
!
-add: anAssociation before: oldAssociation
+add:anAssociation before:oldAssociation
"Add the argument, anAssociation, as an element of the dictionary. Put it
in the position just preceding oldAssociation. Return anAssociation."
- | index |
+ | index key |
index := self indexOfAssociation: oldAssociation
- ifAbsent: [self error: 'association not found'].
- self removeFromOrder: anAssociation key.
- order add: anAssociation key before: (order at: index).
- super add: anAssociation.
+ ifAbsent: [^ self errorNotFound:anAssociation].
+ key := anAssociation key.
+ order remove:key ifAbsent:[].
+ order add:key before:(order at: index).
+ super at:key put:anAssociation value.
^ anAssociation
!
-add: anAssociation beforeIndex: spot
+add:anAssociation beforeIndex:spot
"Add the argument, anAssociation, as an element of the receiver. Put it
in the position just preceding the indexed position spot. Return newObject."
- self removeFromOrder: anAssociation key.
- order add: anAssociation key beforeIndex: spot.
- ^ super add: anAssociation
+ |key|
+
+ key := anAssociation key.
+ order remove:key ifAbsent:[].
+ order add:key beforeIndex:spot.
+ super at:key put:anAssociation value.
+ ^ anAssociation
"Modified: 28.9.1995 / 14:06:53 / stefan"
!
@@ -383,8 +381,7 @@
if it does not (i.e. it is another OD or a dictionary), use #addAllAssociationsFirst:.
Returns the argument, aCollectionOfAssociations (sigh)."
- self addAllLast:aCollectionOfAssociations.
- ^ aCollectionOfAssociations
+ ^ self addAllLast:aCollectionOfAssociations.
"Modified: 28.2.1997 / 15:51:23 / cg"
!
@@ -393,8 +390,7 @@
"Add each association of aDictionaryOrOrderedDictionary to my end.
We expect the argument to respond to #associationsDo:."
- self addAllAssociationsLast:aDictionaryOrOrderedDictionary.
- ^ aDictionaryOrOrderedDictionary
+ ^ self addAllAssociationsLast:aDictionaryOrOrderedDictionary.
"Created: 28.2.1997 / 15:52:02 / cg"
!
@@ -419,22 +415,30 @@
"Created: 28.2.1997 / 15:48:37 / cg"
!
-addFirst: anAssociation
+addFirst:anAssociation
"Add anAssociation to the beginning of the receiver."
- self removeFromOrder: anAssociation key.
- order addFirst: anAssociation key.
- ^ super add: anAssociation.
+ |key|
+
+ key := anAssociation key.
+ order remove:key ifAbsent:[].
+ order addFirst:key.
+ super at:key put:anAssociation value.
+ ^ anAssociation
!
-addLast: anAssociation
+addLast:anAssociation
"Add anAssociation to the end of the receiver.
If anAssociation is already present in the dictionary,
it will be moved to the end. (See also: #add:)"
- self removeFromOrder: anAssociation key.
- order add: anAssociation key.
- ^ super add: anAssociation.
+ |key|
+
+ key := anAssociation key.
+ order remove:key ifAbsent:[].
+ order add:key.
+ super at:key put:anAssociation value.
+ ^ anAssociation
! !
!OrderedDictionary methodsFor:'copying'!
@@ -442,29 +446,25 @@
copyEmpty
"Return a copy of the receiver that contains no elements."
- ^ (self class) new: 10
+ ^ self species new: 10
!
-copyFrom: startIndex to: endIndex
+copyFrom:startIndex to:endIndex
"Return a copy of the receiver that contains elements from
position startIndex to endIndex."
+
+ |newDict|
- | newDict |
- endIndex < startIndex ifTrue: [^self copyEmpty].
- (startIndex < 1 or: [endIndex > order size])
- ifTrue: [^ self errorNotFound].
- newDict := self copyEmpty: endIndex - startIndex + 1.
- startIndex to: endIndex do: [:index | newDict add: (self associationAt: (order at: index))].
- ^ newDict
-!
-
-copyWith: anAssociation
- "Return a copy of the dictionary that is 1 bigger than the receiver and
- includes the argument, anAssociation, at the end."
-
- | newDict |
- newDict := self copy.
- newDict add: anAssociation.
+ endIndex < startIndex ifTrue:[
+ ^ self copyEmpty
+ ].
+ (startIndex < 1 or:[ endIndex > order size ]) ifTrue:[
+ ^ self errorNotFound
+ ].
+ newDict := self copyEmpty:endIndex - startIndex + 1.
+ startIndex to:endIndex do:[:index |
+ newDict add:(self associationAt:(order at:index))
+ ].
^ newDict
!
@@ -474,8 +474,8 @@
No error is reported, if elementToSkip is not in the collection."
| newDict |
- newDict := self class new:order size - 1.
- self associationsDo: [:assoc | anAssociation = assoc ifFalse: [newDict add: assoc]]
+ newDict := self species new:order size - 1.
+ self associationsDo:[:assoc | anAssociation = assoc ifFalse:[newDict add:assoc]]
!
postCopy
@@ -524,13 +524,13 @@
|newDict|
- newDict := self class new.
+ newDict := self species new.
order do:[:key |
|assoc|
assoc := self associationAt:key.
(aBlock value:assoc) ifTrue: [
- newDict add:assoc
+ newDict at:key put:assoc value.
]
].
^ newDict
@@ -552,8 +552,8 @@
order do:[:key |
|el|
-
- (aBlock value: (el := self at:key)) ifTrue:[^ el]
+ el := self at:key.
+ (aBlock value:el) ifTrue:[^ el]
].
^ exceptionBlock value
!
@@ -564,9 +564,10 @@
order do: [:key | aBlock value: (self at: key)]
!
-do: aBlock from: firstIndex to: lastIndex
- "Evaluate aBlock with each of the dictionary's associations from index
- firstIndex to index secondIndex as the argument."
+do: aBlock from: firstIndex to: lastIndex
+ <resource: #obsolete>
+
+ self obsoleteMethodWarning:'use #from:to:do:'.
self from:firstIndex to:lastIndex do:aBlock.
!
@@ -575,7 +576,10 @@
"Return the index of the first association in the dictionary for which aBlock
evaluates as true. If the block does not evaluate to true, return exceptionalValue"
- 1 to:order size do:[:index |
+ |stop "{ Class: SmallInteger }" |
+
+ stop := order size.
+ 1 to:stop do:[:index |
(aBlock value:(self associationAt:(order at:index))) ifTrue: [^ index]
].
^ exceptionalValue value
@@ -585,7 +589,10 @@
"Return the index of the last association in the dictionary for which aBlock
evaluates as true. If the block does not evaluate to true, return 0"
- order size to:1 by:-1 do: [:index |
+ |start "{ Class: SmallInteger }"|
+
+ start := order size.
+ start to:1 by:-1 do: [:index |
(aBlock value:(self associationAt:(order at:index))) ifTrue: [^ index]
].
^ 0
@@ -596,7 +603,10 @@
evaluates as true. Start the backward search at startIndex.
If the block does not evaluate to true, return 0"
- startIndex to:1 by:-1 do: [:index |
+ |start "{ Class: SmallInteger }"|
+
+ start := startIndex.
+ start to:1 by:-1 do: [:index |
(aBlock value:(self associationAt:(order at:index))) ifTrue: [^ index]
].
^ 0
@@ -608,7 +618,12 @@
End the search at endIndex or when an element is found.
If the block does not evaluate to true, return 0"
- startIndex to:endIndex by:-1 do: [:index |
+ |start "{ Class: SmallInteger }"
+ end "{ Class: SmallInteger }"|
+
+ start := startIndex.
+ end := endIndex.
+ start to:end by:-1 do: [:index |
(aBlock value:(self associationAt:(order at:index))) ifTrue: [^ index]
].
^ 0
@@ -618,7 +633,12 @@
"Evaluate aBlock with each of the dictionary's associations from index
firstIndex to index secondIndex as the argument."
- order from:firstIndex to:lastIndex do:[:key |
+ |start "{ Class:SmallInteger }"
+ stop "{ Class:SmallInteger }" |
+
+ start := firstIndex. "/ these assignments force type checking...
+ stop := lastIndex. "/ and guarantee inline loop code below.
+ order from:start to:stop do:[:key |
aBlock value: (self at:key)
].
!
@@ -632,8 +652,8 @@
order do:[:key |
|el|
-
- (aBlock value:key value: (el := self at:key)) ifTrue:[^ el]
+ el := self at:key.
+ (aBlock value:key value:el) ifTrue:[^ el]
].
^ exceptionBlock value
!
@@ -650,7 +670,7 @@
WARNING: do not add/remove elements while iterating over the receiver.
Iterate over a copy to do this."
- order do: [:key | aBlock value:key value:(self at: key)].
+ order do:[:key | aBlock value:key value:(self at: key)].
"Modified: / 26.6.1999 / 10:55:30 / ps"
"Created: / 15.10.1999 / 16:49:31 / cg"
@@ -697,7 +717,10 @@
"Evaluate aBlock with each of the dictionary's associations as the argument,
starting with the last element and taking each in sequence up to the first."
- order size to:1 by:-1 do: [:index |
+ |sz "{ Class:SmallInteger }"|
+
+ sz := order size.
+ sz to:1 by:-1 do: [:index |
aBlock value:(self associationAt:(order at:index))
]
!
@@ -705,16 +728,7 @@
reversed
"Return with a new OrderedDictionary with its associations in reverse order."
- | newDict|
-
- newDict := self class new.
- order size to:1 by:-1 do:[:index |
- |key|
-
- key := order at:index.
- newDict at:key put:(self at:key)
- ].
- ^ newDict
+ ^ self copy reverse.
!
select:aBlock
@@ -726,11 +740,11 @@
newColl := self species new.
order do:[:key |
- |assoc|
+ |val|
- assoc := self associationAt:key.
- (aBlock value:(assoc value)) ifTrue: [
- newColl add:assoc
+ val := self at:key.
+ (aBlock value:val) ifTrue:[
+ newColl at:key put:val.
]
].
^ newColl
@@ -744,8 +758,10 @@
!OrderedDictionary methodsFor:'private'!
-removeFromOrder: aKey
- order remove: aKey ifAbsent: []
+removeFromOrder: aKey
+ <resource: #obsolete>
+
+ order remove: aKey ifAbsent: []
! !
!OrderedDictionary methodsFor:'queries'!
@@ -785,9 +801,8 @@
|key|
order size == 0 ifTrue:[
- "error if collection is empty"
-
- ^ self emptyCollectionError.
+ "error if collection is empty"
+ ^ self emptyCollectionError.
].
key := order removeFirst.
^ super removeKey:key.
@@ -796,25 +811,35 @@
removeFromIndex:fromIndex toIndex:toIndex
"Returns the receiver."
- | keys |
+ |start "{ Class:SmallInteger }"
+ stop "{ Class:SmallInteger }" |
- keys := order copyFrom:fromIndex to:toIndex.
- order removeFromIndex:fromIndex toIndex:toIndex.
- keys do:[ :key |
+ start := fromIndex.
+ stop := toIndex.
+
+ order from:start to:stop do:[:key |
super removeKey:key.
].
+ order removeFromIndex:fromIndex toIndex:toIndex.
"Created: 28.9.1995 / 12:04:33 / stefan"
!
+removeIndex:anInteger
+ self removeFromIndex:anInteger toIndex:anInteger.
+!
+
removeKey:aKey
order remove:aKey.
^ super removeKey:aKey.
!
removeKey:aKey ifAbsent:aBlock
+ |oldValue|
+
+ oldValue := super removeKey:aKey ifAbsent:aBlock.
order remove:aKey ifAbsent:[].
- ^ super removeKey:aKey ifAbsent:aBlock.
+ ^ oldValue.
"Created: / 31-01-2011 / 22:04:01 / cg"
!
@@ -935,7 +960,12 @@
"Return the next index of aAssociation within the receiver between startIndex
and stopIndex. If the receiver does not contain aAssociation, return nil"
- startIndex to: stopIndex do: [:i |
+ |start "{ Class:SmallInteger }"
+ stop "{ Class:SmallInteger }"|
+
+ start := startIndex.
+ stop := stopIndex.
+ start to: stop do: [:i |
(self associationAt: (order at: i)) = aAssociation ifTrue: [^i]].
^nil
!
@@ -944,7 +974,12 @@
"Return the next index of aKey within the receiver between startIndex and
stopIndex. If the receiver does not contain aKey, return nil"
- startIndex to: stopIndex do: [:i |
+ |start "{ Class:SmallInteger }"
+ stop "{ Class:SmallInteger }"|
+
+ start := startIndex.
+ stop := stopIndex.
+ start to: stop do: [:i |
(order at: i) = aKey ifTrue: [^i]].
^nil
!
@@ -953,7 +988,12 @@
"Return the next index of aValue within the receiver between startIndex and
stopIndex. If the receiver does not contain aValue, return nil"
- startIndex to: stopIndex do: [:i |
+ |start "{ Class:SmallInteger }"
+ stop "{ Class:SmallInteger }" |
+
+ start := startIndex.
+ stop := stopIndex.
+ start to: stop do: [:i |
(self at: (order at: i)) = aValue ifTrue: [^i]].
^nil
!
@@ -963,7 +1003,12 @@
startIndex and stopIndex working backwards through the receiver.
If the receiver does not contain aAssociation, return nil"
- startIndex to: stopIndex by: -1
+ |start "{ Class:SmallInteger }"
+ stop "{ Class:SmallInteger }"|
+
+ start := startIndex.
+ stop := stopIndex.
+ start to: stop by: -1
do: [:i | (self associationAt: (order at: i)) = aAssociation ifTrue: [^i]].
^nil
!
@@ -973,20 +1018,32 @@
stopIndex working backwards through the receiver.
If the receiver does not contain aKey, return nil"
- startIndex to: stopIndex by: -1
+ |start "{ Class:SmallInteger }"
+ stop "{ Class:SmallInteger }"|
+
+ start := startIndex.
+ stop := stopIndex.
+ start to: stop by: -1
do: [:i | (order at: i) = aKey ifTrue: [^i]].
^nil
!
-prevIndexOfValue: aValue from: startIndex to: stopIndex
+prevIndexOfValue:aValue from:startIndex to:stopIndex
"Return the previous index of aValue within the receiver between startIndex
- and stopIndex working backwards through the receiver.
+ and stopIndex working backwards through the receiver.
If the receiver does not contain aValue, return nil"
+
+ |start "{ Class:SmallInteger }"
+ stop "{ Class:SmallInteger }"|
- startIndex to: stopIndex by: -1
- do: [:i |
- (self at: (order at: i)) = aValue ifTrue: [^i]].
- ^nil
+ start := startIndex.
+ stop := stopIndex.
+ start to:stop by:-1 do:[:i |
+ (self at:(order at:i)) = aValue ifTrue:[
+ ^ i
+ ]
+ ].
+ ^ nil
! !
!OrderedDictionary methodsFor:'sorting & reordering'!
@@ -1016,10 +1073,10 @@
!OrderedDictionary class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/OrderedDictionary.st,v 1.44 2013-09-15 10:43:49 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/OrderedDictionary.st,v 1.45 2013-11-08 15:12:05 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/OrderedDictionary.st,v 1.44 2013-09-15 10:43:49 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/OrderedDictionary.st,v 1.45 2013-11-08 15:12:05 stefan Exp $'
! !
--- a/PCFilename.st Wed Nov 20 15:12:13 2013 +0000
+++ b/PCFilename.st Mon Nov 25 10:37:44 2013 +0000
@@ -362,15 +362,35 @@
renameTo:newName
"rename the file - the argument must be convertable to a String.
Raise an error if not successful.
- Redefined to delete any existing target-file first."
+ Redefined to delete any existing target-file first.
+ Also take care of possible locks by antivirus scanners, that go away after some time."
+
+ |retryCtr newFilename|
- newName asFilename exists ifTrue:[
- (self pathName sameAs:newName asFilename pathName) ifFalse:[
- newName asFilename delete
+ newFilename := newName asFilename.
+ newFilename exists ifTrue:[
+ (self pathName sameAs:newFilename pathName) ifFalse:[
+ newFilename delete
].
].
- ^ super renameTo:newName
+ "try 5 times if file has just been written to and is locked by a virus scanner"
+ retryCtr := 5.
+ OperatingSystem accessDeniedErrorSignal handle:[:ex|
+ retryCtr := retryCtr - 1.
+ retryCtr > 0 ifTrue:[
+ ('stx: Error cought while renaming %1 to %2 - maybe temporary locked by virus scanner, still trying: %3'
+ bindWith:self pathName
+ with:newFilename pathName
+ with:ex description) infoPrintCR.
+ ] ifFalse:[
+ ex reject
+ ].
+ Delay waitForMilliseconds:200.
+ ex restart.
+ ] do:[
+ ^ super renameTo:newName
+ ].
"
'\tmp\foo' asFilename renameTo:'\tmp\bar'
@@ -887,14 +907,14 @@
!PCFilename class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/PCFilename.st,v 1.60 2013-07-16 17:51:30 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/PCFilename.st,v 1.61 2013-11-21 15:03:39 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/PCFilename.st,v 1.60 2013-07-16 17:51:30 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/PCFilename.st,v 1.61 2013-11-21 15:03:39 stefan Exp $'
!
version_SVN
- ^ '$Id: PCFilename.st,v 1.60 2013-07-16 17:51:30 cg Exp $'
+ ^ '$Id: PCFilename.st,v 1.61 2013-11-21 15:03:39 stefan Exp $'
! !
--- a/SequenceableCollection.st Wed Nov 20 15:12:13 2013 +0000
+++ b/SequenceableCollection.st Mon Nov 25 10:37:44 2013 +0000
@@ -1960,6 +1960,33 @@
"
!
+compareWith:aSequenceableCollection
+ "Compare the receiver with the argument and return 1 if the receiver is
+ greater, 0 if equal and -1 if less than the argument."
+
+ |mySize "{ Class: SmallInteger }"
+ otherSize "{ Class: SmallInteger }"
+ n "{ Class: SmallInteger }"
+ e1 e2|
+
+ mySize := self size.
+ otherSize := aSequenceableCollection size.
+ n := mySize min:otherSize.
+
+ 1 to:n do:[:index |
+ e1 := self at:index.
+ e2 := aSequenceableCollection at:index.
+ e1 ~~ e2 ifTrue:[
+ "identity compare is faster"
+ e1 > e2 ifTrue:[^ 1].
+ e1 < e2 ifTrue:[^ -1].
+ ].
+ ].
+ mySize > otherSize ifTrue:[^ 1].
+ mySize < otherSize ifTrue:[^ -1].
+ ^ 0
+!
+
deepSameContentsAs:aCollection
"return true, if the receiver and the arg have the same contents
in both the named instance vars and any indexed instVars.
@@ -2079,45 +2106,6 @@
"Modified: / 27.3.1998 / 17:33:49 / cg"
!
-identicalContentsAs:aCollection
- "return true if the receiver and aCollection represent collections
- with identical contents. This is much like #=, but compares
- elements using #== instead of #=."
-
- ^ self
- sameContentsAs:aCollection
- whenComparedWith:[:a :b | a == b]
-
-"/ |index "{ Class: SmallInteger }"
-"/ stop "{ Class: SmallInteger }" |
-"/
-"/ (aCollection == self) ifTrue:[^ true].
-"/ (aCollection size == self size) ifFalse:[^ false].
-"/ (aCollection isSequenceable) ifFalse:[^ aCollection identicalContentsAs:self].
-"/
-"/ stop := self size.
-"/ stop == (aCollection size) ifFalse:[^ false].
-"/
-"/ index := 1.
-"/ [index <= stop] whileTrue:[
-"/ (self at:index) == (aCollection at:index) ifFalse:[^ false].
-"/ index := index + 1
-"/ ].
-"/ ^ true
-
- "
- #(1 2 3 4 5) = #(1 2 3 4 5)
- #(1 2 3 4 5) = #(1.0 2 3 4.0 5)
- #($1 $2 $3 $4 $5) = '12345'
-
- #(1 2 3 4 5) identicalContentsAs:#(1 2 3 4 5)
- #(1 2 3 4 5) identicalContentsAs: #(1.0 2 3 4.0 5)
- #($1 $2 $3 $4 $5) identicalContentsAs: '12345'
- "
-
- "Modified: / 31.10.2001 / 11:30:18 / cg"
-!
-
isSameSequenceAs:otherCollection
"Answer whether the receiver's size is the same as otherCollection's size,
and each of the receiver's elements equal the corresponding element of otherCollection.
@@ -2125,6 +2113,7 @@
| size |
+ (otherCollection == self) ifTrue:[^ true].
(size := self size) = otherCollection size ifFalse: [^ false].
otherCollection isSequenceable ifFalse: [^ false].
@@ -2140,29 +2129,24 @@
Redefinded, so that SequenceableCollections are equivalent,
especially OrderedCollections with unused space"
- |index "{ Class: SmallInteger }"
- stop "{ Class: SmallInteger }" |
+ |stop "{ Class: SmallInteger }" |
(aCollection == self) ifTrue:[^true].
(aCollection isSequenceable) ifFalse:[
- aCollection with:self do:[:e1 :e2 |
- (e1 = e2) ifFalse:[^false].
- ].
- ^ true
+ ^ aCollection sameContentsAs:self.
].
stop := self size.
stop == (aCollection size) ifFalse:[^false].
- index := 1.
- [index <= stop] whileTrue:[
- ((self at:index) = (aCollection at:index)) ifFalse:[^false].
- index := index + 1
+ 1 to:stop do:[:index|
+ ((self at:index) = (aCollection at:index)) ifFalse:[^ false].
].
^ true
"
#(1 2 3 4 5) sameContentsAs: #(1 2 3 4 5) copy
+ #(1 2 3 4 5) asSet sameContentsAs: #(1 2 3 4 5) copy
#($1 $2 $3 $4 $5) sameContentsAs: #(1 2 3 4 5)
#($1 $2 $3 $4 $5) sameContentsAs: '12345'
#($1 $2 $3 $4 $5) sameContentsAs: '54321' asSortedCollection
@@ -2179,27 +2163,25 @@
and #identicalContentsAs: is the same as #sameContentsAs:whenComparedUsing:#==.
"
- |index "{ Class: SmallInteger }"
- stop "{ Class: SmallInteger }" |
+ |stop "{ Class: SmallInteger }" |
(aCollection == self) ifTrue:[^ true].
(aCollection size == self size) ifFalse:[^ false].
(aCollection isSequenceable) ifFalse:[
- ^ aCollection sameContentsAs:self whenComparedWith:compareBlock
+ ^ aCollection sameContentsAs:self whenComparedWith:compareBlock
].
stop := self size.
stop == (aCollection size) ifFalse:[^ false].
- index := 1.
- [index <= stop] whileTrue:[
- (compareBlock value:(self at:index) value:(aCollection at:index)) ifFalse:[^ false].
- index := index + 1
+ 1 to:stop do:[:index|
+ (compareBlock value:(self at:index) value:(aCollection at:index)) ifFalse:[^ false].
].
^ true
"
#(1 2 3 4 5) sameContentsAs: #(1 2 3 4 5) whenComparedWith:[:a :b | a = b]
+ #(1 2 3 4 5) sameContentsAs: #(1 2 3 4 5) asSet whenComparedWith:[:a :b | a = b]
#(1 2 3 4 5) sameContentsAs: #(1 2 3 4 5) whenComparedWith:[:a :b | a == b]
#(1 2 3 4 5) sameContentsAs: #(1.0 2 3 4.0 5) whenComparedWith:[:a :b | a = b]
#(1 2 3 4 5) sameContentsAs: #(1.0 2 3 4.0 5) whenComparedWith:[:a :b | a == b]
@@ -7211,11 +7193,13 @@
End the search at endIndex or when an element is found.
Return its index or 0 if none detected."
- |start "{ Class: SmallInteger }"|
+ |start "{ Class: SmallInteger }"
+ end "{ Class: SmallInteger }"|
start := startIndex.
- start to:endIndex by:-1 do:[:index |
- (aBlock value:(self at:index)) ifTrue:[^ index].
+ end := endIndex.
+ start to:end by:-1 do:[:index |
+ (aBlock value:(self at:index)) ifTrue:[^ index].
].
^ 0
@@ -9233,11 +9217,11 @@
!SequenceableCollection class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.353 2013-10-25 12:21:01 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.355 2013-11-14 15:32:31 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.353 2013-10-25 12:21:01 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.355 2013-11-14 15:32:31 stefan Exp $'
! !
--- a/Set.st Wed Nov 20 15:12:13 2013 +0000
+++ b/Set.st Mon Nov 25 10:37:44 2013 +0000
@@ -198,6 +198,7 @@
"Created: / 24.10.1997 / 23:13:44 / cg"
! !
+
!Set methodsFor:'Compatibility-ST80'!
initialIndexFor:hashKey boundedBy:length
@@ -421,6 +422,55 @@
"Modified: 12.4.1996 / 13:35:06 / cg"
!
+removeIdentical:oldObjectArg ifAbsent:exceptionBlock
+ "remove oldObject from the collection and return it.
+ If it was not in the collection return the value of exceptionBlock.
+ Uses identity compare (==) to search for an occurrence.
+
+ WARNING: do not remove elements while iterating over the receiver.
+ See #saveRemove: to do this."
+
+ |oldObject index next|
+
+ oldObjectArg isNil ifTrue:[
+ oldObject := NilEntry.
+ ] ifFalse:[
+ oldObject := oldObjectArg.
+ ].
+
+ "first a quick check.
+ There is a high possibility that objects, which are
+ equal are also identical"
+ index := self find:oldObject ifAbsent:0.
+ index ~~ 0 ifTrue:[
+ oldObject ~~ (keyArray basicAt:index) ifTrue:[
+ index := 0.
+ ]
+ ].
+ index == 0 ifTrue:[
+ "have to go the long and hard path..."
+ index := self findIdentical:oldObject ifAbsent:0.
+ index == 0 ifTrue:[^ exceptionBlock value].
+ ].
+
+ keyArray basicAt:index put:nil.
+ tally := tally - 1.
+ tally == 0 ifTrue:[
+ keyArray := self keyContainerOfSize:(self class goodSizeFrom:0).
+ ] ifFalse:[
+ index == keyArray basicSize ifTrue:[
+ next := 1
+ ] ifFalse:[
+ next := index + 1.
+ ].
+ (keyArray basicAt:next) notNil ifTrue:[
+ keyArray basicAt:index put:DeletedEntry.
+ ].
+ self emptyCheck
+ ].
+ ^ oldObjectArg
+!
+
saveRemove:oldObject
"remove the element, oldObject from the collection.
Return the element
@@ -800,6 +850,14 @@
"Modified: / 03-02-2011 / 13:53:18 / sr"
!
+findIdentical:key ifAbsent:aBlock
+ "Look for the key in the receiver. If it is found, return
+ the index of the slot containing the key, otherwise
+ return the value of evaluating aBlock."
+
+ ^ keyArray identityIndexOf:key ifAbsent:aBlock
+!
+
findKeyOrNil:key
"Look for the key in the receiver.
If it is found, return the index of the first unused slot.
@@ -1206,29 +1264,6 @@
^ 1
"Modified: / 16.11.2001 / 10:30:14 / cg"
-!
-
-sameContentsAs:aCollection
- "answer true, if all the elements in self and aCollection
- are common. This is not defined as #=, since we cannot redefine #hash
- for aCollection."
-
- aCollection size ~~ self size ifTrue:[
- ^ false
- ].
-
- ^ aCollection conform:[:e | (self includes:e)]
-
- "
- #(1 2 3) asSet sameContentsAs: #(1 2 3)
- #(1 2 3 4) asSet sameContentsAs: #(1 2 3)
- #(1 2 3) asSet sameContentsAs: #(1 2 3 3)
- #(1 2 3 'aa') asSet sameContentsAs: #(1 2 3 'aa')
- #(1 2 3 'aa') asIdentitySet sameContentsAs: #(1 2 3 'aa')
- #(1 2 3 #aa) asIdentitySet sameContentsAs: #(1 2 3 #aa)
- "
-
- "Modified: / 13-10-2006 / 12:59:01 / cg"
! !
!Set methodsFor:'visiting'!
@@ -1262,11 +1297,11 @@
!Set class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Set.st,v 1.120 2013-04-03 09:10:55 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Set.st,v 1.122 2013-11-14 15:33:50 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/Set.st,v 1.120 2013-04-03 09:10:55 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Set.st,v 1.122 2013-11-14 15:33:50 stefan Exp $'
! !
--- a/StandaloneStartup.st Wed Nov 20 15:12:13 2013 +0000
+++ b/StandaloneStartup.st Mon Nov 25 10:37:44 2013 +0000
@@ -729,6 +729,13 @@
^ false
!
+patchesDirectory
+ "answer a directory containing patches.
+ The directory needs not to be present."
+
+ ^ OperatingSystem pathOfSTXExecutable asFilename directory construct:'patches'.
+!
+
startupFilename
"used in verbose messages - can/should be redefined in subclasses"
@@ -844,15 +851,18 @@
|patchesDir prevMode patchesToLoad|
- patchesDir := OperatingSystem pathOfSTXExecutable asFilename directory construct:'patches'.
- (patchesDir exists and:[patchesDir isDirectory]) ifTrue:[
+ patchesDir := self patchesDirectory.
+ patchesDir isDirectory ifTrue:[
prevMode := ClassCategoryReader sourceMode.
ClassCategoryReader sourceMode:#discard.
[
patchesToLoad := patchesDir directoryContents.
+ patchesToLoad := patchesToLoad select:[:eachFilenameString|
+ eachFilenameString asFilename isRegularFile
+ ].
aGlobString notEmptyOrNil ifTrue:[
patchesToLoad := patchesToLoad select:[:eachFilenameString|
- aGlobString match:eachFilenameString caseSensitive:false.
+ aGlobString match:eachFilenameString caseSensitive:false
].
].
patchesToLoad sort do:[:eachFilenameString |
@@ -1168,11 +1178,11 @@
!StandaloneStartup class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/StandaloneStartup.st,v 1.76 2013-08-31 22:37:43 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/StandaloneStartup.st,v 1.77 2013-11-19 12:54:21 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/StandaloneStartup.st,v 1.76 2013-08-31 22:37:43 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/StandaloneStartup.st,v 1.77 2013-11-19 12:54:21 stefan Exp $'
! !
--- a/UnixFilename.st Wed Nov 20 15:12:13 2013 +0000
+++ b/UnixFilename.st Mon Nov 25 10:37:44 2013 +0000
@@ -191,30 +191,15 @@
"redefined from superclass, because we do not distinguish file and directory names"
^ self osNameForFile
-!
-
-osNameForFile
- "internal - return the OS's name for the receiver to
- access it as a file."
-
- |name|
-
- (nameString startsWith:'~') ifTrue:[
- name := self class nameWithSpecialExpansions:nameString.
- ] ifFalse:[
- name := nameString.
- ].
-
- ^ name
! !
!UnixFilename class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/UnixFilename.st,v 1.19 2013-03-04 12:33:45 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/UnixFilename.st,v 1.20 2013-11-13 10:37:55 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/UnixFilename.st,v 1.19 2013-03-04 12:33:45 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/UnixFilename.st,v 1.20 2013-11-13 10:37:55 stefan Exp $'
! !
--- a/UnixOperatingSystem.st Wed Nov 20 15:12:13 2013 +0000
+++ b/UnixOperatingSystem.st Mon Nov 25 10:37:44 2013 +0000
@@ -223,17 +223,17 @@
# include <time.h>
struct tm {
- int tm_sec; /* seconds after the minute [0-60] */
- int tm_min; /* minutes after the hour [0-59] */
- int tm_hour; /* hours since midnight [0-23] */
- int tm_mday; /* day of the month [1-31] */
- int tm_mon; /* months since January [0-11] */
- int tm_year; /* years since 1900 */
- int tm_wday; /* days since Sunday [0-6] */
- int tm_yday; /* days since January 1 [0-365] */
- int tm_isdst; /* Daylight Savings Time flag */
- long tm_gmtoff; /* offset from CUT in seconds */
- char *tm_zone; /* timezone abbreviation */
+ int tm_sec; /* seconds after the minute [0-60] */
+ int tm_min; /* minutes after the hour [0-59] */
+ int tm_hour; /* hours since midnight [0-23] */
+ int tm_mday; /* day of the month [1-31] */
+ int tm_mon; /* months since January [0-11] */
+ int tm_year; /* years since 1900 */
+ int tm_wday; /* days since Sunday [0-6] */
+ int tm_yday; /* days since January 1 [0-365] */
+ int tm_isdst; /* Daylight Savings Time flag */
+ long tm_gmtoff; /* offset from CUT in seconds */
+ char *tm_zone; /* timezone abbreviation */
};
# include <crt_externs.h>
@@ -427,6 +427,7 @@
#endif /* not transputer */
#ifndef NO_SOCKET
+# define __USE_GNU // For AI_IDN in netdb.h
# include <netdb.h>
#endif
@@ -654,6 +655,10 @@
"initialize the class"
ObjectMemory addDependent:self.
+ self initializeCachedData.
+!
+
+initializeCachedData
HostName := nil.
DomainName := nil.
LastErrorNumber := nil.
@@ -661,26 +666,47 @@
ForkFailed := false.
SlowFork := false.
CurrentDirectory := nil.
- Codeset := self getCodeset.
-
- "Modified: / 11.12.1998 / 16:35:39 / cg"
+ self initializeCodeset.
+!
+
+initializeCodeset
+ "initialize the codeset, we are running under.
+ The codeset is determined from the environment.
+ The LC_CTYPE locale is set from the environment as a side effect."
+
+ |codeset|
+
+%{
+#include <langinfo.h>
+ char *__codeset;
+
+ setlocale(LC_CTYPE, "");
+ __codeset = nl_langinfo(CODESET);
+ if (strlen(__codeset) > 0) {
+ codeset = __MKSTRING(__codeset);
+ }
+%}.
+ codeset notNil ifTrue:[
+ codeset := codeset asLowercase.
+ codeset = 'utf-8' ifTrue:[
+ codeset := #utf8.
+ ] ifFalse:[
+ codeset := codeset asSymbol.
+ ].
+ ].
+ Codeset := codeset.
+ ^ codeset.
+
+ "
+ OperatingSystem initializeCodeset
+ "
!
update:something with:aParameter from:changedObject
"catch image restart and flush some cached data"
something == #earlyRestart ifTrue:[
- "
- flush cached data/info
- "
- HostName := nil.
- DomainName := nil.
- LastErrorNumber := nil.
- PipeFailed := false.
- SlowFork := false.
- ForkFailed := false.
- CurrentDirectory := nil.
- Codeset := self getCodeset.
+ self initializeCachedData
]
"Created: / 15.6.1996 / 15:22:37 / cg"
@@ -6226,36 +6252,9 @@
!
getCodeset
- "get the codeset, we are running under"
-
- |codeset|
-
-%{
-#include <langinfo.h>
- {
- char *__codeset;
-
- setlocale(LC_CTYPE, "");
- __codeset = nl_langinfo(CODESET);
- if (strlen(__codeset) > 0) {
- codeset = __MKSTRING(__codeset);
- }
- }
-%}.
- codeset notNil ifTrue:[
- codeset := codeset asLowercase.
- codeset = 'utf-8' ifTrue:[
- codeset := #utf8.
- ] ifFalse:[
- codeset := codeset asSymbol.
- ].
- ].
- Codeset := codeset.
- ^ codeset.
-
- "
- OperatingSystem getCodeset
- "
+ "get the codeset the system is running under"
+
+ ^ Codeset
!
getCodesetEncoder
@@ -8236,6 +8235,68 @@
"
!
+setLocale:categorySymbol to:localeStringOrNil
+ "set (and get) the locale for categorySymbol (e.g. #LC_ALL, #LC_CTYPE,....).
+ If localeStringOrNil is nil, nothing is set.
+ If localeStringOrNil is empty, the locale for categorySymbol ist set from the environment.
+ If localeStringOrNil is 'C', the locale for categorySymbol ist set to the default.
+ If localeStringOrNil is to a locale name, the locale for categorySymbol ist set.
+ The current locale setting is returned."
+
+ |locale error|
+
+%{
+ int __category;
+ char *__locale, *ret;
+
+ if (categorySymbol == @symbol(LC_ALL)) {
+ __category = LC_ALL;
+ } else if (categorySymbol == @symbol(LC_COLLATE)) {
+ __category = LC_COLLATE;
+ } else if (categorySymbol == @symbol(LC_CTYPE)) {
+ __category = LC_CTYPE;
+ } else if (categorySymbol == @symbol(LC_MESSAGES)) {
+ __category = LC_MESSAGES;
+ } else if (categorySymbol == @symbol(LC_MONETARY)) {
+ __category = LC_MONETARY;
+ } else if (categorySymbol == @symbol(LC_NUMERIC)) {
+ __category = LC_NUMERIC;
+ } else if (categorySymbol == @symbol(LC_TIME)) {
+ __category = LC_TIME;
+ } else {
+ error = @symbol(argument1);
+ goto out;
+ }
+
+ if (localeStringOrNil == nil) {
+ __locale = 0;
+ } else if (__isStringLike(localeStringOrNil)){
+ __locale = __stringVal(localeStringOrNil);
+ } else {
+ error = @symbol(argument1);
+ goto out;
+ }
+
+ ret = setlocale(__category, __locale);
+ if (ret) {
+ locale = __MKSTRING(ret);
+ }
+
+out:;
+%}.
+ locale notNil ifTrue:[
+ ^ locale.
+ ].
+ ^ self primitiveFailed:error.
+
+ "
+ OperatingSystem setLocale:#LC_ALL to:nil
+ OperatingSystem setLocale:#LC_CTYPE to:nil
+ OperatingSystem setLocale:#LC_CTYPE to:'C'
+ OperatingSystem setLocale:#LC_CTYPE to:''
+ "
+!
+
setLocaleInfo:anInfoDictionary
"set the locale information; if set, this oerrides the OS's settings.
(internal in ST/X only - the OS's settings remain unaffected)
@@ -9023,6 +9084,22 @@
!UnixOperatingSystem class methodsFor:'users & groups'!
+getDesktopDirectory
+ "{ Pragma: +optSpace }"
+ "return the name of the user's desktop directory."
+
+ |home desktop|
+
+ home := self getHomeDirectory.
+ desktop := home,'/Desktop'.
+ desktop asFilename exists ifTrue:[^ desktop].
+ ^ home.
+
+ "
+ OperatingSystem getDesktopDirectory
+ "
+!
+
getEffectiveGroupID
"{ Pragma: +optSpace }"
@@ -11500,7 +11577,7 @@
Domain, type, protocol may be nil or specify a hint for the socket
addresses to be returned."
- |result domain type proto serviceName|
+ |result domain type proto serviceName encodedHostName|
domain := OperatingSystem domainCodeOf:domainArg.
type := OperatingSystem socketTypeCodeOf:typeArg.
@@ -11509,7 +11586,27 @@
serviceName := serviceNameArg printString. "convert integer port numbers"
].
- result := self primGetAddressInfo:(UnixOperatingSystem encodePath:hostName) serviceName:serviceName domainCode:domain socketTypeCode:type protocolCode:proto flags:flags.
+ hostName isNil ifTrue:[
+ encodedHostName := nil.
+ ] ifFalse:[
+ encodedHostName := hostName utf8Encoded.
+ ].
+ (encodedHostName ~~ hostName and:[OperatingSystem getCodeset ~~ #utf8]) ifTrue:[
+ "hostName is not plain ASCII - so this is an IDN domain name. Have to ensure, that the locale is UTF-8.
+ Block interrupt to not affect othe ST/X processes while the locale is changed."
+ |interruptsBlocked oldLocale|
+
+ interruptsBlocked := OperatingSystem blockInterrupts.
+ oldLocale := OperatingSystem setLocale:#'LC_CTYPE' to:nil.
+ OperatingSystem setLocale:#'LC_CTYPE' to:'en_US.UTF-8'.
+ result := self primGetAddressInfo:encodedHostName serviceName:serviceName domainCode:domain socketTypeCode:type protocolCode:proto flags:flags.
+ OperatingSystem setLocale:#'LC_CTYPE' to:oldLocale.
+ interruptsBlocked ifFalse:[
+ OperatingSystem unblockInterrupts.
+ ].
+ ] ifFalse:[
+ result := self primGetAddressInfo:encodedHostName serviceName:serviceName domainCode:domain socketTypeCode:type protocolCode:proto flags:flags.
+ ].
result isArray ifFalse:[
|request|
request := SocketAddressInfo new
@@ -11566,9 +11663,9 @@
domain:#'AF_INET' type:nil protocol:nil flags:nil
self getAddressInfo:'www.exept.de' serviceName:nil
domain:#'AF_INET6' type:nil protocol:nil flags:nil
- "
-
- "Modified: / 26-10-2013 / 11:17:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ self getAddressInfo:'www.baden-wrttemberg.de' serviceName:nil
+ domain:#'AF_INET' type:#stream protocol:nil flags:nil
+ "
!
getNameInfo:socketAddress wantHostName:wantHostName wantServiceName:wantServiceName datagram:useDatagram flags:flags
@@ -11844,16 +11941,20 @@
/*
* Use getaddrinfo()
*/
- struct addrinfo hints;
+ struct addrinfo hints = {0};
struct addrinfo *info = NULL, *infop;
- memset(&hints, 0, sizeof(hints));
+#if defined(AI_IDN)
+ hints.ai_flags = AI_IDN | AI_CANONIDN; // map non-ascii domain names to IDN format
+#endif
if (__isSmallInteger(domain))
hints.ai_family = __intVal(domain);
if (__isSmallInteger(type))
hints.ai_socktype = __intVal(type);
if (__isSmallInteger(proto))
hints.ai_protocol = __intVal(proto);
+ if (__isSmallInteger(flags))
+ hints.ai_flags |= __intVal(flags);
do {
/* reload */
@@ -12963,11 +13064,11 @@
!UnixOperatingSystem class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/UnixOperatingSystem.st,v 1.332 2013-10-26 19:07:06 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/UnixOperatingSystem.st,v 1.336 2013-11-12 11:17:51 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/UnixOperatingSystem.st,v 1.332 2013-10-26 19:07:06 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/UnixOperatingSystem.st,v 1.336 2013-11-12 11:17:51 stefan Exp $'
!
version_HG
--- a/UserPreferences.st Wed Nov 20 15:12:13 2013 +0000
+++ b/UserPreferences.st Mon Nov 25 10:37:44 2013 +0000
@@ -607,9 +607,6 @@
"Modified: / 15-01-2012 / 14:26:53 / cg"
! !
-
-
-
!UserPreferences methodsFor:'accessing-locale'!
dateInputFormat
@@ -967,6 +964,8 @@
"
!
+
+
inspectorClassSetting
self useNewInspector ifTrue:[
^ (NewInspector::NewInspectorView ? InspectorView)
@@ -1518,6 +1517,35 @@
"Created: / 08-07-2011 / 13:22:50 / cg"
!
+enableVMWareDrawingBugWorkaround
+ "return the flag which enables a workaround for a redraw bug when running X/Linux in the VMWare virtual machine"
+
+ ^ self at:#enableVMWareDrawingBugWorkaround ifAbsent:[ false ]
+
+ "
+ UserPreferences current enableVMWareDrawingBugWorkaround
+ "
+
+ "Created: / 19-11-2013 / 09:53:20 / cg"
+!
+
+enableVMWareDrawingBugWorkaround:aBoolean
+ "change the flag which enables a workaround for a redraw bug when running X/Linux in the VMWare virtual machine"
+
+ self at:#enableVMWareDrawingBugWorkaround put:aBoolean.
+ Screen current platformName = 'X11' ifTrue:[
+ Screen current maxOperationsUntilFlush:(aBoolean ifTrue:[1] ifFalse:[nil])
+ ].
+
+ "
+ UserPreferences current enableVMWareDrawingBugWorkaround
+ UserPreferences current enableVMWareDrawingBugWorkaround:true
+ UserPreferences current enableVMWareDrawingBugWorkaround:false
+ "
+
+ "Created: / 19-11-2013 / 09:53:45 / cg"
+!
+
expandSelectionOnMouseMoveWithButtonPressed
"expand the selection in a selectionInListView if the mouse is pressed while moving over
more lines. Default is not FALSE !!"
@@ -4277,8 +4305,6 @@
"Created: / 19-08-2011 / 12:51:58 / cg"
! !
-
-
!UserPreferences methodsFor:'default settings-syntax colors'!
listOfPredefinedSyntaxColoringSchemes
@@ -4549,11 +4575,11 @@
!UserPreferences class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/UserPreferences.st,v 1.349 2013-09-24 15:23:53 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/UserPreferences.st,v 1.350 2013-11-19 08:58:23 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/UserPreferences.st,v 1.349 2013-09-24 15:23:53 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/UserPreferences.st,v 1.350 2013-11-19 08:58:23 cg Exp $'
!
version_HG
--- a/Win32OperatingSystem.st Wed Nov 20 15:12:13 2013 +0000
+++ b/Win32OperatingSystem.st Mon Nov 25 10:37:44 2013 +0000
@@ -824,7 +824,6 @@
"Modified: 7.1.1997 / 19:36:11 / stefan"
! !
-
!Win32OperatingSystem class methodsFor:'OS signal constants'!
sigABRT
@@ -1597,837 +1596,844 @@
int __eno = __unsignedLongIntVal(errNr);
if (__isWIN32Error(__eno)) {
- switch (__eno & 0xFFFF) {
- /*
- * WIN32 GetLastError returns
- */
- case ERROR_INVALID_FUNCTION:
- sym = @symbol(ERROR_INVALID_FUNCTION);
- typ = @symbol(illegalOperationSignal);
- break;
-
- case ERROR_BAD_FORMAT:
- sym = @symbol(ERROR_BAD_FORMAT);
- typ = @symbol(invalidArgumentsSignal);
- break;
-
- case ERROR_FILE_NOT_FOUND:
- sym = @symbol(ERROR_FILE_NOT_FOUND);
- typ = @symbol(nonexistentSignal);
- break;
-
- case ERROR_PATH_NOT_FOUND:
- sym = @symbol(ERROR_PATH_NOT_FOUND);
- typ = @symbol(nonexistentSignal);
- break;
-
- case ERROR_TOO_MANY_OPEN_FILES:
- sym = @symbol(ERROR_TOO_MANY_OPEN_FILES);
- typ = @symbol(noResourcesSignal);
- break;
-
- /*
- * what a nice errorCode - thats the most "useful" one I ever
- * encountered ... (... those stupid micro-softies ...)
- */
- case ERROR_OPEN_FAILED:
- sym = @symbol(ERROR_OPEN_FAILED);
- typ = @symbol(noResourcesSignal);
- break;
-
- case ERROR_ACCESS_DENIED:
- sym = @symbol(ERROR_ACCESS_DENIED);
- typ = @symbol(noPermissionsSignal);
- break;
-
- case ERROR_INVALID_HANDLE:
- sym = @symbol(ERROR_INVALID_HANDLE);
- typ = @symbol(invalidArgumentsSignal);
- break;
-
- case ERROR_NOT_ENOUGH_MEMORY:
- sym = @symbol(ERROR_NOT_ENOUGH_MEMORY);
- typ = @symbol(noResourcesSignal);
- break;
-
- case ERROR_NO_SYSTEM_RESOURCES:
- sym = @symbol(ERROR_NO_SYSTEM_RESOURCES);
- typ = @symbol(noResourcesSignal);
- break;
-
- case ERROR_NONPAGED_SYSTEM_RESOURCES:
- sym = @symbol(ERROR_NONPAGED_SYSTEM_RESOURCES);
- typ = @symbol(noResourcesSignal);
- break;
-
- case ERROR_PAGED_SYSTEM_RESOURCES:
- sym = @symbol(ERROR_PAGED_SYSTEM_RESOURCES);
- typ = @symbol(noResourcesSignal);
- break;
-
- case ERROR_INVALID_ACCESS:
- sym = @symbol(ERROR_INVALID_ACCESS);
- typ = @symbol(inappropriateOperationSignal);
- break;
-
- case ERROR_INVALID_DATA:
- sym = @symbol(ERROR_INVALID_DATA);
- typ = @symbol(invalidArgumentsSignal);
- break;
-
- case ERROR_INVALID_NAME:
- sym = @symbol(ERROR_INVALID_NAME);
- typ = @symbol(invalidArgumentsSignal);
- break;
-
- case ERROR_ARENA_TRASHED:
- sym = @symbol(ERROR_ARENA_TRASHED);
- typ = @symbol(noResourcesSignal);
- break;
-
- case ERROR_OUTOFMEMORY:
- sym = @symbol(ERROR_OUTOFMEMORY);
- typ = @symbol(noResourcesSignal);
- break;
-
- case ERROR_BROKEN_PIPE:
- sym = @symbol(ERROR_BROKEN_PIPE);
- typ = @symbol(peerFaultSignal);
- break;
-
- case ERROR_GEN_FAILURE:
- sym = @symbol(ERROR_GEN_FAILURE);
- break;
-
- case ERROR_WRITE_PROTECT:
- sym = @symbol(ERROR_WRITE_PROTECT);
- typ = @symbol(inappropriateOperationSignal);
- break;
-
- case ERROR_WRITE_FAULT:
- sym = @symbol(ERROR_WRITE_FAULT);
- typ = @symbol(transferFaultSignal);
- break;
-
- case ERROR_READ_FAULT:
- sym = @symbol(ERROR_READ_FAULT);
- typ = @symbol(transferFaultSignal);
- break;
-
- case ERROR_HANDLE_DISK_FULL:
- sym = @symbol(ERROR_HANDLE_DISK_FULL);
- typ = @symbol(volumeFullSignal);
- break;
-
- case ERROR_DISK_FULL:
- sym = @symbol(ERROR_DISK_FULL);
- typ = @symbol(volumeFullSignal);
- break;
-
- case ERROR_SHARING_VIOLATION:
- sym = @symbol(ERROR_SHARING_VIOLATION);
- typ = @symbol(noPermissionsSignal);
- break;
-
- case ERROR_LOCK_VIOLATION:
- sym = @symbol(ERROR_LOCK_VIOLATION);
- typ = @symbol(noPermissionsSignal);
- break;
-
- case ERROR_INVALID_PARAMETER:
- sym = @symbol(ERROR_INVALID_PARAMETER);
- typ = @symbol(invalidArgumentsSignal);
- break;
-
- case ERROR_NET_WRITE_FAULT:
- sym = @symbol(ERROR_NET_WRITE_FAULT);
- typ = @symbol(transferFaultSignal);
- break;
-
- case ERROR_NOT_SUPPORTED:
- sym = @symbol(ERROR_NOT_SUPPORTED);
- typ = @symbol(inappropriateOperationSignal);
- break;
-
- case ERROR_REM_NOT_LIST:
- sym = @symbol(ERROR_REM_NOT_LIST);
- typ = @symbol(noResourcesSignal);
- break;
-
- case ERROR_NETWORK_ACCESS_DENIED:
- sym = @symbol(ERROR_NETWORK_ACCESS_DENIED);
- typ = @symbol(noPermissionsSignal);
- break;
-
- case ERROR_DUP_NAME:
- sym = @symbol(ERROR_DUP_NAME);
- typ = @symbol(noResourcesSignal);
- break;
-
- case ERROR_BAD_NETPATH:
- sym = @symbol(ERROR_BAD_NETPATH);
- typ = @symbol(noResourcesSignal);
- break;
-
- case ERROR_NETWORK_BUSY:
- sym = @symbol(ERROR_NETWORK_BUSY);
- typ = @symbol(noResourcesSignal);
- break;
-
- case ERROR_DRIVE_LOCKED:
- sym = @symbol(ERROR_DRIVE_LOCKED);
- typ = @symbol(inappropriateOperationSignal);
- break;
-
- case ERROR_INVALID_DRIVE:
- sym = @symbol(ERROR_INVALID_DRIVE);
- typ = @symbol(invalidArgumentsSignal);
- break;
-
- case ERROR_WRONG_DISK:
- sym = @symbol(ERROR_WRONG_DISK);
- typ = @symbol(noResourcesSignal);
- break;
-
- case ERROR_CURRENT_DIRECTORY:
- sym = @symbol(ERROR_CURRENT_DIRECTORY);
- typ = @symbol(invalidArgumentsSignal);
- break;
-
- /*
- * what a nice errorCode - thats the most "useful" one I ever
- * encountered ... (... those stupid micro-softies ...)
- */
- case ERROR_CANNOT_MAKE:
- sym = @symbol(ERROR_CANNOT_MAKE);
- typ = @symbol(inappropriateOperationSignal);
- break;
-
- case ERROR_NO_MORE_FILES:
- sym = @symbol(ERROR_NO_MORE_FILES);
- typ = @symbol(noResourcesSignal);
- break;
-
- case ERROR_NOT_READY:
- sym = @symbol(ERROR_NOT_READY);
- typ = @symbol(noResourcesSignal);
- break;
-
- case ERROR_NOT_DOS_DISK:
- sym = @symbol(ERROR_NOT_DOS_DISK);
- typ = @symbol(invalidArgumentsSignal);
- break;
-
- case ERROR_OUT_OF_PAPER:
- sym = @symbol(ERROR_OUT_OF_PAPER);
- typ = @symbol(noResourcesSignal);
- break;
-
- case ERROR_PRINTQ_FULL:
- sym = @symbol(ERROR_PRINTQ_FULL);
- typ = @symbol(noResourcesSignal);
- break;
-
- case ERROR_FILE_EXISTS:
- sym = @symbol(ERROR_FILE_EXISTS);
- typ = @symbol(existingReferentSignal);
- break;
-
- default:
- break;
- }
+ switch (__eno & 0xFFFF) {
+ /*
+ * WIN32 GetLastError returns
+ */
+ case ERROR_INVALID_FUNCTION:
+ sym = @symbol(ERROR_INVALID_FUNCTION);
+ typ = @symbol(illegalOperationSignal);
+ break;
+
+ case ERROR_BAD_FORMAT:
+ sym = @symbol(ERROR_BAD_FORMAT);
+ typ = @symbol(invalidArgumentsSignal);
+ break;
+
+ case ERROR_FILE_NOT_FOUND:
+ sym = @symbol(ERROR_FILE_NOT_FOUND);
+ typ = @symbol(nonexistentSignal);
+ break;
+
+ case ERROR_PATH_NOT_FOUND:
+ sym = @symbol(ERROR_PATH_NOT_FOUND);
+ typ = @symbol(nonexistentSignal);
+ break;
+
+ case ERROR_TOO_MANY_OPEN_FILES:
+ sym = @symbol(ERROR_TOO_MANY_OPEN_FILES);
+ typ = @symbol(noResourcesSignal);
+ break;
+
+ /*
+ * what a nice errorCode - thats the most "useful" one I ever
+ * encountered ... (... those stupid micro-softies ...)
+ */
+ case ERROR_OPEN_FAILED:
+ sym = @symbol(ERROR_OPEN_FAILED);
+ typ = @symbol(noResourcesSignal);
+ break;
+
+ case ERROR_ACCESS_DENIED:
+ sym = @symbol(ERROR_ACCESS_DENIED);
+ typ = @symbol(noPermissionsSignal);
+ break;
+
+ case ERROR_INVALID_HANDLE:
+ sym = @symbol(ERROR_INVALID_HANDLE);
+ typ = @symbol(invalidArgumentsSignal);
+ break;
+
+ case ERROR_NOT_ENOUGH_MEMORY:
+ sym = @symbol(ERROR_NOT_ENOUGH_MEMORY);
+ typ = @symbol(noResourcesSignal);
+ break;
+
+ case ERROR_NO_SYSTEM_RESOURCES:
+ sym = @symbol(ERROR_NO_SYSTEM_RESOURCES);
+ typ = @symbol(noResourcesSignal);
+ break;
+
+ case ERROR_NONPAGED_SYSTEM_RESOURCES:
+ sym = @symbol(ERROR_NONPAGED_SYSTEM_RESOURCES);
+ typ = @symbol(noResourcesSignal);
+ break;
+
+ case ERROR_PAGED_SYSTEM_RESOURCES:
+ sym = @symbol(ERROR_PAGED_SYSTEM_RESOURCES);
+ typ = @symbol(noResourcesSignal);
+ break;
+
+ case ERROR_INVALID_ACCESS:
+ sym = @symbol(ERROR_INVALID_ACCESS);
+ typ = @symbol(inappropriateOperationSignal);
+ break;
+
+ case ERROR_INVALID_DATA:
+ sym = @symbol(ERROR_INVALID_DATA);
+ typ = @symbol(invalidArgumentsSignal);
+ break;
+
+ case ERROR_INVALID_NAME:
+ sym = @symbol(ERROR_INVALID_NAME);
+ typ = @symbol(invalidArgumentsSignal);
+ break;
+
+ case ERROR_ARENA_TRASHED:
+ sym = @symbol(ERROR_ARENA_TRASHED);
+ typ = @symbol(noResourcesSignal);
+ break;
+
+ case ERROR_OUTOFMEMORY:
+ sym = @symbol(ERROR_OUTOFMEMORY);
+ typ = @symbol(noResourcesSignal);
+ break;
+
+ case ERROR_BROKEN_PIPE:
+ sym = @symbol(ERROR_BROKEN_PIPE);
+ typ = @symbol(peerFaultSignal);
+ break;
+
+ case ERROR_GEN_FAILURE:
+ sym = @symbol(ERROR_GEN_FAILURE);
+ break;
+
+ case ERROR_WRITE_PROTECT:
+ sym = @symbol(ERROR_WRITE_PROTECT);
+ typ = @symbol(inappropriateOperationSignal);
+ break;
+
+ case ERROR_WRITE_FAULT:
+ sym = @symbol(ERROR_WRITE_FAULT);
+ typ = @symbol(transferFaultSignal);
+ break;
+
+ case ERROR_READ_FAULT:
+ sym = @symbol(ERROR_READ_FAULT);
+ typ = @symbol(transferFaultSignal);
+ break;
+
+ case ERROR_HANDLE_DISK_FULL:
+ sym = @symbol(ERROR_HANDLE_DISK_FULL);
+ typ = @symbol(volumeFullSignal);
+ break;
+
+ case ERROR_DISK_FULL:
+ sym = @symbol(ERROR_DISK_FULL);
+ typ = @symbol(volumeFullSignal);
+ break;
+
+ case ERROR_SHARING_VIOLATION:
+ sym = @symbol(ERROR_SHARING_VIOLATION);
+ typ = @symbol(noPermissionsSignal);
+ break;
+
+ case ERROR_LOCK_VIOLATION:
+ sym = @symbol(ERROR_LOCK_VIOLATION);
+ typ = @symbol(noPermissionsSignal);
+ break;
+
+ case ERROR_INVALID_PARAMETER:
+ sym = @symbol(ERROR_INVALID_PARAMETER);
+ typ = @symbol(invalidArgumentsSignal);
+ break;
+
+ case ERROR_NET_WRITE_FAULT:
+ sym = @symbol(ERROR_NET_WRITE_FAULT);
+ typ = @symbol(transferFaultSignal);
+ break;
+
+ case ERROR_NOT_SUPPORTED:
+ sym = @symbol(ERROR_NOT_SUPPORTED);
+ typ = @symbol(inappropriateOperationSignal);
+ break;
+
+ case ERROR_REM_NOT_LIST:
+ sym = @symbol(ERROR_REM_NOT_LIST);
+ typ = @symbol(noResourcesSignal);
+ break;
+
+ case ERROR_NETWORK_ACCESS_DENIED:
+ sym = @symbol(ERROR_NETWORK_ACCESS_DENIED);
+ typ = @symbol(noPermissionsSignal);
+ break;
+
+ case ERROR_DUP_NAME:
+ sym = @symbol(ERROR_DUP_NAME);
+ typ = @symbol(noResourcesSignal);
+ break;
+
+ case ERROR_BAD_NETPATH:
+ sym = @symbol(ERROR_BAD_NETPATH);
+ typ = @symbol(noResourcesSignal);
+ break;
+
+ case ERROR_NETWORK_BUSY:
+ sym = @symbol(ERROR_NETWORK_BUSY);
+ typ = @symbol(noResourcesSignal);
+ break;
+
+ case ERROR_DRIVE_LOCKED:
+ sym = @symbol(ERROR_DRIVE_LOCKED);
+ typ = @symbol(inappropriateOperationSignal);
+ break;
+
+ case ERROR_INVALID_DRIVE:
+ sym = @symbol(ERROR_INVALID_DRIVE);
+ typ = @symbol(invalidArgumentsSignal);
+ break;
+
+ case ERROR_WRONG_DISK:
+ sym = @symbol(ERROR_WRONG_DISK);
+ typ = @symbol(noResourcesSignal);
+ break;
+
+ case ERROR_CURRENT_DIRECTORY:
+ sym = @symbol(ERROR_CURRENT_DIRECTORY);
+ typ = @symbol(invalidArgumentsSignal);
+ break;
+
+ /*
+ * what a nice errorCode - thats the most "useful" one I ever
+ * encountered ... (... those stupid micro-softies ...)
+ */
+ case ERROR_CANNOT_MAKE:
+ sym = @symbol(ERROR_CANNOT_MAKE);
+ typ = @symbol(inappropriateOperationSignal);
+ break;
+
+ case ERROR_NO_MORE_FILES:
+ sym = @symbol(ERROR_NO_MORE_FILES);
+ typ = @symbol(noResourcesSignal);
+ break;
+
+ case ERROR_NOT_READY:
+ sym = @symbol(ERROR_NOT_READY);
+ typ = @symbol(noResourcesSignal);
+ break;
+
+ case ERROR_NOT_DOS_DISK:
+ sym = @symbol(ERROR_NOT_DOS_DISK);
+ typ = @symbol(invalidArgumentsSignal);
+ break;
+
+ case ERROR_OUT_OF_PAPER:
+ sym = @symbol(ERROR_OUT_OF_PAPER);
+ typ = @symbol(noResourcesSignal);
+ break;
+
+ case ERROR_PRINTQ_FULL:
+ sym = @symbol(ERROR_PRINTQ_FULL);
+ typ = @symbol(noResourcesSignal);
+ break;
+
+ case ERROR_FILE_EXISTS:
+ sym = @symbol(ERROR_FILE_EXISTS);
+ typ = @symbol(existingReferentSignal);
+ break;
+
+ default:
+ break;
+ }
} else {
- switch (__eno) {
- /*
- * POSIX errnos - these should be defined
- */
+ switch (__eno) {
+ /*
+ * POSIX errnos - these should be defined
+ */
#ifdef EPERM
- case EPERM:
- sym = @symbol(EPERM);
- typ = @symbol(noPermissionsSignal);
- break;
+ case EPERM:
+ sym = @symbol(EPERM);
+ typ = @symbol(noPermissionsSignal);
+ break;
#endif
#ifdef ENOENT
- case ENOENT:
- sym = @symbol(ENOENT);
- typ = @symbol(nonexistentSignal);
- break;
+ case ENOENT:
+ sym = @symbol(ENOENT);
+ typ = @symbol(nonexistentSignal);
+ break;
#endif
#ifdef ESRCH
- case ESRCH:
- sym = @symbol(ESRCH);
- typ = @symbol(unavailableReferentSignal);
- break;
+ case ESRCH:
+ sym = @symbol(ESRCH);
+ typ = @symbol(unavailableReferentSignal);
+ break;
#endif
#ifdef EINTR
- case EINTR:
- sym = @symbol(EINTR);
- typ = @symbol(transientErrorSignal);
- break;
+ case EINTR:
+ sym = @symbol(EINTR);
+ typ = @symbol(transientErrorSignal);
+ break;
#endif
#ifdef EIO
- case EIO:
- sym = @symbol(EIO);
- typ = @symbol(transferFaultSignal);
- break;
+ case EIO:
+ sym = @symbol(EIO);
+ typ = @symbol(transferFaultSignal);
+ break;
#endif
#ifdef ENXIO
- case ENXIO:
- sym = @symbol(ENXIO);
- typ = @symbol(unavailableReferentSignal);
- break;
+ case ENXIO:
+ sym = @symbol(ENXIO);
+ typ = @symbol(unavailableReferentSignal);
+ break;
#endif
#ifdef E2BIG
- case E2BIG:
- sym = @symbol(E2BIG);
- typ = @symbol(invalidArgumentsSignal);
- break;
+ case E2BIG:
+ sym = @symbol(E2BIG);
+ typ = @symbol(invalidArgumentsSignal);
+ break;
#endif
#ifdef ENOEXEC
- case ENOEXEC:
- sym = @symbol(ENOEXEC);
- typ = @symbol(inappropriateOperationSignal);
- break;
+ case ENOEXEC:
+ sym = @symbol(ENOEXEC);
+ typ = @symbol(inappropriateOperationSignal);
+ break;
#endif
#ifdef EBADF
- case EBADF:
- sym = @symbol(EBADF);
- typ = @symbol(badAccessorSignal);
- break;
+ case EBADF:
+ sym = @symbol(EBADF);
+ typ = @symbol(badAccessorSignal);
+ break;
#endif
#ifdef ECHILD
- case ECHILD:
- sym = @symbol(ECHILD);
- typ = @symbol(informationSignal);
- break;
+ case ECHILD:
+ sym = @symbol(ECHILD);
+ typ = @symbol(informationSignal);
+ break;
#endif
#if !defined(EWOULDBLOCK) && defined(EAGAIN) && (EWOULDBLOCK != EAGAIN)
- case EAGAIN:
- sym = @symbol(EAGAIN);
- typ = @symbol(notReadySignal);
- break;
+ case EAGAIN:
+ sym = @symbol(EAGAIN);
+ typ = @symbol(notReadySignal);
+ break;
#endif
#ifdef ENOMEM
- case ENOMEM:
- sym = @symbol(ENOMEM);
- typ = @symbol(noMemorySignal);
- break;
+ case ENOMEM:
+ sym = @symbol(ENOMEM);
+ typ = @symbol(noMemorySignal);
+ break;
#endif
#ifdef EACCES
- case EACCES:
- sym = @symbol(EACCES);
- typ = @symbol(noPermissionsSignal);
- break;
+ case EACCES:
+ sym = @symbol(EACCES);
+ typ = @symbol(noPermissionsSignal);
+ break;
#endif
#ifdef EFAULT
- case EFAULT:
- sym = @symbol(EFAULT);
- typ = @symbol(invalidArgumentsSignal);
- break;
+ case EFAULT:
+ sym = @symbol(EFAULT);
+ typ = @symbol(invalidArgumentsSignal);
+ break;
#endif
#ifdef EBUSY
- case EBUSY:
- sym = @symbol(EBUSY);
- typ = @symbol(unavailableReferentSignal);
- break;
+ case EBUSY:
+ sym = @symbol(EBUSY);
+ typ = @symbol(unavailableReferentSignal);
+ break;
#endif
#ifdef EEXIST
- case EEXIST:
- sym = @symbol(EEXIST);
- typ = @symbol(existingReferentSignal);
- break;
+ case EEXIST:
+ sym = @symbol(EEXIST);
+ typ = @symbol(existingReferentSignal);
+ break;
#endif
#ifdef EXDEV
- case EXDEV:
- sym = @symbol(EXDEV);
- typ = @symbol(inappropriateReferentSignal);
- break;
+ case EXDEV:
+ sym = @symbol(EXDEV);
+ typ = @symbol(inappropriateReferentSignal);
+ break;
#endif
#ifdef ENODEV
- case ENODEV:
- sym = @symbol(ENODEV);
- typ = @symbol(inaccessibleSignal);
- break;
+ case ENODEV:
+ sym = @symbol(ENODEV);
+ typ = @symbol(inaccessibleSignal);
+ break;
#endif
#ifdef ENOTDIR
- case ENOTDIR:
- sym = @symbol(ENOTDIR);
- typ = @symbol(inappropriateOperationSignal);
- break;
+ case ENOTDIR:
+ sym = @symbol(ENOTDIR);
+ typ = @symbol(inappropriateOperationSignal);
+ break;
#endif
#ifdef EISDIR
- case EISDIR:
- sym = @symbol(EISDIR);
- typ = @symbol(inappropriateOperationSignal);
- break;
+ case EISDIR:
+ sym = @symbol(EISDIR);
+ typ = @symbol(inappropriateOperationSignal);
+ break;
#endif
#ifdef EINVAL
- case EINVAL:
- sym = @symbol(EINVAL);
- typ = @symbol(invalidArgumentsSignal);
- break;
+ case EINVAL:
+ sym = @symbol(EINVAL);
+ typ = @symbol(invalidArgumentsSignal);
+ break;
#endif
#ifdef ENFILE
- case ENFILE:
- sym = @symbol(ENFILE);
- typ = @symbol(noResourcesSignal);
- break;
+ case ENFILE:
+ sym = @symbol(ENFILE);
+ typ = @symbol(noResourcesSignal);
+ break;
#endif
#ifdef EMFILE
- case EMFILE:
- sym = @symbol(EMFILE);
- typ = @symbol(noResourcesSignal);
- break;
+ case EMFILE:
+ sym = @symbol(EMFILE);
+ typ = @symbol(noResourcesSignal);
+ break;
#endif
#ifdef ENOTTY
- case ENOTTY:
- sym = @symbol(ENOTTY);
- typ = @symbol(inappropriateOperationSignal);
- break;
+ case ENOTTY:
+ sym = @symbol(ENOTTY);
+ typ = @symbol(inappropriateOperationSignal);
+ break;
#endif
#ifdef EFBIG
- case EFBIG:
- sym = @symbol(EFBIG);
- typ = @symbol(noResourcesSignal);
- break;
+ case EFBIG:
+ sym = @symbol(EFBIG);
+ typ = @symbol(noResourcesSignal);
+ break;
#endif
#ifdef ENOSPC
- case ENOSPC:
- sym = @symbol(ENOSPC);
- typ = @symbol(noResourcesSignal);
- break;
+ case ENOSPC:
+ sym = @symbol(ENOSPC);
+ typ = @symbol(noResourcesSignal);
+ break;
#endif
#ifdef ESPIPE
- case ESPIPE:
- sym = @symbol(ESPIPE);
- typ = @symbol(inappropriateOperationSignal);
- break;
+ case ESPIPE:
+ sym = @symbol(ESPIPE);
+ typ = @symbol(inappropriateOperationSignal);
+ break;
#endif
#ifdef EROFS
- case EROFS:
- sym = @symbol(EROFS);
- typ = @symbol(inappropriateOperationSignal);
- break;
+ case EROFS:
+ sym = @symbol(EROFS);
+ typ = @symbol(inappropriateOperationSignal);
+ break;
#endif
#ifdef EMLINK
- case EMLINK:
- sym = @symbol(EMLINK);
- typ = @symbol(rangeErrorSignal);
- break;
+ case EMLINK:
+ sym = @symbol(EMLINK);
+ typ = @symbol(rangeErrorSignal);
+ break;
#endif
#ifdef EPIPE
- case EPIPE:
- sym = @symbol(EPIPE);
- typ = @symbol(peerFaultSignal);
- break;
+ case EPIPE:
+ sym = @symbol(EPIPE);
+ typ = @symbol(peerFaultSignal);
+ break;
#endif
#ifdef EDOM
- case EDOM:
- sym = @symbol(EDOM);
- typ = @symbol(rangeErrorSignal);
- break;
+ case EDOM:
+ sym = @symbol(EDOM);
+ typ = @symbol(rangeErrorSignal);
+ break;
#endif
#ifdef ERANGE
- case ERANGE:
- sym = @symbol(ERANGE);
- typ = @symbol(rangeErrorSignal);
- break;
+ case ERANGE:
+ sym = @symbol(ERANGE);
+ typ = @symbol(rangeErrorSignal);
+ break;
#endif
#ifdef EDEADLK
# if EDEADLK != EWOULDBLOCK
- case EDEADLK:
- sym = @symbol(EDEADLK);
- typ = @symbol(noResourcesSignal);
- break;
+ case EDEADLK:
+ sym = @symbol(EDEADLK);
+ typ = @symbol(noResourcesSignal);
+ break;
# endif
#endif
#ifdef ENAMETOOLONG
- case ENAMETOOLONG:
- sym = @symbol(ENAMETOOLONG);
- typ = @symbol(rangeErrorSignal);
- break;
+ case ENAMETOOLONG:
+ sym = @symbol(ENAMETOOLONG);
+ typ = @symbol(rangeErrorSignal);
+ break;
#endif
#ifdef ENOLCK
- case ENOLCK:
- sym = @symbol(ENOLCK);
- typ = @symbol(inappropriateOperationSignal);
- break;
+ case ENOLCK:
+ sym = @symbol(ENOLCK);
+ typ = @symbol(inappropriateOperationSignal);
+ break;
#endif
#ifdef ENOSYS
- case ENOSYS:
- sym = @symbol(ENOSYS);
- typ = @symbol(inappropriateOperationSignal);
- break;
+ case ENOSYS:
+ sym = @symbol(ENOSYS);
+ typ = @symbol(inappropriateOperationSignal);
+ break;
#endif
#if defined(ENOTEMPTY) && (ENOTEMPTY != EEXIST)
- case ENOTEMPTY:
- sym = @symbol(ENOTEMPTY);
- typ = @symbol(inappropriateReferentSignal);
- break;
+ case ENOTEMPTY:
+ sym = @symbol(ENOTEMPTY);
+ typ = @symbol(inappropriateReferentSignal);
+ break;
#endif
#ifdef EILSEQ
- case EILSEQ:
- sym = @symbol(EILSEQ);
- typ = @symbol(transferFaultSignal);
- break;
-#endif
- /*
- * XPG3 errnos - defined on most systems
- */
+ case EILSEQ:
+ sym = @symbol(EILSEQ);
+ typ = @symbol(transferFaultSignal);
+ break;
+#endif
+ /*
+ * XPG3 errnos - defined on most systems
+ */
#ifdef ENOTBLK
- case ENOTBLK:
- sym = @symbol(ENOTBLK);
- typ = @symbol(inappropriateReferentSignal);
- break;
+ case ENOTBLK:
+ sym = @symbol(ENOTBLK);
+ typ = @symbol(inappropriateReferentSignal);
+ break;
#endif
#ifdef ETXTBSY
- case ETXTBSY:
- sym = @symbol(ETXTBSY);
- typ = @symbol(inaccessibleSignal);
- break;
-#endif
- /*
- * some others
- */
+ case ETXTBSY:
+ sym = @symbol(ETXTBSY);
+ typ = @symbol(inaccessibleSignal);
+ break;
+#endif
+ /*
+ * some others
+ */
#ifdef EWOULDBLOCK
- case EWOULDBLOCK:
- sym = @symbol(EWOULDBLOCK);
- typ = @symbol(notReadySignal);
- break;
+ case EWOULDBLOCK:
+ sym = @symbol(EWOULDBLOCK);
+ typ = @symbol(notReadySignal);
+ break;
#endif
#ifdef ENOMSG
- case ENOMSG:
- sym = @symbol(ENOMSG);
- typ = @symbol(noDataSignal);
- break;
+ case ENOMSG:
+ sym = @symbol(ENOMSG);
+ typ = @symbol(noDataSignal);
+ break;
#endif
#ifdef ELOOP
- case ELOOP:
- sym = @symbol(ELOOP);
- typ = @symbol(rangeErrorSignal);
- break;
-#endif
-
- /*
- * some stream errors
- */
+ case ELOOP:
+ sym = @symbol(ELOOP);
+ typ = @symbol(rangeErrorSignal);
+ break;
+#endif
+
+ /*
+ * some stream errors
+ */
#ifdef ETIME
- case ETIME:
- sym = @symbol(ETIME);
- typ = @symbol(peerFaultSignal);
- break;
+ case ETIME:
+ sym = @symbol(ETIME);
+ typ = @symbol(peerFaultSignal);
+ break;
#endif
#ifdef ENOSR
- case ENOSR:
- sym = @symbol(ENOSR);
- typ = @symbol(noResourcesSignal);
- break;
+ case ENOSR:
+ sym = @symbol(ENOSR);
+ typ = @symbol(noResourcesSignal);
+ break;
#endif
#ifdef ENOSTR
- case ENOSTR:
- sym = @symbol(ENOSTR);
- typ = @symbol(inappropriateReferentSignal);
- break;
+ case ENOSTR:
+ sym = @symbol(ENOSTR);
+ typ = @symbol(inappropriateReferentSignal);
+ break;
#endif
#ifdef ECOMM
- case ECOMM:
- sym = @symbol(ECOMM);
- typ = @symbol(transferFaultSignal);
- break;
+ case ECOMM:
+ sym = @symbol(ECOMM);
+ typ = @symbol(transferFaultSignal);
+ break;
#endif
#ifdef EPROTO
- case EPROTO:
- sym = @symbol(EPROTO);
- typ = @symbol(inappropriateOperationSignal);
- break;
-#endif
- /*
- * nfs errors
- */
+ case EPROTO:
+ sym = @symbol(EPROTO);
+ typ = @symbol(inappropriateOperationSignal);
+ break;
+#endif
+ /*
+ * nfs errors
+ */
#ifdef ESTALE
- case ESTALE:
- sym = @symbol(ESTALE);
- typ = @symbol(unavailableReferentSignal);
- break;
+ case ESTALE:
+ sym = @symbol(ESTALE);
+ typ = @symbol(unavailableReferentSignal);
+ break;
#endif
#ifdef EREMOTE
- case EREMOTE:
- sym = @symbol(EREMOTE);
- typ = @symbol(rangeErrorSignal);
- break;
-#endif
- /*
- * some networking errors
- */
+ case EREMOTE:
+ sym = @symbol(EREMOTE);
+ typ = @symbol(rangeErrorSignal);
+ break;
+#endif
+ /*
+ * some networking errors
+ */
#ifdef EINPROGRESS
- case EINPROGRESS:
- sym = @symbol(EINPROGRESS);
- typ = @symbol(operationStartedSignal);
- break;
+ case EINPROGRESS:
+ sym = @symbol(EINPROGRESS);
+ typ = @symbol(operationStartedSignal);
+ break;
#endif
#ifdef EALREADY
- case EALREADY:
- sym = @symbol(EALREADY);
- typ = @symbol(operationStartedSignal);
- break;
+ case EALREADY:
+ sym = @symbol(EALREADY);
+ typ = @symbol(operationStartedSignal);
+ break;
#endif
#ifdef ENOTSOCK
- case ENOTSOCK:
- sym = @symbol(ENOTSOCK);
- typ = @symbol(inappropriateOperationSignal);
- break;
+ case ENOTSOCK:
+ sym = @symbol(ENOTSOCK);
+ typ = @symbol(inappropriateOperationSignal);
+ break;
#endif
#ifdef EDESTADDRREQ
- case EDESTADDRREQ:
- sym = @symbol(EDESTADDRREQ);
- typ = @symbol(underspecifiedSignal);
- break;
+ case EDESTADDRREQ:
+ sym = @symbol(EDESTADDRREQ);
+ typ = @symbol(underspecifiedSignal);
+ break;
#endif
#ifdef EMSGSIZE
- case EMSGSIZE:
- sym = @symbol(EMSGSIZE);
- typ = @symbol(rangeErrorSignal);
- break;
+ case EMSGSIZE:
+ sym = @symbol(EMSGSIZE);
+ typ = @symbol(rangeErrorSignal);
+ break;
#endif
#ifdef EPROTOTYPE
- case EPROTOTYPE:
- sym = @symbol(EPROTOTYPE);
- typ = @symbol(wrongSubtypeForOperationSignal);
- break;
+ case EPROTOTYPE:
+ sym = @symbol(EPROTOTYPE);
+ typ = @symbol(wrongSubtypeForOperationSignal);
+ break;
#endif
#ifdef ENOPROTOOPT
- case ENOPROTOOPT:
- sym = @symbol(ENOPROTOOPT);
- typ = @symbol(unsupportedOperationSignal);
- break;
+ case ENOPROTOOPT:
+ sym = @symbol(ENOPROTOOPT);
+ typ = @symbol(unsupportedOperationSignal);
+ break;
#endif
#ifdef EPROTONOSUPPORT
- case EPROTONOSUPPORT:
- sym = @symbol(EPROTONOSUPPORT);
- typ = @symbol(unsupportedOperationSignal);
- break;
+ case EPROTONOSUPPORT:
+ sym = @symbol(EPROTONOSUPPORT);
+ typ = @symbol(unsupportedOperationSignal);
+ break;
#endif
#ifdef ESOCKTNOSUPPORT
- case ESOCKTNOSUPPORT:
- sym = @symbol(ESOCKTNOSUPPORT);
- typ = @symbol(unsupportedOperationSignal);
- break;
+ case ESOCKTNOSUPPORT:
+ sym = @symbol(ESOCKTNOSUPPORT);
+ typ = @symbol(unsupportedOperationSignal);
+ break;
#endif
#ifdef EOPNOTSUPP
- case EOPNOTSUPP:
- sym = @symbol(EOPNOTSUPP);
- typ = @symbol(inappropriateOperationSignal);
- break;
+ case EOPNOTSUPP:
+ sym = @symbol(EOPNOTSUPP);
+ typ = @symbol(inappropriateOperationSignal);
+ break;
#endif
#ifdef EPFNOSUPPORT
- case EPFNOSUPPORT:
- sym = @symbol(EPFNOSUPPORT);
- typ = @symbol(unsupportedOperationSignal);
- break;
+ case EPFNOSUPPORT:
+ sym = @symbol(EPFNOSUPPORT);
+ typ = @symbol(unsupportedOperationSignal);
+ break;
#endif
#ifdef EAFNOSUPPORT
- case EAFNOSUPPORT:
- sym = @symbol(EAFNOSUPPORT);
- typ = @symbol(unsupportedOperationSignal);
- break;
+ case EAFNOSUPPORT:
+ sym = @symbol(EAFNOSUPPORT);
+ typ = @symbol(unsupportedOperationSignal);
+ break;
#endif
#ifdef EADDRINUSE
- case EADDRINUSE:
- sym = @symbol(EADDRINUSE);
- typ = @symbol(existingReferentSignal);
- break;
-#endif
+ case EADDRINUSE:
+ sym = @symbol(EADDRINUSE);
+ typ = @symbol(existingReferentSignal);
+ break;
+#endif
+#ifdef WSAEADDRINUSE
+ case WSAEADDRINUSE:
+ sym = @symbol(WSAEADDRINUSE);
+ typ = @symbol(existingReferentSignal);
+ break;
+#endif
+
#ifdef EADDRNOTAVAIL
- case EADDRNOTAVAIL:
- sym = @symbol(EADDRNOTAVAIL);
- typ = @symbol(noPermissionsSignal);
- break;
+ case EADDRNOTAVAIL:
+ sym = @symbol(EADDRNOTAVAIL);
+ typ = @symbol(noPermissionsSignal);
+ break;
#endif
#ifdef ETIMEDOUT
- case ETIMEDOUT:
- sym = @symbol(ETIMEDOUT);
- typ = @symbol(peerFaultSignal);
- break;
+ case ETIMEDOUT:
+ sym = @symbol(ETIMEDOUT);
+ typ = @symbol(peerFaultSignal);
+ break;
#endif
#ifdef ECONNREFUSED
- case ECONNREFUSED:
- sym = @symbol(ECONNREFUSED);
- typ = @symbol(peerFaultSignal);
- break;
+ case ECONNREFUSED:
+ sym = @symbol(ECONNREFUSED);
+ typ = @symbol(peerFaultSignal);
+ break;
#endif
#ifdef ENETDOWN
- case ENETDOWN:
- sym = @symbol(ENETDOWN);
- typ = @symbol(peerFaultSignal);
- break;
+ case ENETDOWN:
+ sym = @symbol(ENETDOWN);
+ typ = @symbol(peerFaultSignal);
+ break;
#endif
#ifdef ENETUNREACH
- case ENETUNREACH:
- sym = @symbol(ENETUNREACH);
- typ = @symbol(peerFaultSignal);
- break;
+ case ENETUNREACH:
+ sym = @symbol(ENETUNREACH);
+ typ = @symbol(peerFaultSignal);
+ break;
#endif
#ifdef ENETRESET
- case ENETRESET:
- sym = @symbol(ENETRESET);
- typ = @symbol(peerFaultSignal);
- break;
+ case ENETRESET:
+ sym = @symbol(ENETRESET);
+ typ = @symbol(peerFaultSignal);
+ break;
#endif
#ifdef ECONNABORTED
- case ECONNABORTED:
- sym = @symbol(ECONNABORTED);
- typ = @symbol(peerFaultSignal);
- break;
+ case ECONNABORTED:
+ sym = @symbol(ECONNABORTED);
+ typ = @symbol(peerFaultSignal);
+ break;
#endif
#ifdef ECONNRESET
- case ECONNRESET:
- sym = @symbol(ECONNRESET);
- typ = @symbol(peerFaultSignal);
- break;
+ case ECONNRESET:
+ sym = @symbol(ECONNRESET);
+ typ = @symbol(peerFaultSignal);
+ break;
#endif
#ifdef EISCONN
- case EISCONN:
- sym = @symbol(EISCONN);
- typ = @symbol(unpreparedOperationSignal);
- break;
+ case EISCONN:
+ sym = @symbol(EISCONN);
+ typ = @symbol(unpreparedOperationSignal);
+ break;
#endif
#ifdef ENOTCONN
- case ENOTCONN:
- sym = @symbol(ENOTCONN);
- typ = @symbol(unpreparedOperationSignal);
- break;
+ case ENOTCONN:
+ sym = @symbol(ENOTCONN);
+ typ = @symbol(unpreparedOperationSignal);
+ break;
#endif
#ifdef ESHUTDOWN
- case ESHUTDOWN:
- sym = @symbol(ESHUTDOWN);
- typ = @symbol(unpreparedOperationSignal);
- break;
+ case ESHUTDOWN:
+ sym = @symbol(ESHUTDOWN);
+ typ = @symbol(unpreparedOperationSignal);
+ break;
#endif
#ifdef EHOSTDOWN
- case EHOSTDOWN:
- sym = @symbol(EHOSTDOWN);
- typ = @symbol(peerFaultSignal);
- break;
+ case EHOSTDOWN:
+ sym = @symbol(EHOSTDOWN);
+ typ = @symbol(peerFaultSignal);
+ break;
#endif
#ifdef EHOSTUNREACH
- case EHOSTUNREACH:
- sym = @symbol(EHOSTUNREACH);
- typ = @symbol(peerFaultSignal);
- break;
+ case EHOSTUNREACH:
+ sym = @symbol(EHOSTUNREACH);
+ typ = @symbol(peerFaultSignal);
+ break;
#endif
#ifdef WSAEFAULT
- case WSAEFAULT:
- sym = @symbol(WSAEFAULT);
- typ = @symbol(invalidArgumentsSignal);
- break;
+ case WSAEFAULT:
+ sym = @symbol(WSAEFAULT);
+ typ = @symbol(invalidArgumentsSignal);
+ break;
#endif
#ifdef WSAEINTR
- case WSAEINTR:
- sym = @symbol(WSAEINTR);
- typ = @symbol(transientErrorSignal);
- break;
+ case WSAEINTR:
+ sym = @symbol(WSAEINTR);
+ typ = @symbol(transientErrorSignal);
+ break;
#endif
#ifdef WSAEBADF
- case WSAEBADF:
- sym = @symbol(WSAEBADF);
- typ = @symbol(badAccessorSignal);
- break;
-#endif
-#ifdef WSAEACCESS
- case WSAEACCESS:
- sym = @symbol(WSAEACCESS);
- typ = @symbol(badAccessorSignal);
- break;
+ case WSAEBADF:
+ sym = @symbol(WSAEBADF);
+ typ = @symbol(badAccessorSignal);
+ break;
+#endif
+#ifdef WSAEACCES
+ case WSAEACCES:
+ sym = @symbol(WSAEACCES);
+ typ = @symbol(badAccessorSignal);
+ break;
#endif
#ifdef WSAEINVAL
- case WSAEINVAL:
- sym = @symbol(WSAEINVAL);
- typ = @symbol(invalidArgumentsSignal);
- break;
+ case WSAEINVAL:
+ sym = @symbol(WSAEINVAL);
+ typ = @symbol(invalidArgumentsSignal);
+ break;
#endif
#ifdef WSAEMFILE
- case WSAEMFILE:
- sym = @symbol(WSAEMFILE);
- typ = @symbol(noResourcesSignal);
- break;
+ case WSAEMFILE:
+ sym = @symbol(WSAEMFILE);
+ typ = @symbol(noResourcesSignal);
+ break;
#endif
#ifdef WSAEWOULDBLOCK
- case WSAEWOULDBLOCK:
- sym = @symbol(WSAEWOULDBLOCK);
- typ = @symbol(notReadySignal);
- break;
+ case WSAEWOULDBLOCK:
+ sym = @symbol(WSAEWOULDBLOCK);
+ typ = @symbol(notReadySignal);
+ break;
#endif
#ifdef WSAEINPROGRESS
- case WSAEINPROGRESS:
- sym = @symbol(WSAEINPROGRESS);
- typ = @symbol(operationStartedSignal);
- break;
+ case WSAEINPROGRESS:
+ sym = @symbol(WSAEINPROGRESS);
+ typ = @symbol(operationStartedSignal);
+ break;
#endif
#ifdef WSAEALREADY
- case WSAEALREADY:
- sym = @symbol(WSAEALREADY);
- typ = @symbol(operationStartedSignal);
- break;
+ case WSAEALREADY:
+ sym = @symbol(WSAEALREADY);
+ typ = @symbol(operationStartedSignal);
+ break;
#endif
#ifdef WSAENOTSOCK
- case WSAENOTSOCK:
- sym = @symbol(WSAENOTSOCK);
- typ = @symbol(inappropriateOperationSignal);
- break;
+ case WSAENOTSOCK:
+ sym = @symbol(WSAENOTSOCK);
+ typ = @symbol(inappropriateOperationSignal);
+ break;
#endif
#ifdef WSAEPROTONOSUPPORT
- case WSAEPROTONOSUPPORT:
- sym = @symbol(WSAEPROTONOSUPPORT);
- typ = @symbol(unsupportedOperationSignal);
- break;
+ case WSAEPROTONOSUPPORT:
+ sym = @symbol(WSAEPROTONOSUPPORT);
+ typ = @symbol(unsupportedOperationSignal);
+ break;
#endif
#ifdef WSAESOCKTNOSUPPORT
- case WSAESOCKTNOSUPPORT:
- sym = @symbol(WSAESOCKTNOSUPPORT);
- typ = @symbol(unsupportedOperationSignal);
- break;
+ case WSAESOCKTNOSUPPORT:
+ sym = @symbol(WSAESOCKTNOSUPPORT);
+ typ = @symbol(unsupportedOperationSignal);
+ break;
#endif
#ifdef E_NOINTERFACE
- case E_NOINTERFACE:
- sym = @symbol(E_NOINTERFACE);
- typ = @symbol(noInterfaceSignal);
- break;
+ case E_NOINTERFACE:
+ sym = @symbol(E_NOINTERFACE);
+ typ = @symbol(noInterfaceSignal);
+ break;
#endif
#ifdef CO_E_NOTINITIALIZED
- case CO_E_NOTINITIALIZED:
- sym = @symbol(CO_E_NOTINITIALIZED);
- typ = @symbol(coNotInitializedSignal);
- break;
+ case CO_E_NOTINITIALIZED:
+ sym = @symbol(CO_E_NOTINITIALIZED);
+ typ = @symbol(coNotInitializedSignal);
+ break;
#endif
#ifdef REGDB_E_CLASSNOTREG
- case REGDB_E_CLASSNOTREG:
- sym = @symbol(REGDB_E_CLASSNOTREG);
- typ = @symbol(classNotRegisteredSignal);
- break;
+ case REGDB_E_CLASSNOTREG:
+ sym = @symbol(REGDB_E_CLASSNOTREG);
+ typ = @symbol(classNotRegisteredSignal);
+ break;
#endif
#ifdef CLASS_E_NOAGGREGATION
- case CLASS_E_NOAGGREGATION:
- sym = @symbol(CLASS_E_NOAGGREGATION);
- typ = @symbol(noAggregationSignal);
- break;
+ case CLASS_E_NOAGGREGATION:
+ sym = @symbol(CLASS_E_NOAGGREGATION);
+ typ = @symbol(noAggregationSignal);
+ break;
#endif
#ifdef DISP_E_UNKNOWNNAME
- case DISP_E_UNKNOWNNAME:
- sym = @symbol(DISP_E_UNKNOWNNAME);
- typ = @symbol(unknownNameSignal);
- break;
+ case DISP_E_UNKNOWNNAME:
+ sym = @symbol(DISP_E_UNKNOWNNAME);
+ typ = @symbol(unknownNameSignal);
+ break;
#endif
#ifdef OLEOBJ_E_NOVERBS
- case OLEOBJ_E_NOVERBS:
- sym = @symbol(OLEOBJ_E_NOVERBS);
- typ = @symbol(noVerbsSignal);
- break;
-#endif
-
- default:
- break;
- }
+ case OLEOBJ_E_NOVERBS:
+ sym = @symbol(OLEOBJ_E_NOVERBS);
+ typ = @symbol(noVerbsSignal);
+ break;
+#endif
+
+ default:
+ break;
+ }
}
}
%}.
@@ -16700,10 +16706,10 @@
type := OperatingSystem socketTypeCodeOf:typeArg.
proto := self protocolCodeOf:protoArg.
serviceNameArg notNil ifTrue:[
- serviceName := serviceNameArg printString. "convert integer port numbers"
- serviceNameArg isInteger ifTrue:[
- port := serviceNameArg.
- ].
+ serviceName := serviceNameArg printString. "convert integer port numbers"
+ serviceNameArg isInteger ifTrue:[
+ port := serviceNameArg.
+ ].
]. "ifFalse:[serviceName := nil]"
%{ /* STACK:32000 */
@@ -16714,26 +16720,26 @@
int cnt = 0;
if (hostName == nil) {
- __hostName = 0;
+ __hostName = 0;
} else if (__isStringLike(hostName)) {
- strncpy(__hostNameCopy, __stringVal(hostName), sizeof(__hostNameCopy)-1);
- __hostName = __hostNameCopy;
+ strncpy(__hostNameCopy, __stringVal(hostName), sizeof(__hostNameCopy)-1);
+ __hostName = __hostNameCopy;
} else {
- error = @symbol(badArgument1);
- goto exitPrim;
+ error = @symbol(badArgument1);
+ goto exitPrim;
}
if (serviceName == nil) {
- __serviceName = 0;
+ __serviceName = 0;
} else if (__isStringLike(serviceName)) {
- strncpy(__serviceNameCopy, __stringVal(serviceName), sizeof(__serviceNameCopy)-1);
- __serviceName = __serviceNameCopy;
+ strncpy(__serviceNameCopy, __stringVal(serviceName), sizeof(__serviceNameCopy)-1);
+ __serviceName = __serviceNameCopy;
} else {
- error = @symbol(badArgument2);
- goto exitPrim;
+ error = @symbol(badArgument2);
+ goto exitPrim;
}
if (__hostName == 0 && __serviceName == 0) {
- error = @symbol(badArgument);
- goto exitPrim;
+ error = @symbol(badArgument);
+ goto exitPrim;
}
{
@@ -16749,101 +16755,101 @@
memset(&hints, 0, sizeof(hints));
if (__isSmallInteger(domain))
- hints.ai_family = __intVal(domain);
+ hints.ai_family = __intVal(domain);
if (__isSmallInteger(type))
- hints.ai_socktype = __intVal(type);
+ hints.ai_socktype = __intVal(type);
if (__isSmallInteger(proto))
- hints.ai_protocol = __intVal(proto);
+ hints.ai_protocol = __intVal(proto);
do {
# ifdef DO_WRAP_CALLS
- do {
- __threadErrno = 0;
- // do not cast to INT - will loose sign bit then!
- ret = STX_WSA_NOINT_CALL4( "getaddrinfo", getaddrinfo, __hostName, __serviceName, &hints, &info);
- } while ((ret < 0) && (__threadErrno == EINTR));
+ do {
+ __threadErrno = 0;
+ // do not cast to INT - will loose sign bit then!
+ ret = STX_WSA_NOINT_CALL4( "getaddrinfo", getaddrinfo, __hostName, __serviceName, &hints, &info);
+ } while ((ret < 0) && (__threadErrno == EINTR));
# else
- __BEGIN_INTERRUPTABLE__
- ret = getaddrinfo(__hostName, __serviceName, &hints, &info);
- __END_INTERRUPTABLE__
+ __BEGIN_INTERRUPTABLE__
+ ret = getaddrinfo(__hostName, __serviceName, &hints, &info);
+ __END_INTERRUPTABLE__
# endif
} while (ret != 0 && __threadErrno == EINTR);
if (ret != 0) {
- switch (ret) {
- case EAI_FAMILY:
- error = @symbol(badProtocol);
- break;
- case EAI_SOCKTYPE:
- error = @symbol(badSocketType);
- break;
- case EAI_BADFLAGS:
- error = @symbol(badFlags);
- break;
- case EAI_NONAME:
- error = @symbol(unknownHost);
- break;
- case EAI_SERVICE:
- error = @symbol(unknownService);
- break;
- case EAI_MEMORY:
- error = @symbol(allocationFailure);
- break;
- case EAI_FAIL:
- error = @symbol(permanentFailure);
- break;
- case EAI_AGAIN:
- error = @symbol(tryAgain);
- break;
- default:
- error = @symbol(unknownError);
- }
- errorString = __MKSTRING(gai_strerror(ret));
- goto err;
+ switch (ret) {
+ case EAI_FAMILY:
+ error = @symbol(badProtocol);
+ break;
+ case EAI_SOCKTYPE:
+ error = @symbol(badSocketType);
+ break;
+ case EAI_BADFLAGS:
+ error = @symbol(badFlags);
+ break;
+ case EAI_NONAME:
+ error = @symbol(unknownHost);
+ break;
+ case EAI_SERVICE:
+ error = @symbol(unknownService);
+ break;
+ case EAI_MEMORY:
+ error = @symbol(allocationFailure);
+ break;
+ case EAI_FAIL:
+ error = @symbol(permanentFailure);
+ break;
+ case EAI_AGAIN:
+ error = @symbol(tryAgain);
+ break;
+ default:
+ error = @symbol(unknownError);
+ }
+ errorString = __MKSTRING(gai_strerror(ret));
+ goto err;
}
for (cnt=0, infop=info; infop; infop=infop->ai_next)
- cnt++;
+ cnt++;
result = __ARRAY_NEW_INT(cnt);
if (result == nil) {
- error = @symbol(allocationFailure);
- goto err;
+ error = @symbol(allocationFailure);
+ goto err;
}
for (infop=info, cnt=0; infop; infop=infop->ai_next, cnt++) {
- OBJ o, resp;
-
- resp = __ARRAY_NEW_INT(6);
- if (resp == nil) {
- error = @symbol(allocationFailure);
- goto err;
- }
-
- __ArrayInstPtr(result)->a_element[cnt] = resp; __STORE(result, resp);
-
- __ArrayInstPtr(resp)->a_element[0] = __mkSmallInteger(infop->ai_flags);
- __ArrayInstPtr(resp)->a_element[1] = __mkSmallInteger(infop->ai_family);
- __ArrayInstPtr(resp)->a_element[2] = __mkSmallInteger(infop->ai_socktype);
- __ArrayInstPtr(resp)->a_element[3] = __mkSmallInteger(infop->ai_protocol);
-
- __PROTECT__(resp);
- o = __BYTEARRAY_NEW_INT(infop->ai_addrlen);
- __UNPROTECT__(resp);
- if (o == nil) {
- error = @symbol(allocationFailure);
- goto err;
- }
- memcpy(__byteArrayVal(o), infop->ai_addr, infop->ai_addrlen);
+ OBJ o, resp;
+
+ resp = __ARRAY_NEW_INT(6);
+ if (resp == nil) {
+ error = @symbol(allocationFailure);
+ goto err;
+ }
+
+ __ArrayInstPtr(result)->a_element[cnt] = resp; __STORE(result, resp);
+
+ __ArrayInstPtr(resp)->a_element[0] = __mkSmallInteger(infop->ai_flags);
+ __ArrayInstPtr(resp)->a_element[1] = __mkSmallInteger(infop->ai_family);
+ __ArrayInstPtr(resp)->a_element[2] = __mkSmallInteger(infop->ai_socktype);
+ __ArrayInstPtr(resp)->a_element[3] = __mkSmallInteger(infop->ai_protocol);
+
+ __PROTECT__(resp);
+ o = __BYTEARRAY_NEW_INT(infop->ai_addrlen);
+ __UNPROTECT__(resp);
+ if (o == nil) {
+ error = @symbol(allocationFailure);
+ goto err;
+ }
+ memcpy(__byteArrayVal(o), infop->ai_addr, infop->ai_addrlen);
__ArrayInstPtr(resp)->a_element[4] = o; __STORE(resp, o);
- if (infop->ai_canonname) {
- __PROTECT__(resp);
- o = __MKSTRING(infop->ai_canonname);
- __UNPROTECT__(resp);
- if (o == nil) {
- error = @symbol(allocationFailure);
- goto err;
- }
- __ArrayInstPtr(resp)->a_element[5] = o; __STORE(resp, o);
- }
+ if (infop->ai_canonname) {
+ __PROTECT__(resp);
+ o = __MKSTRING(infop->ai_canonname);
+ __UNPROTECT__(resp);
+ if (o == nil) {
+ error = @symbol(allocationFailure);
+ goto err;
+ }
+ __ArrayInstPtr(resp)->a_element[5] = o; __STORE(resp, o);
+ }
}
err:
@@ -16860,130 +16866,134 @@
int i;
if (__isSmallInteger(port)) {
- __port = htons(__smallIntegerVal(port));
+ __port = htons(__smallIntegerVal(port));
} else if (__serviceName) {
- struct servent *sp;
- char *__proto = 0;
-
- if (__isStringLike(protoArg))
- __proto = __stringVal(protoArg);
-
- sp = getservbyname(__serviceName, __proto);
- if (sp == NULL) {
- __port = atoi(__serviceName);
- if (__port <= 0) {
- errorString = @symbol(unknownService);
- error = __mkSmallInteger(-3);
- goto err;
- }
- __port = htons(__port);
- } else
- __port = sp->s_port;
+ struct servent *sp;
+ char *__proto = 0;
+
+ if (__isStringLike(protoArg))
+ __proto = __stringVal(protoArg);
+
+ sp = getservbyname(__serviceName, __proto);
+ if (sp == NULL) {
+ __port = atoi(__serviceName);
+ if (__port <= 0) {
+ errorString = @symbol(unknownService);
+ error = __mkSmallInteger(-3);
+ goto err;
+ }
+ __port = htons(__port);
+ } else
+ __port = sp->s_port;
}
if (__hostName) {
- int err;
-
- do {
+ int err;
+
+ do {
# if 0 && defined(DO_WRAP_CALLS)
- /* This does not work - the structure is allocated in thread local storage */
- hp = STX_WSA_NOINT_CALL1("gethostbyname", gethostbyname, __hostName);
- if ((INT)hp < 0) hp = NULL;
+ /* This does not work - the structure is allocated in thread local storage */
+ hp = STX_WSA_NOINT_CALL1("gethostbyname", gethostbyname, __hostName);
+ if ((INT)hp < 0) hp = NULL;
# else
- /* __BEGIN_INTERRUPTABLE__ is dangerous, because gethostbyname
- * uses a static data area, but allocates it in thread local storage
- */
- // __BEGIN_INTERRUPTABLE__
- hp = gethostbyname(__hostName);
- // __END_INTERRUPTABLE__
-#endif
- } while ((hp == NULL
- && (err = WSAGetLastError()) == EINTR
- || err == TRY_AGAIN));
- if (hp == 0) {
- switch (err) {
- case HOST_NOT_FOUND:
- errorString = @symbol(unknownHost);
- break;
- case NO_ADDRESS:
- errorString = @symbol(noAddress);
- break;
- case NO_RECOVERY:
- errorString = @symbol(permanentFailure);
- break;
- case TRY_AGAIN:
- errorString = @symbol(tryAgain);
- break;
- default:
- errorString = @symbol(unknownError);
- break;
- }
- error = __mkSmallInteger(err);
- goto err;
- }
-
- if (__isSmallInteger(domain) && hp->h_addrtype != __smallIntegerVal(domain)) {
- errorString = @symbol(unknownHost);
- error = __mkSmallInteger(-2);
- goto err;
- }
-
- for (cnt = 0, addrpp = hp->h_addr_list; *addrpp; addrpp++)
- cnt++;
- addrpp = hp->h_addr_list;
+ /* __BEGIN_INTERRUPTABLE__ is dangerous, because gethostbyname
+ * uses a static data area, but allocates it in thread local storage
+ */
+ // __BEGIN_INTERRUPTABLE__
+ hp = gethostbyname(__hostName);
+ // __END_INTERRUPTABLE__
+#endif
+ } while ((hp == NULL
+ && (err = WSAGetLastError()) == EINTR
+ || err == TRY_AGAIN));
+ if (hp == 0) {
+ switch (err) {
+ case HOST_NOT_FOUND:
+ errorString = @symbol(unknownHost);
+ break;
+ case NO_ADDRESS:
+ errorString = @symbol(noAddress);
+ break;
+ case NO_RECOVERY:
+ errorString = @symbol(permanentFailure);
+ break;
+ case TRY_AGAIN:
+ errorString = @symbol(tryAgain);
+ break;
+ default:
+ errorString = @symbol(unknownError);
+ break;
+ }
+ error = __mkSmallInteger(err);
+ goto err;
+ }
+
+ if (__isSmallInteger(domain) && hp->h_addrtype != __smallIntegerVal(domain)) {
+ errorString = @symbol(unknownHost);
+ error = __mkSmallInteger(-2);
+ goto err;
+ }
+
+ for (cnt = 0, addrpp = hp->h_addr_list; *addrpp; addrpp++)
+ cnt++;
+ addrpp = hp->h_addr_list;
} else {
- cnt = 1;
+ cnt = 1;
}
result = __ARRAY_NEW_INT(cnt);
if (result == nil) {
- error = @symbol(allocationFailure);
- goto err;
+ error = @symbol(allocationFailure);
+ goto err;
}
for (i = 0; i < cnt; i++) {
- OBJ o, resp;
- struct sockaddr_in *sa;
-
- resp = __ARRAY_NEW_INT(6);
- if (resp == nil) {
- error = @symbol(allocationFailure);
- goto err;
- }
-
- __ArrayInstPtr(result)->a_element[i] = resp; __STORE(result, resp);
- __ArrayInstPtr(resp)->a_element[0] = __mkSmallInteger(0);
- __ArrayInstPtr(resp)->a_element[2] = type; __STORE(resp, type);
- __ArrayInstPtr(resp)->a_element[3] = proto; __STORE(resp, proto);
- __PROTECT__(resp);
- o = __BYTEARRAY_NEW_INT(sizeof(*sa));
- __UNPROTECT__(resp);
- if (o == nil) {
- error = @symbol(allocationFailure);
- goto err;
- }
- __ArrayInstPtr(resp)->a_element[4] = o; __STORE(resp, o);
- sa = (struct sockaddr_in *)__byteArrayVal(o);
- sa->sin_port = __port;
-
- if (__hostName) {
- sa->sin_family = hp->h_addrtype;
- memcpy(&sa->sin_addr, *addrpp, hp->h_length);
- __ArrayInstPtr(resp)->a_element[1] = __mkSmallInteger(hp->h_addrtype);
- if (hp->h_name) {
- __PROTECT__(resp);
- o = __MKSTRING(hp->h_name);
- __UNPROTECT__(resp);
- if (o == nil) {
- error = @symbol(allocationFailure);
- goto err;
- }
- __ArrayInstPtr(resp)->a_element[5] = o; __STORE(resp, o);
- }
- addrpp++;
- } else{
- __ArrayInstPtr(resp)->a_element[1] = domain; __STORE(resp, domain);
- }
+ OBJ o, resp;
+ struct sockaddr_in *sa;
+
+ resp = __ARRAY_NEW_INT(6);
+ if (resp == nil) {
+ error = @symbol(allocationFailure);
+ goto err;
+ }
+
+ __ArrayInstPtr(result)->a_element[i] = resp; __STORE(result, resp);
+ __ArrayInstPtr(resp)->a_element[0] = __mkSmallInteger(0);
+ __ArrayInstPtr(resp)->a_element[2] = type; __STORE(resp, type);
+ __ArrayInstPtr(resp)->a_element[3] = proto; __STORE(resp, proto);
+ __PROTECT__(resp);
+ o = __BYTEARRAY_NEW_INT(sizeof(*sa));
+ __UNPROTECT__(resp);
+ if (o == nil) {
+ error = @symbol(allocationFailure);
+ goto err;
+ }
+ __ArrayInstPtr(resp)->a_element[4] = o; __STORE(resp, o);
+ sa = (struct sockaddr_in *)__byteArrayVal(o);
+ sa->sin_port = __port;
+
+ if (__hostName) {
+ sa->sin_family = hp->h_addrtype;
+ memcpy(&sa->sin_addr, *addrpp, hp->h_length);
+ __ArrayInstPtr(resp)->a_element[1] = __mkSmallInteger(hp->h_addrtype);
+ if (hp->h_name) {
+ __PROTECT__(resp);
+ o = __MKSTRING(hp->h_name);
+ __UNPROTECT__(resp);
+ if (o == nil) {
+ error = @symbol(allocationFailure);
+ goto err;
+ }
+ __ArrayInstPtr(resp)->a_element[5] = o; __STORE(resp, o);
+ }
+ addrpp++;
+ } else{
+ if (__isSmallInteger(domain))
+ sa->sin_family = __intVal(domain);
+ else
+ sa->sin_family = AF_INET;
+ __ArrayInstPtr(resp)->a_element[1] = domain; __STORE(resp, domain);
+ }
}
err:;
@@ -16995,61 +17005,61 @@
exitPrim:;
%}.
error notNil ifTrue:[
- |request|
- error isSymbol ifTrue:[
- self primitiveFailed:error.
- ].
- request := SocketAddressInfo new
- domain:domainArg;
- type:typeArg;
- protocol:protoArg;
- canonicalName:hostName;
- serviceName:serviceName.
- ^ (HostNameLookupError new
- parameter:error;
- messageText:' - ', (errorString ? error printString);
- request:request) raiseRequest.
+ |request|
+ error isSymbol ifTrue:[
+ self primitiveFailed:error.
+ ].
+ request := SocketAddressInfo new
+ domain:domainArg;
+ type:typeArg;
+ protocol:protoArg;
+ canonicalName:hostName;
+ serviceName:serviceName.
+ ^ (HostNameLookupError new
+ parameter:error;
+ messageText:' - ', (errorString ? error printString);
+ request:request) raiseRequest.
].
1 to:result size do:[:i |
- |entry dom info|
-
- info := SocketAddressInfo new.
- entry := result at:i.
- info flags:(entry at:1).
- info domain:(dom := OperatingSystem domainSymbolOf:(entry at:2)).
- info type:(OperatingSystem socketTypeSymbolOf:(entry at:3)).
- info protocol:(self protocolSymbolOf:(entry at:4)).
- info socketAddress:((SocketAddress newDomain:dom) fromBytes:(entry at:5)).
- info canonicalName:(entry at:6).
- result at:i put:info
+ |entry dom info|
+
+ info := SocketAddressInfo new.
+ entry := result at:i.
+ info flags:(entry at:1).
+ info domain:(dom := OperatingSystem domainSymbolOf:(entry at:2)).
+ info type:(OperatingSystem socketTypeSymbolOf:(entry at:3)).
+ info protocol:(self protocolSymbolOf:(entry at:4)).
+ info socketAddress:((SocketAddress newDomain:dom) fromBytes:(entry at:5)).
+ info canonicalName:(entry at:6).
+ result at:i put:info
].
^ result
"
self getAddressInfo:'localhost' serviceName:nil
- domain:nil type:nil protocol:nil flags:nil
+ domain:nil type:nil protocol:nil flags:nil
self getAddressInfo:'localhost' serviceName:nil
- domain:#AF_INET type:#stream protocol:nil flags:nil
+ domain:#AF_INET type:#stream protocol:nil flags:nil
self getAddressInfo:'localhost' serviceName:nil
- domain:#AF_INET type:#stream protocol:#tcp flags:nil
+ domain:#AF_INET type:#stream protocol:#tcp flags:nil
self getAddressInfo:'localhost' serviceName:10
- domain:#AF_INET type:#stream protocol:#tcp flags:nil
+ domain:#AF_INET type:#stream protocol:#tcp flags:nil
self getAddressInfo:'localhost' serviceName:'10'
- domain:#AF_INET type:#stream protocol:#tcp flags:nil
+ domain:#AF_INET type:#stream protocol:#tcp flags:nil
self getAddressInfo:'blurb.exept.de' serviceName:nil
- domain:#AF_INET type:nil protocol:nil flags:nil
+ domain:#AF_INET type:nil protocol:nil flags:nil
self getAddressInfo:'1.2.3.4' serviceName:'bla'
- domain:#AF_INET type:nil protocol:nil flags:nil
+ domain:#AF_INET type:nil protocol:nil flags:nil
self getAddressInfo:'localhost' serviceName:'echo'
- domain:#AF_INET type:nil protocol:nil flags:nil
+ domain:#AF_INET type:nil protocol:nil flags:nil
self getAddressInfo:nil serviceName:'echo'
- domain:#AF_INET type:nil protocol:nil flags:nil
+ domain:#AF_INET type:nil protocol:nil flags:nil
self getAddressInfo:nil serviceName:nil
- domain:#AF_INET type:nil protocol:nil flags:nil
+ domain:#AF_INET type:nil protocol:nil flags:nil
self getAddressInfo:'www.google.de' serviceName:nil
- domain:nil type:nil protocol:nil flags:nil
+ domain:nil type:nil protocol:nil flags:nil
self getAddressInfo:'smc1' serviceName:nil
- domain:nil type:nil protocol:nil flags:nil
+ domain:nil type:nil protocol:nil flags:nil
"
!
@@ -17335,15 +17345,15 @@
!Win32OperatingSystem class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.479 2013-10-14 16:58:44 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.480 2013-11-15 09:52:16 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.479 2013-10-14 16:58:44 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.480 2013-11-15 09:52:16 stefan Exp $'
!
version_SVN
- ^ '$Id: Win32OperatingSystem.st,v 1.479 2013-10-14 16:58:44 cg Exp $'
+ ^ '$Id: Win32OperatingSystem.st,v 1.480 2013-11-15 09:52:16 stefan Exp $'
! !