From 62e4e3eebdfd0f5680023566bdd5a88752e525a3 Mon Sep 17 00:00:00 2001 From: "Emden R. Gansner" Date: Mon, 9 Sep 2013 16:04:19 -0400 Subject: [PATCH] Report packing info in gvpack; use string representation for mode in pack --- cmd/tools/gvpack.c | 7 +++++-- lib/pack/pack.c | 33 ++++++++++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/cmd/tools/gvpack.c b/cmd/tools/gvpack.c index 8b6199df4..85ad7b81e 100644 --- a/cmd/tools/gvpack.c +++ b/cmd/tools/gvpack.c @@ -216,6 +216,7 @@ static void init(int argc, char *argv[], pack_info* pinfo) pinfo->margin = CL_OFFSET; pinfo->doSplines = TRUE; /* Use edges in packing */ pinfo->fixed = 0; + pinfo->sz = 0; opterr = 0; while ((c = getopt(argc, argv, ":na:gvum:s:o:G:")) != -1) { @@ -232,13 +233,13 @@ static void init(int argc, char *argv[], pack_info* pinfo) free (bp); break; case 'n': - pinfo->mode = l_node; + parsePackModeInfo ("node", pinfo->mode, pinfo); break; case 's': gname = optarg; break; case 'g': - pinfo->mode = l_graph; + parsePackModeInfo ("graph", pinfo->mode, pinfo); break; case 'm': setUInt(&pinfo->margin, optarg); @@ -282,6 +283,8 @@ static void init(int argc, char *argv[], pack_info* pinfo) nGraphs = 10; /* initial guess as to no. of graphs */ if (!outfp) outfp = stdout; /* stdout the default */ + if (verbose) + fprintf (stderr, " margin %d\n", pinfo->margin); } /* init_node_edge: diff --git a/lib/pack/pack.c b/lib/pack/pack.c index ba369c972..dbde2feb0 100644 --- a/lib/pack/pack.c +++ b/lib/pack/pack.c @@ -646,6 +646,8 @@ arrayRects (int ng, boxf* gs, pack_info* pinfo) nr = (ng + (nc-1))/nc; } } + if (Verbose) + fprintf (stderr, "array packing: %s %d rows %d columns\n", (rowMajor?"row major":"column major"), nr, nc); widths = N_NEW(nc+1, double); heights = N_NEW(nr+1, double); @@ -1244,6 +1246,35 @@ chkFlags (char* p, pack_info* pinfo) return p; } +static char* +mode2Str (pack_mode m) +{ + char *s; + + switch (m) { + case l_clust: + s = "cluster"; + break; + case l_node: + s = "node"; + break; + case l_graph: + s = "graph"; + break; + case l_array: + s = "array"; + break; + case l_aspect: + s = "aspect"; + break; + case l_undef: + default: + s = "undefined"; + break; + } + return s; +} + /* parsePackModeInfo; * Return pack_mode of graph using "packmode" attribute. * If not defined, return dflt @@ -1312,7 +1343,7 @@ parsePackModeInfo(char* p, pack_mode dflt, pack_info* pinfo) if (Verbose) { fprintf (stderr, "pack info:\n"); - fprintf (stderr, " mode %d\n", pinfo->mode); + fprintf (stderr, " mode %s\n", mode2Str(pinfo->mode)); if (pinfo->mode == l_aspect) fprintf (stderr, " aspect %f\n", pinfo->aspect); fprintf (stderr, " size %d\n", pinfo->sz); -- 2.40.0