PLplot  5.13.0
plargs.c
Go to the documentation of this file.
1 // Maurice LeBrun mjl@dino.ph.utexas.edu
2 // Institute for Fusion Studies University of Texas at Austin
3 //
4 // Copyright (C) 1993-2004 Maurice LeBrun
5 // Copyright (C) 2004 Andrew Ross
6 // Copyright (C) 2000-2018 Alan W. Irwin
7 //
8 // This file is part of PLplot.
9 //
10 // PLplot is free software; you can redistribute it and/or modify
11 // it under the terms of the GNU Library General Public License as published
12 // by the Free Software Foundation; either version 2 of the License, or
13 // (at your option) any later version.
14 //
15 // PLplot is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU Library General Public License for more details.
19 //
20 // You should have received a copy of the GNU Library General Public License
21 // along with PLplot; if not, write to the Free Software
22 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 //
24 // Some parts of this code were derived from "xterm.c" and "ParseCmd.c" of
25 // the X-windows Version 11 distribution. The copyright notice is
26 // reproduced here:
27 //
28 // Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
29 // and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
30 //
31 // All Rights Reserved
32 //
33 // The full permission notice is given in the PLplot documentation.
34 //
35 //--------------------------------------------------------------------------
36 //
97 
98 #include "plplotP.h"
99 #include <ctype.h>
100 
101 #ifdef HAVE_CRT_EXTERNS_H
102 //
103 // This include file has the declaration for _NSGetArgc(). See below.
104 //
105 #include <crt_externs.h>
106 #endif
107 
108 // Support functions
109 
110 static int ParseOpt( int *, char ***, int *, char ***, PLOptionTable * );
111 static int ProcessOpt( char *, PLOptionTable *, int *, char ***, int * );
112 static int GetOptarg( char **, int *, char ***, int * );
113 static void Help( void );
114 static void Syntax( void );
115 
116 // Option handlers
117 
118 static int opt_h( PLCHAR_VECTOR, PLCHAR_VECTOR, void * );
119 static int opt_v( PLCHAR_VECTOR, PLCHAR_VECTOR, void * );
120 static int opt_verbose( PLCHAR_VECTOR, PLCHAR_VECTOR, void * );
121 static int opt_debug( PLCHAR_VECTOR, PLCHAR_VECTOR, void * );
122 static int opt_hack( PLCHAR_VECTOR, PLCHAR_VECTOR, void * );
123 static int opt_dev( PLCHAR_VECTOR, PLCHAR_VECTOR, void * );
124 static int opt_o( PLCHAR_VECTOR, PLCHAR_VECTOR, void * );
125 static int opt_geo( PLCHAR_VECTOR, PLCHAR_VECTOR, void * );
126 static int opt_a( PLCHAR_VECTOR, PLCHAR_VECTOR, void * );
127 static int opt_jx( PLCHAR_VECTOR, PLCHAR_VECTOR, void * );
128 static int opt_jy( PLCHAR_VECTOR, PLCHAR_VECTOR, void * );
129 static int opt_mar( PLCHAR_VECTOR, PLCHAR_VECTOR, void * );
130 static int opt_ori( PLCHAR_VECTOR, PLCHAR_VECTOR, void * );
131 static int opt_freeaspect( PLCHAR_VECTOR, PLCHAR_VECTOR, void * );
132 static int opt_portrait( PLCHAR_VECTOR, PLCHAR_VECTOR, void * );
133 static int opt_width( PLCHAR_VECTOR, PLCHAR_VECTOR, void * );
134 static int opt_bg( PLCHAR_VECTOR, PLCHAR_VECTOR, void * );
135 static int opt_ncol0( PLCHAR_VECTOR, PLCHAR_VECTOR, void * );
136 static int opt_ncol1( PLCHAR_VECTOR, PLCHAR_VECTOR, void * );
137 static int opt_fam( PLCHAR_VECTOR, PLCHAR_VECTOR, void * );
138 static int opt_fsiz( PLCHAR_VECTOR, PLCHAR_VECTOR, void * );
139 static int opt_fbeg( PLCHAR_VECTOR, PLCHAR_VECTOR, void * );
140 static int opt_finc( PLCHAR_VECTOR, PLCHAR_VECTOR, void * );
141 static int opt_fflen( PLCHAR_VECTOR, PLCHAR_VECTOR, void * );
142 static int opt_bufmax( PLCHAR_VECTOR, PLCHAR_VECTOR, void * );
143 static int opt_nopixmap( PLCHAR_VECTOR, PLCHAR_VECTOR, void * );
144 static int opt_db( PLCHAR_VECTOR, PLCHAR_VECTOR, void * );
145 static int opt_np( PLCHAR_VECTOR, PLCHAR_VECTOR, void * );
146 static int opt_px( PLCHAR_VECTOR, PLCHAR_VECTOR, void * );
147 static int opt_py( PLCHAR_VECTOR, PLCHAR_VECTOR, void * );
148 static int opt_wplt( PLCHAR_VECTOR, PLCHAR_VECTOR, void * );
149 static int opt_drvopt( PLCHAR_VECTOR, PLCHAR_VECTOR, void * );
150 
151 static int opt_plserver( PLCHAR_VECTOR, PLCHAR_VECTOR, void * );
152 static int opt_plwindow( PLCHAR_VECTOR, PLCHAR_VECTOR, void * );
153 static int opt_auto_path( PLCHAR_VECTOR, PLCHAR_VECTOR, void * );
154 static int opt_bufmax( PLCHAR_VECTOR, PLCHAR_VECTOR, void * );
155 static int opt_server_name( PLCHAR_VECTOR, PLCHAR_VECTOR, void * );
156 static int opt_tk_file( PLCHAR_VECTOR, PLCHAR_VECTOR, void * );
157 static int opt_dpi( PLCHAR_VECTOR, PLCHAR_VECTOR, void * );
158 static int opt_dev_compression( PLCHAR_VECTOR, PLCHAR_VECTOR, void * );
159 static int opt_cmap0( PLCHAR_VECTOR, PLCHAR_VECTOR, void * );
160 static int opt_cmap1( PLCHAR_VECTOR, PLCHAR_VECTOR, void * );
161 static int opt_locale( PLCHAR_VECTOR, PLCHAR_VECTOR, void * );
162 static int opt_eofill( PLCHAR_VECTOR, PLCHAR_VECTOR, void * );
163 
164 static int opt_mfo( PLCHAR_VECTOR, PLCHAR_VECTOR, void * );
165 static int opt_mfi( PLCHAR_VECTOR, PLCHAR_VECTOR, void * );
166 
167 // Global variables
168 
169 static PLCHAR_VECTOR program = NULL;
170 static PLCHAR_VECTOR usage = NULL;
171 
172 static int mode_full;
173 static int mode_quiet;
174 static int mode_nodelete;
175 static int mode_showall;
176 static int mode_noprogram;
177 static int mode_nodash;
178 static int mode_skip;
179 
180 // Temporary buffer used for parsing
181 
182 #define OPTMAX 1024
183 static char opttmp[OPTMAX];
184 
185 //--------------------------------------------------------------------------
235 //--------------------------------------------------------------------------
236 
238  {
239  "showall", // Turns on invisible options
240  NULL,
241  NULL,
242  &mode_showall,
244  "-showall",
245  "Turns on invisible options"
246  },
247  {
248  "h", // Help
249  opt_h,
250  NULL,
251  NULL,
252  PL_OPT_FUNC,
253  "-h",
254  "Print out this message"
255  },
256  {
257  "v", // Version
258  opt_v,
259  NULL,
260  NULL,
261  PL_OPT_FUNC,
262  "-v",
263  "Print out the PLplot library version number"
264  },
265  {
266  "verbose", // Be more verbose than usual
267  opt_verbose,
268  NULL,
269  NULL,
270  PL_OPT_FUNC,
271  "-verbose",
272  "Be more verbose than usual"
273  },
274  {
275  "debug", // Print debugging info
276  opt_debug,
277  NULL,
278  NULL,
279  PL_OPT_FUNC,
280  "-debug",
281  "Print debugging info (implies -verbose)"
282  },
283  {
284  "hack", // Enable driver-specific hack(s)
285  opt_hack,
286  NULL,
287  NULL,
289  "-hack",
290  "Enable driver-specific hack(s)"
291  },
292  {
293  "dev", // Output device
294  opt_dev,
295  NULL,
296  NULL,
298  "-dev name",
299  "Output device name"
300  },
301  {
302  "o", // Output filename
303  opt_o,
304  NULL,
305  NULL,
307  "-o name",
308  "Output filename"
309  },
310  {
311  "display", // X server
312  opt_o,
313  NULL,
314  NULL,
316  "-display name",
317  "X server to contact"
318  },
319  {
320  "px", // Plots per page in x
321  opt_px,
322  NULL,
323  NULL,
325  "-px number",
326  "Plots per page in x"
327  },
328  {
329  "py", // Plots per page in y
330  opt_py,
331  NULL,
332  NULL,
334  "-py number",
335  "Plots per page in y"
336  },
337  {
338  "geometry", // Geometry
339  opt_geo,
340  NULL,
341  NULL,
343  "-geometry geom",
344  "Window size/position specified as in X, e.g., 400x300, 400x300-100+200, +100-200, etc."
345  },
346  {
347  "geo", // Geometry (alias)
348  opt_geo,
349  NULL,
350  NULL,
352  "-geo geom",
353  "Window size/position specified as in X, e.g., 400x300, 400x300-100+200, +100-200, etc."
354  },
355  {
356  "wplt", // Plot window
357  opt_wplt,
358  NULL,
359  NULL,
361  "-wplt xl,yl,xr,yr",
362  "Relative coordinates [0-1] of window into plot"
363  },
364  {
365  "mar", // Margin
366  opt_mar,
367  NULL,
368  NULL,
370  "-mar margin",
371  "Margin space in relative coordinates (0 to 0.5, def 0)"
372  },
373  {
374  "a", // Aspect ratio
375  opt_a,
376  NULL,
377  NULL,
379  "-a aspect",
380  "Page aspect ratio (def: same as output device)"
381  },
382  {
383  "jx", // Justification in x
384  opt_jx,
385  NULL,
386  NULL,
388  "-jx justx",
389  "Page justification in x (-0.5 to 0.5, def 0)"
390  },
391  {
392  "jy", // Justification in y
393  opt_jy,
394  NULL,
395  NULL,
397  "-jy justy",
398  "Page justification in y (-0.5 to 0.5, def 0)"
399  },
400  {
401  "ori", // Orientation
402  opt_ori,
403  NULL,
404  NULL,
406  "-ori orient",
407  "Plot orientation (0,1,2,3=landscape,portrait,seascape,upside-down)"
408  },
409  {
410  "freeaspect", // floating aspect ratio
412  NULL,
413  NULL,
414  PL_OPT_FUNC,
415  "-freeaspect",
416  "Allow aspect ratio to adjust to orientation swaps"
417  },
418  {
419  "portrait", // floating aspect ratio
420  opt_portrait,
421  NULL,
422  NULL,
423  PL_OPT_FUNC,
424  "-portrait",
425  "Sets portrait mode (both orientation and aspect ratio)"
426  },
427  {
428  "width", // Pen width
429  opt_width,
430  NULL,
431  NULL,
433  "-width width",
434  "Sets pen width (0 <= width)"
435  },
436  {
437  "bg", // Background color
438  opt_bg,
439  NULL,
440  NULL,
442  "-bg color",
443  "Background color (FF0000=opaque red, 0000FF_0.1=blue with alpha of 0.1)"
444  },
445  {
446  "ncol0", // Allocated colors in cmap 0
447  opt_ncol0,
448  NULL,
449  NULL,
451  "-ncol0 n",
452  "Number of colors to allocate in cmap 0 (upper bound)"
453  },
454  {
455  "ncol1", // Allocated colors in cmap 1
456  opt_ncol1,
457  NULL,
458  NULL,
460  "-ncol1 n",
461  "Number of colors to allocate in cmap 1 (upper bound)"
462  },
463  {
464  "fam", // Familying on switch
465  opt_fam,
466  NULL,
467  NULL,
468  PL_OPT_FUNC,
469  "-fam",
470  "Create a family of output files"
471  },
472  {
473  "fsiz", // Family file size
474  opt_fsiz,
475  NULL,
476  NULL,
478  "-fsiz size[kKmMgG]",
479  "Output family file size (e.g. -fsiz 0.5G, def MB)"
480  },
481  {
482  "fbeg", // Family starting member
483  opt_fbeg,
484  NULL,
485  NULL,
487  "-fbeg number",
488  "First family member number on output"
489  },
490  {
491  "finc", // Family member increment
492  opt_finc,
493  NULL,
494  NULL,
496  "-finc number",
497  "Increment between family members"
498  },
499  {
500  "fflen", // Family member min field width
501  opt_fflen,
502  NULL,
503  NULL,
505  "-fflen length",
506  "Family member number minimum field width"
507  },
508  {
509  "nopixmap", // Do not use pixmaps
510  opt_nopixmap,
511  NULL,
512  NULL,
513  PL_OPT_FUNC,
514  "-nopixmap",
515  "Don't use pixmaps in X-based drivers"
516  },
517  {
518  "db", // Double buffering on switch
519  opt_db,
520  NULL,
521  NULL,
522  PL_OPT_FUNC,
523  "-db",
524  "Double buffer X window output"
525  },
526  {
527  "np", // Page pause off switch
528  opt_np,
529  NULL,
530  NULL,
531  PL_OPT_FUNC,
532  "-np",
533  "No pause between pages"
534  },
535  {
536  "bufmax", // # bytes sent before flushing output
537  opt_bufmax,
538  NULL,
539  NULL,
541  "-bufmax",
542  "bytes sent before flushing output"
543  },
544  {
545  "server_name", // Main window name of server
547  NULL,
548  NULL,
550  "-server_name name",
551  "Main window name of PLplot server (tk driver)"
552  },
553  {
554  "plserver", // PLplot server name
555  opt_plserver,
556  NULL,
557  NULL,
559  "-plserver name",
560  "Invoked name of PLplot server (tk driver)"
561  },
562  {
563  "plwindow", // PLplot container window name
564  opt_plwindow,
565  NULL,
566  NULL,
568  "-plwindow name",
569  "Name of PLplot container window (tk driver)"
570  },
571  {
572  "auto_path", // Additional directory(s) to autoload
574  NULL,
575  NULL,
577  "-auto_path dir",
578  "Additional directory(s) to autoload (tk driver)"
579  },
580  {
581  "tk_file", // -file option for plserver
582  opt_tk_file,
583  NULL,
584  NULL,
586  "-tk_file file",
587  "file for plserver (tk driver)"
588  },
589  {
590  "dpi", // Dots per inch
591  opt_dpi,
592  NULL,
593  NULL,
595  "-dpi dpi",
596  "Resolution, in dots per inch (e.g. -dpi 360x360)"
597  },
598  {
599  "compression", // compression
601  NULL,
602  NULL,
604  "-compression num",
605  "Sets compression level in supporting devices"
606  },
607  {
608  "cmap0",
609  opt_cmap0,
610  NULL,
611  NULL,
613  "-cmap0 file name",
614  "Initializes color table 0 from a cmap0.pal format file in one of standard PLplot paths."
615  },
616  {
617  "cmap1",
618  opt_cmap1,
619  NULL,
620  NULL,
622  "-cmap1 file name",
623  "Initializes color table 1 from a cmap1.pal format file in one of standard PLplot paths."
624  },
625  {
626  "locale",
627  opt_locale,
628  NULL,
629  NULL,
630  PL_OPT_FUNC,
631  "-locale",
632  "Use locale environment (e.g., LC_ALL, LC_NUMERIC, or LANG) to set LC_NUMERIC locale (which affects decimal point separator)."
633  },
634  {
635  "eofill",
636  opt_eofill,
637  NULL,
638  NULL,
639  PL_OPT_FUNC,
640  "-eofill",
641  "For the case where the boundary of the filled region is self-intersecting, use the even-odd fill rule rather than the default nonzero fill rule."
642  },
643  {
644  "drvopt", // Driver specific options
645  opt_drvopt,
646  NULL,
647  NULL,
649  "-drvopt option[=value][,option[=value]]*",
650  "Driver specific options"
651  },
652  {
653  "mfo", // Metafile output option
654  opt_mfo,
655  NULL,
656  NULL,
658  "-mfo PLplot metafile name",
659  "Write the plot to the specified PLplot metafile"
660  },
661  {
662  "mfi", // Metafile output option
663  opt_mfi,
664  NULL,
665  NULL,
667  "-mfi PLplot metafile name",
668  "Read the specified PLplot metafile"
669  },
670  {
671  NULL, // option
672  NULL, // handler
673  NULL, // client data
674  NULL, // address of variable to set
675  0, // mode flag
676  NULL, // short syntax
677  NULL
678  } // long syntax
679 };
680 
682  "All parameters must be white-space delimited. Some options are driver",
683  "dependent. Please see the PLplot reference document for more detail.",
684  NULL
685 };
686 
687 //--------------------------------------------------------------------------
701 //--------------------------------------------------------------------------
702 
703 typedef struct
704 {
707  const char **notes;
708 } PLOptionInfo;
709 
712  "PLplot options",
714 };
715 
716 #define PL_MAX_OPT_TABLES 10
718  {
720  "PLplot options",
722  }
723 };
724 
725 // The structure that hold the driver specific command line options
726 
727 typedef struct DrvOptCmd
728 {
729  char *option;
730  char *value;
731  struct DrvOptCmd *next;
732 } DrvOptCmd;
733 
734 // the variable where opt_drvopt() stores the driver specific command line options
735 static DrvOptCmd drv_opt = { NULL, NULL, NULL };
736 
737 static int tables = 1;
738 
739 PLINT
741 {
742  int mode = 0, argc = 2, status;
743  char *argv[3];
744 
745  argv[0] = (char *) opt;
746  argv[1] = (char *) opt_arg;
747  argv[2] = NULL;
748  mode =
753 
754  status = plparseopts( &argc, argv, mode );
755  if ( status )
756  {
757  fprintf( stderr, "plsetopt: Unrecognized option %s\n", opt );
758  }
759  return status;
760 }
761 
762 //--------------------------------------------------------------------------
763 // plMergeOpts()
764 //
771 //--------------------------------------------------------------------------
772 
773 PLINT
775 {
776  PLOptionTable *tab;
777 
778  pllib_init();
779 
780 // Check to make sure option table has been terminated correctly
781 
782  for ( tab = (PLOptionTable *) options; tab->opt; tab++ )
783  ;
784 
785 // We've reached the last table entry. All the subentries must be NULL or 0
786 
787  if ( ( tab->handler != NULL ) ||
788  ( tab->client_data != NULL ) ||
789  ( tab->var != NULL ) ||
790  ( tab->mode != 0 ) ||
791  ( tab->syntax != NULL ) ||
792  ( tab->desc != NULL ) )
793  {
794  plabort( "plMergeOpts: input table improperly terminated" );
795  return 1;
796  }
797 
798 // No room for more tables
799 
800  if ( tables++ >= PL_MAX_OPT_TABLES )
801  {
802  plabort( "plMergeOpts: max tables limit exceeded, table not merged" );
803  return 1;
804  }
805 
807  ploption_info[tables - 1].name = name;
808  ploption_info[tables - 1].notes = notes;
809 
810  return 0;
811 }
812 
813 //--------------------------------------------------------------------------
814 // plClearOpts()
815 //
818 //--------------------------------------------------------------------------
819 
820 void
821 plClearOpts( void )
822 {
823  tables = 0;
824 }
825 
826 //--------------------------------------------------------------------------
827 // plResetOpts()
828 //
831 //--------------------------------------------------------------------------
832 
833 void
834 plResetOpts( void )
835 {
837  tables = 1;
838 }
839 
840 //--------------------------------------------------------------------------
841 // plparseopts()
842 //
853 //--------------------------------------------------------------------------
854 
855 PLINT
856 c_plparseopts( int *p_argc, char **argv, PLINT mode )
857 {
858  char **argsave, **argend;
859  int i, myargc, myargcsave, status = 0;
860 
861 
862 // Initialize
863 
864  mode_full = mode & PL_PARSE_FULL;
865  mode_quiet = mode & PL_PARSE_QUIET;
869  mode_nodash = mode & PL_PARSE_NODASH;
870  mode_skip = mode & PL_PARSE_SKIP;
871 
872  myargc = ( *p_argc );
873  argend = argv + myargc;
874 
875 // If program name is first argument, save and advance
876 
877  if ( !mode_noprogram )
878  {
879  // Just in case plparseopts has been called previously (e.g., with PL_PARSE_NODELETE).
880  if ( plsc->program )
881  free_mem( plsc->program );
882 
883  // If plparseopts is not called again, this is freed in plend1.
884  plsc->program = plstrdup( argv[0] );
885  program = (PLCHAR_VECTOR) plsc->program;
886  --myargc; ++argv;
887  }
888  if ( myargc == 0 )
889  return 0;
890 
891  // Process the command line
892 
893  // Special hack to deal with -debug option before
894  // pllib_init() is called.
895  argsave = argv;
896  myargcsave = myargc;
897  for (; myargc > 0; --myargc, ++argv )
898  {
899  // Allow for "holes" in argv list
900  if ( *argv == NULL || *argv[0] == '\0' )
901  continue;
902 
903  if ( ( !mode_nodash && !strcmp( *argv, "-debug" ) ) || ( mode_nodash && !strcmp( *argv, "debug" ) ) )
904  {
905  //fprintf(stderr, "Found debug option in argv\n");
906  // Loop over all options tables, starting with the last
907  for ( i = tables - 1; i >= 0; i-- )
908  {
909  // Check option table for option
910 
911  status = ParseOpt( &myargc, &argv, p_argc, &argsave,
912  ploption_info[i].options );
913 
914  if ( !status )
915  break;
916  }
917  break;
918  }
919  }
920  // Restore pointers to condition before the above loop
921  // Although array length and content stored in those pointers
922  // is likely changed.
923  myargc = myargcsave;
924  argv = argsave;
925 
926  pllib_init();
927 
928  argsave = argv;
929  for (; myargc > 0; --myargc, ++argv )
930  {
931  // Allow for "holes" in argv list
932  if ( *argv == NULL || *argv[0] == '\0' )
933  continue;
934 
935  // Loop over all options tables, starting with the last
936  for ( i = tables - 1; i >= 0; i-- )
937  {
938  // Check option table for option
939 
940  status = ParseOpt( &myargc, &argv, p_argc, &argsave,
941  ploption_info[i].options );
942 
943  if ( !status )
944  break;
945  }
946 
947  // Handle error return as specified by the mode flag
948 
949  if ( status == -1 )
950  {
951  // No match. Keep going if mode_skip is set, otherwise abort if
952  // fully parsing, else return without error.
953 
954  status = 0;
955 
956  if ( mode_skip )
957  {
958  if ( !mode_nodelete )
959  *argsave++ = *argv;
960  continue;
961  }
962  if ( !mode_quiet && mode_full )
963  {
964  fprintf( stderr, "\nBad command line option \"%s\"\n", argv[0] );
965  plOptUsage();
966  }
967  if ( mode_full )
968  exit( 1 );
969 
970  break;
971  }
972  else if ( status == 1 )
973  {
974  // Illegal or badly formed
975 
976  if ( !mode_quiet )
977  {
978  fprintf( stderr, "\nBad command line option \"%s\"\n", argv[0] );
979  plOptUsage();
980  }
981  if ( mode_full )
982  exit( 1 );
983 
984  break;
985  }
986  else if ( status == 2 )
987  {
988  // Informational option encountered (-h or -v)
989 
990  exit( 0 );
991  }
992  }
993 
994 // Compress and NULL-terminate argv
995 
996  if ( !mode_nodelete )
997  {
998  for ( i = 0; i < myargc; i++ )
999  *argsave++ = *argv++;
1000 
1001  if ( argsave < argend )
1002  {
1003  *argsave = NULL;
1004 #ifdef HAVE_NSGETARGC
1005  //
1006  // Modify the global argc variable to match the shortened argv.
1007  // The global argc and argv must be kept consistent so that future
1008  // users of them (e.g. libraries loaded later with a device driver)
1009  // will not try to dereference the null pointer at the end of the
1010  // shortened argv array.
1011  //
1012  *_NSGetArgc() = *p_argc;
1013 #endif
1014  }
1015  }
1016 
1017  return status;
1018 }
1019 
1020 //--------------------------------------------------------------------------
1021 // ParseOpt()
1022 //
1033 //--------------------------------------------------------------------------
1034 
1035 static int
1036 ParseOpt( int *p_myargc, char ***p_argv, int *p_argc, char ***p_argsave,
1037  PLOptionTable *option_table )
1038 {
1039  PLOptionTable *tab;
1040  char *opt;
1041 
1042 // Only handle actual flags and their arguments
1043 
1044  if ( mode_nodash || ( *p_argv )[0][0] == '-' )
1045  {
1046  opt = ( *p_argv )[0];
1047  if ( *opt == '-' )
1048  opt++;
1049 
1050  for ( tab = option_table; tab->opt; tab++ )
1051  {
1052  // Skip if option not enabled
1053 
1054  if ( tab->mode & PL_OPT_DISABLED )
1055  continue;
1056 
1057  // Try to match it
1058 
1059  if ( *opt == *tab->opt && !strcmp( opt, tab->opt ) )
1060  {
1061  // Option matched, so remove from argv list if applicable.
1062 
1063  if ( !mode_nodelete )
1064  {
1065  if ( tab->mode & PL_OPT_NODELETE )
1066  ( *( *p_argsave )++ ) = ( **p_argv );
1067  else
1068  --( *p_argc );
1069  }
1070 
1071  // Process option (and argument if applicable)
1072 
1073  return ( ProcessOpt( opt, tab, p_myargc, p_argv, p_argc ) );
1074  }
1075  }
1076  }
1077 
1078  return -1;
1079 }
1080 
1081 //--------------------------------------------------------------------------
1082 // ProcessOpt()
1083 //
1093 //--------------------------------------------------------------------------
1094 
1095 static int
1096 ProcessOpt( char * opt, PLOptionTable *tab, int *p_myargc, char ***p_argv,
1097  int *p_argc )
1098 {
1099  int need_arg, res;
1100  char *opt_arg = NULL;
1101 
1102 // Get option argument if necessary
1103 
1105 
1106  if ( tab->mode & need_arg )
1107  {
1108  if ( GetOptarg( &opt_arg, p_myargc, p_argv, p_argc ) )
1109  return 1;
1110  }
1111 
1112 // Process argument
1113 
1114  switch ( tab->mode & 0xFF00 )
1115  {
1116  case PL_OPT_FUNC:
1117 
1118  // Call function handler to do the job
1119 
1120  if ( tab->handler == NULL )
1121  {
1122  fprintf( stderr,
1123  "ProcessOpt: no handler specified for option %s\n",
1124  tab->opt );
1125  return 1;
1126  }
1127 
1128  if ( mode_nodelete && opt_arg )
1129  {
1130  // Make a copy, since handler may mung opt_arg with strtok()
1131  char *copy =
1132  (char *) malloc( (size_t) ( 1 + strlen( opt_arg ) ) * sizeof ( char ) );
1133  if ( copy == NULL )
1134  {
1135  plabort( "ProcessOpt: out of memory" );
1136  return 1;
1137  }
1138  strcpy( copy, opt_arg );
1139  res = ( ( *tab->handler )( opt, copy, tab->client_data ) );
1140  free( (void *) copy );
1141  return res;
1142  }
1143  else
1144  {
1145  return ( ( *tab->handler )( opt, opt_arg, tab->client_data ) );
1146  }
1147 
1148  case PL_OPT_BOOL:
1149 
1150  // Set *var as a boolean
1151 
1152  if ( tab->var == NULL )
1153  {
1154  fprintf( stderr,
1155  "ProcessOpt: no variable specified for option %s\n",
1156  tab->opt );
1157  return 1;
1158  }
1159  *(int *) tab->var = 1;
1160  break;
1161 
1162  case PL_OPT_INT:
1163 
1164  // Set *var as an int
1165 
1166  if ( tab->var == NULL )
1167  {
1168  fprintf( stderr,
1169  "ProcessOpt: no variable specified for option %s\n",
1170  tab->opt );
1171  return 1;
1172  }
1173  *(int *) tab->var = atoi( opt_arg );
1174  break;
1175 
1176  case PL_OPT_FLOAT:
1177 
1178  // Set *var as a float
1179 
1180  if ( tab->var == NULL )
1181  {
1182  fprintf( stderr,
1183  "ProcessOpt: no variable specified for option %s\n",
1184  tab->opt );
1185  return 1;
1186  }
1187  *(PLFLT *) tab->var = atof( opt_arg );
1188  break;
1189 
1190  case PL_OPT_STRING:
1191 
1192  // Set var (can be NULL initially) to point to opt_arg string
1193 
1194  *(char **) tab->var = opt_arg;
1195  break;
1196 
1197  default:
1198 
1199  // Somebody messed up..
1200 
1201  fprintf( stderr,
1202  "ProcessOpt: invalid processing mode for option %s\n",
1203  tab->opt );
1204  return 1;
1205  }
1206  return 0;
1207 }
1208 
1209 //--------------------------------------------------------------------------
1210 // GetOptarg()
1211 //
1222 //--------------------------------------------------------------------------
1223 
1224 static int
1225 GetOptarg( char **popt_arg, int *p_myargc, char ***p_argv, int *p_argc )
1226 {
1227  int result = 0;
1228 
1229  --( *p_myargc );
1230 
1231  if ( ( *p_myargc ) <= 0 ) // oops, no more arguments
1232  result = 1;
1233 
1234  if ( !result )
1235  {
1236  ( *p_argv )++;
1237  if ( ( *p_argv )[0][0] == '-' && isalpha( ( *p_argv )[0][1] ) )
1238  {
1239  ( *p_argv )--; // oops, next arg is a flag
1240  result = 1;
1241  }
1242  }
1243 
1244  if ( !result ) // yeah, the user got it right
1245  {
1246  if ( !mode_nodelete )
1247  ( *p_argc )--;
1248  *popt_arg = ( *p_argv )[0];
1249  }
1250  else
1251  {
1252  if ( !mode_quiet )
1253  {
1254  fprintf( stderr, "Argument missing for %s option.\n", ( *p_argv )[0] );
1255  plOptUsage();
1256  }
1257  }
1258  return result;
1259 }
1260 
1261 //--------------------------------------------------------------------------
1262 // plSetUsage()
1263 //
1269 //--------------------------------------------------------------------------
1270 
1271 void
1272 plSetUsage( PLCHAR_VECTOR program_string, PLCHAR_VECTOR usage_string )
1273 {
1274  if ( program_string != NULL )
1275  program = program_string;
1276 
1277  if ( usage_string != NULL )
1278  usage = usage_string;
1279 }
1280 
1281 //--------------------------------------------------------------------------
1282 // plOptUsage()
1283 //
1286 //--------------------------------------------------------------------------
1287 
1288 void
1289 plOptUsage( void )
1290 {
1291  if ( usage == NULL )
1292  fprintf( stderr, "\nUsage:\n %s [options]\n", program );
1293  else
1294  fputs( usage, stderr );
1295 
1296  Syntax();
1297 
1298  fprintf( stderr, "\n\nType %s -h for a full description.\n\n",
1299  program );
1300 }
1301 
1302 //--------------------------------------------------------------------------
1303 // Syntax()
1304 //
1307 //--------------------------------------------------------------------------
1308 
1309 static void
1310 Syntax( void )
1311 {
1312  PLOptionTable *tab;
1313  int i, col, len;
1314 
1315 // Loop over all options tables
1316 
1317  for ( i = tables - 1; i >= 0; i-- )
1318  {
1319  // Introducer
1320 
1321  if ( ploption_info[i].name )
1322  fprintf( stderr, "\n%s:", ploption_info[i].name );
1323  else
1324  fputs( "\nUser options:", stderr );
1325 
1326  // Print syntax for each option
1327 
1328  col = 80;
1329  for ( tab = ploption_info[i].options; tab->opt; tab++ )
1330  {
1331  if ( tab->mode & PL_OPT_DISABLED )
1332  continue;
1333 
1334  if ( !mode_showall && ( tab->mode & PL_OPT_INVISIBLE ) )
1335  continue;
1336 
1337  if ( tab->syntax == NULL )
1338  continue;
1339 
1340  len = 3 + (int) strlen( tab->syntax ); // space [ string ]
1341  if ( col + len > 79 )
1342  {
1343  fprintf( stderr, "\n " ); // 3 spaces
1344  col = 3;
1345  }
1346  fprintf( stderr, " [%s]", tab->syntax );
1347  col += len;
1348  }
1349  fprintf( stderr, "\n" );
1350  }
1351 }
1352 
1353 //--------------------------------------------------------------------------
1354 // Help()
1355 //
1358 //--------------------------------------------------------------------------
1359 
1360 static void
1361 Help( void )
1362 {
1363  PLOptionTable *tab;
1364  const char **note;
1365  int i;
1366  FILE *outfile = stderr;
1367 
1368 #ifdef HAVE_POPEN
1369  FILE *pager = NULL;
1370  if ( getenv( "PAGER" ) != NULL )
1371  pager = (FILE *) popen( "$PAGER", "w" );
1372  if ( pager == NULL )
1373  pager = (FILE *) popen( "more", "w" );
1374  if ( pager != NULL )
1375  outfile = pager;
1376 #endif
1377 
1378 // Usage line
1379 
1380  if ( usage == NULL )
1381  fprintf( outfile, "\nUsage:\n %s [options]\n", program );
1382  else
1383  fputs( usage, outfile );
1384 
1385 // Loop over all options tables
1386 
1387  for ( i = tables - 1; i >= 0; i-- )
1388  {
1389  // Introducer
1390 
1391  if ( ploption_info[i].name )
1392  fprintf( outfile, "\n%s:\n", ploption_info[i].name );
1393  else
1394  fputs( "\nUser options:\n", outfile );
1395 
1396  // Print description for each option
1397 
1398  for ( tab = ploption_info[i].options; tab->opt; tab++ )
1399  {
1400  if ( tab->mode & PL_OPT_DISABLED )
1401  continue;
1402 
1403  if ( !mode_showall && ( tab->mode & PL_OPT_INVISIBLE ) )
1404  continue;
1405 
1406  if ( tab->desc == NULL )
1407  continue;
1408 
1409  if ( tab->mode & PL_OPT_INVISIBLE )
1410  fprintf( outfile, " * %-20s %s\n", tab->syntax, tab->desc );
1411  else
1412  fprintf( outfile, " %-20s %s\n", tab->syntax, tab->desc );
1413  }
1414 
1415  // Usage notes
1416 
1417  if ( ploption_info[i].notes )
1418  {
1419  putc( '\n', outfile );
1420  for ( note = ploption_info[i].notes; *note; note++ )
1421  {
1422  fputs( *note, outfile );
1423  putc( '\n', outfile );
1424  }
1425  }
1426  }
1427 
1428 #ifdef HAVE_POPEN
1429  if ( pager != NULL )
1430  pclose( pager );
1431 #endif
1432 }
1433 
1434 //--------------------------------------------------------------------------
1435 // plParseDrvOpts
1436 //
1443 //--------------------------------------------------------------------------
1444 
1445 int
1447 {
1448  DrvOptCmd *drvp;
1449  DrvOpt *t;
1450  int fl;
1451  char msg[80];
1452  memset( msg, '\0', sizeof ( msg ) );
1453 
1454  if ( !drv_opt.option )
1455  return 1;
1456 
1457  drvp = &drv_opt;
1458  do
1459  {
1460  t = acc_opt; fl = 0;
1461  while ( t->opt )
1462  {
1463  if ( strcmp( drvp->option, t->opt ) == 0 )
1464  {
1465  fl = 1;
1466  switch ( t->type )
1467  {
1468  case DRV_STR:
1469  *(char **) ( t->var_ptr ) = ( drvp->value );
1470 #ifdef DEBUG
1471  fprintf( stderr, "plParseDrvOpts: %s %s\n", t->opt, *(char **) t->var_ptr );
1472 #endif
1473  break;
1474 
1475  case DRV_INT:
1476  if ( sscanf( drvp->value, "%d", (int *) t->var_ptr ) != 1 )
1477  {
1478  snprintf( msg, sizeof ( msg ) - 1, "Incorrect argument to '%s' option", drvp->option );
1479  plexit( msg );
1480  }
1481 #ifdef DEBUG
1482  fprintf( stderr, "plParseDrvOpts: %s %d\n", t->opt, *(int *) t->var_ptr );
1483 #endif
1484  break;
1485 
1486  case DRV_FLT:
1487  if ( sscanf( drvp->value, "%f", (float *) t->var_ptr ) != 1 )
1488  {
1489  snprintf( msg, sizeof ( msg ) - 1, "Incorrect argument to '%s' option", drvp->option );
1490  plexit( msg );
1491  }
1492 #ifdef DEBUG
1493  fprintf( stderr, "plParseDrvOpts: %s %f\n", t->opt, *(float *) t->var_ptr );
1494 #endif
1495  break;
1496  }
1497  }
1498  t++;
1499  }
1500 
1501  if ( !fl )
1502  {
1503  snprintf( msg, sizeof ( msg ) - 1, "Option '%s' not recognized.\n\nRecognized options for this driver are:\n", drvp->option );
1504  plwarn( msg );
1505  plHelpDrvOpts( acc_opt );
1506  plexit( "" );
1507  }
1508  }
1509  while ( ( drvp = drvp->next ) )
1510  ;
1511 
1512  return 0;
1513 }
1514 
1515 //--------------------------------------------------------------------------
1516 // plHelpDrvOpts
1517 //
1522 //--------------------------------------------------------------------------
1523 
1524 void
1526 {
1527  DrvOpt *t;
1528 
1529  t = acc_opt;
1530  while ( t->opt )
1531  {
1532  fprintf( stderr, "%s:\t%s\n", t->opt, t->hlp_msg );
1533  t++;
1534  }
1535 }
1536 
1537 //--------------------------------------------------------------------------
1538 // tidyDrvOpts
1539 //
1542 //--------------------------------------------------------------------------
1543 
1544 void
1546 {
1547  DrvOptCmd *drvp, *drvpl;
1548 
1549  drvp = &drv_opt;
1550  do
1551  {
1552  drvpl = drvp;
1553  drvp = drvpl->next;
1554 
1555  free( drvpl->option );
1556  free( drvpl->value );
1557  // Free additional DrvOptCmd variables -
1558  // first entry in list is a static global variable
1559  if ( drvpl != &drv_opt )
1560  free( drvpl );
1561  } while ( drvp != NULL );
1562 
1563  // initialize drv_opt if it's used again
1564  drv_opt.option = NULL;
1565  drv_opt.value = NULL;
1566  drv_opt.next = NULL;
1567 }
1568 
1569 
1570 //--------------------------------------------------------------------------
1571 // Option handlers
1572 //--------------------------------------------------------------------------
1573 
1574 //--------------------------------------------------------------------------
1575 // opt_h()
1576 //
1586 //--------------------------------------------------------------------------
1587 
1588 static int
1589 opt_h( PLCHAR_VECTOR PL_UNUSED( opt ), PLCHAR_VECTOR PL_UNUSED( opt_arg ), void * PL_UNUSED( client_data ) )
1590 {
1591  if ( !mode_quiet )
1592  Help();
1593 
1594  return 2;
1595 }
1596 
1597 //--------------------------------------------------------------------------
1598 // opt_v()
1599 //
1609 //--------------------------------------------------------------------------
1610 
1611 static int
1612 opt_v( PLCHAR_VECTOR PL_UNUSED( opt ), PLCHAR_VECTOR PL_UNUSED( opt_arg ), void * PL_UNUSED( client_data ) )
1613 {
1614  if ( !mode_quiet )
1615  fprintf( stderr, "PLplot library version: %s\n", PLPLOT_VERSION );
1616 
1617  return 2;
1618 }
1619 
1620 //--------------------------------------------------------------------------
1621 // opt_verbose()
1622 //
1632 //--------------------------------------------------------------------------
1633 
1634 static int
1635 opt_verbose( PLCHAR_VECTOR PL_UNUSED( opt ), PLCHAR_VECTOR PL_UNUSED( opt_arg ), void * PL_UNUSED( client_data ) )
1636 {
1637  plsc->verbose = 1;
1638  return 0;
1639 }
1640 
1641 //--------------------------------------------------------------------------
1642 // opt_debug()
1643 //
1653 //--------------------------------------------------------------------------
1654 
1655 static int
1656 opt_debug( PLCHAR_VECTOR PL_UNUSED( opt ), PLCHAR_VECTOR PL_UNUSED( opt_arg ), void * PL_UNUSED( client_data ) )
1657 {
1658  plsc->debug = 1;
1659  plsc->verbose = 1;
1660  return 0;
1661 }
1662 
1663 //--------------------------------------------------------------------------
1664 // opt_hack()
1665 //
1675 //--------------------------------------------------------------------------
1676 
1677 static int
1678 opt_hack( PLCHAR_VECTOR PL_UNUSED( opt ), PLCHAR_VECTOR PL_UNUSED( opt_arg ), void * PL_UNUSED( client_data ) )
1679 {
1680  plsc->hack = 1;
1681  return 0;
1682 }
1683 
1684 //--------------------------------------------------------------------------
1685 // opt_dev()
1686 //
1696 //--------------------------------------------------------------------------
1697 
1698 static int
1699 opt_dev( PLCHAR_VECTOR PL_UNUSED( opt ), PLCHAR_VECTOR opt_arg, void * PL_UNUSED( client_data ) )
1700 {
1701  plsdev( opt_arg );
1702  return 0;
1703 }
1704 
1705 //--------------------------------------------------------------------------
1706 // opt_o()
1707 //
1717 //--------------------------------------------------------------------------
1718 
1719 static int
1720 opt_o( PLCHAR_VECTOR PL_UNUSED( opt ), PLCHAR_VECTOR opt_arg, void * PL_UNUSED( client_data ) )
1721 {
1722  plsfnam( opt_arg );
1723  return 0;
1724 }
1725 
1726 //--------------------------------------------------------------------------
1727 // opt_mar()
1728 //
1738 //--------------------------------------------------------------------------
1739 
1740 static int
1741 opt_mar( PLCHAR_VECTOR PL_UNUSED( opt ), PLCHAR_VECTOR opt_arg, void * PL_UNUSED( client_data ) )
1742 {
1743  plsdidev( atof( opt_arg ), PL_NOTSET, PL_NOTSET, PL_NOTSET );
1744  return 0;
1745 }
1746 
1747 //--------------------------------------------------------------------------
1748 // opt_a()
1749 //
1759 //--------------------------------------------------------------------------
1760 
1761 static int
1762 opt_a( PLCHAR_VECTOR PL_UNUSED( opt ), PLCHAR_VECTOR opt_arg, void * PL_UNUSED( client_data ) )
1763 {
1764  plsdidev( PL_NOTSET, atof( opt_arg ), PL_NOTSET, PL_NOTSET );
1765  return 0;
1766 }
1767 
1768 //--------------------------------------------------------------------------
1769 // opt_jx()
1770 //
1780 //--------------------------------------------------------------------------
1781 
1782 static int
1783 opt_jx( PLCHAR_VECTOR PL_UNUSED( opt ), PLCHAR_VECTOR opt_arg, void * PL_UNUSED( client_data ) )
1784 {
1785  plsdidev( PL_NOTSET, PL_NOTSET, atof( opt_arg ), PL_NOTSET );
1786  return 0;
1787 }
1788 
1789 //--------------------------------------------------------------------------
1790 // opt_jy()
1791 //
1801 //--------------------------------------------------------------------------
1802 
1803 static int
1804 opt_jy( PLCHAR_VECTOR PL_UNUSED( opt ), PLCHAR_VECTOR opt_arg, void * PL_UNUSED( client_data ) )
1805 {
1806  plsdidev( PL_NOTSET, PL_NOTSET, PL_NOTSET, atof( opt_arg ) );
1807  return 0;
1808 }
1809 
1810 //--------------------------------------------------------------------------
1811 // opt_ori()
1812 //
1822 //--------------------------------------------------------------------------
1823 
1824 static int
1825 opt_ori( PLCHAR_VECTOR PL_UNUSED( opt ), PLCHAR_VECTOR opt_arg, void * PL_UNUSED( client_data ) )
1826 {
1827  plsdiori( atof( opt_arg ) );
1828  return 0;
1829 }
1830 
1831 //--------------------------------------------------------------------------
1832 // opt_freeaspect()
1833 //
1843 //--------------------------------------------------------------------------
1844 
1845 static int
1846 opt_freeaspect( PLCHAR_VECTOR PL_UNUSED( opt ), PLCHAR_VECTOR PL_UNUSED( opt_arg ), void * PL_UNUSED( client_data ) )
1847 {
1848  plsc->freeaspect = 1;
1849  return 0;
1850 }
1851 
1852 //--------------------------------------------------------------------------
1853 // opt_portrait()
1854 //
1878 //--------------------------------------------------------------------------
1879 
1880 static int
1881 opt_portrait( PLCHAR_VECTOR PL_UNUSED( opt ), PLCHAR_VECTOR PL_UNUSED( opt_arg ), void * PL_UNUSED( client_data ) )
1882 {
1883  plsc->portrait = 1;
1884  return 0;
1885 }
1886 
1887 //--------------------------------------------------------------------------
1888 // opt_width()
1889 //
1899 //--------------------------------------------------------------------------
1900 
1901 static int
1902 opt_width( PLCHAR_VECTOR PL_UNUSED( opt ), PLCHAR_VECTOR opt_arg, void * PL_UNUSED( client_data ) )
1903 {
1904  double width;
1905 
1906  width = atof( opt_arg );
1907  if ( width < 0. )
1908  {
1909  fprintf( stderr, "?invalid width\n" );
1910  return 1;
1911  }
1912  else
1913  {
1914  plwidth( width );
1915  plsc->widthlock = 1;
1916  }
1917  return 0;
1918 }
1919 
1920 //--------------------------------------------------------------------------
1921 // opt_bg()
1922 //
1936 //--------------------------------------------------------------------------
1937 
1938 static int
1939 opt_bg( PLCHAR_VECTOR PL_UNUSED( opt ), PLCHAR_VECTOR opt_arg, void * PL_UNUSED( client_data ) )
1940 {
1941  PLCHAR_VECTOR rgb;
1942  char *color_field, *alpha_field;
1943  long bgcolor;
1944  PLINT r, g, b;
1945  PLFLT a;
1946 
1947 // Strip off leading "#" (TK-ism) if present.
1948 
1949  if ( *opt_arg == '#' )
1950  rgb = opt_arg + 1;
1951  else
1952  rgb = opt_arg;
1953 
1954  strncpy( opttmp, rgb, OPTMAX - 1 );
1955  opttmp[OPTMAX - 1] = '\0';
1956 
1957  if ( strchr( opttmp, '_' ) )
1958  {
1959  // e.g., -bg ff0000_0.1
1960  color_field = strtok( opttmp, "_" );
1961  alpha_field = strtok( NULL, "_" );
1962  }
1963  else
1964  {
1965  color_field = opttmp;
1966  alpha_field = NULL;
1967  }
1968 
1969  bgcolor = strtol( color_field, NULL, 16 );
1970 
1971 // Must be either a 3 or 6 digit hex number
1972 // If 3 digits, each is "doubled" (i.e. ABC becomes AABBCC).
1973 
1974  switch ( strlen( color_field ) )
1975  {
1976  case 3:
1977  r = (PLINT) ( ( bgcolor & 0xF00 ) >> 8 );
1978  g = (PLINT) ( ( bgcolor & 0x0F0 ) >> 4 );
1979  b = (PLINT) ( bgcolor & 0x00F );
1980 
1981  r = r | ( r << 4 );
1982  g = g | ( g << 4 ); // doubling
1983  b = b | ( b << 4 );
1984  break;
1985 
1986  case 6:
1987  r = (PLINT) ( ( bgcolor & 0xFF0000 ) >> 16 );
1988  g = (PLINT) ( ( bgcolor & 0x00FF00 ) >> 8 );
1989  b = (PLINT) ( bgcolor & 0x0000FF );
1990  break;
1991 
1992  default:
1993  fprintf( stderr, "Unrecognized background color value %s\n", color_field );
1994  return 1;
1995  }
1996 
1997  if ( alpha_field )
1998  a = atof( alpha_field );
1999  else
2000  a = 1.;
2001 
2002  plscolbga( r, g, b, a );
2003 
2004  return 0;
2005 }
2006 
2007 //--------------------------------------------------------------------------
2008 // opt_ncol0()
2009 //
2019 //--------------------------------------------------------------------------
2020 
2021 static int
2022 opt_ncol0( PLCHAR_VECTOR PL_UNUSED( opt ), PLCHAR_VECTOR opt_arg, void * PL_UNUSED( client_data ) )
2023 {
2024  plsc->ncol0 = atoi( opt_arg );
2025  return 0;
2026 }
2027 
2028 //--------------------------------------------------------------------------
2029 // opt_ncol1()
2030 //
2040 //--------------------------------------------------------------------------
2041 
2042 static int
2043 opt_ncol1( PLCHAR_VECTOR PL_UNUSED( opt ), PLCHAR_VECTOR opt_arg, void * PL_UNUSED( client_data ) )
2044 {
2045  plsc->ncol1 = atoi( opt_arg );
2046  return 0;
2047 }
2048 
2049 //--------------------------------------------------------------------------
2050 // opt_wplt()
2051 //
2061 //--------------------------------------------------------------------------
2062 
2063 static int
2064 opt_wplt( PLCHAR_VECTOR PL_UNUSED( opt ), PLCHAR_VECTOR opt_arg, void * PL_UNUSED( client_data ) )
2065 {
2066  char *field;
2067  PLFLT xl, yl, xr, yr;
2068 
2069  strncpy( opttmp, opt_arg, OPTMAX - 1 );
2070  opttmp[OPTMAX - 1] = '\0';
2071 
2072  if ( ( field = strtok( opttmp, "," ) ) == NULL )
2073  return 1;
2074 
2075  xl = atof( field );
2076 
2077  if ( ( field = strtok( NULL, "," ) ) == NULL )
2078  return 1;
2079 
2080  yl = atof( field );
2081 
2082  if ( ( field = strtok( NULL, "," ) ) == NULL )
2083  return 1;
2084 
2085  xr = atof( field );
2086 
2087  if ( ( field = strtok( NULL, "," ) ) == NULL )
2088  return 1;
2089 
2090  yr = atof( field );
2091 
2092  plsdiplt( xl, yl, xr, yr );
2093  return 0;
2094 }
2095 
2096 //--------------------------------------------------------------------------
2097 // opt_drvopt()
2098 //
2108 //--------------------------------------------------------------------------
2109 
2110 static int
2111 opt_drvopt( PLCHAR_VECTOR PL_UNUSED( opt ), PLCHAR_VECTOR opt_arg, void * PL_UNUSED( client_data ) )
2112 {
2113  char t, *tt, *option, *value;
2114  int fl = 0;
2115  DrvOptCmd *drvp;
2116 
2117  option = (char *) malloc( (size_t) ( 1 + strlen( opt_arg ) ) * sizeof ( char ) );
2118  if ( option == NULL )
2119  plexit( "opt_drvopt: Out of memory!?" );
2120 
2121  value = (char *) malloc( (size_t) ( 1 + strlen( opt_arg ) ) * sizeof ( char ) );
2122  if ( value == NULL )
2123  plexit( "opt_drvopt: Out of memory!?" );
2124 
2125  drvp = &drv_opt;
2126  *option = *value = '\0';
2127  tt = option;
2128  while ( ( t = *opt_arg++ ) )
2129  {
2130  switch ( t )
2131  {
2132  case ',':
2133  if ( fl )
2134  fl = 0;
2135  else
2136  {
2137  value[0] = '1';
2138  value[1] = '\0';
2139  }
2140 
2141  *tt = '\0'; tt = option;
2142  drvp->option = plstrdup( option ); // it should not be release, because of familying
2143  drvp->value = plstrdup( value ); // don't release
2144  drvp->next = (DrvOptCmd *) malloc( sizeof ( DrvOptCmd ) ); // don't release
2145  if ( drvp->next == NULL )
2146  plexit( "opt_drvopt: Out of memory!?\n" );
2147 
2148  drvp = drvp->next;
2149  break;
2150 
2151  case '=':
2152  fl = 1;
2153  *tt = '\0'; tt = value;
2154  break;
2155 
2156  default:
2157  *tt++ = t;
2158  }
2159  }
2160 
2161  *tt = '\0';
2162  if ( !fl )
2163  {
2164  value[0] = '1';
2165  value[1] = '\0';
2166  }
2167 
2168  drvp->option = plstrdup( option ); // don't release
2169  drvp->value = plstrdup( value ); // don't release
2170  drvp->next = NULL;
2171 
2172 #ifdef DEBUG
2173  fprintf( stderr, "\nopt_drvopt: -drvopt parsed options:\n" );
2174  drvp = &drv_opt;
2175  do
2176  fprintf( stderr, "%s %s\n", drvp->option, drvp->value );
2177  while ( drvp = drvp->next );
2178  fprintf( stderr, "\n" );
2179 #endif
2180 
2181  free( option ); free( value );
2182 
2183  return 0;
2184 }
2185 
2186 //--------------------------------------------------------------------------
2187 // opt_fam()
2188 //
2198 //--------------------------------------------------------------------------
2199 
2200 static int
2201 opt_fam( PLCHAR_VECTOR PL_UNUSED( opt ), PLCHAR_VECTOR PL_UNUSED( opt_arg ), void * PL_UNUSED( client_data ) )
2202 {
2203  plsfam( 1, -1, -1 );
2204  return 0;
2205 }
2206 
2207 //--------------------------------------------------------------------------
2208 // opt_fsiz()
2209 //
2228 //--------------------------------------------------------------------------
2229 
2230 static int
2231 opt_fsiz( PLCHAR_VECTOR PL_UNUSED( opt ), PLCHAR_VECTOR opt_arg, void * PL_UNUSED( client_data ) )
2232 {
2233  PLINT bytemax;
2234  size_t len = strlen( opt_arg );
2235  char lastchar = opt_arg[len - 1];
2236  PLFLT multiplier = 1.0e6;
2237  char *spec = (char *) malloc( len + 1 );
2238 
2239  if ( spec == NULL )
2240  plexit( "opt_fsiz: Insufficient memory" );
2241 
2242 // Interpret optional suffix
2243 
2244  switch ( lastchar )
2245  {
2246  case 'k':
2247  case 'K':
2248  multiplier = 1.0e3; len--;
2249  break;
2250  case 'm':
2251  case 'M':
2252  multiplier = 1.0e6; len--;
2253  break;
2254  case 'g':
2255  case 'G':
2256  multiplier = 1.0e9; len--;
2257  break;
2258  }
2259  strncpy( spec, opt_arg, len );
2260  spec[len] = '\0';
2261 
2262  bytemax = (PLINT) ( multiplier * atof( spec ) );
2263  if ( bytemax <= 0 )
2264  {
2265  fprintf( stderr, "?invalid file size %d. 2.14G is the maximum.\n", bytemax );
2266  return 1;
2267  }
2268  plsfam( 1, -1, bytemax );
2269 
2270  free( spec );
2271  return 0;
2272 }
2273 
2274 //--------------------------------------------------------------------------
2275 // opt_fbeg()
2276 //
2286 //--------------------------------------------------------------------------
2287 
2288 static int
2289 opt_fbeg( PLCHAR_VECTOR PL_UNUSED( opt ), PLCHAR_VECTOR opt_arg, void * PL_UNUSED( client_data ) )
2290 {
2291  plsc->member = atoi( opt_arg );
2292 
2293  return 0;
2294 }
2295 
2296 //--------------------------------------------------------------------------
2297 // opt_finc()
2298 //
2308 //--------------------------------------------------------------------------
2309 
2310 static int
2311 opt_finc( PLCHAR_VECTOR PL_UNUSED( opt ), PLCHAR_VECTOR opt_arg, void * PL_UNUSED( client_data ) )
2312 {
2313  plsc->finc = atoi( opt_arg );
2314 
2315  return 0;
2316 }
2317 
2318 //--------------------------------------------------------------------------
2319 // opt_fflen()
2320 //
2330 //--------------------------------------------------------------------------
2331 
2332 static int
2333 opt_fflen( PLCHAR_VECTOR PL_UNUSED( opt ), PLCHAR_VECTOR opt_arg, void * PL_UNUSED( client_data ) )
2334 {
2335  plsc->fflen = atoi( opt_arg );
2336 
2337  return 0;
2338 }
2339 
2340 //--------------------------------------------------------------------------
2341 // opt_np()
2342 //
2352 //--------------------------------------------------------------------------
2353 
2354 static int
2355 opt_np( PLCHAR_VECTOR PL_UNUSED( opt ), PLCHAR_VECTOR PL_UNUSED( opt_arg ), void * PL_UNUSED( client_data ) )
2356 {
2357  plspause( 0 );
2358  return 0;
2359 }
2360 
2361 //--------------------------------------------------------------------------
2362 // opt_nopixmap()
2363 //
2373 //--------------------------------------------------------------------------
2374 
2375 static int
2376 opt_nopixmap( PLCHAR_VECTOR PL_UNUSED( opt ), PLCHAR_VECTOR PL_UNUSED( opt_arg ), void * PL_UNUSED( client_data ) )
2377 {
2378  plsc->nopixmap = 1;
2379  return 0;
2380 }
2381 
2382 //--------------------------------------------------------------------------
2383 // opt_db()
2384 //
2394 //--------------------------------------------------------------------------
2395 
2396 static int
2397 opt_db( PLCHAR_VECTOR PL_UNUSED( opt ), PLCHAR_VECTOR PL_UNUSED( opt_arg ), void * PL_UNUSED( client_data ) )
2398 {
2399  plsc->db = 1;
2400  return 0;
2401 }
2402 
2403 //--------------------------------------------------------------------------
2404 // opt_bufmax()
2405 //
2415 //--------------------------------------------------------------------------
2416 
2417 static int
2418 opt_bufmax( PLCHAR_VECTOR PL_UNUSED( opt ), PLCHAR_VECTOR opt_arg, void * PL_UNUSED( client_data ) )
2419 {
2420  plsc->bufmax = atoi( opt_arg );
2421  return 0;
2422 }
2423 
2424 //--------------------------------------------------------------------------
2425 // opt_server_name()
2426 //
2436 //--------------------------------------------------------------------------
2437 
2438 static int
2439 opt_server_name( PLCHAR_VECTOR PL_UNUSED( opt ), PLCHAR_VECTOR opt_arg, void * PL_UNUSED( client_data ) )
2440 {
2441  plsc->server_name = plstrdup( opt_arg );
2442  return 0;
2443 }
2444 
2445 //--------------------------------------------------------------------------
2446 // opt_plserver()
2447 //
2457 //--------------------------------------------------------------------------
2458 
2459 static int
2460 opt_plserver( PLCHAR_VECTOR PL_UNUSED( opt ), PLCHAR_VECTOR opt_arg, void * PL_UNUSED( client_data ) )
2461 {
2462  plsc->plserver = plstrdup( opt_arg );
2463  return 0;
2464 }
2465 
2466 //--------------------------------------------------------------------------
2467 // opt_plwindow()
2468 //
2478 //--------------------------------------------------------------------------
2479 
2480 static int
2481 opt_plwindow( PLCHAR_VECTOR PL_UNUSED( opt ), PLCHAR_VECTOR opt_arg, void * PL_UNUSED( client_data ) )
2482 {
2483  if ( ( plsc->plwindow = (char *) malloc( (size_t) ( 1 + strlen( opt_arg ) ) * sizeof ( char ) ) ) == NULL )
2484  {
2485  plexit( "opt_plwindow: Insufficient memory" );
2486  }
2487  strcpy( plsc->plwindow, opt_arg );
2488  return 0;
2489 }
2490 
2491 //--------------------------------------------------------------------------
2492 // opt_auto_path()
2493 //
2503 //--------------------------------------------------------------------------
2504 
2505 static int
2506 opt_auto_path( PLCHAR_VECTOR PL_UNUSED( opt ), PLCHAR_VECTOR opt_arg, void * PL_UNUSED( client_data ) )
2507 {
2508  plsc->auto_path = plstrdup( opt_arg );
2509  return 0;
2510 }
2511 
2512 //--------------------------------------------------------------------------
2513 // opt_px()
2514 //
2524 //--------------------------------------------------------------------------
2525 
2526 static int
2527 opt_px( PLCHAR_VECTOR PL_UNUSED( opt ), PLCHAR_VECTOR opt_arg, void * PL_UNUSED( client_data ) )
2528 {
2529  plssub( atoi( opt_arg ), -1 );
2530  return 0;
2531 }
2532 
2533 //--------------------------------------------------------------------------
2534 // opt_py()
2535 //
2545 //--------------------------------------------------------------------------
2546 
2547 static int
2548 opt_py( PLCHAR_VECTOR PL_UNUSED( opt ), PLCHAR_VECTOR opt_arg, void * PL_UNUSED( client_data ) )
2549 {
2550  plssub( -1, atoi( opt_arg ) );
2551  return 0;
2552 }
2553 
2554 //--------------------------------------------------------------------------
2555 // opt_geo()
2556 //
2570 //--------------------------------------------------------------------------
2571 
2572 static int
2573 opt_geo( PLCHAR_VECTOR PL_UNUSED( opt ), PLCHAR_VECTOR opt_arg, void * PL_UNUSED( client_data ) )
2574 {
2575  int numargs;
2576  PLFLT xdpi = 0., ydpi = 0.;
2577  PLINT xwid, ywid, xoff, yoff;
2578 
2579 // The TK driver uses the geometry string directly
2580 
2581  if ( ( plsc->geometry = (char *) malloc( (size_t) ( 1 + strlen( opt_arg ) ) * sizeof ( char ) ) ) == NULL )
2582  {
2583  plexit( "opt_geo: Insufficient memory" );
2584  }
2585 
2586  strcpy( plsc->geometry, opt_arg );
2587 
2588  numargs = sscanf( opt_arg, "%dx%d%d%d", &xwid, &ywid, &xoff, &yoff );
2589  if ( numargs == 2 )
2590  {
2591  xoff = 0;
2592  yoff = 0;
2593  if ( xwid == 0 )
2594  fprintf( stderr, "?invalid xwid in -geometry %s\n", opt_arg );
2595  if ( ywid == 0 )
2596  fprintf( stderr, "?invalid ywid in -geometry %s\n", opt_arg );
2597  if ( xwid < 0 )
2598  {
2599  fprintf( stderr, "?invalid xwid in -geometry %s\n", opt_arg );
2600  return 1;
2601  }
2602  if ( ywid < 0 )
2603  {
2604  fprintf( stderr, "?invalid ywid in -geometry %s\n", opt_arg );
2605  return 1;
2606  }
2607  }
2608  else if ( numargs == 4 )
2609  {
2610  if ( xwid == 0 )
2611  fprintf( stderr, "?invalid xwid in -geometry %s\n", opt_arg );
2612  if ( ywid == 0 )
2613  fprintf( stderr, "?invalid ywid in -geometry %s\n", opt_arg );
2614  if ( xwid < 0 )
2615  {
2616  fprintf( stderr, "?invalid xwid in -geometry %s\n", opt_arg );
2617  return 1;
2618  }
2619  if ( ywid < 0 )
2620  {
2621  fprintf( stderr, "?invalid ywid in -geometry %s\n", opt_arg );
2622  return 1;
2623  }
2624  if ( abs( xoff ) == 0 )
2625  fprintf( stderr, "?invalid xoff in -geometry %s\n", opt_arg );
2626  if ( abs( yoff ) == 0 )
2627  fprintf( stderr, "?invalid yoff in -geometry %s\n", opt_arg );
2628  }
2629  else
2630  {
2631  numargs = sscanf( opt_arg, "%d%d", &xoff, &yoff );
2632  if ( numargs == 2 )
2633  {
2634  xwid = 0;
2635  ywid = 0;
2636  if ( abs( xoff ) == 0 )
2637  fprintf( stderr, "?invalid xoff in -geometry %s\n", opt_arg );
2638  if ( abs( yoff ) == 0 )
2639  fprintf( stderr, "?invalid yoff in -geometry %s\n", opt_arg );
2640  }
2641  else
2642  {
2643  fprintf( stderr, "?invalid -geometry %s\n", opt_arg );
2644  return 1;
2645  }
2646  }
2647  //fprintf( stderr, "xwid, ywid, xoff, yoff = %d, %d, %d, %d\n", xwid, ywid, xoff, yoff );
2648  plspage( xdpi, ydpi, xwid, ywid, xoff, yoff );
2649  return 0;
2650 }
2651 
2652 //--------------------------------------------------------------------------
2653 // opt_tk_file()
2654 //
2663 //--------------------------------------------------------------------------
2664 
2665 static int
2666 opt_tk_file( PLCHAR_VECTOR PL_UNUSED( opt ), PLCHAR_VECTOR opt_arg, void * PL_UNUSED( client_data ) )
2667 {
2668  if ( ( plsc->tk_file = (char *) malloc( (size_t) ( 1 + strlen( opt_arg ) ) * sizeof ( char ) ) ) == NULL )
2669  {
2670  plexit( "opt_tk_file: Insufficient memory" );
2671  }
2672 
2673  strcpy( plsc->tk_file, opt_arg );
2674  return 0;
2675 }
2676 
2677 //--------------------------------------------------------------------------
2678 // opt_dpi()
2679 //
2693 //--------------------------------------------------------------------------
2694 
2695 static int
2696 opt_dpi( PLCHAR_VECTOR PL_UNUSED( opt ), PLCHAR_VECTOR opt_arg, void * PL_UNUSED( client_data ) )
2697 {
2698  char *field;
2699  PLFLT xdpi = 0., ydpi = 0.;
2700  PLINT xwid = 0, ywid = 0, xoff = 0, yoff = 0;
2701 
2702  strncpy( opttmp, opt_arg, OPTMAX - 1 );
2703  opttmp[OPTMAX - 1] = '\0';
2704  if ( strchr( opttmp, 'x' ) )
2705  {
2706  field = strtok( opttmp, "x" );
2707  xdpi = atof( field );
2708  if ( xdpi == 0 )
2709  fprintf( stderr, "?invalid xdpi\n" );
2710 
2711  if ( ( field = strtok( NULL, " " ) ) == NULL )
2712  return 1;
2713 
2714  ydpi = atof( field );
2715  if ( ydpi == 0 )
2716  fprintf( stderr, "?invalid ydpi\n" );
2717  }
2718  else
2719  {
2720  xdpi = atof( opttmp );
2721  ydpi = xdpi;
2722  if ( xdpi == 0 )
2723  return 1;
2724  }
2725 
2726  plspage( xdpi, ydpi, xwid, ywid, xoff, yoff );
2727  return 0;
2728 }
2729 
2730 //--------------------------------------------------------------------------
2731 // opt_dev_compression()
2732 //
2741 //--------------------------------------------------------------------------
2742 
2743 static int
2744 opt_dev_compression( PLCHAR_VECTOR PL_UNUSED( opt ), PLCHAR_VECTOR opt_arg, void * PL_UNUSED( client_data ) )
2745 {
2746  PLINT comp = 0;
2747 
2748  comp = atoi( opt_arg );
2749  if ( comp == 0 )
2750  {
2751  fprintf( stderr, "?invalid compression\n" );
2752  return 1;
2753  }
2754  plscompression( comp );
2755 
2756  return 0;
2757 }
2758 
2759 //--------------------------------------------------------------------------
2760 // opt_cmap0()
2761 //
2770 //--------------------------------------------------------------------------
2771 
2772 static int
2773 opt_cmap0( PLCHAR_VECTOR PL_UNUSED( opt ), PLCHAR_VECTOR opt_arg, void * PL_UNUSED( client_data ) )
2774 {
2775  plspal0( opt_arg );
2776  return 0;
2777 }
2778 
2779 //--------------------------------------------------------------------------
2780 // opt_cmap1()
2781 //
2790 //--------------------------------------------------------------------------
2791 
2792 static int
2793 opt_cmap1( PLCHAR_VECTOR PL_UNUSED( opt ), PLCHAR_VECTOR opt_arg, void * PL_UNUSED( client_data ) )
2794 {
2795  plspal1( opt_arg, TRUE );
2796  return 0;
2797 }
2798 
2799 //--------------------------------------------------------------------------
2800 // opt_locale()
2801 //
2810 //--------------------------------------------------------------------------
2811 
2812 static int
2813 opt_locale( PLCHAR_VECTOR PL_UNUSED( opt ), PLCHAR_VECTOR PL_UNUSED( opt_arg ), void * PL_UNUSED( client_data ) )
2814 {
2815  char *locale;
2816  if ( ( locale = setlocale( LC_NUMERIC, "" ) ) )
2817  {
2818  printf( "LC_NUMERIC locale set to \"%s\"\n", locale );
2819  }
2820  else
2821  {
2822  plwarn( "Could not use invalid environment (e.g., LC_ALL, LC_NUMERIC, or LANG) to set LC_NUMERIC locale. Falling back to LC_NUMERIC \"C\" locale instead.\n" );
2823  if ( !( locale = setlocale( LC_NUMERIC, "C" ) ) )
2824  {
2825  plexit( "Your platform is seriously broken. Not even a \"C\" locale could be set." );
2826  }
2827  }
2828  return 0;
2829 }
2830 
2831 //--------------------------------------------------------------------------
2832 // opt_eofill()
2833 //
2844 //--------------------------------------------------------------------------
2845 
2846 static int
2847 opt_eofill( PLCHAR_VECTOR PL_UNUSED( opt ), PLCHAR_VECTOR PL_UNUSED( opt_arg ), void * PL_UNUSED( client_data ) )
2848 {
2849  plsc->dev_eofill = 1;
2850  if ( plsc->level > 0 )
2852  return 0;
2853 }
2854 
2855 //--------------------------------------------------------------------------
2856 // opt_mfo()
2857 //
2866 //--------------------------------------------------------------------------
2867 
2868 static int
2869 opt_mfo( PLCHAR_VECTOR PL_UNUSED( opt ), PLCHAR_VECTOR opt_arg, void * PL_UNUSED( client_data ) )
2870 {
2871  if ( ( plsc->mf_outfile = (char *) malloc( (size_t) ( 1 + strlen( opt_arg ) ) * sizeof ( char ) ) ) == NULL )
2872  {
2873  plexit( "opt_mfo: Insufficient memory" );
2874  }
2875 
2876  strcpy( plsc->mf_outfile, opt_arg );
2877  return 0;
2878 }
2879 
2880 //--------------------------------------------------------------------------
2881 // opt_mfi()
2882 //
2891 //--------------------------------------------------------------------------
2892 
2893 static int
2894 opt_mfi( PLCHAR_VECTOR PL_UNUSED( opt ), PLCHAR_VECTOR opt_arg, void * PL_UNUSED( client_data ) )
2895 {
2896  if ( ( plsc->mf_infile = (char *) malloc( (size_t) ( 1 + strlen( opt_arg ) ) * sizeof ( char ) ) ) == NULL )
2897  {
2898  plexit( "opt_mfi: Insufficient memory" );
2899  }
2900 
2901  strcpy( plsc->mf_infile, opt_arg );
2902  return 0;
2903 }
#define PL_MAX_OPT_TABLES
Definition: plargs.c:716
int plParseDrvOpts(DrvOpt *acc_opt)
Definition: plargs.c:1446
#define plsfam
Definition: plplot.h:805
PLINT plMergeOpts(PLOptionTable *options, PLCHAR_VECTOR name, PLCHAR_VECTOR *notes)
Definition: plargs.c:774
#define PL_OPT_FUNC
Definition: plplot.h:353
static const char * name
Definition: tkMain.c:135
static char ** argv
Definition: qt.cpp:40
static int opt_portrait(PLCHAR_VECTOR, PLCHAR_VECTOR, void *)
static int mode_full
Definition: plargs.c:172
#define PL_PARSE_NOPROGRAM
Definition: plplot.h:369
void plexit(PLCHAR_VECTOR errormsg)
Definition: plctrl.c:1962
#define plspage
Definition: plplot.h:820
static int opt_v(PLCHAR_VECTOR, PLCHAR_VECTOR, void *)
int(* handler)(PLCHAR_VECTOR, PLCHAR_VECTOR, PLPointer)
Definition: plplot.h:402
static int opt_auto_path(PLCHAR_VECTOR, PLCHAR_VECTOR, void *)
static PLCHAR_VECTOR usage
Definition: plargs.c:170
#define PL_PARSE_QUIET
Definition: plplot.h:364
#define plsdev
Definition: plplot.h:795
#define PL_PARSE_NODASH
Definition: plplot.h:370
static int opt_locale(PLCHAR_VECTOR, PLCHAR_VECTOR, void *)
static int opt_nopixmap(PLCHAR_VECTOR, PLCHAR_VECTOR, void *)
#define PL_OPT_DISABLED
Definition: plplot.h:349
static int opt_fflen(PLCHAR_VECTOR, PLCHAR_VECTOR, void *)
#define plscompression
Definition: plplot.h:794
static int argc
Definition: qt.cpp:39
PLCHAR_VECTOR opt
Definition: plplot.h:401
void plResetOpts(void)
Definition: plargs.c:834
const char * PLCHAR_VECTOR
Definition: plplot.h:247
static void Syntax(void)
Definition: plargs.c:1310
#define plscolbga
Definition: plplot.h:792
static int opt_width(PLCHAR_VECTOR, PLCHAR_VECTOR, void *)
#define PL_PARSE_NODELETE
Definition: plplot.h:365
PLCHAR_VECTOR opt
Definition: plplotP.h:750
#define plsdiori
Definition: plplot.h:798
static int opt_dev(PLCHAR_VECTOR, PLCHAR_VECTOR, void *)
void * var_ptr
Definition: plplotP.h:752
#define plparseopts
Definition: plplot.h:767
static int opt_db(PLCHAR_VECTOR, PLCHAR_VECTOR, void *)
static void Help(void)
Definition: plargs.c:1361
#define PL_OPT_FLOAT
Definition: plplot.h:356
void plabort(PLCHAR_VECTOR errormsg)
Definition: plctrl.c:1898
#define plsdiplt
Definition: plplot.h:799
static int ParseOpt(int *, char ***, int *, char ***, PLOptionTable *)
Definition: plargs.c:1036
static int mode_showall
Definition: plargs.c:175
#define plssub
Definition: plplot.h:825
static int opt_py(PLCHAR_VECTOR, PLCHAR_VECTOR, void *)
static int opt_fsiz(PLCHAR_VECTOR, PLCHAR_VECTOR, void *)
static int opt_verbose(PLCHAR_VECTOR, PLCHAR_VECTOR, void *)
#define plspal1
Definition: plplot.h:822
static int opt_dpi(PLCHAR_VECTOR, PLCHAR_VECTOR, void *)
static int opt_dev_compression(PLCHAR_VECTOR, PLCHAR_VECTOR, void *)
char * value
Definition: plargs.c:730
PLINT c_plparseopts(int *p_argc, char **argv, PLINT mode)
Definition: plargs.c:856
static int opt_wplt(PLCHAR_VECTOR, PLCHAR_VECTOR, void *)
static int opt_jy(PLCHAR_VECTOR, PLCHAR_VECTOR, void *)
void plSetUsage(PLCHAR_VECTOR program_string, PLCHAR_VECTOR usage_string)
Definition: plargs.c:1272
int PLINT
Definition: plplot.h:176
static int opt_geo(PLCHAR_VECTOR, PLCHAR_VECTOR, void *)
static int opt_eofill(PLCHAR_VECTOR, PLCHAR_VECTOR, void *)
static int GetOptarg(char **, int *, char ***, int *)
Definition: plargs.c:1225
static int opt_o(PLCHAR_VECTOR, PLCHAR_VECTOR, void *)
static int mode_nodelete
Definition: plargs.c:174
#define PL_NOTSET
Definition: plplot.h:472
static int opt_ncol1(PLCHAR_VECTOR, PLCHAR_VECTOR, void *)
struct DrvOptCmd DrvOptCmd
#define plsfnam
Definition: plplot.h:807
static int mode_skip
Definition: plargs.c:178
#define snprintf
Definition: plplotP.h:235
static int opt_cmap1(PLCHAR_VECTOR, PLCHAR_VECTOR, void *)
static int opt_server_name(PLCHAR_VECTOR, PLCHAR_VECTOR, void *)
#define PL_OPT_NODELETE
Definition: plplot.h:347
#define plsdidev
Definition: plplot.h:796
#define plspal0
Definition: plplot.h:821
PLCHAR_VECTOR hlp_msg
Definition: plplotP.h:753
static int opt_h(PLCHAR_VECTOR, PLCHAR_VECTOR, void *)
#define TRUE
Definition: plplotP.h:176
PLOptionInfo ploption_info_default
Definition: plargs.c:710
PLOptionTable * options
Definition: plargs.c:705
static int opt_jx(PLCHAR_VECTOR, PLCHAR_VECTOR, void *)
PLINT c_plsetopt(PLCHAR_VECTOR opt, PLCHAR_VECTOR opt_arg)
Definition: plargs.c:740
static int opt_a(PLCHAR_VECTOR, PLCHAR_VECTOR, void *)
PLCHAR_VECTOR syntax
Definition: plplot.h:406
static int opt_px(PLCHAR_VECTOR, PLCHAR_VECTOR, void *)
void plP_FreeDrvOpts()
Definition: plargs.c:1545
PLCHAR_VECTOR name
Definition: plargs.c:706
static PLCHAR_VECTOR program
Definition: plargs.c:169
static char opttmp[OPTMAX]
Definition: plargs.c:183
void plHelpDrvOpts(DrvOpt *acc_opt)
Definition: plargs.c:1525
#define PL_OPT_INVISIBLE
Definition: plplot.h:348
#define PL_OPT_BOOL
Definition: plplot.h:354
#define PLSTATE_EOFILL
Definition: plplotP.h:370
#define plwidth
Definition: plplot.h:852
#define plspause
Definition: plplot.h:823
static int tables
Definition: plargs.c:737
static PLCHAR_VECTOR plplot_notes[]
Definition: plargs.c:681
PLCHAR_VECTOR desc
Definition: plplot.h:407
static int opt_mfi(PLCHAR_VECTOR, PLCHAR_VECTOR, void *)
PLPointer var
Definition: plplot.h:404
char * option
Definition: plargs.c:729
static int opt_bufmax(PLCHAR_VECTOR, PLCHAR_VECTOR, void *)
static int opt_plwindow(PLCHAR_VECTOR, PLCHAR_VECTOR, void *)
void plOptUsage(void)
Definition: plargs.c:1289
#define PL_OPT_INT
Definition: plplot.h:355
static PLFLT value(double n1, double n2, double hue)
Definition: plctrl.c:1223
static PLOptionTable options[]
Definition: tclMain.c:108
#define PL_OPT_STRING
Definition: plplot.h:357
char PLDLLIMPEXP * plstrdup(PLCHAR_VECTOR src)
Definition: plctrl.c:2989
static int mode_quiet
Definition: plargs.c:173
#define PL_OPT_ARG
Definition: plplot.h:346
void plP_state(PLINT op)
Definition: plcore.c:246
static int opt_cmap0(PLCHAR_VECTOR, PLCHAR_VECTOR, void *)
#define PL_UNUSED(x)
Definition: plplot.h:128
float PLFLT
Definition: plplot.h:158
#define PL_PARSE_FULL
Definition: plplot.h:363
static int opt_mar(PLCHAR_VECTOR, PLCHAR_VECTOR, void *)
PLINT type
Definition: plplotP.h:751
#define free_mem(a)
Definition: plplotP.h:182
#define PL_PARSE_SKIP
Definition: plplot.h:371
#define PLPLOT_VERSION
Definition: plConfig.h:54
static int mode_noprogram
Definition: plargs.c:176
static int ProcessOpt(char *, PLOptionTable *, int *, char ***, int *)
Definition: plargs.c:1096
static int opt_ori(PLCHAR_VECTOR, PLCHAR_VECTOR, void *)
void plwarn(PLCHAR_VECTOR errormsg)
Definition: plctrl.c:1867
PLPointer client_data
Definition: plplot.h:403
static DrvOptCmd drv_opt
Definition: plargs.c:735
static int opt_finc(PLCHAR_VECTOR, PLCHAR_VECTOR, void *)
void pllib_init()
Definition: plcore.c:2236
static int opt_drvopt(PLCHAR_VECTOR, PLCHAR_VECTOR, void *)
void plClearOpts(void)
Definition: plargs.c:821
static int opt_np(PLCHAR_VECTOR, PLCHAR_VECTOR, void *)
#define PL_PARSE_SHOWALL
Definition: plplot.h:367
static int opt_bg(PLCHAR_VECTOR, PLCHAR_VECTOR, void *)
PLOptionInfo ploption_info[PL_MAX_OPT_TABLES]
Definition: plargs.c:717
static int opt_freeaspect(PLCHAR_VECTOR, PLCHAR_VECTOR, void *)
static int opt_hack(PLCHAR_VECTOR, PLCHAR_VECTOR, void *)
#define OPTMAX
Definition: plargs.c:182
static int opt_fbeg(PLCHAR_VECTOR, PLCHAR_VECTOR, void *)
static int opt_plserver(PLCHAR_VECTOR, PLCHAR_VECTOR, void *)
static int opt_debug(PLCHAR_VECTOR, PLCHAR_VECTOR, void *)
long mode
Definition: plplot.h:405
const char ** notes
Definition: plargs.c:707
static int mode_nodash
Definition: plargs.c:177
static int opt_ncol0(PLCHAR_VECTOR, PLCHAR_VECTOR, void *)
static int opt_mfo(PLCHAR_VECTOR, PLCHAR_VECTOR, void *)
static PLOptionTable ploption_table[]
Definition: plargs.c:237
static int opt_tk_file(PLCHAR_VECTOR, PLCHAR_VECTOR, void *)
static int opt_fam(PLCHAR_VECTOR, PLCHAR_VECTOR, void *)
struct DrvOptCmd * next
Definition: plargs.c:731