From dad2b93d1efe2e3827b6f9063391070fb9ffbe14 Mon Sep 17 00:00:00 2001 From: axel Date: Fri, 24 Feb 2006 23:56:18 +1000 Subject: [PATCH] Add functiopn prototype completions for valgrind --alloc-fn darcs-hash:20060224135618-ac50b-bcd2fa57593f6a5c9f41b9513ac25f859baf1659.gz --- share/completions/valgrind.fish | 4 ++-- share/functions/__fish_print_function_prototypes.fish | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 share/functions/__fish_print_function_prototypes.fish diff --git a/share/completions/valgrind.fish b/share/completions/valgrind.fish index aa4317bf4..b29138aee 100644 --- a/share/completions/valgrind.fish +++ b/share/completions/valgrind.fish @@ -17,7 +17,7 @@ complete -xc valgrind -l $skin -d (_ "Skin") -a " massif\tHeap\ profiler " -eval function __fish_valgrind_skin\; contains -- --$skin=\$argv \(commandline -cpo\)\;end +eval "function __fish_valgrind_skin; contains -- --$skin=\$argv (commandline -cpo);end" set -e $skin @@ -66,7 +66,7 @@ complete -n "__fish_valgrind_skin cachegrind" -xc valgrind -l L2 -d (_ "Type of # Massif-specific options -complete -c valgrind -n "__fish_valgrind_skin massif" -l alloc-fn -d (_ "Specify a function that allocates memory") -x +complete -c valgrind -n "__fish_valgrind_skin massif" -l alloc-fn -d (_ "Specify a function that allocates memory") -x -a "(__fish_print_function_prototypes)" complete -c valgrind -n "__fish_valgrind_skin massif" -x -l heap -d 'Profile heap usage' -a 'yes\t"Profile heap usage" no\t"Do not profile heap usage"' complete -c valgrind -n "__fish_valgrind_skin massif" -x -l heap-admin -d (_ "The number of bytes of heap overhead per allocation") complete -c valgrind -n "__fish_valgrind_skin massif" -x -l stacks -d (_ "Profile stack usage") -a 'yes\t"Profile stack usage" no\t"Do not profile stack usage"' diff --git a/share/functions/__fish_print_function_prototypes.fish b/share/functions/__fish_print_function_prototypes.fish new file mode 100644 index 000000000..148713523 --- /dev/null +++ b/share/functions/__fish_print_function_prototypes.fish @@ -0,0 +1,5 @@ + +function __fish_print_function_prototypes -d "Prints the names of all function prototypes found in the headers in the current directory" + cat *.h*|sed -n "s/^\(.*[^[a-zA-Z_0-9]\|\)\([a-zA-Z_][a-zA-Z_0-9]*\) *(.*);.*\$/\2/p" +end +