1
0
mirror of synced 2026-02-27 01:10:26 +00:00

*** empty log message ***

This commit is contained in:
Eric Smith
2001-12-29 18:59:47 +00:00
parent 1dbfe36f72
commit 5b48b537a2
5 changed files with 43 additions and 18 deletions

View File

@@ -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.4 2001/12/29 09:44:27 eric Exp $
# $Id: Makefile,v 1.5 2001/12/29 10:59:17 eric Exp $
# Copyright 2001 Eric Smith <eric@brouhaha.com>
#
# This program is free software; you can redistribute it and/or modify
@@ -24,12 +24,14 @@ 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
MISC = Makefile scanner.l parser.y
tiff2pdf: tiff2pdf.o scanner.o parser.tab.o
bitblt_test: bitblt_test.o bitblt.o
pandamain: pandamain.o
%.tab.c %.tab.h: %.y
$(YACC) $(YFLAGS) $<

View File

@@ -73,8 +73,8 @@ image_ranges:
| image_ranges ',' range ;
file_clause:
FILE_KEYWORD STRING ';' ;
input_file_clause:
FILE_KEYWORD STRING ';' { open_tiff_input_file ($2) } ;
image_clause:
IMAGE INTEGER ';'
@@ -135,7 +135,7 @@ part_clauses:
| part_clauses part_clause;
input_clause:
file_clause
input_file_clause
| image_clause
| images_clause
| modifier_clause
@@ -151,6 +151,9 @@ input_clause_list:
input_statement:
INPUT input_clauses ;
output_file_clause:
FILE_KEYWORD STRING ';' { open_pdf_output_file ($2) } ;
page_ranges:
range
| page_ranges ',' range ;
@@ -168,7 +171,9 @@ bookmark_clause:
| BOOKMARK STRING ';' ;
output_clause:
page_clause | pages_clause | bookmark_clause
output_file_clause
| page_clause | pages_clause
| bookmark_clause
| output_clause_list ;
output_clauses:

View File

@@ -1,8 +1,13 @@
/*
$Id: scanner.l,v 1.6 2001/12/29 10:59:33 eric Exp $
*/
%option case-insensitive
%{
#include "parser.tab.h"
}%
%}
digit [0-9]
alpha [a-zA-Z]
@@ -12,7 +17,7 @@ alpha [a-zA-Z]
\.\. { return (ELIPSIS); }
{digit}+ { yylval.integer = atoi (yytext); return (INTEGER); }
{digit}+.{digit}* { yylval.float = atof (yytext); return (FLOAT); }
{digit}+.{digit}* { yylval.fp = atof (yytext); return (FLOAT); }
a { yylval.size.width = 8.5 * 25.4;
yylval.size.height = 11.0 * 25.4;
@@ -50,7 +55,7 @@ resolution { return (RESOLUTION) ; }
rotate { return (ROTATE); }
size { return (SIZE); }
\".*\" { yylval.string = newstr (yytext); return (STRING); }
\".*\" { yylval.string = strdup (yytext); return (STRING); }
[ \t\n]+ /* whitespace */
@@ -58,3 +63,4 @@ size { return (SIZE); }
. { printf( "Unrecognized character: %s\n", yytext ); }
%%

14
t2p.c
View File

@@ -1,7 +1,7 @@
/*
* tiffg4: reencode a bilevel TIFF file as a single-strip TIFF Class F Group 4
* Main program
* $Id: t2p.c,v 1.1 2001/12/29 09:44:24 eric Exp $
* $Id: t2p.c,v 1.2 2001/12/29 10:59:47 eric Exp $
* Copyright 2001 Eric Smith <eric@brouhaha.com>
*
* This program is free software; you can redistribute it and/or modify
@@ -32,6 +32,7 @@
#include "tiff2pdf.h"
FILE *yyin;
TIFF *in;
panda_pdf *out;
@@ -206,10 +207,14 @@ boolean process_page (int image) /* range 1 .. n */
}
void yyerror (char *s)
{
fprintf (stderr, "%s\n", s);
}
int main (int argc, char *argv[])
{
FILE *spec;
int result = 0;
panda_init ();
@@ -221,8 +226,8 @@ int main (int argc, char *argv[])
goto fail;
}
spec = fopen (argv [2], "r");
if (! spec)
yyin = fopen (argv [2], "r");
if (! yyin)
{
fprintf (stderr, "can't open spec file '%s'\n", argv [2]);
result = 3;
@@ -232,6 +237,7 @@ int main (int argc, char *argv[])
yyparse ();
fail:
fclose (yyin);
close_tiff_input_file ();
close_pdf_output_file ();
return (result);

View File

@@ -1,7 +1,7 @@
/*
* tiffg4: reencode a bilevel TIFF file as a single-strip TIFF Class F Group 4
* Main program
* $Id: tumble.c,v 1.1 2001/12/29 09:44:24 eric Exp $
* $Id: tumble.c,v 1.2 2001/12/29 10:59:47 eric Exp $
* Copyright 2001 Eric Smith <eric@brouhaha.com>
*
* This program is free software; you can redistribute it and/or modify
@@ -32,6 +32,7 @@
#include "tiff2pdf.h"
FILE *yyin;
TIFF *in;
panda_pdf *out;
@@ -206,10 +207,14 @@ boolean process_page (int image) /* range 1 .. n */
}
void yyerror (char *s)
{
fprintf (stderr, "%s\n", s);
}
int main (int argc, char *argv[])
{
FILE *spec;
int result = 0;
panda_init ();
@@ -221,8 +226,8 @@ int main (int argc, char *argv[])
goto fail;
}
spec = fopen (argv [2], "r");
if (! spec)
yyin = fopen (argv [2], "r");
if (! yyin)
{
fprintf (stderr, "can't open spec file '%s'\n", argv [2]);
result = 3;
@@ -232,6 +237,7 @@ int main (int argc, char *argv[])
yyparse ();
fail:
fclose (yyin);
close_tiff_input_file ();
close_pdf_output_file ();
return (result);