added CTL_LANG conditional.

Tue, 09 Dec 2003 17:40:54 +0000

author
eric
date
Tue, 09 Dec 2003 17:40:54 +0000
changeset 160
1f793b71ffff
parent 159
2af017feadca
child 161
9d43e0dd82a3

added CTL_LANG conditional.

Makefile file | annotate | diff | revisions
semantics.c file | annotate | diff | revisions
tumble.c file | annotate | diff | revisions
     1.1 diff -r 2af017feadca -r 1f793b71ffff Makefile
     1.2 --- a/Makefile	Mon Aug 18 09:59:41 2003 +0000
     1.3 +++ b/Makefile	Tue Dec 09 17:40:54 2003 +0000
     1.4 @@ -26,6 +26,7 @@
     1.5  #DEBUG=1
     1.6  #EFENCE=1
     1.7  #STATIC=1
     1.8 +CTL_LANG=1
     1.9  
    1.10  
    1.11  CFLAGS = -Wall
    1.12 @@ -80,12 +81,23 @@
    1.13  BIN_DISTFILES = COPYING README $(TARGETS)
    1.14  
    1.15  
    1.16 -AUTO_CSRCS = scanner.c parser.tab.c bitblt_tables.c g4_tables.c
    1.17 -AUTO_HDRS = parser.tab.h  bitblt_tables.h g4_tables.h
    1.18 +AUTO_CSRCS = bitblt_tables.c g4_tables.c
    1.19 +AUTO_HDRS = bitblt_tables.h g4_tables.h
    1.20 +
    1.21 +ifdef CTL_LANG
    1.22 +AUTO_CSRCS += scanner.c parser.tab.c
    1.23 +AUTO_HDRS += parser_tab.h
    1.24  AUTO_MISC = parser.output
    1.25 +endif
    1.26  
    1.27  
    1.28 -CFLAGS := $(CFLAGS) -DTUMBLE_VERSION=$(VERSION)
    1.29 +CDEFINES = -DTUMBLE_VERSION=$(VERSION)
    1.30 +
    1.31 +ifdef CTL_LANG
    1.32 +CDEFINES += -DCTL_LANG
    1.33 +endif
    1.34 +
    1.35 +CFLAGS := $(CFLAGS) $(CDEFINES)
    1.36  
    1.37  
    1.38  -include Maketest
    1.39 @@ -94,13 +106,18 @@
    1.40  all: $(TARGETS) $(TEST_TARGETS)
    1.41  
    1.42  
    1.43 -tumble: tumble.o semantics.o \
    1.44 +TUMBLE_OBJS = tumble.o semantics.o \
    1.45  		tumble_input.o tumble_tiff.o tumble_jpeg.o tumble_pbm.o \
    1.46 -		scanner.o parser.tab.o \
    1.47  		bitblt.o bitblt_g4.o bitblt_tables.o g4_tables.o \
    1.48  		pdf.o pdf_util.o pdf_prim.o pdf_name_tree.o \
    1.49  		pdf_bookmark.o pdf_page_label.o \
    1.50  		pdf_text.o pdf_g4.o pdf_jpeg.o
    1.51 +
    1.52 +ifdef CTL_LANG
    1.53 +TUMBLE_OBJS += scanner.o parser.tab.o
    1.54 +endif
    1.55 +
    1.56 +tumble: $(TUMBLE_OBJS)
    1.57  	$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
    1.58  ifndef DEBUG
    1.59  	strip $@
     2.1 diff -r 2af017feadca -r 1f793b71ffff semantics.c
     2.2 --- a/semantics.c	Mon Aug 18 09:59:41 2003 +0000
     2.3 +++ b/semantics.c	Tue Dec 09 17:40:54 2003 +0000
     2.4 @@ -29,7 +29,11 @@
     2.5  #include <stdio.h>
     2.6  
     2.7  #include "semantics.h"
     2.8 +
     2.9 +#ifdef CTL_LANG
    2.10  #include "parser.tab.h"
    2.11 +#endif
    2.12 +
    2.13  #include "tumble.h"
    2.14  
    2.15  
    2.16 @@ -596,6 +600,7 @@
    2.17  }
    2.18  
    2.19  
    2.20 +#ifdef CTL_LANG
    2.21  bool parse_control_file (char *fn)
    2.22  {
    2.23    bool result = 0;
    2.24 @@ -736,3 +741,4 @@
    2.25        page_index++;
    2.26      }
    2.27  }
    2.28 +#endif /* CTL_LANG */
     3.1 diff -r 2af017feadca -r 1f793b71ffff tumble.c
     3.2 --- a/tumble.c	Mon Aug 18 09:59:41 2003 +0000
     3.3 +++ b/tumble.c	Tue Dec 09 17:40:54 2003 +0000
     3.4 @@ -32,7 +32,11 @@
     3.5  
     3.6  
     3.7  #include "semantics.h"
     3.8 +
     3.9 +#ifdef CTL_LANG
    3.10  #include "parser.tab.h"
    3.11 +#endif
    3.12 +
    3.13  #include "tumble.h"
    3.14  #include "bitblt.h"
    3.15  #include "pdf.h"
    3.16 @@ -73,7 +77,9 @@
    3.17    fprintf (stderr, "http://tumble.brouhaha.com/\n");
    3.18    fprintf (stderr, "\n");
    3.19    fprintf (stderr, "usage:\n");
    3.20 +#ifdef CTL_LANG
    3.21    fprintf (stderr, "    %s [options] -c <control.tum>\n", progname);
    3.22 +#endif
    3.23    fprintf (stderr, "    %s [options] <input.tif>... -o <output.pdf>\n", progname);
    3.24    fprintf (stderr, "options:\n");
    3.25    fprintf (stderr, "    -v        verbose\n");
    3.26 @@ -347,6 +353,7 @@
    3.27  }
    3.28  
    3.29  
    3.30 +#ifdef CTL_LANG
    3.31  void main_control (char *control_fn)
    3.32  {
    3.33    if (! parse_control_file (control_fn))
    3.34 @@ -354,11 +361,14 @@
    3.35    if (! process_controls ())
    3.36      fatal (3, "error processing control file\n");
    3.37  }
    3.38 +#endif
    3.39  
    3.40  
    3.41  int main (int argc, char *argv[])
    3.42  {
    3.43 +#ifdef CTL_LANG
    3.44    char *control_fn = NULL;
    3.45 +#endif
    3.46    char *out_fn = NULL;
    3.47    char *bookmark_fmt = NULL;
    3.48    int inf_count = 0;
    3.49 @@ -389,6 +399,7 @@
    3.50  	      else
    3.51  		fatal (1, "missing filename after \"-o\" option\n");
    3.52  	    }
    3.53 +#ifdef CTL_LANG
    3.54  	  else if (strcmp (argv [1], "-c") == 0)
    3.55  	    {
    3.56  	      if (argc)
    3.57 @@ -400,6 +411,7 @@
    3.58  	      else
    3.59  		fatal (1, "missing filename after \"-s\" option\n");
    3.60  	    }
    3.61 +#endif
    3.62  	  else if (strcmp (argv [1], "-b") == 0)
    3.63  	    {
    3.64  	      if (argc)
    3.65 @@ -421,19 +433,27 @@
    3.66        argv++;
    3.67      }
    3.68  
    3.69 +#ifdef CTL_LANG
    3.70    if (! ((! out_fn) ^ (! control_fn)))
    3.71      fatal (1, "either a control file or an output file (but not both) must be specified\n");
    3.72 +  if (control_fn && inf_count)
    3.73 +    fatal (1, "if control file is provided, input files can't be specified as arguments\n");
    3.74 +#else
    3.75 +  if (! out_fn)
    3.76 +    fatal (1, "an output file must be specified\n");
    3.77 +#endif
    3.78  
    3.79    if (out_fn && ! inf_count)
    3.80      fatal (1, "no input files specified\n");
    3.81  
    3.82 -  if (control_fn && inf_count)
    3.83 -    fatal (1, "if control file is provided, input files can't be specified as arguments\n");
    3.84 -
    3.85 +#ifdef CTL_LANG
    3.86    if (control_fn)
    3.87      main_control (control_fn);
    3.88    else
    3.89      main_args (out_fn, inf_count, in_fn, bookmark_fmt);
    3.90 +#else
    3.91 +  main_args (out_fn, inf_count, in_fn, bookmark_fmt);
    3.92 +#endif
    3.93    
    3.94    close_input_file ();
    3.95    close_pdf_output_files ();