zsh-workers
 help / color / mirror / code / Atom feed
* Re: PATCH: Completion/User/_cvs again.
@ 1999-09-07 11:22 Sven Wischnowsky
  0 siblings, 0 replies; 12+ messages in thread
From: Sven Wischnowsky @ 1999-09-07 11:22 UTC (permalink / raw)
  To: zsh-workers


Tanaka Akira wrote:

> I think the style of `_rpm' is useful for state machines. But it
> cannot represent function call. And `_cvs' has such functions.
> 
> For example, `_cvs_extract_directory_entries' is called from
> `_cvs_setup_allentries', `_cvs_setup_direntries' and
> `_cvs_setup_modentries'. And it should return to its caller.
> This is hard to implement in state machine style, I think.

Ah, I see. Sorry.

Yes, adding a heap of extra states a la `extract_file_or_directory_entry'
is ugly.

Hm, some form of `case' that executes all matching branches would be
useful here.

(Yes, I know that one can do that e.g. with a `case' in a loop where
the case branches remove substrings from the `state' name, but that
isn't exactly a nice solution, either.)

Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: PATCH: Completion/User/_cvs again.
@ 1999-09-08  8:27 Sven Wischnowsky
  0 siblings, 0 replies; 12+ messages in thread
From: Sven Wischnowsky @ 1999-09-08  8:27 UTC (permalink / raw)
  To: zsh-workers


Tanaka Akira wrote:

> Also, I found that `cvs diff <TAB>' causes core dump.
> 
> Z(2):akr@is27e1u11% Src/zsh -f                          
> is27e1u11% bindkey -e; fpath=($PWD/Completion/*(/)); autoload -U compinit; compinit -D; compdef _tst tst
> is27e1u11% compconf group_matches=yes message_format='%d' description_format='%d' describe_options=yes   
> is27e1u11% cvs diff zsh: segmentation fault (core dumped)  Src/zsh -f

Whoa! `bslashquote()' used a static buffer -- too short for long lists 
like these (called via the `(q)' param flag).

Bart: `bslashquote()' is basically the `quotename()' from zle_tricky.c,
      I think we should change it there, too.


Bye
 Sven

diff -u os/utils.c Src/utils.c
--- os/utils.c	Tue Sep  7 13:15:41 1999
+++ Src/utils.c	Wed Sep  8 10:15:50 1999
@@ -2963,7 +2963,8 @@
 bslashquote(const char *s, char **e, int instring)
 {
     const char *u, *tt;
-    char *v, buf[PATH_MAX * 2];
+    char *v;
+    VARARR(char, buf, 2 * strlen(s) + 1);
     int sf = 0;
 
     tt = v = buf;

--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: PATCH: Completion/User/_cvs again.
@ 1999-09-08  7:08 Sven Wischnowsky
  0 siblings, 0 replies; 12+ messages in thread
From: Sven Wischnowsky @ 1999-09-08  7:08 UTC (permalink / raw)
  To: zsh-workers


Tanaka Akira wrote:

> In article <990907210627.ZM8775@candle.brasslantern.com>,
>   "Bart Schaefer" <schaefer@candle.brasslantern.com> writes:
> 
> > Aren't we already requiring the parameters modlue for some of the other
> > completion stuff?  Would this be faster/cleaner/clearer as
> > 
> > 	if ! (( $+functions[_cvs_command] )); then
> 
> I didn't know parameter module. Hm, it's good.  But, I think the
> module is not loaded by the completion stuff.
> 
> ...
> 
> Although some functions examine whether parameter module is exist,
> they doesn't try to load the module.

Right. Should we:

1) add a (convenient) way to find out if a module will be autoloaded
   and change such places to test that for `parameter' and then force
   its loading, or
2) make parameter auto-autoloaded and just make it be loaded in
   `_main_complete' if it isn't loaded yet

???

Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: PATCH: Completion/User/_cvs again.
  1999-09-07 22:58     ` Tanaka Akira
@ 1999-09-08  0:46       ` Bart Schaefer
  0 siblings, 0 replies; 12+ messages in thread
From: Bart Schaefer @ 1999-09-08  0:46 UTC (permalink / raw)
  To: Tanaka Akira, zsh-workers

On Sep 8,  7:58am, Tanaka Akira wrote:
> Subject: Re: PATCH: Completion/User/_cvs again.
> In article <990907222631.ZM11028@candle.brasslantern.com>,
>   "Bart Schaefer" <schaefer@candle.brasslantern.com> writes:
> 
> > maybe a bit less readable ...
> 
> +    _cvs_"${${(k)cmds[(R)* $words[1] *]}:-${words[1]:#*~(${(@kj:|:)~cmds})}}"

I think we've just gone from "a bit" to "a lot".  How about:

Index: Completion/User/_cvs
===================================================================
@@ -35,7 +35,7 @@
   if (( CURRENT == 1 )); then
     compadd "$@" ${(k)cmds} || compadd "$@" ${(kv)=cmds}
   else
-    _cvs_"${${(k)cmds[(R)* $words[1] *]}:-${words[1]:#*~(${(@kj:|:)~cmds})}}"
+    _cvs_"${${(k)cmds[(R)* $words[1] *]}:-${(k)cmds[(i)$words[1]]}}"
   fi
 }
 


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: PATCH: Completion/User/_cvs again.
  1999-09-07 21:06 ` Bart Schaefer
@ 1999-09-07 23:22   ` Tanaka Akira
  0 siblings, 0 replies; 12+ messages in thread
From: Tanaka Akira @ 1999-09-07 23:22 UTC (permalink / raw)
  To: zsh-workers

In article <990907210627.ZM8775@candle.brasslantern.com>,
  "Bart Schaefer" <schaefer@candle.brasslantern.com> writes:

> Aren't we already requiring the parameters modlue for some of the other
> completion stuff?  Would this be faster/cleaner/clearer as
> 
> 	if ! (( $+functions[_cvs_command] )); then

I didn't know parameter module. Hm, it's good.  But, I think the
module is not loaded by the completion stuff.

Z(2):akr@is27e1u11% grep zmodload Completion/**/*(.)
Completion/Builtins/CVS/Entries:/_zmodload/1.1.1.7/Thu Aug 19 15:41:03 1999//
Completion/Builtins/_zmodload:#compdef zmodload
Completion/Builtins/_zmodload:  compadd "$expl[@]" - $(zmodload)
Completion/Core/_main_complete:#   if zmodload -e parameter; then
Completion/Core/_normal:  if zmodload -e parameter; then
Completion/Core/_parameters:  if zmodload -e parameter; then
Completion/Core/_parameters:  if zmodload -e parameter; then
Completion/User/_cvs:    ! { zmodload -e stat || zmodload stat }; then
Z(2):akr@is27e1u11% 

Although some functions examine whether parameter module is exist,
they doesn't try to load the module.
-- 
Tanaka Akira


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: PATCH: Completion/User/_cvs again.
  1999-09-07 22:26   ` Bart Schaefer
@ 1999-09-07 22:58     ` Tanaka Akira
  1999-09-08  0:46       ` Bart Schaefer
  0 siblings, 1 reply; 12+ messages in thread
From: Tanaka Akira @ 1999-09-07 22:58 UTC (permalink / raw)
  To: zsh-workers

In article <990907222631.ZM11028@candle.brasslantern.com>,
  "Bart Schaefer" <schaefer@candle.brasslantern.com> writes:

> As long as we're talking style, why do with a `case` what you can do with
> substitution?  I think the following is a lot more easily maintained, if
> maybe a bit less readable ...

Good. But it has a problem.

is27e1u11% cvs D <TAB>
month\ ago   today        week\ ago    yesterday    

Index: Completion/User/_cvs
===================================================================
RCS file: /projects/zsh/zsh/Completion/User/_cvs,v
retrieving revision 1.1.1.6
diff -u -F^( -r1.1.1.6 _cvs
--- _cvs	1999/09/07 22:28:46	1.1.1.6
+++ _cvs	1999/09/07 22:53:25
@@ -35,11 +35,14 @@
   if (( CURRENT == 1 )); then
     compadd "$@" ${(k)cmds} || compadd "$@" ${(kv)=cmds}
   else
-    _cvs_"${${(k)cmds[(R)* $words[1] *]}:-$words[1]}" 2>&- ||
-      _message "unknown cvs command: $words[1]"
+    _cvs_"${${(k)cmds[(R)* $words[1] *]}:-${words[1]:#*~(${(@kj:|:)~cmds})}}"
   fi
 }
 
+_cvs_ () {
+  _message "unknown cvs command: $words[1]"
+}
+
 # define completion functions for each cvs command
 
 builtin functions _cvs_add >&- ||
@@ -582,9 +585,11 @@
 
 # define configuration variables.
 
+local tmp
+
 (( $+_cvs_roots )) ||
-if [[ -f ~/.cvspass ]]; then
-  _cvs_roots=(${${(f)"$(<~/.cvspass)"}%% *})
+if [[ -f "${tmp::=${CVS_PASSFILE:-$HOME/.cvspass}}" ]]; then
+  _cvs_roots=(${${(f)"$(<$tmp)"}%% *})
 else
   _cvs_roots=()
 fi

Also, I found that `cvs diff <TAB>' causes core dump.

Z(2):akr@is27e1u11% Src/zsh -f                          
is27e1u11% bindkey -e; fpath=($PWD/Completion/*(/)); autoload -U compinit; compinit -D; compdef _tst tst
is27e1u11% compconf group_matches=yes message_format='%d' description_format='%d' describe_options=yes   
is27e1u11% cvs diff zsh: segmentation fault (core dumped)  Src/zsh -f
Z(2):akr@is27e1u11% gdb Src/zsh core
GNU gdb 19981224
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "sparc-sun-solaris2.7"...
Core was generated by `Src/zsh -f'.
Program terminated with signal 11, Segmentation Fault.
Reading symbols from /usr/lib/libsocket.so.1...done.
Reading symbols from /usr/lib/libdl.so.1...done.
Reading symbols from /usr/lib/libnsl.so.1...done.
Reading symbols from /usr/lib/libcurses.so.1...done.
Reading symbols from /usr/lib/libc.so.1...done.
Reading symbols from /usr/lib/libmp.so.2...done.
Reading symbols from /usr/platform/SUNW,Ultra-5_10/lib/libc_psr.so.1...done.
Reading symbols from /usr/lib/locale/ja/ja.so.2...done.
Reading symbols from /usr/lib/locale/ja/methods_ja.so.2...done.
Reading symbols from /space/akr/zsh/lib/zsh/3.1.6-pws-3/comp1.so...done.
Reading symbols from /space/akr/zsh/lib/zsh/3.1.6-pws-3/zle.so...done.
Reading symbols from /space/akr/zsh/lib/zsh/3.1.6-pws-3/compctl.so...done.
Reading symbols from /space/akr/zsh/lib/zsh/3.1.6-pws-3/stat.so...done.
#0  0x9dcc8 in bslashquote (
---Type <return> to continue, or q <return> to quit---
    s=0x285540 "--binary", ' ' <repeats 18 times>, "--ignore-space-change     --report-identical-files  -2", ' ' <repeats 24 times>, "-I", ' ' <repeats 24 times>, "-i\n--brief", ' ' <repeats 19 times>, "--initial-tab", ' ' <repeats 13 times>, "--show-c-functi"..., e=0x0, instring=0) at utils.c:2995
2995            if(*u == Meta)
(gdb) where
#0  0x9dcc8 in bslashquote (
    s=0x285540 "--binary", ' ' <repeats 18 times>, "--ignore-space-change     --report-identical-files  -2", ' ' <repeats 24 times>, "-I", ' ' <repeats 24 times>, "-i\n--brief", ' ' <repeats 19 times>, "--initial-tab", ' ' <repeats 13 times>, "--show-c-functi"..., e=0x0, instring=0) at utils.c:2995
#1  0x8f6d0 in paramsubst (l=0x284220, n=0x284260, str=0xffbe459c, qt=1, 
    ssub=0) at subst.c:1652
#2  0x87f24 in stringsubst (list=0x284220, node=0x284260, ssub=0)
    at subst.c:122
#3  0x87b38 in prefork (list=0x284220, flags=0) at subst.c:71
#4  0x320a0 in execcmd (cmd=0x2741e8, input=0, output=0, how=2, last1=2)
    at exec.c:1511
#5  0x30330 in execpline2 (pline=0x274ca8, how=2, input=0, output=0, last1=0)
    at exec.c:1060
#6  0x2f490 in execpline (l=0x271b00, how=2, last1=0) at exec.c:875
#7  0x2edb8 in execlist (list=0x274c90, dont_change_job=1, exiting=0)
    at exec.c:744
#8  0x5fa34 in execif (cmd=0x24d3f8, args=0x0, flags=0) at loop.c:409
#9  0x343cc in execcmd (cmd=0x24d3f8, input=0, output=0, how=2, last1=2)
    at exec.c:1985
#10 0x30330 in execpline2 (pline=0x27fb90, how=2, input=0, output=0, last1=0)
    at exec.c:1060
#11 0x2f490 in execpline (l=0x2717a0, how=2, last1=0) at exec.c:875
---Type <return> to continue, or q <return> to quit---
#12 0x2edb8 in execlist (list=0x27fb78, dont_change_job=1, exiting=0)
    at exec.c:744
#13 0x37bf4 in execautofn (cmd=0x1307b0, args=0x0, flags=0) at exec.c:2907
#14 0x343cc in execcmd (cmd=0x1307b0, input=0, output=0, how=2, last1=2)
    at exec.c:1985
#15 0x30330 in execpline2 (pline=0x131918, how=2, input=0, output=0, last1=0)
    at exec.c:1060
#16 0x2f490 in execpline (l=0x132820, how=2, last1=0) at exec.c:875
#17 0x2edb8 in execlist (list=0x131930, dont_change_job=1, exiting=0)
    at exec.c:744
#18 0x382c0 in runshfunc (list=0x131930, wrap=0x0, name=0x131948 "_display")
    at exec.c:3029
#19 0xff04bc5c in comp_wrapper (list=0x131930, w=0x0, name=0x131948 "_display")
    at compctl.c:2419
#20 0x381f0 in runshfunc (list=0x131930, wrap=0xff05d7f0, 
    name=0x131948 "_display") at exec.c:3016
#21 0x37ee8 in doshfunc (name=0x131948 "_display", list=0x131930, 
    doshargs=0x26e380, flags=2176, noreturnval=0) at exec.c:2967
#22 0x378cc in execshfunc (cmd=0x249a38, shf=0x1318a0, args=0x26e380)
    at exec.c:2860
#23 0x3465c in execcmd (cmd=0x249a38, input=0, output=0, how=2, last1=2)
    at exec.c:2022
#24 0x30330 in execpline2 (pline=0x24a4d8, how=2, input=0, output=0, last1=0)
---Type <return> to continue, or q <return> to quit---
    at exec.c:1060
#25 0x2f490 in execpline (l=0x2489b0, how=2, last1=0) at exec.c:875
#26 0x2edb8 in execlist (list=0x24a4c0, dont_change_job=1, exiting=0)
    at exec.c:744
#27 0x5f8b4 in execif (cmd=0x249a10, args=0x0, flags=0) at loop.c:397
#28 0x343cc in execcmd (cmd=0x249a10, input=0, output=0, how=2, last1=2)
    at exec.c:1985
#29 0x30330 in execpline2 (pline=0x24a490, how=2, input=0, output=0, last1=0)
    at exec.c:1060
#30 0x2f490 in execpline (l=0x248990, how=2, last1=0) at exec.c:875
#31 0x2edb8 in execlist (list=0x24a478, dont_change_job=1, exiting=0)
    at exec.c:744
#32 0x5fa34 in execif (cmd=0x249970, args=0x0, flags=0) at loop.c:409
#33 0x343cc in execcmd (cmd=0x249970, input=0, output=0, how=2, last1=2)
    at exec.c:1985
#34 0x30330 in execpline2 (pline=0x24a3b8, how=2, input=0, output=0, last1=0)
    at exec.c:1060
#35 0x2f490 in execpline (l=0x248950, how=2, last1=0) at exec.c:875
#36 0x2edb8 in execlist (list=0x24a3a0, dont_change_job=1, exiting=0)
    at exec.c:744
#37 0x5fa34 in execif (cmd=0x246628, args=0x0, flags=0) at loop.c:409
#38 0x343cc in execcmd (cmd=0x246628, input=0, output=0, how=2, last1=2)
    at exec.c:1985
---Type <return> to continue, or q <return> to quit---
#39 0x30330 in execpline2 (pline=0x2485a0, how=2, input=0, output=0, last1=0)
    at exec.c:1060
#40 0x2f490 in execpline (l=0x2486b0, how=2, last1=0) at exec.c:875
#41 0x2edb8 in execlist (list=0x248588, dont_change_job=1, exiting=0)
    at exec.c:744
#42 0x5fa34 in execif (cmd=0x246560, args=0x0, flags=0) at loop.c:409
#43 0x343cc in execcmd (cmd=0x246560, input=0, output=0, how=2, last1=2)
    at exec.c:1985
#44 0x30330 in execpline2 (pline=0x248390, how=2, input=0, output=0, last1=0)
    at exec.c:1060
#45 0x2f490 in execpline (l=0x248630, how=2, last1=0) at exec.c:875
#46 0x2edb8 in execlist (list=0x248378, dont_change_job=1, exiting=0)
    at exec.c:744
#47 0x5f394 in execwhile (cmd=0x242ff8, args=0x0, flags=0) at loop.c:325
#48 0x343cc in execcmd (cmd=0x242ff8, input=0, output=0, how=2, last1=2)
    at exec.c:1985
#49 0x30330 in execpline2 (pline=0x244d90, how=2, input=0, output=0, last1=0)
    at exec.c:1060
#50 0x2f490 in execpline (l=0x244170, how=2, last1=0) at exec.c:875
#51 0x2edb8 in execlist (list=0x244d78, dont_change_job=1, exiting=0)
    at exec.c:744
#52 0x382c0 in runshfunc (list=0x19d7e8, wrap=0x0, name=0x12da18 "_arguments")
    at exec.c:3029
---Type <return> to continue, or q <return> to quit---
#53 0xff04bc5c in comp_wrapper (list=0x19d7e8, w=0x0, 
    name=0x12da18 "_arguments") at compctl.c:2419
#54 0x381f0 in runshfunc (list=0x19d7e8, wrap=0xff05d7f0, 
    name=0x12da18 "_arguments") at exec.c:3016
#55 0x37ee8 in doshfunc (name=0x12da18 "_arguments", list=0x19d7e8, 
    doshargs=0x25b998, flags=2048, noreturnval=0) at exec.c:2967
#56 0x378cc in execshfunc (cmd=0x190dc8, shf=0x12d9d0, args=0x25b998)
    at exec.c:2860
#57 0x3465c in execcmd (cmd=0x190dc8, input=0, output=0, how=2, last1=2)
    at exec.c:2022
#58 0x30330 in execpline2 (pline=0x192cd8, how=2, input=0, output=0, last1=0)
    at exec.c:1060
#59 0x2f490 in execpline (l=0x18fc68, how=2, last1=0) at exec.c:875
#60 0x2edb8 in execlist (list=0x192cc0, dont_change_job=1, exiting=0)
    at exec.c:744
#61 0x382c0 in runshfunc (list=0x192cc0, wrap=0x0, name=0x193580 "_cvs_diff")
    at exec.c:3029
#62 0xff04bc5c in comp_wrapper (list=0x192cc0, w=0x0, 
    name=0x193580 "_cvs_diff") at compctl.c:2419
#63 0x381f0 in runshfunc (list=0x192cc0, wrap=0xff05d7f0, 
    name=0x193580 "_cvs_diff") at exec.c:3016
#64 0x37ee8 in doshfunc (name=0x193580 "_cvs_diff", list=0x192cc0, 
    doshargs=0x254800, flags=0, noreturnval=0) at exec.c:2967
---Type <return> to continue, or q <return> to quit---
#65 0x378cc in execshfunc (cmd=0x190a58, shf=0x192ca8, args=0x254800)
    at exec.c:2860
#66 0x3465c in execcmd (cmd=0x190a58, input=0, output=0, how=2, last1=2)
    at exec.c:2022
#67 0x30330 in execpline2 (pline=0x192038, how=2, input=0, output=0, last1=0)
    at exec.c:1060
#68 0x2f490 in execpline (l=0x18f988, how=2, last1=0) at exec.c:875
#69 0x2edb8 in execlist (list=0x192020, dont_change_job=1, exiting=0)
    at exec.c:744
#70 0x5fa34 in execif (cmd=0x1909b8, args=0x0, flags=0) at loop.c:409
#71 0x343cc in execcmd (cmd=0x1909b8, input=0, output=0, how=2, last1=2)
    at exec.c:1985
#72 0x30330 in execpline2 (pline=0x191e70, how=2, input=0, output=0, last1=0)
    at exec.c:1060
#73 0x2f490 in execpline (l=0x18f908, how=2, last1=0) at exec.c:875
#74 0x2edb8 in execlist (list=0x191e58, dont_change_job=1, exiting=0)
    at exec.c:744
#75 0x382c0 in runshfunc (list=0x190828, wrap=0x0, 
    name=0x192068 "_cvs_command") at exec.c:3029
#76 0xff04bc5c in comp_wrapper (list=0x190828, w=0x0, 
    name=0x192068 "_cvs_command") at compctl.c:2419
#77 0x381f0 in runshfunc (list=0x190828, wrap=0xff05d7f0, 
    name=0x192068 "_cvs_command") at exec.c:3016
---Type <return> to continue, or q <return> to quit---
#78 0x37ee8 in doshfunc (name=0x192068 "_cvs_command", list=0x190828, 
    doshargs=0x253f58, flags=0, noreturnval=0) at exec.c:2967
#79 0x378cc in execshfunc (cmd=0x246538, shf=0x135450, args=0x253f58)
    at exec.c:2860
#80 0x3465c in execcmd (cmd=0x246538, input=0, output=0, how=2, last1=2)
    at exec.c:2022
#81 0x30330 in execpline2 (pline=0x2482e8, how=2, input=0, output=0, last1=0)
    at exec.c:1060
#82 0x2f490 in execpline (l=0x2485f0, how=2, last1=0) at exec.c:875
#83 0x2edb8 in execlist (list=0x2482d0, dont_change_job=1, exiting=0)
    at exec.c:744
#84 0x5fa34 in execif (cmd=0x2461c8, args=0x0, flags=0) at loop.c:409
#85 0x343cc in execcmd (cmd=0x2461c8, input=0, output=0, how=2, last1=2)
    at exec.c:1985
#86 0x30330 in execpline2 (pline=0x247390, how=2, input=0, output=0, last1=0)
    at exec.c:1060
#87 0x2f490 in execpline (l=0x246be0, how=2, last1=0) at exec.c:875
#88 0x2edb8 in execlist (list=0x247378, dont_change_job=1, exiting=0)
    at exec.c:744
#89 0x5fa34 in execif (cmd=0x245fc0, args=0x0, flags=0) at loop.c:409
#90 0x343cc in execcmd (cmd=0x245fc0, input=0, output=0, how=2, last1=2)
    at exec.c:1985
#91 0x30330 in execpline2 (pline=0x245c20, how=2, input=0, output=0, last1=0)
---Type <return> to continue, or q <return> to quit---
    at exec.c:1060
#92 0x2f490 in execpline (l=0x246920, how=2, last1=0) at exec.c:875
#93 0x2edb8 in execlist (list=0x245c08, dont_change_job=1, exiting=0)
    at exec.c:744
#94 0x5fa34 in execif (cmd=0x243048, args=0x0, flags=0) at loop.c:409
#95 0x343cc in execcmd (cmd=0x243048, input=0, output=0, how=2, last1=2)
    at exec.c:1985
#96 0x30330 in execpline2 (pline=0x244e20, how=2, input=0, output=0, last1=0)
    at exec.c:1060
#97 0x2f490 in execpline (l=0x2441b0, how=2, last1=0) at exec.c:875
#98 0x2edb8 in execlist (list=0x244e08, dont_change_job=1, exiting=0)
    at exec.c:744
#99 0x5f394 in execwhile (cmd=0x242ff8, args=0x0, flags=0) at loop.c:325
#100 0x343cc in execcmd (cmd=0x242ff8, input=0, output=0, how=2, last1=2)
    at exec.c:1985
#101 0x30330 in execpline2 (pline=0x244d90, how=2, input=0, output=0, last1=0)
    at exec.c:1060
#102 0x2f490 in execpline (l=0x244170, how=2, last1=0) at exec.c:875
#103 0x2edb8 in execlist (list=0x244d78, dont_change_job=1, exiting=0)
    at exec.c:744
#104 0x37bf4 in execautofn (cmd=0xcec98, args=0x0, flags=0) at exec.c:2907
#105 0x343cc in execcmd (cmd=0xcec98, input=0, output=0, how=2, last1=2)
    at exec.c:1985
---Type <return> to continue, or q <return> to quit---
#106 0x30330 in execpline2 (pline=0x12d9e8, how=2, input=0, output=0, last1=0)
    at exec.c:1060
#107 0x2f490 in execpline (l=0x12dc60, how=2, last1=0) at exec.c:875
#108 0x2edb8 in execlist (list=0x12da00, dont_change_job=1, exiting=0)
    at exec.c:744
#109 0x382c0 in runshfunc (list=0x12da00, wrap=0x0, name=0x12da18 "_arguments")
    at exec.c:3029
#110 0xff04bc5c in comp_wrapper (list=0x12da00, w=0x0, 
    name=0x12da18 "_arguments") at compctl.c:2419
#111 0x381f0 in runshfunc (list=0x12da00, wrap=0xff05d7f0, 
    name=0x12da18 "_arguments") at exec.c:3016
#112 0x37ee8 in doshfunc (name=0x12da18 "_arguments", list=0x12da00, 
    doshargs=0x1a21a0, flags=2176, noreturnval=0) at exec.c:2967
#113 0x378cc in execshfunc (cmd=0x1908a0, shf=0x12d9d0, args=0x1a21a0)
    at exec.c:2860
#114 0x3465c in execcmd (cmd=0x1908a0, input=0, output=0, how=2, last1=2)
    at exec.c:2022
#115 0x30330 in execpline2 (pline=0x190630, how=2, input=0, output=0, last1=0)
    at exec.c:1060
#116 0x2f490 in execpline (l=0x18f808, how=2, last1=0) at exec.c:875
#117 0x2edb8 in execlist (list=0x190618, dont_change_job=1, exiting=0)
    at exec.c:744
#118 0x382c0 in runshfunc (list=0x190618, 
wrap=0x0, name=0x1900d0 "_cvs")
---Type <return> to continue, or q <return> to quit---
    at exec.c:3029
#119 0xff04bc5c in comp_wrapper (list=0x190618, w=0x0, name=0x1900d0 "_cvs")
    at compctl.c:2419
#120 0x381f0 in runshfunc (list=0x190618, wrap=0xff05d7f0, 
    name=0x1900d0 "_cvs") at exec.c:3016
#121 0x37ee8 in doshfunc (name=0x1900d0 "_cvs", list=0x190618, 
    doshargs=0x1a20c8, flags=0, noreturnval=0) at exec.c:2967
#122 0x378cc in execshfunc (cmd=0x190878, shf=0x190600, args=0x1a20c8)
    at exec.c:2860
#123 0x3465c in execcmd (cmd=0x190878, input=0, output=0, how=2, last1=2)
    at exec.c:2022
#124 0x30330 in execpline2 (pline=0x1905b8, how=2, input=0, output=0, last1=0)
    at exec.c:1060
#125 0x2f490 in execpline (l=0x18f7e8, how=2, last1=0) at exec.c:875
#126 0x2edb8 in execlist (list=0x1905a0, dont_change_job=1, exiting=0)
    at exec.c:744
#127 0x37bf4 in execautofn (cmd=0x130c10, args=0x0, flags=0) at exec.c:2907
#128 0x343cc in execcmd (cmd=0x130c10, input=0, output=0, how=2, last1=2)
    at exec.c:1985
#129 0x30330 in execpline2 (pline=0x135570, how=2, input=0, output=0, last1=0)
    at exec.c:1060
#130 0x2f490 in execpline (l=0x132ba0, how=2, last1=0) at exec.c:875
#131 0x2edb8 in execlist (list=0x1354e0, dont_change_job=1, exiting=0)
---Type <return> to continue, or q <return> to quit---
    at exec.c:744
#132 0x382c0 in runshfunc (list=0x1354e0, wrap=0x0, name=0x12fc60 "")
    at exec.c:3029
#133 0xff04bc5c in comp_wrapper (list=0x1354e0, w=0x0, name=0x12fc60 "")
    at compctl.c:2419
#134 0x381f0 in runshfunc (list=0x1354e0, wrap=0xff05d7f0, name=0x12fc60 "")
    at exec.c:3016
#135 0x37ee8 in doshfunc (name=0x12fc60 "", list=0x1354e0, doshargs=0xf9fa0, 
    flags=2176, noreturnval=0) at exec.c:2967
#136 0x378cc in execshfunc (cmd=0xcf558, shf=0x135450, args=0xf9fa0)
    at exec.c:2860
#137 0x3465c in execcmd (cmd=0xcf558, input=0, output=0, how=2, last1=2)
    at exec.c:2022
#138 0x30330 in execpline2 (pline=0x114d38, how=2, input=0, output=0, last1=0)
    at exec.c:1060
#139 0x2f490 in execpline (l=0x1190f8, how=2, last1=0) at exec.c:875
#140 0x2eddc in execlist (list=0x118520, dont_change_job=1, exiting=0)
    at exec.c:750
#141 0x5fa34 in execif (cmd=0x117168, args=0x0, flags=0) at loop.c:409
#142 0x343cc in execcmd (cmd=0x117168, input=0, output=0, how=2, last1=2)
    at exec.c:1985
#143 0x30330 in execpline2 (pline=0x113bd0, how=2, input=0, output=0, last1=0)
    at exec.c:1060
---Type <return> to continue, or q <return> to quit---
#144 0x2f490 in execpline (l=0x1164c8, how=2, last1=0) at exec.c:875
#145 0x2edb8 in execlist (list=0x1196c0, dont_change_job=1, exiting=0)
    at exec.c:744
#146 0x37bf4 in execautofn (cmd=0x130918, args=0x0, flags=0) at exec.c:2907
#147 0x343cc in execcmd (cmd=0x130918, input=0, output=0, how=2, last1=2)
    at exec.c:1985
#148 0x30330 in execpline2 (pline=0x138c68, how=2, input=0, output=0, last1=0)
    at exec.c:1060
#149 0x2f490 in execpline (l=0x132940, how=2, last1=0) at exec.c:875
#150 0x2edb8 in execlist (list=0x138c80, dont_change_job=1, exiting=0)
    at exec.c:744
#151 0x382c0 in runshfunc (list=0x138c80, wrap=0x0, name=0x1335b8 "_normal")
    at exec.c:3029
#152 0xff04bc5c in comp_wrapper (list=0x138c80, w=0x0, name=0x1335b8 "_normal")
    at compctl.c:2419
#153 0x381f0 in runshfunc (list=0x138c80, wrap=0xff05d7f0, 
    name=0x1335b8 "_normal") at exec.c:3016
#154 0x37ee8 in doshfunc (name=0x1335b8 "_normal", list=0x138c80, 
    doshargs=0xe8c88, flags=2176, noreturnval=0) at exec.c:2967
#155 0x378cc in execshfunc (cmd=0xcf490, shf=0x138bf0, args=0xe8c88)
    at exec.c:2860
#156 0x3465c in execcmd (cmd=0xcf490, input=0, output=0, how=2, last1=2)
    at exec.c:2022
---Type <return> to continue, or q <return> to quit---
#157 0x30330 in execpline2 (pline=0x1160c8, how=2, input=0, output=0, last1=0)
    at exec.c:1060
#158 0x2f490 in execpline (l=0x1168e8, how=2, last1=0) at exec.c:875
#159 0x2edb8 in execlist (list=0x115d50, dont_change_job=1, exiting=0)
    at exec.c:744
#160 0x5fa34 in execif (cmd=0xcf378, args=0x0, flags=0) at loop.c:409
#161 0x343cc in execcmd (cmd=0xcf378, input=0, output=0, how=2, last1=2)
    at exec.c:1985
#162 0x30330 in execpline2 (pline=0x11abe0, how=2, input=0, output=0, last1=0)
    at exec.c:1060
#163 0x2f490 in execpline (l=0x116688, how=2, last1=0) at exec.c:875
#164 0x2edb8 in execlist (list=0x117988, dont_change_job=1, exiting=0)
    at exec.c:744
#165 0x37bf4 in execautofn (cmd=0x130738, args=0x0, flags=0) at exec.c:2907
#166 0x343cc in execcmd (cmd=0x130738, input=0, output=0, how=2, last1=2)
    at exec.c:1985
#167 0x30330 in execpline2 (pline=0x1317f8, how=2, input=0, output=0, last1=0)
    at exec.c:1060
#168 0x2f490 in execpline (l=0x1327c0, how=2, last1=0) at exec.c:875
#169 0x2edb8 in execlist (list=0x131810, dont_change_job=1, exiting=0)
    at exec.c:744
#170 0x382c0 in runshfunc (list=0x131810, wrap=0x0, name=0x131828 "_complete")
    at exec.c:3029
---Type <return> to continue, or q <return> to quit---
#171 0xff04bc5c in comp_wrapper (list=0x131810, w=0x0, 
    name=0x131828 "_complete") at compctl.c:2419
#172 0x381f0 in runshfunc (list=0x131810, wrap=0xff05d7f0, 
    name=0x131828 "_complete") at exec.c:3016
#173 0x37ee8 in doshfunc (name=0x131828 "_complete", list=0x131810, 
    doshargs=0x12a5e0, flags=2176, noreturnval=0) at exec.c:2967
#174 0x378cc in execshfunc (cmd=0x119ca0, shf=0x131720, args=0x12a5e0)
    at exec.c:2860
#175 0x3465c in execcmd (cmd=0x119ca0, input=0, output=0, how=2, last1=2)
    at exec.c:2022
#176 0x30330 in execpline2 (pline=0x117f18, how=2, input=0, output=0, last1=0)
    at exec.c:1060
#177 0x2f490 in execpline (l=0x11b830, how=2, last1=0) at exec.c:875
#178 0x2edb8 in execlist (list=0x117f00, dont_change_job=1, exiting=0)
    at exec.c:744
#179 0x5f8b4 in execif (cmd=0xcf260, args=0x0, flags=0) at loop.c:397
#180 0x343cc in execcmd (cmd=0xcf260, input=0, output=0, how=2, last1=2)
    at exec.c:1985
#181 0x30330 in execpline2 (pline=0x115df8, how=2, input=0, output=0, last1=0)
    at exec.c:1060
#182 0x2f490 in execpline (l=0x11b850, how=2, last1=0) at exec.c:875
#183 0x2edb8 in execlist (list=0x117e70, dont_change_job=1, exiting=0)
    at exec.c:744
---Type <return> to continue, or q <return> to quit---
#184 0x5e45c in execfor (cmd=0xcf328, args=0x12a5a0, flags=0) at loop.c:117
#185 0x343cc in execcmd (cmd=0xcf328, input=0, output=0, how=2, last1=2)
    at exec.c:1985
#186 0x30330 in execpline2 (pline=0x117e58, how=2, input=0, output=0, last1=0)
    at exec.c:1060
#187 0x2f490 in execpline (l=0x1166e8, how=2, last1=0) at exec.c:875
#188 0x2edb8 in execlist (list=0x1156d0, dont_change_job=1, exiting=0)
    at exec.c:744
#189 0x37bf4 in execautofn (cmd=0x130850, args=0x0, flags=0) at exec.c:2907
#190 0x343cc in execcmd (cmd=0x130850, input=0, output=0, how=2, last1=2)
    at exec.c:1985
#191 0x30330 in execpline2 (pline=0x138ab8, how=2, input=0, output=0, last1=0)
    at exec.c:1060
#192 0x2f490 in execpline (l=0x1328a0, how=2, last1=0) at exec.c:875
#193 0x2edb8 in execlist (list=0x138ad0, dont_change_job=1, exiting=0)
    at exec.c:744
#194 0x382c0 in runshfunc (list=0x138ad0, wrap=0x0, 
    name=0x12d838 "_main_complete") at exec.c:3029
#195 0xff04bc5c in comp_wrapper (list=0x138ad0, w=0x0, 
    name=0x12d838 "_main_complete") at compctl.c:2419
#196 0x381f0 in runshfunc (list=0x138ad0, wrap=0xff05d7f0, 
    name=0x12d838 "_main_complete") at exec.c:3016
#197 0x37ee8 in doshfunc (name=0x12d838 "_main_complete", list=0x138ad0, 
---Type <return> to continue, or q <return> to quit---
    doshargs=0x0, flags=0, noreturnval=0) at exec.c:2967
#198 0xff0a9c0c in callcompfunc (s=0xd1cd0 "", fn=0x12d838 "_main_complete")
    at zle_tricky.c:4834
#199 0xff0aa5f4 in makecomplist (s=0xd1cd0 "", incmd=0, lst=0)
    at zle_tricky.c:4993
#200 0xff0a8464 in docompletion (s=0x114a98 "", lst=0, incmd=0)
    at zle_tricky.c:4505
#201 0xff09a9cc in docomplete (lst=0) at zle_tricky.c:1086
#202 0xff097ce8 in expandorcomplete (args=0xff0d8888) at zle_tricky.c:491
#203 0xff097778 in completecall (args=0xff0d8888) at zle_tricky.c:390
#204 0xff0889f4 in execzlefunc (func=0xff0d67e4, args=0xff0d8888)
    at zle_main.c:628
#205 0xff0884e8 in zleread (lp=0xccd30 "%m%# ", rp=0x0, flags=3)
    at zle_main.c:547
#206 0x50d64 in inputline () at input.c:265
#207 0x50b30 in ingetc () at input.c:210
#208 0x469a0 in ihgetc () at hist.c:242
#209 0x58b78 in gettok () at lex.c:545
#210 0x57edc in yylex () at lex.c:308
#211 0x75e90 in parse_event () at parse.c:105
#212 0x4d580 in loop (toplevel=1, justonce=0) at init.c:113
#213 0x1aa28 in main (argc=2, argv=0xffbef484) at ./main.c:89
(gdb) print u
$1 = 0x5c285a35 <Address 0x5c285a35 out of bounds>
(gdb) 
-- 
Tanaka Akira


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: PATCH: Completion/User/_cvs again.
  1999-09-07 10:47 ` Tanaka Akira
@ 1999-09-07 22:26   ` Bart Schaefer
  1999-09-07 22:58     ` Tanaka Akira
  0 siblings, 1 reply; 12+ messages in thread
From: Bart Schaefer @ 1999-09-07 22:26 UTC (permalink / raw)
  To: Tanaka Akira; +Cc: zsh-workers

On Sep 7,  7:47pm, Tanaka Akira wrote:
> 
> I changed `_cvs' a bit. This change just its style

As long as we're talking style, why do with a `case` what you can do with
substitution?  I think the following is a lot more easily maintained, if
maybe a bit less readable ...

Index: Completion/User/_cvs
===================================================================
RCS file: /extra/cvsroot/zsh/zsh-3.1/Completion/User/_cvs,v
retrieving revision 1.15
diff -u -r1.15 _cvs
--- _cvs	1999/09/07 21:43:55	1.15
+++ _cvs	1999/09/07 22:23:19
@@ -35,34 +35,8 @@
   if (( CURRENT == 1 )); then
     compadd "$@" ${(k)cmds} || compadd "$@" ${(kv)=cmds}
   else
-    case "${${(k)cmds[(R)* $words[1] *]}:-$words[1]}" in
-      add) _cvs_add;;
-      admin) _cvs_admin;;
-      annotate) _cvs_annotate;;
-      checkout) _cvs_checkout;;
-      commit) _cvs_commit;;
-      diff) _cvs_diff;;
-      edit) _cvs_edit;;
-      editors) _cvs_editors;;
-      export) _cvs_export;;
-      history) _cvs_history;;
-      import) _cvs_import;;
-      init) _cvs_init;;
-      log) _cvs_log;;
-      login) _cvs_login;;
-      logout) _cvs_logout;;
-      rdiff) _cvs_rdiff;;
-      release) _cvs_release;;
-      remove) _cvs_remove;;
-      status) _cvs_status;;
-      rtag) _cvs_rtag;;
-      tag) _cvs_tag;;
-      unedit) _cvs_unedit;;
-      update) _cvs_update;;
-      watch) _cvs_watch;;
-      watchers) _cvs_watchers;;
-      *) _message "unknown cvs command: $words[1]";;
-    esac
+    _cvs_"${${(k)cmds[(R)* $words[1] *]}:-$words[1]}" 2>&- ||
+      _message "unknown cvs command: $words[1]"
   fi
 }
 


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: PATCH: Completion/User/_cvs again.
  1999-09-06 18:10 Tanaka Akira
@ 1999-09-07 21:06 ` Bart Schaefer
  1999-09-07 23:22   ` Tanaka Akira
  0 siblings, 1 reply; 12+ messages in thread
From: Bart Schaefer @ 1999-09-07 21:06 UTC (permalink / raw)
  To: Tanaka Akira, zsh-workers

On Sep 7,  3:10am, Tanaka Akira wrote:
> 
> +if ! builtin functions _cvs_command >&-; then
> +  _cvs_command () {

(And similarly for lots of other functions)

Aren't we already requiring the parameters modlue for some of the other
completion stuff?  Would this be faster/cleaner/clearer as

	if ! (( $+functions[_cvs_command] )); then

??


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: PATCH: Completion/User/_cvs again.
@ 1999-09-07 11:51 Sven Wischnowsky
  0 siblings, 0 replies; 12+ messages in thread
From: Sven Wischnowsky @ 1999-09-07 11:51 UTC (permalink / raw)
  To: zsh-workers


I wrote:

> Tanaka Akira wrote:
> 
> > I think the style of `_rpm' is useful for state machines. But it
> > cannot represent function call. And `_cvs' has such functions.
> > 
> > For example, `_cvs_extract_directory_entries' is called from
> > `_cvs_setup_allentries', `_cvs_setup_direntries' and
> > `_cvs_setup_modentries'. And it should return to its caller.
> > This is hard to implement in state machine style, I think.
> 
> Ah, I see. Sorry.
> 
> Yes, adding a heap of extra states a la `extract_file_or_directory_entry'
> is ugly.
> 
> Hm, some form of `case' that executes all matching branches would be
> useful here.
> 
> (Yes, I know that one can do that e.g. with a `case' in a loop where
> the case branches remove substrings from the `state' name, but that
> isn't exactly a nice solution, either.)

I always forget things...

Of course, one can also do (in file `_foo'):

  #compdef foo

  local state lstate ret=1

  if (( $# )); then
    state="$1"
  else
    _arguments '...:->bar' ... && ret=0
  fi

  while [[ -n "$state" ]]; do
    lstate="$state"
    state=''
    case "$lstate" in
    bar)
      # include completions for state `baz' and `foobar'
      _foo baz && ret=0
      _foo foobar && ret=0  # this could also be `state=foobar'
      ;;
    baz) ... ;;
    foobar) ...;;
    esac
  done

  return ret


Don't know if that is cleaner than your solution, though.

Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: PATCH: Completion/User/_cvs again.
  1999-09-07  7:17 Sven Wischnowsky
@ 1999-09-07 10:47 ` Tanaka Akira
  1999-09-07 22:26   ` Bart Schaefer
  0 siblings, 1 reply; 12+ messages in thread
From: Tanaka Akira @ 1999-09-07 10:47 UTC (permalink / raw)
  To: zsh-workers

In article <199909070717.JAA03524@beta.informatik.hu-berlin.de>,
  Sven Wischnowsky <wischnow@informatik.hu-berlin.de> writes:

> Have you had a look at `_rpm'? It uses a (pseudo-endless-) loop with a 
> `case' in it to handle the different states. The calls to `_arguments' 
> then only have to use `->name' to make the code for the state `name'
> to be executed in that loop (and use other completion code for the
> `leafs', of course). Personally, I think that this is better readable, I 
> don't want to say that everyone should use it, though.

Yes. I looked `_rpm'.

I think the style of `_rpm' is useful for state machines. But it
cannot represent function call. And `_cvs' has such functions.

For example, `_cvs_extract_directory_entries' is called from
`_cvs_setup_allentries', `_cvs_setup_direntries' and
`_cvs_setup_modentries'. And it should return to its caller.
This is hard to implement in state machine style, I think.

P.S.

I changed `_cvs' a bit. This change just its style and doesn't change
its functionality. But the patch is quite big because it's change
indentation... Sorry.

Index: Completion/User/_cvs
===================================================================
RCS file: /projects/zsh/zsh/Completion/User/_cvs,v
retrieving revision 1.1.1.4
diff -u -F^( -r1.1.1.4 _cvs
--- _cvs	1999/09/06 18:12:32	1.1.1.4
+++ _cvs	1999/09/07 10:34:47
@@ -19,661 +19,609 @@
 
 # define cvs command dispatch function.
 
-if ! builtin functions _cvs_command >&-; then
-  _cvs_command () {
-    typeset -A cmds
-    cmds=(add " ad new "          admin " adm rcs "       annotate " ann "
-	  checkout " co get "     commit " ci com "       diff " di dif "
-	  edit ""                 editors ""              export " exp ex "
-	  history " hi his "      import " im imp "       init ""
-	  log " lo rlog "         login " logon lgn "     logout ""
-	  rdiff " patch pa "      release " re rel "      remove " rm delete "
-	  status " st stat "      rtag " rt rfreeze "     tag " ta freeze "
-	  unedit ""               update " up upd "       watch ""
-	  watchers "")
-
-    if (( CURRENT == 1 )); then
-      compadd "$@" ${(k)cmds} || compadd "$@" ${(kv)=cmds}
-    else
-      case "${${(k)cmds[(R)* $words[1] *]}:-$words[1]}" in
-	add) _cvs_add;;
-	admin) _cvs_admin;;
-	annotate) _cvs_annotate;;
-	checkout) _cvs_checkout;;
-	commit) _cvs_commit;;
-	diff) _cvs_diff;;
-	edit) _cvs_edit;;
-	editors) _cvs_editors;;
-	export) _cvs_export;;
-	history) _cvs_history;;
-	import) _cvs_import;;
-	init) _cvs_init;;
-	log) _cvs_log;;
-	login) _cvs_login;;
-	logout) _cvs_logout;;
-	rdiff) _cvs_rdiff;;
-	release) _cvs_release;;
-	remove) _cvs_remove;;
-	status) _cvs_status;;
-	rtag) _cvs_rtag;;
-	tag) _cvs_tag;;
-	unedit) _cvs_unedit;;
-	update) _cvs_update;;
-	watch) _cvs_watch;;
-	watchers) _cvs_watchers;;
-	*) _message "unknown cvs command: $words[1]";;
-      esac
-    fi
-  }
-fi
-
-# define completion functions for each cvs command
-
-if ! builtin functions _cvs_add >&-; then
-  _cvs_add () {
-    # "+k:m:"
-    _arguments -s \
-      '-k+:keyword substitution:_cvs_k' \
-      '-m+:message:_cvs_m' \
-      '*:file:_cvs_files_unmaintained' \
-  }
-fi
-
-if ! builtin functions _cvs_admin >&-; then
-  _cvs_admin () {
-    # "+ib::c:a:A:e:l::u::LUn:N:m:o:s:t::IqxV:k:"
-    _arguments -s \
-      -{i,L,U,I,q,x} \
-      '-b-:default branch:(1.1.1)' \
-      '-c+:comment leader (not used):' \
-      '-a+:login names (not work with CVS):' \
-      '-A+:access list to append (not work with CVS):' \
-      '-e+:access list to erase (not work with CVS):' \
-      '-l-:revision to lock:' \
-      '-u-:revision to unlock:' \
-      '-n+:symbolic-name[\:revision]:' \
-      '-N+:symbolic-name[\:revision]:' \
-      '-m+:revision\:msg:' \
-      '-o+:range to delete:' \
-      '-s+:state[\:revision]:' \
-      '-t-:descriptive text:_cvs_admin_t' \
-      '-V+:version (obsolete):' \
-      '-k+:keyword substitution:_cvs_k' \
-      '*:file:_cvs_files'
-  }
-fi
-
-if ! builtin functions _cvs_admin_t >&-; then
-  _cvs_admin_t () {
-    if compset -P -; then
-      _message 'descriptive text'
-    else
-      _files "$@"
-    fi
-  }
-fi
-
-if ! builtin functions _cvs_annotate >&-; then
-  _cvs_annotate () {
-    # "+lr:D:fR"
-    _arguments -s \
-      -{l,f,R} \
-      '-r+:tag:_cvs_revisions' \
-      '-D+:date:_cvs_D' \
-      '*:file:_cvs_files'
-  }
-fi
-
-if ! builtin functions _cvs_checkout >&-; then
-  _cvs_checkout () {
-    # "+ANnk:d:flRpQqcsr:D:j:P"
-    _arguments -s \
-      -{A,N,n,f,l,R,q,c,s,P} \
-      '-k+:keyword substitution:_cvs_k' \
-      '-d+:directory:_files -/' \
-      '-r+:tag:_cvs_revisions' \
-      '-D+:date:_cvs_D' \
-      '-j+:tag:_cvs_revisions' \
-      '*:module:_cvs_modules'
-  }
-fi
-
-if ! builtin functions _cvs_commit >&-; then
-  _cvs_commit () {
-    # "+nlRm:fF:r:"
-    _arguments -s \
-      -{n,l,R,f} \
-      '-m+:message:_cvs_m' \
-      '-F+:log message file:_files' \
-      '-r+:tag:_cvs_revisions' \
-      '*:file:_cvs_files_modified'
-  }
-fi
-
-if ! builtin functions _cvs_diff >&-; then
-  _cvs_diff () {
-    # "+abcdefhilnpstuw0123456789BHNRC:D:F:I:L:U:V:W:k:r:"
-    _arguments -s \
-      -{l,R} \
-      '-D+:date:_cvs_D' \
-      '-k+:keyword substitution:_cvs_k' \
-      '-r+:tag:_cvs_revisions' \
-      -{h,p,0,1,2,3,4,5,6,7,8,9} \
-      '--binary' \
-      '--brief' \
-      '--changed-group-format=:format:' \
-      '-c' '-C+:lines:' '--context=-:lines:' \
-      '-e' '--ed' \
-      '-t' '--expand-tabs' \
-      '-f' '--forward-ed' \
-      '--horizon-lines=:lines:' \
-      '--ifdef=:name:' \
-      '-w' '--ignore-all-space' \
-      '-B' '--ignore-blank-lines' \
-      '-i' '--ignore-case' \
-      '-I+:regex:' '--ignore-matching-lines=:regex:' \
-      '-b' '--ignore-space-change' \
-      '--initial-tab' \
-      '*-L+:label:' '*--label=:label:' \
-      '--left-column' \
-      '--line-format=:format:' \
-      '-d' '--minimal' \
-      '-N' '--new-file' \
-      '--new-group-format=:format:' \
-      '--new-line-format=:format:' \
-      '--old-group-format=:format:' \
-      '--old-line-format=:format:' \
-      '--paginate' \
-      '-n' '--rcs' \
-      '-s' '--report-identical-files' \
-      '--show-c-function' \
-      '-F+:regex:' '--show-function-line=:regex:' \
-      '-y' '--side-by-side' \
-      '-H' '--speed-large-files' \
-      '--suppress-common-lines' \
-      '-a' '--text' \
-      '--unchanged-group-format=:format:' \
-      '--unchanged-line-format=:format:' \
-      '-u' '-U+:lines:' '--unified=-:lines:' \
-      '-W:columns:' '--width=:columns:' \
-      '*:file:_cvs_diff_arg'
-  }
-fi
-
-if ! builtin functions _cvs_diff_arg >&-; then
-  _cvs_diff_arg () {
-    _cvs_files_modified || _cvs_files
-  }
-fi
-
-if ! builtin functions _cvs_edit >&-; then
-  _cvs_edit () {
-    # "+lRa:"
-    _arguments -s \
-      -{l,R} \
-      '-a+:action:(edit unedit commit all none)'
-      '*:file:_cvs_files'
-  }
-fi
-
-if ! builtin functions _cvs_editors >&-; then
-  _cvs_editors () {
-    # "+lR"
-    _arguments -s \
-      -{l,R} \
-      '*:file:_cvs_files'
-  }
-fi
-
-if ! builtin functions _cvs_export >&-; then
-  _cvs_export () {
-    # "+Nnk:d:flRQqr:D:"
-    _arguments -s \
-      -{N,n,f,l,R,Q,q} \
-      '-k+:keyword substitution:_cvs_k' \
-      '-d+:directory:_files -/' \
-      '-r+:tag:_cvs_revisions' \
-      '-D+:date:_cvs_D' \
-      '*:module:_cvs_modules'
-  }
-fi
-
-if ! builtin functions _cvs_history >&-; then
-  _cvs_history () {
-    # "+Tacelow?D:b:f:m:n:p:r:t:u:x:X:z:"
-    _arguments -s \
-      -{T,a,c,e,l,o,w,\?} \
-      '-D+:date:_cvs_D' \
-      '-b+:string:' \
-      '-f+:arg:' \
-      '-m+:module:_cvs_modules' \
-      '-n+:arg:' \
-      '*-p+:repository:' \
-      '-r+:rev:' \
-      '-t+:tag:' \
-      '-u+:user name:' \
-      '-x+:type:_cvs_history_x' \
-      '-X+:arg:' \
-      '-z+:arg:' \
-      '*:file:_cvs_files'
-  }
-fi
-
-if ! builtin functions _cvs_history_x >&-; then
-  _cvs_history_x () {
-    compset -P '*'
-
-    compadd "$@" -y '(
-    F\ --\ release
-    O\ --\ checkout
-    E\ --\ export
-    T\ --\ rtag
-    C\ --\ merge\ collision-detected
-    G\ --\ merge\ succeed
-    U\ --\ working\ file\ was\ copied
-    W\ --\ working\ file\ was\ deleted
-    A\ --\ A\ file\ was\ added
-    M\ --\ A\ file\ was\ modified
-    R\ --\ A\ file\ was\ removed
-    )' F O E T C G U W A M R
-  }
-fi
-
-if ! builtin functions _cvs_import >&-; then
-  _cvs_import () {
-    # "+Qqdb:m:I:k:W:"
-    _arguments -s \
-      -{Q,q,d} \
-      '-b+:branch:' \
-      '-m+:message:_cvs_m' \
-      '*-I+:name:_files' \
-      '-k+:keyword substitution:_cvs_k' \
-      '*-W+:spec:' \
-      ':repository:_cvs_modules' \
-      ':vendor tag:' \
-      ':release tag:'
-  }
-fi
-
-if ! builtin functions _cvs_init >&-; then
-  _cvs_init () {
-    false
-  }
-fi
-
-if ! builtin functions _cvs_login >&-; then
-  _cvs_login () {
-    false
-  }
-fi
-
-if ! builtin functions _cvs_logout >&-; then
-  _cvs_logout () {
-    false
-  }
-fi
-
-if ! builtin functions _cvs_rdiff >&-; then
-  _cvs_rdiff () {
-    # "+V:k:cuftsQqlRD:r:"
-    _arguments -s \
-      -{c,u,f,t,s,Q,q,l,R} \
-      '-V+:version:' \
-      '-k+:keyword substitution:_cvs_k' \
-      '*-D+:date:_cvs_D' \
-      '*-r+:tag:_cvs_revisions' \
-      '*:module:_cvs_modules'
-  }
-fi
-
-if ! builtin functions _cvs_release >&-; then
-  _cvs_release () {
-    # "+Qdq"
-    _arguments -s \
-      -{Q,d,q} \
-      '*:directory:_files -/'
-  }
-fi
-
-if ! builtin functions _cvs_remove >&-; then
-  _cvs_remove () {
-    # "+flR"
-    _arguments -s \
-      -{f,l,R} \
-      '*:file:_cvs_files_removed'
-  }
-fi
-
-if ! builtin functions _cvs_status >&-; then
-  _cvs_status () {
-    # "+vlR"
-    _arguments -s \
-      -{v,l,R} \
-      '*:file:_cvs_files'
-  }
-fi
-
-if ! builtin functions _cvs_tag >&-; then
-  _cvs_tag () {
-    # "+FQqlRcdr:D:bf"
-    _arguments -s \
-      -{F,Q,q,l,R,c,d,b,f} \
-      '-r+:tag:_cvs_revisions' \
-      '-D+:date:_cvs_D' \
-      '*:file:_cvs_files'
-  }
-fi
-
-if ! builtin functions _cvs_unedit >&-; then
-  _cvs_unedit () {
-    # "+lR"
-    _arguments -s \
-      -{l,R} \
-      '*:file:_cvs_files'
-  }
-fi
+builtin functions _cvs_command >&- ||
+_cvs_command () {
+  typeset -A cmds
+  cmds=(add " ad new "          admin " adm rcs "       annotate " ann "
+	checkout " co get "     commit " ci com "       diff " di dif "
+	edit ""                 editors ""              export " exp ex "
+	history " hi his "      import " im imp "       init ""
+	log " lo rlog "         login " logon lgn "     logout ""
+	rdiff " patch pa "      release " re rel "      remove " rm delete "
+	status " st stat "      rtag " rt rfreeze "     tag " ta freeze "
+	unedit ""               update " up upd "       watch ""
+	watchers "")
 
-if ! builtin functions _cvs_update >&-; then
-  _cvs_update () {
-    # "+ApPflRQqduk:r:D:j:I:W:"
-    _arguments -s \
-      -{A,p,P,f,l,R,Q,q,d,u} \
-      '-k+:keyword substitution:_cvs_k' \
-      '-r+:tag:_cvs_revisions' \
-      '-D+:date:_cvs_D' \
-      '-j+:tag:_cvs_revisions' \
-      '*-I+:name:_files' \
-      '*-W+:spec:' \
-      '*:file:_cvs_files'
-  }
-fi
-
-if ! builtin functions _cvs_watch >&-; then
-  _cvs_watch () {
-    if (( CURRENT == 2 )); then
-      compadd on off add remove
-    else
-      case "$words[2]" in
-	on|off) # "+lR"
-	  _arguments -s \
-	  -{l,R} \
-	  ':watch command:' \
-	  ':*:file:_cvs_files'
-	  ;;
-	add|remove) # "+lRa:"
-	  _arguments -s \
-	  -{l,R} \
-	  '*-a+:action:(edit unedit commit all none)' \
-	  ':watch command:' \
-	  ':*:file:_cvs_files'
-	  ;;
-      esac
-    fi
-  }
-fi
+  if (( CURRENT == 1 )); then
+    compadd "$@" ${(k)cmds} || compadd "$@" ${(kv)=cmds}
+  else
+    case "${${(k)cmds[(R)* $words[1] *]}:-$words[1]}" in
+      add) _cvs_add;;
+      admin) _cvs_admin;;
+      annotate) _cvs_annotate;;
+      checkout) _cvs_checkout;;
+      commit) _cvs_commit;;
+      diff) _cvs_diff;;
+      edit) _cvs_edit;;
+      editors) _cvs_editors;;
+      export) _cvs_export;;
+      history) _cvs_history;;
+      import) _cvs_import;;
+      init) _cvs_init;;
+      log) _cvs_log;;
+      login) _cvs_login;;
+      logout) _cvs_logout;;
+      rdiff) _cvs_rdiff;;
+      release) _cvs_release;;
+      remove) _cvs_remove;;
+      status) _cvs_status;;
+      rtag) _cvs_rtag;;
+      tag) _cvs_tag;;
+      unedit) _cvs_unedit;;
+      update) _cvs_update;;
+      watch) _cvs_watch;;
+      watchers) _cvs_watchers;;
+      *) _message "unknown cvs command: $words[1]";;
+    esac
+  fi
+}
 
-if ! builtin functions _cvs_watchers >&-; then
-  _cvs_watchers () {
-    # "+lR"
-    _arguments -s \
-      -{l,R} \
-      ':*:file:_cvs_files'
-  }
-fi
+# define completion functions for each cvs command
 
-if ! builtin functions _cvs_root >&-; then
-  _cvs_root () {
-    compadd "$@" $_cvs_roots || _files "$@" -/
-  }
-fi
+builtin functions _cvs_add >&- ||
+_cvs_add () {
+  # "+k:m:"
+  _arguments -s \
+    '-k+:keyword substitution:_cvs_k' \
+    '-m+:message:_cvs_m' \
+    '*:file:_cvs_files_unmaintained' \
+}
+
+builtin functions _cvs_admin >&- ||
+_cvs_admin () {
+  # "+ib::c:a:A:e:l::u::LUn:N:m:o:s:t::IqxV:k:"
+  _arguments -s \
+    -{i,L,U,I,q,x} \
+    '-b-:default branch:(1.1.1)' \
+    '-c+:comment leader (not used):' \
+    '-a+:login names (not work with CVS):' \
+    '-A+:access list to append (not work with CVS):' \
+    '-e+:access list to erase (not work with CVS):' \
+    '-l-:revision to lock:' \
+    '-u-:revision to unlock:' \
+    '-n+:symbolic-name[\:revision]:' \
+    '-N+:symbolic-name[\:revision]:' \
+    '-m+:revision\:msg:' \
+    '-o+:range to delete:' \
+    '-s+:state[\:revision]:' \
+    '-t-:descriptive text:_cvs_admin_t' \
+    '-V+:version (obsolete):' \
+    '-k+:keyword substitution:_cvs_k' \
+    '*:file:_cvs_files'
+}
+
+builtin functions _cvs_admin_t >&- ||
+_cvs_admin_t () {
+  if compset -P -; then
+    _message 'descriptive text'
+  else
+    _files "$@"
+  fi
+}
 
-if ! builtin functions _cvs_tempdir >&-; then
-  _cvs_tempdir () {
-    compadd "$@" $TMPPREFIX:h $TMPDIR /tmp
-  }
-fi
+builtin functions _cvs_annotate >&- ||
+_cvs_annotate () {
+  # "+lr:D:fR"
+  _arguments -s \
+    -{l,f,R} \
+    '-r+:tag:_cvs_revisions' \
+    '-D+:date:_cvs_D' \
+    '*:file:_cvs_files'
+}
+
+builtin functions _cvs_checkout >&- ||
+_cvs_checkout () {
+  # "+ANnk:d:flRpQqcsr:D:j:P"
+  _arguments -s \
+    -{A,N,n,f,l,R,q,c,s,P} \
+    '-k+:keyword substitution:_cvs_k' \
+    '-d+:directory:_files -/' \
+    '-r+:tag:_cvs_revisions' \
+    '-D+:date:_cvs_D' \
+    '-j+:tag:_cvs_revisions' \
+    '*:module:_cvs_modules'
+}
+
+builtin functions _cvs_commit >&- ||
+_cvs_commit () {
+  # "+nlRm:fF:r:"
+  _arguments -s \
+    -{n,l,R,f} \
+    '-m+:message:_cvs_m' \
+    '-F+:log message file:_files' \
+    '-r+:tag:_cvs_revisions' \
+    '*:file:_cvs_files_modified'
+}
+
+builtin functions _cvs_diff >&- ||
+_cvs_diff () {
+  # "+abcdefhilnpstuw0123456789BHNRC:D:F:I:L:U:V:W:k:r:"
+  _arguments -s \
+    -{l,R} \
+    '-D+:date:_cvs_D' \
+    '-k+:keyword substitution:_cvs_k' \
+    '-r+:tag:_cvs_revisions' \
+    -{h,p,0,1,2,3,4,5,6,7,8,9} \
+    '--binary' \
+    '--brief' \
+    '--changed-group-format=:format:' \
+    '-c' '-C+:lines:' '--context=-:lines:' \
+    '-e' '--ed' \
+    '-t' '--expand-tabs' \
+    '-f' '--forward-ed' \
+    '--horizon-lines=:lines:' \
+    '--ifdef=:name:' \
+    '-w' '--ignore-all-space' \
+    '-B' '--ignore-blank-lines' \
+    '-i' '--ignore-case' \
+    '-I+:regex:' '--ignore-matching-lines=:regex:' \
+    '-b' '--ignore-space-change' \
+    '--initial-tab' \
+    '*-L+:label:' '*--label=:label:' \
+    '--left-column' \
+    '--line-format=:format:' \
+    '-d' '--minimal' \
+    '-N' '--new-file' \
+    '--new-group-format=:format:' \
+    '--new-line-format=:format:' \
+    '--old-group-format=:format:' \
+    '--old-line-format=:format:' \
+    '--paginate' \
+    '-n' '--rcs' \
+    '-s' '--report-identical-files' \
+    '--show-c-function' \
+    '-F+:regex:' '--show-function-line=:regex:' \
+    '-y' '--side-by-side' \
+    '-H' '--speed-large-files' \
+    '--suppress-common-lines' \
+    '-a' '--text' \
+    '--unchanged-group-format=:format:' \
+    '--unchanged-line-format=:format:' \
+    '-u' '-U+:lines:' '--unified=-:lines:' \
+    '-W:columns:' '--width=:columns:' \
+    '*:file:_cvs_diff_arg'
+}
+
+builtin functions _cvs_diff_arg >&- ||
+_cvs_diff_arg () {
+  _cvs_files_modified || _cvs_files
+}
+
+builtin functions _cvs_edit >&- ||
+_cvs_edit () {
+  # "+lRa:"
+  _arguments -s \
+    -{l,R} \
+    '-a+:action:(edit unedit commit all none)'
+    '*:file:_cvs_files'
+}
+
+builtin functions _cvs_editors >&- ||
+_cvs_editors () {
+  # "+lR"
+  _arguments -s \
+    -{l,R} \
+    '*:file:_cvs_files'
+}
+
+builtin functions _cvs_export >&- ||
+_cvs_export () {
+  # "+Nnk:d:flRQqr:D:"
+  _arguments -s \
+    -{N,n,f,l,R,Q,q} \
+    '-k+:keyword substitution:_cvs_k' \
+    '-d+:directory:_files -/' \
+    '-r+:tag:_cvs_revisions' \
+    '-D+:date:_cvs_D' \
+    '*:module:_cvs_modules'
+}
+
+builtin functions _cvs_history >&- ||
+_cvs_history () {
+  # "+Tacelow?D:b:f:m:n:p:r:t:u:x:X:z:"
+  _arguments -s \
+    -{T,a,c,e,l,o,w,\?} \
+    '-D+:date:_cvs_D' \
+    '-b+:string:' \
+    '-f+:arg:' \
+    '-m+:module:_cvs_modules' \
+    '-n+:arg:' \
+    '*-p+:repository:' \
+    '-r+:rev:' \
+    '-t+:tag:' \
+    '-u+:user name:' \
+    '-x+:type:_cvs_history_x' \
+    '-X+:arg:' \
+    '-z+:arg:' \
+    '*:file:_cvs_files'
+}
+
+builtin functions _cvs_history_x >&- ||
+_cvs_history_x () {
+  compset -P '*'
+
+  compadd "$@" -y '(
+  F\ --\ release
+  O\ --\ checkout
+  E\ --\ export
+  T\ --\ rtag
+  C\ --\ merge\ collision-detected
+  G\ --\ merge\ succeed
+  U\ --\ working\ file\ was\ copied
+  W\ --\ working\ file\ was\ deleted
+  A\ --\ A\ file\ was\ added
+  M\ --\ A\ file\ was\ modified
+  R\ --\ A\ file\ was\ removed
+  )' F O E T C G U W A M R
+}
+
+builtin functions _cvs_import >&- ||
+_cvs_import () {
+  # "+Qqdb:m:I:k:W:"
+  _arguments -s \
+    -{Q,q,d} \
+    '-b+:branch:' \
+    '-m+:message:_cvs_m' \
+    '*-I+:name:_files' \
+    '-k+:keyword substitution:_cvs_k' \
+    '*-W+:spec:' \
+    ':repository:_cvs_modules' \
+    ':vendor tag:' \
+    ':release tag:'
+}
+
+builtin functions _cvs_init >&- ||
+_cvs_init () {
+  false
+}
+
+builtin functions _cvs_login >&- ||
+_cvs_login () {
+  false
+}
+
+builtin functions _cvs_logout >&- ||
+_cvs_logout () {
+  false
+}
+
+builtin functions _cvs_rdiff >&- ||
+_cvs_rdiff () {
+  # "+V:k:cuftsQqlRD:r:"
+  _arguments -s \
+    -{c,u,f,t,s,Q,q,l,R} \
+    '-V+:version:' \
+    '-k+:keyword substitution:_cvs_k' \
+    '*-D+:date:_cvs_D' \
+    '*-r+:tag:_cvs_revisions' \
+    '*:module:_cvs_modules'
+}
+
+builtin functions _cvs_release >&- ||
+_cvs_release () {
+  # "+Qdq"
+  _arguments -s \
+    -{Q,d,q} \
+    '*:directory:_files -/'
+}
+
+builtin functions _cvs_remove >&- ||
+_cvs_remove () {
+  # "+flR"
+  _arguments -s \
+    -{f,l,R} \
+    '*:file:_cvs_files_removed'
+}
+
+builtin functions _cvs_status >&- ||
+_cvs_status () {
+  # "+vlR"
+  _arguments -s \
+    -{v,l,R} \
+    '*:file:_cvs_files'
+}
+
+builtin functions _cvs_tag >&- ||
+_cvs_tag () {
+  # "+FQqlRcdr:D:bf"
+  _arguments -s \
+    -{F,Q,q,l,R,c,d,b,f} \
+    '-r+:tag:_cvs_revisions' \
+    '-D+:date:_cvs_D' \
+    '*:file:_cvs_files'
+}
+
+builtin functions _cvs_unedit >&- ||
+_cvs_unedit () {
+  # "+lR"
+  _arguments -s \
+    -{l,R} \
+    '*:file:_cvs_files'
+}
+
+builtin functions _cvs_update >&- ||
+_cvs_update () {
+  # "+ApPflRQqduk:r:D:j:I:W:"
+  _arguments -s \
+    -{A,p,P,f,l,R,Q,q,d,u} \
+    '-k+:keyword substitution:_cvs_k' \
+    '-r+:tag:_cvs_revisions' \
+    '-D+:date:_cvs_D' \
+    '-j+:tag:_cvs_revisions' \
+    '*-I+:name:_files' \
+    '*-W+:spec:' \
+    '*:file:_cvs_files'
+}
+
+builtin functions _cvs_watch >&- ||
+_cvs_watch () {
+  if (( CURRENT == 2 )); then
+    compadd on off add remove
+  else
+    case "$words[2]" in
+      on|off) # "+lR"
+	_arguments -s \
+	-{l,R} \
+	':watch command:' \
+	':*:file:_cvs_files'
+	;;
+      add|remove) # "+lRa:"
+	_arguments -s \
+	-{l,R} \
+	'*-a+:action:(edit unedit commit all none)' \
+	':watch command:' \
+	':*:file:_cvs_files'
+	;;
+    esac
+  fi
+}
 
-if ! builtin functions _cvs_user_variable >&-; then
-  _cvs_user_variable () {
-    if compset -P '*='; then
-      _default
-    else
-      _message "variable=value"
-    fi
-  }
-fi
+builtin functions _cvs_watchers >&- ||
+_cvs_watchers () {
+  # "+lR"
+  _arguments -s \
+    -{l,R} \
+    ':*:file:_cvs_files'
+}
+
+builtin functions _cvs_root >&- ||
+_cvs_root () {
+  compadd "$@" $_cvs_roots || _files "$@" -/
+}
+
+builtin functions _cvs_tempdir >&- ||
+_cvs_tempdir () {
+  compadd "$@" $TMPPREFIX:h $TMPDIR /tmp
+}
+
+builtin functions _cvs_user_variable >&- ||
+_cvs_user_variable () {
+  if compset -P '*='; then
+    _default
+  else
+    _message "variable=value"
+  fi
+}
 
 # define completion functions for cvs global options.
-
-if ! builtin functions _cvs_bindir >&-; then
-  _cvs_bindir () {
-    compadd "$@" /usr/local/bin || _files "$@" -/
-  }
-fi
 
-if ! builtin functions _cvs_editor >&-; then
-  _cvs_editor () {
-    compadd "$@" vi
-  }
-fi
-
-if ! builtin functions _cvs_gzip_level >&-; then
-  _cvs_gzip_level () {
-    compadd "$@" 9
-  }
-fi
+builtin functions _cvs_bindir >&- ||
+_cvs_bindir () {
+  compadd "$@" /usr/local/bin || _files "$@" -/
+}
+
+builtin functions _cvs_editor >&- ||
+_cvs_editor () {
+  compadd "$@" vi
+}
+
+builtin functions _cvs_gzip_level >&- ||
+_cvs_gzip_level () {
+  compadd "$@" 9
+}
 
 # define completion functions for cvs common options and arguments.
 
-if ! builtin functions _cvs_D >&-; then
-  _cvs_D () {
-    compadd "$@" today yesterday week\ ago month\ ago
-  }
-fi
-
-if ! builtin functions _cvs_k >&-; then
-  _cvs_k () {
-    compadd "$@" kv kvl k o b v
-  }
-fi
+builtin functions _cvs_D >&- ||
+_cvs_D () {
+  compadd "$@" today yesterday week\ ago month\ ago
+}
+
+builtin functions _cvs_k >&- ||
+_cvs_k () {
+  compadd "$@" kv kvl k o b v
+}
+
+builtin functions _cvs_m >&- ||
+_cvs_m () {
+  _message "log message"
+}
+
+builtin functions _cvs_modules >&- ||
+_cvs_modules () {
+  local root=$CVSROOT
+  [[ -f CVS/Root ]] && root=$(<CVS/Root)
 
-if ! builtin functions _cvs_m >&-; then
-  _cvs_m () {
-    _message "log message"
-  }
-fi
-
-if ! builtin functions _cvs_modules >&-; then
-  _cvs_modules () {
-    local root=$CVSROOT
-    [[ -f CVS/Root ]] && root=$(<CVS/Root)
-
-    if [[ $root = :* || ! -d $root ]]; then
-      _message "module name"
-    else
-      compadd - \
-	$root/^CVSROOT(:t) \
-	${${(M)${(f)"$(<$root/CVSROOT/modules)"}:#[^#]*}%%[ 	]*}
-    fi
-  }
-fi
+  if [[ $root = :* || ! -d $root ]]; then
+    _message "module name"
+  else
+    compadd - \
+      $root/^CVSROOT(:t) \
+      ${${(M)${(f)"$(<$root/CVSROOT/modules)"}:#[^#]*}%%[ 	]*}
+  fi
+}
 
-if ! builtin functions _cvs_revisions >&-; then
-  _cvs_revisions () {
-    compadd - ${${${(M)${(f)"$(cvs -q status -vl .)"}:#	*}##[ 	]##}%%[ 	]*}
-  }
-fi
+builtin functions _cvs_revisions >&- ||
+_cvs_revisions () {
+  compadd - ${${${(M)${(f)"$(cvs -q status -vl .)"}:#	*}##[ 	]##}%%[ 	]*}
+}
 
 # define completion functions for files maintained by cvs.
-
-if ! builtin functions _cvs_setup_prefix >&-; then
-  _cvs_setup_prefix () {
-    if [[ -prefix */ ]]; then
-      qpref="${PREFIX%/*}/"
-      pref=$~qpref
-    else
-      qpref=
-      pref=./
-    fi
-  }
-fi
 
