Skip to content

Instantly share code, notes, and snippets.

@isacdaavid
Created March 25, 2016 17:03
Show Gist options
  • Save isacdaavid/1c14bc8fed56d3cf7d3a to your computer and use it in GitHub Desktop.
Save isacdaavid/1c14bc8fed56d3cf7d3a to your computer and use it in GitHub Desktop.
# CCExtractor Sample Exercise No. 1 for GSoC 2016:
# Find all functions in CCExtractor.
#!/bin/sh
SRCDIR="../ccextractor/src/"
types="(const|volatile|restrict|atomic|_Atomic|static|extern|inline|signed|unsigned|void|char|short|int|long|float|double|bool|_Bool|size_t|ssize_t|ptrdiff_t|([u]?int(_least|_fast|ptr|max)?[0-9]+_t))+"
identifiers="([[:alnum:]]|_)+"
for file in $(find "$SRCDIR" -name '*.c' -o -name '*.h'); do
#grep PNG_FUNCTION "$file"
grep -E --color=always "^[[:space:]]*${types}[[:space:]]${identifiers}[[:space:]]*[(]" "$file"
done
# repeated
# deal with comments
# macros?
# complex and user-defined data types
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment