home *** CD-ROM | disk | FTP | other *** search
- /* 09-27-90 M.C. Smith */
- /***********************************************************************/
- /* RexCOMM.CMD */
- /* Purpose: test the functions of the RxCOMM dll package. Creates a */
- /* "dumb" terminal program in REXX using the comm DLL. */
- /* */
- /* NOTE: This code has been released into the Public Domain by the */
- /* author. This code has NOT been extensivly tested, being a */
- /* 3 hour development project that was abandoned due to the */
- /* performance of the REXX interpreter under OS/2. If you find */
- /* any bugs, or would like to contact the author, he can */
- /* be reached at: */
- /* */
- /* Copyright (c) 1990 by: Mark C. Smith */
- /* 2638 Marrietta */
- /* Farmersvilles, Tx 75234 */
- /* */
- /* 214/484-4470 */
- /* */
- /* */
- /***********************************************************************/
-
- Address CMD /* Pass all commands to environment */
- Arg handle /* Should be our COM port */
-
- call Initial
-
- Do FOREVER
- If chars() > 0 Then /* Characters available at keyboard? */
- Do
- char = RxGetChar(NOECHO)
- If char = 'F1' Then
- Leave
- Else
- call RxCommPut handle, char
- End /* IF chars() > 0 */
-
- If RxCommCheck(handle) > 0 Then
- Call RxSay RxCommGet(handle)
-
- End /* Do FOREVER */
-
- /* Ending - close our comm port */
-
- call RxCommClose handle
-
- '@Cls'
-
- Say 'REXXCOMM ended successfully'
-
- EXIT 0
-
- /************************************************************************/
- /* LoadFunctions: load our DLL library and register it with REXX/SAA */
- /************************************************************************/
-
- LoadFunctions:
-
- call RxFuncAdd 'RxCommOpen' , 'RXCOMM', 'RXCOMMOPEN'
- call RxFuncAdd 'RxCommClose' , 'RXCOMM', 'RXCOMMCLOSE'
- call RxFuncAdd 'RxCommPut' , 'RXCOMM', 'RXCOMMPUT'
- call RxFuncAdd 'RxCommGet' , 'RXCOMM', 'RXCOMMGET'
- call RxFuncAdd 'RxCommGetParams', 'RXCOMM', 'RXCOMMGETPARAMS'
- call RxFuncAdd 'RxCommSetParams', 'RXCOMM', 'RXCOMMSETPARAMS'
- call RxFuncAdd 'RxCommSendBreak', 'RXCOMM', 'RXCOMMSENDBREAK'
- call RxFuncAdd 'RxCommCheck' , 'RXCOMM', 'RXCOMMCHECK'
- call RxFuncAdd 'RxCommSetDTR' , 'RXCOMM', 'RXCOMMSETDTR'
- call RxFuncAdd 'RxCommFlush' , 'RXCOMM', 'RXCOMMFLUSH'
- call RxFuncAdd 'RxGetChar' , 'RXCOMM', 'RXGETCHAR'
- call RxFuncAdd 'RxSay' , 'RXCOMM', 'RXSAY'
-
- Return
-
- /*************************************************************************/
- /* Initial: set up our environment */
- /*************************************************************************/
-
- Initial:
-
- blank = ' '
- true = 1
- false = 0
-
- ocd = blank
-
- handle = Strip(handle)
-
- If SubStr(handle,1,3) \= 'COM' Then
- Do
- Say 'RexComm: Unknown COMM port.'
- Say
- Say 'Usage RexComm x'
- Say ' where x is a valid comm port'
- Exit 98
- End /* If handle = '' | handle = '?' */
-
- call LoadFunctions
-
- '@Cls'
-
- Say 'REXX/SAA COMM version 1.00 test program'
-
- /* Open the Communications port - theoretically we SHOULD test the result */
- /* since the port might be in use by another process. However, as this */
- /* is just a test, I will not. Note that RxCommOpen() will return a bad */
- /* return code on failure (-2). */
-
- call RxCommOpen handle
-
- /* Set up our comm port to the proper baud rate etc. */
-
- call RxCommSetParams handle, 2400, 8, 'NONE', 1
-
- Say "Press 'F1' to end communications."
- Say
-
- '@Ansi ON'
-
- Return
-