Creates sourcehut JSON annotations for C source trees
Initialize git flag to false
Fix indentation in multi_comment()
Fix line and column numbers of identifiers

refs

master
browse log

clone

read-only
https://git.sr.ht/~sircmpwn/annotatec
read/write
git@git.sr.ht:~sircmpwn/annotatec

You can also use your local clone with git send-email.

annotatec

This program scans C source code and emits an annotation graph for git.sr.ht's code annotations feature.

Limitations

This supports C11 syntax and a handful of GNU C extensions. If your software uses -std=gnu*, it will likely not be parsed successfully. You will undoubtably run into some GNU extensions anyway, please report them here

Usage

annotatec [-gdD] [-C <cpp...>] files... >annotations.json

This will print annotations to stdout and progress to stderr. For information about uploading these annotations to git.sr.ht, see the git.sr.ht docs.

The -C flag allows you to specify a custom C preprocessor command to use, where you will need to supply it with a list of include directories, macros, and so on, which matches those used in your source tree, as well as the C standard to target. For example:

annotatec -C "cpp -std=c11 -Iinclude $(pkg-config --cflags libgit2)"

You also will almost certainly want to specify the -g flag, which will translate file paths into git blob IDs.

Example

To generate annotations for all C files in your git repo suitable for sending to git.sr.ht:

find . -name "*.c" | xargs \
  annotatec -gC "cpp -std=c11 -Iinclude $(pkg-config --cflags libgit2)" \
  > annotations.json

Bugs, help, patches

Submit bugs to ~sircmpwn/annotate.

Send support requests to sr.ht-discuss.

Send patches via email to sr.ht-dev with git config format.subjectPrefix 'PATCH annotatec'.