Graphviz 16.1.3~dev.20261121.1645
Loading...
Searching...
No Matches
dot.c
Go to the documentation of this file.
1
7/*************************************************************************
8 * Copyright (c) 2011 AT&T Intellectual Property
9 * All rights reserved. This program and the accompanying materials
10 * are made available under the terms of the Eclipse Public License v2.0
11 * which accompanies this distribution, and is available at
12 * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
13 *
14 * Contributors: Details at https://graphviz.org
15 *************************************************************************/
16
17/*
18 * Written by Stephen North and Eleftherios Koutsofios.
19 */
20
21#include "config.h"
22
23#include <cgraph/cgraph.h>
24#include <gvc/gvc.h>
25#include <gvc/gvio.h>
26#include <util/exit.h>
27
28#include <common/globals.h>
29
30#include <stdbool.h>
31#include <stdlib.h>
32#include <time.h>
33
34static GVC_t *Gvc;
35static graph_t *G;
36
37#ifndef _WIN32
38#ifndef NO_FPERR
39static void fperr(int s) {
40 fprintf(stderr, "caught SIGFPE %d\n", s);
41 /* signal (s, SIG_DFL); raise (s); */
43}
44#endif
45#endif
46
47int main(int argc, char **argv) {
48 graph_t *prev = NULL;
49 int r, rc = 0;
50
51 Gvc = gvContextPlugins(lt_preloaded_symbols, DEMAND_LOADING);
52 GvExitOnUsage = 1;
53 gvParseArgs(Gvc, argc, argv);
54#ifndef _WIN32
55 signal(SIGUSR1, gvToggle);
56#ifndef NO_FPERR
57 signal(SIGFPE, fperr);
58#endif
59#endif
60
61 if ((G = gvPluginsGraph(Gvc))) {
62 gvLayoutJobs(Gvc, G); /* take layout engine from command line */
64 } else {
65 while ((G = gvNextInputGraph(Gvc))) {
66 if (prev) {
69 }
70 gvLayoutJobs(Gvc, G); /* take layout engine from command line */
71 r = agreseterrors();
72 rc = MAX(rc, r);
73 if (r == 0) {
75 r = agreseterrors();
76 rc = MAX(rc, r);
77 }
78 prev = G;
79 }
80 }
82 r = gvFreeContext(Gvc);
83 graphviz_exit(MAX(rc, r));
84}
85
#define MAX(a, b)
Definition arith.h:33
abstract graph C library, Cgraph API
static void fperr(int s)
Definition dot.c:39
static graph_t * G
Definition dot.c:35
static GVC_t * Gvc
Definition dot.c:34
lt_symlist_t lt_preloaded_symbols[]
static NORETURN void graphviz_exit(int status)
Definition exit.h:23
int GvExitOnUsage
Definition globals.h:73
node NULL
Definition grammar.y:181
int agreseterrors(void)
Definition agerror.c:185
int agclose(Agraph_t *g)
deletes a graph, freeing its associated storage
Definition graph.c:97
int gvParseArgs(GVC_t *gvc, int argc, char **argv)
Definition args.c:225
void gvFinalize(GVC_t *gvc)
Definition gvcontext.c:57
graph_t * gvNextInputGraph(GVC_t *gvc)
Definition input.c:524
int gvFreeLayout(GVC_t *gvc, graph_t *g)
Definition gvlayout.c:105
void gvToggle(int s)
Definition utils.c:373
int gvRenderJobs(GVC_t *gvc, graph_t *g)
Definition emit.c:4123
int gvLayoutJobs(GVC_t *gvc, graph_t *g)
Definition gvlayout.c:53
GVC_t * gvContextPlugins(const lt_symlist_t *builtins, int demand_loading)
Definition gvc.c:35
int gvFreeContext(GVC_t *gvc)
Definition gvcontext.c:64
graph_t * gvPluginsGraph(GVC_t *gvc)
Definition input.c:215
Graphviz context library.
$2 prev
Definition htmlparse.y:291
graph or subgraph
Definition cgraph.h:424
Definition gvcint.h:81
int main()
Definition grammar.c:90