From: Moritz Muehlenthaler Date: Fri, 19 Aug 2011 08:08:14 +0000 (+0200) Subject: sn-tex: Added flip option (-f) to sn-tex X-Git-Url: https://git.octo.it/?p=sort-networks.git;a=commitdiff_plain;h=2e9e8d9a09ece0eaa3243f9249616dd8d6bce1cc sn-tex: Added flip option (-f) to sn-tex Signed-off-by: Florian Forster --- diff --git a/src/sn-tex.c b/src/sn-tex.c index 3c71409..6cbfd06 100644 --- a/src/sn-tex.c +++ b/src/sn-tex.c @@ -42,6 +42,7 @@ static double vertical_spacing = 0.8; static double x_offset; static int next_vertex_number = 0; +static int flip = 0; #define INPUT_TO_Y(i) (((double) (i)) * vertical_spacing) @@ -51,6 +52,7 @@ static void exit_usage (void) /* {{{ */ "\n" "Valid options are:\n" " -w Specify the width of the graph (in TikZ default units).\n" + " -f Flip the sorting network (min wire at the top, max wire at the bottom).\n" "\n"); exit (EXIT_FAILURE); } /* }}} void exit_usage */ @@ -59,7 +61,7 @@ static int read_options (int argc, char **argv) /* {{{ */ { int option; - while ((option = getopt (argc, argv, "w:h?")) != -1) + while ((option = getopt (argc, argv, "w:fh?")) != -1) { switch (option) { @@ -74,6 +76,9 @@ static int read_options (int argc, char **argv) /* {{{ */ output_width = width; break; } + case 'f': + flip = 1; + break; case 'h': case '?': @@ -224,7 +229,10 @@ int main (int argc, char **argv) /* {{{ */ x_offset = outer_spacing; - printf ("\\begin{tikzpicture}[auto]\n"); + if (flip) + printf ("\\begin{tikzpicture}[auto,yscale=-1]\n"); + else + printf ("\\begin{tikzpicture}[auto]\n"); for (i = 0; i < SN_NETWORK_STAGE_NUM (n); i++) tex_show_stage (SN_NETWORK_STAGE_GET (n, i));