From 1dbfe36f7212b98de28d3ab518127024a4063fdd Mon Sep 17 00:00:00 2001 From: Eric Smith Date: Sat, 29 Dec 2001 17:45:43 +0000 Subject: [PATCH] *** empty log message *** --- Makefile | 15 +++++++------- bitblt.c | 1 + bitblt.h | 4 ---- bitblt_test.c | 1 + parser.y | 54 ++++++++++++++++++++++++++++----------------------- scanner.l | 5 ++--- 6 files changed, 41 insertions(+), 39 deletions(-) diff --git a/Makefile b/Makefile index 2d1719a..ddaa6e6 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ -# tiffg4: reencode a bilevel TIFF file as a single-strip TIFF Class F Group 4 +# tiff2pdf: build a PDF file out of one or more TIFF Class F Group 4 files # Makefile -# $Id: Makefile,v 1.3 2001/12/27 20:44:15 eric Exp $ +# $Id: Makefile,v 1.4 2001/12/29 09:44:27 eric Exp $ # Copyright 2001 Eric Smith # # This program is free software; you can redistribute it and/or modify @@ -19,17 +19,15 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA -CFLAGS = -g -I/usr/local/include/panda +CFLAGS = -Wall -g -I/usr/local/include/panda LDLIBS = -g -ltiff -lm -L/usr/local/lib/panda -lpanda -lpng YACC = bison YFLAGS = -d -v -bitblt_test: bitblt_test.o bitblt.o - -bitblt.o: bitblt.c - tiff2pdf: tiff2pdf.o scanner.o parser.tab.o +bitblt_test: bitblt_test.o bitblt.o + pandamain: pandamain.o @@ -37,4 +35,5 @@ pandamain: pandamain.o $(YACC) $(YFLAGS) $< # %.c: %.l -# $(LEX) $(LFLAGS) $< \ No newline at end of file +# $(LEX) $(LFLAGS) $< + diff --git a/bitblt.c b/bitblt.c index fe0de8b..f35f957 100644 --- a/bitblt.c +++ b/bitblt.c @@ -1,5 +1,6 @@ #include +#include "type.h" #include "bitblt.h" static inline u8 pixel_mask (x) diff --git a/bitblt.h b/bitblt.h index dd87064..d78c8b5 100644 --- a/bitblt.h +++ b/bitblt.h @@ -1,7 +1,3 @@ -typedef unsigned char u8; -typedef unsigned int u32; -typedef int boolean; - typedef struct Point { u32 x; diff --git a/bitblt_test.c b/bitblt_test.c index a2f4213..90f0a92 100644 --- a/bitblt_test.c +++ b/bitblt_test.c @@ -1,5 +1,6 @@ #include +#include "type.h" #include "bitblt.h" diff --git a/parser.y b/parser.y index 1a3dbde..6ae119a 100644 --- a/parser.y +++ b/parser.y @@ -1,12 +1,15 @@ %{ -#include + #include + #include "type.h" + #include "tiff2pdf.h" %} %union { int integer; double fp; char *string; - struct { double width, double height } size; + struct { double width; double height; } size; + struct { int first; int last; } range; } %token INTEGER @@ -26,12 +29,13 @@ %token PORTRAIT %token LANDSCAPE -%token FILE +%token FILE_KEYWORD %token IMAGE %token IMAGES %token ROTATE %token CROP %token SIZE +%token RESOLUTION %token INPUT %token PAGE @@ -39,10 +43,13 @@ %token BOOKMARK %token OUTPUT -%type image_range -%type image_ranges -%type page_range -%type page_ranges +%type range +%type image_ranges +%type page_ranges + +%type unit + + %type length @@ -57,17 +64,17 @@ statement: | output_statement ; -image_range: - INTEGER ELIPSIS INTEGER - | INTEGER ; +range: + INTEGER ELIPSIS INTEGER { $$.first = $1; $$.last = $3; } + | INTEGER { $$.first = $1; $$.last = $1; } ; image_ranges: - image_range - | image_ranges ',' image_range ; + range + | image_ranges ',' range ; file_clause: - FILE STRING ';' ; + FILE_KEYWORD STRING ';' ; image_clause: IMAGE INTEGER ';' @@ -82,12 +89,12 @@ rotate_clause: ROTATE INTEGER ';' ; unit: - CM - | INCH ; + /* empty */ /* default to INCH */ { $$ = 25.4; } + | CM { $$ = 1.0; } + | INCH { $$ = 25.4; } ; length: - FLOAT - | FLOAT unit ; + FLOAT unit { $$ = $1 * $2; } ; crop_clause: CROP PAGE_SIZE ';' @@ -104,8 +111,11 @@ size_clause: | SIZE PAGE_SIZE orientation ';' | SIZE length ',' length ';' ; +resolution_clause: + RESOLUTION FLOAT unit ; + modifier_clause: - rotate_clause | crop_clause | size_clause; + rotate_clause | crop_clause | size_clause | resolution_clause; modifier_clauses: modifier_clause @@ -141,13 +151,9 @@ input_clause_list: input_statement: INPUT input_clauses ; -page_range: - INTEGER ELIPSIS INTEGER - | INTEGER ; - page_ranges: - page_range - | page_ranges ',' page_range ; + range + | page_ranges ',' range ; page_clause: PAGE INTEGER ';' diff --git a/scanner.l b/scanner.l index 431dc23..565b389 100644 --- a/scanner.l +++ b/scanner.l @@ -1,10 +1,8 @@ %option case-insensitive -/* %{ #include "parser.tab.h" }% -*/ digit [0-9] alpha [a-zA-Z] @@ -37,7 +35,7 @@ bookmark { return (BOOKMARK); } cm { return (CM); } crop { return (CROP); } even { return (EVEN); } -file { return (FILE); } +file { return (FILE_KEYWORD); } image { return (IMAGE); } images { return (IMAGES); } inch { return (INCH); } @@ -48,6 +46,7 @@ output { return (OUTPUT); } page { return (PAGE); } pages { return (PAGES); } portrait { return (PORTRAIT) ; } +resolution { return (RESOLUTION) ; } rotate { return (ROTATE); } size { return (SIZE); }