home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 3 / AACD03.BIN / AACDprefs < prev    next >
Text File  |  1999-11-01  |  18KB  |  462 lines

  1. /*
  2. Preferences editor for Amiga Active CDs
  3. $VER: AACDprefs 1.3 (26.8.99) by Neil Bothwick
  4. */
  5.  
  6. /* ;;; Initialise */
  7. options results
  8. signal on error
  9. CurrStack = pragma('S',16384)
  10. if CurrStack > 16384 then call pragma('S',CurrStack)
  11.  
  12. VerStr       = sourceline(3)
  13. VerStr       = subword(VerStr,2,words(VerStr) - 4)
  14. WinTitle     = 'Amiga Active CD preferences'
  15. GuiPort      = 'AACDPREFS'
  16. PrgPort      = GuiPort'.1'
  17. CDPrefs      = 'ENV:AACD.prefs'
  18. IderPrefs    = 'ENV:AACDfile.prefs'
  19. DefCDPrefs   = 'CDTools/S/AACD.prefs'
  20. DefIderPrefs = 'CDTools/S/AACDfile.prefs'
  21. FileTypes    = 'IFF GIF JPG PNG ANM MPG MOV AVI PDF SVX WAV S3M XMM MED DBM MOD MP3 MID AGD HTM LHA DEF'
  22. Settings     = 'CPU FPU PPC GFX'
  23. CmdHelp      = '"Command for this type of file"'
  24. ArgHelp      = '"Arguments for this command\nThe filename will be added to the end.\nUse %s to include the filename somewhere else."'
  25. Filetype.0   = 'AACDfile'
  26. Filetype.1   = 'Directory Opus'
  27.  
  28. MUIA_Menuitem_Shortcut              = 0x80422030
  29. MUIM_Application_AboutMUI           = 0x8042d21d
  30. MUIM_Application_OpenConfigWindow   = 0x804299ba
  31. MUIA_Group_SameHeight               = 0x8042037e
  32. MUIA_Group_SameWidth                = 0x8042b3ec
  33. MUIA_Group_Spacing                  = 0x8042866d
  34. MUIA_Group_Columns                  = 0x8042f416
  35. MUIA_Group_Rows                     = 0x8042b68f
  36. MUIA_Selected                       = 0x8042654b
  37. MUIA_Disabled                       = 0x80423661
  38. MUIA_Application_Author             = 0x80424842
  39. MUIA_Application_Copyright          = 0x8042ef4d
  40. MUIA_Application_Description        = 0x80421fc6
  41. MUIA_Application_Title              = 0x804281b8
  42. MUIA_Application_Version            = 0x8042b33f
  43. /*monitor on 'CON:0/0/600/180/AACDPrefs/CLOSE/AUTO'*/
  44.  
  45. call LoadLib('rexxsupport.library')
  46. call LoadLib('rexxdossupport.library')
  47. call LoadLib('rexxreqtools.library')
  48. ;;;
  49. /* ;;; Check for MUI */
  50. address command 'Assign >NIL: MUI: EXISTS'
  51. if RC > 0 then do
  52.     address command 'RequestChoice >NIL: "Amiga Active CD" "This program require Magic User Interface*NRun the Welcome script for a temporary MUI setup,*Nor install it from the CDTools drawer of the CD" "OK"'
  53.     exit
  54.     end
  55. ;;;
  56. /* ;;; Create main window */
  57. thisport = openport(PrgPort)
  58. if thisport = 0 then exit
  59. address(GuiPort)
  60. window id MAIN port PrgPort command 'QUIT' title '"'WinTitle'"'
  61. ;;;
  62. /* ;;; Menus */
  63.     menu ID PROJM label 'Project'
  64.         item ID ABOUM port PrgPort command '"ABOUT"' ATTRS MUIA_Menuitem_Shortcut '"?"' label 'About'
  65.         item  port GuiPort command '"method 'MUIM_Application_AboutMUI' 0"' label 'About MUI'
  66.         menu ID SETTM label 'Settings'
  67.             item port PrgPort command '"method 'MUIM_Application_OpenConfigWindow'"' label 'MUI...'
  68.             endmenu
  69.         item ID QUITM port PrgPort command 'QUIT' ATTRS MUIA_Menuitem_Shortcut 'Q' label 'Quit'
  70.         endmenu
  71.     menu ID EDITM label 'Edit'
  72.         item ID RESTM port PrgPort command '"RESTORE"' ATTRS MUIA_Menuitem_Shortcut 'D' label 'Restore to Defaults'
  73.         item ID LASTM port PrgPort command '"LOAD"' ATTRS MUIA_Menuitem_Shortcut 'L' label 'Last saved'
  74.         endmenu
  75. ;;;
  76. /* ;;; Info */
  77.     group id TABS REGISTER LABELS 'Info,System,Filetypes'
  78.         view file 'CDTools/S/AACDprefs.txt'
  79. ;;;
  80. /* ;;; System */
  81.         group ATTRS MUIA_Group_Columns 4
  82.             space HORIZ
  83.             label 'Filetypes'
  84.             cycle id FTYPE help '"Use Directory Opus filetypes\nor AACDfile settings."' labels Filetype.0','Filetype.1
  85.             space HORIZ
  86.             space HORIZ
  87.             label 'CPU'
  88.             cycle id CPU help '"Some functions have CPU optimised versions,\nset this to ensure you get the best options"' labels '68000,68020,68030,68040,68060'
  89.             space HORIZ
  90.             space HORIZ
  91.             label 'FPU'
  92.             cycle id FPU help '"WARNING:\nSelecting this when you do not have an FPU\nmay crash some programs"' labels 'No FPU,FPU'
  93.             space HORIZ
  94.             space HORIZ
  95.             label 'PPC'
  96.             cycle id PPC help '"Type of PPC processor, if fitted"' labels 'None,603,604'
  97.             space HORIZ
  98.             space HORIZ
  99.             label 'Graphics system'
  100.             cycle id GFX help '"Select the type of graphics\nyour Amiga uses"' labels 'AGA,OCS,CyberGraphX,Picasso96'
  101.             space HORIZ
  102.             space HORIZ
  103.             /*
  104.             label 'Summat else'
  105.             cycle id SUMAT help '"I am sure there was something else I\nneeded to include. I suppose I will\nthink of it just after the CD is mastered."' labels 'Option 1,Option 2,Option 3,Option 4'
  106.             space HORIZ
  107.             */
  108.             endgroup
  109. ;;;
  110. /* ;;; Filetypes */
  111.         group id FTABS REGISTER LABELS 'Images,Sounds,Other'
  112. ;;;
  113. /* ;;; Images */
  114.             group ATTRS MUIA_Group_Columns 3
  115.                 label DOUBLE LEFT '\033b\033uFiletype'
  116.                 label DOUBLE LEFT '\033b\033uCommand'
  117.                 label DOUBLE LEFT '\033b\033uArguments'
  118.                 label DOUBLE LEFT 'IFF Picture'
  119.                     popasl ID IFF0 port PrgPort command '"Check %s"' help '"Command to view IFF pictures"'
  120.                     string ID IFF1 help ArgHelp
  121.                 label DOUBLE LEFT 'GIF Picture'
  122.                     popasl ID GIF0 port PrgPort command '"Check %s"' help '"Command to view GIF pictures"'
  123.                     string ID GIF1 help ArgHelp
  124.                 label DOUBLE LEFT 'JPEG Picture'
  125.                     popasl ID JPG0 port PrgPort command '"Check %s"' help '"Command to view JPEG pictures"'
  126.                     string ID JPG1 help ArgHelp
  127.                 label DOUBLE LEFT 'PNG Picture'
  128.                     popasl ID PNG0 port PrgPort command '"Check %s"' help '"Command to view PNG pictures"'
  129.                     string ID PNG1 help ArgHelp
  130.                 label DOUBLE LEFT 'IFF Anim'
  131.                     popasl ID ANM0 port PrgPort command '"Check %s"' help '"Command to view IFF animations"'
  132.                     string ID ANM1 help ArgHelp
  133.                 label DOUBLE LEFT 'MPEG Video'
  134.                     popasl ID MPG0 port PrgPort command '"Check %s"' help '"Command to view MPEG video"'
  135.                     string ID MPG1 help ArgHelp
  136.                 label DOUBLE LEFT 'Quicktime Video'
  137.                     popasl ID MOV0 port PrgPort command '"Check %s"' help '"Command to view Quicktime movies"'
  138.                     string ID MOV1 help ArgHelp
  139.                 label DOUBLE LEFT 'AVI Video'
  140.                     popasl ID AVI0 port PrgPort command '"Check %s"' help '"Command to view AVI video"'
  141.                     string ID AVI1 help ArgHelp
  142.                 label DOUBLE LEFT 'Adobe PDF'
  143.                     popasl ID PDF0 port PrgPort command '"Check %s"' help '"Command to view Adobe Acrobat PDF files"'
  144.                     string ID PDF1 help ArgHelp
  145.                 space
  146.                 endgroup
  147. ;;;
  148. /* ;;; Sounds */
  149.             group ATTRS MUIA_Group_Columns 3
  150.                 label DOUBLE LEFT '\033b\033uFiletype'
  151.                 label DOUBLE LEFT '\033b\033uCommand'
  152.                 label DOUBLE LEFT '\033b\033uArguments'
  153.                 label DOUBLE LEFT 'IFF Sample'
  154.                     popasl ID SVX0 port PrgPort command '"Check %s"' help '"Command to play IFF samples"'
  155.                     string ID SVX1 help ArgHelp
  156.                 label DOUBLE LEFT 'WAV Sample'
  157.                     popasl ID WAV0 port PrgPort command '"Check %s"' help '"Command to play WAV samples"'
  158.                     string ID WAV1 help ArgHelp
  159.                 label DOUBLE LEFT 'S3M Module'
  160.                     popasl ID S3M0 port PrgPort command '"Check %s"' help '"Command to play S3M modules"'
  161.                     string ID S3M1 help ArgHelp
  162.                 label DOUBLE LEFT 'XM Module'
  163.                     popasl ID XMM0 port PrgPort command '"Check %s"' help '"Command to play XM modules"'
  164.                     string ID XMM1 help ArgHelp
  165.                 label DOUBLE LEFT 'MED Module'
  166.                     popasl ID MED0 port PrgPort command '"Check %s"' help '"Command to play OctaMED modules"'
  167.                     string ID MED1 help ArgHelp
  168.                 label DOUBLE LEFT 'DBM Module'
  169.                     popasl ID DBM0 port PrgPort command '"Check %s"' help '"Command to play DigiBooster modules"'
  170.                     string ID DBM1 help ArgHelp
  171.                 label DOUBLE LEFT 'Other Module'
  172.                     popasl ID MOD0 port PrgPort command '"Check %s"' help '"Command to play other modules"'
  173.                     string ID MOD1 help ArgHelp
  174.                 label DOUBLE LEFT 'MPEG Audio'
  175.                     popasl ID MP30 port PrgPort command '"Check %s"' help '"Command to play MPEG audio"'
  176.                     string ID MP31 help ArgHelp
  177.                 label DOUBLE LEFT 'MIDI'
  178.                     popasl ID MID0 port PrgPort command '"Check %s"' help '"Command to play midi files"'
  179.                     string ID MID1 help ArgHelp
  180.                 space
  181.                 endgroup
  182. ;;;
  183. /* ;;; Others */
  184.             group ATTRS MUIA_Group_Columns 3
  185.                 label DOUBLE LEFT '\033b\033uFiletype'
  186.                 label DOUBLE LEFT '\033b\033uCommand'
  187.                 label DOUBLE LEFT '\033b\033uArguments'
  188.                 label DOUBLE LEFT 'AmigaGuide'
  189.                     popasl ID AGD0 port PrgPort command '"Check %s"' help '"Command to view AmigaGuide documents"'
  190.                     string ID AGD1 help ArgHelp
  191.                 label DOUBLE LEFT 'HTML'
  192.                     popasl ID HTM0 port PrgPort command '"Check %s"' help '"Command to view HTML documents"'
  193.                     string ID HTM1 help ArgHelp
  194.                 label DOUBLE LEFT 'LhA archive'
  195.                     popasl ID LHA0 port PrgPort command '"Check %s"' help '"Command to list LhA archives"'
  196.                     string ID LHA1 help ArgHelp
  197.                 label DOUBLE LEFT 'Default'
  198.                     popasl ID DEF0 port PrgPort command '"Check %s"' help '"Command to show all other file types"'
  199.                     string ID DEF1 help ArgHelp
  200.                 space
  201.                 endgroup
  202.             endgroup
  203.         endgroup
  204. ;;;
  205. /* ;;; Buttons */
  206.     group HORIZ
  207.         button ID SAVE   port PrgPort command '"UsePrefs(1)"' help '"Save the settings to\nyour hard drive"' label 'Save'
  208.         button ID USE    port PrgPort command '"UsePrefs"'  help '"Use the settings for this session"' label 'Use'
  209.         button ID CANCEL port PrgPort command '"Quit"'      help '"Exit without changing the settings"' label 'Cancel'
  210.         endgroup
  211.     endwindow
  212. ;;;
  213. /* ;;; Set application details */
  214. address(GuiPort)
  215. 'application' MUIA_Application_Version VerStr
  216. 'application' MUIA_Application_Author 'Neil Bothwick'
  217. 'application' MUIA_Application_Copyright '© 1999 by Neil Bothwick, Wirenet'
  218. 'application' MUIA_Application_Title 'AACDprefs'
  219. 'application' MUIA_Application_Description 'Search AmigAactive CD, Aminet CD and Aminet index files'
  220. ;;;
  221. /* ;;; Main loop */
  222. call LoadPrefs()
  223. do forever
  224.     call waitpkt(PrgPort)
  225.     packet = getpkt(PrgPort)
  226.     if packet = '0000 0000'x then iterate
  227.     cmd = getarg(packet)
  228.     call reply(packet,0)
  229.     parse var cmd cmd args
  230.     interpret 'call 'cmd'("'args'")'
  231.     end
  232. ;;;
  233. /* ;;; Load prefs */
  234. LoadPrefs:
  235.     /* Load system settings */
  236.     if exists(CDPrefs) then PrefsFile = CDPrefs
  237.     else do
  238.         PrefsFile = DefCDPrefs
  239.         call ShowMsg('No system settings found, using defaults')
  240.         end
  241.     if ~open(prefs,PrefsFile,'R') then do
  242.         call ShowMsg('Failed to read system preferences file')
  243.         exit
  244.         end
  245.     do until eof(prefs)
  246.         PrefsLine = readln(prefs)
  247.         if PrefsLine = '' then iterate
  248.         if pos(left(PrefsLine,1),';#') > 0 then iterate
  249.         if left(PrefsLine,11) = 'CLASS=HTML2' 0 then iterate
  250.         parse var PrefsLine setting '=' value
  251.         interpret 'cycle id' setting 'label' value
  252.         end
  253.     call close(prefs)
  254.  
  255.     /* Load filetype settings */
  256.     if exists(IderPrefs) then PrefsFile = IderPrefs
  257.     else do
  258.         PrefsFile = DefIderPrefs
  259.         call ShowMsg('No filetype settings found, using defaults')
  260.         end
  261.     if ~open(prefs,PrefsFile,'R') then do
  262.         call ShowMsg('Failed to read filetype preferences file')
  263.         exit
  264.         end
  265.  
  266.     PrefsLine = readln(prefs)
  267.     setvar CfgVersion PrefsLine
  268.     ClassCount = 0
  269.     UseOpus = 0
  270.  
  271.     do until eof(prefs)
  272.         PrefsLine = readln(prefs)
  273.         if PrefsLine = '' then iterate
  274.         if pos(left(PrefsLine,1),';#') > 0 then iterate
  275.         ClassCount = ClassCount + 1
  276.         PrefsLine = substr(PrefsLine,pos('CLASS=',upper(PrefsLine)) + 6)
  277.         if left(PrefsLine,1) = '"' then parse var Prefsline '"' Class '"' PrefsLine /*Class = substr(PrefsLine,2,pos('"',PrefsLine,2) - 2)*/
  278.         else parse var PrefsLine Class PrefsLine
  279.         PrefsLine = strip(PrefsLine)
  280.         parse var PrefsLine Defn 'ACTION=' Action
  281.         interpret Class'.cmd="'word(Action,1)'"'
  282.         interpret Class'.arg="'subword(Action,2)'"'
  283.         if ClassCount = 1 & upper(Class) = 'DEFAULT' then UseOpus = 1
  284.         end
  285.     call close(prefs)
  286.  
  287.     cycle id FTYPE label Filetype.UseOpus
  288.     call LoadGadgets('IFF','IFF_picture')
  289.     call LoadGadgets('GIF','GIF_picture')
  290.     call LoadGadgets('JPG','JPEG_picture')
  291.     call LoadGadgets('PNG','PNG_Picture')
  292.     call LoadGadgets('ANM','ANIM')
  293.     call LoadGadgets('MPG','MPEG_Video')
  294.     call LoadGadgets('MOV','Quicktime_Movie')
  295.     call LoadGadgets('AVI','AVI_Video')
  296.     call LoadGadgets('PDF','PDF_file')
  297.     call LoadGadgets('SVX','IFF_Sample')
  298.     call LoadGadgets('WAV','WAV_Sample')
  299.     call LoadGadgets('S3M','S3M_Module')
  300.     call LoadGadgets('XMM','XM_Module')
  301.     call LoadGadgets('MED','MED_Module')
  302.     call LoadGadgets('DBM','DBM_Module')
  303.     call LoadGadgets('MOD','Module')
  304.     call LoadGadgets('MP3','MPEG_Audio')
  305.     call LoadGadgets('MID','MIDI')
  306.     call LoadGadgets('AGD','Guide')
  307.     call LoadGadgets('HTM','HTML')
  308.     call LoadGadgets('LHA','LhA_Archive')
  309.     call LoadGadgets('DEF','Default')
  310.     return
  311. ;;;
  312. /* ;;; Set gadgets */
  313. LoadGadgets:
  314.     NM = arg(1)
  315.     Class = arg(2)
  316.     if symbol(Class'.cmd') = 'VAR' then do
  317.         interpret 'popasl ID 'NM'0 CONTENT 'Class'.cmd'
  318.         interpret 'string ID 'NM'1 CONTENT 'Class'.arg'
  319.         end
  320.     else do
  321.         interpret 'popasl ID 'NM'0 CONTENT "Execute"'
  322.         interpret 'string ID 'NM'1 CONTENT ":CDTools/S/NoAction"'
  323.         end
  324.     return
  325. ;;;
  326. /* ;;; Use prefs */
  327. UsePrefs:
  328.     parse arg sav
  329.  
  330.     /* Save system settings */
  331.     if ~open(prefs,CDPrefs,'W') then call ShowMsg('Failed to save preferences')
  332.     else do
  333.         call writeln(prefs,'# Amiga Active CD preferences - created by AACDprefs' word(sourceline(3),3)'0a'x)
  334.         do i = 1 to words(Settings)
  335.             setting = word(Settings,i)
  336.             cycle id setting
  337.             call writeln(prefs,setting'='result)
  338.             end
  339.         call close(prefs)
  340.         end
  341.  
  342.     /* Save filetype settings */
  343.     do i = 1 to words(FileTypes)
  344.         type = word(FileTypes,i)
  345.         interpret 'popasl ID' type'0'
  346.         command = result
  347.         if command = '' then command = 'Multiview'
  348.         interpret type '= command'
  349.         interpret 'string ID' type'1'
  350.         interpret type '= strip('type' result)'
  351.         end
  352.  
  353.     cycle id FTYPE
  354.     UseOpus = (result == 'Directory Opus')
  355.  
  356.     if ~open(prefs,IderPrefs,'W') then call ShowMsg('Failed to save preferences')
  357.     else do
  358.         call writeln(prefs,'# IDer Prefs file - created by AACDprefs' word(sourceline(3),3)'0a'x)
  359.         call writeln(prefs,'# IDer  --  © 1995 Eclipse Software'||'0a'x)
  360.  
  361.         /* Use Opus prefs */
  362.         if UseOpus = 1 then do
  363.             signal off error
  364.             address command 'version >NIL: dopus5.library 55'
  365.             signal on error
  366.             select
  367.                 when RC = 5 then call ShowMsg('Opus filetypes need as least version 5.5 of Directory Opus')
  368.                 when ~show('P','DOPUS.1') then call ShowMsg('You need to be running Directory Opus as\nWorkbench replacement to use Opus filetypes.')
  369.                 otherwise do
  370.                     call writeln(prefs,'CLASS=Default ACTION=dopus_dclick')
  371.                     /* Ensure dopus_dclick is in path */
  372.                     signal off error
  373.                     address command 'which >NIL: dopus_dclick'
  374.                     if RC = 5 then address command 'copy CDTools/dopus_dclick C: clone'
  375.                     signal on error
  376.                     end
  377.                 end
  378.             end
  379.  
  380.         call writeln(prefs,'CLASS=IFF_Picture OFFSET=0,"FORM????ILBM" ACTION='IFF)
  381.         call writeln(prefs,'CLASS=GIF_Picture SUFFIX=.GIF OFFSET=0,"GIF87a" ACTION='GIF)
  382.         call writeln(prefs,'CLASS=JPEG_Picture OFFSET=6,4A464946 ACTION='JPG)
  383.         call writeln(prefs,'CLASS=PNG_Picture OFFSET=0,89504E47 ACTION='PNG)
  384.         call writeln(prefs,'CLASS=ANIM SUFFIX=.ANIM OFFSET=0,"FORM????ANIM" ACTION='ANM)
  385.         call writeln(prefs,'CLASS=MPEG_Video SUFFIX=.MPG ACTION='MPG)
  386.         call writeln(prefs,'CLASS=Quicktime_Movie SUFFIX=.(MOV|MV|QT) ACTION='MOV)
  387.         call writeln(prefs,'CLASS=AVI_Video SUFFIX=.AVI OFFSET=0,"RIFF" FLAGS=T ACTION='AVI)
  388.         call writeln(prefs,'CLASS=PDF_file SUFFIX=.PDF OFFSET=0,"%PDF" ACTION='PDF)
  389.         call writeln(prefs,'CLASS=IFF_Sample OFFSET=0,"FORM????8SVX" ACTION='SVX)
  390.         call writeln(prefs,'CLASS=WAV_Sample OFFSET=0,"RIFF????WAVE" ACTION='WAV)
  391.         call writeln(prefs,'CLASS=S3M_Module SUFFIX=.S3M NAME=S3M.#? OFFSET=44,"SCRM" FLAGS=T ACTION='S3M)
  392.         call writeln(prefs,'CLASS=XM_Module SUFFIX=.XM OFFSET=0,"Extended Module:" FLAGS=I ACTION='XMM)
  393.         call writeln(prefs,'CLASS=MED_Module SUFFIX=.MED NAME=MED.#? OFFSET=0,"MMD?" ACTION='MED)
  394.         call writeln(prefs,'CLASS=DBM_Module SUFFIX=.DBM OFFSET=0,"DBM0" ACTION='DBM)
  395.         call writeln(prefs,'CLASS=Module SUFFIX=.MOD NAME=MOD.#? OFFSET=1080,"M.K." FLAGS=T ACTION='MOD)
  396.         call writeln(prefs,'CLASS=MPEG_Audio NAME=(#?.MP3|#?.MP2) FLAGS=I ACTION='MP3)
  397.         call writeln(prefs,'CLASS=MIDI SUFFIX=.MID OFFSET=0,"MThd" ACTION='MID)
  398.         call writeln(prefs,'CLASS=Guide SUFFIX=.GUIDE OFFSET=0,"@database" FLAGS=I ACTION='AGD)
  399.         call writeln(prefs,'CLASS=HTML NAME=(#?.html|#?.htm) OFFSET=0,"<html" FLAGS=I ACTION='HTM)
  400.         call writeln(prefs,'CLASS=HTML2 NAME=(#?.html|#?.htm) OFFSET=0,"<!doctype" FLAGS=I ACTION='HTM)
  401.         call writeln(prefs,'CLASS=LhA_Archive NAME=(#?.LhA|?#.Lzh) OFFSET=2,"-lh?-" ACTION='LHA)
  402.         call writeln(prefs,'CLASS=Default ACTION='DEF)
  403.         call writeln(prefs,'0a'x||'#END')
  404.         call close(prefs)
  405.         end
  406.     if sav = 1 then do
  407.         address command 'copy >NIL:' CDPrefs 'ENVARC:'
  408.         address command 'copy >NIL:' IderPrefs 'ENVARC:'
  409.         end
  410.     call Quit()
  411.     return
  412. ;;;
  413. /* ;;; Show about requester */
  414. About:
  415.     request title '"'WinTitle'"' gadgets '"OK"' string VerStr' by Neil Bothwick\nCreated using MUIRexx 3.0a'
  416.     return
  417. ;;;
  418. /* ;;; Load a library */
  419. LoadLib:
  420.     parse arg library
  421.     if show('L',library) then return
  422.     if ~exists('LIBS:'library) then address command 'copy System/Libs/'library 'LIBS: clone quiet'
  423.     if ~addlib(library,0,-30,0) then call ExitMsg('Failed to load' library||'0a'x||'Make sure you have run InitCD')
  424.     return
  425. ;;;
  426. /* ;;; Check for a circular reference */
  427. Check:
  428.     arg prog
  429.     prog = strip(prog)
  430.     select
  431.         when prog = 'AACDFILE' then call ShowMsg('You cannot use AACDfile here')
  432.         when prog = 'CUCDFILE' then call ShowMsg('You cannot use CUCDfile here')
  433.         when prog = 'IDER' then call ShowMsg('You cannot use IDer here')
  434.         when pos(right(prog,9), '/AACDFILE :AACDFILE') > 0 then call ShowMsg('You cannot use AACDfile here')
  435.         when pos(right(prog,9), '/CUCDFILE :CUCDFILE') > 0 then call ShowMsg('You cannot use CUCDfile here')
  436.         when pos(right(prog,5), '/IDER :IDER') > 0 then call ShowMsg('You cannot use IDer here')
  437.         otherwise nop
  438.         end
  439.     return
  440. ;;;
  441. /* ;;; ShowMsg */
  442. ShowMsg:
  443.     parse arg msg
  444.     'request id MAIN title "'WinTitle'" gadgets "OK" string' msg
  445.     return
  446. ;;;
  447. /* ;;; Error handler */
  448. Error:
  449.     address command 'requestchoice >NIL: "error" "Error' RC 'in line' sigl'" "OK"'
  450.     if RC = 5 then return
  451.     call ShowMsg('Error' RC 'in line' sigl)
  452.     call Quit()
  453.     return
  454. ;;;
  455. /* ;;; Quit */
  456. Quit:
  457.     address(GuiPort)
  458.     'QUIT'
  459.     exit
  460. ;;;
  461.  
  462.