Graphviz 13.0.0~dev.20250210.0415
Loading...
Searching...
No Matches
debug.h
Go to the documentation of this file.
1
3
4#pragma once
5
6#include <stddef.h>
7#include <stdio.h>
8#include <string.h>
9#include <time.h>
10#include <util/lockfile.h>
11
15#define GV_INFO(...) \
16 do { \
17 if (Verbose) { \
18 const char *const name_ = strrchr(__FILE__, '/') == NULL \
19 ? __FILE__ \
20 : strrchr(__FILE__, '/') + 1; \
21 lockfile(stderr); \
22 const time_t now_ = time(NULL); \
23 const struct tm *const now_tm_ = localtime(&now_); \
24 fprintf(stderr, "[Graphviz] %s:%d: %04d-%02d-%02d %02d:%02d: ", name_, \
25 __LINE__, now_tm_->tm_year + 1900, now_tm_->tm_mon + 1, \
26 now_tm_->tm_mday, now_tm_->tm_hour, now_tm_->tm_sec); \
27 fprintf(stderr, __VA_ARGS__); \
28 fprintf(stderr, "\n"); \
29 unlockfile(stderr); \
30 } \
31 } while (0)
32
39#define GV_DEBUG(...) GV_INFO(__VA_ARGS__)
platform abstraction over flockfile