27static Agraph_t*(*agmemread)(
const char*);
28static GVC_t*(*gvContext)();
31static int(*
gvLayout)(GVC_t*, graph_t*,
const char*);
43#define LOADSYM(SYM) SYM = (decltype(SYM))(dlsym(libgraphviz, #SYM));
46static constexpr const char * LIB_GRAPHVIZ =
"libgvc.so";
48static constexpr const char * LIB_GRAPHVIZ =
"libgvc.dylib";
58#if __linux || __APPLE__
59 libgraphviz = dlopen(LIB_GRAPHVIZ, RTLD_LAZY|RTLD_NOLOAD);
61 libgraphviz = dlopen(LIB_GRAPHVIZ, RTLD_LAZY|RTLD_NODELETE);
87 std::ostringstream oss;
89#if __linux || __APPLE__
95 const std::string filename_pdf = oss.str() +
".pdf";
101 exec(
"/usr/bin/setsid", {
"--fork",
"xdg-open", filename_pdf.c_str() });
103 exec(
"/usr/bin/open", {
"-a",
"Preview", filename_pdf.c_str() });
113 const std::string filename_dot = oss.str() +
".dot";
114 std::ofstream out(filename_dot);
116 diag.
err() <<
"Failed to generate '" << filename_dot <<
"'.\n";
void M_EXPORT exec(const char *executable, std::initializer_list< const char * > args)
static constexpr const char * NOTE
static constexpr const char * RESET
std::ostream & out() const