patches
author Claus Gittinger <cg@exept.de>
Mon, 29 Nov 1999 12:50:06 +0100
changeset 397 5ad969d9ea05
parent 384 e516fa60a3f9
child 446 e740c00fb271
permissions -rw-r--r--
*** empty log message ***

"/
"/ $Header$
"/
"/ This file is processed at initial startup 
"/ - not when resuming an image.
"/

"/
"/ install uncompiled classes as autoload
"/ classes ... (if not already present)
"/ Autoloaded classes will be automatically filed-in
"/ when first accessed. This allows a smaller executable,
"/ but creates a short delay, when the class is loaded on
"/ first access.
"/
"/ You can add more classes to these lists -
"/ i.e. all your classes you like to have around,
"/ but which are not needed often enough to justify
"/ machine code for them ...

|system iSets requiredClasses enableJIT|

'patches [info]: initial startup (snapshot image restart is faster) ...' infoPrintCR.

"/
"/ the JIT translator is known to work with the following
"/ architectures:
"/  ix86        (linux, win32, unixware)
"/  sgi-mips    (irix)
"/  alpha       (osf)
"/  sparc       (solaris)   [only tested with v7 & v8 cpus]
"/  aix         (rs6k)    
"/
enableJIT := false.

system := OperatingSystem getSystemType.
(#(
  'linux'
  'unixware'
  'solaris'
  'iris'
  'osf'
  'win32'
) includes:system) ifTrue:[
    enableJIT := true.

    system = 'solaris' ifTrue:[
	"/ for now, disable if we detect running on a sparcV9;
	"/ Reason:
	"/   we only have v8 machines here (at eXept), 
	"/   and therefore have no way of checking if it runs on v9.
	"/  I dont want ST/X to crash on your side in that case ...
	"/  ... better run a bit slower than not running at all.
	"/ Please let us know if it runs and we will remove the code below
	"/ (which you should do as well).

	iSets := OperatingSystem getSystemInfo at:#instructionSets.
	(iSets includesString:'sparcv9') ifTrue:[
	    'patches [warning]: disable JIT for sparcV9 - not yet validated' infoPrintCR.
	    enableJIT := false
	]
    ]
].

enableJIT ifTrue:[
    "/ 'patches [info]: turn on JIT ...' infoPrintCR.
    ObjectMemory justInTimeCompilation:true.
].

"/ GLXWorkstation forceGL:true.
"/ OperatingSystem disableSignal:14.

ObjectMemory infoPrinting:false.
"/ Smalltalk loadBinaries:true.
Compiler allowUnderscoreInIdentifier:true. 
Compiler warnUnderscoreInIdentifier:false. 
Compiler warnSTXSpecials:false.

Project notNil ifTrue:[
    Project setDefaultProject.
    Project current packageName:#'autoloaded'.
].

"/
"/ when filing in, keep source as reference to file
"/ (instead of keeping a string locally in the image)
"/
"/ I disable this - its dangerous if you fileIn
"/ classes from other directories and fileOut later clobbers those files
"/
"/ ClassCategoryReader sourceMode:#reference.

"/
"/ the following are required (either compiled or interpreted) ...
"/
requiredClasses := #( 
     ObsoleteObject
     "/ BinaryIOManager BinaryInputManager BinaryOutputManager BinaryObjectStorage
     StringCollection
     CachingRegistry Registry
).

requiredClasses do:[:s |
    (Smalltalk at:s) isNil ifTrue:[
	('patches [info]: loading ' , s , ' ...') infoPrintCR.
	Smalltalk fileInClass:s initialize:true lazy:false silent:true
    ]
].
!

|optionalViews|

(Smalltalk at:#View) isNil ifTrue:[
    'patches [info]: installing required autoloaded classes ...' infoPrintCR.

    optionalViews := #(
			DeviceWorkstation
			Workstation
			XWorkstation
			DisplayRootView
			SimpleView
			TopView
			StandardSystemView
			ModalBox
			View
			PseudoView
			DeviceDrawable
			DisplayMedium
			DisplaySurface
			GraphicsMedium
			DeviceGraphicsContext
			GraphicsContext
			Image
			ViewStyle
			KeyboardMap
			KeyboardForwarder
			TextCollector
			SynchronousWindowSensor
			WindowSensor
			WindowGroup
			WindowEvent
			WindowingTransformation
			FontDescription
			Font
			Form
			Cursor
			Color
			Depth1Image
			Depth8Image
			ResourcePack
			Model
			Controller
			ApplicationModel
			ApplicationWindow
			WindowBuilder
			PopUpView
			ShadowView
			Colormap
			DeviceHandle
			DisplayObject
		     ).
    optionalViews do:[:s |
	"install if not already compiled-in"
	(Smalltalk at:s) isNil ifTrue:[
	    Autoload subclass:s
		 instanceVariableNames:''
		 classVariableNames:''
		 poolDictionaries:''
		 category:'autoloaded-Views'
	]
    ].
    (Smalltalk at:#DeviceWorkstation) autoload.
    (Smalltalk at:#XWorkstation) autoload.
    (Smalltalk at:#Workstation) autoload.
    (Smalltalk at:#DeviceHandle) autoload.
].
!

Project notNil ifTrue:[
    Project setDefaultProject.
    Project current packageName:#'patches'.
].

'patches [info]: installing patches ...' infoPrintCR.
!

"/ future systems will read patches from a patch-directory,
"/ called stxPatches. (we will deliver patch-sets in the future)
"/ This is not yet implemented, but we are prepared here for
"/ this ...
"/ patches from that directory are read in alphabetic order;
"/ patches will be named them p_nnnn.st, where nnnn is a sequence-nr.

|patchDir|

patchDir := 'stxPatches' asFilename.
(patchDir exists and:[patchDir isDirectory and:[patchDir isReadable]]) ifTrue:[
    patchDir directoryContents sort do:[:f |
	|fn|

	fn := (patchDir construct:f) name.
	('patches [info]: reading patchFile ''' , fn , ''' ...') infoPrintCR.
	Smalltalk fileIn:fn.
    ]
].
!

"/
"/ the following patches where added by the changesBrowsers 'make change a patch'
"/ function ...
"/
!