-if ! builtin functions _cvs_extract_directory_entries >&-; then
-  _cvs_extract_directory_entries () {
-    entries=($entries ${${${(M)rawentries:#D/*}#D/}%%/*})
-  }
-fi
-
-if ! builtin functions _cvs_extract_file_entries >&-; then
-  _cvs_extract_file_entries () {
-    entries=($entries ${${${(M)rawentries:#/*}#/}%%/*})
-  }
-fi
+builtin functions _cvs_setup_prefix >&- ||
+_cvs_setup_prefix () {
+  if [[ -prefix */ ]]; then
+    qpref="${PREFIX%/*}/"
+    pref=$~qpref
+  else
+    qpref=
+    pref=./
+  fi
+}
 
-if ! builtin functions _cvs_extract_modifiedfile_entries >&-; then
-  _cvs_extract_modifiedfile_entries () {
-    if [[ -n "$compconfig[_cvs_disable_stat]" ]] ||
-      ! { zmodload -e stat || zmodload stat }; then
-      _cvs_extract_file_entries
-      return
-    fi
-
-    local ents pats
-    ents=(${${${${(M)rawentries:#/*}#/}/\\/[^\\/]#\\///}%/[^/]#/[^/]#})
-    pats=(${${${(f)"$(LANG=C builtin stat -gn +mtime -F '%a %b %e %T %Y' ${pref}*(D))"}##*/}/ //})
-    eval 'ents=(${ents:#('${(j:|:)${(@)pats:q}}')})'
-    entries=($entries ${ents%%/*})
-  }
-fi
+builtin functions _cvs_extract_directory_entries >&- ||
+_cvs_extract_directory_entries () {
+  entries=($entries ${${${(M)rawentries:#D/*}#D/}%%/*})
+}
+
+builtin functions _cvs_extract_file_entries >&- ||
+_cvs_extract_file_entries () {
+  entries=($entries ${${${(M)rawentries:#/*}#/}%%/*})
+}
+
+builtin functions _cvs_extract_modifiedfile_entries >&- ||
+_cvs_extract_modifiedfile_entries () {
+  if [[ -n "$compconfig[_cvs_disable_stat]" ]] ||
+    ! { zmodload -e stat || zmodload stat }; then
+    _cvs_extract_file_entries
+    return
+  fi
 
-if ! builtin functions _cvs_setup_allentries >&-; then
-  _cvs_setup_allentries () {
-    entries=()
-    if [[ -f ${pref}CVS/Entries ]]; then
-      local rawentries
-      rawentries=(${(f)"$(<${pref}CVS/Entries)"})
-      _cvs_extract_file_entries
-      _cvs_extract_directory_entries
-    fi
-  }
-fi
+  local ents pats
+  ents=(${${${${(M)rawentries:#/*}#/}/\\/[^\\/]#\\///}%/[^/]#/[^/]#})
+  pats=(${${${(f)"$(LANG=C builtin stat -gn +mtime -F '%a %b %e %T %Y' ${pref}*(D))"}##*/}/ //})
+  eval 'ents=(${ents:#('${(j:|:)${(@)pats:q}}')})'
+  entries=($entries ${ents%%/*})
+}
+
+builtin functions _cvs_setup_allentries >&- ||
+_cvs_setup_allentries () {
+  entries=()
+  if [[ -f ${pref}CVS/Entries ]]; then
+    local rawentries
+    rawentries=(${(f)"$(<${pref}CVS/Entries)"})
+    _cvs_extract_file_entries
+    _cvs_extract_directory_entries
+  fi
+}
 
-if ! builtin functions _cvs_setup_direntries >&-; then
-  _cvs_setup_direntries () {
-    entries=()
-    if [[ -f ${pref}CVS/Entries ]]; then
-      local rawentries
-      rawentries=(${(f)"$(<${pref}CVS/Entries)"})
-      _cvs_extract_directory_entries
-    fi
-  }
-fi
+builtin functions _cvs_setup_direntries >&- ||
+_cvs_setup_direntries () {
+  entries=()
+  if [[ -f ${pref}CVS/Entries ]]; then
+    local rawentries
+    rawentries=(${(f)"$(<${pref}CVS/Entries)"})
+    _cvs_extract_directory_entries
+  fi
+}
 
-if ! builtin functions _cvs_setup_modentries >&-; then
-  _cvs_setup_modentries () {
-    entries=()
-    if [[ -f ${pref}CVS/Entries ]]; then
-      local rawentries
-      rawentries=(${(f)"$(<${pref}CVS/Entries)"})
-      _cvs_extract_modifiedfile_entries
-      _cvs_extract_directory_entries
-    fi
-  }
-fi
+builtin functions _cvs_setup_modentries >&- ||
+_cvs_setup_modentries () {
+  entries=()
+  if [[ -f ${pref}CVS/Entries ]]; then
+    local rawentries
+    rawentries=(${(f)"$(<${pref}CVS/Entries)"})
+    _cvs_extract_modifiedfile_entries
+    _cvs_extract_directory_entries
+  fi
+}
 
-if ! builtin functions _cvs_directories >&-; then
-  _cvs_directories () {
-    if [[ -d ${pref}CVS ]]; then
-      _cvs_setup_direntries
-      (( $#entries )) && compgen "$@" -g "${(j:|:)${(@)entries:q}}"
-    else
-      _files "$@"
-    fi
-  }
-fi
+builtin functions _cvs_directories >&- ||
+_cvs_directories () {
+  if [[ -d ${pref}CVS ]]; then
+    _cvs_setup_direntries
+    (( $#entries )) && compgen "$@" -g "${(j:|:)${(@)entries:q}}"
+  else
+    _files "$@"
+  fi
+}
 
-if ! builtin functions _cvs_files >&-; then
-  _cvs_files () {
-    local qpref pref entries
-    _cvs_setup_prefix
-    if [[ -d ${pref}CVS ]]; then
-      _cvs_setup_allentries
-      (( $#entries )) && compgen "$@" -g "${(j:|:)${(@)entries:q}}"
-    else
-      _files "$@"
-    fi
-  }
-fi
+builtin functions _cvs_files >&- ||
+_cvs_files () {
+  local qpref pref entries
+  _cvs_setup_prefix
+  if [[ -d ${pref}CVS ]]; then
+    _cvs_setup_allentries
+    (( $#entries )) && compgen "$@" -g "${(j:|:)${(@)entries:q}}"
+  else
+    _files "$@"
+  fi
+}
 
-if ! builtin functions _cvs_files_modified >&-; then
-  _cvs_files_modified () {
-    local qpref pref entries
-    _cvs_setup_prefix
-    if [[ -d ${pref}CVS ]]; then
-      _cvs_setup_modentries
-      (( $#entries )) && compgen "$@" -g "${(j:|:)${(@)entries:q}}"
-    else
-      _files "$@"
-    fi
-  }
-fi
+builtin functions _cvs_files_modified >&- ||
+_cvs_files_modified () {
+  local qpref pref entries
+  _cvs_setup_prefix
+  if [[ -d ${pref}CVS ]]; then
+    _cvs_setup_modentries
+    (( $#entries )) && compgen "$@" -g "${(j:|:)${(@)entries:q}}"
+  else
+    _files "$@"
+  fi
+}
 
-if ! builtin functions _cvs_files_removed >&-; then
-  _cvs_files_removed () {
-    local qpref pref entries
-    _cvs_setup_prefix
-    if [[ -d ${pref}CVS ]]; then
-      _cvs_setup_allentries
-      setopt localoptions unset
-      local omit
-      omit=(${pref}*(D:t))
-      eval 'entries=(${entries:#('${(j:|:)${(@)omit:q}}')})'
-      compadd "$@" -P "$qpref" - ${entries:q} ||
-      _cvs_directories "$@"
-    else
-      _files "$@"
-    fi
-  }
-fi
+builtin functions _cvs_files_removed >&- ||
+_cvs_files_removed () {
+  local qpref pref entries
+  _cvs_setup_prefix
+  if [[ -d ${pref}CVS ]]; then
+    _cvs_setup_allentries
+    setopt localoptions unset
+    local omit
+    omit=(${pref}*(D:t))
+    eval 'entries=(${entries:#('${(j:|:)${(@)omit:q}}')})'
+    compadd "$@" -P "$qpref" - ${entries:q} ||
+    _cvs_directories "$@"
+  else
+    _files "$@"
+  fi
+}
 
-if ! builtin functions _cvs_files_unmaintained >&-; then
-  _cvs_files_unmaintained () {
-    local qpref pref entries
-    _cvs_setup_prefix
-    if [[ -d ${pref}CVS ]]; then
-      _cvs_setup_allentries
-      setopt localoptions unset
-      local omit
-      omit=($_cvs_ignore_default ${entries:q} ${=cvsignore})
-      [[ -r ~/.cvsignore ]] && omit=($omit $(<~/.cvsignore))
-      [[ -r ${pref}.cvsignore ]] && omit=($omit $(<${pref}.cvsignore))
-      compgen "$@" -g '*~(*/|)('${(j:|:)omit}')(D)' ||
-      compgen "$@" -g '*~(*/|)('${(j:|:)${(@)entries:q}}')(D)' ||
-      _cvs_directories "$@"
-    else
-      _files "$@"
-    fi
-  }
-fi
+builtin functions _cvs_files_unmaintained >&- ||
+_cvs_files_unmaintained () {
+  local qpref pref entries
+  _cvs_setup_prefix
+  if [[ -d ${pref}CVS ]]; then
+    _cvs_setup_allentries
+    setopt localoptions unset
+    local omit
+    omit=($_cvs_ignore_default ${entries:q} ${=cvsignore})
+    [[ -r ~/.cvsignore ]] && omit=($omit $(<~/.cvsignore))
+    [[ -r ${pref}.cvsignore ]] && omit=($omit $(<${pref}.cvsignore))
+    compgen "$@" -g '*~(*/|)('${(j:|:)omit}')(D)' ||
+    compgen "$@" -g '*~(*/|)('${(j:|:)${(@)entries:q}}')(D)' ||
+    _cvs_directories "$@"
+  else
+    _files "$@"
+  fi
+}
 
 # define configuration variables.
 
-if (( ! $+_cvs_roots )); then
-  if [[ -f ~/.cvspass ]]; then
-    _cvs_roots=(${${(f)"$(<~/.cvspass)"}%% *})
-  else
-    _cvs_roots=()
-  fi
+(( $+_cvs_roots )) ||
+if [[ -f ~/.cvspass ]]; then
+  _cvs_roots=(${${(f)"$(<~/.cvspass)"}%% *})
+else
+  _cvs_roots=()
 fi
 
-if (( ! $+_cvs_ignore_default )); then
-  _cvs_ignore_default=(
-    RCS SCCS CVS CVS.adm RCSLOG 'cvslog.*' tags TAGS .make.state .nse_depinfo
-    '*\~' '\#*' '.\#*' ',*' '_$*' '*$' '*.old' '*.bak' '*.BAK' '*.orig' '*.rej'
-    '.del-*' '*.a' '*.olb' '*.o' '*.obj' '*.so' '*.exe' '*.Z' '*.elc' '*.ln'
-    core
-  )
-fi
+(( $+_cvs_ignore_default )) ||
+_cvs_ignore_default=(
+  RCS SCCS CVS CVS.adm RCSLOG 'cvslog.*' tags TAGS .make.state .nse_depinfo
+  '*\~' '\#*' '.\#*' ',*' '_$*' '*$' '*.old' '*.bak' '*.BAK' '*.orig' '*.rej'
+  '.del-*' '*.a' '*.olb' '*.o' '*.obj' '*.so' '*.exe' '*.Z' '*.elc' '*.ln'
+  core
+)
 
 # call real _cvs.
 
-- 
Tanaka Akira


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: PATCH: Completion/User/_cvs again.
@ 1999-09-07  7:17 Sven Wischnowsky
  1999-09-07 10:47 ` Tanaka Akira
  0 siblings, 1 reply; 12+ messages in thread
From: Sven Wischnowsky @ 1999-09-07  7:17 UTC (permalink / raw)
  To: zsh-workers


Tanaka Akira wrote:

> This is new condensed version of _cvs.
> After applying the patch, you should remove Completion/Cvs.
> 
> I didn't use the state machine support "->" by _arguments because
> there are functions that is `called' such as _cvs_setup_prefix. (An
> state machine cannot represent call-return relation because it has no
> stack.)

Have you had a look at `_rpm'? It uses a (pseudo-endless-) loop with a 
`case' in it to handle the different states. The calls to `_arguments' 
then only have to use `->name' to make the code for the state `name'
to be executed in that loop (and use other completion code for the
`leafs', of course). Personally, I think that this is better readable, I 
don't want to say that everyone should use it, though.

Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 12+ messages in thread

* PATCH: Completion/User/_cvs again.
@ 1999-09-06 18:10 Tanaka Akira
  1999-09-07 21:06 ` Bart Schaefer
  0 siblings, 1 reply; 12+ messages in thread
From: Tanaka Akira @ 1999-09-06 18:10 UTC (permalink / raw)
  To: zsh-workers

This is new condensed version of _cvs.
After applying the patch, you should remove Completion/Cvs.

I didn't use the state machine support "->" by _arguments because
there are functions that is `called' such as _cvs_setup_prefix. (An
state machine cannot represent call-return relation because it has no
stack.)

However I think state machine is good for command line parsing even
now, it is not enough for general programming.

--- /dev/null	Mon Sep  6 20:50:56 1999
+++ Completion/User/_cvs	Tue Sep  7 02:49:55 1999
@@ -0,0 +1,680 @@
+#compdef cvs
+
+# redefine _cvs.
+
+_cvs () {
+  # "+Qqrwtnlvb:T:e:d:Hfz:s:xa"
+  _arguments -s \
+    -{a,f,H,l,n,Q,q,r,t,v,w,x} \
+    '--version' '--help' '--help-commands' '--help-synonyms' '--help-options' \
+    '--allow-root=:rootdir:_files -/' \
+    '-b+:bindir:_cvs_bindir' \
+    '-T+:temporary directory:_cvs_tempdir' \
+    '-d+:cvsroot:_cvs_root' \
+    '-e+:editor:_cvs_editor' \
+    '-s+:user variable:_cvs_user_variable' \
+    '-z+:gzip level:_cvs_gzip_level' \
+    '*::cvs command:_cvs_command'
+}
+
+# define cvs command dispatch function.
+
+if ! builtin functions _cvs_command >&-; then
+  _cvs_command () {
+    typeset -A cmds
+    cmds=(add " ad new "          admin " adm rcs "       annotate " ann "
+	  checkout " co get "     commit " ci com "       diff " di dif "
+	  edit ""                 editors ""              export " exp ex "
+	  history " hi his "      import " im imp "       init ""
+	  log " lo rlog "         login " logon lgn "     logout ""
+	  rdiff " patch pa "      release " re rel "      remove " rm delete "
+	  status " st stat "      rtag " rt rfreeze "     tag " ta freeze "
+	  unedit ""               update " up upd "       watch ""
+	  watchers "")
+
+    if (( CURRENT == 1 )); then
+      compadd "$@" ${(k)cmds} || compadd "$@" ${(kv)=cmds}
+    else
+      case "${${(k)cmds[(R)* $words[1] *]}:-$words[1]}" in
+	add) _cvs_add;;
+	admin) _cvs_admin;;
+	annotate) _cvs_annotate;;
+	checkout) _cvs_checkout;;
+	commit) _cvs_commit;;
+	diff) _cvs_diff;;
+	edit) _cvs_edit;;
+	editors) _cvs_editors;;
+	export) _cvs_export;;
+	history) _cvs_history;;
+	import) _cvs_import;;
+	init) _cvs_init;;
+	log) _cvs_log;;
+	login) _cvs_login;;
+	logout) _cvs_logout;;
+	rdiff) _cvs_rdiff;;
+	release) _cvs_release;;
+	remove) _cvs_remove;;
+	status) _cvs_status;;
+	rtag) _cvs_rtag;;
+	tag) _cvs_tag;;
+	unedit) _cvs_unedit;;
+	update) _cvs_update;;
+	watch) _cvs_watch;;
+	watchers) _cvs_watchers;;
+	*) _message "unknown cvs command: $words[1]";;
+      esac
+    fi
+  }
+fi
+
+# define completion functions for each cvs command
+
+if ! builtin functions _cvs_add >&-; then
+  _cvs_add () {
+    # "+k:m:"
+    _arguments -s \
+      '-k+:keyword substitution:_cvs_k' \
+      '-m+:message:_cvs_m' \
+      '*:file:_cvs_files_unmaintained' \
+  }
+fi
+
+if ! builtin functions _cvs_admin >&-; then
+  _cvs_admin () {
+    # "+ib::c:a:A:e:l::u::LUn:N:m:o:s:t::IqxV:k:"
+    _arguments -s \
+      -{i,L,U,I,q,x} \
+      '-b-:default branch:(1.1.1)' \
+      '-c+:comment leader (not used):' \
+      '-a+:login names (not work with CVS):' \
+      '-A+:access list to append (not work with CVS):' \
+      '-e+:access list to erase (not work with CVS):' \
+      '-l-:revision to lock:' \
+      '-u-:revision to unlock:' \
+      '-n+:symbolic-name[\:revision]:' \
+      '-N+:symbolic-name[\:revision]:' \
+      '-m+:revision\:msg:' \
+      '-o+:range to delete:' \
+      '-s+:state[\:revision]:' \
+      '-t-:descriptive text:_cvs_admin_t' \
+      '-V+:version (obsolete):' \
+      '-k+:keyword substitution:_cvs_k' \
+      '*:file:_cvs_files'
+  }
+fi
+
+if ! builtin functions _cvs_admin_t >&-; then
+  _cvs_admin_t () {
+    if compset -P -; then
+      _message 'descriptive text'
+    else
+      _files "$@"
+    fi
+  }
+fi
+
+if ! builtin functions _cvs_annotate >&-; then
+  _cvs_annotate () {
+    # "+lr:D:fR"
+    _arguments -s \
+      -{l,f,R} \
+      '-r+:tag:_cvs_revisions' \
+      '-D+:date:_cvs_D' \
+      '*:file:_cvs_files'
+  }
+fi
+
+if ! builtin functions _cvs_checkout >&-; then
+  _cvs_checkout () {
+    # "+ANnk:d:flRpQqcsr:D:j:P"
+    _arguments -s \
+      -{A,N,n,f,l,R,q,c,s,P} \
+      '-k+:keyword substitution:_cvs_k' \
+      '-d+:directory:_files -/' \
+      '-r+:tag:_cvs_revisions' \
+      '-D+:date:_cvs_D' \
+      '-j+:tag:_cvs_revisions' \
+      '*:module:_cvs_modules'
+  }
+fi
+
+if ! builtin functions _cvs_commit >&-; then
+  _cvs_commit () {
+    # "+nlRm:fF:r:"
+    _arguments -s \
+      -{n,l,R,f} \
+      '-m+:message:_cvs_m' \
+      '-F+:log message file:_files' \
+      '-r+:tag:_cvs_revisions' \
+      '*:file:_cvs_files_modified'
+  }
+fi
+
+if ! builtin functions _cvs_diff >&-; then
+  _cvs_diff () {
+    # "+abcdefhilnpstuw0123456789BHNRC:D:F:I:L:U:V:W:k:r:"
+    _arguments -s \
+      -{l,R} \
+      '-D+:date:_cvs_D' \
+      '-k+:keyword substitution:_cvs_k' \
+      '-r+:tag:_cvs_revisions' \
+      -{h,p,0,1,2,3,4,5,6,7,8,9} \
+      '--binary' \
+      '--brief' \
+      '--changed-group-format=:format:' \
+      '-c' '-C+:lines:' '--context=-:lines:' \
+      '-e' '--ed' \
+      '-t' '--expand-tabs' \
+      '-f' '--forward-ed' \
+      '--horizon-lines=:lines:' \
+      '--ifdef=:name:' \
+      '-w' '--ignore-all-space' \
+      '-B' '--ignore-blank-lines' \
+      '-i' '--ignore-case' \
+      '-I+:regex:' '--ignore-matching-lines=:regex:' \
+      '-b' '--ignore-space-change' \
+      '--initial-tab' \
+      '*-L+:label:' '*--label=:label:' \
+      '--left-column' \
+      '--line-format=:format:' \
+      '-d' '--minimal' \
+      '-N' '--new-file' \
+      '--new-group-format=:format:' \
+      '--new-line-format=:format:' \
+      '--old-group-format=:format:' \
+      '--old-line-format=:format:' \
+      '--paginate' \
+      '-n' '--rcs' \
+      '-s' '--report-identical-files' \
+      '--show-c-function' \
+      '-F+:regex:' '--show-function-line=:regex:' \
+      '-y' '--side-by-side' \
+      '-H' '--speed-large-files' \
+      '--suppress-common-lines' \
+      '-a' '--text' \
+      '--unchanged-group-format=:format:' \
+      '--unchanged-line-format=:format:' \
+      '-u' '-U+:lines:' '--unified=-:lines:' \
+      '-W:columns:' '--width=:columns:' \
+      '*:file:_cvs_diff_arg'
+  }
+fi
+
+if ! builtin functions _cvs_diff_arg >&-; then
+  _cvs_diff_arg () {
+    _cvs_files_modified || _cvs_files
+  }
+fi
+
+if ! builtin functions _cvs_edit >&-; then
+  _cvs_edit () {
+    # "+lRa:"
+    _arguments -s \
+      -{l,R} \
+      '-a+:action:(edit unedit commit all none)'
+      '*:file:_cvs_files'
+  }
+fi
+
+if ! builtin functions _cvs_editors >&-; then
+  _cvs_editors () {
+    # "+lR"
+    _arguments -s \
+      -{l,R} \
+      '*:file:_cvs_files'
+  }
+fi
+
+if ! builtin functions _cvs_export >&-; then
+  _cvs_export () {
+    # "+Nnk:d:flRQqr:D:"
+    _arguments -s \
+      -{N,n,f,l,R,Q,q} \
+      '-k+:keyword substitution:_cvs_k' \
+      '-d+:directory:_files -/' \
+      '-r+:tag:_cvs_revisions' \
+      '-D+:date:_cvs_D' \
+      '*:module:_cvs_modules'
+  }
+fi
+
+if ! builtin functions _cvs_history >&-; then
+  _cvs_history () {
+    # "+Tacelow?D:b:f:m:n:p:r:t:u:x:X:z:"
+    _arguments -s \
+      -{T,a,c,e,l,o,w,\?} \
+      '-D+:date:_cvs_D' \
+      '-b+:string:' \
+      '-f+:arg:' \
+      '-m+:module:_cvs_modules' \
+      '-n+:arg:' \
+      '*-p+:repository:' \
+      '-r+:rev:' \
+      '-t+:tag:' \
+      '-u+:user name:' \
+      '-x+:type:_cvs_history_x' \
+      '-X+:arg:' \
+      '-z+:arg:' \
+      '*:file:_cvs_files'
+  }
+fi
+
+if ! builtin functions _cvs_history_x >&-; then
+  _cvs_history_x () {
+    compset -P '*'
+
+    compadd "$@" -y '(
+    F\ --\ release
+    O\ --\ checkout
+    E\ --\ export
+    T\ --\ rtag
+    C\ --\ merge\ collision-detected
+    G\ --\ merge\ succeed
+    U\ --\ working\ file\ was\ copied
+    W\ --\ working\ file\ was\ deleted
+    A\ --\ A\ file\ was\ added
+    M\ --\ A\ file\ was\ modified
+    R\ --\ A\ file\ was\ removed
+    )' F O E T C G U W A M R
+  }
+fi
+
+if ! builtin functions _cvs_import >&-; then
+  _cvs_import () {
+    # "+Qqdb:m:I:k:W:"
+    _arguments -s \
+      -{Q,q,d} \
+      '-b+:branch:' \
+      '-m+:message:_cvs_m' \
+      '*-I+:name:_files' \
+      '-k+:keyword substitution:_cvs_k' \
+      '*-W+:spec:' \
+      ':repository:_cvs_modules' \
+      ':vendor tag:' \
+      ':release tag:'
+  }
+fi
+
+if ! builtin functions _cvs_init >&-; then
+  _cvs_init () {
+    false
+  }
+fi
+
+if ! builtin functions _cvs_login >&-; then
+  _cvs_login () {
+    false
+  }
+fi
+
+if ! builtin functions _cvs_logout >&-; then
+  _cvs_logout () {
+    false
+  }
+fi
+
+if ! builtin functions _cvs_rdiff >&-; then
+  _cvs_rdiff () {
+    # "+V:k:cuftsQqlRD:r:"
+    _arguments -s \
+      -{c,u,f,t,s,Q,q,l,R} \
+      '-V+:version:' \
+      '-k+:keyword substitution:_cvs_k' \
+      '*-D+:date:_cvs_D' \
+      '*-r+:tag:_cvs_revisions' \
+      '*:module:_cvs_modules'
+  }
+fi
+
+if ! builtin functions _cvs_release >&-; then
+  _cvs_release () {
+    # "+Qdq"
+    _arguments -s \
+      -{Q,d,q} \
+      '*:directory:_files -/'
+  }
+fi
+
+if ! builtin functions _cvs_remove >&-; then
+  _cvs_remove () {
+    # "+flR"
+    _arguments -s \
+      -{f,l,R} \
+      '*:file:_cvs_files_removed'
+  }
+fi
+
+if ! builtin functions _cvs_status >&-; then
+  _cvs_status () {
+    # "+vlR"
+    _arguments -s \
+      -{v,l,R} \
+      '*:file:_cvs_files'
+  }
+fi
+
+if ! builtin functions _cvs_tag >&-; then
+  _cvs_tag () {
+    # "+FQqlRcdr:D:bf"
+    _arguments -s \
+      -{F,Q,q,l,R,c,d,b,f} \
+      '-r+:tag:_cvs_revisions' \
+      '-D+:date:_cvs_D' \
+      '*:file:_cvs_files'
+  }
+fi
+
+if ! builtin functions _cvs_unedit >&-; then
+  _cvs_unedit () {
+    # "+lR"
+    _arguments -s \
+      -{l,R} \
+      '*:file:_cvs_files'
+  }
+fi
+
+if ! builtin functions _cvs_update >&-; then
+  _cvs_update () {
+    # "+ApPflRQqduk:r:D:j:I:W:"
+    _arguments -s \
+      -{A,p,P,f,l,R,Q,q,d,u} \
+      '-k+:keyword substitution:_cvs_k' \
+      '-r+:tag:_cvs_revisions' \
+      '-D+:date:_cvs_D' \
+      '-j+:tag:_cvs_revisions' \
+      '*-I+:name:_files' \
+      '*-W+:spec:' \
+      '*:file:_cvs_files'
+  }
+fi
+
+if ! builtin functions _cvs_watch >&-; then
+  _cvs_watch () {
+    if (( CURRENT == 2 )); then
+      compadd on off add remove
+    else
+      case "$words[2]" in
+	on|off) # "+lR"
+	  _arguments -s \
+	  -{l,R} \
+	  ':watch command:' \
+	  ':*:file:_cvs_files'
+	  ;;
+	add|remove) # "+lRa:"
+	  _arguments -s \
+	  -{l,R} \
+	  '*-a+:action:(edit unedit commit all none)' \
+	  ':watch command:' \
+	  ':*:file:_cvs_files'
+	  ;;
+      esac
+    fi
+  }
+fi
+
+if ! builtin functions _cvs_watchers >&-; then
+  _cvs_watchers () {
+    # "+lR"
+    _arguments -s \
+      -{l,R} \
+      ':*:file:_cvs_files'
+  }
+fi
+
+if ! builtin functions _cvs_root >&-; then
+  _cvs_root () {
+    compadd "$@" $_cvs_roots || _files "$@" -/
+  }
+fi
+
+if ! builtin functions _cvs_tempdir >&-; then
+  _cvs_tempdir () {
+    compadd "$@" $TMPPREFIX:h $TMPDIR /tmp
+  }
+fi
+
+if ! builtin functions _cvs_user_variable >&-; then
+  _cvs_user_variable () {
+    if compset -P '*='; then
+      _default
+    else
+      _message "variable=value"
+    fi
+  }
+fi
+
+# define completion functions for cvs global options.
+
+if ! builtin functions _cvs_bindir >&-; then
+  _cvs_bindir () {
+    compadd "$@" /usr/local/bin || _files "$@" -/
+  }
+fi
+
+if ! builtin functions _cvs_editor >&-; then
+  _cvs_editor () {
+    compadd "$@" vi
+  }
+fi
+
+if ! builtin functions _cvs_gzip_level >&-; then
+  _cvs_gzip_level () {
+    compadd "$@" 9
+  }
+fi
+
+# define completion functions for cvs common options and arguments.
+
+if ! builtin functions _cvs_D >&-; then
+  _cvs_D () {
+    compadd "$@" today yesterday week\ ago month\ ago
+  }
+fi
+
+if ! builtin functions _cvs_k >&-; then
+  _cvs_k () {
+    compadd "$@" kv kvl k o b v
+  }
+fi
+
+if ! builtin functions _cvs_m >&-; then
+  _cvs_m () {
+    _message "log message"
+  }
+fi
+
+if ! builtin functions _cvs_modules >&-; then
+  _cvs_modules () {
+    local root=$CVSROOT
+    [[ -f CVS/Root ]] && root=$(<CVS/Root)
+
+    if [[ $root = :* || ! -d $root ]]; then
+      _message "module name"
+    else
+      compadd - \
+	$root/^CVSROOT(:t) \
+	${${(M)${(f)"$(<$root/CVSROOT/modules)"}:#[^#]*}%%[ 	]*}
+    fi
+  }
+fi
+
+if ! builtin functions _cvs_revisions >&-; then
+  _cvs_revisions () {
+    compadd - ${${${(M)${(f)"$(cvs -q status -vl .)"}:#	*}##[ 	]##}%%[ 	]*}
+  }
+fi
+
+# define completion functions for files maintained by cvs.
+
+if ! builtin functions _cvs_setup_prefix >&-; then
+  _cvs_setup_prefix () {
+    if [[ -prefix */ ]]; then
+      qpref="${PREFIX%/*}/"
+      pref=$~qpref
+    else
+      qpref=
+      pref=./
+    fi
+  }
+fi
+
+if ! builtin functions _cvs_extract_directory_entries >&-; then
+  _cvs_extract_directory_entries () {
+    entries=($entries ${${${(M)rawentries:#D/*}#D/}%%/*})
+  }
+fi
+
+if ! builtin functions _cvs_extract_file_entries >&-; then
+  _cvs_extract_file_entries () {
+    entries=($entries ${${${(M)rawentries:#/*}#/}%%/*})
+  }
+fi
+
+if ! builtin functions _cvs_extract_modifiedfile_entries >&-; then
+  _cvs_extract_modifiedfile_entries () {
+    if [[ -n "$compconfig[_cvs_disable_stat]" ]] ||
+      ! { zmodload -e stat || zmodload stat }; then
+      _cvs_extract_file_entries
+      return
+    fi
+
+    local ents pats
+    ents=(${${${${(M)rawentries:#/*}#/}/\\/[^\\/]#\\///}%/[^/]#/[^/]#})
+    pats=(${${${(f)"$(LANG=C builtin stat -gn +mtime -F '%a %b %e %T %Y' ${pref}*(D))"}##*/}/ //})
+    eval 'ents=(${ents:#('${(j:|:)${(@)pats:q}}')})'
+    entries=($entries ${ents%%/*})
+  }
+fi
+
+if ! builtin functions _cvs_setup_allentries >&-; then
+  _cvs_setup_allentries () {
+    entries=()
+    if [[ -f ${pref}CVS/Entries ]]; then
+      local rawentries
+      rawentries=(${(f)"$(<${pref}CVS/Entries)"})
+      _cvs_extract_file_entries
+      _cvs_extract_directory_entries
+    fi
+  }
+fi
+
+if ! builtin functions _cvs_setup_direntries >&-; then
+  _cvs_setup_direntries () {
+    entries=()
+    if [[ -f ${pref}CVS/Entries ]]; then
+      local rawentries
+      rawentries=(${(f)"$(<${pref}CVS/Entries)"})
+      _cvs_extract_directory_entries
+    fi
+  }
+fi
+
+if ! builtin functions _cvs_setup_modentries >&-; then
+  _cvs_setup_modentries () {
+    entries=()
+    if [[ -f ${pref}CVS/Entries ]]; then
+      local rawentries
+      rawentries=(${(f)"$(<${pref}CVS/Entries)"})
+      _cvs_extract_modifiedfile_entries
+      _cvs_extract_directory_entries
+    fi
+  }
+fi
+
+if ! builtin functions _cvs_directories >&-; then
+  _cvs_directories () {
+    if [[ -d ${pref}CVS ]]; then
+      _cvs_setup_direntries
+      (( $#entries )) && compgen "$@" -g "${(j:|:)${(@)entries:q}}"
+    else
+      _files "$@"
+    fi
+  }
+fi
+
+if ! builtin functions _cvs_files >&-; then
+  _cvs_files () {
+    local qpref pref entries
+    _cvs_setup_prefix
+    if [[ -d ${pref}CVS ]]; then
+      _cvs_setup_allentries
+      (( $#entries )) && compgen "$@" -g "${(j:|:)${(@)entries:q}}"
+    else
+      _files "$@"
+    fi
+  }
+fi
+
+if ! builtin functions _cvs_files_modified >&-; then
+  _cvs_files_modified () {
+    local qpref pref entries
+    _cvs_setup_prefix
+    if [[ -d ${pref}CVS ]]; then
+      _cvs_setup_modentries
+      (( $#entries )) && compgen "$@" -g "${(j:|:)${(@)entries:q}}"
+    else
+      _files "$@"
+    fi
+  }
+fi
+
+if ! builtin functions _cvs_files_removed >&-; then
+  _cvs_files_removed () {
+    local qpref pref entries
+    _cvs_setup_prefix
+    if [[ -d ${pref}CVS ]]; then
+      _cvs_setup_allentries
+      setopt localoptions unset
+      local omit
+      omit=(${pref}*(D:t))
+      eval 'entries=(${entries:#('${(j:|:)${(@)omit:q}}')})'
+      compadd "$@" -P "$qpref" - ${entries:q} ||
+      _cvs_directories "$@"
+    else
+      _files "$@"
+    fi
+  }
+fi
+
+if ! builtin functions _cvs_files_unmaintained >&-; then
+  _cvs_files_unmaintained () {
+    local qpref pref entries
+    _cvs_setup_prefix
+    if [[ -d ${pref}CVS ]]; then
+      _cvs_setup_allentries
+      setopt localoptions unset
+      local omit
+      omit=($_cvs_ignore_default ${entries:q} ${=cvsignore})
+      [[ -r ~/.cvsignore ]] && omit=($omit $(<~/.cvsignore))
+      [[ -r ${pref}.cvsignore ]] && omit=($omit $(<${pref}.cvsignore))
+      compgen "$@" -g '*~(*/|)('${(j:|:)omit}')(D)' ||
+      compgen "$@" -g '*~(*/|)('${(j:|:)${(@)entries:q}}')(D)' ||
+      _cvs_directories "$@"
+    else
+      _files "$@"
+    fi
+  }
+fi
+
+# define configuration variables.
+
+if (( ! $+_cvs_roots )); then
+  if [[ -f ~/.cvspass ]]; then
+    _cvs_roots=(${${(f)"$(<~/.cvspass)"}%% *})
+  else
+    _cvs_roots=()
+  fi
+fi
+
+if (( ! $+_cvs_ignore_default )); then
+  _cvs_ignore_default=(
+    RCS SCCS CVS CVS.adm RCSLOG 'cvslog.*' tags TAGS .make.state .nse_depinfo
+    '*\~' '\#*' '.\#*' ',*' '_$*' '*$' '*.old' '*.bak' '*.BAK' '*.orig' '*.rej'
+    '.del-*' '*.a' '*.olb' '*.o' '*.obj' '*.so' '*.exe' '*.Z' '*.elc' '*.ln'
+    core
+  )
+fi
+
+# call real _cvs.
+
+_cvs "$@"
Index: INSTALL
===================================================================
RCS file: /projects/zsh/zsh/INSTALL,v
retrieving revision 1.1.1.10
diff -u -F^( -r1.1.1.10 INSTALL
--- INSTALL	1999/09/06 11:05:39	1.1.1.10
+++ INSTALL	1999/09/06 17:57:05
@@ -253,7 +253,7 @@
 Completion or Functions subdirectories.  By default, all the functions for
 the Completion system will be installed (see the zshcompsys manual page),
 plus those provide functions for the line editor, i.e.
-  FUNCTIONS_INSTALL='Core/* Base/* Builtins/* User/* Commands/* Cvs/* Debian/*  Linux/* X/* Zle/*'
+  FUNCTIONS_INSTALL='Core/* Base/* Builtins/* User/* Commands/* Debian/* Linux/* X/* Zle/*'
 and if the --enable-dynamic option was given, the functions in
 Functions/Zftp, which require the zftp module to be available (see the
 zshzftpsys manual page), will be included as well.  Note, however, that
@@ -262,7 +262,7 @@
 
 There are also some miscellaneous functions with documentation in comments;
 the complete set of functions can be installed with
-  FUNCTIONS_INSTALL='Core/* Base/* Builtins/* User/* Commands/* Cvs/* \
+  FUNCTIONS_INSTALL='Core/* Base/* Builtins/* User/* Commands/* \
   Debian/* Linux/* X/* Misc/* Zftp/* Zle/*'
 Note you should set this by hand to include `Zftp/*' if you have zftp
 compiled into a statically linked shell.
Index: configure.in
===================================================================
RCS file: /projects/zsh/zsh/configure.in,v
retrieving revision 1.1.1.25
diff -u -F^( -r1.1.1.25 configure.in
--- configure.in	1999/09/06 11:05:40	1.1.1.25
+++ configure.in	1999/09/06 17:57:05
@@ -215,7 +215,7 @@
 [  --enable-function-subdirs  install functions in subdirectories])
 
 if test "x${FUNCTIONS_INSTALL+set}" != xset; then
-  FUNCTIONS_INSTALL="Core/* Base/* Builtins/* User/* Commands/* Cvs/* Debian/* Linux/* X/* Zle/*"
+  FUNCTIONS_INSTALL="Core/* Base/* Builtins/* User/* Commands/* Debian/* Linux/* X/* Zle/*"
   if test $dynamic != no; then
     FUNCTIONS_INSTALL="${FUNCTIONS_INSTALL} Zftp/*"
   fi
-- 
Tanaka Akira


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~1999-09-08  8:27 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-09-07 11:22 PATCH: Completion/User/_cvs again Sven Wischnowsky
  -- strict thread matches above, loose matches on Subject: below --
1999-09-08  8:27 Sven Wischnowsky
1999-09-08  7:08 Sven Wischnowsky
1999-09-07 11:51 Sven Wischnowsky
1999-09-07  7:17 Sven Wischnowsky
1999-09-07 10:47 ` Tanaka Akira
1999-09-07 22:26   ` Bart Schaefer
1999-09-07 22:58     ` Tanaka Akira
1999-09-08  0:46       ` Bart Schaefer
1999-09-06 18:10 Tanaka Akira
1999-09-07 21:06 ` Bart Schaefer
1999-09-07 23:22   ` Tanaka Akira

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).