Skip to content

Commit

Permalink
*** empty log message ***
Browse files Browse the repository at this point in the history
  • Loading branch information
brouhaha committed Dec 31, 2001
1 parent 54a3bf9 commit c78e1d4
Show file tree
Hide file tree
Showing 5 changed files with 389 additions and 57 deletions.
14 changes: 10 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# tiff2pdf: build a PDF file out of one or more TIFF Class F Group 4 files
# Makefile
# $Id: Makefile,v 1.6 2001/12/29 20:16:46 eric Exp $
# $Id: Makefile,v 1.7 2001/12/30 23:24:50 eric Exp $
# Copyright 2001 Eric Smith <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
Expand All @@ -24,8 +24,8 @@ LDLIBS = -g -ltiff -lm -L/usr/local/lib/panda -lpanda -lpng
YACC = bison
YFLAGS = -d -v

SRCS = bitblt.c bitblt_test.c tiff2pdf.c
HDRS = type.h bitblt.h tiff2pdf.h
SRCS = bitblt.c bitblt_test.c tiff2pdf.c semantics.c
HDRS = type.h bitblt.h tiff2pdf.h semantics.h
MISC = Makefile scanner.l parser.y

TARGETS = tiff2pdf bitblt_test
Expand All @@ -34,14 +34,20 @@ AUTO_SRCS = scanner.c parser.tab.c
AUTO_HDRS = parser.tab.h
AUTO_MISC = parser.output

tiff2pdf: tiff2pdf.o scanner.o parser.tab.o
tiff2pdf: tiff2pdf.o scanner.o semantics.o parser.tab.o

bitblt_test: bitblt_test.o bitblt.o


clean:
rm -f *.o *.d $(TARGETS) $(AUTO_SRCS) $(AUTO_HDRS) $(AUTO_MISC)

wc:
wc -l $(SRCS) $(HDRS) $(MISC)

ls-lt:
ls -lt $(SRCS) $(HDRS) $(MISC)


%.tab.c %.tab.h %.output: %.y
$(YACC) $(YFLAGS) $<
Expand Down
40 changes: 26 additions & 14 deletions parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
%token RESOLUTION
%token INPUT

%token FORMAT
%token PAGE
%token PAGES
%token BOOKMARK
Expand Down Expand Up @@ -69,21 +70,21 @@ range:
| INTEGER { $$.first = $1; $$.last = $1; } ;

image_ranges:
range { input_images ($1.first, $1.last); }
| image_ranges ',' range { input_images ($3.first, $3.last); } ;
range { input_images ($1); }
| image_ranges ',' range { input_images ($3); } ;


input_file_clause:
FILE_KEYWORD STRING ';' { input_set_file ($2) } ;

image_clause:
IMAGE INTEGER ';' { input_images ($2, $2); } ;
IMAGE INTEGER ';' { range_t range = { $2, $2 }; input_images (range); } ;

images_clause:
IMAGES image_ranges ';' ;

rotate_clause:
ROTATE INTEGER ';' { input_set_rotation ($2) };
ROTATE INTEGER ';' { input_set_rotation ($2) } ;

unit:
/* empty */ /* default to INCH */ { $$ = 25.4; }
Expand Down Expand Up @@ -125,7 +126,7 @@ part_clause:
ODD { input_set_modifier_context (INPUT_MODIFIER_ODD); }
modifier_clause_list ';'
{ input_set_modifier_context (INPUT_MODIFIER_ALL); }
| EVEN { input_set_modifier_context (INPUT_MODIFIER_ODD); }
| EVEN { input_set_modifier_context (INPUT_MODIFIER_EVEN); }
modifier_clause_list ';'
{ input_set_modifier_context (INPUT_MODIFIER_ALL); } ;

Expand All @@ -150,24 +151,34 @@ input_statement:
output_file_clause:
FILE_KEYWORD STRING ';' { output_set_file ($2) } ;

format_clause:
FORMAT STRING ';' { output_set_page_number_format ($2) } ;

page_ranges:
range { output_pages ($1.first, $1.last); }
| page_ranges ',' range { output_pages ($3.first, $3.last); } ;
range { output_pages ($1); }
| page_ranges ',' range { output_pages ($3); } ;

page_clause:
PAGE INTEGER ';' { output_pages ($2, $2); }
| PAGE STRING ',' INTEGER ';' { output_pages ($4, $4); } ;
PAGE INTEGER ';' { range_t range = { $2, $2 }; output_pages (range); } ;

pages_clause:
PAGES page_ranges ';'
| PAGES STRING ',' page_ranges ';' ;
PAGES page_ranges ';' ;

bookmark_name:
STRING { output_set_bookmark ($1); } ;

bookmark_name_list:
bookmark_name
| bookmark_name_list ',' bookmark_name ;

bookmark_clause:
BOOKMARK INTEGER ',' STRING ';'
| BOOKMARK STRING ';' ;
BOOKMARK { output_push_context (); }
bookmark_name_list
output_clause_list ';' { output_pop_context (); } ;

output_clause:
output_file_clause
| format_clause
| page_clause | pages_clause
| bookmark_clause
| output_clause_list ;
Expand All @@ -177,7 +188,8 @@ output_clauses:
| output_clauses output_clause ;

output_clause_list:
'{' output_clauses '}' ;
'{' { output_push_context (); }
output_clauses '}' { output_pop_context (); } ;

output_statement:
OUTPUT output_clauses ;
5 changes: 3 additions & 2 deletions scanner.l
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
$Id: scanner.l,v 1.10 2001/12/30 09:09:08 eric Exp $
$Id: scanner.l,v 1.11 2001/12/30 23:25:08 eric Exp $
*/

%option case-insensitive
Expand Down Expand Up @@ -54,6 +54,7 @@ cm { return (CM); }
crop { return (CROP); }
even { return (EVEN); }
file { return (FILE_KEYWORD); }
format { return (FORMAT); }
image { return (IMAGE); }
images { return (IMAGES); }
inch { return (INCH); }
Expand All @@ -68,7 +69,7 @@ resolution { return (RESOLUTION) ; }
rotate { return (ROTATE); }
size { return (SIZE); }

\".*\" {
\"[^\n"]*\" {
int len = strlen (yytext) - 2;
yylval.string = malloc (len + 1);
memcpy (yylval.string, yytext + 1, len);
Expand Down
Loading

0 comments on commit c78e1d4

Please sign in to comment.