; $VER: SuperPlay-Interfaces 1.1 (6.8.96)

; Author    Date       Remark
; -------------------------------------------------------
; Indy      07-Jul-96  Version 1.0
; Indy      06-Aug-96  Version 1.1
;
; Feel free to use it for own installer-scripts.


(SET #selectLang (ASKCHOICE
                   (PROMPT "")
                   (HELP @askchoice-help)
                   (CHOICES "English Installation"
                            "Deutsche Installation" )
                   (DEFAULT 0)
                 )
)

(IF (= #selectLang 0) (SET @language "english")  )
(IF (= #selectLang 1) (SET @language "deutsch")  )

(IF (= @language "deutsch")
  (

  (SET #msg "Mit diesen Installer-Script werden die Interface-Dateien ins \
gewnschte Verzeichnis kopiert und dann anschlieend zur Erzeugung \
der .sym- und .obj-Dateien compiliert. Dabei kann gewhlt werden welche \
Objektdateien (.obj, .objs etc.) erzeugt werden sollen und in welchen \
Verzeichnis sich das sym- und obj-Verzeichnis befindet.(Der Oberon-Compiler \
mu sich mit Oberon:Oberon aufrufen lassen.)")
  
  (SET #whereInt-Dir  "In welches Verzeichnis sollen die SuperPlay-Interfaces kopiert werden?" )
  (SET #whereSym-Dir (CAT "In welchem gemeinsamen (Ober-)Verzeichnis befindet sich sowohl "
                         "das Verzeichnis \"sym\" also auch \"obj\", bzw. wo sollen diese "
                         "angelegt werden?"))
  (SET #whichObjFiles "Welche Objekt-Files sollen angelegt werden?")
  (SET #doCopy        "Kopiere")
  (SET #bigDataGC     "Groes Datenmodell und GC")
  (SET #bigData       "Groes Datenmodell ohne GC")
  (SET #smallDataGC   "Kleines Datenmodell und GC")
  (SET #smallData     "Kleines Datenmodell ohne GC")
  )
)

(IF (= @language "english")
  (

  (SET #msg "With this installer-script you can copy and compile the interface-files.")
  (SET #whereInt-Dir  "Into which directory I should copy the SuperPlay-interfaces?" )
  (SET #whereSym-Dir (CAT "In which common (main-)directory are your \"sym\" AND \"obj\" "
                          "drawer, or in which directory should they be created?"))
  (SET #whichObjFiles "Which sort of object-files should be created?")
  (SET #doCopy        "Copy")
  (SET #bigDataGC     "Big data with gc")
  (SET #bigData       "Big data without gc")
  (SET #smallDataGC   "Small data with gc")
  (SET #smallData     "Small data without gc")
  )
)

; *** Procedures ***

(PROCEDURE DoIt(
  (TEXTFILE
  (DEST "T:CompileSP")
  (APPEND "STACK 30000\n"
          #parameter)
  )

  (EXECUTE "T:CompileSP"
  (PROMPT ("Compile SuperPlay-Interfaces:\n- %s..." #modell))
  (HELP @run-help)
  (CONFIRM)
  )
))


(MESSAGE #msg)

; *** Zielverzeichnis fr Interfaces ermitteln ***

(SET @default-dest "Oberon:Interfaces/")
(SET #int-dir (ASKDIR (PROMPT #whereInt-Dir)
                  (HELP @askfile-help)
                  (DEFAULT @default-dest)
             )
)

; *** Verzeichnis fr sym-, obj-Verzeichnis ermitteln ***

(SET @default-dest "Oberon:")
(SET #sym-dir (ASKDIR (PROMPT #whereSym-Dir)
                     (HELP @askfile-help)
                     (DEFAULT @default-dest)
             )
)


; *** Falls nicht vorhanden sym- und obj-Verzeichnis erstellen ***

(IF (NOT (EXISTS (TACKON #sym-dir "sym")))
        (MAKEDIR (TACKON #sym-dir "sym") )
)

(IF (NOT (EXISTS (TACKON #sym-dir "obj")))
        (MAKEDIR (TACKON #sym-dir "obj") )
)


;*** Interfaces kopieren ***

(FOREACH "Interfaces/" "#?"
  (COPYLIB
   (PROMPT (CAT (#doCopy) (" '%s'..." @each-name)))
   (HELP @copylib-help)
   (SOURCE (TACKON "Interfaces/" @each-name))
   (DEST #int-dir)
   (CONFIRM)
  )
)


; Oberon Batch-Datei erstellen

(TEXTFILE (DEST "T:BatchSP")
          (APPEND (TACKON #int-dir ("spObjects.mod"))
                  ("\n")
                  (TACKON #int-dir ("SuperPlay.mod"))
                  ("\n")
          )
)

(SET @execute-dir #sym-dir)
(SET @default-dest #int-dir)

(SET #m   "Oberon:Oberon <T:BatchSP >CON:////SuperPlay-Library -m  ")
(SET #ma  "Oberon:Oberon <T:BatchSP >CON:////SuperPlay-Library -ma ")
(SET #md  "Oberon:Oberon <T:BatchSP >CON:////SuperPlay-Library -md ")
(SET #mda "Oberon:Oberon <T:BatchSP >CON:////SuperPlay-Library -mda")

(RUN "Resident Oberon:Oberon")
(RUN "ResidentManager")

(SET obj
  (ASKOPTIONS
    (PROMPT #whichObjFiles)
    (HELP @askchoice-help)
    (CHOICES (CAT "obj   - " #bigDataGC)
             (CAT "obja  - " #bigData)
             (CAT "objs  - " #smallDataGC)
             (CAT "objsa - " #smallData)
    )
    (DEFAULT 15)
  )
)

(IF (IN obj 0)   ; Groes Datenmodell mit Garbage Collector
  (
  (SET #modell #bigDataGC)
  (SET #parameter #m)
  (DoIt)
  )
)

(IF (IN obj 1)   ; Groes Datenmodell ohne Garbage Collector
  (
  (SET #modell #bigData)
  (SET #parameter #ma)
  (DoIt)
  )
)

(IF (IN obj 2)   ; Kleines Datenmodell mit Garbage Collector
  (
  (SET #modell #smallDataGC)
  (SET #parameter #md)
  (DoIt)
  )
)

(IF (IN obj 3)   ; Kleines Datenmodell ohne Garbage Collector
  (
  (SET #modell #smallData)
  (SET #parameter #mda)
  (DoIt)
  )
)


(DELETE "T:CompileSP")
(DELETE "T:BatchSP")

(EXIT "tschuess\n         [|8:)")
