home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / imm_110.zip / RXX19.ZIP / rxextras.cmd next >
OS/2 REXX Batch file  |  1994-01-26  |  6KB  |  234 lines

  1. /* RxExtras - test for all functions in RxExtras.DLL */
  2. Address CMD
  3. /* rcy =  RxFuncDrop('RxExtra') */
  4.  
  5. If RxFuncQuery('RxExtra') <> 0 Then
  6.     rcy = RxFuncAdd('RxExtra', 'RxExtras', 'RxExtra')
  7.  
  8. Call RxExtra "Drop" /* Drop everything */
  9. rcy = RxFuncAdd('RxExtra', 'RxExtras', 'RxExtra')
  10. Say 'Using version 'RxExtra("Load")' of RxExtras'
  11.  
  12. Say
  13. Say "Testing RxBootDrive and RxRead..."
  14. Call RxRead 'stem.', RxBootDrive()":"'\CONFIG.SYS'
  15. Say "Your Config.Sys file should now appear"
  16. "@PAUSE"
  17. Do i = 1 to stem.0
  18.    Say stem.i
  19. end /* do */
  20. "@PAUSE"
  21.  
  22. Say
  23. Say "Testing RxBootDrive by itself"
  24. Say 'Your bootdrive is 'RxBootDrive()":"
  25. "@PAUSE"
  26.  
  27. temp.0 = 5
  28. temp.1 = "This is a test file"
  29. temp.2 = "With this ring, I thee bed"
  30. temp.3 = "The worlds smallest handcuff"
  31. temp.4 = "How to win fiends and affluent people"
  32. temp.5 = "### The last line ###"
  33.  
  34. Say
  35. Say "Testing RxWrite by writing 5 lines to \TEMP.DAT"
  36. Call RxWrite "temp.", "\temp.dat"
  37. Say "Here is \TEMP.DAT"
  38. "@type \temp.dat | more"
  39. "@PAUSE"
  40. "@DEL \temp.dat"
  41.  
  42. Say
  43. Say "Testing RxVolumeLabel"
  44. Say "Label of C is "RxVolumeLabel("C")
  45. "@PAUSE"
  46.  
  47. Say
  48. Drop stem.
  49. Drop temp.
  50. temp.1 = 1
  51. temp.testing = "Testing is on" 
  52. temp.2 = 3
  53. temp.testing.1 = "Life be in it"
  54. Say "Testing RxVarDump - dumping all 'local' variables"
  55. Call RxVarDump 'vars.'
  56. Do i = 1 to vars.0
  57.   Say 'Variable Name:"'vars.i.name'" has the value: "'vars.i.value'"'
  58. End
  59. Drop vars.
  60. "@PAUSE"
  61.  
  62. Say
  63. Say "Testing RxStemCopy"
  64. Say "Copy all variables from temp. to temp2."
  65. Say "See RxVarDump above for temp. variables"
  66.  
  67. Call RxStemCopy "temp.", "temp2."
  68.  
  69. Say "Now we have..."
  70. Call RxVarDump 'vars.'
  71. Do i = 1 to vars.0
  72.   Say 'Variable Name:"'vars.i.name'" has the value: "'vars.i.value'"'
  73. End
  74. Drop vars.
  75. "@PAUSE"
  76.  
  77. Say
  78. Say "Testing RxSort"
  79. temp.0 = 16
  80. temp.1 = "This is a list"
  81. temp.2 = "a List should be sorted"
  82. temp.3 = "upper and Lowercase"
  83. temp.4 = "$trange"
  84. temp.5 = "#unny"
  85. temp.6 = "@nd unusual"
  86. temp.7 = "12345"
  87. temp.8 = "123456"
  88. temp.9 = "One isthe 9"
  89. temp.10 = "Ten green bottles 10"
  90. temp.11 = "Legs 11"
  91. temp.12 = "And then some 12"
  92. temp.13 = "Hollow weeing 13"
  93. temp.14 = "Only 14"
  94. temp.15 = "15"
  95. temp.16 = "The last line!"
  96. Say
  97. Say "The unsorted list is..."
  98. Say Copies('-', 50)
  99. Do i = 1 to temp.0
  100.     Say temp.i
  101. end /* do */
  102. Say Copies('-', 50)
  103. "@PAUSE"
  104. Say
  105. Say "Sorting in descending order gives..."
  106. Call RxSort 'temp.', 'Descending'
  107. Say Copies('-', 50)
  108. Do i = 1 to temp.0
  109.     Say temp.i
  110. end /* do */
  111. Say Copies('-', 50)
  112. "@PAUSE"
  113. Say
  114. Say "Sorting in ascending order gives..."
  115. Call RxSort 'temp.', 'Asc'
  116. Say Copies('-', 50)
  117. Do i = 1 to temp.0
  118.     Say temp.i
  119. end /* do */
  120. Say Copies('-', 50)
  121. "@PAUSE"
  122.  
  123. Say
  124. Say "Testing RxSwitchTo"
  125. Say "Switching to the desktop, hit Ctrl-Alt-Shift-O to see developers"
  126. /* RxSwitchTo works by matching as much of the string as you give it
  127.  * to the first session.
  128.  * i.e. Call RxSwitchTo "System C"
  129.  * Will switch to the system clock.
  130.  */
  131. Call RxSwitchTo "OS"
  132. If POS("Switch", result) <> 0 Then Do /* probably 2.1 */
  133.   Call RxSwitchTo "Desktop"
  134. End
  135. "@PAUSE"
  136.  
  137. Say
  138. Say "Testing RxQuerySwitchListo"
  139. Say "The programs running should now appear."
  140. Call RxQuerySwitchList "temp."
  141. Do i = 1 to temp.0
  142.    Say "Tite: "temp.i ", Hwnd: "temp.i.hwnd", Process Id: "temp.i.pid
  143. End /* do */
  144. "@PAUSE"
  145.  
  146. Say
  147. Say "Testing RxQueryDriveType for Drive C:"
  148. Say RxQueryDriveType("C:")
  149. "@PAUSE"
  150.  
  151. BD = RxBootDrive()
  152. PathToSearch = BD":\OS2;"BD":\OS2\INSTALL"
  153. Say
  154. Say "Testing RxSearchPath looking for DATABASE.TXT in \OS2 and \OS2\INSTALL"
  155. Say RxSearchPath(PathToSearch, 'DATABASE.TXT')
  156. "@PAUSE"
  157.  
  158. Say
  159. Say "Testing Global variables"
  160. Call RxSetGlobal "SETTINGS.TX1", "This is shared memory!"
  161. Say "The text 'This is shared memory!' should now appear..."
  162. Say RxGetGlobal('settings.tx1')
  163. "@PAUSE"
  164.  
  165. Say
  166. Say "Testing RxLineCount"
  167. LC = RxLineCount(RxBootDrive()':\config.sys')
  168. Say 'There are 'LC' lines in the your CONFIG.SYS file'
  169. "@PAUSE"
  170.  
  171. Say
  172. Say "Testing RxGetEXEName"
  173. Say "The command line for this program was '"RxGetEXEName()"'"
  174. "@PAUSE"
  175.  
  176. Say
  177. Say "Testing RxNap"
  178. Say "This program should appear to sleep for half a second"
  179. Call RxNap 500
  180. "@PAUSE"
  181.  
  182. Say
  183. Say "Testing RxFileExists"
  184. If (RxFileExists(RxBootDrive()":\CONFIG.SYS")) Then
  185.     Say "I found your CONFIG.SYS!"
  186. "@PAUSE"
  187.  
  188. Say
  189. Say "Testing RxKillProcess"
  190. Say "Please note the following output for processes to kill"
  191. Say "(and remember to convert the process from hex to decimal)"
  192. "@PSTAT /C | MORE"
  193. Call Charout ,"Enter a process id to be killed ?"
  194. Parse Pull id
  195. Say "Kill process returned: "RxKillProcess(id)
  196. "@PAUSE"
  197.  
  198. Say
  199. Say "Testing RxAddFileHandles"
  200. Say "There are currently "RxAddFileHandles(0)" handles available."
  201. Say "Now adding 25 more. Now "RxAddFileHandles(25)" handles available."
  202. "@PAUSE"
  203.  
  204. Say
  205. Say "Testing RxSetFileHandles"
  206. Say "There are currently "RxAddFileHandles(0)" handles available"
  207. Say "Now setting this to 100."
  208. Call RxSetFileHandles 100
  209. Say "Now "RxAddFileHandles(0)" handles available."
  210. "@PAUSE"
  211.  
  212. Say
  213. Say "Testing RxMatchWildCard"
  214. MF = 'MYFILE.cmd'
  215. WC = '*.cmd'
  216. Result = RxMatchWildCard(MF, WC)
  217. If Result = MF Then 
  218.     Say '   'MF' matches Wildcard 'WC' (Edited name is:'Result')'
  219. Else
  220.     Say '   'MF' does not match Wildcard 'WC' (Edited name is:'Result')'
  221. MF = 'MYFILE.cmd'
  222. WC = '*.bbb'
  223. Result = RxMatchWildCard(MF, WC)
  224. If Result = MF Then 
  225.     Say '   'MF' matches Wildcard 'WC' (Edited name is:'Result')'
  226. Else
  227.     Say '   'MF' does not match Wildcard 'WC' (Edited name is:'Result')'
  228.  
  229. Say
  230. Say "All testing is now over..."
  231. "@PAUSE"
  232.  
  233. Call RxExtra "Drop"
  234.