--- a/Dict.st Thu Feb 02 13:23:05 1995 +0100
+++ b/Dict.st Thu Feb 02 13:25:49 1995 +0100
@@ -21,7 +21,7 @@
COPYRIGHT (c) 1991 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libbasic/Attic/Dict.st,v 1.14 1994-10-10 00:22:42 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Attic/Dict.st,v 1.15 1995-02-02 12:25:19 claus Exp $
'!
!Dictionary class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
version
"
-$Header: /cvs/stx/stx/libbasic/Attic/Dict.st,v 1.14 1994-10-10 00:22:42 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Attic/Dict.st,v 1.15 1995-02-02 12:25:19 claus Exp $
"
!
@@ -361,7 +361,7 @@
valueArray := valueArray shallowCopy
! !
-!Dictionary methodsFor:'enumeration'!
+!Dictionary methodsFor:'enumerating'!
allKeysDo:aBlock
"perform the block for all keys in the collection."
--- a/Dictionary.st Thu Feb 02 13:23:05 1995 +0100
+++ b/Dictionary.st Thu Feb 02 13:25:49 1995 +0100
@@ -21,7 +21,7 @@
COPYRIGHT (c) 1991 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libbasic/Dictionary.st,v 1.14 1994-10-10 00:22:42 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Dictionary.st,v 1.15 1995-02-02 12:25:19 claus Exp $
'!
!Dictionary class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
version
"
-$Header: /cvs/stx/stx/libbasic/Dictionary.st,v 1.14 1994-10-10 00:22:42 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Dictionary.st,v 1.15 1995-02-02 12:25:19 claus Exp $
"
!
@@ -361,7 +361,7 @@
valueArray := valueArray shallowCopy
! !
-!Dictionary methodsFor:'enumeration'!
+!Dictionary methodsFor:'enumerating'!
allKeysDo:aBlock
"perform the block for all keys in the collection."
--- a/DirStr.st Thu Feb 02 13:23:05 1995 +0100
+++ b/DirStr.st Thu Feb 02 13:25:49 1995 +0100
@@ -21,7 +21,7 @@
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libbasic/Attic/DirStr.st,v 1.14 1994-11-21 16:38:59 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Attic/DirStr.st,v 1.15 1995-02-02 12:25:21 claus Exp $
'!
!DirectoryStream class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
version
"
-$Header: /cvs/stx/stx/libbasic/Attic/DirStr.st,v 1.14 1994-11-21 16:38:59 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Attic/DirStr.st,v 1.15 1995-02-02 12:25:21 claus Exp $
"
!
@@ -54,7 +54,7 @@
"
! !
-!DirectoryStream class primitiveDefinitions!
+!DirectoryStream primitiveDefinitions!
%{
#include <stdio.h>
--- a/DirectoryStream.st Thu Feb 02 13:23:05 1995 +0100
+++ b/DirectoryStream.st Thu Feb 02 13:25:49 1995 +0100
@@ -21,7 +21,7 @@
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libbasic/DirectoryStream.st,v 1.14 1994-11-21 16:38:59 claus Exp $
+$Header: /cvs/stx/stx/libbasic/DirectoryStream.st,v 1.15 1995-02-02 12:25:21 claus Exp $
'!
!DirectoryStream class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
version
"
-$Header: /cvs/stx/stx/libbasic/DirectoryStream.st,v 1.14 1994-11-21 16:38:59 claus Exp $
+$Header: /cvs/stx/stx/libbasic/DirectoryStream.st,v 1.15 1995-02-02 12:25:21 claus Exp $
"
!
@@ -54,7 +54,7 @@
"
! !
-!DirectoryStream class primitiveDefinitions!
+!DirectoryStream primitiveDefinitions!
%{
#include <stdio.h>
--- a/Exception.st Thu Feb 02 13:23:05 1995 +0100
+++ b/Exception.st Thu Feb 02 13:25:49 1995 +0100
@@ -24,7 +24,7 @@
COPYRIGHT (c) 1993 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libbasic/Exception.st,v 1.14 1994-11-28 20:32:42 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Exception.st,v 1.15 1995-02-02 12:25:24 claus Exp $
'!
!Exception class methodsFor:'documentation'!
@@ -45,7 +45,7 @@
version
"
-$Header: /cvs/stx/stx/libbasic/Exception.st,v 1.14 1994-11-28 20:32:42 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Exception.st,v 1.15 1995-02-02 12:25:24 claus Exp $
"
!
@@ -223,13 +223,13 @@
suspendedContext := sContext.
! !
-!Exception methodsFor:'raising '!
+!Exception methodsFor:'raising'!
raise
"actually raise an exception"
resumeBlock := [:value | ^ value].
- self evaluateHandler
+ ^ self evaluateHandler
!
evaluateHandler
@@ -238,7 +238,10 @@
the raising signal.
If found, take the contexts 2nd argument (the handler) and evaluate
it with the receiver exception as argument.
- If none found, just return."
+ If no handler is found, try per signal handler, or
+ per process handler (if its the noHandlerSignal).
+ Finally fall back to Exceptions emergencyHandler, which is always
+ available and enters the debugger."
|con block noHandlerSignal|
--- a/OrdColl.st Thu Feb 02 13:23:05 1995 +0100
+++ b/OrdColl.st Thu Feb 02 13:25:49 1995 +0100
@@ -21,7 +21,7 @@
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libbasic/Attic/OrdColl.st,v 1.17 1994-11-17 14:17:52 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Attic/OrdColl.st,v 1.18 1995-02-02 12:25:26 claus Exp $
'!
!OrderedCollection class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
version
"
-$Header: /cvs/stx/stx/libbasic/Attic/OrdColl.st,v 1.17 1994-11-17 14:17:52 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Attic/OrdColl.st,v 1.18 1995-02-02 12:25:26 claus Exp $
"
!
@@ -339,6 +339,29 @@
c := #(4 3 2 1) asOrderedCollection.
c add:'here' beforeIndex:3
"
+ "
+ |c|
+ c := #(4 3 2 1) asOrderedCollection.
+ c add:'here' beforeIndex:1
+ "
+ "
+ |c|
+ c := #(4 3 2 1) asOrderedCollection.
+ c add:'here' beforeIndex:5
+ "
+!
+
+add:anObject afterIndex:index
+ "insert the argument, anObject to become located at index.
+ Return the argument, anObject."
+
+ ^ self add:anObject beforeIndex:(index + 1)
+
+ "
+ |c|
+ c := #(4 3 2 1) asOrderedCollection.
+ c add:'here' afterIndex:4
+ "
!
add:newObject after:oldObject
@@ -357,7 +380,16 @@
"
|c|
c := #(4 3 2 1) asOrderedCollection.
- c add:'here' after:3.
+ c add:'here' after:3.
+ "
+ "
+ |c|
+ c := #(4 3 2 1) asOrderedCollection.
+ c add:'here' after:1.
+ "
+ "
+ |c|
+ c := #(4 3 2 1) asOrderedCollection.
c add:'here' after:5
"
!
@@ -764,7 +796,7 @@
^ super asOrderedCollection
! !
-!OrderedCollection methodsFor:'enumeration'!
+!OrderedCollection methodsFor:'enumerating'!
do:aBlock
"evaluate the argument, aBlock for every element in the collection."
--- a/OrderedCollection.st Thu Feb 02 13:23:05 1995 +0100
+++ b/OrderedCollection.st Thu Feb 02 13:25:49 1995 +0100
@@ -21,7 +21,7 @@
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libbasic/OrderedCollection.st,v 1.17 1994-11-17 14:17:52 claus Exp $
+$Header: /cvs/stx/stx/libbasic/OrderedCollection.st,v 1.18 1995-02-02 12:25:26 claus Exp $
'!
!OrderedCollection class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
version
"
-$Header: /cvs/stx/stx/libbasic/OrderedCollection.st,v 1.17 1994-11-17 14:17:52 claus Exp $
+$Header: /cvs/stx/stx/libbasic/OrderedCollection.st,v 1.18 1995-02-02 12:25:26 claus Exp $
"
!
@@ -339,6 +339,29 @@
c := #(4 3 2 1) asOrderedCollection.
c add:'here' beforeIndex:3
"
+ "
+ |c|
+ c := #(4 3 2 1) asOrderedCollection.
+ c add:'here' beforeIndex:1
+ "
+ "
+ |c|
+ c := #(4 3 2 1) asOrderedCollection.
+ c add:'here' beforeIndex:5
+ "
+!
+
+add:anObject afterIndex:index
+ "insert the argument, anObject to become located at index.
+ Return the argument, anObject."
+
+ ^ self add:anObject beforeIndex:(index + 1)
+
+ "
+ |c|
+ c := #(4 3 2 1) asOrderedCollection.
+ c add:'here' afterIndex:4
+ "
!
add:newObject after:oldObject
@@ -357,7 +380,16 @@
"
|c|
c := #(4 3 2 1) asOrderedCollection.
- c add:'here' after:3.
+ c add:'here' after:3.
+ "
+ "
+ |c|
+ c := #(4 3 2 1) asOrderedCollection.
+ c add:'here' after:1.
+ "
+ "
+ |c|
+ c := #(4 3 2 1) asOrderedCollection.
c add:'here' after:5
"
!
@@ -764,7 +796,7 @@
^ super asOrderedCollection
! !
-!OrderedCollection methodsFor:'enumeration'!
+!OrderedCollection methodsFor:'enumerating'!
do:aBlock
"evaluate the argument, aBlock for every element in the collection."
--- a/PipeStr.st Thu Feb 02 13:23:05 1995 +0100
+++ b/PipeStr.st Thu Feb 02 13:25:49 1995 +0100
@@ -21,7 +21,7 @@
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libbasic/Attic/PipeStr.st,v 1.15 1994-10-28 01:27:58 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Attic/PipeStr.st,v 1.16 1995-02-02 12:25:28 claus Exp $
'!
!PipeStream class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
version
"
-$Header: /cvs/stx/stx/libbasic/Attic/PipeStr.st,v 1.15 1994-10-28 01:27:58 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Attic/PipeStr.st,v 1.16 1995-02-02 12:25:28 claus Exp $
"
!
@@ -81,7 +81,7 @@
"
! !
-!PipeStream class primitiveDefinitions!
+!PipeStream primitiveDefinitions!
%{
#include <stdio.h>
--- a/PipeStream.st Thu Feb 02 13:23:05 1995 +0100
+++ b/PipeStream.st Thu Feb 02 13:25:49 1995 +0100
@@ -21,7 +21,7 @@
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libbasic/PipeStream.st,v 1.15 1994-10-28 01:27:58 claus Exp $
+$Header: /cvs/stx/stx/libbasic/PipeStream.st,v 1.16 1995-02-02 12:25:28 claus Exp $
'!
!PipeStream class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
version
"
-$Header: /cvs/stx/stx/libbasic/PipeStream.st,v 1.15 1994-10-28 01:27:58 claus Exp $
+$Header: /cvs/stx/stx/libbasic/PipeStream.st,v 1.16 1995-02-02 12:25:28 claus Exp $
"
!
@@ -81,7 +81,7 @@
"
! !
-!PipeStream class primitiveDefinitions!
+!PipeStream primitiveDefinitions!
%{
#include <stdio.h>
--- a/Point.st Thu Feb 02 13:23:05 1995 +0100
+++ b/Point.st Thu Feb 02 13:25:49 1995 +0100
@@ -21,7 +21,7 @@
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libbasic/Point.st,v 1.14 1994-11-28 20:33:21 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Point.st,v 1.15 1995-02-02 12:25:30 claus Exp $
'!
!Point class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
version
"
-$Header: /cvs/stx/stx/libbasic/Point.st,v 1.14 1994-11-28 20:33:21 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Point.st,v 1.15 1995-02-02 12:25:30 claus Exp $
"
!
@@ -186,7 +186,13 @@
hash
"return a number for hashing"
+ x = y ifTrue:[^ x hash].
+"
+ used to be:
^ (x hash) bitXor:(y hash)
+ the following handles 1@x vs. x@1 better:
+"
+ ^ (x hash) bitXor:(y hash bitShift:12)
!
< aPoint
@@ -220,14 +226,14 @@
|p|
(aPoint isMemberOf:Point) ifTrue:[ "this is a hint to STC"
- x ~~ (aPoint x) ifTrue:[^ false].
- y ~~ (aPoint y) ifTrue:[^ false].
+ x ~= (aPoint x) ifTrue:[^ false].
+ y ~= (aPoint y) ifTrue:[^ false].
^ true
].
aPoint respondsToArithmetic ifFalse:[ ^ false].
p := aPoint asPoint.
- x ~~ (p x) ifTrue:[^ false].
- y ~~ (p y) ifTrue:[^ false].
+ x ~= (p x) ifTrue:[^ false].
+ y ~= (p y) ifTrue:[^ false].
^ true
!
@@ -504,9 +510,43 @@
!
r
- "return the receiver's radius in polar coordinate system."
+ "return the receiver's radius in a polar coordinate system.
+ (i.e. the length of a vector from 0@0 to the receiver)"
^ (self dotProduct:self) sqrt
+
+ "
+ (1@1) r
+ (2@1) r
+ (2@0) r
+ "
+!
+
+angle
+ "return the receiver's angle in a polar coordinate system.
+ (i.e. the angle of a vector from 0@0 to the receiver)"
+
+ y < 0 ifTrue:[
+ x < 0 ifTrue:[
+ ^ 270 degreesToRadians - (y / x) arcTan
+ ].
+ x = 0 ifTrue:[
+ ^ 180
+ ].
+ ^ 360 degreesToRadians - (y abs / x) arcTan
+ ].
+ x < 0 ifTrue:[
+ ^ 180 degreesToRadians - (y / x abs) arcTan
+ ].
+ x = 0 ifTrue:[
+ ^ 0
+ ].
+ ^ (y / x) arcTan
+
+ "
+ (1@1) angle radiansToDegrees
+ (2@1) angle radiansToDegrees
+ "
!
abs
@@ -577,6 +617,20 @@
(10 @ 10) quadrantContaining:(5 @ 15)
(10 @ 10) quadrantContaining:(15 @ 5)
"
+!
+
+quadrant
+ "return the number of the quadrant containing the receiver.
+ quadrants are named as follows:
+
+ ^ 2 | 3
+ Y ------
+ 1 | 0
+
+ X >
+ "
+
+ ^ 0@0 quadrantContaining:self
! !
!Point methodsFor:'printing & storing'!
--- a/PosStream.st Thu Feb 02 13:23:05 1995 +0100
+++ b/PosStream.st Thu Feb 02 13:25:49 1995 +0100
@@ -21,7 +21,7 @@
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libbasic/Attic/PosStream.st,v 1.17 1994-10-28 01:28:03 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Attic/PosStream.st,v 1.18 1995-02-02 12:25:33 claus Exp $
'!
!PositionableStream class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
version
"
-$Header: /cvs/stx/stx/libbasic/Attic/PosStream.st,v 1.17 1994-10-28 01:28:03 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Attic/PosStream.st,v 1.18 1995-02-02 12:25:33 claus Exp $
"
!
@@ -223,7 +223,13 @@
nextChunk
"return the next chunk, i.e. all characters up to the next
- non-doubled exclamation mark; undouble doubled exclamation marks"
+ exclamation mark. Within the chunk, exclamation marks have to be doubled,
+ they are undoubled here.
+ Except for primitive code, in which doubling is not needed (allowed).
+ This exception was added to make it easier to edit primitive code with
+ external editors. However, this means, that other Smalltalks cannot always
+ read chunks containing primitive code
+ - but that doesnt really matter, since C-primitives are an ST/X feature anyway."
|theString sep newString done thisChar nextChar inPrimitive
index "{ Class:SmallInteger }"
@@ -287,32 +293,40 @@
nextChunkPut:aString
"put aString as a chunk onto the receiver;
- double all exclamation marks and append an exclamation mark"
+ double all exclamation marks except within primitives and append a
+ single delimiting exclamation mark at the end."
|sep gotPercent inPrimitive character
index "{ Class:SmallInteger }"
endIndex "{ Class:SmallInteger }"
- next "{ Class:SmallInteger }" |
+ stop "{ Class:SmallInteger }"
+ next "{ Class:SmallInteger }"
+ i "{ Class:SmallInteger }" |
sep := self class chunkSeparator.
inPrimitive := false.
gotPercent := false.
index := 1.
endIndex := aString size.
+ stop := endIndex + 1.
[index <= endIndex] whileTrue:[
- next := aString indexOf:$% startingAt:index ifAbsent:[endIndex + 1].
- next := next min:
- (aString indexOf:${ startingAt:index ifAbsent:[endIndex + 1]).
+ "
+ find position of next interresting character;
+ output stuff up to that one in one piece
+ "
+ next := aString indexOf:$% startingAt:index ifAbsent:stop.
next := next min:
- (aString indexOf:$} startingAt:index ifAbsent:[endIndex + 1]).
+ (aString indexOf:${ startingAt:index ifAbsent:stop).
+ next := next min:
+ (aString indexOf:$} startingAt:index ifAbsent:stop).
next := next min:
- (aString indexOf:sep startingAt:index ifAbsent:[endIndex + 1]).
+ (aString indexOf:sep startingAt:index ifAbsent:stop).
- ((index == 1) and:[next == (endIndex + 1)]) ifTrue:[
+ ((index == 1) and:[next == stop]) ifTrue:[
self nextPutAll:aString
] ifFalse:[
- self nextPutAll:(aString copyFrom:index to:(next - 1))
+ self nextPutAll:aString startingAt:index to:(next - 1)
].
index := next.
--- a/PositionableStream.st Thu Feb 02 13:23:05 1995 +0100
+++ b/PositionableStream.st Thu Feb 02 13:25:49 1995 +0100
@@ -21,7 +21,7 @@
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libbasic/PositionableStream.st,v 1.17 1994-10-28 01:28:03 claus Exp $
+$Header: /cvs/stx/stx/libbasic/PositionableStream.st,v 1.18 1995-02-02 12:25:33 claus Exp $
'!
!PositionableStream class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
version
"
-$Header: /cvs/stx/stx/libbasic/PositionableStream.st,v 1.17 1994-10-28 01:28:03 claus Exp $
+$Header: /cvs/stx/stx/libbasic/PositionableStream.st,v 1.18 1995-02-02 12:25:33 claus Exp $
"
!
@@ -223,7 +223,13 @@
nextChunk
"return the next chunk, i.e. all characters up to the next
- non-doubled exclamation mark; undouble doubled exclamation marks"
+ exclamation mark. Within the chunk, exclamation marks have to be doubled,
+ they are undoubled here.
+ Except for primitive code, in which doubling is not needed (allowed).
+ This exception was added to make it easier to edit primitive code with
+ external editors. However, this means, that other Smalltalks cannot always
+ read chunks containing primitive code
+ - but that doesnt really matter, since C-primitives are an ST/X feature anyway."
|theString sep newString done thisChar nextChar inPrimitive
index "{ Class:SmallInteger }"
@@ -287,32 +293,40 @@
nextChunkPut:aString
"put aString as a chunk onto the receiver;
- double all exclamation marks and append an exclamation mark"
+ double all exclamation marks except within primitives and append a
+ single delimiting exclamation mark at the end."
|sep gotPercent inPrimitive character
index "{ Class:SmallInteger }"
endIndex "{ Class:SmallInteger }"
- next "{ Class:SmallInteger }" |
+ stop "{ Class:SmallInteger }"
+ next "{ Class:SmallInteger }"
+ i "{ Class:SmallInteger }" |
sep := self class chunkSeparator.
inPrimitive := false.
gotPercent := false.
index := 1.
endIndex := aString size.
+ stop := endIndex + 1.
[index <= endIndex] whileTrue:[
- next := aString indexOf:$% startingAt:index ifAbsent:[endIndex + 1].
- next := next min:
- (aString indexOf:${ startingAt:index ifAbsent:[endIndex + 1]).
+ "
+ find position of next interresting character;
+ output stuff up to that one in one piece
+ "
+ next := aString indexOf:$% startingAt:index ifAbsent:stop.
next := next min:
- (aString indexOf:$} startingAt:index ifAbsent:[endIndex + 1]).
+ (aString indexOf:${ startingAt:index ifAbsent:stop).
+ next := next min:
+ (aString indexOf:$} startingAt:index ifAbsent:stop).
next := next min:
- (aString indexOf:sep startingAt:index ifAbsent:[endIndex + 1]).
+ (aString indexOf:sep startingAt:index ifAbsent:stop).
- ((index == 1) and:[next == (endIndex + 1)]) ifTrue:[
+ ((index == 1) and:[next == stop]) ifTrue:[
self nextPutAll:aString
] ifFalse:[
- self nextPutAll:(aString copyFrom:index to:(next - 1))
+ self nextPutAll:aString startingAt:index to:(next - 1)
].
index := next.
--- a/ProcSched.st Thu Feb 02 13:23:05 1995 +0100
+++ b/ProcSched.st Thu Feb 02 13:25:49 1995 +0100
@@ -32,7 +32,7 @@
COPYRIGHT (c) 1993 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libbasic/Attic/ProcSched.st,v 1.25 1994-11-28 20:33:22 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Attic/ProcSched.st,v 1.26 1995-02-02 12:25:35 claus Exp $
'!
Smalltalk at:#Processor put:nil!
@@ -55,7 +55,7 @@
version
"
-$Header: /cvs/stx/stx/libbasic/Attic/ProcSched.st,v 1.25 1994-11-28 20:33:22 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Attic/ProcSched.st,v 1.26 1995-02-02 12:25:35 claus Exp $
"
!
@@ -299,8 +299,10 @@
aProcess state:#active.
oldProcess setStateTo:#run if:#active.
- "no interrupts now - activeProcess has already been changed
- (dont add any message sends here)"
+ "
+ no interrupts now - activeProcess has already been changed
+ (dont add any message sends here)
+ "
activeProcess := aProcess.
currentPriority := pri.
%{
@@ -311,23 +313,18 @@
else
ok = __threadSwitch(__context, _intVal(id));
%}.
- "time passes ...
+ "time passes spent in some other process ...
... here again"
- p := activeProcess.
- activeProcess := oldProcess.
- currentPriority := oldPri.
+ p := activeProcess.
+ activeProcess := oldProcess.
+ currentPriority := oldPri.
ok ifFalse:[
"
switch failed for some reason -
destroy the bad process
"
-"
- p := activeProcess.
- activeProcess := oldProcess.
- currentPriority := oldPri.
-"
p id ~~ 0 ifTrue:[
'problem with process ' errorPrint. p id errorPrint. ' terminate it.' errorPrintNL.
p state:#suspended.
@@ -342,7 +339,7 @@
!
scheduleForInterrupt:aProcess
- "make aProcess evaluate its pushedInterrupt block(s)"
+ "make aProcess evaluate its pushed interrupt block(s)"
|id|
@@ -644,7 +641,7 @@
].
aProcess == scheduler ifTrue:[
'scheduler should never be suspended' printNL.
- "/ MiniDebugger enterWithMessage:'scheduler should never be suspended'.
+ MiniDebugger enterWithMessage:'scheduler should never be suspended'.
^ self
].
@@ -993,6 +990,24 @@
]
].
^ nil
+!
+
+activeProcessIsSystemProcess
+ "return true if the active process is a system process,
+ which should not be suspended."
+
+ |active|
+
+ (self class isPureEventDriven
+ or:[(active := self activeProcess) id == 0
+ or:[active nameOrId endsWith:'dispatcher']]) ifTrue:[
+ ^ true
+ ].
+ ^ false
+
+ "
+ Processor activeProcessIsSystemProcess
+ "
! !
!ProcessorScheduler methodsFor:'dispatching'!
--- a/Process.st Thu Feb 02 13:23:05 1995 +0100
+++ b/Process.st Thu Feb 02 13:25:49 1995 +0100
@@ -13,8 +13,8 @@
Link subclass:#Process
instanceVariableNames:'id prio state startBlock name
restartable interruptActions
- exitAction singleStepping
- emergencySignalHandler'
+ exitAction exitSemaphore suspendSemaphore
+ singleStepping emergencySignalHandler'
classVariableNames:'TerminateSignal'
poolDictionaries:''
category:'Kernel-Processes'
@@ -24,7 +24,7 @@
COPYRIGHT (c) 1992 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libbasic/Process.st,v 1.18 1994-11-28 20:34:14 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Process.st,v 1.19 1995-02-02 12:25:39 claus Exp $
'!
!Process class methodsFor:'documentation'!
@@ -45,7 +45,7 @@
version
"
-$Header: /cvs/stx/stx/libbasic/Process.st,v 1.18 1994-11-28 20:34:14 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Process.st,v 1.19 1995-02-02 12:25:39 claus Exp $
"
!
@@ -67,14 +67,18 @@
ProcessorScheduler.
Processes can be terminated either soft or via a hardTerminate.
+
A soft terminate (see Process>>terminate) will raise a TerminationSignal
- in the process, which can be handled. If no other handler was specified,
- the processes own handler (see Process>>start) will catch the signal
- and terminate the process. During this signal processing, normal unwind
- processing takes place, this means that with a soft terminate, all
- valueOnUnwind:/valueNowOrOnUnwind: cleanup blocks are evaluated.
+ in the process, which can be handled by the process.
+ If no other handler was specified, the processes own handler
+ (see Process>>start) will catch the signal and terminate the process.
+ During this signal processing, normal unwind processing takes place,
+ this means that with a soft terminate, all valueOnUnwind:/valueNowOrOnUnwind:
+ cleanup blocks are evaluated.
(so a process which has set up those blocks correctly does not have to
care especially about cleanup in case of termination).
+ Other than that, the TerminateSignal can be cought for special cleanup or
+ even to make the process continue execution.
A hard terminate (Process>>terminateNoSignal) will NOT do all of the above,
but quickly (and without any cleanup) terminate the process.
@@ -86,13 +90,25 @@
in Smalltalk/X, processes are gone, when an image is restarted;
this means, that you have to take care of process re-creation yourself.
Usually, this is done by depending on ObjectMemory, recreating the
- process(s) when the #returnFromSnapshot-change notifiaction arrives.
+ process(s) when the #returnFromSnapshot-change notifiction arrives.
All views (actually windowGroups) recreate their window process
on image-restart. You have to do so manually for your own processes.
A later version will allow specification of automatic restart, but
- thats not yet implemented.
+ thats not yet implemented. However, even when implemented, restartable processes
+ will be recreated to restart from the beginning. It will not be possible to
+ automatically continue a processes execution where it left off.
+ This is a consequence of the portable implementation of ST/X, since in order to
+ implement this feature, the machines stack had to be preserved and recreated.
+ Although this is possible theoretically, this has not been implemented, since
+ the machines stack layout is highly machine/compiler dependent,
+
+
+ Process synchronization:
+ any other process can wait for a process to suspend or terminate. This
+ is implemented by using suspendSemaphore and exitSemaphore, which are
+ signalled when these events occur (see waitUntilSuspended/waitUntilTerminated).
Instance variables:
@@ -108,12 +124,17 @@
name <String-or-nil> the processes name (if any)
(for process-monitor)
+ suspendSemaphore <Semaphore> triggered when suspend (if nonNil)
+
+ exitSemaphore <Semaphore> triggered when terminated (if nonNil)
+
restartable <Boolean> is restartable (not yet implemented)
interruptActions <Collection> interrupt actions as defined by interruptWith:,
performed at interrupt time
- exitAction <Block> additional cleanup action to perform on termination
+ exitAction <Block> additional cleanup action to perform
+ on termination (if nonNil)
emergencySignalHandler <Block> can be used for per-process
emergency signal handling
@@ -487,7 +508,7 @@
name := '(' , startBlock displayString , ')'
].
startBlock := nil.
- (SignalSet with:TerminateSignal with:(Object abortSignal))
+ (SignalSet with:TerminateSignal with:AbortSignal)
handle:[:ex |
ex return
] do:block.
@@ -496,6 +517,8 @@
exitAction := nil.
block value.
].
+ suspendSemaphore notNil ifTrue:[suspendSemaphore signal].
+ exitSemaphore notNil ifTrue:[exitSemaphore signal].
Processor terminateActiveNoSignal
] ifFalse:[
"is this artificial restriction useful ?"
@@ -508,6 +531,7 @@
suspend
"suspend the receiver process - will continue to run when a resume is sent"
+ suspendSemaphore notNil ifTrue:[suspendSemaphore signal].
Processor suspend:self
!
@@ -533,6 +557,8 @@
] do:[
TerminateSignal raise.
].
+ suspendSemaphore notNil ifTrue:[suspendSemaphore signal].
+ exitSemaphore notNil ifTrue:[exitSemaphore signal].
Processor terminateNoSignal:self
] ifFalse:[
self interruptWith:[self terminate]
@@ -542,6 +568,8 @@
terminateNoSignal
"terminate the receiver process without performing any unwind- or exit-actions"
+ suspendSemaphore notNil ifTrue:[suspendSemaphore signal].
+ exitSemaphore notNil ifTrue:[exitSemaphore signal].
Processor terminateNoSignal:self
! !
@@ -626,6 +654,24 @@
wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
0 "stc hint"
]
+!
+
+waitUntilTerminated
+ "set the softSuspend flag of the receiver and wait until it
+ suspends. The receviers process must execute checkForSoftSuspend
+ periodically for this rendevous to work."
+
+ exitSemaphore := Semaphore new.
+ exitSemaphore wait
+!
+
+waitUntilSuspended
+ "set the softSuspend flag of the receiver and wait until it
+ suspends. The receviers process must execute checkForSoftSuspend
+ periodically for this rendevous to work."
+
+ suspendSemaphore := Semaphore new.
+ suspendSemaphore wait
! !
!Process methodsFor:'printing & storing'!
--- a/ProcessorScheduler.st Thu Feb 02 13:23:05 1995 +0100
+++ b/ProcessorScheduler.st Thu Feb 02 13:25:49 1995 +0100
@@ -32,7 +32,7 @@
COPYRIGHT (c) 1993 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.25 1994-11-28 20:33:22 claus Exp $
+$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.26 1995-02-02 12:25:35 claus Exp $
'!
Smalltalk at:#Processor put:nil!
@@ -55,7 +55,7 @@
version
"
-$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.25 1994-11-28 20:33:22 claus Exp $
+$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.26 1995-02-02 12:25:35 claus Exp $
"
!
@@ -299,8 +299,10 @@
aProcess state:#active.
oldProcess setStateTo:#run if:#active.
- "no interrupts now - activeProcess has already been changed
- (dont add any message sends here)"
+ "
+ no interrupts now - activeProcess has already been changed
+ (dont add any message sends here)
+ "
activeProcess := aProcess.
currentPriority := pri.
%{
@@ -311,23 +313,18 @@
else
ok = __threadSwitch(__context, _intVal(id));
%}.
- "time passes ...
+ "time passes spent in some other process ...
... here again"
- p := activeProcess.
- activeProcess := oldProcess.
- currentPriority := oldPri.
+ p := activeProcess.
+ activeProcess := oldProcess.
+ currentPriority := oldPri.
ok ifFalse:[
"
switch failed for some reason -
destroy the bad process
"
-"
- p := activeProcess.
- activeProcess := oldProcess.
- currentPriority := oldPri.
-"
p id ~~ 0 ifTrue:[
'problem with process ' errorPrint. p id errorPrint. ' terminate it.' errorPrintNL.
p state:#suspended.
@@ -342,7 +339,7 @@
!
scheduleForInterrupt:aProcess
- "make aProcess evaluate its pushedInterrupt block(s)"
+ "make aProcess evaluate its pushed interrupt block(s)"
|id|
@@ -644,7 +641,7 @@
].
aProcess == scheduler ifTrue:[
'scheduler should never be suspended' printNL.
- "/ MiniDebugger enterWithMessage:'scheduler should never be suspended'.
+ MiniDebugger enterWithMessage:'scheduler should never be suspended'.
^ self
].
@@ -993,6 +990,24 @@
]
].
^ nil
+!
+
+activeProcessIsSystemProcess
+ "return true if the active process is a system process,
+ which should not be suspended."
+
+ |active|
+
+ (self class isPureEventDriven
+ or:[(active := self activeProcess) id == 0
+ or:[active nameOrId endsWith:'dispatcher']]) ifTrue:[
+ ^ true
+ ].
+ ^ false
+
+ "
+ Processor activeProcessIsSystemProcess
+ "
! !
!ProcessorScheduler methodsFor:'dispatching'!
--- a/Rectangle.st Thu Feb 02 13:23:05 1995 +0100
+++ b/Rectangle.st Thu Feb 02 13:25:49 1995 +0100
@@ -21,7 +21,7 @@
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libbasic/Rectangle.st,v 1.12 1994-11-21 16:39:12 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Rectangle.st,v 1.13 1995-02-02 12:25:44 claus Exp $
'!
!Rectangle class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
version
"
-$Header: /cvs/stx/stx/libbasic/Rectangle.st,v 1.12 1994-11-21 16:39:12 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Rectangle.st,v 1.13 1995-02-02 12:25:44 claus Exp $
"
!
@@ -536,7 +536,7 @@
by amount, a Point or Number.
This is destructive (modifies the receiver, not a copy) and
should only be used if you know, that you are the exclusive owner
- of the receiver."
+ of the receiver. (use translatedBy if in doubt)"
|amountPoint|
@@ -567,22 +567,23 @@
"scale the receiver rectangle by scale (a Number or Point).
This is destructive (modifies the receiver, not a copy) and
should only be used if you know, that you are the exclusive owner
- of the receiver."
+ of the receiver. (use scaledBy if in doubt)"
- |scalePoint|
+ |scalePoint sx sy|
(scale isMemberOf:Point) ifTrue:[ "type hint to stc"
- width := width * scale x.
- height := height * scale y.
- left := left * scale x.
- top := top * scale y
+ sx := scale x.
+ sy := scale y
] ifFalse:[
scalePoint := scale asPoint.
- width := width * scalePoint x.
- height := height * scalePoint y.
- left := left * scalePoint x.
- top := top * scalePoint y
- ]
+ sx := scalePoint x.
+ sy := scalePoint y
+ ].
+ width := width * sx.
+ height := height * sy.
+ left := left * sx.
+ top := top * sy
+
"
(Rectangle origin:10@10 corner:50@50) scaleBy:2
"
@@ -649,12 +650,22 @@
"return a Rectangle with same extent as receiver but
origin translated by the argument, aPoint"
- ^ Rectangle origin:(self origin + aPoint) extent:(self extent)
+ |amountPoint|
+
+ amountPoint := aPoint asPoint.
+ ^ Rectangle left:(left + amountPoint x)
+ top:(top + amountPoint y)
+ width:width
+ height:height
+
+"/ ^ Rectangle origin:(self origin + aPoint) extent:(self extent)
!
rounded
- ^ Rectangle left:(left rounded) top:(top rounded)
- width:(width rounded) height:(height rounded)
+ ^ Rectangle left:(left rounded)
+ top:(top rounded)
+ width:(width rounded)
+ height:(height rounded)
!
expandBy:delta
@@ -763,14 +774,17 @@
"return a new rectangle which is the receiver
scaled by scale"
- |scalePoint|
+ |scalePoint sx sy|
scalePoint := scale asPoint.
- ^ Rectangle left:left top:top
- width:(width * scalePoint x)
- height:(height * scalePoint y)
+ sx := scalePoint x.
+ sy := scalePoint y.
+ ^ Rectangle left:left * sx
+ top:top * sy
+ width:(width * sx)
+ height:(height * sy)
"
- (Rectangle origin:10@10 corner:50@50) scaledBy:2
+ (Rectangle origin:10@10 corner:50@50) scaledBy:2
"
"its NOT destructive:"
@@ -778,8 +792,8 @@
|r1 r2|
r1 := Rectangle origin:10@10 corner:50@50.
- r2 := r1 scaledBy:2.
- r1
+ r2 := r1 scaledBy:2.
+ r1
"
!
--- a/Registry.st Thu Feb 02 13:23:05 1995 +0100
+++ b/Registry.st Thu Feb 02 13:25:49 1995 +0100
@@ -1,6 +1,6 @@
"
COPYRIGHT (c) 1993 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
@@ -19,9 +19,9 @@
Registry comment:'
COPYRIGHT (c) 1993 by Claus Gittinger
- All Rights Reserved
+ All Rights Reserved
-$Header: /cvs/stx/stx/libbasic/Registry.st,v 1.10 1994-10-10 00:27:59 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Registry.st,v 1.11 1995-02-02 12:25:47 claus Exp $
'!
!Registry class methodsFor:'documentation'!
@@ -29,7 +29,7 @@
copyright
"
COPYRIGHT (c) 1993 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
@@ -42,7 +42,7 @@
version
"
-$Header: /cvs/stx/stx/libbasic/Registry.st,v 1.10 1994-10-10 00:27:59 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Registry.st,v 1.11 1995-02-02 12:25:47 claus Exp $
"
!
@@ -82,27 +82,27 @@
cleanState ifTrue:[
sz := phantomArray size.
- 1 to:sz do:[:index |
- (registeredObjects at:index) isNil ifTrue:[
- phantom := phantomArray at:index.
- phantom notNil ifTrue:[
- phantomArray at:index put:nil.
- phantom disposed
- ]
- ]
- ]
+ 1 to:sz do:[:index |
+ (registeredObjects at:index) isNil ifTrue:[
+ phantom := phantomArray at:index.
+ phantom notNil ifTrue:[
+ phantomArray at:index put:nil.
+ phantom disposed
+ ]
+ ]
+ ]
]
! !
-!Registry methodsFor:'enumeration'!
+!Registry methodsFor:'enumerating'!
contentsDo:aBlock
"evaluate aBlock for each registered object"
registeredObjects notNil ifTrue:[
- registeredObjects nonNilElementsDo:[:o |
- aBlock value:o
- ]
+ registeredObjects nonNilElementsDo:[:o |
+ aBlock value:o
+ ]
]
! !
@@ -121,7 +121,7 @@
index := registeredObjects identityIndexOf:anObject ifAbsent:[0].
index ~~ 0 ifTrue:[
- phantomArray at:index put:anObject shallowCopyForFinalization.
+ phantomArray at:index put:anObject shallowCopyForFinalization.
]
!
@@ -137,22 +137,22 @@
phantom := anObject shallowCopyForFinalization.
registeredObjects isNil ifTrue:[
- registeredObjects := WeakArray new:10.
- registeredObjects watcher:self.
- registeredObjects at:1 put:anObject.
- phantomArray := Array new:10.
- phantomArray at:1 put:phantom.
- cleanState := true.
- ObjectMemory addDependent:self.
- ^ self
+ registeredObjects := WeakArray new:10.
+ registeredObjects watcher:self.
+ registeredObjects at:1 put:anObject.
+ phantomArray := Array new:10.
+ phantomArray at:1 put:phantom.
+ cleanState := true.
+ ObjectMemory addDependent:self.
+ ^ self
].
index := registeredObjects identityIndexOf:anObject ifAbsent:[0].
index ~~ 0 ifTrue:[
- "already registered"
- phantomArray at:index put:phantom.
- self error:'object is already registered'.
- ^ self
+ "already registered"
+ phantomArray at:index put:phantom.
+ self error:'object is already registered'.
+ ^ self
].
"search for a free slot, on the fly look for leftovers"
@@ -160,15 +160,15 @@
index ~~ 0 ifTrue:[
"is there a leftover ?"
p := phantomArray at:index.
- p notNil ifTrue:[
+ p notNil ifTrue:[
"tell the phantom"
- phantomArray at:index put:nil.
- p disposed.
- p := nil.
- ].
- registeredObjects at:index put:anObject.
- phantomArray at:index put:phantom.
- ^ self
+ phantomArray at:index put:nil.
+ p disposed.
+ p := nil.
+ ].
+ registeredObjects at:index put:anObject.
+ phantomArray at:index put:phantom.
+ ^ self
].
"no free slot, add at the end"
@@ -196,8 +196,8 @@
index := registeredObjects identityIndexOf:anObject ifAbsent:[0].
index ~~ 0 ifTrue:[
- phantomArray at:index put:nil.
- registeredObjects at:index put:nil
+ phantomArray at:index put:nil.
+ registeredObjects at:index put:nil
]
! !
@@ -205,11 +205,11 @@
update:aParameter
aParameter == #earlyRestart ifTrue:[
- phantomArray notNil ifTrue:[
- phantomArray atAllPut:nil
- ]
+ phantomArray notNil ifTrue:[
+ phantomArray atAllPut:nil
+ ]
].
aParameter == #returnFromSnapshot ifTrue:[
- cleanState := true
+ cleanState := true
]
! !
--- a/Semaphore.st Thu Feb 02 13:23:05 1995 +0100
+++ b/Semaphore.st Thu Feb 02 13:25:49 1995 +0100
@@ -21,7 +21,7 @@
COPYRIGHT (c) 1993 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libbasic/Semaphore.st,v 1.13 1994-10-28 01:29:18 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Semaphore.st,v 1.14 1995-02-02 12:25:49 claus Exp $
'!
!Semaphore class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
version
"
-$Header: /cvs/stx/stx/libbasic/Semaphore.st,v 1.13 1994-10-28 01:29:18 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Semaphore.st,v 1.14 1995-02-02 12:25:49 claus Exp $
"
!
@@ -95,6 +95,15 @@
count := n
! !
+!Semaphore methodsFor:'queries '!
+
+wouldBlock
+ "return true, if the receiver would block the activeProcess
+ if a wait was performed. False otherwise."
+
+ ^ count == 0
+! !
+
!Semaphore methodsFor:'wait & signal'!
wait