1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-01-17 10:20:55 +01:00
zsh/Completion/User/_gprof
2000-03-23 04:19:26 +00:00

57 lines
1.3 KiB
Text

#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 '(#--[no-] --)' \
'*=name*:function name:->funcs' \
'*=dirs*:directory:_dir_list' && ret=0
if [[ -n "$state" ]]; then
local cmd pair expl
_wanted 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
_description functions expl 'call arc to function'
else
_description functions expl 'call arc from function'
fi
else
_description functions expl function
fi
compadd "$expl[@]" -M 'r:|_=* r:|=*' - "$_gprof_funcs[@]" && ret=0
else
return 1
fi
fi
return ret