Hello everyone.

This script works very fine.  I will take a look at sources, and learn
the proper way to share this.

There is a lot of dictionaries you can use with ispell:

http://fmg-www.cs.ucla.edu/geoff/ispell-dictionaries.html


I will make a package with ispell and the American and British
dictionaries, and a separate package with the Spanish dictionary.
I'm starting to learn Portuguese, so I will try to make a package for
this language too, but I think it would be great if a native speaker
of each language makes and tests the dictionaries.  The work is easy,
just make a utf8 formatter like that I showed you in the first mail I
send with this subject.

With the dot's address I can fix the output to make it work with
arbitrarily selections.  I'm still looking for some way to get the
dot's address of a window within a rc script, but I think that the
proper way it's going to be keep learning C (just 3th chapter of K&R
for now...) and make a simple C program to make the work and put it in
/acme/bin for future use in scripts, and maybe substitute the script
with a faster program.

Regards, 
trebol.

//////////////////////////
//////////////////////////

#!/bin/rc

rm -f /tmp/$pid^'.'aispell

args=()
spellflags=()
for(x){
        switch($x){
        case -d*
                spellflags=($spellflags $x)
        case -p*
                spellflags=($spellflags $x)
        case -T*
                spellflags=($spellflags $x)
        case *
                args = ($args $x)
        }
}

dir = /mnt/wsys
if(! test -f $dir/cons)
        dir = /mnt/term/$dir
id=`{cat $dir/new/ctl}
id=$id(1)

#if(~ $#args 1 && ~ $args /*){
#       adir = `{basename -d $args}
#       args = `{basename $args}
#       echo 'name '^$adir^/-spell > $dir/$id/ctl
#       cd $adir
#}
#if not {
        echo 'name '^`{pwd}^/-spell > $dir/$id/ctl
#}

{
        echo noscroll
        if(~ $#args 0){
                cat > /tmp/$pid^'.'aispell
                args = /tmp/$pid^'.'aispell
                pipe = 1
        }
        for(i in $args){
                        name = $i
                        if(~ $pipe 1){
                                name = `{sed 's/ .*//g' < /mnt/acme/$winid/tag}
                                if(~ name '') name = nonamedwindow
                        }
                for(j in `{{cat $i; echo} | $home/local/bin/acme/spout | sort 
-t: -u +2 | sed 's/$/\!/g' | $home/local/bin/ispell -a $spellflags | grep 
'^[&#]' | sed 's/ /_/g'}){
                # {cat $i; echo} is for spout, needs \n. I want make a list of 
lines, so j can't have spaces 
                        miss = `{ echo $j | awk -F_ '{print $2}'}
                        sugg = `{ echo $j | sed 's/^.*://g'} # I can't put grep 
-v '^#' here...
                        {cat $i; echo} |
                        $home/local/bin/acme/spout |
                        grep '.*:'$miss'$' |
                        sed 's/$/ '$sugg'/g' | # If I put grep -v '^#' above, 
this sed cuts output, I don't know why ...
                        sed 's/#_.*$//g' |
                        sed 's/_/ /g' |  # If I put sed 's/_/ /g' above, 
variables don't work in sed.  Again, I don't know why...
                        sed s',^,'$name',g' > $dir/$id/body
                }

        }
        rm -f /tmp/$pid^'.'aispell
        echo clean
}> $dir/$id/ctl

Reply via email to