| 1 |
/** |
| 2 |
* @file |
| 3 |
* @brief main rendering program for various layouts of graphs and output formats |
| 4 |
*/ |
| 5 |
|
| 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 <gvc/gvc.h> |
| 24 |
#include <gvc/gvio.h> |
| 25 |
#include <util/exit.h> |
| 26 |
|
| 27 |
#include <common/globals.h> |
| 28 |
|
| 29 |
#include <stdbool.h> |
| 30 |
#include <stdlib.h> |
| 31 |
#include <time.h> |
| 32 |
|
| 33 |
static GVC_t *Gvc; |
| 34 |
static graph_t * G; |
| 35 |
|
| 36 |
#ifndef _WIN32 |
| 37 |
#ifndef NO_FPERR |
| 38 |
static void fperr(int s) |
| 39 |
{ |
| 40 |
fprintf(stderr, "caught SIGFPE %d\n", s); |
| 41 |
/* signal (s, SIG_DFL); raise (s); */ |
| 42 |
graphviz_exit(1); |
| 43 |
} |
| 44 |
#endif |
| 45 |
#endif |
| 46 |
|
| 47 |
int 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 */ |
| 64 |
gvRenderJobs(Gvc, G); |
| 65 |
} |
| 66 |
else { |
| 67 |
while ((G = gvNextInputGraph(Gvc))) { |
| 68 |
if (prev) { |
| 69 |
gvFreeLayout(Gvc, prev); |
| 70 |
agclose(prev); |
| 71 |
} |
| 72 |
gvLayoutJobs(Gvc, G); /* take layout engine from command line */ |
| 73 |
gvRenderJobs(Gvc, G); |
| 74 |
r = agreseterrors(); |
| 75 |
rc = MAX(rc,r); |
| 76 |
prev = G; |
| 77 |
} |
| 78 |
} |
| 79 |
gvFinalize(Gvc); |
| 80 |
r = gvFreeContext(Gvc); |
| 81 |
graphviz_exit(MAX(rc,r)); |
| 82 |
} |
| 83 |
|
| 84 |
/** |
| 85 |
* @dir . |
| 86 |
* @brief main rendering program for various layouts of graphs and output formats |
| 87 |
*/ |
| 88 |
|
| 89 |
/** |
| 90 |
* @mainpage |
| 91 |
* |
| 92 |
* %Hierarchy:\n |
| 93 |
* -# Applications |
| 94 |
* - @ref cmd/dot – main rendering application for various layouts of graphs and output formats |
| 95 |
* - @ref cmd – directory of applications |
| 96 |
* - @ref dot.demo "dot.demo" – demo programs |
| 97 |
* -# @ref plugin – Plugins of graph layout engines and output formats |
| 98 |
* -# Core libraries |
| 99 |
* -# @ref engines |
| 100 |
* -# @ref common_render – rendering for layout engines |
| 101 |
* -# @ref common_utils – low level utilities for layout engines |
| 102 |
* -# @ref lib – miscellaneous libraries |
| 103 |
* -# @ref cgraph – abstract graph C library |
| 104 |
* -# @ref cgraph_app – uncoupled application specific functions |
| 105 |
* -# @ref cgraph_core – highly cohesive core |
| 106 |
* -# Low level utility libraries |
| 107 |
* - @ref cgraph_utils – low level cgraph utilities |
| 108 |
* - @ref lib/cdt – Container Data Types library |
| 109 |
*/ |