home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / spellgrd.zip / rx_samp.cmd < prev    next >
OS/2 REXX Batch file  |  1996-09-03  |  2KB  |  69 lines

  1. /*                                                                   */
  2. /* Tests the REXX interface to SpellGuard                            */
  3. /*                                                                   */
  4. /*   opens the dictionary                                            */
  5. /*   finds the word "test"                                           */
  6. /*   does not find the word "tesst"                                   */
  7. /*   matches the word "tesst"                                         */
  8. /*   prints out the matches of "tesst" along with their               */
  9. /*    similarity index                                               */
  10. /*   closes the dictionary                                           */
  11. /*                                                                   */
  12. PARSE ARG
  13. SIGNAL ON HALT NAME STOP
  14.  
  15. call RxFuncAdd 'LoadRxGrdFuncs', 'RXGRD', 'LoadRxGrdFuncs'
  16. words.0=0
  17. call LoadRxGrdFuncs
  18. ret=RxSGOpenDictionary("spellgrd.dct","words.usr","spellgrd.ini")
  19.  
  20. /* 0 is everything okay - 3 just means words.usr not found */
  21. IF ((ret=0) | (ret=3)) THEN
  22.    bOkay=TRUE
  23. ELSE
  24.    bOkay=FALSE
  25.  
  26. IF (bOkay=FALSE) THEN
  27. DO
  28.    say "ret from Open was " ret
  29. END
  30. ELSE
  31. DO
  32.    ret=RxSGFindWord("test")
  33.    IF (ret = 0) THEN
  34.    DO
  35.       SAY "test not found"
  36.    END
  37.    ELSE
  38.    DO
  39.       SAY "test found"
  40.    END
  41.    ret=RxSGFindWord("tesst")
  42.    IF (ret = 0) THEN
  43.    DO
  44.       SAY "tesst  not found"
  45.       SAY "now running a match for tesst"
  46.       ret=RxSGMatchWord("tesst",75,"words")
  47.       IF (ret = 0) THEN
  48.       DO
  49.          SAY "no matches found"
  50.       END
  51.       ELSE
  52.       DO
  53.          SAY words.0 " matches found "
  54.          DO I=1 to words.0
  55.            SAY words.I.word "-" words.I.index
  56.          END
  57.       END
  58.    END
  59.    ELSE
  60.    DO
  61.       SAY a_word "found"
  62.    END
  63.    CALL RxSGCloseDictionary
  64. END
  65. EXIT
  66.  
  67. STOP:
  68.    CALL RxSGCloseDictionary
  69.