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

"this allows turning off processes and running
 pure event driven - for debugging only.

 If the system has been created without thread
 support (i.e. a quick port without asm-support)
 it will come up automatically in event mode.
"

"
ProcessorScheduler pureEventDriven.
" 
!

"
 install uncompiled classes as autoload
 classes ... (if not already present)

 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 ...
"

|optional optionalGames optionalDemos optionalApps optionalBench compat|

Transcript showCr:'installing autoloaded classes ...'.

optionalGames := #(
                   Tetris TetrisBlock TicTacToe
                  ).

optionalDemos := #(
                   Animation GlobeDemo RoundGlobe
                   GLTeapotDemo GLTeapotView SliderBox
                   GLPlaneDemoView1 GLPlaneDemoView2
                   GLSphereDemoView1 GLSphereDemoView2
                   GLObjectDemoView GLCubeDemoView GLTetraDemoView
                   Logo3DView1
                  ).

optionalApps := #(
                  AddressBook AddressBook2 InitialLabelView AddressView

                  DrawTool DrawObject DrawLine DrawText
                  DrawRectangle DrawRoundRectangle DrawEllipse
                  DrawPolygon DrawCurve DrawGroup DrawView DrawImage
                  PatternMenu

                  LogicTool 

                  MailView MailHandler MailLetter MailReplyTextView

                  NewsView NewsHandler NNTPHandler NumberSet

                  ArchiveView DirectoryView DirectoryViewObject 
                  DirectoryObject FileObject

                  DocumentView DocumentReader
                  DisplayText DisplayPicture DisplayIcon DisplaySound

                  Builder BuilderView BuilderTreeView
                  BuilderClassBox BuilderVariablesBox

                  Clock ClockView RoundClock RoundClock2

                  VocPanel VocBrowser VocView SoundStream

                  Keyword KeywordSet ManualBrowser ManualMaker ManualView
                 ).

"notice, that it does not really make sense to
 run Benchmarks in interpreted mode ..."

optionalBench := #(
                  SlopstoneBenchmark SmopstoneBenchmark

                  "DeltaBlue benchmark"
                  AbstractConstraint BinaryConstraint Constraint 
                  DBMethod DBVariable EditConstraint
                  EqualityConstraint Plan Planner ScaleConstraint
                  StayConstraint Strength UnaryConstraint XMouseConstraint
                  YMouseConstraint

                  "RichardsBenchmarks"
                  DeviceTaskDataRecord HandlerTaskDataRecord
                  IdleTaskDataRecord Packet RBObject RichardsBenchmarks
                  TaskControlBlock TaskState WorkerTaskDataRecord

                  "self benchmarks"
                  AbstractBenchmark AtAllPutBenchmark BenchmarkRunner
                  BubbleSort2Array BubbleSort2Benchmark BubbleSortBenchmark
                  Cons FastSumToBenchmark HanoiBenchmark HanoiDisk
                  IncrementAllBenchmark IntMM2Array IntMM2Benchmark
                  IntMM2Matrix IntMMBenchmark MM2Benchmark MMBenchmark
                  NestedLoopBenchmark Perm2Benchmark PermArray PermBenchmark
                  PuzzleArray PuzzleBenchmark Queens2Benchmark QueensBenchmark
                  Quicksort2Array Quicksort2Benchmark QuicksortBenchmark
                  RecurseBenchmark SieveBenchmark SumAllBenchmark
                  SumFromToBenchmark SumToBenchmark TakBenchmark TaklBenchmark
                  Towers2Benchmark Towers2Disk TowersBenchmark
                  TowersBenchmarkElement TreeSort2Benchmark TreeSort2Node
                  TreeSortBenchmark TreeSortNodeBenchmark
                 ).

