home *** CD-ROM | disk | FTP | other *** search
- /************************/
- /* iSpell.rexx 1.9 */
- /* Brecht Machiels 1999 */
- /************************
- $VER: iSpell v1.9
- $AUTHOR: Copyright © 1999 Brecht Machiels
- $DESCRIPTION: Checks spelling in YAM with nice GUI
- *********************/
-
- SCREEN = 'Workbench'
-
- BINPATH = "iSpell:bin/" /* iSpell binaries path */
- LIBPATH = "iSpell:lib/" /* iSpell dictionaries path */
-
- LANGUAGE.0 = 2 /* Number of languages */
- LANGUAGE.1 = "English" /* Language #1 */
- LANGUAGE.2 = "Nederlands" /* Language #2 */
- /* You can add languages(upto 9)*/
- /*********/
-
- Window_PublicScreen = 0x804278e4 /* V6 isg STRPTR */
- Group_Rows = 0x8042b68f /* V4 is. LONG */
- Group_Spacing = 0x8042866d /* V4 is. LONG */
-
- MUIV_List_Insert_Bottom = -3
-
- /**/
-
- OPTIONS RESULTS
-
- ADDRESS ISPELLMR
-
- window ID MAIN COMMAND 'quit' PORT ISPELLMR TITLE 'iSpell' ATTRS Window_PublicScreen SCREEN
- group HORIZ
- group
- text ID TWORD LABEL '\n\n\033cLoading dictionary\n\n'
- group HORIZ ATTRS Group_Rows 2 Group_Spacing 0
- button ID NEXT HELP '"Ignore this word & continue checking"' LABEL 'Next'
- button ID ACCPT HELP '"Accept this word for this session"' LABEL 'Accept'
- button ID ADD HELP '"Add this word to the private dictionary"' LABEL 'Add'
- button ID RSTRT HELP '"Restart at the beginning of the document"' LABEL 'Restart'
- button ID STOP HELP '"Stop checking of the document"' LABEL 'Stop'
- button ID EXIT HELP '"Stop checking & exit iSpell"' LABEL 'Exit'
- endgroup
- endgroup
- list ID SLST
- endgroup
- endwindow
-
- call pragma('D', BINPATH)
- call pragma('S', 8192)
-
- languages=""
- if language.0 > 1 then do
- languages=language.1
- langnr=language.0
- do langnr=2 to language.0
- languages=languages||"|"||language.langnr
- end
- end
- else languages=language.1
-
- languages=languages||"|_Quit"
- Address 'YAM' 'REQUEST "Select the language:" "'languages'"'
-
- SELECT
- WHEN result=0 then exit
- WHEN result=1 then call SelLang(language.1)
- WHEN result=2 then call SelLang(language.2)
- WHEN result=3 then call SelLang(language.3)
- WHEN result=4 then call SelLang(language.4)
- WHEN result=5 then call SelLang(language.5)
- WHEN result=6 then call SelLang(language.6)
- WHEN result=7 then call SelLang(language.7)
- WHEN result=8 then call SelLang(language.8)
- WHEN result=9 then call SelLang(language.9)
- OTHERWISE call exit
- end
-
- SelLang:
- language=arg(1)
- if show('P', 'IRexxSpell') then do
- address 'IRexxSpell' quickcheck LANGUAGE
- if result = 'bad' then do
- address 'IRexxSpell' exit
- address command "run <nil: >nil: "BINPATH"iSpell -d"LANGUAGE" -p"LIBPATH""LANGUAGE" -r >nil: <nil:"
- address command "waitforport IRexxSpell"
- end
- end
- else do
- address command "run <nil: >nil: "BINPATH"iSpell -d"LANGUAGE" -p"LIBPATH""LANGUAGE" -r >nil: <nil:"
- address command "waitforport IRexxSpell"
- end
- CALL Start
- return
-
- Start:
- Address 'YAM' 'WRITEEDITOR "'POSITION sof'"'
-
- do forever
- Address 'YAM' 'WRITEEDITOR GETCURSOR'
- wordpos = result + 1
- Address 'YAM' 'WRITEEDITOR GETLINE'
- temp = subword(substr(result, wordpos), 1, 1)
- check = compress(temp, '.?!()')
-
- if check = '' then CALL stop
- if verify(check, ';:/_&|@"#''§^ç<>{}°©1234567890[]®', 'm') ~= 0 then
- Address 'YAM' 'WRITEEDITOR "'NEXT word'"'
- else do
- Address 'IRexxSpell' 'QUICKCHECK 'check''
- result = checkword
- if checkword = 'bad' then do
- text ID TWORD LABEL '\n\033c"\033b'checkword'\033n" is spelled incorrectly\n\n\033cSelect an option'
- address 'IRexxSpell' check checkwork
- r = result
- r1 = substr(r,1,1)
- select
- when r1 = '#' then suggest = "No_Suggestions"
- when r1 = '&' then do
- rt = space(compress(r,'&1234567890:')
- suggest = rt
- end
- otherwise suggest = checkword
- end
- index = 0
- do index = index + 1 while index ~= words(suggest) + 1
- list ID SLST INSERT POS MUIV_List_Insert_Bottom STRING subword(suggest,index,1)
- end
- do forever
- callhook ID SLST COMMAND 'CALL ReplaceWord(%s);leave' PORT ISPELLMR
- callhook ID NEXT COMMAND 'Address 'YAM' 'WRITEEDITOR "'NEXT word'"';leave' PORT ISPELLMR
- callhook ID ADD COMMAND 'Address 'IRexxSpell' 'ADD 'check'';leave' PORT ISPELLMR
- callhook ID ACCPT COMMAND 'Address 'IRexxSpell' 'ACCEPT 'translate(check, "abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ");leave' PORT ISPELLMR
- callhook ID RSTRT COMMAND 'CALL Start' PORT ISPELLMR
- callhook ID STOP COMMAND 'exit' PORT ISPELLMR
- callhook ID EXIT COMMAND 'CALL CleanExit' PORT ISPELLMR
- end
- Address 'YAM' 'WRITEEDITOR "'NEXT word'"'
- end
- end
- end
-
- ReplaceWord:
- newword=arg(1)
- Address 'YAM' 'WRITEEDITOR "'MARK on'"'
- Address 'YAM' 'WRITEEDITOR "'NEXT word'"'
- Address 'YAM' 'WRITEEDITOR "'CURSOR left'"'
- Address 'YAM' 'WRITEEDITOR "'ERASE'"'
- Address 'YAM' 'WRITEEDITOR "'TEXT newword'"'
- Address 'YAM' 'WRITEEDITOR "'NEXT word'"'
- return
-
- CleanExit:
- Address 'IRexxSpell' 'EXIT'
- exit
-
-