1 2b85f70d 2005-01-11 devnull #!/usr/local/plan9/bin/rc
3 474ef694 2005-01-07 devnull . $PLAN9/lib/acme.rc
5 474ef694 2005-01-07 devnull fn event {
6 474ef694 2005-01-07 devnull # $1 - c1 origin of event
7 474ef694 2005-01-07 devnull # $2 - c2 type of action
8 474ef694 2005-01-07 devnull # $3 - q0 beginning of selection
9 474ef694 2005-01-07 devnull # $4 - q1 end of selection
10 886f121b 2005-01-07 devnull # $5 - eq0 beginning of expanded selection
11 886f121b 2005-01-07 devnull # $6 - eq1 end of expanded selection
12 886f121b 2005-01-07 devnull # $7 - flag
13 886f121b 2005-01-07 devnull # $8 - nr number of runes in $7
14 886f121b 2005-01-07 devnull # $9 - text
15 886f121b 2005-01-07 devnull # $10 - chorded argument
16 886f121b 2005-01-07 devnull # $11 - origin of chorded argument
18 474ef694 2005-01-07 devnull switch($1$2){
19 474ef694 2005-01-07 devnull case E* # write to body or tag
20 474ef694 2005-01-07 devnull case F* # generated by ourselves; ignore
21 474ef694 2005-01-07 devnull case K* # type away we do not care
22 474ef694 2005-01-07 devnull case Mi # mouse: text inserted in tag
23 474ef694 2005-01-07 devnull case MI # mouse: text inserted in body
24 474ef694 2005-01-07 devnull case Md # mouse: text deleted from tag
25 474ef694 2005-01-07 devnull case MD # mouse: text deleted from body
27 474ef694 2005-01-07 devnull case Mx MX # button 2 in tag or body
28 474ef694 2005-01-07 devnull winwriteevent $*
30 474ef694 2005-01-07 devnull case Ml ML # button 3 in tag or body
32 474ef694 2005-01-07 devnull if(~ $dict NONE)
33 886f121b 2005-01-07 devnull dictwin /adict/$9/ $9
35 886f121b 2005-01-07 devnull dictwin /adict/$dict/$9 $dict $9
40 474ef694 2005-01-07 devnull fn dictwin {
41 474ef694 2005-01-07 devnull newwindow
42 474ef694 2005-01-07 devnull winname $1
43 474ef694 2005-01-07 devnull switch($#*){
45 474ef694 2005-01-07 devnull dict -d '?' >[2=1] | sed 1d | winwrite body
50 474ef694 2005-01-07 devnull dict -d $dict $3 >[2=1] | winwrite body
52 474ef694 2005-01-07 devnull winctl clean
53 474ef694 2005-01-07 devnull wineventloop
56 474ef694 2005-01-07 devnull dict=NONE
57 474ef694 2005-01-07 devnull if(~ $1 -d){
62 474ef694 2005-01-07 devnull if(~ $1 -d*){
63 474ef694 2005-01-07 devnull dict=`{echo $1 | sed 's/-d//'}
66 474ef694 2005-01-07 devnull if(~ $1 -*){
67 474ef694 2005-01-07 devnull echo 'usage: adict [-d dict] [word...]' >[1=2]
68 474ef694 2005-01-07 devnull exit usage
71 474ef694 2005-01-07 devnull switch($#*){
73 474ef694 2005-01-07 devnull if(~ $dict NONE)
74 474ef694 2005-01-07 devnull dictwin /adict/
76 474ef694 2005-01-07 devnull dictwin /adict/$dict/ $dict
78 474ef694 2005-01-07 devnull if(~ $dict NONE){
79 2b85f70d 2005-01-11 devnull dict=`{dict -d'?' | 9 sed -n 's/^ ([^\[ ]+).*/\1/p' | sed 1q}
80 474ef694 2005-01-07 devnull if(~ $#dict 0){
81 474ef694 2005-01-07 devnull echo 'no dictionaries present on this system' >[1=2]
82 474ef694 2005-01-07 devnull exit nodict
86 474ef694 2005-01-07 devnull dictwin /adict/$dict/$i $dict $i