optional := #(
              HelpView 
              Scale HorizontalScale GLXView Point3D SliderBox 
              DialogBox OptionBox TextBox 
              InputView
              ProcessView
              DirectoryBrowser FileBrowser
              VariableHorizontalPanel
              FontPanel FramedBox FileSelectionBox FileSaveBox
              RadioButton RadioButtonGroup MotionButton MenuButton PullDownMenu

              GIFReader TIFFReader FaceReader WindowsIconReader SunReader
              XBMReader JPEGReader PBMReader ST80FormReader XPMReader

              EpsonFX1PrinterStream HPLjetIIPrinterStream
              PostscriptPrinterStream
              Decompiler Polygon 
              ScreenSaver LightInTheDark LightInTheDark2
              ChangeSetBrowser
              ImageView ImageEditView ImageInspectorView
              Depth1Image Depth2Image Depth4Image Depth8Image Depth24Image
              TreeView TreeGraphView ClassTreeView ClassTreeGraphView WindowTreeView
              EventMonitor ProcessMonitor MemoryMonitor MemoryUsageView
              ColorPanel HLSPanel RGBPanel ColorWheel ThreeSliderPanel
              ColorSlider HueSlider RGBSlider

              PersistencyManager BinaryIOManager BinaryInputManager
              BinaryOutputManager DBFile BinaryObjectStorage
             ).

optionalGames do:[:s |
    "install if not already compiled-in"
    (Smalltalk at:s) isNil ifTrue:[
        Autoload subclass:s
             instanceVariableNames:''
             classVariableNames:''
             poolDictionaries:''
             category:'autoloaded-Games & Demos'
    ]
].

optionalDemos do:[:s |
    "install if not already compiled-in"
    (Smalltalk at:s) isNil ifTrue:[
        Autoload subclass:s
             instanceVariableNames:''
             classVariableNames:''
             poolDictionaries:''
             category:'autoloaded-Games & Demos'
    ]
].

optionalApps do:[:s |
    "install if not already compiled-in"
    (Smalltalk at:s) isNil ifTrue:[
        Autoload subclass:s
             instanceVariableNames:''
             classVariableNames:''
             poolDictionaries:''
             category:'autoloaded-Applications'
    ]
].

optionalBench do:[:s |
    "install if not already compiled-in"
    (Smalltalk at:s) isNil ifTrue:[
        Autoload subclass:s
             instanceVariableNames:''
             classVariableNames:''
             poolDictionaries:''
             category:'autoloaded-Benchmarks'
    ]
].

optional do:[:s |
    "install if not already compiled-in"
    (Smalltalk at:s) isNil ifTrue:[
        Autoload subclass:s
             instanceVariableNames:''
             classVariableNames:''
             poolDictionaries:''
             category:'autoloaded-Classes'
    ]
].

Transcript showCr:'installing ST-80 compatibility (autoloaded) classes ...'.

"a kludge: we have added new ImageReaders above - tell Image"
"avoid introducing a new global ..."
(Smalltalk includesKey:#Image) ifTrue:[
    (Smalltalk at:#Image) isBehavior ifTrue:[
        (Smalltalk at:#Image) initializeFileFormatTable.
    ]
].

"some ST80 name aliases"
Smalltalk at:#ScheduledWindow put:StandardSystemView.
Smalltalk at:#ColorValue put:Color.
Smalltalk at:#BlockClosure put:Block.
Smalltalk at:#Disk put:( FileDirectory directoryNamed:'/').

"ST/X has (currently) no Double, but Floats is what ST-80 Doubles are ..."
Smalltalk at:#Double put:Float.

compat := #(BitBlt Pen Commander
            OpaqueForm 
            AbstractPath Arc Circle Curve LinearFit
            Arrow Line Path Spline Ellipse DrawingPen
            Filename ActionMenu FillInTheBlank
            KeyedSet
            DialogView FormView
            NoController MouseMenuController
            StandardSystemController
            WeakDictionary WeakIdentityDictionary
            ValueHolder ComposedTextView
            UnixSocketAccessor StringHolder
           ).

compat do:[:s |
    "install if not already compiled-in"
    (Smalltalk at:s) isNil ifTrue:[
        Autoload subclass:s
             instanceVariableNames:''
             classVariableNames:''
             poolDictionaries:''
             category:'autoloaded-ST80-Classes'
    ]
]

!

Transcript showCr:'installing patches ...' !

!OperatingSystem class methodsFor:'queries'!

supportsIOInterrupts
    "return true, if the OS supports IO availability interrupts 
     (i.e. SIGPOLL/SIGIO)."

"IO signals do not work currently 
(I dont know why - streams work, but sockets fail to produce
 a signal ..... help help help"

    ^ false
! !
