..

Sun, 30 Dec 2001 04:16:46 +0000

author
eric
date
Sun, 30 Dec 2001 04:16:46 +0000
changeset 14
4c261fbf8c77
parent 13
3ab5717225d3
child 15
dda3d673b82b

..

t2p.c file | annotate | diff | revisions
tumble.c file | annotate | diff | revisions
     1.1 diff -r 3ab5717225d3 -r 4c261fbf8c77 t2p.c
     1.2 --- a/t2p.c	Sun Dec 30 01:54:43 2001 +0000
     1.3 +++ b/t2p.c	Sun Dec 30 04:16:46 2001 +0000
     1.4 @@ -1,7 +1,7 @@
     1.5  /*
     1.6   * tiffg4: reencode a bilevel TIFF file as a single-strip TIFF Class F Group 4
     1.7   * Main program
     1.8 - * $Id: t2p.c,v 1.2 2001/12/29 10:59:47 eric Exp $
     1.9 + * $Id: t2p.c,v 1.3 2001/12/29 20:16:46 eric Exp $
    1.10   * Copyright 2001 Eric Smith <eric@brouhaha.com>
    1.11   *
    1.12   * This program is free software; you can redistribute it and/or modify
    1.13 @@ -32,6 +32,8 @@
    1.14  #include "tiff2pdf.h"
    1.15  
    1.16  
    1.17 +int line;
    1.18 +
    1.19  FILE *yyin;
    1.20  TIFF *in;
    1.21  panda_pdf *out;
    1.22 @@ -207,9 +209,26 @@
    1.23  }
    1.24  
    1.25  
    1.26 +void input_images (int first, int last)
    1.27 +{
    1.28 +  if (first == last)
    1.29 +    printf ("image %d\n", first);
    1.30 +  else
    1.31 +    printf ("iamges %d..%d\n", first, last);
    1.32 +}
    1.33 +
    1.34 +void output_pages (int first, int last)
    1.35 +{
    1.36 +  if (first == last)
    1.37 +    printf ("page %d\n", first);
    1.38 +  else
    1.39 +    printf ("pages %d..%d\n", first, last);
    1.40 +}
    1.41 +
    1.42 +
    1.43  void yyerror (char *s)
    1.44  {
    1.45 -  fprintf (stderr, "%s\n", s);
    1.46 +  fprintf (stderr, "%d: %s\n", line, s);
    1.47  }
    1.48  
    1.49  
    1.50 @@ -226,18 +245,21 @@
    1.51        goto fail;
    1.52      }
    1.53  
    1.54 -  yyin = fopen (argv [2], "r");
    1.55 +  yyin = fopen (argv [1], "r");
    1.56    if (! yyin)
    1.57      {
    1.58 -      fprintf (stderr, "can't open spec file '%s'\n", argv [2]);
    1.59 +      fprintf (stderr, "can't open spec file '%s'\n", argv [1]);
    1.60        result = 3;
    1.61        goto fail;
    1.62      }
    1.63  
    1.64 +  line = 1;
    1.65 +
    1.66    yyparse ();
    1.67  
    1.68   fail:
    1.69 -  fclose (yyin);
    1.70 +  if (yyin)
    1.71 +    fclose (yyin);
    1.72    close_tiff_input_file ();
    1.73    close_pdf_output_file ();
    1.74    return (result);
     2.1 diff -r 3ab5717225d3 -r 4c261fbf8c77 tumble.c
     2.2 --- a/tumble.c	Sun Dec 30 01:54:43 2001 +0000
     2.3 +++ b/tumble.c	Sun Dec 30 04:16:46 2001 +0000
     2.4 @@ -1,7 +1,7 @@
     2.5  /*
     2.6   * tiffg4: reencode a bilevel TIFF file as a single-strip TIFF Class F Group 4
     2.7   * Main program
     2.8 - * $Id: tumble.c,v 1.2 2001/12/29 10:59:47 eric Exp $
     2.9 + * $Id: tumble.c,v 1.3 2001/12/29 20:16:46 eric Exp $
    2.10   * Copyright 2001 Eric Smith <eric@brouhaha.com>
    2.11   *
    2.12   * This program is free software; you can redistribute it and/or modify
    2.13 @@ -32,6 +32,8 @@
    2.14  #include "tiff2pdf.h"
    2.15  
    2.16  
    2.17 +int line;
    2.18 +
    2.19  FILE *yyin;
    2.20  TIFF *in;
    2.21  panda_pdf *out;
    2.22 @@ -207,9 +209,26 @@
    2.23  }
    2.24  
    2.25  
    2.26 +void input_images (int first, int last)
    2.27 +{
    2.28 +  if (first == last)
    2.29 +    printf ("image %d\n", first);
    2.30 +  else
    2.31 +    printf ("iamges %d..%d\n", first, last);
    2.32 +}
    2.33 +
    2.34 +void output_pages (int first, int last)
    2.35 +{
    2.36 +  if (first == last)
    2.37 +    printf ("page %d\n", first);
    2.38 +  else
    2.39 +    printf ("pages %d..%d\n", first, last);
    2.40 +}
    2.41 +
    2.42 +
    2.43  void yyerror (char *s)
    2.44  {
    2.45 -  fprintf (stderr, "%s\n", s);
    2.46 +  fprintf (stderr, "%d: %s\n", line, s);
    2.47  }
    2.48  
    2.49  
    2.50 @@ -226,18 +245,21 @@
    2.51        goto fail;
    2.52      }
    2.53  
    2.54 -  yyin = fopen (argv [2], "r");
    2.55 +  yyin = fopen (argv [1], "r");
    2.56    if (! yyin)
    2.57      {
    2.58 -      fprintf (stderr, "can't open spec file '%s'\n", argv [2]);
    2.59 +      fprintf (stderr, "can't open spec file '%s'\n", argv [1]);
    2.60        result = 3;
    2.61        goto fail;
    2.62      }
    2.63  
    2.64 +  line = 1;
    2.65 +
    2.66    yyparse ();
    2.67  
    2.68   fail:
    2.69 -  fclose (yyin);
    2.70 +  if (yyin)
    2.71 +    fclose (yyin);
    2.72    close_tiff_input_file ();
    2.73    close_pdf_output_file ();
    2.74    return (result);