home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / netdor3.zip / DISK_13 / IMAGE12.ZIP / CATALOG / ITKAPPS.CMD < prev    next >
OS/2 REXX Batch file  |  1993-09-21  |  4KB  |  128 lines

  1. /*****************************************************************************
  2.  *              Catalog backend for Image Toolkit Applications:              *
  3.  *                          IBROW, MAGNIFY, PMDRAW                           *
  4.  *****************************************************************************
  5.  *                    Licensed Materials-Property of IBM                     *
  6.  *               5604-472 (c) Copyright IBM Corporation, 1993                *
  7.  *                           All rights reserved.                            *
  8.  *                  US Government Users Restricted Rights -                  *
  9.  *                 Use, duplication or disclosure restricted                 *
  10.  *                by GSA ADP Schedule Contract with IBM Corp.                *
  11.  ****************************************************************************/
  12. trace '0'
  13. signal on syntax
  14. signal on novalue
  15. call on halt
  16. call rxfuncadd 'CADDINIT', 'RXCADD', 'CADDINIT'
  17. Ver = 'CAddInit'()
  18. if abbrev(Ver, 'ERROR:')
  19.   then exit 200
  20. Title = RxCAdd.STitle 'Installation'
  21. XCode = 0
  22. select
  23.   when RxCAdd.OpType = 'ADD'
  24.     then do
  25.       XCode = InstallTK()
  26.     end
  27.   when RxCAdd.OpType = 'REMOVE'
  28.     then nop
  29.   otherwise do
  30.     call 'MessageBox' Title, 'Unexpected operation type "'RxCAdd.OpType'"'
  31.     XCode = 201
  32.   end
  33. end
  34. call AddExit XCode
  35.  
  36. InstallTK: procedure
  37. call RxFuncAdd 'RXCOUINFO', 'COUENV', 'RXCOUINFO'
  38. CoreDir = RxCouInfo('GET', 'REMOTE')
  39. if CoreDir = '0' | Abbrev(CoreDir, 'ERROR:') then do
  40.    XCode = 1
  41.    Msg = 'Error: unable to query COUENV'
  42. end; else do
  43.    '@'CoreDir'IMAGETK\ITKINSTA /IITKFMT16'
  44.    XCode = rc
  45.    if XCode = 0 | XCode = 3 | XCode = 4 then do
  46.       XCode = 0
  47.       Msg = ''
  48.    end; else do
  49.       Msg = 'Error' XCode 'occurred - toolkit not installed.'
  50.    end
  51. end
  52. if Msg <> ''
  53.   then call 'MessageBox' 'Image Toolkit Installation', Msg
  54. return XCode
  55.  
  56. RunItl: procedure expose RXCADD.
  57. parse arg ItlName
  58. CDr = rxCouInfo('GET', 'REMOTE')
  59. List = 'VERSION STITLE OPTYPE PREVIOUS'
  60. do I = 1 to words(List)
  61.   Name = 'RXCADD.'word(List, I)
  62.   call value Name, value(Name), 'OS2ENVIRONMENT'
  63. end I
  64. do I = 1 to RXCADD.PROGINFO.0
  65.   call value 'RXCADD.PROGINFO.'I, RXCADD.PROGINFO.I, 'OS2ENVIRONMENT'
  66. end I
  67. if pos('\', ItlName) = 0
  68.   then do
  69.     parse source . . Me
  70.     ItlName = left(Me, lastpos('\', Me))||ItlName
  71.   end
  72. '@CALL' CDr'IMPIT.CMD /R:'ItlName '/NOPAUSE'
  73. return rc
  74.  
  75. AddExit:
  76. parse arg XCode, Msg
  77. if XCode = ''
  78.   then XCode = 0
  79. if Msg <> ''
  80.   then call 'MessageBox' Title, Msg
  81. call 'CAddComplete' XCode
  82. call 'CAddExit'
  83. exit XCode
  84.  
  85. /***********************************************************************
  86.  *                             ERROR TRAPS                             *
  87.  ***********************************************************************/
  88. BugInit:
  89. signal off error; signal off failure; signal off halt
  90. signal off novalue; signal off notready; signal off syntax
  91. parse upper source . . Me
  92. if symbol('TITLE') = 'LIT'
  93.   then Title = 'COREADD Failure'
  94. Me = Me':'||'0A'x
  95. if symbol('GLOBALS') = 'LIT'
  96.   then do
  97.     Globals = 'TrVal'
  98.     TrVal = 'O'
  99.   end
  100. return
  101.  
  102. Halt:
  103. Where = SigL
  104. call BugInit
  105. call 'MessageBox' Title, Me||'Execution halted by user in line' Where
  106. XXC = 204
  107. signal DebugExit
  108.  
  109. Syntax:
  110. Where = SigL
  111. call BugInit
  112. call 'MessageBox' Title,,
  113.     Me||'Syntax error' rc '('errortext(rc)') in line' Where'.'
  114. XXC = 203
  115. signal DebugExit
  116.  
  117. Novalue:
  118. Where = SigL
  119. call BugInit
  120. call 'MessageBox' Title, Me||'NOVALUE error ('condition('D')') in line' Where'.'
  121. XXC = 203
  122. signal DebugExit
  123.  
  124. DebugExit:
  125. call 'CAddComplete' XXC
  126. call 'CAddExit'
  127. exit XXC
  128.