about summary refs log tree commit diff
path: root/Completion/User/_gprof
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2000-04-11 07:57:56 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2000-04-11 07:57:56 +0000
commitfac3086d9782e73dcaf1aa65fd36a0b63a374719 (patch)
tree7bab35e2787ca17f02ec932dffae1bfff2ffcfe3 /Completion/User/_gprof
parent37012f06a7e5e8a64614dbf9032c77cff1bcfcfb (diff)
downloadzsh-fac3086d9782e73dcaf1aa65fd36a0b63a374719.tar.gz
zsh-fac3086d9782e73dcaf1aa65fd36a0b63a374719.tar.xz
zsh-fac3086d9782e73dcaf1aa65fd36a0b63a374719.zip
_wanted now tests both tags and labels; change places where _wanted was called without a command; allow multiple patterns per string in file-patterns; update _next_tags to work with labels (10632)
Diffstat (limited to 'Completion/User/_gprof')
-rw-r--r--Completion/User/_gprof60
1 files changed, 53 insertions, 7 deletions
diff --git a/Completion/User/_gprof b/Completion/User/_gprof
index 0a1d621be..659e921e8 100644
--- a/Completion/User/_gprof
+++ b/Completion/User/_gprof
@@ -1,12 +1,58 @@
 #compdef gprof
 
-_arguments -s -{a,b,c,D,h,i,l,L,s,T,v,w,x,y,z} \
-           -{A,C,e,E,f,F,J,n,N,O,p,P,q,Q,Z}:'function name: _exec_funcs' \
+local curcontext="$curcontext" state line ret=1
+typeset -A opt_args
+
+_arguments -C -s -{a,b,c,D,h,i,l,L,s,T,v,w,x,y,z} \
+           -{A,C,e,E,f,F,J,n,N,O,p,P,q,Q,Z}:'function name:->funcs' \
 	   '-I:directory:_dir_list' \
-	   '-d-:debug level:' '-k:function names: _exec_funcs -p' \
+	   '-d-:debug level:' '-k:function names:->pair' \
 	   '-m:minimum execution count:' \
-	   ':executable:_files -g *(*)' \
-	   ':profile file:_files -g gmon.*' \
+	   ':executable:_files -g \*\(\*\)' \
+	   ':profile file:_files -g gmon.\*' \
 	   -- -s '(#--[no-] --)' \
-           '*=name*:function name: _exec_funcs' \
-	   '*=dirs*:directory:_dir_list'
+           '*=name*:function name:->funcs' \
+	   '*=dirs*:directory:_dir_list' && ret=0
+
+if [[ -n "$state" ]]; then
+  local cmd pair expl
+
+  _tags functions || return 1
+
+  [[ "$state" = pair ]] && pair=yes
+
+  if [[ $#line -gt 1 ]]; then
+    cmd="$line[2]"
+  else
+    return 1
+  fi
+
+  if [[ -n "$cmd" ]]; then
+    if [[ "$cmd" = /* ]]; then
+      tmp="$cmd"
+    else
+      tmp="$PWD/$cmd"
+    fi
+
+    if [[ "$tmp" != "$_gprof_command" ]]; then
+      _gprof_command="$tmp"
+      _gprof_funcs=( "${(@)${(@M)${(@f)$(nm $cmd)}:#[^ ]# [tT] ([^_]|_[^_])*}##* }" )
+    fi
+  
+    if [[ -n "$pair" ]]; then
+      if compset -P '*/'; then
+        expl='call arc to function'
+      else
+        expl='call arc from function'
+      fi
+    else
+      expl=function
+    fi
+    _wanted functions expl "$expl" \
+        compadd "$expl[@]" -M 'r:|_=* r:|=*' - "$_gprof_funcs[@]" && ret=0
+  else
+    return 1
+  fi
+fi
+
+return ret