*** empty log message ***
authorclaus
Sun, 09 Jan 1994 22:16:16 +0100
changeset 38 454b1b94a48e
parent 37 d9a302eaa3ef
child 39 bcf183a31bbb
*** empty log message ***
Delay.st
Dict.st
Dictionary.st
DirStr.st
DirectoryStream.st
ExtStream.st
ExternalStream.st
False.st
Filename.st
--- a/Delay.st	Sun Jan 09 22:13:01 1994 +0100
+++ b/Delay.st	Sun Jan 09 22:16:16 1994 +0100
@@ -9,17 +9,23 @@
 
 !Delay class methodsFor:'instance creation'!
 
-forMilliseconds:millis
-    ^ self new milliseconds:millis
+forMilliseconds:aNumber
+    "return a new Delay object for delaying aNumber milliseconds"
+
+    ^ self new milliseconds:aNumber
 !
 
-forSeconds:seconds
-    ^ self new milliseconds:(seconds * 1000)
+forSeconds:aNumber
+    "return a new Delay object for delaying aNumber seconds"
+
+    ^ self new milliseconds:(aNumber * 1000)
 ! !
 
 !Delay methodsFor:'accessing'!
 
 milliseconds:aNumber
+    "set the milliseconds"
+
     milliseconds := aNumber
 ! !
 
--- a/Dict.st	Sun Jan 09 22:13:01 1994 +0100
+++ b/Dict.st	Sun Jan 09 22:16:16 1994 +0100
@@ -26,7 +26,7 @@
 (The implementation uses two array to store the keys and values separately.)
 Searching for an element is done using a hash into the key array.
 
-$Header: /cvs/stx/stx/libbasic/Attic/Dict.st,v 1.6 1993-12-11 00:45:55 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Attic/Dict.st,v 1.7 1994-01-09 21:15:05 claus Exp $
 
 written jun 91 by claus
 rewritten 92 to use hash scheme
@@ -113,7 +113,7 @@
 keys
     "return a collection containing all keys of the receiver"
 
-    ^ keyArray select:[:key | key notNil]
+    ^ keyArray select:[:key | key notNil and:[key ~~ DeletedEntry]]
 !
 
 keyAtValue:aValue
@@ -129,7 +129,7 @@
      This is a slow access, since there is no fast reverse mapping"
 
     keyArray keysAndValuesDo:[:index :aKey |
-        aKey notNil ifTrue:[
+        (aKey notNil and:[aKey ~~ DeletedEntry]) ifTrue:[
             (valueArray at:index) = aValue ifTrue:[^ aKey].
         ].
     ].
@@ -189,10 +189,10 @@
             ] ifFalse:[
                 next := index + 1.
             ].
-            "redundant check to save a send sometimes"
             (keyArray basicAt:next) notNil ifTrue:[
-                self rehashFrom:next.
-            ]
+                keyArray basicAt:index put:DeletedEntry
+            ].
+            self emptyCheck
         ]
     ]
 ! !
@@ -202,18 +202,24 @@
 allKeysDo:aBlock
     "perform the block for all keys in the collection."
 
-    keyArray nonNilElementsDo:aBlock
+    tally == 0 ifTrue:[^ self].
+    keyArray nonNilElementsDo:[:key |
+        (key ~~ DeletedEntry) ifTrue:[
+            aBlock value:key
+        ]
+    ]
 !
 
 associationsDo:aBlock
     "perform the block for all associations in the collection."
 
-    |key|
+    |key n "{ Class: SmallInteger }"|
 
     tally == 0 ifTrue:[^ self].
