home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / icssrexx.zip / REXXRECO.CMD < prev   
OS/2 REXX Batch file  |  1994-05-05  |  5KB  |  132 lines

  1. /******************************************************************************/ 
  2. /*                                                                            */ 
  3. /* COPYRIGHT:                                                                 */ 
  4. /* ----------                                                                 */ 
  5. /* Copyright (C) International Business Machines Corp., 1994.                 */ 
  6. /*                                                                            */ 
  7. /* DISCLAIMER OF WARRANTIES:                                                  */ 
  8. /* -------------------------                                                  */ 
  9. /* The following [enclosed] code is sample code created by IBM                */ 
  10. /* Corporation.  This sample code is not part of any standard IBM product     */ 
  11. /* and is provided to you solely for the purpose of assisting you in the      */ 
  12. /* development of your applications.  The code is provided "AS IS",           */ 
  13. /* without warranty of any kind.  IBM shall not be liable for any damages     */ 
  14. /* arising out of your use of the sample code, even if they have been         */ 
  15. /* advised of the possibility of such damages.                                */ 
  16. /*                                                                            */ 
  17. /******************************************************************************/ 
  18.  
  19. /*******************************************************************/
  20. /*                                                                 */
  21. /* Sample program for ICSS REXX interface.                         */
  22. /*                                                                 */
  23. /* Usage: rexxreco <verbose_level>                                 */
  24. /*                                                                 */
  25. /*     verbose_level:  controls level of output from ICSS.         */
  26. /*                     0 = none, default is 2.                     */
  27. /*                                                                 */
  28. /*******************************************************************/
  29. /* Notes:  This program uses default values for ICSS API calls.    */
  30. /*         If your profile is set up to use MMPM, you will need to */
  31. /*         run this program using PMREXX.  If you are using an     */
  32. /*         ACPA card without MMPM, simply run this program from    */
  33. /*         the command line.                                       */
  34. /*******************************************************************/
  35.  
  36. arg verbose_level
  37.  
  38. if verbose_level = "" then
  39.    verbose_level = 2
  40.  
  41. say "This is REXXRECO.CMD, verbose level is" verbose_level
  42.  
  43. /*------symbolic values copied from icssapi.h-------------------------*/
  44. default_int = '-1';
  45. default_flt = '-2.0';
  46. default_str = '';
  47.  
  48. /* register the ICSS function loader */
  49.  
  50. call RxFuncAdd 'LoadFunctions', 'ICSSREXX', 'LoadFunctions' 
  51. call LoadFunctions  /* load the ICSS functions */
  52.  
  53. /* Start ICSS */
  54.  
  55. icss_rc = ICRXStart(default_str)
  56. say '@@ Start returned: ' icss_rc
  57. say;
  58.  
  59. icss_rc = ICRXStartConversation(default_str,default_int,default_str,default_int)
  60. say '@@ StartConversation returned: ' icss_rc
  61. say;
  62.  
  63. /* Example of SetValue */
  64. parmid = 10;  /* Verbose Level */  
  65. say; 
  66. say 'Setting Verbose Level...';
  67. icss_rc = ICRXSetValue(parmid, verbose_level);
  68. say '@@ SetValue returned:' icss_rc; 
  69.  
  70.  
  71. say; 
  72. icss_rc = ICRXGetValue(parmid);
  73. parse var icss_rc real_rc parm_value;
  74. say '@@ GetValue returned:' real_rc 'with parm value:' parm_value 'for Verbose Level';
  75.  
  76. /* Load the context */
  77.  
  78. context_name = 'RL.CTX';
  79.  
  80. say 'Loading context' context_name;  
  81. icss_rc = ICRXLoadContext(context_name,default_flt,default_flt,default_flt)
  82. parse var icss_rc temp_rc handle
  83. say '@@ LoadContext returned: ' temp_rc ' with handle: ' handle
  84.  
  85. say "Initialization complete!  Press any key to continue."
  86. pull junk
  87.  
  88. answer = "Y"
  89.  
  90. /* Loop until the user responds with something other than "Y" */
  91.  
  92. do while answer = "Y"
  93.    say ' '
  94.  
  95.    icss_rc = ICRXListen(handle,'5','')  
  96.    say '@@ Listen returned: ' icss_rc
  97.    say ' '
  98.    say '@@ -->BEGIN SPEAKING<--'
  99.    
  100.    icss_rc = ICRXGetSpokenWords()              
  101.    parse var icss_rc temp_rc too_soon utt_len acq_time reco_time buff 
  102.    say '@@ GetSpokenWords returned:'
  103.    say '@@               words: ' buff
  104.    say '@@         return code: ' temp_rc
  105.    say '@@            too soon: ' too_soon
  106.    say '@@    utterance length: ' utt_len
  107.    say '@@    acquisition time: ' acq_time
  108.    say '@@    recognition time: ' reco_time
  109.    say '  '
  110.  
  111.    say 'Another Reco (Y/N)?'
  112.    pull answer
  113. end 
  114.  
  115. say "OK, Cleaning up..."
  116. icss_rc = ICRXRemoveContext(handle);
  117. say '@@ RemoveContext returned:' icss_rc
  118.  
  119. icss_rc = ICRXEndConversation()
  120. say '@@ EndConversation returned: ' icss_rc
  121.  
  122. icss_rc = ICRXEnd();  
  123. say '@@ End returned: ' icss_rc
  124.  
  125. /*-------------------------------*/
  126.  
  127. call DropFunctions     /* not strictly necessary, perhaps */
  128.  
  129. say "All Done!"
  130. exit
  131.  
  132.