--- a/.hgtags Mon Jul 01 22:14:20 2013 +0100
+++ b/.hgtags Tue Jul 09 22:51:30 2013 +0100
@@ -8,14 +8,14 @@
27fb4984e97ba85d254d442042a0a57688f8f586 expecco_1_7_0rc8
288a01786ed5f59915047167fba6c00b36226c4a expeccoNET_1_5_1rc1
28ef0472cf2f08acd9c2056a517e1fae4bc8033d expecco_2_2_5
-2a27aa34e65bdbf5d9af53c6ccc467549e8b00c0 stable
2f39b0b6f4e6ecc84a698e16accec417b27b0da4 expecco_1_3_4
+353aa0894d7d54bf9f017788ecb8b9c7933f1b76 expecco_2_5_1
+353aa0894d7d54bf9f017788ecb8b9c7933f1b76 stable
373af30a15cafccd184b57b8492979e1969af65f rel3_4_1_1
3816e831f5f3ed00876f38adbfaf1a25ad010ed7 rel2_10_8_6_last_before_vmData_change
471ed2bb3bf16111afbf2e0d6dfb422d78294aca expecco_1_0_3
520c27f8cae267240021277e257e013b60b9cdb8 rel5_2_2
54dd825d531c7adec355b2ffbdd6b66d00d4678a expecco_1_6_0rc5
-56edc9d911403e8f3b20c97f3c89e5da01cea0d5 expecco_2_5_1
5fcd709c7fd282e9c55d8642d1a6b1d5d77baf5e expecco_2_5_0
615c4fe0f449a6be077b11450d39fb6560b1695a rel4_1_3_1
62ff001533901d30b624539b2f404d73f01db468 expecco_1_6_0
--- a/AbstractOperatingSystem.st Mon Jul 01 22:14:20 2013 +0100
+++ b/AbstractOperatingSystem.st Tue Jul 09 22:51:30 2013 +0100
@@ -605,12 +605,53 @@
This looks for the files extension, and is typically used to present help-files,
html documents, pdf documents etc.
operationSymbol is one of:
- open
- edit
- explore
- "
-
- "/ use a fileBrowser
+ open
+ edit
+ explore
+ "
+
+ self openApplicationForDocument:aFilenameOrString operation:operationSymbol mimeType:nil
+!
+
+openApplicationForDocument:aFilenameOrString operation:operationSymbol mimeType:mimeTypeStringArg
+ "open a windows-shell application to present the document contained in aFilenameOrString.
+ This looks for the files extension, and is typically used to present help-files,
+ html documents, pdf documents etc.
+ operationSymbol is one of:
+ open
+ edit
+ explore
+ mimeTypeStringArg is e.g. 'text/html' or: 'application/pdf'
+ "
+
+ |openCommand mimeTypeString|
+
+ mimeTypeString := mimeTypeStringArg.
+
+ MIMETypes notNil ifTrue:[
+ mimeTypeString isNil ifTrue:[
+ mimeTypeString := MIMETypes mimeTypeForFilename:aFilenameOrString.
+ ].
+ openCommand := MIMETypes defaultCommandTemplateToOpenMimeType:mimeTypeString.
+ ].
+ openCommand notEmptyOrNil ifTrue:[
+ (openCommand includesSubString:'%1') ifTrue:[
+ openCommand := openCommand bindWith:aFilenameOrString asString.
+ ] ifFalse:[
+ openCommand := openCommand, ' "', aFilenameOrString asString, '"'.
+ ].
+
+ (self
+ startProcess:openCommand
+ inputFrom:nil outputTo:nil
+ errorTo:nil auxFrom:nil
+ environment:nil inDirectory:nil) notNil
+ ifTrue:[
+ ^ self.
+ ].
+ ].
+
+ "/ last resort: use a fileBrowser
UserPreferences current fileBrowserClass openOn:aFilenameOrString
"
@@ -2284,6 +2325,15 @@
"
!
+accessModeOfFd:aFileDescriptor
+ "return a number representing access rights rwxrwxrwx for owner,
+ group and others. Return nil if such a file does not exist.
+ Notice that the returned number is OS dependent - use the
+ modeMasks as returned by OperatingSystem>>accessMaskFor:"
+
+ ^ self subclassResponsibility
+!
+
changeAccessModeOf:aPathName to:modeBits
"change the access rights of aPathName to the OS dependent modeBits.
You should construct this mask using accessMaskFor, to be OS
@@ -2291,6 +2341,16 @@
false if such a file does not exist or change was not allowd."
self subclassResponsibility
+!
+
+changeAccessModeOfFd:aFileDescriptor to:modeBits
+ "change the access rights of the file referenced by aFileDescriptor
+ to the OS dependent modeBits.
+ You should construct this mask using accessMaskFor, to be OS
+ independent. Return true if changed,
+ false if such a file does not exist or change was not allowd."
+
+ ^ self subclassResponsibility
! !
!AbstractOperatingSystem class methodsFor:'file locking'!
@@ -7189,11 +7249,11 @@
!AbstractOperatingSystem class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/AbstractOperatingSystem.st,v 1.237 2013-05-15 13:57:09 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/AbstractOperatingSystem.st,v 1.239 2013-07-08 19:27:09 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/AbstractOperatingSystem.st,v 1.237 2013-05-15 13:57:09 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/AbstractOperatingSystem.st,v 1.239 2013-07-08 19:27:09 stefan Exp $'
! !
--- a/AutoDeletedFilename.st Mon Jul 01 22:14:20 2013 +0100
+++ b/AutoDeletedFilename.st Tue Jul 09 22:51:30 2013 +0100
@@ -92,9 +92,37 @@
!AutoDeletedFilename methodsFor:'accessing'!
+keep
+ "do not delete the file on finalization"
+
+ self unregisterForFinalization
+!
+
+setName:aString
+ super setName:aString.
+ self registerForFinalization
+! !
+
+!AutoDeletedFilename methodsFor:'copying'!
+
+shallowCopy
+ "when copying, return a real filename
+ (to avoid mutiple removals)"
+
+ ^ Filename named:nameString
+
+ "
+ 'blaFaselQall.mist' asFilename asAutoDeletedFilename copy
+ "
+! !
+
+!AutoDeletedFilename methodsFor:'finalization'!
+
+executor
+ ^ self class basicNew nameString:nameString
+!
+
finalize
-"/ Transcript showCR:'AutoDeletedFilename: deleting ', self pathName.
-
|linkInfo|
linkInfo := self linkInfo.
@@ -105,11 +133,6 @@
super removeFile.
].
].
-!
-
-setName:aString
- super setName:aString.
- self registerForFinalization
! !
!AutoDeletedFilename methodsFor:'removing'!
@@ -137,6 +160,6 @@
!AutoDeletedFilename class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/AutoDeletedFilename.st,v 1.9 2013-05-15 10:25:11 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/AutoDeletedFilename.st,v 1.10 2013-07-05 12:32:08 stefan Exp $'
! !
--- a/Bag.st Mon Jul 01 22:14:20 2013 +0100
+++ b/Bag.st Tue Jul 09 22:51:30 2013 +0100
@@ -427,6 +427,30 @@
^ count
! !
+!Bag methodsFor:'statistical functions'!
+
+variance
+ "compute the variance over a complete data set (and not of a sample)"
+
+ |m sz sumDeltaSquares|
+
+ m := self arithmeticMean.
+ sumDeltaSquares := 0.
+ sz := 0.
+ self
+ valuesAndCountsDo:[:val :count |
+ sumDeltaSquares := sumDeltaSquares + ((val - m) squared).
+ sz := sz + 1.
+ ].
+
+ ^ sumDeltaSquares / sz
+
+ "
+ TestCase assert:( #(1 1 1 2 2 2 1 1 1 2 2 2) asBag variance = #(1 1 1 2 2 2 1 1 1 2 2 2) variance).
+ TestCase assert:( #(1 1 1 1 1 0 0 0 0 0) asBag variance = #(1 1 1 1 1 0 0 0 0 0) variance).
+ "
+! !
+
!Bag methodsFor:'testing'!
includes:anObject
@@ -450,10 +474,10 @@
!Bag class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Bag.st,v 1.45 2013-06-25 11:23:48 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Bag.st,v 1.46 2013-07-04 15:46:20 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/Bag.st,v 1.45 2013-06-25 11:23:48 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Bag.st,v 1.46 2013-07-04 15:46:20 stefan Exp $'
! !
--- a/BlockContext.st Mon Jul 01 22:14:20 2013 +0100
+++ b/BlockContext.st Tue Jul 09 22:51:30 2013 +0100
@@ -155,6 +155,10 @@
(nargs == 6) ifTrue:[^ #value:value:value:value:value:value:].
(nargs == 7) ifTrue:[^ #value:value:value:value:value:value:value:].
(nargs == 8) ifTrue:[^ #value:value:value:value:value:value:value:value:].
+ (nargs == 9) ifTrue:[^ #value:value:value:value:value:value:value:value:value:].
+ (nargs == 10) ifTrue:[^ #value:value:value:value:value:value:value:value:value:value:].
+ (nargs == 11) ifTrue:[^ #value:value:value:value:value:value:value:value:value:value:value:].
+ (nargs == 12) ifTrue:[^ #value:value:value:value:value:value:value:value:value:value:value:value:].
^ nil
! !
@@ -257,10 +261,10 @@
!BlockContext class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/BlockContext.st,v 1.38 2013-06-07 13:32:46 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/BlockContext.st,v 1.39 2013-07-04 06:29:43 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/BlockContext.st,v 1.38 2013-06-07 13:32:46 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/BlockContext.st,v 1.39 2013-07-04 06:29:43 cg Exp $'
! !
--- a/Class.st Mon Jul 01 22:14:20 2013 +0100
+++ b/Class.st Tue Jul 09 22:51:30 2013 +0100
@@ -1682,34 +1682,33 @@
source
"return the classes full source code"
- |code aStream tmpFilename|
+ |code aStream|
" this is too slow for big classes (due to the emphasis stored)...
code := String new:1000.
aStream := WriteStream on:code.
self fileOutOn:aStream
"
- tmpFilename := Filename newTemporary.
[
- aStream := tmpFilename newReadWriteStream.
- aStream removeOnClose:true.
+ aStream := FileStream newTemporary.
+ aStream removeOnClose:true.
] on:OpenError do:[:ex|
- self warn:'Class>>#source: cannot create temporary file: ', ex description.
- ^ nil
+ self warn:'Class>>#source: cannot create temporary file: ', ex description.
+ ^ nil
].
[
- FileOutErrorSignal handle:[:ex |
- aStream nextPut:$" ; nextPutAll:ex description; nextPut:$".
- FileOutErrorSignal isHandled ifTrue:[
- ex reject.
- ].
- ] do:[
- self fileOutOn:aStream.
- ].
- aStream reset.
- code := aStream contents.
+ FileOutErrorSignal handle:[:ex |
+ aStream nextPut:$" ; nextPutAll:ex description; nextPut:$".
+ FileOutErrorSignal isHandled ifTrue:[
+ ex reject.
+ ].
+ ] do:[
+ self fileOutOn:aStream.
+ ].
+ aStream reset.
+ code := aStream contents.
] ensure:[
- aStream close.
+ aStream close.
].
^ code
@@ -2480,7 +2479,7 @@
"Modified: 22.3.1997 / 16:12:17 / cg"
!
-fileOutAs:fileNameString
+fileOutAs:filenameString
"create a file consisting of all methods in myself in
sourceForm, from which the class can be reconstructed (by filing in).
The given fileName should be a full path, including suffix.
@@ -2489,8 +2488,8 @@
Also, since the classes methods need a valid sourcefile, the current
sourceFile may not be rewritten."
- |aStream fileName newFileName savFilename needRename
- mySourceFileName sameFile s mySourceFileID anySourceRef|
+ |filename fileExists needRename
+ mySourceFileName sameFile s mySourceFileID anySourceRef outStream savFilename|
self isLoaded ifFalse:[
^ FileOutErrorSignal
@@ -2498,105 +2497,103 @@
errorString:' - will not fileOut unloaded class: ', self name
].
- fileName := fileNameString asFilename.
+ filename := filenameString asFilename.
"
if file exists, copy the existing to a .sav-file,
create the new file as XXX.new-file,
and, if that worked rename afterwards ...
"
- (fileName exists) ifTrue:[
- sameFile := false.
-
- "/ check carefully - maybe, my source does not really come from that
- "/ file (i.e. all of my methods have their source as string)
-
- anySourceRef := false.
- self instAndClassMethodsDo:[:m |
- m sourcePosition notNil ifTrue:[
- anySourceRef := true
- ]
- ].
-
- anySourceRef ifTrue:[
- s := self sourceStream.
- s notNil ifTrue:[
- OperatingSystem isUNIXlike ifTrue:[
- mySourceFileID := s pathName asFilename info id.
- sameFile := (fileName info id) == mySourceFileID.
- ] ifFalse:[
- mySourceFileID := s pathName asFilename asAbsoluteFilename.
- sameFile := (fileName asFilename asAbsoluteFilename) = mySourceFileID.
- ].
- s close.
- ] ifFalse:[
- classFilename notNil ifTrue:[
- "
- check for overwriting my current source file
- this is not allowed, since it would clobber my methods source
- file ... you have to save it to some other place.
- This happens if you ask for a fileOut into the source-directory
- (from which my methods get their source)
- "
- mySourceFileName := Smalltalk getSourceFileName:classFilename.
- sameFile := (fileNameString = mySourceFileName).
- sameFile ifFalse:[
- mySourceFileName notNil ifTrue:[
- OperatingSystem isUNIXlike ifTrue:[
- sameFile := (fileName info id) == (mySourceFileName asFilename info id)
- ]
- ]
- ].
+ [
+ fileExists := filename exists.
+ fileExists ifTrue:[
+ sameFile := false.
+
+ "/ check carefully - maybe, my source does not really come from that
+ "/ file (i.e. all of my methods have their source as string)
+
+ anySourceRef := false.
+ self instAndClassMethodsDo:[:m |
+ m sourcePosition notNil ifTrue:[
+ anySourceRef := true
]
].
- ].
-
- sameFile ifTrue:[
- ^ FileOutErrorSignal
- raiseRequestWith:fileNameString
- errorString:(' - may not overwrite sourcefile: %1\try again after loading sources in the browser' withCRs bindWith:fileNameString)
- ].
-
- savFilename := Filename newTemporary.
- fileName copyTo:savFilename.
- newFileName := fileName withSuffix:'new'.
- needRename := true
- ] ifFalse:[
- "/ another possible trap: if my sourceFileName is
- "/ the same as the written one AND the new files directory
- "/ is along the sourcePath, we also need a temporary file
- "/ first, to avoid accessing the newly written file.
-
- anySourceRef := false.
- self instAndClassMethodsDo:[:m |
- |mSrc|
-
- (mSrc := m sourceFilename) notNil ifTrue:[
- mSrc asFilename baseName = fileName baseName ifTrue:[
- anySourceRef := true
+
+ anySourceRef ifTrue:[
+ s := self sourceStream.
+ s notNil ifTrue:[
+ OperatingSystem isUNIXlike ifTrue:[
+ mySourceFileID := s pathName asFilename info id.
+ sameFile := (filename info id) == mySourceFileID.
+ ] ifFalse:[
+ mySourceFileID := s pathName asFilename asAbsoluteFilename.
+ sameFile := (filename asFilename asAbsoluteFilename) = mySourceFileID.
+ ].
+ s close.
+ ] ifFalse:[
+ classFilename notNil ifTrue:[
+ "
+ check for overwriting my current source file
+ this is not allowed, since it would clobber my methods source
+ file ... you have to save it to some other place.
+ This happens if you ask for a fileOut into the source-directory
+ (from which my methods get their source)
+ "
+ mySourceFileName := Smalltalk getSourceFileName:classFilename.
+ sameFile := (filenameString = mySourceFileName).
+ sameFile ifFalse:[
+ mySourceFileName notNil ifTrue:[
+ OperatingSystem isUNIXlike ifTrue:[
+ sameFile := (filename info id) == (mySourceFileName asFilename info id)
+ ]
+ ]
+ ].
+ ]
+ ].
+ ].
+
+ sameFile ifTrue:[
+ ^ FileOutErrorSignal
+ raiseRequestWith:filenameString
+ errorString:(' - may not overwrite sourcefile: %1\try again after loading sources in the browser' withCRs bindWith:filenameString)
+ ].
+
+ outStream := FileStream newTemporaryIn:filename directory.
+ outStream fileName accessRights:filename accessRights.
+ needRename := true
+ ] ifFalse:[
+ "/ another possible trap: if my sourceFileName is
+ "/ the same as the written one AND the new files directory
+ "/ is along the sourcePath, we also need a temporary file
+ "/ first, to avoid accessing the newly written file.
+
+ self instAndClassMethodsDo:[:m |
+ |mSrc mSrcFilename|
+
+ (anySourceRef isNil and:[(mSrc := m sourceFilename) notNil]) ifTrue:[
+ mSrcFilename := mSrc asFilename.
+ (mSrcFilename baseName = filename baseName
+ and:[mSrcFilename exists]) ifTrue:[
+ anySourceRef := mSrcFilename.
+ ]
]
+ ].
+ anySourceRef notNil ifTrue:[
+ outStream := FileStream newTemporaryIn:filename directory.
+ outStream fileName accessRights:anySourceRef accessRights.
+ needRename := true
+ ] ifFalse:[
+ outStream := filename writeStream.
+ needRename := false
]
].
- anySourceRef ifTrue:[
- newFileName := fileName withSuffix:'new'.
- needRename := true
- ] ifFalse:[
- newFileName := fileName.
- needRename := false
- ]
+ ] on:FileStream openErrorSignal do:[:ex|
+ ^ FileOutErrorSignal
+ raiseRequestWith:filename name
+ errorString:(' - cannot create file:', filename name)
].
- [
- aStream := newFileName writeStream.
- ] on:FileStream openErrorSignal do:[:ex|
- savFilename notNil ifTrue:[
- savFilename delete
- ].
- ^ FileOutErrorSignal
- raiseRequestWith:newFileName name
- errorString:(' - cannot create file:', newFileName name)
- ].
- self fileOutOn:aStream.
- aStream close.
+ self fileOutOn:outStream.
+ outStream syncData; close.
"
finally, replace the old-file
@@ -2604,11 +2601,15 @@
we have to do a copy ...
"
needRename ifTrue:[
- newFileName copyTo:fileName.
- newFileName delete
- ].
- savFilename notNil ifTrue:[
- savFilename delete
+ fileExists ifTrue:[
+ savFilename := filename addSuffix:'.sav~'.
+ savFilename delete.
+ filename renameTo:savFilename.
+ ].
+ outStream fileName renameTo:filename.
+ fileExists ifTrue:[
+ savFilename delete.
+ ].
].
"
@@ -5667,11 +5668,11 @@
!Class class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Class.st,v 1.626 2013-05-27 08:45:38 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Class.st,v 1.627 2013-07-04 23:12:52 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/Class.st,v 1.626 2013-05-27 08:45:38 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Class.st,v 1.627 2013-07-04 23:12:52 stefan Exp $'
!
version_SVN
--- a/Collection.st Mon Jul 01 22:14:20 2013 +0100
+++ b/Collection.st Tue Jul 09 22:51:30 2013 +0100
@@ -259,6 +259,7 @@
^ self withSize:n
! !
+
!Collection class methodsFor:'Signal constants'!
emptyCollectionSignal
@@ -530,6 +531,7 @@
].
! !
+
!Collection methodsFor:'accessing'!
anElement
@@ -4239,24 +4241,6 @@
Used by functions which create a growing collection (see collect:with:, for example)"
^ self species
-!
-
-standardDeviation
- "standard deviation value of all elements in the collection"
-
- |m sumDeltaSquares|
-
- m := self arithmeticMean.
- sumDeltaSquares := self inject:0 into:[:sum :this | sum + ((this - m) squared)].
- ^ (sumDeltaSquares / (self size - 1)) sqrt
-
- "
- TestCase assert:( #( 1 2 3 4) arithmeticMean = 2.5).
- TestCase assert:( #(13 23 12 44 55) arithmeticMean closeTo: 29.4).
- TestCase assert:( #(13 23 12 44 55) standardDeviation closeTo: 19.2431).
- "
-
- "Created: / 13-04-2011 / 17:58:47 / cg"
! !
!Collection methodsFor:'searching'!
@@ -4490,6 +4474,42 @@
"
! !
+!Collection methodsFor:'statistical functions'!
+
+standardDeviation
+ "standard deviation value of all elements in the collection,
+ which is the complete set and not a sample."
+
+ ^ self variance sqrt
+
+ "
+ TestCase assert:( #( 1 2 3 4) arithmeticMean = 2.5).
+ TestCase assert:( #(13 23 12 44 55) arithmeticMean closeTo: 29.4).
+ TestCase assert:( #(13 23 12 44 55) standardDeviation closeTo: 17.2116).
+ TestCase assert:( (1 to: 100) arithmeticMean = ((100 + 1)/2)).
+ TestCase assert:( (1 to: 100) standardDeviation = ((100 squared - 1)/12) sqrt).
+ TestCase assert:( (1 to: 6) standardDeviation = ((6 squared - 1)/12) sqrt).
+ "
+!
+
+variance
+ "compute the variance over a complete data set (and not of a sample)"
+
+ |mean sumDeltaSquares|
+
+ mean := self arithmeticMean.
+ sumDeltaSquares := 0.
+ self do:[:each|
+ sumDeltaSquares := sumDeltaSquares + ((each - mean) squared).
+ ].
+ ^ sumDeltaSquares / self size.
+
+ "
+ #(1 1 1 1 1 1 1 1 1 1) variance
+ #(1 2 3 4 5 6 7 8 9 0) variance
+ "
+! !
+
!Collection methodsFor:'testing'!
allElementsHaveTheIdenticalValue
@@ -4822,11 +4842,11 @@
!Collection class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.307 2013-06-29 09:34:33 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.308 2013-07-04 15:47:07 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.307 2013-06-29 09:34:33 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.308 2013-07-04 15:47:07 stefan Exp $'
! !
--- a/EncodedStream.st Mon Jul 01 22:14:20 2013 +0100
+++ b/EncodedStream.st Tue Jul 09 22:51:30 2013 +0100
@@ -314,6 +314,10 @@
"Created: / 15-06-2005 / 11:16:33 / janfrog"
!
+flush
+ stream flush
+!
+
isOpen
^ stream notNil and:[stream isOpen]
!
@@ -424,6 +428,14 @@
skipSeparators
^ stream skipSeparators
+!
+
+sync
+ stream sync
+!
+
+syncData
+ stream syncData
! !
!EncodedStream methodsFor:'testing'!
@@ -472,11 +484,11 @@
!EncodedStream class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/EncodedStream.st,v 1.28 2013-06-03 10:39:29 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/EncodedStream.st,v 1.29 2013-07-06 06:41:24 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/EncodedStream.st,v 1.28 2013-06-03 10:39:29 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/EncodedStream.st,v 1.29 2013-07-06 06:41:24 stefan Exp $'
!
version_HG
--- a/ExternalStream.st Mon Jul 01 22:14:20 2013 +0100
+++ b/ExternalStream.st Tue Jul 09 22:51:30 2013 +0100
@@ -2456,19 +2456,20 @@
"{ Pragma: +optSpace }"
- |exClass|
-
- exClass := (errorNumber == (OperatingSystem errorNumberFor:#ERROR_FILE_NOT_FOUND))
- ifTrue:[ FileDoesNotExistException ]
- ifFalse:[ OpenError ].
+ |exClass errorSymbol|
+
+ errorSymbol := OperatingSystem errorSymbolForNumber:errorNumber.
+ exClass := (errorSymbol == #ERROR_FILE_NOT_FOUND or:[errorSymbol == #ENOENT])
+ ifTrue:[ FileDoesNotExistException ]
+ ifFalse:[ OpenError ].
^ exClass newException
- errorCode:errorNumber;
- "/ cg: initialized lazyly - see #description in OpenError
- "/ errorString:(' : ' , (OperatingSystem errorTextForNumber:errorNumber));
- parameter:self;
- raiseRequest
- "/ in:thisContext sender
+ errorCode:errorNumber;
+ "/ cg: initialized lazyly - see #description in OpenError
+ "/ errorString:(' : ' , (OperatingSystem errorTextForNumber:errorNumber));
+ parameter:self;
+ raiseRequest
+ "/ in:thisContext sender
"Modified: / 09-09-2011 / 07:22:49 / cg"
!
@@ -2501,6 +2502,14 @@
!ExternalStream methodsFor:'finalization'!
+executor
+ "return a copy for finalization-registration;
+ since all we need at finalization time is the fileDescriptor,
+ a cheaper copy is possible."
+
+ ^ self class basicNew setAccessor:handleType to:handle
+!
+
finalizationLobby
"answer the registry used for finalization.
ExternalStreams have their own Registry"
@@ -2514,16 +2523,6 @@
self closeFile
! !
-!ExternalStream methodsFor:'instance release'!
-
-executor
- "return a copy for finalization-registration;
- since all we need at finalization time is the fileDescriptor,
- a cheaper copy is possible."
-
- ^ self class basicNew setAccessor:handleType to:handle
-! !
-
!ExternalStream methodsFor:'line reading/writing'!
nextLine
@@ -3913,6 +3912,7 @@
!
nextWord
+ <resource: #obsolete>
"in text-mode:
read the alphaNumeric next word (i.e. up to non letter-or-digit).
return a string containing those characters.
@@ -4636,7 +4636,7 @@
!
isBlocking
- "return true, if O_NONBLOCK is NOT set in the fileDescriptor (propably UNIX specific)"
+ "return true, if O_NONBLOCK is NOT set in the fileDescriptor (probably UNIX specific)"
handle isNil ifTrue:[^ self errorNotOpen].
^ OperatingSystem isBlockingOn:self fileDescriptor
@@ -5762,11 +5762,11 @@
!ExternalStream class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.365 2013-06-26 11:04:06 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.370 2013-07-08 22:33:56 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.365 2013-06-26 11:04:06 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.370 2013-07-08 22:33:56 stefan Exp $'
! !
--- a/FileStream.st Mon Jul 01 22:14:20 2013 +0100
+++ b/FileStream.st Tue Jul 09 22:51:30 2013 +0100
@@ -226,21 +226,23 @@
positioning a file stream.
For example, poor VMS does not allow positioning onto arbitrary
byte boundaries if the file is a variable-record-RMS file.
- (stupid enough, this is the default for textfiles as created by
- some tools ...)
+ (stupid enough, this is the default for textfiles as created by some tools ...)
Therefore, the instance variable canPosition is set according to
this and an error is raised, if a position: is attemted.
I know, this is ugly, but what else could we do ?
+ Late note: who cares for VMS these days?
+ (and how much useless effort has been put in the past,
+ to support lousy operating systems?)
[instance variables:]
- pathName <String> the files path (if known)
- canPosition <Boolean> positionable - read above comment
+ pathName <String> the files path (if known)
+ canPosition <Boolean> positionable - read above comment
[author:]
- Claus Gittinger
+ Claus Gittinger
[see also:]
- Filename DirectoryStream PipeStream Socket
+ Filename DirectoryStream PipeStream Socket
"
!
@@ -387,6 +389,155 @@
^ newStream createForReadWrite.
!
+newTemporary
+ "create atomically a new file and return the file stream - use this for temporary files.
+ The created file has the name '/tmp/stxtmp_xx_nn' where xx is our
+ unix process id, and nn is a unique number, incremented with every call to this method.
+ If any of the environment variables ST_TMPDIR or TMPDIR is set,
+ its value defines the temp directory."
+
+ ^ self newTemporaryIn:Filename tempDirectory
+
+ "
+ FileStream newTemporary
+ FileStream newTemporary
+ "
+!
+
+newTemporaryIn:aDirectoryOrNil
+ "create atomically a new file and return the file stream - use this for temporary files.
+ The created file is in aDirectoryPrefix and named 'stxtmp_xx_nn',
+ where xx is our unix process id, and nn is a unique number, incremented
+ with every call to this method."
+
+ ^ self newTemporaryIn:aDirectoryOrNil nameTemplate:Filename tempFileNameTemplate
+
+ "temp files in '/tmp':
+
+ FileStream newTemporary
+ "
+
+ "temp files somewhere
+ (not recommended - use above since it can be controlled via shell variables):
+
+ FileStream newTemporaryIn:'/tmp'
+ FileStream newTemporaryIn:'/tmp'
+ FileStream newTemporaryIn:'/usr/tmp'
+ FileStream newTemporaryIn:'/'
+ "
+
+ "a local temp file:
+
+ FileStream newTemporaryIn:''
+ FileStream newTemporaryIn:nil
+ FileStream newTemporaryIn:'.'
+ FileStream newTemporaryIn:('source' asFilename)
+ "
+!
+
+newTemporaryIn:aDirectoryOrNil nameTemplate:template
+ "create atomically a new file and return the file stream - use this for temporary files.
+ The created file is in aDirectoryOrNil and named after the given template,
+ in which %1 and %2 are expanded to the unix process id, and a unique number, incremented
+ with every call to this method respectively.
+ See also: #newTemporary which looks for a good temp directory."
+
+ |nameString random prevRandom prevNameString newTempFilename stream|
+
+ [
+ prevRandom := random.
+ prevNameString := nameString.
+
+ "Use random numbers in order to improve the security
+ by making the generated names less predictable"
+ [
+ random := RandomGenerator new nextInteger.
+ ] doWhile:[random = prevRandom].
+
+ nameString := template bindWith:(OperatingSystem getProcessId) with:random.
+
+ aDirectoryOrNil isNil ifTrue:[
+ newTempFilename := nameString.
+ ] ifFalse:[
+ newTempFilename := aDirectoryOrNil asFilename constructString:nameString.
+ ].
+
+ [
+ stream := self open:newTempFilename withMode:#(CREATE_NEW GENERIC_READ_WRITE).
+ ] on:OpenError do:[:ex|
+ (OperatingSystem errorHolderForNumber:ex errorCode) errorCategory ~~ #existingReferentSignal ifFalse:[
+ "some fundamental error, raise exception"
+ ex reject.
+ ].
+ prevNameString = nameString ifTrue:[
+ "no more names - probably a bad template"
+ ex reject.
+ ].
+ "file exists, retry another one"
+ ].
+ ] doWhile:[
+ stream isNil and:[prevNameString ~= nameString] "/ if namestring didn't change, the template is bad
+ ].
+ ^ stream
+
+ "temp files in '/tmp':
+
+ FileStream newTemporaryIn:'/tmp' asFilename nameTemplate:'foo%1_%2'
+
+ This must fail on the second try:
+ FileStream newTemporaryIn:'/tmp' asFilename nameTemplate:'foo'
+ FileStream newTemporaryIn:'c:\temp' asFilename nameTemplate:'foo'
+ "
+
+ "temp files somewhere
+ (not recommended - use above since it can be controlled via shell variables):
+
+ FileStream newTemporaryIn:'/tmp' nameTemplate:'foo%1_%2'
+ FileStream newTemporaryIn:'/tmp' nameTemplate:'foo%1_%2'
+ FileStream newTemporaryIn:'/usr/tmp' nameTemplate:'foo%1_%2'
+ FileStream newTemporaryIn:'/' nameTemplate:'foo%1_%2'
+ "
+
+ "a local temp file:
+
+ FileStream newTemporaryIn:'' nameTemplate:'foo%1_%2'
+ FileStream newTemporaryIn:nil nameTemplate:'foo%1_%2'
+ FileStream newTemporaryIn:'.' nameTemplate:'foo%1_%2'
+ FileStream newTemporaryIn:('source' asFilename) nameTemplate:'foo%1_%2'
+ "
+!
+
+newTemporaryIn:aDirectoryOrNil withSuffix:aSuffixString
+ "create atomically a new file and return the file stream - use this for temporary files.
+ The created file is in aDirectoryPrefix and named 'stxtmp_xx_nn',
+ where xx is our unix process id, and nn is a unique number, incremented
+ with every call to this method."
+
+ ^ self
+ newTemporaryIn:aDirectoryOrNil
+ nameTemplate:(Filename tempFileNameTemplate asFilename
+ withSuffix:aSuffixString) asString
+
+ "
+ FileStream newTemporaryWithSuffix:'txt'
+ FileStream newTemporaryIn:'/tmp' withSuffix:'txt'
+ "
+!
+
+newTemporaryWithSuffix:aString
+ "create atomically a new file and return the file stream - use this for temporary files.
+ The created file has the name '/tmp/stxtmp_xx_nn' where xx is our
+ unix process id, and nn is a unique number, incremented with every call to this method.
+ If any of the environment variables ST_TMPDIR or TMPDIR is set,
+ its value defines the temp directory."
+
+ ^ self newTemporaryIn:Filename tempDirectory withSuffix:aString
+
+ "
+ FileStream newTemporaryWithSuffix:'txt'
+ "
+!
+
oldFileNamed:filename
"return a FileStream for existing file named filename, aString.
The file is opened for read/write access.
@@ -402,7 +553,8 @@
^ newStream openForReadWrite.
"
- FileStream oldFileNamed:'/dAsGiBtEsNiChT'
+ '/tmp/dAsGiBtEsNiChT' asFilename remove.
+ FileStream oldFileNamed:'/tmp/dAsGiBtEsNiChT'
"
!
@@ -421,6 +573,20 @@
"
!
+open:aFilenameString withMode:anArrayOrString
+ "The argument de
+ The file is opened for read/write access."
+
+ |stream|
+
+ stream := self new pathName:aFilenameString.
+ stream
+ readwrite; "/ assume read/write mode, but this depends on the args
+ openWithMode:anArrayOrString attributes:nil.
+
+ ^ stream
+!
+
readonlyFileNamed:filename
"return a readonly FileStream for existing file named filename, aString.
Raises an error if the file does not exist."
@@ -555,6 +721,43 @@
"Modified: 20.10.1997 / 19:22:44 / cg"
! !
+!FileStream methodsFor:'access rights'!
+
+accessRights
+ "return the access rights of the file as opaque data
+ (SmallInteger in unix/linux)"
+
+ ^ OperatingSystem accessModeOfFd:self fileDescriptor.
+
+ "
+ 'Make.proto' asFilename readingFileDo:[:s|
+ s accessRights
+ ]
+ "
+!
+
+accessRights:opaqueData
+ "set the access rights of the file to opaqueData,
+ which is normally retrieved by Filename>>#accessRights
+ or FileStreamm>>#accessRights."
+
+ (OperatingSystem changeAccessModeOfFd:self fileDescriptor to:opaqueData) ifFalse:[
+ ^ self fileName accessDeniedError:self
+ ].
+
+ "
+ 'Make.proto' asFilename readingFileDo:[:s|
+ s accessRights:s accessRights
+ ]
+ "
+
+ "
+ '/' asFilename readingFileDo:[:s|
+ s accessRights:s accessRights
+ ]
+ "
+! !
+
!FileStream methodsFor:'accessing'!
contentsOfEntireFile
@@ -607,7 +810,8 @@
This is an ST/X special feature which is not portable
to other systems."
- removeOnClose := aBoolean
+ removeOnClose := aBoolean.
+ Lobby registerChange:self.
"Modified: / 13.8.1998 / 12:10:07 / cg"
!
@@ -648,6 +852,18 @@
"
! !
+!FileStream methodsFor:'finalization'!
+
+executor
+ |executor|
+
+ executor := super executor.
+ removeOnClose == true ifTrue:[
+ executor setPathName:pathName removeOnClose:true.
+ ].
+ ^ executor
+! !
+
!FileStream methodsFor:'misc functions'!
copyToEndInto:outStream bufferSize:bufferSize
@@ -1042,14 +1258,16 @@
encodedPathName := OperatingSystem encodePath:pathName.
%{
- HFILE f;
-
+ HFILE f = NULL;
int pass = 0;
+ if (!__isNonNilObject(encodedPathName)
+ || !(__isStringLike(openmode) || __isArrayLike(openmode)))
+ goto badArgument;
+
retry:
- if (__isNonNilObject(encodedPathName) && (__isStringLike(openmode) || __isArrayLike(openmode)))
#ifdef __VMS__
- if (__isStringLike(pathName)) {
+ if (__isStringLike(encodedPathName)) {
do {
/*
* allow passing additional RMS arguments.
@@ -1066,7 +1284,6 @@
numAttrib = __arraySize(attributeSpec);
for (i=0; i<numAttrib;i++) {
if (! __isStringLike(ap[i])) {
- f = NULL;
__threadErrno = EINVAL; /* invalid argument */
goto getOutOfHere;
}
@@ -1150,12 +1367,10 @@
__END_INTERRUPTABLE__
break;
default:
- f = NULL;
__threadErrno = E2BIG; /* too many args */
goto getOutOfHere;
}
} else if (attributeSpec != nil) {
- f = NULL;
__threadErrno = EINVAL; /* invalid argument */
goto getOutOfHere;
} else {
@@ -1174,8 +1389,6 @@
# ifdef WIN32
{
DWORD share = 0, access = 0, create = 0, attr = 0;
- int numAttrib, i;
- OBJ *ap;
char * __openmode;
HANDLE handle;
SECURITY_ATTRIBUTES sa;
@@ -1188,7 +1401,7 @@
create = OPEN_EXISTING;
} else if (strcmp(__openmode, "rb+") == 0) {
access = GENERIC_READ | GENERIC_WRITE;
- create = OPEN_ALWAYS;
+ create = OPEN_EXISTING;
} else if (strcmp(__openmode, "wb") == 0) {
access = GENERIC_WRITE;
create = CREATE_ALWAYS;
@@ -1207,8 +1420,10 @@
console_fprintf(stderr, "Win32OS [warning]: unsupported open mode\n");
}
} else if (__isArrayLike(openmode)) {
- ap = __ArrayInstPtr(attributeSpec)->a_element;
- numAttrib = __arraySize(attributeSpec);
+ OBJ *ap = __arrayVal(openmode);
+ int numAttrib = __arraySize(openmode);
+ int i;
+
__openmode = "rb+";
for (i=0; i<numAttrib; i++) {
@@ -1223,6 +1438,8 @@
access |= GENERIC_READ;
} else if (attrSym == @symbol(GENERIC_WRITE)) {
access |= GENERIC_WRITE;
+ } else if (attrSym == @symbol(GENERIC_READ_WRITE)) {
+ access |= GENERIC_READ|GENERIC_WRITE;
} else if (attrSym == @symbol(CREATE_NEW)) {
create |= CREATE_NEW;
@@ -1245,17 +1462,14 @@
attr |= FILE_FLAG_SEQUENTIAL_SCAN;
} else if (attrSym == @symbol(FILE_FLAG_DELETE_ON_CLOSE)) {
attr |= FILE_FLAG_DELETE_ON_CLOSE;
+ } else if (!__isSymbol(attrSym) && __isStringLike(attrSym)) {
+ __openmode = __stringVal(attrSym);
} else {
console_fprintf(stderr, "Win32OS [warning]: unsupported open mode\n");
}
}
- } else {
- f = NULL;
-// argumentError = @symbol(badAttributeSpec);
- goto badArgument;
}
if (create == 0) {
- f = NULL;
// argumentError = @symbol(missingCreateMode);
goto badArgument;
}
@@ -1312,38 +1526,110 @@
__threadErrno = EMFILE;
}
CloseHandle(handle);
- f = NULL;
} else {
f = fdopen(fd, __openmode);
}
__stxWrapApiLeaveCritical();
- } else {
- f = NULL;
+ } else {
+ __threadErrno = __WIN32_ERR(GetLastError());
}
}
# else /* not WIN32 */
if (__isStringLike(encodedPathName)) {
- do {
- __BEGIN_INTERRUPTABLE__
-# ifdef LINUX
- /*
- * LINUX may ret a non-NULL f even when interrupted.
- * Therefore, check errno and fake a null-ret.
- */
- __threadErrno = 0;
- f = fopen((char *) __stringVal(encodedPathName), (char *) __stringVal(openmode));
- if (__threadErrno == EINTR)
- f = NULL;
-# else /* not LINUX */
- f = fopen((char *) __stringVal(encodedPathName), (char *) __stringVal(openmode));
-# endif /* not LINUX */
- __END_INTERRUPTABLE__
- } while ((f == NULL) && (__threadErrno == EINTR));
+ int accessMode = 0666; // default access mode of fopen(), relies on umask()
+ int flags = 0;
+ int fd;
+ char * __openmode;
+
+ if (__isStringLike(openmode)) {
+ __openmode = __stringVal(openmode);
+ if (strcmp(__openmode, "r") == 0) {
+ flags = O_RDONLY;
+ } else if (strcmp(__openmode, "r+") == 0) {
+ flags = O_RDWR;
+ } else if (strcmp(__openmode, "w") == 0) {
+ flags = O_WRONLY | O_CREAT | O_TRUNC;
+ } else if (strcmp(__openmode, "w+") == 0) {
+ flags = O_RDWR | O_CREAT | O_TRUNC;
+ } else if (strcmp(__openmode, "a") == 0) {
+ flags = O_WRONLY | O_CREAT | O_APPEND;
+ } else if (strcmp(__openmode, "a+") == 0) {
+ flags = O_RDWR | O_CREAT| O_APPEND;
+ } else {
+ console_fprintf(stderr, "UNIXOS [warning]: unsupported open mode\n");
+ }
+ } else if (__isArrayLike(openmode)) {
+ OBJ *ap = __arrayVal(openmode);
+ int numAttrib = __arraySize(openmode);
+ int i;
+
+ __openmode = "r+";
+
+ for (i=0; i<numAttrib; i++) {
+ OBJ attrSym = ap[i];
+
+ if (attrSym == @symbol(FILE_SHARE_READ)) {
+ // ignore
+ } else if (attrSym == @symbol(FILE_SHARE_WRITE)) {
+ // ignore
+ } else if (attrSym == @symbol(GENERIC_READ)) {
+ flags |= O_RDONLY;
+ } else if (attrSym == @symbol(GENERIC_WRITE)) {
+ flags |= O_WRONLY;
+ } else if (attrSym == @symbol(GENERIC_READ_WRITE)) {
+ flags |= O_RDWR;
+
+ } else if (attrSym == @symbol(CREATE_NEW)) {
+ flags |= O_CREAT|O_EXCL;
+ accessMode = 0600; // simulate mkstemp()
+ } else if (attrSym == @symbol(CREATE_ALWAYS)) {
+ flags |= O_CREAT|O_TRUNC;
+ } else if (attrSym == @symbol(OPEN_EXISTING)) {
+ // nothing to be set
+ } else if (attrSym == @symbol(OPEN_ALWAYS)) {
+ flags |= O_CREAT;
+ } else if (attrSym == @symbol(TRUNCATE_EXISTING)) {
+ flags |= O_TRUNC;
+
+ } else if (attrSym == @symbol(FILE_ATTRIBUTE_HIDDEN)) {
+ // ignore
+ } else if (attrSym == @symbol(FILE_ATTRIBUTE_READONLY)) {
+ accessMode &= 0444;
+ } else if (attrSym == @symbol(FILE_FLAG_WRITE_THROUGH)) {
+#ifdef O_DIRECT
+ flags |= O_DIRECT;
+#endif
+ } else if (attrSym == @symbol(FILE_FLAG_SEQUENTIAL_SCAN)) {
+ // ignore
+ } else if (attrSym == @symbol(FILE_FLAG_DELETE_ON_CLOSE)) {
+ // ignore;
+ } else if (!__isSymbol(attrSym) && __isStringLike(attrSym)) {
+ __openmode = __stringVal(attrSym);
+ } else {
+ console_fprintf(stderr, "UNIXOS [warning]: unsupported open mode\n");
+ }
+ }
+ }
+ do {
+ __BEGIN_INTERRUPTABLE__
+ fd = open((char *) __stringVal(encodedPathName), flags, accessMode);
+ __END_INTERRUPTABLE__
+ } while ((fd < 0) && (__threadErrno == EINTR));
+
+ if (fd >= 0) {
+ __threadErrno = 0;
+ f = fdopen(fd, __openmode);
+ if (f == NULL) {
+ close(fd); // fdopen failed, close before retry.
+ }
+ }
}
+
# endif /* not WIN32 */
#endif /* not VMS */
+
if (f == NULL) {
/*
* If no filedescriptors available, try to finalize
@@ -1413,7 +1699,6 @@
#endif
}
}
-
%}.
handle notNil ifTrue:[
position := 0.
@@ -1564,6 +1849,11 @@
setMode:aModeSymbol
mode := aModeSymbol
+!
+
+setPathName:pathNameString removeOnClose:aBoolean
+ pathName := pathNameString.
+ removeOnClose := aBoolean.
! !
!FileStream methodsFor:'private fileIn'!
@@ -1707,11 +1997,11 @@
!FileStream class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/FileStream.st,v 1.156 2013-06-03 18:41:26 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/FileStream.st,v 1.166 2013-07-08 19:22:38 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/FileStream.st,v 1.156 2013-06-03 18:41:26 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/FileStream.st,v 1.166 2013-07-08 19:22:38 stefan Exp $'
! !
--- a/Filename.st Mon Jul 01 22:14:20 2013 +0100
+++ b/Filename.st Tue Jul 09 22:51:30 2013 +0100
@@ -13,8 +13,7 @@
Object subclass:#Filename
instanceVariableNames:'nameString'
- classVariableNames:'NextTempFilenameIndex TempDirectory DefaultTempDirectory
- ConcreteClass'
+ classVariableNames:'TempDirectory DefaultTempDirectory ConcreteClass'
poolDictionaries:''
category:'System-Support'
!
@@ -497,7 +496,9 @@
If any of the environment variables ST_TMPDIR or TMPDIR is set,
its value defines the temp directory.
Notice, that no file is created by this - only a unique name
- is generated."
+ is generated.
+
+ DO NOT USE THIS FOR PLAIN FILES - IT IS UNSECURE use FileStream>>#newTemporary"
^ self newTemporaryIn:(self tempDirectory)
@@ -548,7 +549,9 @@
Notice: only a unique filename object is created and returned - no physical
file is created by this method (i.e. you have to send #writeStream or
whatever to it in order to really create something).
- See also: #newTemporary which looks for a good temp directory."
+ See also: #newTemporary which looks for a good temp directory.
+
+ DO NOT USE THIS FOR PLAIN FILES - IT IS UNSECURE use FileStream>>#newTemporaryIn:"
^ self newTemporaryIn:aDirectoryOrNil nameTemplate:(self tempFileNameTemplate)
@@ -586,7 +589,9 @@
Notice: only a unique filename object is created and returned - no physical
file is created by this method (i.e. you have to send #writeStream or
whatever to it in order to really create something).
- See also: #newTemporary which looks for a good temp directory."
+ See also: #newTemporary which looks for a good temp directory.
+
+ DO NOT USE THIS FOR PLAIN FILES - IT IS UNSECURE use FileStream>>#newTemporaryIn:nameTemplate:"
|nameString newTempFilename|
@@ -597,15 +602,12 @@
"although the above allows things to be redefined in concrete classes,
the following should work on all systems ..."
- NextTempFilenameIndex isNil ifTrue:[
- NextTempFilenameIndex := 1.
- ].
-
[
- nameString := template bindWith:(OperatingSystem getProcessId) with:NextTempFilenameIndex.
- NextTempFilenameIndex := NextTempFilenameIndex + 1.
-
- (aDirectoryOrNil isNil or:[aDirectoryOrNil asString isEmpty]) ifTrue:[
+ "Use random numbers in order to improve the security
+ by making the generated names less predictable"
+ nameString := template bindWith:(OperatingSystem getProcessId) with:RandomGenerator new nextInteger.
+
+ aDirectoryOrNil isNil ifTrue:[
newTempFilename := self named:nameString
] ifFalse:[
newTempFilename := aDirectoryOrNil asFilename construct:nameString
@@ -2266,7 +2268,7 @@
^ OperatingSystem accessDeniedErrorSignal
raiseRequestWith:filename?self
- errorString:(' - cannot create/write file: ' , (filename ? self) asString)
+ errorString:(' - cannot create/write file: "%1"' bindWith:(filename ? self) asString)
!
fileNotFoundError:filename
@@ -2331,6 +2333,28 @@
"
!
+existingReadWriteStream
+ "return a stream for read/write the file represented by the receiver.
+ If the file does not already exist, an exception is raised."
+
+ ^ FileStream oldFileNamed:(self osNameForAccess)
+
+ "
+ '/tmp/blaFaselQuall666666' asFilename remove.
+ '/tmp/blaFaselQuall666666' asFilename existingReadWriteStream.
+ "
+ "
+ |s|
+ s := '/tmp/foo' asFilename readWriteStream.
+ s nextPutAll:'1234567890'; close.
+ s := '/tmp/foo' asFilename existingReadWriteStream.
+ s nextPutAll:'abcdef'; close.
+
+ '/tmp/foo' asFilename contents inspect.
+ '/tmp/foo' asFilename remove
+ "
+!
+
newReadWriteStream
"return a stream for read/write the file represented by the receiver.
If the file does not already exist, it is created;
@@ -2353,6 +2377,25 @@
"
!
+openWithMode:anArrayOrString
+ "return a stream for read/write the file represented by the receiver.
+ If the file does not already exist, it is created;
+ if it does exist, it is truncated."
+
+ ^ FileStream open:self osNameForAccess withMode:anArrayOrString
+
+ "
+ |s|
+
+ s := '/tmp/foo' asFilename openWithMode:'r+'.
+ s nextPutAll:'1234567890'.
+ s close.
+
+
+ '/tmp/foo' asFilename contents
+ "
+!
+
readStream
"return a stream for reading from the file represented by the receiver.
Raises an error if the file does not exist."
@@ -2795,6 +2838,51 @@
"Modified: / 29-09-2006 / 16:26:32 / cg"
!
+copyToStream:outStream
+ "Copy the files contents into another file.
+ The argument must be convertable to a filename.
+ Raises an exception, if an error occurs."
+
+ |newName inStream resetBinary|
+
+ "Contents is not copied if newName represent same file as me."
+ outStream isFileStream ifTrue:[
+ outStream fileName asAbsoluteFilename = self asAbsoluteFilename ifTrue: [ ^ self ].
+ ].
+
+ inStream := self readStream.
+ inStream isNil ifTrue:[
+ ^ self fileNotFoundError:self
+ ].
+
+ [
+ inStream binary.
+ resetBinary := false.
+ outStream isBinary ifFalse:[
+ outStream binary.
+ resetBinary := true.
+ ].
+
+ [
+ inStream copyToEndInto:outStream.
+ ] on:Error do:[:ex|
+ ^ self fileCreationError:newName
+ ]
+ ] ensure:[
+ inStream close.
+ resetBinary ifTrue:[
+ outStream text.
+ ].
+ ].
+
+ "
+ |out|
+ out := FileStream newTemporary.
+ 'Make.proto' asFilename copyToStream:out.
+ out reset; contents
+ "
+!
+
createAsEmptyFile
"create an empty file with the receivers name.
Raises an exception if not successful
@@ -5926,11 +6014,11 @@
!Filename class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Filename.st,v 1.397 2013-06-04 10:16:54 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Filename.st,v 1.401 2013-07-08 19:23:30 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/Filename.st,v 1.397 2013-06-04 10:16:54 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Filename.st,v 1.401 2013-07-08 19:23:30 stefan Exp $'
! !
--- a/Integer.st Mon Jul 01 22:14:20 2013 +0100
+++ b/Integer.st Tue Jul 09 22:51:30 2013 +0100
@@ -1289,7 +1289,7 @@
!
atRandom:aRandomGenerator
- "return a random number between 1 amd myself"
+ "return a random number between 1 and myself"
self < 1 ifTrue:[^ self].
^ aRandomGenerator nextIntegerBetween:1 and:self
@@ -4939,11 +4939,11 @@
!Integer class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Integer.st,v 1.279 2013-05-27 08:08:41 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Integer.st,v 1.280 2013-07-04 15:45:33 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/Integer.st,v 1.279 2013-05-27 08:08:41 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Integer.st,v 1.280 2013-07-04 15:45:33 stefan Exp $'
! !
--- a/OSErrorHolder.st Mon Jul 01 22:14:20 2013 +0100
+++ b/OSErrorHolder.st Tue Jul 09 22:51:30 2013 +0100
@@ -361,6 +361,14 @@
!OSErrorHolder methodsFor:'accessing'!
+errorCategory
+ ^ errorCategory
+!
+
+errorSymbol
+ ^ errorSymbol
+!
+
errorSymbol:sym errorCategory:typ
errorSymbol := sym.
errorCategory := typ.
@@ -403,20 +411,28 @@
^ s
"Modified: / 12-02-2007 / 12:29:07 / cg"
-!
+! !
+
+!OSErrorHolder methodsFor:'printing'!
-errorSymbol
- ^ errorSymbol
+printOn:aStream
+ aStream
+ nextPutAll:self className;
+ nextPut:$(;
+ nextPutAll:errorSymbol;
+ nextPutAll:', ';
+ nextPutAll:errorCategory;
+ nextPut:$).
! !
!OSErrorHolder class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/OSErrorHolder.st,v 1.20 2013-04-27 12:43:50 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/OSErrorHolder.st,v 1.21 2013-07-04 19:27:31 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/OSErrorHolder.st,v 1.20 2013-04-27 12:43:50 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/OSErrorHolder.st,v 1.21 2013-07-04 19:27:31 stefan Exp $'
! !
--- a/ObjectMemory.st Mon Jul 01 22:14:20 2013 +0100
+++ b/ObjectMemory.st Tue Jul 09 22:51:30 2013 +0100
@@ -1288,29 +1288,29 @@
lbl origin:(0.0@0.0) corner:(1.0@0.0).
h := lbl preferredHeight.
lbl
- topInset:5;
- bottomInset:(h+5) negated;
- leftInset:5;
- rightInset:5.
+ topInset:5;
+ bottomInset:(h+5) negated;
+ leftInset:5;
+ rightInset:5.
progress := ProgressIndicator in:top.
progress origin:(0.0@45) corner:(1.0@45).
progress level:-1.
h := progress preferredHeight.
progress
- topInset:(h // 2) negated;
- bottomInset:(h // 2) negated;
- leftInset:5;
- rightInset:5.
+ topInset:(h // 2) negated;
+ bottomInset:(h // 2) negated;
+ leftInset:5;
+ rightInset:5.
progress beInvisible.
listV := HVScrollableView for:SelectionInListView in:top.
listV origin:(0.0@55) corner:(1.0@1.0).
listV
- topInset:(h // 2);
- bottomInset:40;
- leftInset:5;
- rightInset:5.
+ topInset:(h // 2);
+ bottomInset:40;
+ leftInset:5;
+ rightInset:5.
listV beInvisible.
panel := HorizontalPanelView in:top.
@@ -1349,247 +1349,247 @@
firstRound := true.
[done] whileFalse:[
- anyShown := false.
-
- progress percentage:0.
- firstRound ifTrue:[
- firstRound := false.
- ] ifFalse:[
- lbl label:'compressing garbage ...'.
- self garbageCollect.
- ].
-
- lbl label:('searching level '
- , levels size printString
- , ' (' , objects size printString , ' refs) ...').
- nAll := objects size.
- nDone := 0.
-
- objectArray := objects asArray.
-
- owners := "Weak"IdentitySet new.
-
- numObjectsDone := 0.
- found := false.
-
- AbortSignal handle:[]
- do:[
- [self allObjectsIncludingContextsDo:[:o |
- |inPrevLevel isOwner|
-
- stop ifTrue:[AbortSignal raise].
- stop ifFalse:[
- isOwner := false.
- (o referencesAny:objectArray) ifTrue:[
- o isBehavior ifTrue:[
- o == Smalltalk ifTrue:[
- found := true.
- ] ifFalse:[
- "/ only add it if it has classInstVars
- o instSize ~~ Class instSize ifTrue:[
- isOwner := true.
- ]
- ]
- ] ifFalse:[
- o class ~~ WeakArray ifTrue:[
- isOwner := true.
- ]
- ].
- ].
-
- isOwner ifTrue:[
- (objects includesIdentical:o) ifFalse:[
- inPrevLevel := false.
- levels do:[:lColl |
- lColl == o ifTrue:[
- inPrevLevel := true
- ] ifFalse:[
- (lColl includesIdentical:o) ifTrue:[inPrevLevel := true].
- ]
- ].
- inPrevLevel ifFalse:[
- owners add:o.
- (limitOrNil notNil and:[owners size >= limitOrNil]) ifTrue:[
- AbortSignal raise
- ].
- ]
- ]
- ].
-
- numObjectsDone := numObjectsDone + 1.
- numObjects notNil ifTrue:[
- numObjectsDone \\ 1000 == 0 ifTrue:[
- progress percentage:(numObjectsDone / numObjects * 100).
- Processor yield.
- ]
- ]
- ]
- ]] whileFalse.
- ].
- progress percentage:100.
-
- numObjects isNil ifTrue:[
- numObjects := numObjectsDone.
- ].
-
- owners remove:aCollection ifAbsent:nil.
- owners remove:thisContext ifAbsent:nil.
- owners remove:objectArray ifAbsent:nil.
- owners remove:objects keyArray ifAbsent:nil.
- owners remove:owners keyArray ifAbsent:nil.
+ anyShown := false.
+
+ progress percentage:0.
+ firstRound ifTrue:[
+ firstRound := false.
+ ] ifFalse:[
+ lbl label:'compressing garbage ...'.
+ self garbageCollect.
+ ].
+
+ lbl label:('searching level '
+ , levels size printString
+ , ' (' , objects size printString , ' refs) ...').
+ nAll := objects size.
+ nDone := 0.
+
+ objectArray := objects asArray.
+
+ owners := "Weak"IdentitySet new.
+
+ numObjectsDone := 0.
+ found := false.
+
+ AbortOperationRequest handle:[]
+ do:[
+ [self allObjectsIncludingContextsDo:[:o |
+ |inPrevLevel isOwner|
+
+ stop ifTrue:[AbortOperationRequest raise].
+ stop ifFalse:[
+ isOwner := false.
+ (o referencesAny:objectArray) ifTrue:[
+ o isBehavior ifTrue:[
+ o == Smalltalk ifTrue:[
+ found := true.
+ ] ifFalse:[
+ "/ only add it if it has classInstVars
+ o instSize ~~ Class instSize ifTrue:[
+ isOwner := true.
+ ]
+ ]
+ ] ifFalse:[
+ o class ~~ WeakArray ifTrue:[
+ isOwner := true.
+ ]
+ ].
+ ].
+
+ isOwner ifTrue:[
+ (objects includesIdentical:o) ifFalse:[
+ inPrevLevel := false.
+ levels do:[:lColl |
+ lColl == o ifTrue:[
+ inPrevLevel := true
+ ] ifFalse:[
+ (lColl includesIdentical:o) ifTrue:[inPrevLevel := true].
+ ]
+ ].
+ inPrevLevel ifFalse:[
+ owners add:o.
+ (limitOrNil notNil and:[owners size >= limitOrNil]) ifTrue:[
+ AbortOperationRequest raise
+ ].
+ ]
+ ]
+ ].
+
+ numObjectsDone := numObjectsDone + 1.
+ numObjects notNil ifTrue:[
+ numObjectsDone \\ 1000 == 0 ifTrue:[
+ progress percentage:(numObjectsDone / numObjects * 100).
+ Processor yield.
+ ]
+ ]
+ ]
+ ]] whileFalse.
+ ].
+ progress percentage:100.
+
+ numObjects isNil ifTrue:[
+ numObjects := numObjectsDone.
+ ].
+
+ owners remove:aCollection ifAbsent:nil.
+ owners remove:thisContext ifAbsent:nil.
+ owners remove:objectArray ifAbsent:nil.
+ owners remove:objects keyArray ifAbsent:nil.
+ owners remove:owners keyArray ifAbsent:nil.
"/ 'done with level: ' print. levels size print. ' found ' print. owners size print. ' refs' printCR.
- owners isEmpty ifTrue:[
- found ifFalse:[
- stop := true.
- ]
- ].
-
- stop ifFalse:[
- done := found or:[(owners includesIdentical:Smalltalk)].
- done ifTrue:[
- moreChainsOnThisLevel := true.
- temporaryRemoved := IdentitySet new.
-
- levels size > 0 ifTrue:[
- "/ show what we found so far.
- levels last add:Smalltalk.
- levels reverse.
- ].
-
- chains := OrderedCollection new.
-
- tLevels := levels collect:[:lColl | lColl copy].
-
- lbl label:('building refchains ...').
-
- nAll := aCollection size.
- nDone := 0.
- aCollection do:[:anObject | |theseChains|
- stop ifFalse:[
- theseChains := self
- refChainsFrom:Smalltalk
- to:anObject
- inRefSets:tLevels
- startingAt:1.
-
- theseChains size > 0 ifTrue:[
- chains addAll:theseChains
- ].
- nDone := nDone + 1.
- progress percentage:(nDone / nAll * 100).
- ]
- ].
-
- tLevels := nil.
-
- levels size > 0 ifTrue:[
- levels reverse.
- levels last remove:Smalltalk.
- ].
-
- [stop not
- and:[chains size > 0]] whileTrue:[
- chain := chains first.
- chains removeFirst.
-
- lbl label:('found a reference chain.').
- progress beInvisible.
-
- chain addFirst:Smalltalk.
- list := OrderedCollection withSize:chain size.
- 1 to:chain size-1 do:[:i |
- list
- at:i
- put:(self refNameFor:(chain at:i+1) in:(chain at:i))
- ].
- list at:list size put:(chain last classNameWithArticle).
-
- "/ hide the VMProcesses stuff from the user ...
- (list at:1) string = 'Smalltalk:__VMProcesses__' ifTrue:[
- list at:1 put:'__VMProcesses__ (a hidden VM reference)'.
- list removeIndex:2.
- chain at:1 put:nil.
- chain removeIndex:2.
- ].
-
- listV list:list.
-
- listV beVisible.
- listV doubleClickAction:[:idx | |o|
- (o := chain at:idx) notNil ifTrue:[
- o inspect.
- ]
- ].
- moreButton beVisible.
- anyShown := anyShownInAnyLevel := true.
- showMore := false.
-
- "/ kludge - wait for some user action
-
- [showMore or:[stop or:[top realized not]]] whileFalse:[
- Delay waitForSeconds:0.1
- ].
-
- chain := nil.
-
- top realized ifFalse:[
- stop := true
- ] ifTrue:[
- listV doubleClickAction:nil.
- showMore ifFalse:[
- stop := true.
- ].
- ].
- done := false.
-
- stop ifFalse:[
- progress beVisible.
- listV beInvisible.
- moreButton beInvisible.
-
- chain := nil.
- ]
- ].
- levels size > 0 ifTrue:[
- levels last addAll:temporaryRemoved.
- ]
- ].
- ].
-
- owners remove:Smalltalk ifAbsent:nil.
- owners remove:(owners keyArray) ifAbsent:nil.
- owners remove:objectArray ifAbsent:nil.
- levels do:[:lColl |
- owners remove:lColl ifAbsent:nil
- ].
-
- levels add:owners.
-
- objects := owners.
-
- objects size == 0 ifTrue:[
- stop := true
- ].
-
- stop ifTrue:[
- Smalltalk at:#'__VMProcesses__' put:nil.
- top destroy.
- anyShown ifFalse:[
- userStop ifFalse:[
- self information:(anyShownInAnyLevel ifTrue:['no more references'] ifFalse:['no references']).
- ]
- ].
- ^ self.
- ].
+ owners isEmpty ifTrue:[
+ found ifFalse:[
+ stop := true.
+ ]
+ ].
+
+ stop ifFalse:[
+ done := found or:[(owners includesIdentical:Smalltalk)].
+ done ifTrue:[
+ moreChainsOnThisLevel := true.
+ temporaryRemoved := IdentitySet new.
+
+ levels size > 0 ifTrue:[
+ "/ show what we found so far.
+ levels last add:Smalltalk.
+ levels reverse.
+ ].
+
+ chains := OrderedCollection new.
+
+ tLevels := levels collect:[:lColl | lColl copy].
+
+ lbl label:('building refchains ...').
+
+ nAll := aCollection size.
+ nDone := 0.
+ aCollection do:[:anObject | |theseChains|
+ stop ifFalse:[
+ theseChains := self
+ refChainsFrom:Smalltalk
+ to:anObject
+ inRefSets:tLevels
+ startingAt:1.
+
+ theseChains size > 0 ifTrue:[
+ chains addAll:theseChains
+ ].
+ nDone := nDone + 1.
+ progress percentage:(nDone / nAll * 100).
+ ]
+ ].
+
+ tLevels := nil.
+
+ levels size > 0 ifTrue:[
+ levels reverse.
+ levels last remove:Smalltalk.
+ ].
+
+ [stop not
+ and:[chains size > 0]] whileTrue:[
+ chain := chains first.
+ chains removeFirst.
+
+ lbl label:('found a reference chain.').
+ progress beInvisible.
+
+ chain addFirst:Smalltalk.
+ list := OrderedCollection withSize:chain size.
+ 1 to:chain size-1 do:[:i |
+ list
+ at:i
+ put:(self refNameFor:(chain at:i+1) in:(chain at:i))
+ ].
+ list at:list size put:(chain last classNameWithArticle).
+
+ "/ hide the VMProcesses stuff from the user ...
+ (list at:1) string = 'Smalltalk:__VMProcesses__' ifTrue:[
+ list at:1 put:'__VMProcesses__ (a hidden VM reference)'.
+ list removeIndex:2.
+ chain at:1 put:nil.
+ chain removeIndex:2.
+ ].
+
+ listV list:list.
+
+ listV beVisible.
+ listV doubleClickAction:[:idx | |o|
+ (o := chain at:idx) notNil ifTrue:[
+ o inspect.
+ ]
+ ].
+ moreButton beVisible.
+ anyShown := anyShownInAnyLevel := true.
+ showMore := false.
+
+ "/ kludge - wait for some user action
+
+ [showMore or:[stop or:[top realized not]]] whileFalse:[
+ Delay waitForSeconds:0.1
+ ].
+
+ chain := nil.
+
+ top realized ifFalse:[
+ stop := true
+ ] ifTrue:[
+ listV doubleClickAction:nil.
+ showMore ifFalse:[
+ stop := true.
+ ].
+ ].
+ done := false.
+
+ stop ifFalse:[
+ progress beVisible.
+ listV beInvisible.
+ moreButton beInvisible.
+
+ chain := nil.
+ ]
+ ].
+ levels size > 0 ifTrue:[
+ levels last addAll:temporaryRemoved.
+ ]
+ ].
+ ].
+
+ owners remove:Smalltalk ifAbsent:nil.
+ owners remove:(owners keyArray) ifAbsent:nil.
+ owners remove:objectArray ifAbsent:nil.
+ levels do:[:lColl |
+ owners remove:lColl ifAbsent:nil
+ ].
+
+ levels add:owners.
+
+ objects := owners.
+
+ objects size == 0 ifTrue:[
+ stop := true
+ ].
+
+ stop ifTrue:[
+ Smalltalk at:#'__VMProcesses__' put:nil.
+ top destroy.
+ anyShown ifFalse:[
+ userStop ifFalse:[
+ self information:(anyShownInAnyLevel ifTrue:['no more references'] ifFalse:['no references']).
+ ]
+ ].
+ ^ self.
+ ].
].
anyShown ifTrue:[
- userStop ifFalse:[
- self information:'no more references'.
- ]
+ userStop ifFalse:[
+ self information:'no more references'.
+ ]
].
Smalltalk at:#'__VMProcesses__' put:nil.
^ self
@@ -2269,41 +2269,41 @@
|done limit|
- AbortSignal handle:[:ex |
- "/ in case of abort (from the debugger),
- "/ disable gcSteps.
- done := true.
- IncrementalGCLimit := FreeSpaceGCLimit := nil.
- 'ObjectMemory [error]: IGC aborted; turning off incremental GC' errorPrintCR
+ AbortOperationRequest handle:[:ex |
+ "/ in case of abort (from the debugger),
+ "/ disable gcSteps.
+ done := true.
+ IncrementalGCLimit := FreeSpaceGCLimit := nil.
+ 'ObjectMemory [error]: IGC aborted; turning off incremental GC' errorPrintCR
] do:[
- limit := IncrementalGCLimit.
- (limit notNil and:[self oldSpaceAllocatedSinceLastGC > limit]) ifTrue:[
+ limit := IncrementalGCLimit.
+ (limit notNil and:[self oldSpaceAllocatedSinceLastGC > limit]) ifTrue:[
"/ 'IGC [info]: start since allocatedSinceLastGC > IncrementalGCLimit' infoPrintCR.
- done := ObjectMemory gcStep
- ] ifFalse:[
- limit := FreeSpaceGCLimit.
- (limit notNil and:[(self freeSpace + self freeListSpace) < limit]) ifTrue:[
+ done := ObjectMemory gcStep
+ ] ifFalse:[
+ limit := FreeSpaceGCLimit.
+ (limit notNil and:[(self freeSpace + self freeListSpace) < limit]) ifTrue:[
"/ 'IGC [info]: start since freeSpace < FreeSpaceGCLimit' infoPrintCR.
- done := ObjectMemory gcStep.
- done ifTrue:[
- self moreOldSpaceIfUseful
- ].
- ] ifFalse:[
- limit := DynamicCodeGCTrigger.
- (limit notNil and:[self compiledCodeCounter > limit]) ifTrue:[
+ done := ObjectMemory gcStep.
+ done ifTrue:[
+ self moreOldSpaceIfUseful
+ ].
+ ] ifFalse:[
+ limit := DynamicCodeGCTrigger.
+ (limit notNil and:[self compiledCodeCounter > limit]) ifTrue:[
"/ 'IGC [info]: start since compiledCodeCounter > DynamicCodeGCTrigger' infoPrintCR.
- done := ObjectMemory gcStep.
- ] ifFalse:[
- limit := DynamicCodeLimit.
- (limit notNil and:[self compiledCodeSpaceUsed > limit]) ifTrue:[
+ done := ObjectMemory gcStep.
+ ] ifFalse:[
+ limit := DynamicCodeLimit.
+ (limit notNil and:[self compiledCodeSpaceUsed > limit]) ifTrue:[
"/ 'IGC [info]: start since compiledCodeSpaceUsed > DynamicCodeLimit' infoPrintCR.
- done := ObjectMemory gcStep.
- ] ifFalse:[
- done := true
- ]
- ]
- ]
- ].
+ done := ObjectMemory gcStep.
+ ] ifFalse:[
+ done := true
+ ]
+ ]
+ ]
+ ].
].
^ done not
@@ -5504,7 +5504,7 @@
!ObjectMemory class methodsFor:'documentation'!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/ObjectMemory.st,v 1.269 2013-06-27 21:01:21 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/ObjectMemory.st,v 1.270 2013-07-05 11:17:47 stefan Exp $'
!
version_SVN
--- a/OrderedDictionary.st Mon Jul 01 22:14:20 2013 +0100
+++ b/OrderedDictionary.st Tue Jul 09 22:51:30 2013 +0100
@@ -604,7 +604,8 @@
!
keysAndValuesDo:aBlock
- "perform the block for all keys in the collection.
+ "perform the block for all keys and values in the collection.
+ Enumerate them in the order by which they were added.
See also:
#associationsDo: (which passes key-value associations)
@@ -621,6 +622,25 @@
"Modified: / 15.10.1999 / 16:53:50 / cg"
!
+keysAndValuesReverseDo:aBlock
+ "perform the block for all keys and values in the collection.
+ Enumerate them in the reverse order from which they were added.
+
+ See also:
+ #associationsDo: (which passes key-value associations)
+ #keysAndValuesDo: (which passes keys & values separately)
+ #do: (which passes values only)
+
+ WARNING: do not add/remove elements while iterating over the receiver.
+ Iterate over a copy to do this."
+
+ order reverseDo: [:key | aBlock value:key value:(self at: key)].
+
+ "Modified: / 26.6.1999 / 10:55:30 / ps"
+ "Created: / 15.10.1999 / 16:49:31 / cg"
+ "Modified: / 15.10.1999 / 16:53:50 / cg"
+!
+
keysDo:aBlock
"evaluate the argument, aBlock for every key in the collection.
@@ -961,10 +981,10 @@
!OrderedDictionary class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/OrderedDictionary.st,v 1.40 2013-04-25 07:18:43 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/OrderedDictionary.st,v 1.41 2013-07-01 14:48:19 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/OrderedDictionary.st,v 1.40 2013-04-25 07:18:43 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/OrderedDictionary.st,v 1.41 2013-07-01 14:48:19 cg Exp $'
! !
--- a/ProcessorScheduler.st Mon Jul 01 22:14:20 2013 +0100
+++ b/ProcessorScheduler.st Tue Jul 09 22:51:30 2013 +0100
@@ -2415,7 +2415,7 @@
wasBlocked := OperatingSystem blockInterrupts.
aFileDescriptor isNil ifTrue:[
- (readCheckArray identityIndexOf:aSemaphore startingAt:1) == 0 ifTrue:[
+ (idx := readCheckArray identityIndexOf:aSemaphore startingAt:1) == 0 ifTrue:[
idx := readFdArray identityIndexOf:nil startingAt:1.
idx ~~ 0 ifTrue:[
readFdArray at:idx put:aFileDescriptor.
@@ -2435,7 +2435,7 @@
].
]
] ifFalse:[
- (readFdArray identityIndexOf:aFileDescriptor startingAt:1) == 0 ifTrue:[
+ (idx := readFdArray identityIndexOf:aFileDescriptor startingAt:1) == 0 ifTrue:[
idx := readFdArray identityIndexOf:nil startingAt:1.
idx ~~ 0 ifTrue:[
readFdArray at:idx put:aFileDescriptor.
@@ -3377,11 +3377,11 @@
!ProcessorScheduler class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.270 2013-06-27 09:49:11 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.271 2013-07-05 13:27:01 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.270 2013-06-27 09:49:11 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.271 2013-07-05 13:27:01 cg Exp $'
! !
--- a/SequenceableCollection.st Mon Jul 01 22:14:20 2013 +0100
+++ b/SequenceableCollection.st Tue Jul 09 22:51:30 2013 +0100
@@ -368,6 +368,7 @@
^ self == SequenceableCollection
! !
+
!SequenceableCollection methodsFor:'Compatibility-Squeak'!
allButFirst
@@ -687,6 +688,7 @@
^ self replaceFrom:start to:stop with:anArray startingAt:repStart
! !
+
!SequenceableCollection methodsFor:'accessing'!
after:anObject
@@ -4258,6 +4260,30 @@
"
!
+upToAll:aSubCollection
+ "return a new collection consisting of the receiver's elements upTo
+ (but excluding) the first occurrence of a subcollection.
+ If none of aCollectionOfObjects is found in the receiver, the returned collection
+ will consist of all elements of the receiver.
+ See also #upTo:"
+
+ |pos|
+
+ pos := self indexOfSubCollection:aSubCollection.
+ pos == 0 ifTrue:[^ self copy].
+
+ ^ self copyFrom:1 to:(pos - 1)
+
+ "
+ 'hello world' upToAll:'wo'
+ 'hello world' upToAll:'bla'
+ #(1 2 3 4 5 6 7 8) upToAll:#(5)
+ #(1 2 3 4 5 6 7 8) upToAll:#()
+ #(1 3 4 2 3 4 5 6 7 8) upToAll:#(3 4 5 6)
+ #(1 3 4 2 3 4 5 6 7 8) upToAll:#(3 5 6)
+ "
+!
+
upToAny:aCollectionOfObjects
"return a new collection consisting of the receiver's elements upTo
(but excluding) any in aCollectionOfObjects.
@@ -6816,6 +6842,7 @@
"Created: 14.2.1997 / 16:13:03 / cg"
! !
+
!SequenceableCollection methodsFor:'searching'!
detect:aBlock startingAt:startIndex
@@ -8966,11 +8993,11 @@
!SequenceableCollection class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.340 2013-06-29 09:35:21 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.341 2013-07-05 14:28:29 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.340 2013-06-29 09:35:21 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.341 2013-07-05 14:28:29 cg Exp $'
! !
--- a/UnixOperatingSystem.st Mon Jul 01 22:14:20 2013 +0100
+++ b/UnixOperatingSystem.st Tue Jul 09 22:51:30 2013 +0100
@@ -3675,6 +3675,42 @@
"
!
+accessModeOfFd:aFileDescriptor
+ "return a number representing access rights rwxrwxrwx for owner,
+ group and others. Return nil if such a file does not exist.
+ Notice that the returned number is OS dependent - use the
+ modeMasks as returned by OperatingSystem>>accessMaskFor:"
+
+%{
+ struct stat buf;
+ int ret;
+
+ if (__isSmallInteger(aFileDescriptor)) {
+# ifdef TRACE_STAT_CALLS
+ printf("fstat on '%d' for accessMode\n", __smallIntegerVal(aFileDescriptor));
+# endif
+ __BEGIN_INTERRUPTABLE__
+ do {
+ ret = fstat(__smallIntegerVal(aFileDescriptor), &buf);
+ } while ((ret < 0) && (errno == EINTR));
+ __END_INTERRUPTABLE__
+
+ if (ret < 0) {
+ @global(LastErrorNumber) = __mkSmallInteger(errno);
+ RETURN ( nil );
+ }
+ RETURN ( __mkSmallInteger(buf.st_mode & 0777) );
+ }
+%}.
+ ^ self primitiveFailed
+
+ "
+ '/' asFilename readingFileDo:[:s|
+ (OperatingSystem accessModeOfFd:s fileDescriptor) printStringRadix:8
+ ].
+ "
+!
+
changeAccessModeOf:aPathName to:modeBits
"change the access rights of aPathName to the OS dependent modeBits.
You should construct this mask using accessMaskFor, to be OS
@@ -3701,6 +3737,32 @@
}
%}.
^ self primitiveFailed
+!
+
+changeAccessModeOfFd:aFileDescriptor to:modeBits
+ "change the access rights of the file referenced by aFileDescriptor
+ to the OS dependent modeBits.
+ You should construct this mask using accessMaskFor, to be OS
+ independent. Return true if changed,
+ false if such a file does not exist or change was not allowd."
+
+%{
+ int ret;
+
+ if (__isSmallInteger(aFileDescriptor) && __isSmallInteger(modeBits)) {
+ __BEGIN_INTERRUPTABLE__
+ do {
+ ret = fchmod(__smallIntegerVal(aFileDescriptor), __intVal(modeBits));
+ } while (ret < 0 && errno == EINTR);
+ __END_INTERRUPTABLE__
+ if (ret < 0) {
+ @global(LastErrorNumber) = __mkSmallInteger(errno);
+ RETURN ( false );
+ }
+ RETURN ( true );
+ }
+%}.
+ ^ self primitiveFailed
! !
!UnixOperatingSystem class methodsFor:'file locking'!
@@ -5778,14 +5840,14 @@
^ nil
!
-makePTYPair
- "make a pipe, return array with two filedescriptors on success,
- nil on failure.
+makePTY
+ "make a pty-pair, return a triple with two filedescriptors and the pty's name
+ on success, nil on failure.
This is a lowLevel entry, not for public use.
See NonPositionableExternalStream>>makePTYPair for a more user-friendly,
public interface."
- |fdS fdM|
+ |fdS fdM ptyName|
%{
/*
@@ -5809,8 +5871,9 @@
_fdM -1;
}
if ((_fdM >= 0) && (_fdS >= 0)) {
- fdM = __mkSmallInteger(_fdM);
- fdS = __mkSmallInteger(_fdS);
+ fdM = __mkSmallInteger(_fdM);
+ fdS = __mkSmallInteger(_fdS);
+ ptyName = __MKSTRING(slaveName);
}
# define PTY_IS_IMPLEMENTED 1
#endif /* IRIX5 */
@@ -5852,8 +5915,9 @@
}
if ((_fdM >= 0) && (_fdS >= 0)) {
- fdM = __mkSmallInteger(_fdM);
- fdS = __mkSmallInteger(_fdS);
+ fdM = __mkSmallInteger(_fdM);
+ fdS = __mkSmallInteger(_fdS);
+ ptyName = __MKSTRING(slaveName);
}
# define PTY_IS_IMPLEMENTED 1
#endif /* HAS_UNIX98_PTY */
@@ -5915,6 +5979,7 @@
char line[128];
register CONST char *cp1, *cp2;
int len, _fdM = -1, _fdS = -1;
+ char *slaveName = NULL;
len = sizeof(PTY_TEMPL) - 1;
strncpy(line, PTY_TEMPL, sizeof(PTY_TEMPL));
@@ -5951,6 +6016,7 @@
(void) chmod( line, S_IRUSR | S_IWUSR | S_IWGRP );
if( (_fdS = open(line, O_RDWR, 0)) >= 0 ) {
+ slaveName = line;
goto getOutOfHere; /* success */
}
(void) close(_fdM );
@@ -5960,20 +6026,35 @@
getOutOfHere: ;
if ((_fdM >= 0) && (_fdS >= 0)) {
- fdM = __mkSmallInteger(_fdM);
- fdS = __mkSmallInteger(_fdS);
+ fdM = __mkSmallInteger(_fdM);
+ fdS = __mkSmallInteger(_fdS);
+ ptyName = __MKSTRING(slaveName);
}
#endif /* ! defined(PTY_IS_IMPLEMENTED) */
%}.
fdM notNil ifTrue:[
- ^ Array with:fdM with:fdS.
+ ^ Array with:fdM with:fdS with:ptyName.
].
^ nil
!
+makePTYPair
+ "make a pty-pair, return an array with two filedescriptors on success,
+ nil on failure.
+ This is a leftover compatibility lowLevel entry, not for public use.
+ See NonPositionableExternalStream>>makePTYPair for a more user-friendly,
+ public interface."
+
+ |triple|
+
+ triple := self makePTY.
+ triple isNil ifTrue:[^ nil].
+ ^ Array with:(triple at:1) with:(triple at:2)
+!
+
makePipe
"make a pipe, return array with two filedescriptors on success,
nil on failure.
@@ -13247,11 +13328,11 @@
!UnixOperatingSystem class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/UnixOperatingSystem.st,v 1.325 2013-05-21 20:44:47 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/UnixOperatingSystem.st,v 1.329 2013-07-08 19:27:29 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/UnixOperatingSystem.st,v 1.325 2013-05-21 20:44:47 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/UnixOperatingSystem.st,v 1.329 2013-07-08 19:27:29 stefan Exp $'
!
version_HG
--- a/Win32OperatingSystem.st Mon Jul 01 22:14:20 2013 +0100
+++ b/Win32OperatingSystem.st Tue Jul 09 22:51:30 2013 +0100
@@ -824,6 +824,7 @@
"Modified: 7.1.1997 / 19:36:11 / stefan"
! !
+
!Win32OperatingSystem class methodsFor:'OS signal constants'!
sigABRT
@@ -1596,833 +1597,837 @@
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;
-
- default:
- sym = nil;
- 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;
+ case EADDRINUSE:
+ sym = @symbol(EADDRINUSE);
+ 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;
+ case WSAEBADF:
+ sym = @symbol(WSAEBADF);
+ typ = @symbol(badAccessorSignal);
+ break;
#endif
#ifdef WSAEACCESS
- case WSAEACCESS:
- sym = @symbol(WSAEACCESS);
- typ = @symbol(badAccessorSignal);
- break;
+ case WSAEACCESS:
+ sym = @symbol(WSAEACCESS);
+ 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;
+ }
}
}
%}.
@@ -2431,7 +2436,7 @@
^ holder
"
- OperatingSystem errorHolderForNumber:4
+ self errorHolderForNumber:16777296
self errorHolderForNumber:(self errorNumberFor:#EPERM)
self errorHolderForNumber:(self errorNumberFor:#EIO)
self errorHolderForNumber:(self errorNumberFor:#ENXIO)
@@ -3780,7 +3785,9 @@
shellExecute:hwndArg lpOperation:lpOperationArg lpFile:lpFileArg lpParameters:lpParametersArg lpDirectory:lpDirectoryArg nShowCmd:nShowCmd
"Opens or prints the specified file, which can be an executable, document file, or directory.
If its a directory, an explorer window is opened (see example below).
- Can be used to open a browser or viewer on html-files, pdf-files etc"
+ Can be used to open a browser or viewer on html-files, pdf-files etc.
+ lpDirectory: the pathname string of the directory used for the command,
+ or nil for the current directory."
|errorNumber handle|
@@ -3791,102 +3798,102 @@
shExecInfo.cbSize = sizeof(shExecInfo);
if (__isSmallInteger(nShowCmd)) {
- shExecInfo.nShow = __intVal(nShowCmd);
+ shExecInfo.nShow = __intVal(nShowCmd);
} else {
- if (nShowCmd == @symbol(SW_SHOW)) {
- shExecInfo.nShow = SW_SHOW;
- } else if (nShowCmd == @symbol(SW_SHOWNORMAL)) {
- shExecInfo.nShow = SW_SHOWNORMAL;
- } else if (nShowCmd == @symbol(SW_SHOWDEFAULT)) {
- shExecInfo.nShow = SW_SHOWDEFAULT;
- } else if (nShowCmd == @symbol(SW_SHOWMAXIMIZED)) {
- shExecInfo.nShow = SW_SHOWMAXIMIZED;
- } else if (nShowCmd == @symbol(SW_SHOWMINIMIZED)) {
- shExecInfo.nShow = SW_SHOWMINIMIZED;
- } else if (nShowCmd == @symbol(SW_SHOWMINNOACTIVE)) {
- shExecInfo.nShow = SW_SHOWMINNOACTIVE;
- } else if (nShowCmd == @symbol(SW_SHOWNA)) {
- shExecInfo.nShow = SW_SHOWNA;
- } else if (nShowCmd == @symbol(SW_SHOWNOACTIVATE)) {
- shExecInfo.nShow = SW_SHOWNOACTIVATE;
- } else if (nShowCmd == @symbol(SW_MAXIMIZE)) {
- shExecInfo.nShow = SW_MAXIMIZE;
- } else if (nShowCmd == @symbol(SW_RESTORE)) {
- shExecInfo.nShow = SW_RESTORE;
- } else {
- goto badArgument;
- }
+ if (nShowCmd == @symbol(SW_SHOW)) {
+ shExecInfo.nShow = SW_SHOW;
+ } else if (nShowCmd == @symbol(SW_SHOWNORMAL)) {
+ shExecInfo.nShow = SW_SHOWNORMAL;
+ } else if (nShowCmd == @symbol(SW_SHOWDEFAULT)) {
+ shExecInfo.nShow = SW_SHOWDEFAULT;
+ } else if (nShowCmd == @symbol(SW_SHOWMAXIMIZED)) {
+ shExecInfo.nShow = SW_SHOWMAXIMIZED;
+ } else if (nShowCmd == @symbol(SW_SHOWMINIMIZED)) {
+ shExecInfo.nShow = SW_SHOWMINIMIZED;
+ } else if (nShowCmd == @symbol(SW_SHOWMINNOACTIVE)) {
+ shExecInfo.nShow = SW_SHOWMINNOACTIVE;
+ } else if (nShowCmd == @symbol(SW_SHOWNA)) {
+ shExecInfo.nShow = SW_SHOWNA;
+ } else if (nShowCmd == @symbol(SW_SHOWNOACTIVATE)) {
+ shExecInfo.nShow = SW_SHOWNOACTIVATE;
+ } else if (nShowCmd == @symbol(SW_MAXIMIZE)) {
+ shExecInfo.nShow = SW_MAXIMIZE;
+ } else if (nShowCmd == @symbol(SW_RESTORE)) {
+ shExecInfo.nShow = SW_RESTORE;
+ } else {
+ goto badArgument;
+ }
}
if (((lpOperationArg == nil) || __isStringLike(lpOperationArg))
&& ((lpFileArg == nil) || __isStringLike(lpFileArg))
&& ((lpParametersArg == nil) || __isStringLike(lpParametersArg))
&& ((lpDirectoryArg == nil) || __isStringLike(lpDirectoryArg))
) {
- // hProcess member receives the process handle
- shExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
-
- shExecInfo.hwnd = 0;
- shExecInfo.lpVerb = (lpOperationArg != nil) ? __stringVal(lpOperationArg) : NULL;
- shExecInfo.lpFile = (lpFileArg != nil) ? __stringVal(lpFileArg) : NULL;
- shExecInfo.lpParameters = (lpParametersArg != nil) ? __stringVal(lpParametersArg) : NULL;
- shExecInfo.lpDirectory = (lpDirectoryArg != nil) ? __stringVal(lpDirectoryArg) : NULL;
- if (hwndArg != nil) {
- if (__isExternalAddressLike(hwndArg)) {
- shExecInfo.hwnd = (HANDLE)(__externalAddressVal(hwndArg));
- } else
- goto badArgument;
- }
- if (ShellExecuteEx(&shExecInfo)) {
- if (shExecInfo.hProcess) {
- DWORD_PTR processAffinityMask, systemAffinityMask;
- /*
- * Set the affinity mask
- * to any processor, and resume the processes main thread.
- * (librun/process.s limited the affinity to a single processor).
- */
- GetProcessAffinityMask(shExecInfo.hProcess, &processAffinityMask, &systemAffinityMask);
- SetProcessAffinityMask(shExecInfo.hProcess, systemAffinityMask);
-
- // new (does not work, yet):
- // __externalAddressVal(handle) = shExecInfo.hProcess;
- // RETURN (handle);
-
- // old:
- CloseHandle(shExecInfo.hProcess);
- RETURN (self); /* OK */
- } else {
- RETURN (self); /* OK */
- }
- } else {
- /* error */
- errorNumber = __mkSmallInteger(__WIN32_ERR(GetLastError()));
- }
+ // hProcess member receives the process handle
+ shExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
+
+ shExecInfo.hwnd = 0;
+ shExecInfo.lpVerb = (lpOperationArg != nil) ? __stringVal(lpOperationArg) : NULL;
+ shExecInfo.lpFile = (lpFileArg != nil) ? __stringVal(lpFileArg) : NULL;
+ shExecInfo.lpParameters = (lpParametersArg != nil) ? __stringVal(lpParametersArg) : NULL;
+ shExecInfo.lpDirectory = (lpDirectoryArg != nil) ? __stringVal(lpDirectoryArg) : NULL;
+ if (hwndArg != nil) {
+ if (__isExternalAddressLike(hwndArg)) {
+ shExecInfo.hwnd = (HANDLE)(__externalAddressVal(hwndArg));
+ } else
+ goto badArgument;
+ }
+ if (ShellExecuteEx(&shExecInfo)) {
+ if (shExecInfo.hProcess) {
+ DWORD_PTR processAffinityMask, systemAffinityMask;
+ /*
+ * Set the affinity mask
+ * to any processor, and resume the processes main thread.
+ * (librun/process.s limited the affinity to a single processor).
+ */
+ GetProcessAffinityMask(shExecInfo.hProcess, &processAffinityMask, &systemAffinityMask);
+ SetProcessAffinityMask(shExecInfo.hProcess, systemAffinityMask);
+
+ // new (does not work, yet):
+ // __externalAddressVal(handle) = shExecInfo.hProcess;
+ // RETURN (handle);
+
+ // old:
+ CloseHandle(shExecInfo.hProcess);
+ RETURN (self); /* OK */
+ } else {
+ RETURN (self); /* OK */
+ }
+ } else {
+ /* error */
+ errorNumber = __mkSmallInteger(__WIN32_ERR(GetLastError()));
+ }
}
badArgument: ;
%}.
errorNumber isNil ifTrue:[
- self primitiveFailed:'invalid argument(s)'.
+ self primitiveFailed:'invalid argument(s)'.
] ifFalse:[
- (OperatingSystem errorHolderForNumber:errorNumber)
- parameter:lpFileArg;
- reportError
+ (OperatingSystem errorHolderForNumber:errorNumber)
+ parameter:lpFileArg;
+ reportError
].
"
self
- shellExecute:nil
- lpOperation:'open'
- lpFile:(Filename currentDirectory pathName)
- lpParameters:nil
- lpDirectory:(Filename currentDirectory pathName)
- nShowCmd:#SW_SHOWNORMAL
+ shellExecute:nil
+ lpOperation:'open'
+ lpFile:(Filename currentDirectory pathName)
+ lpParameters:nil
+ lpDirectory:nil
+ nShowCmd:#SW_SHOWNORMAL
self
- shellExecute:nil
- lpOperation:'explore'
- lpFile:(Filename currentDirectory pathName)
- lpParameters:nil
- lpDirectory:(Filename currentDirectory pathName)
- nShowCmd:#SW_SHOWNORMAL
+ shellExecute:nil
+ lpOperation:'explore'
+ lpFile:(Filename currentDirectory pathName)
+ lpParameters:nil
+ lpDirectory:nil
+ nShowCmd:#SW_SHOWNORMAL
"
!
@@ -5865,21 +5872,21 @@
%{
if (__isStringLike(aPathName)) {
- char nameBuffer[MAXPATHLEN + 1];
- char nameBuffer2[MAXPATHLEN + 1];
- char *returnedName = NULL;
- int rslt;
+ char nameBuffer[MAXPATHLEN + 1];
+ char nameBuffer2[MAXPATHLEN + 1];
+ char *returnedName = NULL;
+ int rslt;
#ifdef DO_WRAP_CALLS
- char _aPathName[MAXPATHLEN+1];
-
- strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
- do {
- __threadErrno = 0;
- rslt = STX_API_NOINT_CALL4( "GetFullPathNameA", GetFullPathNameA, _aPathName, MAXPATHLEN, nameBuffer, NULL);
- } while ((rslt < 0) && (__threadErrno == EINTR));
-#else
- rslt = GetFullPathNameA(__stringVal(aPathName), MAXPATHLEN, nameBuffer, NULL);
+ char _aPathName[MAXPATHLEN+1];
+
+ strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
+ do {
+ __threadErrno = 0;
+ rslt = STX_API_NOINT_CALL4( "GetFullPathNameA", GetFullPathNameA, _aPathName, MAXPATHLEN, nameBuffer, NULL);
+ } while ((rslt < 0) && (__threadErrno == EINTR));
+#else
+ rslt = GetFullPathNameA(__stringVal(aPathName), MAXPATHLEN, nameBuffer, NULL);
#endif
returnedName = nameBuffer;
@@ -5901,27 +5908,27 @@
RETURN (nil);
}
if (__isUnicode16String(aPathName)) {
- wchar_t nameBuffer[MAXPATHLEN + 1];
- wchar_t nameBuffer2[MAXPATHLEN + 1];
- wchar_t *returnedName = NULL;
- int rslt;
- wchar_t _aPathName[MAXPATHLEN+1];
- int i, l;
-
- l = __unicode16StringSize(aPathName);
- if (l > MAXPATHLEN) l = MAXPATHLEN;
- for (i=0; i<l; i++) {
- _aPathName[i] = __unicode16StringVal(aPathName)[i];
- }
- _aPathName[i] = 0;
+ wchar_t nameBuffer[MAXPATHLEN + 1];
+ wchar_t nameBuffer2[MAXPATHLEN + 1];
+ wchar_t *returnedName = NULL;
+ int rslt;
+ wchar_t _aPathName[MAXPATHLEN+1];
+ int i, l;
+
+ l = __unicode16StringSize(aPathName);
+ if (l > MAXPATHLEN) l = MAXPATHLEN;
+ for (i=0; i<l; i++) {
+ _aPathName[i] = __unicode16StringVal(aPathName)[i];
+ }
+ _aPathName[i] = 0;
#ifdef DO_WRAP_CALLS
- do {
- __threadErrno = 0;
- rslt = STX_API_NOINT_CALL4( "GetFullPathNameW", GetFullPathNameW, _aPathName, MAXPATHLEN, nameBuffer, NULL);
- } while ((rslt < 0) && (__threadErrno == EINTR));
-#else
- rslt = GetFullPathNameW(_aPathName, MAXPATHLEN, nameBuffer, NULL);
+ do {
+ __threadErrno = 0;
+ rslt = STX_API_NOINT_CALL4( "GetFullPathNameW", GetFullPathNameW, _aPathName, MAXPATHLEN, nameBuffer, NULL);
+ } while ((rslt < 0) && (__threadErrno == EINTR));
+#else
+ rslt = GetFullPathNameW(_aPathName, MAXPATHLEN, nameBuffer, NULL);
#endif
returnedName = nameBuffer;
@@ -7798,8 +7805,8 @@
getNetworkMACAddresses
"return a dictionary filled with
- key -> name of interface
- value -> the MAC adress (as ByteArray)
+ key -> name of interface
+ value -> the MAC adress (as ByteArray)
for each interface
"
@@ -7861,16 +7868,16 @@
"Keep the order as reurned by the OS"
info := OrderedDictionary new:nAdapters.
nAdapters notNil ifTrue:[
- 1 to:nAdapters do:[:i |
- |entry name description macAddr ipAddr|
-
- entry := rawData at:i.
- name := entry at:1.
- "/ description := entry at:2.
- macAddr := entry at:3.
- "/ ipAddr := entry at:4.
- info at:name put:macAddr.
- ].
+ 1 to:nAdapters do:[:i |
+ |entry name description macAddr ipAddr|
+
+ entry := rawData at:i.
+ name := entry at:1.
+ "/ description := entry at:2.
+ macAddr := entry at:3.
+ "/ ipAddr := entry at:4.
+ info at:name put:macAddr.
+ ].
].
^ info
@@ -9800,32 +9807,31 @@
!Win32OperatingSystem class methodsFor:'shell operations'!
-openApplicationForDocument:aFilenameOrString operation:operationSymbol
+openApplicationForDocument:fileOrUrl operation:operationSymbol mimeType:mimeType
"open a windows-shell application to present the document contained in aFilenameOrString.
This looks for the files extension, and is typically used to present help-files,
html documents, pdf documents etc.
operationSymbol is one of:
- open
- edit
- explore
- print
- "
-
- |result filename|
-
- filename := aFilenameOrString asFilename.
- result := self
- shellExecute:nil
- lpOperation:operationSymbol
- lpFile:filename pathName
- lpParameters:nil
- lpDirectory:filename directory pathName
- nShowCmd:#SW_SHOWNORMAL.
- ^ self.
+ open
+ edit
+ explore
+ print
+ "
+
+ self
+ shellExecute:nil
+ lpOperation:operationSymbol
+ lpFile:fileOrUrl asString
+ lpParameters:nil
+ lpDirectory:nil "/ uses the current directory
+ nShowCmd:#SW_SHOWNORMAL.
+
"
self openApplicationForDocument: Filename currentDirectory operation:#open
+ self openApplicationForDocument: 'C:\' operation:#open
self openApplicationForDocument: '..\..\doc\books\ArtOfSmalltalk\artMissing186187Fix1.pdf' asFilename operation:#open
+ self openApplicationForDocument: 'http://www.exept.de' asFilename operation:#open
self openApplicationForDocument: 'C:\WINDOWS\Help\clipbrd.chm' asFilename operation:#open
"
@@ -17136,15 +17142,15 @@
!Win32OperatingSystem class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.467 2013-06-20 22:33:31 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.469 2013-07-05 12:36:41 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.467 2013-06-20 22:33:31 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.469 2013-07-05 12:36:41 stefan Exp $'
!
version_SVN
- ^ '$Id: Win32OperatingSystem.st,v 1.467 2013-06-20 22:33:31 cg Exp $'
+ ^ '$Id: Win32OperatingSystem.st,v 1.469 2013-07-05 12:36:41 stefan Exp $'
! !
--- a/WriteStream.st Mon Jul 01 22:14:20 2013 +0100
+++ b/WriteStream.st Tue Jul 09 22:51:30 2013 +0100
@@ -483,6 +483,23 @@
"Modified: / 04-09-2011 / 20:03:32 / cg"
!
+nextPutAll:n from:aCollection startingAt:pos1
+ "append some elements of the argument, aCollection to the stream."
+
+ ^ self nextPutAll:aCollection startingAt:pos1 to:pos1+n-1
+
+ "
+ |s|
+
+ s := '' writeStream.
+ s nextPutAll:'hello '.
+ s next:5 putAll:'1234world012345' startingAt:5.
+ s contents
+ "
+
+ "Modified: 12.7.1996 / 10:31:36 / cg"
+!
+
nextPutAll:aCollection startingAt:pos1 to:pos2
"append some elements of the argument, aCollection to the stream.
Redefined to avoid count grows of the underlying collection -
@@ -632,10 +649,10 @@
!WriteStream class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/WriteStream.st,v 1.78 2013-06-03 18:39:07 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/WriteStream.st,v 1.79 2013-07-06 13:30:16 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/WriteStream.st,v 1.78 2013-06-03 18:39:07 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/WriteStream.st,v 1.79 2013-07-06 13:30:16 cg Exp $'
! !
--- a/resources/de.rs Mon Jul 01 22:14:20 2013 +0100
+++ b/resources/de.rs Tue Jul 09 22:51:30 2013 +0100
@@ -1,6 +1,6 @@
#encoding iso8859-1
-; $Header: /cvs/stx/stx/libbasic/resources/de.rs,v 1.8 2010-06-08 19:20:52 cg Exp $
+; $Header: /cvs/stx/stx/libbasic/resources/de.rs,v 1.9 2013-07-04 19:23:21 stefan Exp $
;
; German strings
;
@@ -192,4 +192,6 @@
; 'ERROR_NOT_DOS_DISK' 'Not a DOS disk'
; 'ERROR_OUT_OF_PAPER' 'Printer is out of paper'
; 'ERROR_PRINTQ_FULL' 'Printer queue is full'
+'ERROR_FILE_EXISTS' 'Datei existiert bereits'
+
#endif
--- a/resources/en.rs Mon Jul 01 22:14:20 2013 +0100
+++ b/resources/en.rs Tue Jul 09 22:51:30 2013 +0100
@@ -1,6 +1,6 @@
#encoding iso8859-1
-; $Header: /cvs/stx/stx/libbasic/resources/en.rs,v 1.2 2004/03/15 16:39:09 cg Exp $
+; $Header: /cvs/stx/stx/libbasic/resources/en.rs,v 1.3 2013-07-04 19:23:06 stefan Exp $
;
; English date strings
;
@@ -140,13 +140,7 @@
'ERROR_NOT_DOS_DISK' ?'Not a DOS disk'
'ERROR_OUT_OF_PAPER' ?'Printer is out of paper'
'ERROR_PRINTQ_FULL' ?'Printer queue is full'
+'ERROR_FILE_EXISTS' ?'File already exists'
#endif
MAY_ABBREV ? 'may'
-
-
-
-
-
-
-