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