Debian Codegraph @

easel/devkit/ctags-fix

raw
1 #! /usr/bin/perl
2
3 # To be used in an idiomatic pipe for listing all keywords in a codebase:
4 #
5 # find . -name \*.[ch] -exec ctags -x {} \; | ~/src/easel/trunk/devkit/ctags-fix | sort | tbl-pretty -f3 > 00INDEX
6 #
7 # ctags apparently prints a %15s %4d format
8 # on keywords >15 long + linenumbers > 3 digits long, ctags merges the
9 # first two fields, as in:
10 # esl_msa_FormatDesc1221 ./easel/esl_msa.c esl_msa_FormatDesc(ESL_MSA *msa, const char *desc, ...)
11 # We try to detect this as best as possible; the possible ambiguity
12 # is when the keyword name itself ends in a digit. To dismbiguate, we
13 # assume no files have >=10000 lines.
14 #
15 # we also assume ctags has been called in a pipe from 'find',
16 # so all filenames start with './', as in:
17 # find . -name \*.[ch] -exec ctags -x {} \; | ctags-fix > foo
18 # This allows us to unambiguously find the true third column.
19
20
21 while (<>)
22 {
23 if (/^(\S{16,})(\d{4})\s+(\.\/.+)$/) { printf("%s %d %s\n", $1, $2, $3); }
24 else { print; }
25 }