'From Cuis 2.6 of 10 August 2010 [latest update: #540] on 1 September 2010 at 11:59:24 pm'!
!classDefinition: #SystemDictionary category: #'System-Support'!
IdentityDictionary subclass: #SystemDictionary
	instanceVariableNames: 'cachedClassNames '
	classVariableNames: 'LastImageName LastQuitLogPosition LowSpaceProcess LowSpaceSemaphore ShutDownList SourceFileVersionString SpecialSelectors StartUpList StartupStamp EndianCache '
	poolDictionaries: ''
	category: 'System-Support'!

!SystemDictionary methodsFor: 'snapshot and quit' stamp: 'jmv 9/1/2010 23:55'!
processShutDownList: quitting
	"Send #shutDown to each class that needs to wrap up before a snapshot."

	self send: #shutDown: toClassesNamedIn: ShutDownList with: quitting.
	EndianCache _ nil! !

!SystemDictionary methodsFor: 'snapshot and quit' stamp: 'jmv 9/1/2010 23:55'!
processStartUpList: resuming
	"Send #startUp to each class that needs to run initialization after a snapshot."

	EndianCache _ self calcEndianness.
	self send: #startUp: toClassesNamedIn: StartUpList with: resuming! !

!SystemDictionary methodsFor: 'sources, change log' stamp: 'jmv 9/1/2010 23:54'!
calcEndianness
	| bytes word blt |
	"What endian-ness is the current hardware?  The String '1234' will be stored into a machine word.  On BigEndian machines (the Mac), $1 will be the high byte if the word.  On LittleEndian machines (the PC), $4 will be the high byte."
	"Smalltalk endianness"

	bytes _ ByteArray withAll: #(0 0 0 0).  "(1 2 3 4) or (4 3 2 1)"
	word _ WordArray with: 16r01020304.
	blt _ (BitBlt toForm: (Form new hackBits: bytes)) 
				sourceForm: (Form new hackBits: word).
	blt combinationRule: Form over.  "store"
	blt sourceY: 0; destY: 0; height: 1; width: 4.
	blt sourceX: 0; destX: 0.
	blt copyBits.  "paste the word into the bytes"
	bytes first = 1 ifTrue: [^ #big].
	bytes first = 4 ifTrue: [^ #little].
	self error: 'Ted is confused'.! !

!SystemDictionary methodsFor: 'sources, change log' stamp: 'jmv 9/1/2010 23:58'!
endianness
	"Endianness is cached. If it happens to be nil, we are in the midst of either shutdown or startup. In such cases, compute endiannes but DO NOT cache it. I.e. do not do lazy initialization."
	^EndianCache ifNil: [ self calcEndianness ]! !

!classDefinition: #SystemDictionary category: #'System-Support'!
IdentityDictionary subclass: #SystemDictionary
	instanceVariableNames: 'cachedClassNames'
	classVariableNames: 'EndianCache LastImageName LastQuitLogPosition LowSpaceProcess LowSpaceSemaphore ShutDownList SourceFileVersionString SpecialSelectors StartUpList StartupStamp'
	poolDictionaries: ''
	category: 'System-Support'!
