Skip to content

Instantly share code, notes, and snippets.

@lethee
Last active August 29, 2015 13:56
Show Gist options
  • Save lethee/9106179 to your computer and use it in GitHub Desktop.
Save lethee/9106179 to your computer and use it in GitHub Desktop.
automatically-adding-enter-exit-function-logs-to-a-project
// http://stackoverflow.com/questions/2281739/automatically-adding-enter-exit-function-logs-to-a-project
#define KNRM "\x1B[0m"
#define KRED "\x1B[31m"
#define KGRN "\x1B[32m"
#define KYEL "\x1B[33m"
#define KBLU "\x1B[34m"
#define KMAG "\x1B[35m"
#define KCYN "\x1B[36m"
#define KWHT "\x1B[37m"
#define ENTRY EntryRaiiObject obj ## __LINE__ (__FUNCTION__, __LINE__);
struct EntryRaiiObject {
EntryRaiiObject(const char *f, int line) : f_(f) { printf("%s##>>> %s (%d)%s\n", KGRN, f_, line, KNRM); }
~EntryRaiiObject() { printf("%s##<<< %s%s\n", KGRN, f_, KNRM); }
const char *f_;
};
void main()
{ENTRY
return;
}
@lethee
Copy link
Author

lethee commented Jul 2, 2014

pattern: ^{$
replace: {ENTRY

따라서 함수는 반드시 다음행에서 {로 시작해야 한다. struct 등은 다음행에서 {로시작되지 않아야 한다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment