*** empty log message ***
authorclaus
Fri, 31 Mar 1995 04:52:25 +0200
changeset 324 290cfb34ec93
parent 323 d84f824d73ef
child 325 46bca6125b93
*** empty log message ***
Fraction.st
ObjMem.st
Object.st
ObjectMemory.st
Set.st
SmallInt.st
SmallInteger.st
Smalltalk.st
--- a/Fraction.st	Fri Mar 31 04:48:54 1995 +0200
+++ b/Fraction.st	Fri Mar 31 04:52:25 1995 +0200
@@ -21,7 +21,7 @@
 COPYRIGHT (c) 1989 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libbasic/Fraction.st,v 1.15 1995-03-08 23:38:25 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Fraction.st,v 1.16 1995-03-31 02:50:03 claus Exp $
 '!
 
 !Fraction class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libbasic/Fraction.st,v 1.15 1995-03-08 23:38:25 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Fraction.st,v 1.16 1995-03-31 02:50:03 claus Exp $
 "
 !
 
@@ -50,9 +50,8 @@
 "
     Instances of Fraction represent fractional numbers consisting of
     a numerator and denominator. Both are themselfes arbitrary precision
-    integers. Fractions are usually created by dividing Integers using //
-    (for exact division).
-"
+    integers. Fractions are usually created by dividing Integers using /
+    (for exact division)."
 ! !
 
 !Fraction class methodsFor:'initialization'!
@@ -427,6 +426,13 @@
 		denominator:denominator) reduced
 !
 
+quotientFromInteger:anInteger
+    "sent when an integer does not know how to divide by the receiver, a fraction"
+
+    ^ (self class numerator:numerator
+		denominator:(anInteger * denominator)) reduced
+!
+
 lessFromInteger:anInteger
     "sent when an integer does not know how to compare to the receiver, a fraction"
 
--- a/ObjMem.st	Fri Mar 31 04:48:54 1995 +0200
+++ b/ObjMem.st	Fri Mar 31 04:52:25 1995 +0200
@@ -33,7 +33,7 @@
 COPYRIGHT (c) 1992 by Claus Gittinger
 	     All Rights Reserved
 
-$Header: /cvs/stx/stx/libbasic/Attic/ObjMem.st,v 1.33 1995-03-20 03:12:14 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Attic/ObjMem.st,v 1.34 1995-03-31 02:50:38 claus Exp $
 '!
 
 !ObjectMemory class methodsFor:'documentation'!
@@ -54,7 +54,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libbasic/Attic/ObjMem.st,v 1.33 1995-03-20 03:12:14 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Attic/ObjMem.st,v 1.34 1995-03-31 02:50:38 claus Exp $
 "
 !
 
@@ -1172,6 +1172,18 @@
     ObjectMemory tenuringScavenge.
     (ObjectMemory spaceOf:p) printNL.
     "
+!
+
+maximumIdentityHashValue
+    "for ST-80 compatibility: return the maximum value
+     a hashKey as returned by identityHash can get.
+     Since ST/X uses direct pointers, a field in the objectHeader
+     is used, which is currently 12 bits in size."
+
+    "/ BOGUS: here we should have define of stc.h somehow
+    "/ to have that knowledge at one place only ...
+
+     ^ 4095
 ! !
 
 !ObjectMemory class methodsFor:'garbage collection'!
--- a/Object.st	Fri Mar 31 04:48:54 1995 +0200
+++ b/Object.st	Fri Mar 31 04:52:25 1995 +0200
@@ -29,7 +29,7 @@
 COPYRIGHT (c) 1988 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libbasic/Object.st,v 1.39 1995-03-25 01:23:16 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Object.st,v 1.40 1995-03-31 02:51:26 claus Exp $
 '!
 
 !Object class methodsFor:'documentation'!
@@ -50,7 +50,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libbasic/Object.st,v 1.39 1995-03-25 01:23:16 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Object.st,v 1.40 1995-03-31 02:51:26 claus Exp $
 "
 !
 
@@ -1641,7 +1641,7 @@
      You can of course redefine #doesNotUnderstand: in your classes
      to implement message delegation."
 
-    |sel errorString|
+    |sel errorString cls|
 
     aMessage selector isNil ifTrue:[
 	"happens when things go mad, or a method has been
@@ -1654,12 +1654,12 @@
 
     "the new errorString gives more information ..."
 "/    errorString := 'Message not understood: ' , sel.
-    thisContext sender searchClass notNil ifTrue:[
-	"it was a super or directed send ..."
-	errorString := thisContext sender searchClass name , ' does not understand: ' , sel.
-    ] ifFalse:[
-	errorString := self class name , ' does not understand: ' , sel.
+    cls := thisContext sender searchClass.
+    cls isNil ifTrue:[
+	"it was NOT a super or directed send ..."
+	cls := self class
     ].
+    errorString := cls name , ' does not understand: ' , sel.
 
     "
      this only happens, when YOU play around with my classvars ...
@@ -1877,6 +1877,14 @@
     ^ Inspector
 ! !
 
+!Object methodsFor:'converting'!
+
+asValue
+    "return a valueHolder for for the receiver"
+
+    ^ ValueHolder with:self
+! !
+
 !Object methodsFor:'accessing'!
 
 at:index
@@ -3045,11 +3053,12 @@
 readBinaryContentsFrom:stream manager:manager
     "reconstruct the receivers instance variables by reading a binary
      binary representation from stream.
-     This is a general implementation walking over instances loading
-     each recursively using manager.
+     This is a general implementation, walking over instances 
+     and loading each recursively using manager.
      Notice, that the bit-instances (bytes, words etc.) have already been
      read by the class.
-     Can be redefined in subclasses (see String, SmallInteger etc)."
+     Can be redefined in subclasses to read more compact representations
+     (see String, SmallInteger etc)."
 
     |size "{ Class: SmallInteger }"|
 
@@ -3071,7 +3080,8 @@
     "append a binary representation of the receiver onto stream.
      This method first stores the class, then the body, which is done
      in a separate method to allow redefinition of the bodies format.
-     Can be redefined in subclasses (see String, SmallInteger etc)."
+     Can be redefined in subclasses to write more compact representations
+     (see String, SmallInteger etc)."
 
     manager putIdOf:(self class) on:stream.
     self storeBinaryDefinitionBodyOn:stream manager:manager
--- a/ObjectMemory.st	Fri Mar 31 04:48:54 1995 +0200
+++ b/ObjectMemory.st	Fri Mar 31 04:52:25 1995 +0200
@@ -33,7 +33,7 @@
 COPYRIGHT (c) 1992 by Claus Gittinger
 	     All Rights Reserved
 
-$Header: /cvs/stx/stx/libbasic/ObjectMemory.st,v 1.33 1995-03-20 03:12:14 claus Exp $
+$Header: /cvs/stx/stx/libbasic/ObjectMemory.st,v 1.34 1995-03-31 02:50:38 claus Exp $
 '!
 
 !ObjectMemory class methodsFor:'documentation'!
@@ -54,7 +54,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libbasic/ObjectMemory.st,v 1.33 1995-03-20 03:12:14 claus Exp $
+$Header: /cvs/stx/stx/libbasic/ObjectMemory.st,v 1.34 1995-03-31 02:50:38 claus Exp $
 "
 !
 
@@ -1172,6 +1172,18 @@
     ObjectMemory tenuringScavenge.
     (ObjectMemory spaceOf:p) printNL.
     "
+!
+
+maximumIdentityHashValue
+    "for ST-80 compatibility: return the maximum value
+     a hashKey as returned by identityHash can get.
+     Since ST/X uses direct pointers, a field in the objectHeader
+     is used, which is currently 12 bits in size."
+
+    "/ BOGUS: here we should have define of stc.h somehow
+    "/ to have that knowledge at one place only ...
+
+     ^ 4095
 ! !
 
 !ObjectMemory class methodsFor:'garbage collection'!
--- a/Set.st	Fri Mar 31 04:48:54 1995 +0200
+++ b/Set.st	Fri Mar 31 04:52:25 1995 +0200
@@ -21,7 +21,7 @@
 COPYRIGHT (c) 1991 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libbasic/Set.st,v 1.15 1995-03-08 23:39:52 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Set.st,v 1.16 1995-03-31 02:52:10 claus Exp $
 '!
 
 !Set class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libbasic/Set.st,v 1.15 1995-03-08 23:39:52 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Set.st,v 1.16 1995-03-31 02:52:10 claus Exp $
 "
 !
 
@@ -151,11 +151,13 @@
 
 fullCheck
     "check if collection is full (after an add); grow if so.
-     Definition of full is currently:'filled more than 75%'"
+     Definition of 'full' is currently: 'filled more than 75%'"
 
     |sz "{Class: SmallInteger}" |
 
-    "grow if filled more than 75% "
+    "
+     grow if filled more than 75% 
+    "
     sz := keyArray basicSize.
     tally > (sz * 3 // 4) ifTrue:[
        self grow
@@ -164,13 +166,17 @@
 
 emptyCheck
     "check if the receiver has become too empty (after a remove)
-     - shrink if filled less than 12.5%"
+     and shrink if it makes sense.
+     Definition of 'too empty' is 'filled less than 12.5% (i.e. 1/8th)'"
 
     |sz      "{Class: SmallInteger}"
      newSize "{Class: SmallInteger}" |
 
     sz := keyArray basicSize.
     sz > 30 ifTrue:[
+	"
+	 shrink if too empty
+	"
 	tally < (sz // 8) ifTrue:[
 	    newSize := sz // 7.
 	    self grow:newSize
@@ -178,6 +184,15 @@
     ]
 !
 
+initialIndexFor:hashKey boundedBy:length
+    "for ST-80 compatibility only; it is (currently) not used in this
+     implementation of sets. Therefore, in ST/X it does not make sense
+     to redefine it. (which may be a bad design decision, but slightly
+     improves performance, by avoiding an extra message send ...)"
+
+    ^ hashKey \\ length + 1.
+!
+
 setTally:count
     "initialize the contents array (for at least count slots) 
      and set tally to zero.
--- a/SmallInt.st	Fri Mar 31 04:48:54 1995 +0200
+++ b/SmallInt.st	Fri Mar 31 04:52:25 1995 +0200
@@ -21,7 +21,7 @@
 COPYRIGHT (c) 1988 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libbasic/Attic/SmallInt.st,v 1.25 1995-03-25 01:24:01 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Attic/SmallInt.st,v 1.26 1995-03-31 02:52:18 claus Exp $
 '!
 
 !SmallInteger class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libbasic/Attic/SmallInt.st,v 1.25 1995-03-25 01:24:01 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Attic/SmallInt.st,v 1.26 1995-03-31 02:52:18 claus Exp $
 "
 !
 
@@ -791,7 +791,7 @@
 %}
 .
     aNumber isInteger ifTrue:[
-	aNumber = 0 ifTrue:[
+	aNumber == 0 ifTrue:[
 	    ^ DivisionByZeroSignal raise.
 	].
 	^ Fraction numerator:self denominator:aNumber
@@ -875,8 +875,7 @@
     if (val != _MIN_INT) {
 	RETURN ( _MKSMALLINT(-val) );
     }
-%}
-.
+%}.
     "only reached for minVal"
     ^ self negated
 !
@@ -892,8 +891,8 @@
     if (val != _MIN_INT) {
 	RETURN ( _MKSMALLINT(- val) );
     }
-%}
-.
+%}.
+    "only reached for minVal"
     ^ (LargeInteger value:(SmallInteger maxVal)) + 1
 ! !
 
@@ -1703,10 +1702,10 @@
 #ifdef THISCONTEXT_IN_REGISTER
 	__thisContext = sav;
 #endif
-        newString = _MKSTRING(buffer COMMA_SND);
-        if (newString != nil) {
+	newString = _MKSTRING(buffer COMMA_SND);
+	if (newString != nil) {
 	    RETURN (newString);
-        }
+	}
     }
 %}.
     "
