|
| !Run file for Zap
| (c) D.H.Symes and others 1991-1999
|

| Check Zap isn't already running
If "<Zap$Running>"="Yes" Then Error 0 Zap is already running

| Set up directory paths and load sprites
Set Zap$Dir <Obey$Dir>
Set ZapCode$Path <Zap$Dir>.Code.
Set ZapTemplates$Path ZapUser:Templates.,<Zap$Dir>.Templates.
Set ZapExtensions$Path ZapCode:Extensions.
Set ZapModules$Path <Zap$Dir>.Modules.

| Load ObeySupport
RMEnsure ObeySupport 0.02 RMLoad ZapCode:ObeySpt

| Load sprites
IconSprites <Zap$Dir>.!Sprites

| Boot or default ZapFonts and ZapUser if they haven't already been booted
RMEnsure UtilityModule 3.50 If "<Alias$IfThere>"="" Then Set Alias$IfThere ZapCode:IfThere %%*0

If "<ZapUser$Path>" = "" Then Else IfThere ZapUser:!Run Then Else Unset ZapUser$Path
Set Alias$ZapBootUser IfThere Choices:!ZapUser Then Obey Choices:!ZapUser.!Boot
If "<Choices$Write>" = "" Then Set Alias$ZapBootUser ""
If "<ZapUser$Path>" = "" Then ZapBootUser
Unset Alias$ZapBootUser
If "<ZapUser$Path>" = "" Then IfThere <Zap$Dir>.!ZapUser Then Obey <Zap$Dir>.!ZapUser.!Boot
If "<ZapUser$Path>" = "" Then Error 0 Please locate !ZapUser

If "<ZapFontsSource$Path>" = "" Then Else IfThere ZapFontsSource: Then Else Unset ZapFontsSource$Path
If "<ZapFontsSource$Path>" = "" Then IfThere BootResources:!ZapFonts Then Obey BootResources:!ZapFonts.!Boot
If "<ZapFontsSource$Path>" = "" Then IfThere <Zap$Dir>.!ZapFonts Then Obey <Zap$Dir>.!ZapFonts.!Boot
If ("<ZapFontsSource$Path>" = "") OR ("<Zap$Redraw>" = "") Then Error 0 Please locate !ZapFonts

Set ZapFonts$Path ZapFontsSource:

| Find operating system version
SetEval Zap$OSVsn 350
RMEnsure UtilityModule 3.50 SetEval Zap$OSVsn 300
RMEnsure UtilityModule 3.10 SetEval Zap$OSVsn 200

| To turn off dynamic areas uncomment the following line
| SetEval Zap$OSVsn 300

| Default options
Set Zap$Types     ZapGenerated:Types
Set Zap$External  ZapGenerated:External
Set Zap$HelpData  ZapGenerated:HelpData

| Generate configuration files if necessary
Obey ZapCode:SetZapGen
WimpSlot -min 96K
Run ZapCode:Config.ConfigScan
If "<Zap$Temp>" = "1" Then WimpSlot -min 256K -max 256K
If "<Zap$Temp>" = "1" Then Run ZapCode:Config.CreateConf -script ZapCode:Config.RunScript
WimpSlot -min 96K

| Obey the !ZapRun file
Obey ZapGenerated:!ZapRun

| Force template file to '2D' if on Risc OS 2
If Zap$OSVsn<300 Then Set Zap$Templates ZapTemplates:2D

| For RISC OS 2 users
RMEnsure ColourTrans 0.51 RMLoad System:Modules.Colours

| Load modules and start Zap task (possibly loading a file).
RMEnsure ZapRedraw 0.36 RMLoad <Zap$Redraw>
RMLoad ZapCode:Zap
Zap_Desktop %*0