From 6e3fc48a9a3bcc5c5861426147173a587b6720fa Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sun, 16 Jan 2022 10:18:18 -0800 Subject: [PATCH] dot.demo/demo.c: [nfc] align with C99 style and clang-format --- dot.demo/demo.c | 59 ++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 32 deletions(-) diff --git a/dot.demo/demo.c b/dot.demo/demo.c index 1ef35c613..498c713f0 100644 --- a/dot.demo/demo.c +++ b/dot.demo/demo.c @@ -1,5 +1,5 @@ /************************************************************************* - * Copyright (c) 2011 AT&T Intellectual Property + * Copyright (c) 2011 AT&T Intellectual Property * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -10,47 +10,42 @@ /* Note that, with the call to gvParseArgs(), this application assumes that * a known layout algorithm is going to be specified. This can be done either - * using argv[0] or requiring the user to run this code with a -K flag specifying - * which layout to use. In the former case, after this program has been built as - * 'demo', you will need to rename it as one of the installed layout engines such - * as dot, neato, sfdp, etc. + * using argv[0] or requiring the user to run this code with a -K flag + * specifying which layout to use. In the former case, after this program has + * been built as 'demo', you will need to rename it as one of the installed + * layout engines such as dot, neato, sfdp, etc. */ #include -int main(int argc, char **argv) -{ - Agraph_t *g; - Agnode_t *n, *m; - Agedge_t *e; - GVC_t *gvc; +int main(int argc, char **argv) { - /* set up a graphviz context */ - gvc = gvContext(); + // set up a graphviz context + GVC_t *gvc = gvContext(); - /* parse command line args - minimally argv[0] sets layout engine */ - gvParseArgs(gvc, argc, argv); + // parse command line args - minimally argv[0] sets layout engine + gvParseArgs(gvc, argc, argv); - /* Create a simple digraph */ - g = agopen("g", Agdirected, 0); - n = agnode(g, "n", 1); - m = agnode(g, "m", 1); - e = agedge(g, n, m, 0, 1); + // Create a simple digraph + Agraph_t *g = agopen("g", Agdirected, 0); + Agnode_t *n = agnode(g, "n", 1); + Agnode_t *m = agnode(g, "m", 1); + Agedge_t *e = agedge(g, n, m, 0, 1); - /* Set an attribute - in this case one that affects the visible rendering */ - agsafeset(n, "color", "red", ""); + // Set an attribute - in this case one that affects the visible rendering + agsafeset(n, "color", "red", ""); - /* Compute a layout using layout engine from command line args */ - gvLayoutJobs(gvc, g); + // Compute a layout using layout engine from command line args + gvLayoutJobs(gvc, g); - /* Write the graph according to -T and -o options */ - gvRenderJobs(gvc, g); + // Write the graph according to -T and -o options + gvRenderJobs(gvc, g); - /* Free layout data */ - gvFreeLayout(gvc, g); + // Free layout data + gvFreeLayout(gvc, g); - /* Free graph structures */ - agclose(g); + // Free graph structures + agclose(g); - /* close output file, free context, and return number of errors */ - return (gvFreeContext(gvc)); + // close output file, free context, and return number of errors + return gvFreeContext(gvc); } -- 2.40.0