--- a/Smalltalk.st Wed Dec 13 17:19:49 1995 +0100
+++ b/Smalltalk.st Wed Dec 13 17:47:35 1995 +0100
@@ -11,13 +11,14 @@
"
Object subclass:#Smalltalk
- instanceVariableNames:''
- classVariableNames:'ExitBlocks CachedClasses SystemPath StartupClass StartupSelector
+ instanceVariableNames:''
+ classVariableNames:'ExitBlocks CachedClasses SystemPath StartupClass StartupSelector
StartupArguments CachedAbbreviations SilentLoading Initializing
StandAlone LogDoits LoadBinaries RealSystemPath ResourcePath
- SourcePath BitmapPath BinaryPath FileInPath'
- poolDictionaries:''
- category:'System-Support'
+ SourcePath BitmapPath BinaryPath FileInPath ImageStartTime
+ ImageRestartTime'
+ poolDictionaries:''
+ category:'System-Support'
!
!Smalltalk class methodsFor:'documentation'!
@@ -40,7 +41,7 @@
"
This is one of the central classes in the system;
it provides all system-startup, shutdown and maintenance support.
- Also global variables are kept here.
+ Also global variables are (conceptionally) kept here.
As you will notice, this is NOT a Dictionary
- my implementation of globals is totally different
@@ -48,41 +49,58 @@
However, it provides the known enumeration protocol.
It may change to become a subclass of collection at some time ...
+
Instance variables:
- none - all handling is done in the VM
+ none - all handling is done in the VM
Class variables:
- ExitBlocks <Collection> blocks to evaluate before system is
- left. Not currently used.
-
- CachedClasses <Collection> known classes (cached for faster enumeration)
-
- SystemPath <Collection> path to search for system files (sources, bitmaps etc)
-
- StartupClass <Class> class, which gets initial message
- (right after VM initialization)
- StartupSelector <Symbol> message sent to StartupClass
-
- CachedAbbreviations
- <Dictionary> className to filename mappings
-
- SilentLoading <Boolean> suppresses messages during fileIn and in compiler
- (can be set to true from a customized main)
-
- LogDoits <Boolean> if true, doits are also logged in the changes
- file. Default is false, since the changes file
- may become huge ...
-
- LoadBinaries <Boolean> if true, we attempt to load classes rom a binary
- file, if present. If false, this is always suppressed.
-
- SourcePath <Collection> cached names of really existing directories
- BitmapPath These are remembered, since in NFS systems,
- ResourcePath the time to lookup files may become long
- BinaryPath (especially, if some directories are on machines
- FileInPath which are not up ...). Therefore, the set of really
- existing directories is cached when the SystemPath
- is walked the first time.
+
+ ExitBlocks <Collection> blocks to evaluate before system is
+ left. Not currently used (GNU-ST compatibility).
+
+ SystemPath <Collection> path to search for system files (sources, bitmaps etc)
+ Set to a default here, but typically changed from some
+ startup.rc file
+
+ StartupClass <Class>
+ StartupSelector <Symbol>
+ class and selector, where the system starts up
+ (right after VM initialization)
+ If an image is saved while this is nonNil, the image will come up
+ there.
+
+ SilentLoading <Boolean> suppresses messages during fileIn and in compiler
+ (can be set to true from a customized main)
+
+ LogDoits <Boolean> if true, doits are also logged in the changes
+ file. Default is false, since the changes file
+ may become huge if every tiny doIt is saved there ...
+
+ LoadBinaries <Boolean> if true, we attempt to load classes rom a binary
+ file, if present. If false, this is always suppressed.
+
+ ImageStartTime <AbsoluteTime> timestamp when this system was started the very first time
+ (i.e. initial start without an image)
+
+ ImageRestartTime
+ <AbsoluteTIme> timestamp when this image was started
+
+
+
+ strictly private classVariables (helpers):
+
+ CachedClasses <Collection> known classes (cached for faster class enumeration)
+
+ CachedAbbreviations
+ <Dictionary> className to filename mappings
+
+ SourcePath <Collection> cached names of really existing directories
+ BitmapPath These are remembered, since in NFS systems,
+ ResourcePath the time to lookup files may become long
+ BinaryPath (especially, if some directories are on machines
+ FileInPath which are not up ...). Therefore, the set of really
+ existing directories is cached when the SystemPath
+ is walked the first time.
"
! !
@@ -295,17 +313,17 @@
must init display here - some classes (Color, Form) need it during initialize
"
Workstation notNil ifTrue:[
- Workstation initialize
+ Workstation initialize
].
Compiler := ByteCodeCompiler.
Compiler isNil ifTrue:[
- "
- ByteCodeCompiler is not in the system (i.e. has not been linked in)
- this allows at least immediate evaluations for runtime systems without compiler
- NOTICE: a parser is always needed, otherwise we cannot read resource files etc.
- "
- Compiler := Parser
+ "
+ ByteCodeCompiler is not in the system (i.e. has not been linked in)
+ this allows at least immediate evaluations for runtime systems without compiler
+ NOTICE: a parser is always needed, otherwise we cannot read resource files etc.
+ "
+ Compiler := Parser
].
"
@@ -318,11 +336,15 @@
"/ aClass initialize
"/ ].
+ ImageStartTime := AbsoluteTime now.
+
Display notNil ifTrue:[
- Display initialize.
+ Display initialize.
].
self initInterrupts.
- self initUserPreferences.
+ self initUserPreferences.
+
+ "Modified: 13.12.1995 / 17:43:27 / cg"
!
isInitialized
@@ -374,7 +396,7 @@
at:aKey put:aValue
"store the argument aValue under aKey, a symbol"
-"
+" "
|oldValue|
%{
@@ -383,15 +405,18 @@
oldValue = __GLOBAL_SET(aKey, aValue, (OBJ *)0);
%}.
CachedClasses notNil ifTrue:[
- oldValue isBehavior ifTrue:[
- CachedClasses remove:oldValue
- ].
- aValue isBehavior ifTrue:[
- CachedClasses add:aValue
- ].
+ oldValue isBehavior ifTrue:[
+ CachedClasses remove:oldValue
+ ].
+ aValue isBehavior ifTrue:[
+ aValue isMeta ifTrue:[
+ self halt
+ ].
+ CachedClasses add:aValue
+ ].
].
- ^ aValue
-"
+ ^ aValue.
+" "
%{ /* NOCONTEXT */
extern OBJ __GLOBAL_SET();
@@ -972,7 +997,7 @@
|classes|
- "/ you may wander, what this while is for, here ...
+ "/ you may wonder, what this while is for, here ...
"/ the reason is that if we modify the class hierarchy in
"/ anothe view (background fileIn), while building up the
"/ cachedClasses set, this may be flushed (invalidated) by the
@@ -980,20 +1005,26 @@
"/ If that happens, we restart the set-building here
"/
[(classes := CachedClasses) isNil] whileTrue:[
- CachedClasses := classes := IdentitySet new:800.
- self do:[:anObject |
- anObject notNil ifTrue:[
- anObject isBehavior ifTrue:[
- classes add:anObject
- ]
- ]
- ]
+ CachedClasses := classes := IdentitySet new:800.
+ self do:[:anObject |
+ anObject notNil ifTrue:[
+ anObject isBehavior ifTrue:[
+ classes add:anObject
+ ]
+ ]
+ ]
].
^ classes
"
Smalltalk allClasses
+
+ to get the list sorted by name:
+
+ Smalltalk allClasses asSortedCollection:[:a :b | a name < b name]
"
+
+ "Modified: 13.12.1995 / 14:52:50 / cg"
!
cellAt:aName
@@ -1216,20 +1247,21 @@
which allow a stepwise re-init: #earlyRestart, #restarted and #returnFromSnapshot.
#earlyRestart is send first, nothing has been setup yet.
- (should be used to flush all device dependent entries)
+ (should be used to flush all device dependent entries)
#restarted is send right after.
- (should be used to recreate external resources (fds, bitmaps etc)
+ (should be used to recreate external resources (fds, bitmaps etc)
#returnFromSnapshot is sent last
- (should be used to restart processes, reOpen Streams which cannot
- be automatically be reopened (i.e. Sockets, Pipes) and so on.
- (Notice that positionable fileStreams are already reopened and repositioned)
+ (should be used to restart processes, reOpen Streams which cannot
+ be automatically be reopened (i.e. Sockets, Pipes) and so on.
+ (Notice that positionable fileStreams are already reopened and repositioned)
"
|deb insp imageName|
Initializing := true.
+ ImageRestartTime := AbsoluteTime now.
"
invalidate the display connection.
@@ -1237,7 +1269,7 @@
the Display during early startup
"
Display notNil ifTrue:[
- Display invalidateConnection
+ Display invalidateConnection
].
"
@@ -1261,7 +1293,7 @@
insp := Inspector.
deb := Debugger.
deb notNil ifTrue:[
- deb reinitialize
+ deb reinitialize
].
Inspector := MiniInspector.
Debugger := MiniDebugger.
@@ -1283,7 +1315,7 @@
- sorry, but order is important
"
Workstation notNil ifTrue:[
- Workstation reinitialize.
+ Workstation reinitialize.
].
"
@@ -1305,21 +1337,21 @@
if there is no Transcript, go to stderr
"
Transcript isNil ifTrue:[
- Transcript := Stderr
+ Transcript := Stderr
].
(SilentLoading == true) ifFalse:[
- Transcript cr.
- Transcript showCr:('Smalltalk restarted from:' , ObjectMemory imageName).
- Transcript cr.
-
- DemoMode ifTrue:[
- Transcript showCr:'*** Restricted use: ***'.
- Transcript showCr:'*** This program may be used for education only. ***'.
- Transcript showCr:'*** Please read the files COPYRIGHT and LICENSE ***'.
- Transcript showCr:'*** for more details. ***'.
- Transcript cr.
- ].
+ Transcript cr.
+ Transcript showCr:('Smalltalk restarted from:' , ObjectMemory imageName).
+ Transcript cr.
+
+ DemoMode ifTrue:[
+ Transcript showCr:'*** Restricted use: ***'.
+ Transcript showCr:'*** This program may be used for education only. ***'.
+ Transcript showCr:'*** Please read the files COPYRIGHT and LICENSE ***'.
+ Transcript showCr:'*** for more details. ***'.
+ Transcript cr.
+ ].
].
"
@@ -1328,19 +1360,19 @@
-fastStart argument.
"
(Arguments includes:'-faststart') ifFalse:[
- Class withoutUpdatingChangesDo:[
- (self fileIn:((Arguments at:1) , '_r.rc')) ifFalse:[
- "no _r.rc file where executable is; try default smalltalk_r.rc"
- self fileIn:'smalltalk_r.rc'
- ].
- ]
+ Class withoutUpdatingChangesDo:[
+ (self fileIn:((Arguments at:1) , '_r.rc')) ifFalse:[
+ "no _r.rc file where executable is; try default smalltalk_r.rc"
+ self fileIn:'smalltalk_r.rc'
+ ].
+ ]
].
"
if there is a display, start its event dispatcher
"
Display notNil ifTrue:[
- Display startDispatch.
+ Display startDispatch.
].
"
@@ -1348,17 +1380,17 @@
these two globals during snapshot ... or in main
"
(StartupClass notNil and:[StartupSelector notNil]) ifTrue:[
- "
- allow more customization by reading an image specific rc-file
- "
- imageName := ObjectMemory imageName.
- imageName notNil ifTrue:[
- (imageName endsWith:'.img') ifTrue:[
- imageName := imageName copyWithoutLast:4
- ].
- self fileIn:(imageName , '.rc')
- ].
- StartupClass perform:StartupSelector withArguments:StartupArguments.
+ "
+ allow more customization by reading an image specific rc-file
+ "
+ imageName := ObjectMemory imageName.
+ imageName notNil ifTrue:[
+ (imageName endsWith:'.img') ifTrue:[
+ imageName := imageName copyWithoutLast:4
+ ].
+ self fileIn:(imageName , '.rc')
+ ].
+ StartupClass perform:StartupSelector withArguments:StartupArguments.
].
"
@@ -1366,12 +1398,14 @@
otherwise go into a read-eval-print loop
"
Display notNil ifTrue:[
- Processor dispatchLoop
+ Processor dispatchLoop
] ifFalse:[
- self readEvalPrint
+ self readEvalPrint
].
self exit
+
+ "Modified: 13.12.1995 / 17:43:53 / cg"
!
start
@@ -2578,6 +2612,35 @@
"
!
+imageRestartTime
+ "return a timestamp for the moment when this image was restarted"
+
+ ^ ImageRestartTime
+
+ "
+ Smalltalk imageStartTime
+ Smalltalk imageRestartTime
+ "
+
+ "Created: 13.12.1995 / 17:44:20 / cg"
+ "Modified: 13.12.1995 / 17:45:55 / cg"
+!
+
+imageStartTime
+ "return a timestamp for the moment when this system started the first time
+ (i.e. the first initial start without an image)"
+
+ ^ ImageStartTime
+
+ "
+ Smalltalk imageStartTime
+ Smalltalk imageRestartTime
+ "
+
+ "Created: 13.12.1995 / 17:44:14 / cg"
+ "Modified: 13.12.1995 / 17:45:47 / cg"
+!
+
majorVersionNr
"return the major version number.
This is only incremented for very fundamental changes,
@@ -2674,5 +2737,5 @@
!Smalltalk class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.99 1995-12-11 17:29:59 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.100 1995-12-13 16:47:35 cg Exp $'
! !