Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mvertes/trace.h
https://github.com/mvertes/trace.h
Last synced: 2 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/mvertes/trace.h
- Owner: mvertes
- Created: 2017-11-25T17:54:26.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2017-11-25T18:10:46.000Z (about 7 years ago)
- Last Synced: 2024-11-24T07:42:06.521Z (2 months ago)
- Language: C
- Size: 1000 Bytes
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# trace.h
Macros for temporary debug traces## Installation
Install with [clib]
```sh
$ clib install mvertes/trace.h
```## Usage
Enclose your statements with `t_X()` to instrument your code and
output automatic smart traces with filename, function, line number
and value of expression, where type *X* can be: *c* (char), *d*
(decimal int), *g* (floating point double), *p* (hexa-decimal
pointer), *s* (string), *u* (unsigned), *x* (hexa-decimal int), *v*
(void), following [printf(3)] convention for types.## Example
```c
#include
#include "trace.h"int main(int argc, char **argv)
{
t_s(argv[0]);
t_d(printf("Hello World!\n"));
return 0;
}
```Outputs:
```sh
[hello.c:6 main] './hello'
Hello World!
[hello.c:7 main] printf("Hello World!\n"): 13
```## License
MIT[clib]: https://github.com/clibs/clib
[printf(3)]: http://man7.org/linux/man-pages/man3/printf.3.html