Graphviz 12.0.1~dev.20240715.2254
Loading...
Searching...
No Matches
dot.c
Go to the documentation of this file.
1
6/*************************************************************************
7 * Copyright (c) 2011 AT&T Intellectual Property
8 * All rights reserved. This program and the accompanying materials
9 * are made available under the terms of the Eclipse Public License v1.0
10 * which accompanies this distribution, and is available at
11 * https://www.eclipse.org/legal/epl-v10.html
12 *
13 * Contributors: Details at https://graphviz.org
14 *************************************************************************/
15
16/*
17 * Written by Stephen North and Eleftherios Koutsofios.
18 */
19
20#include "config.h"
21
22#include <cgraph/cgraph.h>
23#include <cgraph/exit.h>
24#include <gvc/gvc.h>
25#include <gvc/gvio.h>
26
27#include <common/globals.h>
28
29#include <stdbool.h>
30#include <stdlib.h>
31#include <time.h>
32
33static GVC_t *Gvc;
34static graph_t * G;
35
36#ifndef _WIN32
37#ifndef NO_FPERR
38static void fperr(int s)
39{
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{
49 graph_t *prev = NULL;
50 int r, rc = 0;
51
52 Gvc = gvContextPlugins(lt_preloaded_symbols, DEMAND_LOADING);
53 GvExitOnUsage = 1;
54 gvParseArgs(Gvc, argc, argv);
55#ifndef _WIN32
56 signal(SIGUSR1, gvToggle);
57#ifndef NO_FPERR
58 signal(SIGFPE, fperr);
59#endif
60#endif
61
62 if ((G = gvPluginsGraph(Gvc))) {
63 gvLayoutJobs(Gvc, G); /* take layout engine from command line */
65 }
66 else {
67 while ((G = gvNextInputGraph(Gvc))) {
68 if (prev) {
71 }
72 gvLayoutJobs(Gvc, G); /* take layout engine from command line */
74 r = agreseterrors();
75 rc = MAX(rc,r);
76 prev = G;
77 }
78 }
80 r = gvFreeContext(Gvc);
81 graphviz_exit(MAX(rc,r));
82}
83
abstract graph C library, Cgraph API
static void fperr(int s)
Definition dot.c:38
static graph_t * G
Definition dot.c:34
static GVC_t * Gvc
Definition dot.c:33
lt_symlist_t lt_preloaded_symbols[]
static NORETURN void graphviz_exit(int status)
Definition exit.h:23
int GvExitOnUsage
Definition globals.h:70
node NULL
Definition grammar.y:149
int agreseterrors(void)
Definition agerror.c:183
int agclose(Agraph_t *g)
deletes a graph, freeing its associated storage
Definition graph.c:96
int gvParseArgs(GVC_t *gvc, int argc, char **argv)
Definition args.c:220
void gvFinalize(GVC_t *gvc)
Definition gvcontext.c:57
graph_t * gvNextInputGraph(GVC_t *gvc)
Definition input.c:505
int gvFreeLayout(GVC_t *gvc, graph_t *g)
Definition gvlayout.c:105
void gvToggle(int s)
Definition utils.c:402
int gvRenderJobs(GVC_t *gvc, graph_t *g)
Definition emit.c:3912
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:206
Graphviz context library.
$2 u p prev
Definition htmlparse.y:495
graph or subgraph
Definition cgraph.h:425
Definition gvcint.h:80
int main()
Definition grammar.c:93
#define MAX(a, b)
Definition write.c:31