about summary refs log tree commit diff
path: root/Completion/Unix/Command/_gprof
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2001-04-02 11:51:50 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2001-04-02 11:51:50 +0000
commit0cef1d08c0531ca39aa1d70bd6935d21285c4d5f (patch)
tree402362a9f75cb1a87fde689ba5839ebbafefc75b /Completion/Unix/Command/_gprof
parent3df5882eac05b8e441681aa548f5549df44d2052 (diff)
downloadzsh-0cef1d08c0531ca39aa1d70bd6935d21285c4d5f.tar.gz
zsh-0cef1d08c0531ca39aa1d70bd6935d21285c4d5f.tar.xz
zsh-0cef1d08c0531ca39aa1d70bd6935d21285c4d5f.zip
moved from Completion/User/_gprof
Diffstat (limited to 'Completion/Unix/Command/_gprof')
-rw-r--r--Completion/Unix/Command/_gprof58
1 files changed, 58 insertions, 0 deletions
diff --git a/Completion/Unix/Command/_gprof b/Completion/Unix/Command/_gprof
new file mode 100644
index 000000000..1f7a0fd0e
--- /dev/null
+++ b/Completion/Unix/Command/_gprof
@@ -0,0 +1,58 @@
+#compdef gprof
+
+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:->pair' \
+	   '-m:minimum execution count:' \
+	   ':executable:_files -g \*\(\*\)' \
+	   ':profile file:_files -g gmon.\*' \
+	   -- -s '((#s)--[no-] --)' \
+           '*=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 -M 'r:|_=* r:|=*' -a _gprof_funcs && ret=0
+  else
+    return 1
+  fi
+fi
+
+return ret