--- a/SmallInteger.st	Fri Mar 31 04:48:54 1995 +0200
+++ b/SmallInteger.st	Fri Mar 31 04:52:25 1995 +0200
@@ -21,7 +21,7 @@
 COPYRIGHT (c) 1988 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libbasic/SmallInteger.st,v 1.25 1995-03-25 01:24:01 claus Exp $
+$Header: /cvs/stx/stx/libbasic/SmallInteger.st,v 1.26 1995-03-31 02:52:18 claus Exp $
 '!
 
 !SmallInteger class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libbasic/SmallInteger.st,v 1.25 1995-03-25 01:24:01 claus Exp $
+$Header: /cvs/stx/stx/libbasic/SmallInteger.st,v 1.26 1995-03-31 02:52:18 claus Exp $
 "
 !
 
@@ -791,7 +791,7 @@
 %}
 .
     aNumber isInteger ifTrue:[
-	aNumber = 0 ifTrue:[
+	aNumber == 0 ifTrue:[
 	    ^ DivisionByZeroSignal raise.
 	].
 	^ Fraction numerator:self denominator:aNumber
@@ -875,8 +875,7 @@
     if (val != _MIN_INT) {
 	RETURN ( _MKSMALLINT(-val) );
     }
-%}
-.
+%}.
     "only reached for minVal"
     ^ self negated
 !
