From a73c7f0eae8c4888a6c1195b23e7d7a65f0de7d4 Mon Sep 17 00:00:00 2001 From: Eric Smith Date: Sun, 30 Dec 2001 04:16:46 +0000 Subject: [PATCH] .. --- t2p.c | 32 +++++++++++++++++++++++++++----- tumble.c | 32 +++++++++++++++++++++++++++----- 2 files changed, 54 insertions(+), 10 deletions(-) diff --git a/t2p.c b/t2p.c index a50b4b0..04c05a4 100644 --- a/t2p.c +++ b/t2p.c @@ -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.2 2001/12/29 10:59:47 eric Exp $ + * $Id: t2p.c,v 1.3 2001/12/29 20:16:46 eric Exp $ * Copyright 2001 Eric Smith * * This program is free software; you can redistribute it and/or modify @@ -32,6 +32,8 @@ #include "tiff2pdf.h" +int line; + FILE *yyin; TIFF *in; panda_pdf *out; @@ -207,9 +209,26 @@ boolean process_page (int image) /* range 1 .. n */ } +void input_images (int first, int last) +{ + if (first == last) + printf ("image %d\n", first); + else + printf ("iamges %d..%d\n", first, last); +} + +void output_pages (int first, int last) +{ + if (first == last) + printf ("page %d\n", first); + else + printf ("pages %d..%d\n", first, last); +} + + void yyerror (char *s) { - fprintf (stderr, "%s\n", s); + fprintf (stderr, "%d: %s\n", line, s); } @@ -226,18 +245,21 @@ int main (int argc, char *argv[]) goto fail; } - yyin = fopen (argv [2], "r"); + yyin = fopen (argv [1], "r"); if (! yyin) { - fprintf (stderr, "can't open spec file '%s'\n", argv [2]); + fprintf (stderr, "can't open spec file '%s'\n", argv [1]); result = 3; goto fail; } + line = 1; + yyparse (); fail: - fclose (yyin); + if (yyin) + fclose (yyin); close_tiff_input_file (); close_pdf_output_file (); return (result); diff --git a/tumble.c b/tumble.c index 2431c9d..a17a833 100644 --- a/tumble.c +++ b/tumble.c @@ -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.2 2001/12/29 10:59:47 eric Exp $ + * $Id: tumble.c,v 1.3 2001/12/29 20:16:46 eric Exp $ * Copyright 2001 Eric Smith * * This program is free software; you can redistribute it and/or modify @@ -32,6 +32,8 @@ #include "tiff2pdf.h" +int line; + FILE *yyin; TIFF *in; panda_pdf *out; @@ -207,9 +209,26 @@ boolean process_page (int image) /* range 1 .. n */ } +void input_images (int first, int last) +{ + if (first == last) + printf ("image %d\n", first); + else + printf ("iamges %d..%d\n", first, last); +} + +void output_pages (int first, int last) +{ + if (first == last) + printf ("page %d\n", first); + else + printf ("pages %d..%d\n", first, last); +} + + void yyerror (char *s) { - fprintf (stderr, "%s\n", s); + fprintf (stderr, "%d: %s\n", line, s); } @@ -226,18 +245,21 @@ int main (int argc, char *argv[]) goto fail; } - yyin = fopen (argv [2], "r"); + yyin = fopen (argv [1], "r"); if (! yyin) { - fprintf (stderr, "can't open spec file '%s'\n", argv [2]); + fprintf (stderr, "can't open spec file '%s'\n", argv [1]); result = 3; goto fail; } + line = 1; + yyparse (); fail: - fclose (yyin); + if (yyin) + fclose (yyin); close_tiff_input_file (); close_pdf_output_file (); return (result);