home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / rexxtr.zip / rxextras.cmd next >
OS/2 REXX Batch file  |  1995-12-17  |  7KB  |  292 lines

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