From: Emden R. Gansner Date: Thu, 21 Aug 2014 19:12:54 +0000 (-0400) Subject: Clarify the need to specify the layout algorithm in demo.c. X-Git-Tag: TRAVIS_CI_BUILD_EXPERIMENTAL~172 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5147eb4e627ff406c705a5c674a2d870a33be6ae;p=graphviz Clarify the need to specify the layout algorithm in demo.c. --- diff --git a/doc/libguide/drivers.tex b/doc/libguide/drivers.tex index 06d2dfc45..930e5877c 100644 --- a/doc/libguide/drivers.tex +++ b/doc/libguide/drivers.tex @@ -37,9 +37,12 @@ call the function {\tt gvParseArgs}: This function takes the context value, plus an array of strings using the same conventions as the parameters to {\tt main} function in a C program. In particular, {\tt argc} should be the number of -values in {\tt argv}. If {\tt argv[0]} is the name of one of the +values in {\tt argv}. If the base part of {\tt argv[0]} ({\tt argv[0]} with the +directory portion removed) is the name of one of the layout algorithms, this will be bound to the \gvc\ value and used at layout time. +(This can always be overridden by supplying a {\tt "-K"} flag, or by +supplying a {\tt "layout"} attribute in the graph.) The remaining {\tt argv} values, if any, are interpreted exactly like the allowed command line flags for any \gviz\ program. Thus, {\tt "-T"} can be used to set the output type, and {\tt "-o"} diff --git a/doc/libguide/libguide.pdf b/doc/libguide/libguide.pdf index 7a071e0f5..0ba7a62af 100644 Binary files a/doc/libguide/libguide.pdf and b/doc/libguide/libguide.pdf differ diff --git a/doc/libguide/samples.tex b/doc/libguide/samples.tex index 258d31533..a6e78cf8d 100644 --- a/doc/libguide/samples.tex +++ b/doc/libguide/samples.tex @@ -1,7 +1,7 @@ \section{A sample program: {\tt simple.c}} \label{sec:simple} This following code illustrates an application which uses \gviz\ to -position a graph using the \dot\ layout and then write the output +position a graph using the \dot\ layout and then writes the output using the {\tt plain} format. An application can replace the call to {\tt gvRender} with its own function for rendering the graph, using the layout information @@ -76,6 +76,14 @@ int main(int argc, char **argv) This example provides a modification of the previous example. Again it relies on the \gviz\ renderers, but now it creates the graph dynamically rather than reading the graph from a file. + +Note that either the graph or the {\tt argv[]} values have to specify which +layout algorithm is used, as explained in Section~\ref{sec:gvc}. Specifically, +the input graph must have the {\tt layout} attribute set, or the command line +arguments must contain a valid {\tt "-K"} flag. +If not, {\tt gvParseArgs} will look at the base name part of {\tt argv[0]} and +use that as the name of desired layout program. For this to work, the executable +program needs to be renamed as one of the \gviz\ layout programs (cf. Section~\ref{sec:intro}). \begin{verbatim} #include