@@ -892,8 +891,8 @@
     if (val != _MIN_INT) {
 	RETURN ( _MKSMALLINT(- val) );
     }
-%}
-.
+%}.
+    "only reached for minVal"
     ^ (LargeInteger value:(SmallInteger maxVal)) + 1
 ! !
 
@@ -1703,10 +1702,10 @@
 #ifdef THISCONTEXT_IN_REGISTER
 	__thisContext = sav;
 #endif
-        newString = _MKSTRING(buffer COMMA_SND);
-        if (newString != nil) {
+	newString = _MKSTRING(buffer COMMA_SND);
+	if (newString != nil) {
 	    RETURN (newString);
-        }
+	}
     }
 %}.
     "
--- a/Smalltalk.st	Fri Mar 31 04:48:54 1995 +0200
+++ b/Smalltalk.st	Fri Mar 31 04:52:25 1995 +0200
@@ -26,7 +26,7 @@
 COPYRIGHT (c) 1988 by Claus Gittinger
 	     All Rights Reserved
 
-$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.40 1995-03-26 15:04:30 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.41 1995-03-31 02:52:25 claus Exp $
 '!
 
 "
@@ -55,7 +55,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.40 1995-03-26 15:04:30 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.41 1995-03-31 02:52:25 claus Exp $
 "
 !
 
@@ -992,15 +992,20 @@
 
 do:aBlock
     "evaluate the argument, aBlock for all values in the Smalltalk dictionary"
-%{
-    _GLOBALS_DO(&aBlock COMMA_CON);
+
+    |work|
+
+%{  /* NOREGISTER - work may not be placed into a register here */
+    _GLOBALS_DO(&aBlock, &work COMMA_CON);
 %}
 !
 
 keysDo:aBlock
     "evaluate the argument, aBlock for all keys in the Smalltalk dictionary"
-%{
-    _GLOBALKEYS_DO(&aBlock COMMA_CON);
+    |work|
+
+%{  /* NOREGISTER - work may not be placed into a register here */
+    _GLOBALKEYS_DO(&aBlock, &work COMMA_CON);
 %}
 !