-    1 to:(keyArray basicSize) do:[:index |
+    n := keyArray basicSize.
+    1 to:n do:[:index |
         key := keyArray basicAt:index.
-        key notNil ifTrue:[
+        (key notNil and:[key ~~ DeletedEntry]) ifTrue:[
             aBlock value:(Association key:key value:(valueArray basicAt:index))
         ]
     ]
@@ -222,15 +228,15 @@
 do:aBlock
     "perform the block for all values in the collection."
 
-    |index "{ Class:SmallInteger }" |
+    |key n "{ Class: SmallInteger }"|
 
     tally == 0 ifTrue:[^ self].
-    index := 1.
-    keyArray do:[:key |
-        key notNil ifTrue:[
+    n := keyArray basicSize.
+    1 to:n do:[:index |
+        key := keyArray basicAt:index.
+        (key notNil and:[key ~~ DeletedEntry]) ifTrue:[
             aBlock value:(valueArray basicAt:index)
         ].
-        index := index + 1
     ]
 !
 
@@ -238,15 +244,15 @@
     "evaluate the argument, aBlock for every element in the collection,
      passing both key and element as arguments."
 
-    |index "{ Class:SmallInteger }" |
+    |key n "{ Class: SmallInteger }"|
 
     tally == 0 ifTrue:[^ self].
-    index := 1.
-    keyArray do:[:key |
-        key notNil ifTrue:[
+    n := keyArray basicSize.
+    1 to:n do:[:index |
+        key := keyArray basicAt:index.
+        (key notNil and:[key ~~ DeletedEntry]) ifTrue:[
             aTwoArgBlock value:key value:(valueArray basicAt:index)
         ].
-        index := index + 1
     ]
 !
 
@@ -312,7 +318,7 @@
     oldSize := oldKeyArray size.
     1 to:oldSize do:[:index |
         key := oldKeyArray basicAt:index.
-        key notNil ifTrue:[
+        (key notNil and:[key ~~ DeletedEntry]) ifTrue:[
             newIndex := self findNil:key.
             keyArray basicAt:newIndex put:key.
             valueArray basicAt:newIndex put:(oldValueArray basicAt:index).
@@ -336,7 +342,7 @@
 
     1 to:n do:[:index |
         key := oldKeyArray basicAt:index.
-        key notNil ifTrue:[
+        (key notNil and:[key ~~ DeletedEntry]) ifTrue:[
             newIndex := self findNil:key.
             keyArray basicAt:newIndex put:key.
             valueArray basicAt:newIndex put:(oldValueArray basicAt:index).
@@ -354,15 +360,16 @@
     index := startIndex.
     key := keyArray basicAt:index.
     [key notNil] whileTrue:[
-        i := self findNil:key.
-        i == index ifTrue:[
-            ^ self
+        key ~~ DeletedEntry ifTrue:[
+            i := self findNil:key.
+            i == index ifTrue:[
+                ^ self
+            ].
+            keyArray basicAt:i put:key.
+            valueArray basicAt:i put:(valueArray basicAt:index).
+            keyArray basicAt:index put:nil.
+            valueArray basicAt:index put:nil.
         ].
-        keyArray basicAt:i put:key.
-        valueArray basicAt:i put:(valueArray basicAt:index).
-        keyArray basicAt:index put:nil.
-        valueArray basicAt:index put:nil.
-
         index == length ifTrue:[
             index := 1
         ] ifFalse:[
--- a/Dictionary.st	Sun Jan 09 22:13:01 1994 +0100
+++ b/Dictionary.st	Sun Jan 09 22:16:16 1994 +0100
@@ -26,7 +26,7 @@
 (The implementation uses two array to store the keys and values separately.)
 Searching for an element is done using a hash into the key array.
 
-$Header: /cvs/stx/stx/libbasic/Dictionary.st,v 1.6 1993-12-11 00:45:55 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Dictionary.st,v 1.7 1994-01-09 21:15:05 claus Exp $
 
 written jun 91 by claus
 rewritten 92 to use hash scheme
@@ -113,7 +113,7 @@
 keys
     "return a collection containing all keys of the receiver"
 
-    ^ keyArray select:[:key | key notNil]
+    ^ keyArray select:[:key | key notNil and:[key ~~ DeletedEntry]]
 !
 
 keyAtValue:aValue
@@ -129,7 +129,7 @@
      This is a slow access, since there is no fast reverse mapping"
 
     keyArray keysAndValuesDo:[:index :aKey |
-        aKey notNil ifTrue:[
+        (aKey notNil and:[aKey ~~ DeletedEntry]) ifTrue:[
             (valueArray at:index) = aValue ifTrue:[^ aKey].
         ].
     ].
@@ -189,10 +189,10 @@
             ] ifFalse:[
                 next := index + 1.
             ].
-            "redundant check to save a send sometimes"
             (keyArray basicAt:next) notNil ifTrue:[
-                self rehashFrom:next.
-            ]
+                keyArray basicAt:index put:DeletedEntry
+            ].
+            self emptyCheck
         ]
     ]
 ! !
@@ -202,18 +202,24 @@
 allKeysDo:aBlock
     "perform the block for all keys in the collection."
 
-    keyArray nonNilElementsDo:aBlock
+    tally == 0 ifTrue:[^ self].
+    keyArray nonNilElementsDo:[:key |
+        (key ~~ DeletedEntry) ifTrue:[
+            aBlock value:key
+        ]
+    ]
 !
 
 associationsDo:aBlock
     "perform the block for all associations in the collection."
 
-    |key|
+    |key n "{ Class: SmallInteger }"|
 
     tally == 0 ifTrue:[^ self].
-    1 to:(keyArray basicSize) do:[:index |
+    n := keyArray basicSize.
+    1 to:n do:[:index |
         key := keyArray basicAt:index.
-        key notNil ifTrue:[
+        (key notNil and:[key ~~ DeletedEntry]) ifTrue:[
             aBlock value:(Association key:key value:(valueArray basicAt:index))
         ]
     ]
@@ -222,15 +228,15 @@
 do:aBlock
     "perform the block for all values in the collection."
 
-    |index "{ Class:SmallInteger }" |
+    |key n "{ Class: SmallInteger }"|
 
     tally == 0 ifTrue:[^ self].
-    index := 1.
-    keyArray do:[:key |
-        key notNil ifTrue:[
+    n := keyArray basicSize.
+    1 to:n do:[:index |
+        key := keyArray basicAt:index.
+        (key notNil and:[key ~~ DeletedEntry]) ifTrue:[
             aBlock value:(valueArray basicAt:index)
         ].
-        index := index + 1
     ]
 !
 
@@ -238,15 +244,15 @@
     "evaluate the argument, aBlock for every element in the collection,
      passing both key and element as arguments."
 
-    |index "{ Class:SmallInteger }" |
+    |key n "{ Class: SmallInteger }"|
 
     tally == 0 ifTrue:[^ self].
-    index := 1.
-    keyArray do:[:key |
-        key notNil ifTrue:[
+    n := keyArray basicSize.
+    1 to:n do:[:index |
+        key := keyArray basicAt:index.
+        (key notNil and:[key ~~ DeletedEntry]) ifTrue:[
             aTwoArgBlock value:key value:(valueArray basicAt:index)
         ].
-        index := index + 1
     ]
 !
 
@@ -312,7 +318,7 @@
     oldSize := oldKeyArray size.
     1 to:oldSize do:[:index |
         key := oldKeyArray basicAt:index.
-        key notNil ifTrue:[
+        (key notNil and:[key ~~ DeletedEntry]) ifTrue:[
             newIndex := self findNil:key.
             keyArray basicAt:newIndex put:key.
             valueArray basicAt:newIndex put:(oldValueArray basicAt:index).
@@ -336,7 +342,7 @@
 
     1 to:n do:[:index |
         key := oldKeyArray basicAt:index.
-        key notNil ifTrue:[
+        (key notNil and:[key ~~ DeletedEntry]) ifTrue:[
             newIndex := self findNil:key.
             keyArray basicAt:newIndex put:key.
             valueArray basicAt:newIndex put:(oldValueArray basicAt:index).
@@ -354,15 +360,16 @@
     index := startIndex.
     key := keyArray basicAt:index.
     [key notNil] whileTrue:[
-        i := self findNil:key.
-        i == index ifTrue:[
-            ^ self
+        key ~~ DeletedEntry ifTrue:[
+            i := self findNil:key.
+            i == index ifTrue:[
+                ^ self
+            ].
+            keyArray basicAt:i put:key.
+            valueArray basicAt:i put:(valueArray basicAt:index).
+            keyArray basicAt:index put:nil.
+            valueArray basicAt:index put:nil.
         ].
-        keyArray basicAt:i put:key.
-        valueArray basicAt:i put:(valueArray basicAt:index).
-        keyArray basicAt:index put:nil.
-        valueArray basicAt:index put:nil.
-
         index == length ifTrue:[
             index := 1
         ] ifFalse:[
--- a/DirStr.st	Sun Jan 09 22:13:01 1994 +0100
+++ b/DirStr.st	Sun Jan 09 22:16:16 1994 +0100
@@ -22,7 +22,7 @@
 COPYRIGHT (c) 1989 by Claus Gittinger
               All Rights Reserved
 
-$Header: /cvs/stx/stx/libbasic/Attic/DirStr.st,v 1.6 1994-01-08 16:17:01 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Attic/DirStr.st,v 1.7 1994-01-09 21:15:30 claus Exp $
 '!
 
 %{
@@ -148,6 +148,8 @@
 !
 
 reOpen
+    "reOpen the stream after image restart"
+
     dirPointer := nil.
     super reOpen
 ! !
--- a/DirectoryStream.st	Sun Jan 09 22:13:01 1994 +0100
+++ b/DirectoryStream.st	Sun Jan 09 22:16:16 1994 +0100
@@ -22,7 +22,7 @@
 COPYRIGHT (c) 1989 by Claus Gittinger
               All Rights Reserved
 
-$Header: /cvs/stx/stx/libbasic/DirectoryStream.st,v 1.6 1994-01-08 16:17:01 claus Exp $
+$Header: /cvs/stx/stx/libbasic/DirectoryStream.st,v 1.7 1994-01-09 21:15:30 claus Exp $
 '!
 
 %{
@@ -148,6 +148,8 @@
 !
 
 reOpen
+    "reOpen the stream after image restart"
+
     dirPointer := nil.
     super reOpen
 ! !
--- a/ExtStream.st	Sun Jan 09 22:13:01 1994 +0100
+++ b/ExtStream.st	Sun Jan 09 22:16:16 1994 +0100
@@ -22,7 +22,7 @@
 COPYRIGHT (c) 1988 by Claus Gittinger
               All Rights Reserved
 
-$Header: /cvs/stx/stx/libbasic/Attic/ExtStream.st,v 1.10 1994-01-08 16:17:40 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Attic/ExtStream.st,v 1.11 1994-01-09 21:15:45 claus Exp $
 
 written 88 by claus
 '!
@@ -471,7 +471,8 @@
 
 nextByte
     "read the next byte and return it as an Integer; return nil on error.
-     This is allowed in both text and binary modes."
+     This is allowed in both text and binary modes, always returning a 
+     byte binary value."
 
 %{  /* NOCONTEXT */
 
--- a/ExternalStream.st	Sun Jan 09 22:13:01 1994 +0100
+++ b/ExternalStream.st	Sun Jan 09 22:16:16 1994 +0100
@@ -22,7 +22,7 @@
 COPYRIGHT (c) 1988 by Claus Gittinger
               All Rights Reserved
 
-$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.10 1994-01-08 16:17:40 claus Exp $
+$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.11 1994-01-09 21:15:45 claus Exp $
 
 written 88 by claus
 '!
@@ -471,7 +471,8 @@
 
 nextByte
     "read the next byte and return it as an Integer; return nil on error.
-     This is allowed in both text and binary modes."
+     This is allowed in both text and binary modes, always returning a 
+     byte binary value."
 
 %{  /* NOCONTEXT */
 
--- a/False.st	Sun Jan 09 22:13:01 1994 +0100
+++ b/False.st	Sun Jan 09 22:16:16 1994 +0100
@@ -1,6 +1,6 @@
 "
  COPYRIGHT (c) 1988 by Claus Gittinger
-	      All Rights Reserved
+              All Rights Reserved
 
  This software is furnished under a license and may be used
  only in accordance with the terms of that license and with the
@@ -20,11 +20,11 @@
 False comment:'
 
 COPYRIGHT (c) 1988 by Claus Gittinger
-	      All Rights Reserved
+              All Rights Reserved
 
 Class False has only one instance, false, representing logical falsehood.
 
-$Header: /cvs/stx/stx/libbasic/False.st,v 1.4 1993-10-13 02:11:58 claus Exp $
+$Header: /cvs/stx/stx/libbasic/False.st,v 1.5 1994-01-09 21:16:00 claus Exp $
 '!
 
 !False methodsFor:'logical operations'!
@@ -122,5 +122,8 @@
 !False methodsFor: 'binary storage'!
 
 storeBinaryOn: stream manager: manager
+    "store a binary representation of the receiver on stream;
+     redefined, since false is stored with a special type-code"
+
     stream nextPut: manager codeForFalse
 ! !
--- a/Filename.st	Sun Jan 09 22:13:01 1994 +0100
+++ b/Filename.st	Sun Jan 09 22:16:16 1994 +0100
@@ -24,17 +24,25 @@
 Filenames; originally added for ST-80 compatibility, is
 taking over functionality from other classes (FileDirectory).
 
-$Header: /cvs/stx/stx/libbasic/Filename.st,v 1.4 1993-10-13 02:12:08 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Filename.st,v 1.5 1994-01-09 21:16:16 claus Exp $
 '!
 
 !Filename class methodsFor:'instance creation'!
 
 currentDirectory
+    "return a filename for the current directory"
+
     ^ (self basicNew) name:(FileDirectory currentDirectory pathName)
+
+    "Filename currentDirectory"
 !
 
 named:aString
+    "return a filename for a directory named aString"
+
     ^ (self basicNew) name:aString
+
+    "Filename named:'/tmp/fooBar'"
 ! !
 
 !Filename class methodsFor:'queries'!
@@ -43,27 +51,41 @@
     "return the file/directory separator."
 
      ^ OperatingSystem fileSeparator
+
+     "Filename separator"
 ! !
 
 !Filename methodsFor:'instance creation'!
 
 construct:subname
-    ^ (self class basicNew) name:(name , '/' , subname)
+    "taking the receiver as a directory name, construct a new
+     filename for an entry within this directory (i.e. for a file
+     or a subdirectory in that directory)."
+
+    ^ (self class basicNew) name:(name , self class separator asString , subname)
+
+    "('/tmp' asFilename construct:'foo') asString"
 ! !
 
 !Filename methodsFor:'converting'!
 
 asString
+    "return the receiver converted to a string"
+
     ^ name
 !
 
 asFilename
+    "return the receiver converted to a filename"
+
     ^ self
 ! !
 
 !Filename methodsFor:'private accessing'!
 
 name:aString
+    "set the filename"
+
     name := aString
 ! !