/*  (c) 05.03.95: Michael Bock, Vorwärtsstraße 5, D-44139 Dortmund
 *               e-mail: nightfire@blanker.ruhr.de
 *
 *           ISpell Rechtschreibkorrektur  -Arexx Skript-
 *                         für TeXtPlus
 */ v0.14

options results

  address 'TextPlus' WLeft

tflag = 1

do while (tflag=1)


  address 'TextPlus' GetWord


    select
     when substr(result,1,1)='$' then address 'TextPlus' WRight
     when substr(result,1,1)='\' then address 'TextPlus' WRight
     when substr(result,1,3)='TeX' then  address 'TextPlus' WRight

OTHERWISE
 select
     when  substr(result,length(result),1) ='.'
     then  result = substr(result,1,length(result)-1)
     when  substr(result,length(result),1) =','
     then  result = substr(result,1,length(result)-1)

     when  substr(result,length(result),1) ='}'
     then  result = substr(result,1,length(result)-1)

     otherwise end
  zwi = result
  if rc =1 then tflag = 0



  address 'IRexxSpell' check result
  r = result
  r1 = substr(r,1,1)

  if r1 ='#' then
  
    do
      address 'TextPlus' Display 'ISpell Rexx Check © 04.03.95 Michael Bock'

       hailstring = 'Wort unbekannt :'
       defstring = zwi

       address 'TextPlus' RequestString hailstring'\\'defstring
       if zwi = result then zwi = result
       else
       do
       if result =''  then 
                   do
                    hailstring ='Wort in Bibliothek aufnehmen ?'
                    address 'TextPlus' RequestString hailstring'\\'defstring
                    if result ='' then tflag =0
                       else address 'IRexxSpell' add defstring
                    end
                      
                      
                      
                      else     do

                                zwi = result

                                address 'TextPlus' WDelRight
                                address 'TextPlus' Type zwi' '
                               end
       end

    end

    if r1='&' then
    
    do
       address 'TextPlus' Display 'Alternativen :' r
       hailstring = 'Wort unbekannt :'
       defstring = zwi

       address 'TextPlus' RequestString hailstring'\\'defstring
       if zwi = result then zwi = result
       else
       do
       if result =''  then 
       
                   do
                    hailstring ='Wort in Bibliothek aufnehmen ?'
                    address 'TextPlus' RequestString hailstring'\\'defstring
                    if result ='' then tflag =0
                       else address 'IRexxSpell' add defstring
                    end

 
                      else     do

                                zwi = result

                                address 'TextPlus' WDelRight
                                address 'TextPlus' Type zwi' '
                               end
       end


    end


            do
            address 'TextPlus' WRight
            if rc = 1 then tflag = 0
            end


END

  end


exit 0
