tumble.c

changeset 160
1f793b71ffff
parent 158
e5452e27f518
child 166
301f6f17c364
     1.1 --- a/tumble.c	Mon Aug 18 09:59:41 2003 +0000
     1.2 +++ b/tumble.c	Tue Dec 09 17:40:54 2003 +0000
     1.3 @@ -32,7 +32,11 @@
     1.4  
     1.5  
     1.6  #include "semantics.h"
     1.7 +
     1.8 +#ifdef CTL_LANG
     1.9  #include "parser.tab.h"
    1.10 +#endif
    1.11 +
    1.12  #include "tumble.h"
    1.13  #include "bitblt.h"
    1.14  #include "pdf.h"
    1.15 @@ -73,7 +77,9 @@
    1.16    fprintf (stderr, "http://tumble.brouhaha.com/\n");
    1.17    fprintf (stderr, "\n");
    1.18    fprintf (stderr, "usage:\n");
    1.19 +#ifdef CTL_LANG
    1.20    fprintf (stderr, "    %s [options] -c <control.tum>\n", progname);
    1.21 +#endif
    1.22    fprintf (stderr, "    %s [options] <input.tif>... -o <output.pdf>\n", progname);
    1.23    fprintf (stderr, "options:\n");
    1.24    fprintf (stderr, "    -v        verbose\n");
    1.25 @@ -347,6 +353,7 @@
    1.26  }
    1.27  
    1.28  
    1.29 +#ifdef CTL_LANG
    1.30  void main_control (char *control_fn)
    1.31  {
    1.32    if (! parse_control_file (control_fn))
    1.33 @@ -354,11 +361,14 @@
    1.34    if (! process_controls ())
    1.35      fatal (3, "error processing control file\n");
    1.36  }
    1.37 +#endif
    1.38  
    1.39  
    1.40  int main (int argc, char *argv[])
    1.41  {
    1.42 +#ifdef CTL_LANG
    1.43    char *control_fn = NULL;
    1.44 +#endif
    1.45    char *out_fn = NULL;
    1.46    char *bookmark_fmt = NULL;
    1.47    int inf_count = 0;
    1.48 @@ -389,6 +399,7 @@
    1.49  	      else
    1.50  		fatal (1, "missing filename after \"-o\" option\n");
    1.51  	    }
    1.52 +#ifdef CTL_LANG
    1.53  	  else if (strcmp (argv [1], "-c") == 0)
    1.54  	    {
    1.55  	      if (argc)
    1.56 @@ -400,6 +411,7 @@
    1.57  	      else
    1.58  		fatal (1, "missing filename after \"-s\" option\n");
    1.59  	    }
    1.60 +#endif
    1.61  	  else if (strcmp (argv [1], "-b") == 0)
    1.62  	    {
    1.63  	      if (argc)
    1.64 @@ -421,19 +433,27 @@
    1.65        argv++;
    1.66      }
    1.67  
    1.68 +#ifdef CTL_LANG
    1.69    if (! ((! out_fn) ^ (! control_fn)))
    1.70      fatal (1, "either a control file or an output file (but not both) must be specified\n");
    1.71 +  if (control_fn && inf_count)
    1.72 +    fatal (1, "if control file is provided, input files can't be specified as arguments\n");
    1.73 +#else
    1.74 +  if (! out_fn)
    1.75 +    fatal (1, "an output file must be specified\n");
    1.76 +#endif
    1.77  
    1.78    if (out_fn && ! inf_count)
    1.79      fatal (1, "no input files specified\n");
    1.80  
    1.81 -  if (control_fn && inf_count)
    1.82 -    fatal (1, "if control file is provided, input files can't be specified as arguments\n");
    1.83 -
    1.84 +#ifdef CTL_LANG
    1.85    if (control_fn)
    1.86      main_control (control_fn);
    1.87    else
    1.88      main_args (out_fn, inf_count, in_fn, bookmark_fmt);
    1.89 +#else
    1.90 +  main_args (out_fn, inf_count, in_fn, bookmark_fmt);
    1.91 +#endif
    1.92    
    1.93    close_input_file ();
    1.94    close_pdf_output_files ();