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