*** empty log message ***
This commit is contained in:
23
Makefile
23
Makefile
@@ -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.5 2001/12/29 10:59:17 eric Exp $
|
||||
# $Id: Makefile,v 1.6 2001/12/29 20:16:46 eric Exp $
|
||||
# Copyright 2001 Eric Smith <eric@brouhaha.com>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
@@ -28,14 +28,33 @@ SRCS = bitblt.c bitblt_test.c tiff2pdf.c
|
||||
HDRS = type.h bitblt.h tiff2pdf.h
|
||||
MISC = Makefile scanner.l parser.y
|
||||
|
||||
TARGETS = tiff2pdf bitblt_test
|
||||
|
||||
AUTO_SRCS = scanner.c parser.tab.c
|
||||
AUTO_HDRS = parser.tab.h
|
||||
AUTO_MISC = parser.output
|
||||
|
||||
tiff2pdf: tiff2pdf.o scanner.o parser.tab.o
|
||||
|
||||
bitblt_test: bitblt_test.o bitblt.o
|
||||
|
||||
|
||||
%.tab.c %.tab.h: %.y
|
||||
clean:
|
||||
rm -f *.o *.d $(TARGETS) $(AUTO_SRCS) $(AUTO_HDRS) $(AUTO_MISC)
|
||||
|
||||
|
||||
%.tab.c %.tab.h %.output: %.y
|
||||
$(YACC) $(YFLAGS) $<
|
||||
|
||||
# %.c: %.l
|
||||
# $(LEX) $(LFLAGS) $<
|
||||
|
||||
|
||||
ALL_SRCS = $(SRCS) $(AUTO_SRCS)
|
||||
|
||||
DEPENDS = $(ALL_SRCS:.c=.d)
|
||||
|
||||
%.d: %.c
|
||||
$(CC) -M -MG $(CFLAGS) $< | sed -e 's@ /[^ ]*@@g' -e 's@^\(.*\)\.o:@\1.d \1.o:@' > $@
|
||||
|
||||
include $(DEPENDS)
|
||||
|
||||
16
parser.y
16
parser.y
@@ -69,16 +69,16 @@ range:
|
||||
| INTEGER { $$.first = $1; $$.last = $1; } ;
|
||||
|
||||
image_ranges:
|
||||
range
|
||||
| image_ranges ',' range ;
|
||||
range { input_images ($1.first, $1.last); }
|
||||
| image_ranges ',' range { input_images ($3.first, $3.last); } ;
|
||||
|
||||
|
||||
input_file_clause:
|
||||
FILE_KEYWORD STRING ';' { open_tiff_input_file ($2) } ;
|
||||
|
||||
image_clause:
|
||||
IMAGE INTEGER ';'
|
||||
| IMAGE INTEGER modifier_clause_list ';' ;
|
||||
IMAGE INTEGER ';' { input_images ($2, $2); }
|
||||
| IMAGE INTEGER modifier_clause_list ';' { input_images ($2, $2); } ;
|
||||
|
||||
images_clause:
|
||||
IMAGES image_ranges ';'
|
||||
@@ -155,12 +155,12 @@ output_file_clause:
|
||||
FILE_KEYWORD STRING ';' { open_pdf_output_file ($2) } ;
|
||||
|
||||
page_ranges:
|
||||
range
|
||||
| page_ranges ',' range ;
|
||||
range { output_pages ($1.first, $1.last); }
|
||||
| page_ranges ',' range { output_pages ($3.first, $3.last); } ;
|
||||
|
||||
page_clause:
|
||||
PAGE INTEGER ';'
|
||||
| PAGE STRING ',' INTEGER ';' ;
|
||||
PAGE INTEGER ';' { output_pages ($2, $2); }
|
||||
| PAGE STRING ',' INTEGER ';' { output_pages ($4, $4); } ;
|
||||
|
||||
pages_clause:
|
||||
PAGES page_ranges ';'
|
||||
|
||||
34
scanner.l
34
scanner.l
@@ -1,25 +1,36 @@
|
||||
/*
|
||||
$Id: scanner.l,v 1.7 2001/12/29 17:54:43 eric Exp $
|
||||
$Id: scanner.l,v 1.8 2001/12/29 20:16:46 eric Exp $
|
||||
*/
|
||||
|
||||
%option case-insensitive
|
||||
%option noyywrap
|
||||
|
||||
%{
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "parser.tab.h"
|
||||
#include "type.h"
|
||||
#include "tiff2pdf.h"
|
||||
|
||||
#ifdef SCANNER_DEBUG
|
||||
#define LDBG(x) printf x
|
||||
#else
|
||||
#define LDBG(x)
|
||||
#endif
|
||||
%}
|
||||
|
||||
|
||||
digit [0-9]
|
||||
alpha [a-zA-Z]
|
||||
dot [\.]
|
||||
|
||||
%%
|
||||
|
||||
\.\. { return (ELIPSIS); }
|
||||
[\,;{}] { return (yytext [0]); }
|
||||
{dot}{dot} { LDBG(("elipsis\n")); return (ELIPSIS); }
|
||||
|
||||
{digit}+ { yylval.integer = atoi (yytext); return (INTEGER); }
|
||||
{digit}+.{digit}* { yylval.fp = atof (yytext); return (FLOAT); }
|
||||
{digit}+ { yylval.integer = atoi (yytext); LDBG(("integer %d\n", yylval.integer)); return (INTEGER); }
|
||||
{digit}+\.{digit}+ { yylval.fp = atof (yytext); return (FLOAT); }
|
||||
|
||||
a { yylval.size.width = 8.5 * 25.4;
|
||||
yylval.size.height = 11.0 * 25.4;
|
||||
@@ -57,12 +68,21 @@ resolution { return (RESOLUTION) ; }
|
||||
rotate { return (ROTATE); }
|
||||
size { return (SIZE); }
|
||||
|
||||
\".*\" { yylval.string = strdup (yytext); return (STRING); }
|
||||
\".*\" {
|
||||
int len = strlen (yytext) - 2;
|
||||
yylval.string = malloc (len + 1);
|
||||
memcpy (yylval.string, yytext + 1, len);
|
||||
yylval.string [len] = '\0';
|
||||
LDBG (("string \"%s\"\n", yylval.string));
|
||||
return (STRING);
|
||||
}
|
||||
|
||||
[ \t\n]+ /* whitespace */
|
||||
[ \t]+ /* whitespace */
|
||||
\n { line++; }
|
||||
|
||||
--.* /* Ada/VHDL style one-line comment */
|
||||
#.* /* shell-style one-line comment */
|
||||
|
||||
. { printf( "Unrecognized character: %s\n", yytext ); }
|
||||
. { fprintf (stderr, "Unrecognized character: %s\n", yytext); }
|
||||
|
||||
%%
|
||||
|
||||
12
t2p.h
12
t2p.h
@@ -1,3 +1,5 @@
|
||||
extern int line;
|
||||
|
||||
boolean open_tiff_input_file (char *name);
|
||||
boolean close_tiff_input_file (void);
|
||||
|
||||
@@ -5,3 +7,13 @@ boolean open_pdf_output_file (char *name);
|
||||
boolean close_pdf_output_file (void);
|
||||
|
||||
boolean process_page (int image); /* range 1 .. n */
|
||||
|
||||
void input_images (int first, int last);
|
||||
void output_pages (int first, int last);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
12
tumble.h
12
tumble.h
@@ -1,3 +1,5 @@
|
||||
extern int line;
|
||||
|
||||
boolean open_tiff_input_file (char *name);
|
||||
boolean close_tiff_input_file (void);
|
||||
|
||||
@@ -5,3 +7,13 @@ boolean open_pdf_output_file (char *name);
|
||||
boolean close_pdf_output_file (void);
|
||||
|
||||
boolean process_page (int image); /* range 1 .. n */
|
||||
|
||||
void input_images (int first, int last);
|
||||
void output_pages (int first, int last);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user