tumble.c

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