*** empty log message ***

Sat, 29 Dec 2001 18:59:47 +0000

author
eric
date
Sat, 29 Dec 2001 18:59:47 +0000
changeset 12
c3e2c2344560
parent 11
30d18cf8bb67
child 13
3ab5717225d3

*** empty log message ***

Makefile file | annotate | diff | revisions
parser.y file | annotate | diff | revisions
scanner.l file | annotate | diff | revisions
t2p.c file | annotate | diff | revisions
tumble.c file | annotate | diff | revisions
     1.1 --- a/Makefile	Sat Dec 29 17:45:43 2001 +0000
     1.2 +++ b/Makefile	Sat Dec 29 18:59:47 2001 +0000
     1.3 @@ -1,6 +1,6 @@
     1.4  # tiff2pdf: build a PDF file out of one or more TIFF Class F Group 4 files
     1.5  # Makefile
     1.6 -# $Id: Makefile,v 1.4 2001/12/29 09:44:27 eric Exp $
     1.7 +# $Id: Makefile,v 1.5 2001/12/29 10:59:17 eric Exp $
     1.8  # Copyright 2001 Eric Smith <eric@brouhaha.com>
     1.9  #
    1.10  # This program is free software; you can redistribute it and/or modify
    1.11 @@ -24,12 +24,14 @@
    1.12  YACC = bison
    1.13  YFLAGS = -d -v
    1.14  
    1.15 +SRCS = bitblt.c bitblt_test.c tiff2pdf.c
    1.16 +HDRS = type.h bitblt.h tiff2pdf.h
    1.17 +MISC = Makefile scanner.l parser.y
    1.18 +
    1.19  tiff2pdf: tiff2pdf.o scanner.o parser.tab.o
    1.20  
    1.21  bitblt_test: bitblt_test.o bitblt.o
    1.22  
    1.23 -pandamain: pandamain.o
    1.24 -
    1.25  
    1.26  %.tab.c %.tab.h: %.y
    1.27  	$(YACC) $(YFLAGS) $<
     2.1 --- a/parser.y	Sat Dec 29 17:45:43 2001 +0000
     2.2 +++ b/parser.y	Sat Dec 29 18:59:47 2001 +0000
     2.3 @@ -73,8 +73,8 @@
     2.4  	| image_ranges ',' range ;
     2.5  
     2.6  
     2.7 -file_clause:
     2.8 -	FILE_KEYWORD STRING  ';' ;
     2.9 +input_file_clause:
    2.10 +	FILE_KEYWORD STRING  ';'  { open_tiff_input_file ($2) } ;
    2.11  
    2.12  image_clause:
    2.13  	IMAGE INTEGER ';'
    2.14 @@ -135,7 +135,7 @@
    2.15  	| part_clauses part_clause;
    2.16  
    2.17  input_clause:
    2.18 -	file_clause
    2.19 +	input_file_clause
    2.20  	| image_clause
    2.21  	| images_clause
    2.22  	| modifier_clause
    2.23 @@ -151,6 +151,9 @@
    2.24  input_statement:
    2.25  	INPUT input_clauses ;
    2.26  
    2.27 +output_file_clause:
    2.28 +	FILE_KEYWORD STRING  ';' { open_pdf_output_file ($2) } ;
    2.29 +
    2.30  page_ranges:
    2.31  	range
    2.32  	| page_ranges ',' range ;
    2.33 @@ -168,7 +171,9 @@
    2.34  	| BOOKMARK STRING ';' ;
    2.35  
    2.36  output_clause:
    2.37 -	page_clause | pages_clause | bookmark_clause
    2.38 +	output_file_clause
    2.39 +	| page_clause | pages_clause
    2.40 +	| bookmark_clause
    2.41  	| output_clause_list ;
    2.42  
    2.43  output_clauses:
     3.1 --- a/scanner.l	Sat Dec 29 17:45:43 2001 +0000
     3.2 +++ b/scanner.l	Sat Dec 29 18:59:47 2001 +0000
     3.3 @@ -1,8 +1,13 @@
     3.4 +/*
     3.5 +$Id: scanner.l,v 1.6 2001/12/29 10:59:33 eric Exp $
     3.6 +*/
     3.7 +
     3.8  %option case-insensitive
     3.9  
    3.10  %{
    3.11  #include "parser.tab.h"
    3.12 -}%
    3.13 +%}
    3.14 +
    3.15  
    3.16  digit [0-9]
    3.17  alpha [a-zA-Z]
    3.18 @@ -12,7 +17,7 @@
    3.19  \.\.		{ return (ELIPSIS); }
    3.20  
    3.21  {digit}+	{ yylval.integer = atoi (yytext); return (INTEGER); }
    3.22 -{digit}+.{digit}* { yylval.float = atof (yytext); return (FLOAT); }
    3.23 +{digit}+.{digit}* { yylval.fp = atof (yytext); return (FLOAT); }
    3.24  
    3.25  a		{ yylval.size.width = 8.5 * 25.4;
    3.26  		  yylval.size.height = 11.0 * 25.4;
    3.27 @@ -50,7 +55,7 @@
    3.28  rotate		{ return (ROTATE); }
    3.29  size		{ return (SIZE); }
    3.30  
    3.31 -\".*\"		{ yylval.string = newstr (yytext); return (STRING); }
    3.32 +\".*\"		{ yylval.string = strdup (yytext); return (STRING); }
    3.33  
    3.34  [ \t\n]+	/* whitespace */
    3.35  
    3.36 @@ -58,3 +63,4 @@
    3.37  
    3.38  .		{ printf( "Unrecognized character: %s\n", yytext ); }
    3.39  
    3.40 +%%
     4.1 --- a/t2p.c	Sat Dec 29 17:45:43 2001 +0000
     4.2 +++ b/t2p.c	Sat Dec 29 18:59:47 2001 +0000
     4.3 @@ -1,7 +1,7 @@
     4.4  /*
     4.5   * tiffg4: reencode a bilevel TIFF file as a single-strip TIFF Class F Group 4
     4.6   * Main program
     4.7 - * $Id: t2p.c,v 1.1 2001/12/29 09:44:24 eric Exp $
     4.8 + * $Id: t2p.c,v 1.2 2001/12/29 10:59:47 eric Exp $
     4.9   * Copyright 2001 Eric Smith <eric@brouhaha.com>
    4.10   *
    4.11   * This program is free software; you can redistribute it and/or modify
    4.12 @@ -32,6 +32,7 @@
    4.13  #include "tiff2pdf.h"
    4.14  
    4.15  
    4.16 +FILE *yyin;
    4.17  TIFF *in;
    4.18  panda_pdf *out;
    4.19  
    4.20 @@ -206,10 +207,14 @@
    4.21  }
    4.22  
    4.23  
    4.24 +void yyerror (char *s)
    4.25 +{
    4.26 +  fprintf (stderr, "%s\n", s);
    4.27 +}
    4.28 +
    4.29  
    4.30  int main (int argc, char *argv[])
    4.31  {
    4.32 -  FILE *spec;
    4.33    int result = 0;
    4.34  
    4.35    panda_init ();
    4.36 @@ -221,8 +226,8 @@
    4.37        goto fail;
    4.38      }
    4.39  
    4.40 -  spec = fopen (argv [2], "r");
    4.41 -  if (! spec)
    4.42 +  yyin = fopen (argv [2], "r");
    4.43 +  if (! yyin)
    4.44      {
    4.45        fprintf (stderr, "can't open spec file '%s'\n", argv [2]);
    4.46        result = 3;
    4.47 @@ -232,6 +237,7 @@
    4.48    yyparse ();
    4.49  
    4.50   fail:
    4.51 +  fclose (yyin);
    4.52    close_tiff_input_file ();
    4.53    close_pdf_output_file ();
    4.54    return (result);
     5.1 --- a/tumble.c	Sat Dec 29 17:45:43 2001 +0000
     5.2 +++ b/tumble.c	Sat Dec 29 18:59:47 2001 +0000
     5.3 @@ -1,7 +1,7 @@
     5.4  /*
     5.5   * tiffg4: reencode a bilevel TIFF file as a single-strip TIFF Class F Group 4
     5.6   * Main program
     5.7 - * $Id: tumble.c,v 1.1 2001/12/29 09:44:24 eric Exp $
     5.8 + * $Id: tumble.c,v 1.2 2001/12/29 10:59:47 eric Exp $
     5.9   * Copyright 2001 Eric Smith <eric@brouhaha.com>
    5.10   *
    5.11   * This program is free software; you can redistribute it and/or modify
    5.12 @@ -32,6 +32,7 @@
    5.13  #include "tiff2pdf.h"
    5.14  
    5.15  
    5.16 +FILE *yyin;
    5.17  TIFF *in;
    5.18  panda_pdf *out;
    5.19  
    5.20 @@ -206,10 +207,14 @@
    5.21  }
    5.22  
    5.23  
    5.24 +void yyerror (char *s)
    5.25 +{
    5.26 +  fprintf (stderr, "%s\n", s);
    5.27 +}
    5.28 +
    5.29  
    5.30  int main (int argc, char *argv[])
    5.31  {
    5.32 -  FILE *spec;
    5.33    int result = 0;
    5.34  
    5.35    panda_init ();
    5.36 @@ -221,8 +226,8 @@
    5.37        goto fail;
    5.38      }
    5.39  
    5.40 -  spec = fopen (argv [2], "r");
    5.41 -  if (! spec)
    5.42 +  yyin = fopen (argv [2], "r");
    5.43 +  if (! yyin)
    5.44      {
    5.45        fprintf (stderr, "can't open spec file '%s'\n", argv [2]);
    5.46        result = 3;
    5.47 @@ -232,6 +237,7 @@
    5.48    yyparse ();
    5.49  
    5.50   fail:
    5.51 +  fclose (yyin);
    5.52    close_tiff_input_file ();
    5.53    close_pdf_output_file ();
    5.54    return (result);