1 /* SCCS-info %W% %E% */
2 
3 /*--------------------------------------------------------------------*/
4 /*                                                                    */
5 /*              VCG : Visualization of Compiler Graphs                */
6 /*              --------------------------------------                */
7 /*                                                                    */
8 /*   file:         options.c                                          */
9 /*   version:      1.00.00                                            */
10 /*   creation:     1.4.1993                                           */
11 /*   author:       I. Lemke  (...-Version 0.99.99)                    */
12 /*                 G. Sander (Version 1.00.00-...)                    */
13 /*                 Universitaet des Saarlandes, 66041 Saarbruecken    */
14 /*                 ESPRIT Project #5399 Compare                       */
15 /*   description:  Option handling                                    */
16 /*   status:       in work                                            */
17 /*                                                                    */
18 /*--------------------------------------------------------------------*/
19 
20 #ifndef lint
21 static char *id_string="$Id: options.c,v 1.3 1995/02/08 12:53:51 sander Exp $";
22 #endif
23 
24 
25 /*
26  *   Copyright (C) 1993-2005 Saarland University
27  *
28  *  This program and documentation is free software; you can redistribute
29  *  it under the terms of the  GNU General Public License as published by
30  *  the  Free Software Foundation;  either version 2  of the License,  or
31  *  (at your option) any later version.
32  *
33  *  This  program  is  distributed  in  the hope that it will be useful,
34  *  but  WITHOUT ANY WARRANTY;  without  even  the  implied  warranty of
35  *  MERCHANTABILITY  or  FITNESS  FOR  A  PARTICULAR  PURPOSE.  See  the
36  *  GNU General Public License for more details.
37  *
38  *  You  should  have  received a copy of the GNU General Public License
39  *  along  with  this  program;  if  not,  write  to  the  Free Software
40  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
41  *
42  *  The software is available per anonymous ftp at ftp.cs.uni-sb.de.
43  *  Contact  sander@cs.uni-sb.de  for additional information.
44  */
45 
46 
47 /*
48  * $Log: options.c,v $
49  * Revision 1.3  1995/02/08  12:53:51  sander
50  * Negative integers allowed for integer options
51  *
52  * Revision 1.2  1995/02/08  11:11:14  sander
53  * Distribution version 1.3.
54  *
55  * Revision 1.1  1994/12/23  18:12:45  sander
56  * Initial revision
57  *
58  */
59 
60 
61 #include <stdio.h>
62 #include <stdlib.h>
63 #include <string.h>
64 #include "globals.h"
65 #include "main.h"
66 #include "alloc.h"
67 #include "fisheye.h"
68 #include "options.h"
69 
70 
71 /************************************************************************
72  * This module provides function to scan the options and help messages
73  *
74  * This file provides the following functions:
75  * ------------------------------------------
76  * scanOptions              Scan the option array and return after the
77  *                          first file.
78  * print_version_copyright  Print a version and a copyright message.
79  * print_basic_help         Print a basic help message.
80  * print_help               Print a full help message.
81  ************************************************************************/
82 
83 
84 /* Prototypes
85  * ==========
86  */
87 
88 static int simpleOption	_PP((char *optstr));
89 static int intOption    _PP((char *optstr, int *res));
90 static int stringOption	_PP((char *optstr, char *strw));
91 static int fnameOption  _PP((char *optstr, char *res));
92 static int wordOption	_PP((char *optstr, char **res));
93 static int unitOption	_PP((char *optstr, float *res));
94 
95 
96 /* Global variables
97  * ================
98  */
99 
100 
101 /* The global copy of the option argument buffer
102  */
103 
104 int 	gblargi = 1;        /* the actual  index */
105 int 	gblargc;            /* the maximal index */
106 char	**gblargv;          /* the option buffer */
107 
108 
109 /* General flags regarding the option handling
110  */
111 
112 static int opt_error;        /* indicates errors during the option scan */
113 static int opt_give_help;    /* indicates the the user needs full help  */
114 static int opt_give_version; /* indicates the version is needed         */
115 static int opt_from_stdin;   /* indicates that the input is stdin       */
116 
117 
118 /*  Special flags for X11:
119  *  ----------------------
120  */
121 
122 
123 /*  Indicates that VCG should grab the input focus.
124  */
125 
126 int grabinputfocus;
127 
128 char *Xmydiplayname   = NULL;
129 char *Xmygeometry     = NULL;
130 int  Xmyborderwidth   = 2;
131 char *Xmybackingstore = NULL;
132 
133 #ifdef X11
134 static char *Xmyfontname = NULL;
135 extern char Xfontname[512];	/* from X11dev.c */
136 #endif
137 
138 
139 /*  Flag: indicates that we have more than one input file
140  */
141 
142 int multiple_files = 0;
143 
144 
145 /*  Flag: indicates that we should be silent
146  */
147 
148 int silent = 0;
149 
150 /*  Maximal number of parse errors
151  */
152 
153 int nr_max_errors = 16;
154 
155 /*  Flag to suppress various tests
156  */
157 
158 int fastflag = 0;
159 
160 /*  Flag to supress drawing of nodes and edges.
161  */
162 
163 int supress_nodes = 0;
164 int supress_edges = 0;
165 
166 /*  Flag to summarize multiple edges without label between same nodes.
167  */
168 
169 int summarize_double_edges = 0;
170 
171 /*  Flag to hide single nodes. Nodes that are unconnected with everything
172  *  else are sometimes very ugly.
173  */
174 
175 int hide_single_nodes = 0;
176 
177 
178 /*  Layout flag:  To change the layout may reduce the number of crossings,
179  *  but it takes. The standard layout is the fastest.
180  *
181  *    0   ->  normal SCC layout
182  *    1   ->  maximize depth of the layout (tree traversal heuristic)
183  *    2   ->  minimize depth of the layout (tree traversal heuristic)
184  *    3   ->  topological order layout, minimize backward edges
185  *    4   ->  maximize depth of the layout (very slow)
186  *    5   ->  minimize depth of the layout (very slow)
187  *    6   ->  presort according increasing indegree
188  *    7   ->  presort according decreasing indegree
189  *    8   ->  presort according increasing outdegree
190  *    9   ->  presort according decreasing outdegree
191  *    10  ->  presort according increasing degree
192  *    11  ->  presort according decreasing degree
193  *    12  ->  dfs algorithm
194  *    TREE_LAYOUT -> use special layout for trees
195  */
196 
197 int layout_flag = 0;
198 
199 
200 /* Crossing heuristics:
201  *
202  *    0   ->  barycentering
203  *    1   ->  mediancentering
204  *    2   ->  bary   with mediancentering
205  *    3   ->  median with barycentering
206  */
207 
208 int crossing_heuristics = 0;
209 
210 
211 /* Local crossing unwinding: 1 = yes, 0 = not
212  */
213 
214 int local_unwind = 1;
215 
216 
217 /*  Near edges allowed: 1 = yes, 0 = not
218  */
219 
220 int near_edge_layout = 1;
221 
222 
223 /*  Fine tuning allowed: 1 = yes, 0 = no
224  */
225 
226 int fine_tune_layout = 1;
227 
228 
229 /*  When to add (nondirty) edge labels:
230  *  Phase 0 = directly after folding
231  *  Phase 1 = after partitioning
232  */
233 
234 int edge_label_phase = 0;
235 
236 
237 /*  Number of iteration used for barycentering layout
238  *  Minimal and maximal.
239  */
240 
241 int min_baryiterations = 0;
242 int max_baryiterations = MAXINT;
243 
244 
245 /*  Flag, indicating whether the phase 2 of bary centering should be skipped
246  */
247 
248 int skip_baryphase2 = 0;
249 
250 
251 /*  Number of iteration used for the initial medium shifting
252  *  that calculates x positions. Minimal and maximal.
253  */
254 
255 int max_mediumshifts = 100;
256 int min_mediumshifts = 0;
257 
258 
259 /*  Flag, indicating that the last mediymshift phase is upwards
260  *  instead downwards.
261  */
262 
263 int nwdumping_phase = 0;
264 
265 
266 /*  Number of iteration used for the calculation of x positions.
267  *  Minimal and maximal.
268  */
269 
270 int max_centershifts = 100;
271 int min_centershifts = 0;
272 
273 /*  Number of iteration used for the straight line phase.
274  */
275 
276 int max_straighttune = 100;
277 
278 
279 /*  Flag, indicates that the Priority layout phase should be used.
280  *  In this case, max_centershifts is 0, i.e. the center shift phase
281  *  is suppressed.
282  *  The priority layout phase forces nodes with exactly one successor
283  *  and one predecessor to be placed in a straight vertical line.
284  *  This is useful for manhatten layout.
285  */
286 
287 int prio_phase = 0;
288 
289 /*  Flag, indicates that the straigt line fine tuning should be
290  *  switched on. This is useful for manhatten layout.
291  */
292 
293 int straight_phase = 0;
294 
295 
296 /*  Number of iterations during the calculation of bendings.
297  */
298 
299 int max_edgebendings = 100;
300 
301 /*  Flag indicates that manhatten edges are required.
302  *  Manhatten layout means that all edge segments are either horizontal
303  *  or vertical, i.e. have a gradient of 0 degree or 90 degree.
304  *  This implies prio_phase = 1.
305  */
306 
307 int manhatten_edges = 0;
308 
309 /*  Flag indicates that horizontal segments of manhatten edges between
310  *  layers are shared, thus there is only one line. This is helpful
311  *  for trees.
312  */
313 
314 int one_line_manhatten = 0;
315 
316 /* Layoutfactors that influence the centering of nodes in step3.
317  * Normally,  (down,up,near) = (1,1,1)  is appropriate.
318  * For trees, (down,up,near) = (10,1,5) gives better layouts.
319  * (1,1,1) enforces nodes to be positioned central to all surrounding
320  * nodes.
321  * (10,1,5) enforces nodes to be positioned central to their successors.
322  * (1,10,5) enforces nodes to be positioned central to their predecessors.
323  */
324 
325 int layout_downfactor = 1;
326 int layout_upfactor   = 1;
327 int layout_nearfactor = 1;
328 
329 
330 /*  Edges can be drawn as splines, if G_spline is 1.
331  *  G_flat_factor is the factor how splines should be bend.
332  */
333 
334 int G_spline = 0;
335 int G_flat_factor = 70;
336 
337 
338 /*  Flag, indicates that after displaying, the specification file
339  *  should be touched. For Animation only.
340  */
341 
342 int touch_file = 0;
343 
344 
345 
346 /*  Interface for PostScript/Bitmap output without X11 interaction.
347  *  The VCG tool acts as a kind of filter VCG -> PostScript.
348  */
349 
350 int    exfile    = 0;
351 char   exfilename[800];
352 int    extype    = 3;     /* PostScript */
353 int    expaper   = 1;     /* A4         */
354 int    excolor   = 3;     /* B&W        */
355 int    exori     = 1;     /* Portrait   */
356 int    expapernum= 1;
357 int    exxdpi    = 72;
358 int    exydpi    = 72;
359 float  exscaling = -1.0;   /* Maxspect */
360 float  exwidth   = -1.0;
361 float  exheight  = -1.0;
362 float  exleftm   = -1.0;  /* Left  Margin  */
363 float  exrightm  = -1.0;  /* Right  Margin */
364 float  extopm    = -1.0;  /* Top    Margin */
365 float  exbottomm = -1.0;  /* Bottom Margin */
366 int    exbbox    = 1;     /* with Bounding Box */
367 
368 
369 /*  Color maps
370  *  ----------
371  *  See alloc.h for color names
372  */
373 
374 
375 int 	 cmap_size    = BASECMAPSIZE;
376 int 	 cmap_changed = 1;
377 
378 unsigned char origredmap[BASECMAPSIZE] = {
379 	  255, 0, 255, 0, 255, 255, 0, 85, 0, 128, 0, 128, 128,
380 	  0, 255, 170, 128, 255, 128, 255, 255, 128, 238, 64, 127,
381 	  240, 160, 154, 255, 255, 218, 0
382 };
383 
384 unsigned char origgreenmap[BASECMAPSIZE] = {
385 	  255, 0, 0, 255, 255, 0, 255, 85, 0, 0, 128, 128, 0,
386 	  128, 215, 170, 128, 128, 255, 255, 128, 255, 130, 224,
387 	  255, 230, 32, 205, 192, 165, 112, 0
388 };
389 
390 unsigned char origbluemap[BASECMAPSIZE] = {
391 	  255, 255, 0, 0, 0, 255, 255, 85, 128, 0, 0, 0, 128,
392 	  128, 0, 170, 255, 128, 128, 128, 255, 255, 238, 208, 212,
393 	  140, 240, 50, 203, 0, 214, 0
394 };
395 
396 unsigned char redmap[CMAPSIZE];
397 unsigned char greenmap[CMAPSIZE];
398 unsigned char bluemap[CMAPSIZE];
399 
400 
401 
402 /*  Screen Specifics
403  *  ----------------
404  */
405 
406 #ifdef VMS
407 int 	RootWinMaxDepth;    /* Depth of the frame buffer         */
408 #else
409 int 	maxDepth;           /* Depth of the frame buffer         */
410 #endif
411 int	ScreenWidth;	    /* Size of the screen                */
412 int   	ScreenHeight;
413 int	colored= -1; 	    /* Color screen (1) or BW screen (0) */
414 
415 
416 /*  Layout Parameters
417  *  -----------------
418  */
419 
420 long 	V_xmin;		    /* Minimal and maximal co-ordinates */
421 long	V_xmax;		    /* that are visible                 */
422 long	V_ymin;
423 long	V_ymax;
424 
425 long 	V_xmin_initial = 0L;	    /* and their initial values */
426 long 	V_ymin_initial = 0L;
427 
428 
429 /*  File Specifics
430  *  --------------
431  *  Because of C-stile line directives, the file name used by the
432  *  parser for error messages is not always the same as the filename
433  *  of the actal input file.
434  */
435 
436 char	Dataname[ 801];     /* Filename that is actual input        */
437 char    filename[1024];     /* Filename from the view of the parser */
438 
439 
440 /*  Global Graph Attributes
441  *  -----------------------
442  */
443 
444 int 	G_timelimit = 0;	/* Limitation in the running time
445 				 * in seconds. 0 = no limit.
446 				 */
447 
448 int	G_xymax_final = 0;
449 
450 char    *G_title;		/* title of the global graph          */
451 long    G_x, G_y;		/* window location on the root screen */
452 int     G_width, G_height;	/* size of the open part of window    */
453 int     G_width_set;		/* indicates that the width  was set. */
454 int     G_height_set;		/* indicates that the height was set. */
455 int     G_xmax, G_ymax;		/* maximal size of window             */
456 int     G_xbase, G_ybase;	/* location of the origin (0,0)       */
457 int     G_xspace, G_yspace;	/* offset of drawing area             */
458 int     G_orientation;		/* top-to-bottom, or left-to-right    */
459 int     G_folding;		/* global graph folded (1) or not (0) */
460 int     G_color;		/* background color                   */
461 int     G_displayel;		/* edge labels drawn (1) or not (0)   */
462 int     G_dirtyel;		/* edge labels dirty (1) or not (0)   */
463 int     G_shrink, G_stretch;	/* global scaling factors             */
464 int     G_yalign;
465 int 	G_dspace;		/* space between dummy nodes	      */
466 int     G_portsharing;		/* edge sharing between the ports     */
467 int     G_arrowmode;		/* arrow drawing mode                 */
468 
469 int 	G_xraster;		/* x-raster for real nodes            */
470 int 	G_yraster;		/* y-raster for real nodes	      */
471 int 	G_dxraster;		/* x-raster for dummy nodes	      */
472 
473 
474 
475 /* Default values of folded edges. This initialization indicates that
476  * folded edges are thick.
477  */
478 
479 char    *fold_elabel= NULL;        /* folded edge label          */
480 int     fold_lstyle = -1;          /* folded edge line style     */
481 int     fold_thick  = 3;           /* folded edge thickness      */
482 int     fold_ecolor = -1;          /* folded edge color          */
483 int     fold_elcolor= -1;          /* folded edge color          */
484 int     fold_arrows = -1;          /* folded edge arrowsize      */
485 int     fold_barrows= -1;          /* folded edge back arrowsize */
486 int     fold_arrowc = -1;          /* folded edge arrowcolor     */
487 int     fold_barrowc= -1;          /* folded edge back arrowcolor*/
488 int     fold_arrsty = -1;          /* folded edge arrowstyle     */
489 int     fold_barrsty= -1;          /* folded edge back arrowstyle*/
490 
491 
492 /* 	The maximal edge priority
493  */
494 
495 int max_eprio;
496 
497 
498 /*	The names of the info fields. If info_name_available,
499  *      info_names is set to a table of strings we use in the
500  *      interaction menu.
501  */
502 
503 int 	info_name_available;
504 char 	*info_names[3];
505 
506 /*	The names of the edge classes. If class_name_available,
507  *      class_names is set to a table of strings we use in the
508  *      interaction menu.
509  */
510 
511 
512 int     max_nr_classes;
513 int 	class_name_available;
514 char 	**class_names = NULL;
515 
516 
517 /* the following flag indicates whether all nodes to be visualized
518  * have already locations, or not. If not, then we must layout the
519  * graph.
520  */
521 
522 int     locFlag;
523 
524 
525 
526 /*--------------------------------------------------------------------*/
527 /*  Special Routines to get certain types of options		      */
528 /*--------------------------------------------------------------------*/
529 
530 
531 /*  Get a simple option
532  *  -------------------
533  *  e.g. like -a, -b, -c. We return true, if the option was recognized.
534  *  We return false, if the option was not recognized.
535  *  Before the actual argument index gblargi points to the actual
536  *  argument.
537  *  Afterwards, the actual argument index gblargi points to the
538  *  next recognizable argument.
539  */
540 
541 
542 #ifdef ANSI_C
simpleOption(char * optstr)543 static int simpleOption(char *optstr)
544 #else
545 static int simpleOption(optstr)
546 char *optstr;
547 #endif
548 {
549 	char *c, *d;
550 
551 	if (gblargi >= gblargc) { opt_error = 1; return(0); }
552 
553 	c = optstr;
554 	d = gblargv[gblargi];
555 
556 	while ((*c) && (*d) && ((*c== *d) || (toupper(*c)== *d))) { c++; d++; }
557 
558 	while (*c==' ') c++;
559 	if (*c) return(0);
560 	while (*d==' ') d++;
561 	if (*d) return(0);
562 
563 	gblargi++;
564 	return(1);
565 }
566 
567 
568 
569 /*  Get an integer option (only positive integers)
570  *  ----------------------------------------------
571  *  e.g. on -a 4711, we set *res = 4711 and return true.
572  *  We return false, if the option was not recognized.
573  *  Before the actual argument index gblargi points to the actual
574  *  argument.
575  *  Afterwards, the actual argument index gblargi points to the
576  *  next recognizable argument.
577  */
578 
579 
580 #ifdef ANSI_C
intOption(char * optstr,int * res)581 static int intOption(char *optstr, int *res)
582 #else
583 static int intOption(optstr, res)
584 char *optstr;
585 int *res;
586 #endif
587 {
588 	char *c, *d;
589 	int oldi;
590 	int sig;
591 
592 	oldi = gblargi;
593 	if (gblargi >= gblargc) { opt_error = 1; return(0); }
594 
595 	c = optstr;
596 	d = gblargv[gblargi];
597 
598 	while ((*c) && (*d) && ((*c== *d) || (toupper(*c)== *d))) { c++; d++; }
599 
600 	while (*c==' ') c++;
601 	if (*c) return(0);
602 
603 	while (*d==' ') d++;
604 	if (!*d) {
605 		gblargi++;
606 		if (gblargi >= gblargc) {
607 			opt_error = 1;
608 			FPRINTF(stderr,"Option error at `%s' : ", optstr);
609 			FPRINTF(stderr,"Missing integer argument !\n");
610 			gblargi = oldi;
611 			return(0);
612 		}
613 		d = gblargv[gblargi];
614 	}
615 
616 	if (   (*d!='0') && (*d!='1') && (*d!='2') && (*d!='3') && (*d!='4')
617 	    && (*d!='-') && (*d!='5') && (*d!='6') && (*d!='7') && (*d!='8')
618 	    && (*d!='9')) {
619 			gblargi = oldi;
620 			return(0);
621 	}
622 
623 	*res = atoi(d);
624 
625 	gblargi++;
626 	return(1);
627 }
628 
629 
630 /*  Get a string option
631  *  -------------------
632  *  i.e. we test on the string word strw.
633  *  We return true, if the option + strw was recognized.
634  *  We return false, if the option was not recognized.
635  *  Before the actual argument index gblargi points to the actual
636  *  argument.
637  *  Afterwards, the actual argument index gblargi points to the
638  *  next recognizable argument.
639  */
640 
641 
642 #ifdef ANSI_C
stringOption(char * optstr,char * strw)643 static int stringOption(char *optstr, char *strw)
644 #else
645 static int stringOption(optstr, strw)
646 char *optstr;
647 char *strw;
648 #endif
649 {
650 	char *c, *d;
651 	int oldi;
652 
653 	oldi = gblargi;
654 	if (gblargi >= gblargc) { opt_error = 1; return(0); }
655 
656 	c = optstr;
657 	d = gblargv[gblargi];
658 
659 	while ((*c) && (*d) && ((*c== *d) || (toupper(*c)== *d))) { c++; d++; }
660 
661 	while (*c==' ') c++;
662 	if (*c) return(0);
663 
664 	while (*d==' ') d++;
665 	if (!*d) {
666 		gblargi++;
667 		if (gblargi >= gblargc) {
668 			opt_error = 1;
669 			FPRINTF(stderr,"Option error at `%s' : ", optstr);
670 			FPRINTF(stderr,"Missing string argument !\n");
671 			gblargi = oldi;
672 			return(0);
673 		}
674 		d = gblargv[gblargi];
675 	}
676 
677 	c = strw;
678 	while ((*c) && (*d) && ((*c== *d) || (toupper(*c)== *d))) { c++; d++; }
679 
680 	while (*c==' ') c++;
681 	if (*c) { gblargi = oldi; return(0); }
682 	while (*d==' ') d++;
683 	if (*d) { gblargi = oldi; return(0); }
684 
685 	gblargi++;
686 	return(1);
687 }
688 
689 
690 /*  Get a filename option
691  *  ---------------------
692  *  If the option keyword is recognized, the next option is copied
693  *  into the result, and true is returned. The result string buffer
694  *  should have a capacity of at least 800 chars.
695  *  We return false, if the option was not recognized.
696  *  Before the actual argument index gblargi points to the actual
697  *  argument.
698  *  Afterwards, the actual argument index gblargi points to the
699  *  next recognizable argument.
700  */
701 
702 
703 #ifdef ANSI_C
fnameOption(char * optstr,char * res)704 static int fnameOption(char *optstr, char *res)
705 #else
706 static int fnameOption(optstr, res)
707 char *optstr;
708 char *res;
709 #endif
710 {
711 	char *c, *d;
712 	int oldi;
713 
714 	oldi = gblargi;
715 	if (gblargi >= gblargc) { opt_error = 1; return(0); }
716 
717 	c = optstr;
718 	d = gblargv[gblargi];
719 
720 	while ((*c) && (*d) && ((*c== *d) || (toupper(*c)== *d))) { c++; d++; }
721 
722 	while (*c==' ') c++;
723 	if (*c) return(0);
724 	while (*d==' ') d++;
725 	if (*d) return(0);
726 
727 	gblargi++;
728 	if (gblargi >= gblargc) {
729 		opt_error = 1;
730 		FPRINTF(stderr,"Option error at `%s' : ", optstr);
731 		FPRINTF(stderr,"Missing file name !\n");
732 		gblargi = oldi;
733 		return(0);
734 	}
735 	d = gblargv[gblargi];
736 	if (*d=='-') {
737 		opt_error = 1;
738 		FPRINTF(stderr,"Option error at `%s' : ", d);
739 		FPRINTF(stderr,"File names should not start with `-' !\n");
740 		gblargi = oldi;
741 		return(0);
742 	}
743 
744 	strncpy(res, d, 800);
745 
746 	gblargi++;
747 	return(1);
748 }
749 
750 
751 
752 /*  Get a stringword option
753  *  -----------------------
754  *  If the option keyword is recognized, the next option is copied
755  *  into the result, and true is returned. The result string buffer
756  *  should have a capacity of at least 800 chars.
757  *  We return false, if the option was not recognized.
758  *  Before the actual argument index gblargi points to the actual
759  *  argument.
760  *  Afterwards, the actual argument index gblargi points to the
761  *  next recognizable argument.
762  */
763 
764 
765 #ifdef ANSI_C
wordOption(char * optstr,char ** res)766 static int wordOption(char *optstr, char **res)
767 #else
768 static int wordOption(optstr, res)
769 char *optstr;
770 char **res;
771 #endif
772 {
773 	char *c, *d;
774 	int oldi;
775 
776 	oldi = gblargi;
777 	if (gblargi >= gblargc) { opt_error = 1; return(0); }
778 
779 	c = optstr;
780 	d = gblargv[gblargi];
781 
782 	while ((*c) && (*d) && ((*c== *d) || (toupper(*c)== *d))) { c++; d++; }
783 
784 	while (*c==' ') c++;
785 	if (*c) return(0);
786 	while (*d==' ') d++;
787 	if (*d) return(0);
788 
789 	gblargi++;
790 	if (gblargi >= gblargc) {
791 		opt_error = 1;
792 		FPRINTF(stderr,"Option error at `%s' : ", optstr);
793 		FPRINTF(stderr,"Missing word !\n");
794 		gblargi = oldi;
795 		return(0);
796 	}
797 	d = gblargv[gblargi];
798 	*res = d;
799 
800 	gblargi++;
801 	return(1);
802 }
803 
804 
805 
806 /*  Get an unit option (float plus unit keyword)
807  *  --------------------------------------------
808  *  e.g. on -a 3.4 meter, we set *res = 3.4 * 100 and return true.
809  *  We return false, if the option was not recognized.
810  *  Before the actual argument index gblargi points to the actual
811  *  argument.
812  *  Afterwards, the actual argument index gblargi points to the
813  *  next recognizable argument.
814  */
815 
816 
817 #ifdef ANSI_C
unitOption(char * optstr,float * res)818 static int unitOption(char *optstr, float *res)
819 #else
820 static int unitOption(optstr, res)
821 char *optstr;
822 float *res;
823 #endif
824 {
825 	char *c, *d;
826 	float help;
827 	int oldi;
828 
829 	oldi = gblargi;
830 	if (gblargi >= gblargc) { opt_error = 1; return(0); }
831 
832 	c = optstr;
833 	d = gblargv[gblargi];
834 
835 	while ((*c) && (*d) && ((*c== *d) || (toupper(*c)== *d))) { c++; d++; }
836 
837 	while (*c==' ') c++;
838 	if (*c) return(0);
839 
840 	while (*d==' ') d++;
841 	if (!*d) {
842 		gblargi++;
843 		if (gblargi >= gblargc) {
844 			opt_error = 1;
845 			FPRINTF(stderr,"Option error at `%s' : ", optstr);
846 			FPRINTF(stderr,"Missing float argument !\n");
847 			gblargi = oldi;
848 			return(0);
849 		}
850 		d = gblargv[gblargi];
851 	}
852 
853 	if (   (*d!='0') && (*d!='1') && (*d!='2') && (*d!='3')
854 	    && (*d!='4') && (*d!='5') && (*d!='6') && (*d!='7')
855 	    && (*d!='8') && (*d!='9') && (*d!='.') && (*d!=' ')) {
856 			gblargi = oldi;
857 			return(0);
858 	}
859 
860 	help = atof(d);
861 
862 	while (   (*d=='0') || (*d=='1') || (*d=='2') || (*d=='3')
863 	       || (*d=='4') || (*d=='5') || (*d=='6') || (*d=='7')
864 	       || (*d=='8') || (*d=='9') || (*d=='.') || (*d==' ')) d++;
865 
866 	while (*d==' ') d++;
867 	if (!*d) {
868 		gblargi++;
869 		if (gblargi >= gblargc) {
870 			opt_error = 1;
871 			FPRINTF(stderr,"Option error at `%s' : ", optstr);
872 			FPRINTF(stderr,"Missing unit !\n");
873 			gblargi = oldi;
874 			return(0);
875 		}
876 		d = gblargv[gblargi];
877 	}
878 
879 	if (strcmp(d,"in") == 0)            help = help * 2.54;
880 	else if (strcmp(d,"inch")      ==0) help = help * 2.54;
881 	else if (strcmp(d,"ft")        ==0) help = help * 30.48;
882 	else if (strcmp(d,"foot")      ==0) help = help * 30.48;
883 	else if (strcmp(d,"feet")      ==0) help = help * 30.48;
884 	else if (strcmp(d,"foots")     ==0) help = help * 30.48;
885 	else if (strcmp(d,"mm")        ==0) help = help / 10.0;
886 	else if (strcmp(d,"millimeter")==0) help = help / 10.0;
887 	else if (strcmp(d,"cm")        ==0) help = help;
888 	else if (strcmp(d,"centimeter")==0) help = help;
889 	else if (strcmp(d,"decimeter") ==0) help = help * 10.0;
890 	else if (strcmp(d,"dezimeter") ==0) help = help * 10.0;
891 	else if (strcmp(d,"dm")        ==0) help = help * 10.0;
892 	else if (strcmp(d,"m")         ==0) help = help * 100.0;
893 	else if (strcmp(d,"meter")     ==0) help = help * 100.0;
894 	else {  opt_error = 1;
895 		FPRINTF(stderr,"Option error at `%s' : ", optstr);
896 		FPRINTF(stderr,"Missing unit !\n");
897 		gblargi = oldi;
898 		return(0);
899 	}
900 
901 	*res = help;
902 	gblargi++;
903 	return(1);
904 }
905 
906 
907 
908 
909 /*--------------------------------------------------------------------*/
910 /*  Fetch option Routine					      */
911 /*--------------------------------------------------------------------*/
912 
913 
914 /* Scan the options
915  * ----------------
916  * If the first file name was found, we return 1, in order to allow
917  * to treat this file.
918  * The function can be reentered after a successful display of a graph,
919  * in order to treat the remaining options.
920  */
921 
922 
923 #ifdef ANSI_C
scanOptions(int argc,char * argv[])924 int scanOptions(int argc, char *argv[])
925 #else
926 int scanOptions(argc, argv)
927 int 	argc;
928 char	*argv[];
929 #endif
930 {
931 	int help;
932 
933 #ifdef NOINPUTFOCUS
934 	grabinputfocus = 0;
935 #else
936 	grabinputfocus = 1;
937 #endif
938 
939 	gblargc = argc;
940 	gblargv = argv;
941 
942 	opt_error        = 0;
943 	opt_give_help    = 0;
944 	opt_give_version = 0;
945 	opt_from_stdin   = 0;
946 	Dataname[0] = 0;
947 
948 	while (gblargi<gblargc) {
949 
950 		/* General Options */
951 		/* ----------------*/
952 
953 		if      (simpleOption("-h"))         opt_give_help = 1;
954 		else if (simpleOption("-?"))         opt_give_help = 1;
955 		else if (simpleOption("-help"))      opt_give_help = 1;
956 		else if (simpleOption("-v"))         opt_give_version = 1;
957 		else if (simpleOption("-version"))   opt_give_version = 1;
958 		else if (   intOption("-a",         &touch_file));
959 		else if (   intOption("-animation", &touch_file));
960 		else if (   intOption("-b",         &max_edgebendings));
961 		else if (   intOption("-bmax",      &max_edgebendings));
962 		else if (   intOption("-bending",   &max_edgebendings));
963 		else if (simpleOption("-bary"))      crossing_heuristics = 0;
964 		else if (simpleOption("-barymedian"))crossing_heuristics = 2;
965 		else if (   intOption("-c",         &max_baryiterations));
966 		else if (   intOption("-cmax",      &max_baryiterations));
967 		else if (   intOption("-crossing",  &max_baryiterations));
968 		else if (   intOption("-cmin",      &min_baryiterations));
969 		else if (   intOption("-e",         &nr_max_errors));
970 		else if (   intOption("-error",     &nr_max_errors));
971 		else if (simpleOption("-f"))         fastflag = 1;
972 		else if (simpleOption("-fast"))      fastflag = 1;
973 		else if (simpleOption("-hidesingles"))  hide_single_nodes = 1;
974 		else if (simpleOption("-ignoresingles"))hide_single_nodes = 1;
975 		else if (simpleOption("-l"))         edge_label_phase = 1;
976 		else if (simpleOption("-latelabels"))edge_label_phase = 1;
977 		else if (simpleOption("-m"))         multiple_files = 1;
978 		else if (simpleOption("-multi"))     multiple_files = 1;
979 		else if (simpleOption("-median"))    crossing_heuristics = 1;
980 		else if (simpleOption("-medianbary"))crossing_heuristics = 3;
981 		else if (simpleOption("-manhatten")) manhatten_edges = 1;
982 		else if (simpleOption("-manhattan")) manhatten_edges = 1;
983 		else if (simpleOption("-nomanhatten")) manhatten_edges = 2;
984 		else if (simpleOption("-nomanhattan")) manhatten_edges = 2;
985 		else if (simpleOption("-nocopt"))    skip_baryphase2 = 1;
986 		else if (simpleOption("-nocopt2"))   skip_baryphase2 = 1;
987 		else if (simpleOption("-nocopt1"))   local_unwind = 0;
988 		else if (simpleOption("-nocoptl"))   local_unwind = 0;
989 		else if (simpleOption("-nocoptloc")) local_unwind = 0;
990 		else if (simpleOption("-notune"))    fine_tune_layout = 0;
991 		else if (simpleOption("-nofinetune"))fine_tune_layout = 0;
992 		else if (simpleOption("-nonearedge"))near_edge_layout = 0;
993 		else if (simpleOption("-nonodes"))   supress_nodes = 1;
994 		else if (simpleOption("-noedges"))   supress_edges = 1;
995 		else if (simpleOption("-orthogonal"))manhatten_edges = 1;
996 		else if (simpleOption("-noorthogonal"))manhatten_edges = 2;
997 		else if (   intOption("-p",         &max_mediumshifts));
998 		else if (   intOption("-pmax",      &max_mediumshifts));
999 		else if (   intOption("-pendulum",  &max_mediumshifts));
1000 		else if (   intOption("-pmin",      &min_mediumshifts));
1001 		else if (simpleOption("-prio"))      prio_phase = 1;
1002 		else if (simpleOption("-noprio"))    prio_phase = 2;
1003 		else if (   intOption("-r",         &max_centershifts));
1004 		else if (   intOption("-rmax",      &max_centershifts));
1005 		else if (   intOption("-rubberband",&max_centershifts));
1006 		else if (   intOption("-rmin",      &min_centershifts));
1007 		else if (simpleOption("-smanhatten")) one_line_manhatten = 1;
1008 		else if (simpleOption("-smanhattan")) one_line_manhatten = 1;
1009 		else if (simpleOption("-nosmanhatten")) one_line_manhatten = 2;
1010 		else if (simpleOption("-nosmanhattan")) one_line_manhatten = 2;
1011 		else if (   intOption("-smax",      &max_straighttune));
1012 		else if (simpleOption("-straight"))  straight_phase = 1;
1013 		else if (simpleOption("-nostraight"))straight_phase = 2;
1014 		else if (simpleOption("-s"))         summarize_double_edges=1;
1015 		else if (simpleOption("-summarize")) summarize_double_edges=1;
1016 		else if (simpleOption("-silent"))    silent = 1;
1017 		else if (simpleOption("-spline"))    G_spline = 1;
1018 		else if (   intOption("-t"         ,&G_timelimit)) {
1019 			if (G_timelimit<=1) G_timelimit = 1;
1020 		}
1021 		else if (   intOption("-timelimit" ,&G_timelimit)) {
1022 			if (G_timelimit<=1) G_timelimit = 1;
1023 		}
1024 		else if (   intOption("-xpos"      ,&help)) {
1025 			if (help>0) V_xmin_initial = (long)help;
1026 		}
1027 		else if (   intOption("-ypos"      ,&help)) {
1028 			if (help>0) V_ymin_initial = (long)help;
1029 		}
1030 		else if (simpleOption("-blackwhite")) {
1031 				colored = 0;
1032 				excolor = 3;
1033 		}
1034 		else if (simpleOption("-nocolors")) {
1035 				colored = 0;
1036 				excolor = 3;
1037 		}
1038 		else if (simpleOption("-nocolours")) {
1039 				colored = 0;
1040 				excolor = 3;
1041 		}
1042 
1043 		/* Options for the Layout Algorithm */
1044 		/* -------------------------------- */
1045 
1046 		else if (stringOption("-d", "normal"))      layout_flag = 0;
1047 		else if (stringOption("-d", "dfs"))         layout_flag = 12;
1048 		else if (stringOption("-d", "0"))           layout_flag = 3;
1049 		else if (stringOption("-d", "minbackward")) layout_flag = 3;
1050 		else if (stringOption("-d", "+"))           layout_flag = 1;
1051 		else if (stringOption("-d", "maxdepth"))    layout_flag = 1;
1052 		else if (stringOption("-d", "++"))          layout_flag = 4;
1053 		else if (stringOption("-d", "maxdepthslow"))layout_flag = 4;
1054 		else if (stringOption("-d", "-"))           layout_flag = 2;
1055 		else if (stringOption("-d", "mindepth"))    layout_flag = 2;
1056 		else if (stringOption("-d", "--"))          layout_flag = 5;
1057 		else if (stringOption("-d", "mindepthslow"))layout_flag = 5;
1058 		else if (stringOption("-d", "minindeg"))    layout_flag = 6;
1059 		else if (stringOption("-d", "minindegree")) layout_flag = 6;
1060 		else if (stringOption("-d", "maxindeg"))    layout_flag = 7;
1061 		else if (stringOption("-d", "maxindegree")) layout_flag = 7;
1062 		else if (stringOption("-d", "minoutdeg"))   layout_flag = 8;
1063 		else if (stringOption("-d", "minoutdegree"))layout_flag = 8;
1064 		else if (stringOption("-d", "maxoutdeg"))   layout_flag = 9;
1065 		else if (stringOption("-d", "maxoutdegree"))layout_flag = 9;
1066 		else if (stringOption("-d", "mindeg"))      layout_flag = 10;
1067 		else if (stringOption("-d", "mindegree"))   layout_flag = 10;
1068 		else if (stringOption("-d", "maxdeg"))      layout_flag = 11;
1069 		else if (stringOption("-d", "maxdegree"))   layout_flag = 11;
1070 		else if (stringOption("-d", "tree")) layout_flag = TREE_LAYOUT;
1071 
1072 		/* Options for the view */
1073 		/* -------------------- */
1074 
1075 		else if (stringOption("-view", "normal")) fisheye_view = 0;
1076 		else if (stringOption("-view", "cfish"))  fisheye_view = CSCF_VIEW;
1077 		else if (stringOption("-view", "pfish"))  fisheye_view = PSCF_VIEW;
1078 		else if (stringOption("-view", "fcfish")) fisheye_view = FCSCF_VIEW;
1079 		else if (stringOption("-view", "fpfish")) fisheye_view = FPSCF_VIEW;
1080 
1081 		/* Options for the Printer driver */
1082 		/* ------------------------------ */
1083 
1084 		else if (fnameOption("-vcgoutput", exfilename)) {
1085 			exfile = 1;
1086 			extype = 0;
1087 		}
1088 		else if (fnameOption("-pbmoutput", exfilename)) {
1089 			exfile = 1;
1090 			extype = 1;
1091 			excolor= 3;
1092 		}
1093 		else if (fnameOption("-ppmoutput", exfilename)) {
1094 			exfile = 1;
1095 			extype = 2;
1096 			excolor= 1;
1097 		}
1098 		else if (fnameOption("-psoutput",  exfilename)) {
1099 			exfile = 1;
1100 			extype = 3;
1101 		}
1102 		else if (stringOption("-paper", "a4"))      expaper = 1;
1103 		else if (stringOption("-paper", "b5"))      expaper = 2;
1104 		else if (stringOption("-paper", "a5"))      expaper = 3;
1105 		else if (stringOption("-paper", "11x17"))   expaper = 4;
1106 		else if (stringOption("-paper", "tabloid")) expaper = 4;
1107 		else if (stringOption("-paper", "8x11"))    expaper = 5;
1108 		else if (stringOption("-paper", "letter"))  expaper = 5;
1109 		else if (stringOption("-paper", "8x14"))    expaper = 6;
1110 		else if (stringOption("-paper", "legal"))   expaper = 6;
1111 		else if (simpleOption("-noboundingbox"))    exbbox  = 0;
1112 		else if (simpleOption("-color"))            excolor = 1;
1113 		else if (simpleOption("-colour"))           excolor = 1;
1114 		else if (simpleOption("-grey"))             excolor = 2;
1115 		else if (simpleOption("-gray"))             excolor = 2;
1116 		else if (simpleOption("-portrait"))         exori   = 1;
1117 		else if (simpleOption("-landscape"))        exori   = 2;
1118 		else if (   intOption("-split",&expapernum)) {
1119 			if (expapernum>16)     expapernum = 5;
1120 			else if (expapernum>9) expapernum = 4;
1121 			else if (expapernum>4) expapernum = 3;
1122 			else if (expapernum>1) expapernum = 2;
1123 			else expapernum =  1;
1124 		}
1125 		else if (   intOption("-xdpi",   &exxdpi));
1126 		else if (   intOption("-ydpi",   &exydpi));
1127 		else if (   intOption("-scale",  &help))
1128 			exscaling = (float)help/100.0;
1129 		else if (  unitOption("-width",  &exwidth));
1130 		else if (  unitOption("-height", &exheight));
1131 		else if (  unitOption("-lm",     &exleftm));
1132 		else if (  unitOption("-rm",     &exrightm));
1133 		else if (  unitOption("-tm",     &extopm));
1134 		else if (  unitOption("-bm",     &exbottomm));
1135 
1136 
1137 		/* Special X11 options  */
1138 		/* -------------------- */
1139 #ifdef X11
1140 		else if (wordOption("-display",      &Xmydiplayname));
1141 		else if (wordOption("-geometry",     &Xmygeometry));
1142 		else if (wordOption("-bs",           &Xmybackingstore));
1143 		else if (wordOption("-backingstore", &Xmybackingstore));
1144 		else if (wordOption("-font",         &Xmyfontname)) {
1145 			strncpy(Xfontname, Xmyfontname, 510);
1146 			Xfontname[511] = 0;
1147 		}
1148 		else if ( intOption("-bw",           &Xmyborderwidth));
1149 		else if ( intOption("-borderwidth",  &Xmyborderwidth));
1150 		else if (simpleOption("-grabinputfocus"))
1151 				grabinputfocus = 1-grabinputfocus;
1152 #endif
1153 
1154 		/* Further general options  */
1155 		/* ------------------------ */
1156 
1157 		else if (simpleOption("-"))        opt_from_stdin = 1;
1158 		else if (gblargv[gblargi][0]=='-') opt_error = 1;
1159 		else {  strncpy(Dataname, gblargv[gblargi], 800 );
1160 			gblargi++;
1161 			Dataname[800] = 0;
1162 			if (opt_from_stdin) opt_error = 1;
1163 			else return(1);
1164 		}
1165 		if (opt_error) return(0);
1166 	}
1167 
1168 	if (opt_from_stdin) strcpy(Dataname,"-");
1169 	return(1);
1170 }
1171 
1172 
1173 
1174 /*--------------------------------------------------------------------*/
1175 /*  Give Version, basic help or general help                          */
1176 /*--------------------------------------------------------------------*/
1177 
1178 
1179 /* Print the version and copyright notice
1180  * --------------------------------------
1181  */
1182 
1183 
1184 #ifdef ANSI_C
print_version_copyright(void)1185 void print_version_copyright(void)
1186 #else
1187 void print_version_copyright()
1188 #endif
1189 {
1190 	if (!opt_give_version) return;
1191 
1192 	PRINTF("VCG/XVCG - USAAR Visualization Tool %s\n",version_str);
1193 	PRINTF("-----------------------------------------\n");
1194 	PRINTF("%s %s\n",&(revision_str[1]),date_str);
1195 
1196 	PRINTF("Copyright (C) 1993-2005 Saarland University.\n");
1197 	PRINTF("This software is supported by the ESPRIT project 5399 Compare.\n");
1198 	PRINTF("We thank the Compare Consortium for the permission to distribute\n");
1199 	PRINTF("this software freely. VCG/XVCG comes with ABSOLUTELY NO WARRANTY.\n");
1200 	PRINTF("You are welcome to redistribute XVCG under certain conditions.\n");
1201 	PRINTF("See the file `COPYING' for details.\n");
1202 	PRINTF("Contact  sander@cs.uni-sb.de  for additional information.\n\n");
1203 
1204 	if (Dataname[0]) PRINTF("Input specification: %s\n\n", Dataname);
1205 }
1206 
1207 
1208 /* Print the basic help
1209  * --------------------
1210  */
1211 
1212 #ifdef ANSI_C
print_basic_help(void)1213 void print_basic_help(void)
1214 #else
1215 void print_basic_help()
1216 #endif
1217 {
1218 	PRINTF("USAAR Visualization Tool %s (C) 1993--1995 I.Lemke/G.Sander & Compare\n",
1219 		version_str);
1220 	PRINTF("%s %s\n",&(revision_str[1]),date_str);
1221 	PRINTF("Usage:   %s [options] [filename]\n",gblargv[0]);
1222 	PRINTF("Enter %s -h  for help information.\n", gblargv[0]);
1223 	exit(0);
1224 }
1225 
1226 
1227 /* Print the full help
1228  * -------------------
1229  */
1230 
1231 #ifdef ANSI_C
print_help(void)1232 void print_help(void)
1233 #else
1234 void print_help()
1235 #endif
1236 {
1237 	if (!opt_give_help) return;
1238 
1239 	PRINTF("USAAR Visualization Tool %s (C) 1993--1995 I.Lemke/G.Sander & Compare\n",
1240 		version_str);
1241 
1242 	PRINTF("%s %s\n\n",&(revision_str[1]),date_str);
1243 
1244 	PRINTF("Usage:   %s [options] [filename]\n\n",gblargv[0]);
1245 	PRINTF("General options:\n");
1246 	PRINTF("================\n");
1247 
1248 	/* General Options */
1249 	/* ----------------*/
1250 
1251 	PRINTF("-                 The input is <stdin> instead of a file.\n");
1252 	PRINTF("-h | -? | - help  Print help.\n");
1253 	PRINTF("-v | -version     Print version and copyright.\n");
1254 	PRINTF("-silent           Be silent during the layout.\n");
1255 	PRINTF("-nocolors | -blackwhite\n");
1256 	PRINTF("                  Don't use colors.\n");
1257 	PRINTF("-e <num> | -error <num>\n");
1258 	PRINTF("                  Maximal number of parse errors (default: 16).\n");
1259 	PRINTF("-a <num> | -animation <num>\n");
1260 	PRINTF("                  Animation handler. <num> > 0  means: touch input file after\n");
1261 	PRINTF("                  successful visualization and then sleep for <num>  seconds.\n");
1262 	PRINTF("                  <num> < 0  means: send signal USRSIG1  to the caller  after\n");
1263 	PRINTF("                  successful visualization.\n");
1264 	PRINTF("-m | -multi       Read multiple files one after another to display a sequence\n");
1265 	PRINTF("                  of graphs.\n");
1266 
1267 	PRINTF("-bary             Use bary centering as crossing reduction (default).\n");
1268 	PRINTF("-median           Use median centerings as crossing reduction. On graphs with\n");
1269 	PRINTF("                  large average degree of edges, bary centering is faster.\n");
1270 	PRINTF("-barymedian       Use hybrid method as crossing reduction.  Bary centering is\n");
1271 	PRINTF("                  used unless the bary values  are equal.  Only then,  median\n");
1272 	PRINTF("                  centering is used.\n");
1273 	PRINTF("-medianbary       Use hybrid method as crossing reduction.Median centering is\n");
1274 	PRINTF("                  used unless the median values are equal.  Only  then,  bary\n");
1275 	PRINTF("                  centering is used.\n");
1276 
1277 	PRINTF("-notune | -nofinetune\n");
1278 	PRINTF("                  Switch the fine tuning layout phase off.  This yield a less\n");
1279 	PRINTF("                  compact distribution of nodes in the levels.\n");
1280 	PRINTF("-manhattan | -orthogonal\n");
1281 	PRINTF("                  Switch orthogonal manhattan layout on. This forces edges of\n");
1282 	PRINTF("                  gradient 0 or 90 degree.\n");
1283 	PRINTF("-nomanhattan | -noorthogonal\n");
1284 	PRINTF("                  Switch orthogonal manhattan layout explicitly off.\n");
1285 	PRINTF("-smanhattan       Use manhattan layout without separation  of horizontal line\n");
1286 	PRINTF("                  segments.  This looks nice for trees but might be confusing\n");
1287 	PRINTF("                  in general.\n");
1288 	PRINTF("-nosmanhattan     Switch this phase explicitly off.\n");
1289 	PRINTF("-prio             Switch priority layout on.  This forces straight long edges\n");
1290 	PRINTF("                  with gradient 90 degree.\n");
1291 	PRINTF("-noprio           Switch priority layout explicitly off.\n");
1292 	PRINTF("-straight         Switch the straight line tuning phase on. This phase forces\n");
1293 	PRINTF("                  straight long edges with gradient 90 degree. It can be used\n");
1294 	PRINTF("                  to improve the priority layout.\n");
1295 	PRINTF("-nostraight       Switch the straight line tuning phase explicitly off.\n");
1296 	PRINTF("-nonearedge       Do not allow near edges in the layout.\n");
1297 	PRINTF("-l | -latelabels  Create labels after partitioning of edges.  This may reduce\n");
1298 	PRINTF("                  the number of crossings.\n");
1299 	PRINTF("-hidesingles | -ignoresingles\n");
1300 	PRINTF("                  Ignore single nodes (nodes without visible edges)  that are\n");
1301 	PRINTF("                  not connected with the remaining graph.\n");
1302 	PRINTF("-s | -summarize   Summarize duplicated edges.\n");
1303 
1304 	PRINTF("\n");
1305 	PRINTF("Options for the speed of the layout:\n");
1306 	PRINTF("====================================\n");
1307 	PRINTF("-t <num> | -timelimit <num>\n");
1308 	PRINTF("                  Set the time limit to <num> seconds.   If the time limit is\n");
1309 	PRINTF("                  exceeded,  the fastest possible layout mode is switched on.\n");
1310 	PRINTF("                  This may yield a very ugly layout.\n");
1311 	PRINTF("-f | -fast        Switch fast & dirty & ugly mode on.\n");
1312 	PRINTF("                  This implies -bmax 2 -cmax 2 -pmax 2 -rmax 2 -smax 2.\n");
1313 	PRINTF("-b <num> | -bmax <num> | -bending <num>\n");
1314 	PRINTF("                  Maximal number of iterations used for the reduction of edge\n");
1315 	PRINTF("                  bendings (default: 100).\n");
1316 	PRINTF("-c <num> | -cmax <num> | -crossing <num>\n");
1317 	PRINTF("                  Maximal number of iterations used for the reduction of edge\n");
1318 	PRINTF("                  crossings (default: infinite).\n");
1319 	PRINTF("-cmin <num>       Minimal number of iterations used for the reduction of edge\n");
1320 	PRINTF("                  crossings (default: 0).\n");
1321 	PRINTF("-p <num> | -pmax <num> | -pendulum <num>\n");
1322 	PRINTF("                  Maximal number of iterations used for the balancing  by the\n");
1323 	PRINTF("                  pendulum method (default: 100).\n");
1324 	PRINTF("-pmin <num>       Minimal number of iterations used for the balancing  by the\n");
1325 	PRINTF("                  pendulum method (default: 0).\n");
1326 	PRINTF("-r <num> | -rmax <num> | -rubberband <num>\n");
1327 	PRINTF("                  Maximal number of iterations used for the balancing  by the\n");
1328 	PRINTF("                  rubberband method (default: 100).\n");
1329 	PRINTF("-rmin <num>       Minimal number of iterations used for the balancing  by the\n");
1330 	PRINTF("                  rubberband method (default: 0).\n");
1331 	PRINTF("-smax <num>       Maximal number  of iterations used  for the  straight  line\n");
1332 	PRINTF("                  tuning phase (default: 100).\n");
1333 	PRINTF("-nocopt | -nocopt2\n");
1334 	PRINTF("                  Skip optimization  phase 2  of crossing reduction.  This is\n");
1335 	PRINTF("                  the most time consuming phase during crossing reduction.\n");
1336 	PRINTF("-nocoptl | -nocoptloc\n");
1337 	PRINTF("                  Switch local crossing optimization off. However, this phase\n");
1338 	PRINTF("                  is normally not time critical.\n");
1339 
1340 
1341 	PRINTF("\n");
1342 	PRINTF("Options for the distribution of nodes in the layout:\n");
1343 	PRINTF("====================================================\n");
1344 
1345 	PRINTF("-d normal         Normal  distribution  of nodes  into the levels  (default).\n");
1346 	PRINTF("                  This algorithm is based on  the calculation of the strongly\n");
1347 	PRINTF("                  connected components.\n");
1348 	PRINTF("-d dfs            Depth first search  distribution of nodes  into the levels.\n");
1349 	PRINTF("                  This is the fastest method.\n");
1350 	PRINTF("-d0 | -d minbackward\n");
1351 	PRINTF("                  Reduce backward edges  heuristically.  This may  yield less\n");
1352 	PRINTF("                  crossings and a uniform edge flow.\n");
1353 	PRINTF("-d+ | -d maxdepth Maximize depth of the layout heuristically.\n");
1354 	PRINTF("-d- | -d mindepth Minimize depth of the layout heuristically.\n");
1355 	PRINTF("-d++ | -d maxdepthslow\n");
1356 	PRINTF("                  Maximize depth of the layout (very slow).\n");
1357 	PRINTF("-d-- | -d mindepthslow\n");
1358 	PRINTF("                  Minimize depth of the layout (very slow).\n");
1359 	PRINTF("-d minindeg | -d minindegree\n");
1360 	PRINTF("                  Presort the nodes, i.e. lay out first the node with minimal\n");
1361 	PRINTF("                  indegrees.\n");
1362 	PRINTF("-d maxindeg | -d maxindegree\n");
1363 	PRINTF("                  Presort the nodes, i.e. lay out first the node with maximal\n");
1364 	PRINTF("                  indegrees.\n");
1365 	PRINTF("-d minoutdeg | -d minoutdegree\n");
1366 	PRINTF("                  Presort the nodes, i.e. lay out first the node with minimal\n");
1367 	PRINTF("                  outdegrees.\n");
1368 	PRINTF("-d maxoutdeg | -d maxoutdegree\n");
1369 	PRINTF("                  Presort the nodes, i.e. lay out first the node with maximal\n");
1370 	PRINTF("                  outdegrees.\n");
1371 	PRINTF("-d mindeg | -d mindegree\n");
1372 	PRINTF("                  Presort the nodes, i.e. lay out first the node with minimal\n");
1373 	PRINTF("                  degrees.\n");
1374 	PRINTF("-d maxdeg | -d maxdegree\n");
1375 	PRINTF("                  Presort the nodes, i.e. lay out first the node with maximal\n");
1376 	PRINTF("                  degrees.\n");
1377 	PRINTF("-d tree           Use specialized layout  for trees.  This does not work with\n");
1378 	PRINTF("                  non-trees.\n");
1379 
1380 	PRINTF("\n");
1381 	PRINTF("Options for the view onto the graph:\n");
1382 	PRINTF("====================================\n");
1383 
1384 	PRINTF("-view normal      Normal view on the graph. No distortion.\n");
1385 	PRINTF("-view cfish       Cartesian fisheye view.  The graph is  distorted  such that\n");
1386 	PRINTF("                  the whole graph is visible.  Horizontal  and vertical lines\n");
1387 	PRINTF("                  don't change their direction.\n");
1388 	PRINTF("-view fcfish      Cartesian fisheye view with fixed size focus.  The graph is\n");
1389 	PRINTF("                  distorted, but not necessarily the whole graph is visible.\n");
1390 	PRINTF("-view pfish       Polar fisheye view.  The graph is  distorted  such that the\n");
1391 	PRINTF("                  whole graph is visible.  Even horizontal and vertical lines\n");
1392 	PRINTF("                  might be distorted.\n");
1393 	PRINTF("-view fpfish      Polar fisheye view  with  fixed size  focus.  The  graph is\n");
1394 	PRINTF("                  distorted, but not necessarily the whole graph is visible.\n");
1395 	PRINTF("-spline           Use splines instead of polygons to draw edges. WARNING: The\n");
1396 	PRINTF("                  drawing of splines is very slow.\n");
1397 	PRINTF("-nonodes          Suppress drawing of nodes.\n");
1398 	PRINTF("-noedges          Suppress drawing of edges.\n");
1399 	PRINTF("-xpos <num>       Set the x-coordinate of the initial point of the graph that\n");
1400 	PRINTF("                  appears at the window origin or of the initial focus point.\n");
1401 	PRINTF("-ypos <num>       Set the y-coordinate of the initial point of the graph that\n");
1402 	PRINTF("                  appears at the window origin or of the initial focus point.\n");
1403 
1404 
1405 	PRINTF("\n");
1406 	PRINTF("Special printer driver options:\n");
1407 	PRINTF("===============================\n");
1408 
1409 	PRINTF("-vcgoutput <filename> \n");
1410 	PRINTF("                  Produce a VCG file named <filename> that contains the graph\n");
1411 	PRINTF("                  as laid out.  All nodes  of the graph are annotated  by the\n");
1412 	PRINTF("                  calculated coordinates.In this case the interactive display\n");
1413 	PRINTF("                  is suppressed.\n");
1414 	PRINTF("-psoutput <filename> \n");
1415 	PRINTF("                  Produce a PostScript file  named  <filename>  that contains\n");
1416 	PRINTF("                  the  graph.   In  this  case  the  interactive  display  is\n");
1417 	PRINTF("                  suppressed.\n");
1418 	PRINTF("-pbmoutput <filename> \n");
1419 	PRINTF("                  Produce a bitmap file named  <filename>  in PBM format that\n");
1420 	PRINTF("                  contains the graph  in  black and white.  In this case  the\n");
1421 	PRINTF("                  the interactive display is suppressed.\n");
1422 	PRINTF("-ppmoutput <filename> \n");
1423 	PRINTF("                  Produce a bitmap file named  <filename>  in PPM format that\n");
1424 	PRINTF("                  contains the graph in colors.  In this case the interactive\n");
1425 	PRINTF("                  display is suppressed.\n");
1426 	PRINTF("-paper [ a4 | b5 | a5 | 11x17 | tabloid | 8x11 | letter | 8x14 | legal ]\n");
1427 	PRINTF("                  Select the paper type. Default is din A4.\n");
1428 	PRINTF("-noBoundingBox    Suppress the calculation  of a BoundingBox.  This is useful\n");
1429 	PRINTF("                  only for PostScript output.\n");
1430 	PRINTF("-color            Select a color file output (PostScript).\n");
1431 	PRINTF("-grey | -gray     Select a gray-scaled file output (PostScript).\n");
1432 	PRINTF("-blackwhite       Select a monochromatic file output (PostScript, default).\n");
1433 	PRINTF("-portrait         Select the paper orientation `Portrait' (default).\n");
1434 	PRINTF("-landscape        Select the paper orientation `Landscape'.\n");
1435 	PRINTF("-split <num>      Split the graph  into  <num>  pages.  This  works  only for\n");
1436 	PRINTF("                  PostScript output.\n");
1437 	PRINTF("                  The number of pages must be one of 1,4,9,16,25.\n");
1438 	PRINTF("-xdpi  <num>      Set the horizontal resolution for the bitmap output.\n");
1439 	PRINTF("-ydpi  <num>      Set the vertical resolution for the bitmap output.\n");
1440 	PRINTF("-scale <num>      Scale the graph to <num> percent  for the file output.  The\n");
1441 	PRINTF("                  default scaling fits the graph with maximal aspect ratio to\n");
1442 	PRINTF("                  the paper size.\n");
1443 	PRINTF("-width <float> <units>\n");
1444 	PRINTF("                  Fit the graph onto the paper such that its width is smaller\n");
1445 	PRINTF("                  than <float> <units>. No scaling must be specified.\n");
1446 	PRINTF("                  <units> are  inch | in | ft | foot | mm | cm | dm | m\n");
1447 	PRINTF("-height <float> <units>\n");
1448 	PRINTF("                  Fit the graph onto the paper  such that  height  is smaller\n");
1449 	PRINTF("                  than <float> <units>. No scaling must be specified.\n");
1450 	PRINTF("                  <units> are  inch | in | ft | foot | mm | cm | dm | m\n");
1451 	PRINTF("-lm <float> <units>\n");
1452 	PRINTF("                  Set the left  margin  of  the  output  to  <float> <units>.\n");
1453 	PRINTF("                  No right margin must be specified. The default is centering\n");
1454 	PRINTF("                  on the page.  If the graph  does not  fit  onto  the  page,\n");
1455 	PRINTF("                  nonsense may happen.\n");
1456 	PRINTF("                  <units> are  inch | in | ft | foot | mm | cm | dm | m\n");
1457 	PRINTF("-rm <float> <units>\n");
1458 	PRINTF("                  Set the right margin  of  the  output  to  <float> <units>.\n");
1459 	PRINTF("                  No left margin must be specified.  The default is centering\n");
1460 	PRINTF("                  on the page.  If the graph  does not  fit  onto  the  page,\n");
1461 	PRINTF("                  nonsense may happen.\n");
1462 	PRINTF("                  <units> are  inch | in | ft | foot | mm | cm | dm | m\n");
1463 	PRINTF("-tm <float> <units>\n");
1464 	PRINTF("                  Set the top   margin  of  the  output  to  <float> <units>.\n");
1465 	PRINTF("                  No bottom margin must be specified.The default is centering\n");
1466 	PRINTF("                  on the page.  If the graph  does not  fit  onto  the  page,\n");
1467 	PRINTF("                  nonsense may happen.\n");
1468 	PRINTF("                  <units> are  inch | in | ft | foot | mm | cm | dm | m\n");
1469 	PRINTF("-bm <float> <units>\n");
1470 	PRINTF("                  Set the bottom margin of  the  output  to  <float> <units>.\n");
1471 	PRINTF("                  No  top  margin must be specified. The default is centering\n");
1472 	PRINTF("                  on the page.  If the graph  does not  fit  onto  the  page,\n");
1473 	PRINTF("                  nonsense may happen.\n");
1474 	PRINTF("                  <units> are  inch | in | ft | foot | mm | cm | dm | m\n");
1475 
1476 #ifdef X11
1477 	PRINTF("\n");
1478 	PRINTF("Special X11 options:\n");
1479 	PRINTF("====================\n");
1480 
1481 	PRINTF("-display <host:dpy>\n");
1482 	PRINTF("                  Set the X11 server to contact.\n");
1483 	PRINTF("-geometry <geom>  The size/location of the window.\n");
1484 	PRINTF("-bw <num> | -borderwidth <num>\n");
1485 	PRINTF("                  The border width of the window.\n");
1486 	PRINTF("-font <xfont>     (default is `%s').\n",Xfontname);
1487 	if (!grabinputfocus)
1488 	PRINTF("-grabinputfocus   Grab the input focus actively.\n");
1489 	else
1490 	PRINTF("-grabinputfocus   Avoid to grab the input focus actively.\n");
1491 #endif
1492 	PRINTF("\n");
1493 	exit(0);
1494 }
1495 
1496 
1497 /*--------------------------------------------------------------------*/
1498 
1499 
1500