Thu, 13 Mar 2003 08:57:05 +0000
changed program name from t2p to tumble.
1.1 --- a/Makefile Thu Mar 13 08:03:11 2003 +0000 1.2 +++ b/Makefile Thu Mar 13 08:57:05 2003 +0000 1.3 @@ -1,6 +1,6 @@ 1.4 -# t2p: build a PDF file out of one or more TIFF Class F Group 4 files 1.5 +# tumble: build a PDF file from image files 1.6 # Makefile 1.7 -# $Id: Makefile,v 1.28 2003/03/12 23:57:21 eric Exp $ 1.8 +# $Id: Makefile,v 1.29 2003/03/13 00:57:05 eric Exp $ 1.9 # Copyright 2001, 2002, 2003 Eric Smith <eric@brouhaha.com> 1.10 # 1.11 # This program is free software; you can redistribute it and/or modify 1.12 @@ -55,18 +55,18 @@ 1.13 # let me know why so I can improve this Makefile. 1.14 # ----------------------------------------------------------------------------- 1.15 1.16 -VERSION = 0.23 1.17 +VERSION = 0.24 1.18 1.19 -PACKAGE = t2p 1.20 +PACKAGE = tumble 1.21 1.22 -TARGETS = t2p 1.23 +TARGETS = tumble 1.24 1.25 -CSRCS = t2p.c semantics.c \ 1.26 +CSRCS = tumble.c semantics.c \ 1.27 bitblt.c bitblt_table_gen.c bitblt_g4.c g4_table_gen.c \ 1.28 pdf.c pdf_util.c pdf_prim.c pdf_bookmark.c pdf_name_tree.c \ 1.29 pdf_text.c pdf_g4.c pdf_jpeg.c 1.30 OSRCS = scanner.l parser.y 1.31 -HDRS = t2p.h semantics.h bitblt.h bitblt_tables.h \ 1.32 +HDRS = tumble.h semantics.h bitblt.h bitblt_tables.h \ 1.33 pdf.h pdf_private.h pdf_util.h pdf_prim.h pdf_name_tree.h 1.34 MISC = COPYING Makefile 1.35 1.36 @@ -85,7 +85,7 @@ 1.37 all: $(TARGETS) $(TEST_TARGETS) 1.38 1.39 1.40 -t2p: t2p.o scanner.o semantics.o parser.tab.o \ 1.41 +tumble: tumble.o scanner.o semantics.o parser.tab.o \ 1.42 bitblt.o bitblt_g4.o bitblt_tables.o g4_tables.o \ 1.43 pdf.o pdf_util.o pdf_prim.o pdf_bookmark.o pdf_name_tree.o \ 1.44 pdf_text.o pdf_g4.o pdf_jpeg.o
2.1 --- a/bitblt.c Thu Mar 13 08:03:11 2003 +0000 2.2 +++ b/bitblt.c Thu Mar 13 08:57:05 2003 +0000 2.3 @@ -1,10 +1,8 @@ 2.4 /* 2.5 - * t2p: Create a PDF file from the contents of one or more TIFF 2.6 - * bilevel image files. The images in the resulting PDF file 2.7 - * will be compressed using ITU-T T.6 (G4) fax encoding. 2.8 + * tumble: build a PDF file from image files 2.9 * 2.10 * bitblt routines 2.11 - * $Id: bitblt.c,v 1.15 2003/03/12 02:59:09 eric Exp $ 2.12 + * $Id: bitblt.c,v 1.16 2003/03/13 00:57:05 eric Exp $ 2.13 * Copyright 2001, 2002, 2003 Eric Smith <eric@brouhaha.com> 2.14 * 2.15 * This program is free software; you can redistribute it and/or modify
3.1 --- a/bitblt.h Thu Mar 13 08:03:11 2003 +0000 3.2 +++ b/bitblt.h Thu Mar 13 08:57:05 2003 +0000 3.3 @@ -1,10 +1,8 @@ 3.4 /* 3.5 - * t2p: Create a PDF file from the contents of one or more TIFF 3.6 - * bilevel image files. The images in the resulting PDF file 3.7 - * will be compressed using ITU-T T.6 (G4) fax encoding. 3.8 + * tumble: build a PDF file from image files 3.9 * 3.10 * bitblt routines 3.11 - * $Id: bitblt.h,v 1.16 2003/03/12 02:59:09 eric Exp $ 3.12 + * $Id: bitblt.h,v 1.17 2003/03/13 00:57:05 eric Exp $ 3.13 * Copyright 2001, 2002, 2003 Eric Smith <eric@brouhaha.com> 3.14 * 3.15 * This program is free software; you can redistribute it and/or modify
4.1 --- a/bitblt_g4.c Thu Mar 13 08:03:11 2003 +0000 4.2 +++ b/bitblt_g4.c Thu Mar 13 08:57:05 2003 +0000 4.3 @@ -1,10 +1,8 @@ 4.4 /* 4.5 - * t2p: Create a PDF file from the contents of one or more TIFF 4.6 - * bilevel image files. The images in the resulting PDF file 4.7 - * will be compressed using ITU-T T.6 (G4) fax encoding. 4.8 + * tumble: build a PDF file from image files 4.9 * 4.10 * G4 compression 4.11 - * $Id: bitblt_g4.c,v 1.13 2003/03/12 19:30:44 eric Exp $ 4.12 + * $Id: bitblt_g4.c,v 1.14 2003/03/13 00:57:05 eric Exp $ 4.13 * Copyright 2003 Eric Smith <eric@brouhaha.com> 4.14 * 4.15 * This program is free software; you can redistribute it and/or modify
5.1 --- a/bitblt_table_gen.c Thu Mar 13 08:03:11 2003 +0000 5.2 +++ b/bitblt_table_gen.c Thu Mar 13 08:57:05 2003 +0000 5.3 @@ -1,10 +1,8 @@ 5.4 /* 5.5 - * t2p: Create a PDF file from the contents of one or more TIFF 5.6 - * bilevel image files. The images in the resulting PDF file 5.7 - * will be compressed using ITU-T T.6 (G4) fax encoding. 5.8 + * tumble: build a PDF file from image files 5.9 * 5.10 * bitblt table generator 5.11 - * $Id: bitblt_table_gen.c,v 1.6 2003/03/11 22:40:34 eric Exp $ 5.12 + * $Id: bitblt_table_gen.c,v 1.7 2003/03/13 00:57:05 eric Exp $ 5.13 * Copyright 2003 Eric Smith <eric@brouhaha.com> 5.14 * 5.15 * This program is free software; you can redistribute it and/or modify
6.1 --- a/g4_table_gen.c Thu Mar 13 08:03:11 2003 +0000 6.2 +++ b/g4_table_gen.c Thu Mar 13 08:57:05 2003 +0000 6.3 @@ -1,10 +1,8 @@ 6.4 /* 6.5 - * t2p: Create a PDF file from the contents of one or more TIFF 6.6 - * bilevel image files. The images in the resulting PDF file 6.7 - * will be compressed using ITU-T T.6 (G4) fax encoding. 6.8 + * tumble: build a PDF file from image files 6.9 * 6.10 * G4 table generator 6.11 - * $Id: g4_table_gen.c,v 1.3 2003/03/11 22:57:46 eric Exp $ 6.12 + * $Id: g4_table_gen.c,v 1.4 2003/03/13 00:57:05 eric Exp $ 6.13 * Copyright 2003 Eric Smith <eric@brouhaha.com> 6.14 * 6.15 * This program is free software; you can redistribute it and/or modify
7.1 --- a/parser.y Thu Mar 13 08:03:11 2003 +0000 7.2 +++ b/parser.y Thu Mar 13 08:57:05 2003 +0000 7.3 @@ -1,10 +1,8 @@ 7.4 /* 7.5 - * t2p: Create a PDF file from the contents of one or more TIFF 7.6 - * bilevel image files. The images in the resulting PDF file 7.7 - * will be compressed using ITU-T T.6 (G4) fax encoding. 7.8 + * tumble: build a PDF file from image files 7.9 * 7.10 * Parser 7.11 - * $Id: parser.y,v 1.17 2003/02/21 00:49:11 eric Exp $ 7.12 + * $Id: parser.y,v 1.18 2003/03/13 00:57:05 eric Exp $ 7.13 * Copyright 2001, 2002, 2003 Eric Smith <eric@brouhaha.com> 7.14 * 7.15 * This program is free software; you can redistribute it and/or modify
8.1 --- a/pdf.c Thu Mar 13 08:03:11 2003 +0000 8.2 +++ b/pdf.c Thu Mar 13 08:57:05 2003 +0000 8.3 @@ -1,10 +1,8 @@ 8.4 /* 8.5 - * t2p: Create a PDF file from the contents of one or more TIFF 8.6 - * bilevel image files. The images in the resulting PDF file 8.7 - * will be compressed using ITU-T T.6 (G4) fax encoding. 8.8 + * tumble: build a PDF file from image files 8.9 * 8.10 * PDF routines 8.11 - * $Id: pdf.c,v 1.9 2003/03/13 00:03:11 eric Exp $ 8.12 + * $Id: pdf.c,v 1.10 2003/03/13 00:57:05 eric Exp $ 8.13 * Copyright 2001, 2002, 2003 Eric Smith <eric@brouhaha.com> 8.14 * 8.15 * This program is free software; you can redistribute it and/or modify
9.1 --- a/pdf.h Thu Mar 13 08:03:11 2003 +0000 9.2 +++ b/pdf.h Thu Mar 13 08:57:05 2003 +0000 9.3 @@ -1,10 +1,8 @@ 9.4 /* 9.5 - * t2p: Create a PDF file from the contents of one or more TIFF 9.6 - * bilevel image files. The images in the resulting PDF file 9.7 - * will be compressed using ITU-T T.6 (G4) fax encoding. 9.8 + * tumble: build a PDF file from image files 9.9 * 9.10 * PDF routines 9.11 - * $Id: pdf.h,v 1.8 2003/03/12 23:57:21 eric Exp $ 9.12 + * $Id: pdf.h,v 1.9 2003/03/13 00:57:05 eric Exp $ 9.13 * Copyright 2001, 2002, 2003 Eric Smith <eric@brouhaha.com> 9.14 * 9.15 * This program is free software; you can redistribute it and/or modify
10.1 --- a/pdf_bookmark.c Thu Mar 13 08:03:11 2003 +0000 10.2 +++ b/pdf_bookmark.c Thu Mar 13 08:57:05 2003 +0000 10.3 @@ -1,10 +1,8 @@ 10.4 /* 10.5 - * t2p: Create a PDF file from the contents of one or more TIFF 10.6 - * bilevel image files. The images in the resulting PDF file 10.7 - * will be compressed using ITU-T T.6 (G4) fax encoding. 10.8 + * tumble: build a PDF file from image files 10.9 * 10.10 * PDF routines 10.11 - * $Id: pdf_bookmark.c,v 1.5 2003/03/05 12:56:25 eric Exp $ 10.12 + * $Id: pdf_bookmark.c,v 1.6 2003/03/13 00:57:05 eric Exp $ 10.13 * Copyright 2003 Eric Smith <eric@brouhaha.com> 10.14 * 10.15 * This program is free software; you can redistribute it and/or modify
11.1 --- a/pdf_g4.c Thu Mar 13 08:03:11 2003 +0000 11.2 +++ b/pdf_g4.c Thu Mar 13 08:57:05 2003 +0000 11.3 @@ -1,10 +1,8 @@ 11.4 /* 11.5 - * t2p: Create a PDF file from the contents of one or more TIFF 11.6 - * bilevel image files. The images in the resulting PDF file 11.7 - * will be compressed using ITU-T T.6 (G4) fax encoding. 11.8 + * tumble: build a PDF file from image files 11.9 * 11.10 * PDF routines 11.11 - * $Id: pdf_g4.c,v 1.14 2003/03/12 23:59:35 eric Exp $ 11.12 + * $Id: pdf_g4.c,v 1.15 2003/03/13 00:57:05 eric Exp $ 11.13 * Copyright 2003 Eric Smith <eric@brouhaha.com> 11.14 * 11.15 * This program is free software; you can redistribute it and/or modify
12.1 --- a/pdf_jpeg.c Thu Mar 13 08:03:11 2003 +0000 12.2 +++ b/pdf_jpeg.c Thu Mar 13 08:57:05 2003 +0000 12.3 @@ -1,10 +1,8 @@ 12.4 /* 12.5 - * t2p: Create a PDF file from the contents of one or more TIFF 12.6 - * bilevel image files. The images in the resulting PDF file 12.7 - * will be compressed using ITU-T T.6 (G4) fax encoding. 12.8 + * tumble: build a PDF file from image files 12.9 * 12.10 * PDF routines 12.11 - * $Id: pdf_jpeg.c,v 1.1 2003/03/12 02:57:06 eric Exp $ 12.12 + * $Id: pdf_jpeg.c,v 1.2 2003/03/13 00:57:05 eric Exp $ 12.13 * Copyright 2003 Eric Smith <eric@brouhaha.com> 12.14 * 12.15 * This program is free software; you can redistribute it and/or modify
13.1 --- a/pdf_name_tree.c Thu Mar 13 08:03:11 2003 +0000 13.2 +++ b/pdf_name_tree.c Thu Mar 13 08:57:05 2003 +0000 13.3 @@ -1,10 +1,8 @@ 13.4 /* 13.5 - * t2p: Create a PDF file from the contents of one or more TIFF 13.6 - * bilevel image files. The images in the resulting PDF file 13.7 - * will be compressed using ITU-T T.6 (G4) fax encoding. 13.8 + * tumble: build a PDF file from image files 13.9 * 13.10 * PDF routines 13.11 - * $Id: pdf_name_tree.c,v 1.8 2003/03/12 03:13:28 eric Exp $ 13.12 + * $Id: pdf_name_tree.c,v 1.9 2003/03/13 00:57:05 eric Exp $ 13.13 * Copyright 2003 Eric Smith <eric@brouhaha.com> 13.14 * 13.15 * This program is free software; you can redistribute it and/or modify
14.1 --- a/pdf_name_tree.h Thu Mar 13 08:03:11 2003 +0000 14.2 +++ b/pdf_name_tree.h Thu Mar 13 08:57:05 2003 +0000 14.3 @@ -1,10 +1,8 @@ 14.4 /* 14.5 - * t2p: Create a PDF file from the contents of one or more TIFF 14.6 - * bilevel image files. The images in the resulting PDF file 14.7 - * will be compressed using ITU-T T.6 (G4) fax encoding. 14.8 + * tumble: build a PDF file from image files 14.9 * 14.10 * PDF routines 14.11 - * $Id: pdf_name_tree.h,v 1.2 2003/03/07 22:52:09 eric Exp $ 14.12 + * $Id: pdf_name_tree.h,v 1.3 2003/03/13 00:57:05 eric Exp $ 14.13 * Copyright 2003 Eric Smith <eric@brouhaha.com> 14.14 * 14.15 * This program is free software; you can redistribute it and/or modify
15.1 --- a/pdf_prim.c Thu Mar 13 08:03:11 2003 +0000 15.2 +++ b/pdf_prim.c Thu Mar 13 08:57:05 2003 +0000 15.3 @@ -1,10 +1,8 @@ 15.4 /* 15.5 - * t2p: Create a PDF file from the contents of one or more TIFF 15.6 - * bilevel image files. The images in the resulting PDF file 15.7 - * will be compressed using ITU-T T.6 (G4) fax encoding. 15.8 + * tumble: build a PDF file from image files 15.9 * 15.10 * PDF routines 15.11 - * $Id: pdf_prim.c,v 1.11 2003/03/13 00:00:21 eric Exp $ 15.12 + * $Id: pdf_prim.c,v 1.12 2003/03/13 00:57:05 eric Exp $ 15.13 * Copyright 2001, 2002, 2003 Eric Smith <eric@brouhaha.com> 15.14 * 15.15 * This program is free software; you can redistribute it and/or modify
16.1 --- a/pdf_prim.h Thu Mar 13 08:03:11 2003 +0000 16.2 +++ b/pdf_prim.h Thu Mar 13 08:57:05 2003 +0000 16.3 @@ -1,10 +1,8 @@ 16.4 /* 16.5 - * t2p: Create a PDF file from the contents of one or more TIFF 16.6 - * bilevel image files. The images in the resulting PDF file 16.7 - * will be compressed using ITU-T T.6 (G4) fax encoding. 16.8 + * tumble: build a PDF file from image files 16.9 * 16.10 * PDF routines 16.11 - * $Id: pdf_prim.h,v 1.9 2003/03/12 22:56:57 eric Exp $ 16.12 + * $Id: pdf_prim.h,v 1.10 2003/03/13 00:57:05 eric Exp $ 16.13 * Copyright 2001, 2002, 2003 Eric Smith <eric@brouhaha.com> 16.14 * 16.15 * This program is free software; you can redistribute it and/or modify
17.1 --- a/pdf_private.h Thu Mar 13 08:03:11 2003 +0000 17.2 +++ b/pdf_private.h Thu Mar 13 08:57:05 2003 +0000 17.3 @@ -1,10 +1,8 @@ 17.4 /* 17.5 - * t2p: Create a PDF file from the contents of one or more TIFF 17.6 - * bilevel image files. The images in the resulting PDF file 17.7 - * will be compressed using ITU-T T.6 (G4) fax encoding. 17.8 + * tumble: build a PDF file from image files 17.9 * 17.10 * PDF routines 17.11 - * $Id: pdf_private.h,v 1.6 2003/03/07 22:52:09 eric Exp $ 17.12 + * $Id: pdf_private.h,v 1.7 2003/03/13 00:57:05 eric Exp $ 17.13 * Copyright 2001, 2002, 2003 Eric Smith <eric@brouhaha.com> 17.14 * 17.15 * This program is free software; you can redistribute it and/or modify
18.1 --- a/pdf_text.c Thu Mar 13 08:03:11 2003 +0000 18.2 +++ b/pdf_text.c Thu Mar 13 08:57:05 2003 +0000 18.3 @@ -1,10 +1,8 @@ 18.4 /* 18.5 - * t2p: Create a PDF file from the contents of one or more TIFF 18.6 - * bilevel image files. The images in the resulting PDF file 18.7 - * will be compressed using ITU-T T.6 (G4) fax encoding. 18.8 + * tumble: build a PDF file from image files 18.9 * 18.10 * PDF routines 18.11 - * $Id: pdf_text.c,v 1.1 2003/03/12 23:57:21 eric Exp $ 18.12 + * $Id: pdf_text.c,v 1.2 2003/03/13 00:57:05 eric Exp $ 18.13 * Copyright 2003 Eric Smith <eric@brouhaha.com> 18.14 * 18.15 * This program is free software; you can redistribute it and/or modify
19.1 --- a/pdf_util.c Thu Mar 13 08:03:11 2003 +0000 19.2 +++ b/pdf_util.c Thu Mar 13 08:57:05 2003 +0000 19.3 @@ -1,10 +1,8 @@ 19.4 /* 19.5 - * t2p: Create a PDF file from the contents of one or more TIFF 19.6 - * bilevel image files. The images in the resulting PDF file 19.7 - * will be compressed using ITU-T T.6 (G4) fax encoding. 19.8 + * tumble: build a PDF file from image files 19.9 * 19.10 * PDF routines 19.11 - * $Id: pdf_util.c,v 1.5 2003/03/10 05:08:25 eric Exp $ 19.12 + * $Id: pdf_util.c,v 1.6 2003/03/13 00:57:05 eric Exp $ 19.13 * Copyright 2001, 2002, 2003 Eric Smith <eric@brouhaha.com> 19.14 * 19.15 * This program is free software; you can redistribute it and/or modify
20.1 --- a/pdf_util.h Thu Mar 13 08:03:11 2003 +0000 20.2 +++ b/pdf_util.h Thu Mar 13 08:57:05 2003 +0000 20.3 @@ -1,10 +1,8 @@ 20.4 /* 20.5 - * t2p: Create a PDF file from the contents of one or more TIFF 20.6 - * bilevel image files. The images in the resulting PDF file 20.7 - * will be compressed using ITU-T T.6 (G4) fax encoding. 20.8 + * tumble: build a PDF file from image files 20.9 * 20.10 * PDF routines 20.11 - * $Id: pdf_util.h,v 1.5 2003/03/07 03:02:12 eric Exp $ 20.12 + * $Id: pdf_util.h,v 1.6 2003/03/13 00:57:05 eric Exp $ 20.13 * Copyright 2001, 2002, 2003 Eric Smith <eric@brouhaha.com> 20.14 * 20.15 * This program is free software; you can redistribute it and/or modify
21.1 --- a/scanner.l Thu Mar 13 08:03:11 2003 +0000 21.2 +++ b/scanner.l Thu Mar 13 08:57:05 2003 +0000 21.3 @@ -1,10 +1,8 @@ 21.4 /* 21.5 - * t2p: Create a PDF file from the contents of one or more TIFF 21.6 - * bilevel image files. The images in the resulting PDF file 21.7 - * will be compressed using ITU-T T.6 (G4) fax encoding. 21.8 + * tumble: build a PDF file from image files 21.9 * 21.10 * Lexical analyzer 21.11 - * $Id: scanner.l,v 1.17 2003/02/21 00:49:11 eric Exp $ 21.12 + * $Id: scanner.l,v 1.18 2003/03/13 00:57:05 eric Exp $ 21.13 * Copyright 2001, 2002, 2003 Eric Smith <eric@brouhaha.com> 21.14 * 21.15 * This program is free software; you can redistribute it and/or modify
22.1 --- a/semantics.c Thu Mar 13 08:03:11 2003 +0000 22.2 +++ b/semantics.c Thu Mar 13 08:57:05 2003 +0000 22.3 @@ -1,10 +1,8 @@ 22.4 /* 22.5 - * t2p: Create a PDF file from the contents of one or more TIFF 22.6 - * bilevel image files. The images in the resulting PDF file 22.7 - * will be compressed using ITU-T T.6 (G4) fax encoding. 22.8 + * tumble: build a PDF file from image files 22.9 * 22.10 * Semantic routines for spec file parser 22.11 - * $Id: semantics.c,v 1.18 2003/03/12 00:38:04 eric Exp $ 22.12 + * $Id: semantics.c,v 1.19 2003/03/13 00:57:05 eric Exp $ 22.13 * Copyright 2001, 2002, 2003 Eric Smith <eric@brouhaha.com> 22.14 * 22.15 * This program is free software; you can redistribute it and/or modify 22.16 @@ -32,7 +30,7 @@ 22.17 22.18 #include "semantics.h" 22.19 #include "parser.tab.h" 22.20 -#include "t2p.h" 22.21 +#include "tumble.h" 22.22 22.23 22.24 typedef struct
23.1 --- a/semantics.h Thu Mar 13 08:03:11 2003 +0000 23.2 +++ b/semantics.h Thu Mar 13 08:57:05 2003 +0000 23.3 @@ -1,10 +1,8 @@ 23.4 /* 23.5 - * t2p: Create a PDF file from the contents of one or more TIFF 23.6 - * bilevel image files. The images in the resulting PDF file 23.7 - * will be compressed using ITU-T T.6 (G4) fax encoding. 23.8 + * tumble: build a PDF file from image files 23.9 * 23.10 * Semantic routines for spec file parser 23.11 - * $Id: semantics.h,v 1.12 2003/03/12 00:38:04 eric Exp $ 23.12 + * $Id: semantics.h,v 1.13 2003/03/13 00:57:05 eric Exp $ 23.13 * Copyright 2001, 2002, 2003 Eric Smith <eric@brouhaha.com> 23.14 * 23.15 * This program is free software; you can redistribute it and/or modify
24.1 --- a/t2p.c Thu Mar 13 08:03:11 2003 +0000 24.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 24.3 @@ -1,732 +0,0 @@ 24.4 -/* 24.5 - * t2p: Create a PDF file from the contents of one or more TIFF 24.6 - * bilevel image files. The images in the resulting PDF file 24.7 - * will be compressed using ITU-T T.6 (G4) fax encoding. 24.8 - * 24.9 - * Main program 24.10 - * $Id: t2p.c,v 1.31 2003/03/12 23:59:10 eric Exp $ 24.11 - * Copyright 2001, 2002, 2003 Eric Smith <eric@brouhaha.com> 24.12 - * 24.13 - * This program is free software; you can redistribute it and/or modify 24.14 - * it under the terms of the GNU General Public License version 2 as 24.15 - * published by the Free Software Foundation. Note that permission is 24.16 - * not granted to redistribute this program under the terms of any 24.17 - * other version of the General Public License. 24.18 - * 24.19 - * This program is distributed in the hope that it will be useful, 24.20 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 24.21 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 24.22 - * GNU General Public License for more details. 24.23 - * 24.24 - * You should have received a copy of the GNU General Public License 24.25 - * along with this program; if not, write to the Free Software 24.26 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA 24.27 - */ 24.28 - 24.29 - 24.30 -#include <stdarg.h> 24.31 -#include <stdbool.h> 24.32 -#include <stdint.h> 24.33 -#include <stdio.h> 24.34 -#include <stdlib.h> 24.35 -#include <string.h> 24.36 -#include <unistd.h> 24.37 - 24.38 -#include <tiffio.h> 24.39 -#define TIFF_REVERSE_BITS 24.40 - 24.41 -#include "bitblt.h" 24.42 -#include "semantics.h" 24.43 -#include "parser.tab.h" 24.44 -#include "t2p.h" 24.45 -#include "pdf.h" 24.46 - 24.47 - 24.48 -#define MAX_INPUT_FILES 5000 24.49 - 24.50 -#define POINTS_PER_INCH 72 24.51 - 24.52 -/* page size limited by Acrobat Reader to 45 inches on a side */ 24.53 -#define PAGE_MAX_INCHES 45 24.54 -#define PAGE_MAX_POINTS (PAGE_MAX_INCHES * POINTS_PER_INCH) 24.55 - 24.56 - 24.57 -typedef struct output_file_t 24.58 -{ 24.59 - struct output_file_t *next; 24.60 - char *name; 24.61 - pdf_file_handle pdf; 24.62 -} output_file_t; 24.63 - 24.64 - 24.65 -int verbose; 24.66 - 24.67 - 24.68 -char *in_filename; 24.69 -TIFF *in; 24.70 -output_file_t *output_files; 24.71 -output_file_t *out; 24.72 - 24.73 - 24.74 -char *progname; 24.75 - 24.76 - 24.77 -bool close_tiff_input_file (void); 24.78 -bool close_pdf_output_files (void); 24.79 - 24.80 - 24.81 -void usage (void) 24.82 -{ 24.83 - fprintf (stderr, "\n"); 24.84 - fprintf (stderr, "t2p - Copyright 2001-2003 Eric Smith <eric@brouhaha.com>\n"); 24.85 - fprintf (stderr, "http://www.brouhaha.com/~eric/software/t2p/\n"); 24.86 - fprintf (stderr, "\n"); 24.87 - fprintf (stderr, "usage:\n"); 24.88 - fprintf (stderr, " %s [options] -s spec\n", progname); 24.89 - fprintf (stderr, " %s [options] <input.tif>... -o <output.pdf>\n", progname); 24.90 - fprintf (stderr, "options:\n"); 24.91 - fprintf (stderr, " -v verbose\n"); 24.92 - fprintf (stderr, " -b fmt create bookmarks\n"); 24.93 - fprintf (stderr, "bookmark format:\n"); 24.94 - fprintf (stderr, " %%F file name (sans suffix)\n"); 24.95 - fprintf (stderr, " %%p page number\n"); 24.96 -} 24.97 - 24.98 - 24.99 -/* generate fatal error message to stderr, doesn't return */ 24.100 -void fatal (int ret, char *format, ...) 24.101 -{ 24.102 - va_list ap; 24.103 - 24.104 - fprintf (stderr, "fatal error"); 24.105 - if (format) 24.106 - { 24.107 - fprintf (stderr, ": "); 24.108 - va_start (ap, format); 24.109 - vfprintf (stderr, format, ap); 24.110 - va_end (ap); 24.111 - } 24.112 - else 24.113 - fprintf (stderr, "\n"); 24.114 - if (ret == 1) 24.115 - usage (); 24.116 - close_tiff_input_file (); 24.117 - close_pdf_output_files (); 24.118 - exit (ret); 24.119 -} 24.120 - 24.121 - 24.122 -bool close_tiff_input_file (void) 24.123 -{ 24.124 - if (in) 24.125 - { 24.126 - free (in_filename); 24.127 - TIFFClose (in); 24.128 - } 24.129 - in = NULL; 24.130 - in_filename = NULL; 24.131 - return (1); 24.132 -} 24.133 - 24.134 - 24.135 -bool open_tiff_input_file (char *name) 24.136 -{ 24.137 - if (in) 24.138 - { 24.139 - if (strcmp (name, in_filename) == 0) 24.140 - return (1); 24.141 - close_tiff_input_file (); 24.142 - } 24.143 - in_filename = strdup (name); 24.144 - if (! in_filename) 24.145 - { 24.146 - fprintf (stderr, "can't strdup input filename '%s'\n", name); 24.147 - return (0); 24.148 - } 24.149 - in = TIFFOpen (name, "r"); 24.150 - if (! in) 24.151 - { 24.152 - fprintf (stderr, "can't open input file '%s'\n", name); 24.153 - free (in_filename); 24.154 - return (0); 24.155 - } 24.156 - return (1); 24.157 -} 24.158 - 24.159 - 24.160 -bool close_pdf_output_files (void) 24.161 -{ 24.162 - output_file_t *o, *n; 24.163 - 24.164 - for (o = output_files; o; o = n) 24.165 - { 24.166 - n = o->next; 24.167 - pdf_close (o->pdf); 24.168 - free (o->name); 24.169 - free (o); 24.170 - } 24.171 - out = NULL; 24.172 - output_files = NULL; 24.173 - return (1); 24.174 -} 24.175 - 24.176 -bool open_pdf_output_file (char *name, 24.177 - pdf_file_attributes_t *attributes) 24.178 -{ 24.179 - output_file_t *o; 24.180 - 24.181 - if (out && (strcmp (name, out->name) == 0)) 24.182 - return (1); 24.183 - for (o = output_files; o; o = o->next) 24.184 - if (strcmp (name, o->name) == 0) 24.185 - { 24.186 - out = o; 24.187 - return (1); 24.188 - } 24.189 - o = calloc (1, sizeof (output_file_t)); 24.190 - if (! o) 24.191 - { 24.192 - fprintf (stderr, "can't calloc output file struct for '%s'\n", name); 24.193 - return (0); 24.194 - } 24.195 - 24.196 - o->name = strdup (name); 24.197 - if (! o->name) 24.198 - { 24.199 - fprintf (stderr, "can't strdup output filename '%s'\n", name); 24.200 - free (o); 24.201 - return (0); 24.202 - } 24.203 - 24.204 - o->pdf = pdf_create (name, (attributes->has_bookmarks ? 24.205 - PDF_PAGE_MODE_USE_OUTLINES : 24.206 - PDF_PAGE_MODE_USE_NONE)); 24.207 - if (! o->pdf) 24.208 - { 24.209 - fprintf (stderr, "can't open output file '%s'\n", name); 24.210 - free (o->name); 24.211 - free (o); 24.212 - return (0); 24.213 - } 24.214 - 24.215 - if (attributes->author) 24.216 - pdf_set_author (o->pdf, attributes->author); 24.217 - if (attributes->creator) 24.218 - pdf_set_creator (o->pdf, attributes->creator); 24.219 - if (attributes->title) 24.220 - pdf_set_title (o->pdf, attributes->title); 24.221 - if (attributes->subject) 24.222 - pdf_set_subject (o->pdf, attributes->subject); 24.223 - if (attributes->keywords) 24.224 - pdf_set_keywords (o->pdf, attributes->keywords); 24.225 - 24.226 - /* prepend new output file onto list */ 24.227 - o->next = output_files; 24.228 - output_files = o; 24.229 - 24.230 - out = o; 24.231 - return (1); 24.232 -} 24.233 - 24.234 - 24.235 -void process_page_numbers (int page_index, 24.236 - int count, 24.237 - int base, 24.238 - page_label_t *page_label) 24.239 -{ 24.240 -} 24.241 - 24.242 - 24.243 -/* frees original! */ 24.244 -static Bitmap *resize_bitmap (Bitmap *src, 24.245 - double x_resolution, 24.246 - double y_resolution, 24.247 - input_attributes_t input_attributes) 24.248 -{ 24.249 - Rect src_rect; 24.250 - Point dest_min; 24.251 - Bitmap *dest; 24.252 - 24.253 - int width_pixels = input_attributes.page_size.width * x_resolution; 24.254 - int height_pixels = input_attributes.page_size.height * y_resolution; 24.255 - 24.256 - src_rect.min.x = (rect_width (& src->rect) - width_pixels) / 2; 24.257 - src_rect.min.y = (rect_height (& src->rect) - height_pixels) / 2; 24.258 - src_rect.max.x = src_rect.min.x + width_pixels; 24.259 - src_rect.max.y = src_rect.min.y + height_pixels; 24.260 - 24.261 - dest_min.x = 0; 24.262 - dest_min.y = 0; 24.263 - 24.264 - dest = bitblt (src, & src_rect, NULL, & dest_min, TF_SRC, 0); 24.265 - free_bitmap (src); 24.266 - return (dest); 24.267 -} 24.268 - 24.269 - 24.270 -/* "in place" rotation */ 24.271 -static void rotate_bitmap (Bitmap *src, 24.272 - input_attributes_t input_attributes) 24.273 -{ 24.274 - switch (input_attributes.rotation) 24.275 - { 24.276 - case 0: break; 24.277 - case 90: rot_90 (src); break; 24.278 - case 180: rot_180 (src); break; 24.279 - case 270: rot_270 (src); break; 24.280 - default: 24.281 - fprintf (stderr, "rotation must be 0, 90, 180, or 270\n"); 24.282 - } 24.283 -} 24.284 - 24.285 - 24.286 -#define SWAP(type,a,b) do { type temp; temp = a; a = b; b = temp; } while (0) 24.287 - 24.288 - 24.289 -bool last_tiff_page (void) 24.290 -{ 24.291 - return (TIFFLastDirectory (in)); 24.292 -} 24.293 - 24.294 - 24.295 -bool process_tiff_page (int image, /* range 1 .. n */ 24.296 - input_attributes_t input_attributes, 24.297 - bookmark_t *bookmarks) 24.298 -{ 24.299 - int result = 0; 24.300 - 24.301 - uint32_t image_length, image_width; 24.302 - uint32_t dest_image_length, dest_image_width; 24.303 -#ifdef CHECK_DEPTH 24.304 - uint32_t image_depth; 24.305 -#endif 24.306 - 24.307 - uint16_t samples_per_pixel; 24.308 - uint16_t bits_per_sample; 24.309 - uint16_t planar_config; 24.310 - 24.311 - uint16_t resolution_unit; 24.312 - float x_resolution, y_resolution; 24.313 - double dest_x_resolution, dest_y_resolution; 24.314 - 24.315 - double width_points, height_points; /* really 1/72 inch units rather than 24.316 - points */ 24.317 - 24.318 - Rect rect; 24.319 - Bitmap *bitmap = NULL; 24.320 - 24.321 - int row; 24.322 - 24.323 - pdf_page_handle page; 24.324 - 24.325 - if (! TIFFSetDirectory (in, image - 1)) 24.326 - { 24.327 - fprintf (stderr, "can't find page %d of input file\n", image); 24.328 - goto fail; 24.329 - } 24.330 - if (1 != TIFFGetField (in, TIFFTAG_IMAGELENGTH, & image_length)) 24.331 - { 24.332 - fprintf (stderr, "can't get image length\n"); 24.333 - goto fail; 24.334 - } 24.335 - if (1 != TIFFGetField (in, TIFFTAG_IMAGEWIDTH, & image_width)) 24.336 - { 24.337 - fprintf (stderr, "can't get image width\n"); 24.338 - goto fail; 24.339 - } 24.340 - 24.341 - if (1 != TIFFGetField (in, TIFFTAG_SAMPLESPERPIXEL, & samples_per_pixel)) 24.342 - { 24.343 - fprintf (stderr, "can't get samples per pixel\n"); 24.344 - goto fail; 24.345 - } 24.346 - 24.347 -#ifdef CHECK_DEPTH 24.348 - if (1 != TIFFGetField (in, TIFFTAG_IMAGEDEPTH, & image_depth)) 24.349 - { 24.350 - fprintf (stderr, "can't get image depth\n"); 24.351 - goto fail; 24.352 - } 24.353 -#endif 24.354 - 24.355 - if (1 != TIFFGetField (in, TIFFTAG_BITSPERSAMPLE, & bits_per_sample)) 24.356 - { 24.357 - fprintf (stderr, "can't get bits per sample\n"); 24.358 - goto fail; 24.359 - } 24.360 - 24.361 - if (1 != TIFFGetField (in, TIFFTAG_PLANARCONFIG, & planar_config)) 24.362 - planar_config = 1; 24.363 - 24.364 - if (1 != TIFFGetField (in, TIFFTAG_RESOLUTIONUNIT, & resolution_unit)) 24.365 - resolution_unit = 2; 24.366 - if (1 != TIFFGetField (in, TIFFTAG_XRESOLUTION, & x_resolution)) 24.367 - x_resolution = 300; 24.368 - if (1 != TIFFGetField (in, TIFFTAG_YRESOLUTION, & y_resolution)) 24.369 - y_resolution = 300; 24.370 - 24.371 - if (samples_per_pixel != 1) 24.372 - { 24.373 - fprintf (stderr, "samples per pixel %u, must be 1\n", samples_per_pixel); 24.374 - goto fail; 24.375 - } 24.376 - 24.377 -#ifdef CHECK_DEPTH 24.378 - if (image_depth != 1) 24.379 - { 24.380 - fprintf (stderr, "image depth %u, must be 1\n", image_depth); 24.381 - goto fail; 24.382 - } 24.383 -#endif 24.384 - 24.385 - if (bits_per_sample != 1) 24.386 - { 24.387 - fprintf (stderr, "bits per sample %u, must be 1\n", bits_per_sample); 24.388 - goto fail; 24.389 - } 24.390 - 24.391 - if (planar_config != 1) 24.392 - { 24.393 - fprintf (stderr, "planar config %u, must be 1\n", planar_config); 24.394 - goto fail; 24.395 - } 24.396 - 24.397 - if (input_attributes.has_resolution) 24.398 - { 24.399 - x_resolution = input_attributes.x_resolution; 24.400 - y_resolution = input_attributes.y_resolution; 24.401 - } 24.402 - 24.403 - if ((input_attributes.rotation == 90) || (input_attributes.rotation == 270)) 24.404 - { 24.405 - dest_image_width = image_length; 24.406 - dest_image_length = image_width; 24.407 - dest_x_resolution = y_resolution; 24.408 - dest_y_resolution = x_resolution; 24.409 - SWAP (double, width_points, height_points); /* $$$ not yet set!!! */ 24.410 - } 24.411 - else 24.412 - { 24.413 - dest_image_width = image_width; 24.414 - dest_image_length = image_length; 24.415 - dest_x_resolution = x_resolution; 24.416 - dest_y_resolution = y_resolution; 24.417 - } 24.418 - 24.419 - rect.min.x = 0; 24.420 - rect.min.y = 0; 24.421 - rect.max.x = image_width; 24.422 - rect.max.y = image_length; 24.423 - 24.424 - bitmap = create_bitmap (& rect); 24.425 - 24.426 - if (! bitmap) 24.427 - { 24.428 - fprintf (stderr, "can't allocate bitmap\n"); 24.429 - goto fail; 24.430 - } 24.431 - 24.432 - for (row = 0; row < image_length; row++) 24.433 - if (1 != TIFFReadScanline (in, 24.434 - bitmap->bits + row * bitmap->row_words, 24.435 - row, 24.436 - 0)) 24.437 - { 24.438 - fprintf (stderr, "can't read TIFF scanline\n"); 24.439 - goto fail; 24.440 - } 24.441 - 24.442 -#ifdef TIFF_REVERSE_BITS 24.443 - reverse_bits ((uint8_t *) bitmap->bits, 24.444 - image_length * bitmap->row_words * sizeof (word_t)); 24.445 -#endif /* TIFF_REVERSE_BITS */ 24.446 - 24.447 -#if 0 24.448 - if (input_attributes.has_page_size) 24.449 - bitmap = resize_bitmap (bitmap, 24.450 - x_resolution, 24.451 - y_resolution, 24.452 - input_attributes); 24.453 -#endif 24.454 - 24.455 - rotate_bitmap (bitmap, 24.456 - input_attributes); 24.457 - 24.458 - width_points = (rect_width (& bitmap->rect) / dest_x_resolution) * POINTS_PER_INCH; 24.459 - height_points = (rect_height (& bitmap->rect) / dest_y_resolution) * POINTS_PER_INCH; 24.460 - 24.461 - if ((height_points > PAGE_MAX_POINTS) || (width_points > PAGE_MAX_POINTS)) 24.462 - { 24.463 - fprintf (stdout, "image too large (max %d inches on a side\n", PAGE_MAX_INCHES); 24.464 - goto fail; 24.465 - } 24.466 - 24.467 - page = pdf_new_page (out->pdf, width_points, height_points); 24.468 - 24.469 -#if 0 24.470 - pdf_write_text (page); 24.471 -#else 24.472 - pdf_write_g4_fax_image (page, 24.473 - 0, 0, /* x, y */ 24.474 - width_points, height_points, 24.475 - bitmap, 24.476 - 0, /* ImageMask */ 24.477 - 0, 0, 0, /* r, g, b */ 24.478 - 0); /* BlackIs1 */ 24.479 -#endif 24.480 - 24.481 - while (bookmarks) 24.482 - { 24.483 - /* $$$ need to handle level here */ 24.484 - pdf_new_bookmark (NULL, bookmarks->name, 0, page); 24.485 - bookmarks = bookmarks->next; 24.486 - } 24.487 - 24.488 - result = 1; 24.489 - 24.490 - fail: 24.491 - if (bitmap) 24.492 - free_bitmap (bitmap); 24.493 - 24.494 - return (result); 24.495 -} 24.496 - 24.497 - 24.498 -#if 0 24.499 -bool process_jpeg_page (int image, /* range 1 .. n */ 24.500 - input_attributes_t input_attributes, 24.501 - bookmark_t *bookmarks) 24.502 -{ 24.503 - int result = 0; 24.504 - FILE *f; 24.505 - pdf_page_handle page; 24.506 - 24.507 - f = fopen (filename, "rb"); 24.508 - if (! f) 24.509 - fatal ("error opening input file '%s'\n", filename); 24.510 - 24.511 - page = pdf_new_page (out->pdf, width_points, height_points); 24.512 - 24.513 - pdf_write_jpeg_image (page, 24.514 - 0, 0, /* x, y */ 24.515 - width_points, height_points, 24.516 - f); 24.517 - 24.518 - return (result); 24.519 -} 24.520 -#endif 24.521 - 24.522 - 24.523 -bool process_page (int image, /* range 1 .. n */ 24.524 - input_attributes_t input_attributes, 24.525 - bookmark_t *bookmarks) 24.526 -{ 24.527 - int result = 0; 24.528 - 24.529 - result = process_tiff_page (image, input_attributes, bookmarks); 24.530 - 24.531 - return (result); 24.532 -} 24.533 - 24.534 - 24.535 -#define MAX_BOOKMARK_NAME_LEN 500 24.536 - 24.537 - 24.538 -static int filename_length_without_suffix (char *in_fn) 24.539 -{ 24.540 - char *p; 24.541 - int len = strlen (in_fn); 24.542 - 24.543 - p = strrchr (in_fn, '.'); 24.544 - if (p && ((strcasecmp (p, ".tif") == 0) || 24.545 - (strcasecmp (p, ".tiff") == 0))) 24.546 - return (p - in_fn); 24.547 - return (len); 24.548 -} 24.549 - 24.550 - 24.551 -/* $$$ this function should ensure that it doesn't overflow the name string! */ 24.552 -static void generate_bookmark_name (char *name, 24.553 - char *bookmark_fmt, 24.554 - char *in_fn, 24.555 - int page) 24.556 -{ 24.557 - bool meta = 0; 24.558 - int len; 24.559 - 24.560 - while (*bookmark_fmt) 24.561 - { 24.562 - if (meta) 24.563 - { 24.564 - meta = 0; 24.565 - switch (*bookmark_fmt) 24.566 - { 24.567 - case '%': 24.568 - *(name++) = '%'; 24.569 - break; 24.570 - case 'F': 24.571 - len = filename_length_without_suffix (in_fn); 24.572 - strncpy (name, in_fn, len); 24.573 - name += len; 24.574 - break; 24.575 - case 'p': 24.576 - sprintf (name, "%d", page); 24.577 - name += strlen (name); 24.578 - break; 24.579 - default: 24.580 - break; 24.581 - } 24.582 - } 24.583 - else 24.584 - switch (*bookmark_fmt) 24.585 - { 24.586 - case '%': 24.587 - meta = 1; 24.588 - break; 24.589 - default: 24.590 - *(name++) = *bookmark_fmt; 24.591 - } 24.592 - bookmark_fmt++; 24.593 - } 24.594 - *name = '\0'; 24.595 -} 24.596 - 24.597 - 24.598 -void main_args (char *out_fn, 24.599 - int inf_count, 24.600 - char **in_fn, 24.601 - char *bookmark_fmt) 24.602 -{ 24.603 - int i, ip; 24.604 - input_attributes_t input_attributes; 24.605 - pdf_file_attributes_t output_attributes; 24.606 - bookmark_t bookmark; 24.607 - char bookmark_name [MAX_BOOKMARK_NAME_LEN]; 24.608 - 24.609 - bookmark.next = NULL; 24.610 - bookmark.level = 1; 24.611 - bookmark.name = & bookmark_name [0]; 24.612 - 24.613 - memset (& input_attributes, 0, sizeof (input_attributes)); 24.614 - memset (& output_attributes, 0, sizeof (output_attributes)); 24.615 - 24.616 - output_attributes.has_bookmarks = (bookmark_fmt != NULL); 24.617 - 24.618 - if (! open_pdf_output_file (out_fn, & output_attributes)) 24.619 - fatal (3, "error opening output file \"%s\"\n", out_fn); 24.620 - for (i = 0; i < inf_count; i++) 24.621 - { 24.622 - if (! open_tiff_input_file (in_fn [i])) 24.623 - fatal (3, "error opening input file \"%s\"\n", in_fn [i]); 24.624 - for (ip = 1;; ip++) 24.625 - { 24.626 - fprintf (stderr, "processing page %d of file \"%s\"\r", ip, in_fn [i]); 24.627 - if (bookmark_fmt) 24.628 - generate_bookmark_name (& bookmark_name [0], 24.629 - bookmark_fmt, 24.630 - in_fn [i], 24.631 - ip); 24.632 - if (! process_page (ip, input_attributes, 24.633 - bookmark_fmt ? & bookmark : NULL)) 24.634 - fatal (3, "error processing page %d of input file \"%s\"\n", ip, in_fn [i]); 24.635 - if (last_tiff_page ()) 24.636 - break; 24.637 - } 24.638 - if (verbose) 24.639 - fprintf (stderr, "processed %d pages of input file \"%s\"\n", ip, in_fn [i]); 24.640 - if (! close_tiff_input_file ()) 24.641 - fatal (3, "error closing input file \"%s\"\n", in_fn [i]); 24.642 - } 24.643 - if (! close_pdf_output_files ()) 24.644 - fatal (3, "error closing output file \"%s\"\n", out_fn); 24.645 -} 24.646 - 24.647 - 24.648 -void main_spec (char *spec_fn) 24.649 -{ 24.650 - if (! parse_spec_file (spec_fn)) 24.651 - fatal (2, "error parsing spec file\n"); 24.652 - if (! process_specs ()) 24.653 - fatal (3, "error processing spec file\n"); 24.654 -} 24.655 - 24.656 - 24.657 -int main (int argc, char *argv[]) 24.658 -{ 24.659 - char *spec_fn = NULL; 24.660 - char *out_fn = NULL; 24.661 - char *bookmark_fmt = NULL; 24.662 - int inf_count = 0; 24.663 - char *in_fn [MAX_INPUT_FILES]; 24.664 - 24.665 - progname = argv [0]; 24.666 - 24.667 - pdf_init (); 24.668 - 24.669 - while (--argc) 24.670 - { 24.671 - if (argv [1][0] == '-') 24.672 - { 24.673 - if (strcmp (argv [1], "-v") == 0) 24.674 - verbose++; 24.675 - else if (strcmp (argv [1], "-o") == 0) 24.676 - { 24.677 - if (argc) 24.678 - { 24.679 - argc--; 24.680 - argv++; 24.681 - out_fn = argv [1]; 24.682 - } 24.683 - else 24.684 - fatal (1, "missing filename after \"-o\" option\n"); 24.685 - } 24.686 - else if (strcmp (argv [1], "-s") == 0) 24.687 - { 24.688 - if (argc) 24.689 - { 24.690 - argc--; 24.691 - argv++; 24.692 - spec_fn = argv [1]; 24.693 - } 24.694 - else 24.695 - fatal (1, "missing filename after \"-s\" option\n"); 24.696 - } 24.697 - else if (strcmp (argv [1], "-b") == 0) 24.698 - { 24.699 - if (argc) 24.700 - { 24.701 - argc--; 24.702 - argv++; 24.703 - bookmark_fmt = argv [1]; 24.704 - } 24.705 - else 24.706 - fatal (1, "missing format string after \"-b\" option\n"); 24.707 - } 24.708 - else 24.709 - fatal (1, "unrecognized option \"%s\"\n", argv [1]); 24.710 - } 24.711 - else if (inf_count < MAX_INPUT_FILES) 24.712 - in_fn [inf_count++] = argv [1]; 24.713 - else 24.714 - fatal (1, "exceeded maximum of %d input files\n", MAX_INPUT_FILES); 24.715 - argv++; 24.716 - } 24.717 - 24.718 - if (! ((! out_fn) ^ (! spec_fn))) 24.719 - fatal (1, "either a spec file or an output file (but not both) must be specified\n"); 24.720 - 24.721 - if (out_fn && ! inf_count) 24.722 - fatal (1, "no input files specified\n"); 24.723 - 24.724 - if (spec_fn && inf_count) 24.725 - fatal (1, "if spec file is provided, input files can't be specified as arguments\n"); 24.726 - 24.727 - if (spec_fn) 24.728 - main_spec (spec_fn); 24.729 - else 24.730 - main_args (out_fn, inf_count, in_fn, bookmark_fmt); 24.731 - 24.732 - close_tiff_input_file (); 24.733 - close_pdf_output_files (); 24.734 - exit (0); 24.735 -}
25.1 --- a/t2p.h Thu Mar 13 08:03:11 2003 +0000 25.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 25.3 @@ -1,71 +0,0 @@ 25.4 -/* 25.5 - * t2p: Create a PDF file from the contents of one or more TIFF 25.6 - * bilevel image files. The images in the resulting PDF file 25.7 - * will be compressed using ITU-T T.6 (G4) fax encoding. 25.8 - * 25.9 - * $Id: t2p.h,v 1.12 2003/03/12 23:59:10 eric Exp $ 25.10 - * Copyright 2001, 2002, 2003 Eric Smith <eric@brouhaha.com> 25.11 - * 25.12 - * This program is free software; you can redistribute it and/or modify 25.13 - * it under the terms of the GNU General Public License version 2 as 25.14 - * published by the Free Software Foundation. Note that permission is 25.15 - * not granted to redistribute this program under the terms of any 25.16 - * other version of the General Public License. 25.17 - * 25.18 - * This program is distributed in the hope that it will be useful, 25.19 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 25.20 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25.21 - * GNU General Public License for more details. 25.22 - * 25.23 - * You should have received a copy of the GNU General Public License 25.24 - * along with this program; if not, write to the Free Software 25.25 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA */ 25.26 - 25.27 - 25.28 -extern int verbose; 25.29 - 25.30 - 25.31 -typedef struct 25.32 -{ 25.33 - bool has_resolution; 25.34 - double x_resolution; 25.35 - double y_resolution; 25.36 - 25.37 - bool has_page_size; 25.38 - page_size_t page_size; 25.39 - 25.40 - bool has_rotation; 25.41 - int rotation; 25.42 - 25.43 - bool has_crop; 25.44 - crop_t crop; 25.45 -} input_attributes_t; 25.46 - 25.47 -bool open_tiff_input_file (char *name); 25.48 -bool close_tiff_input_file (void); 25.49 - 25.50 - 25.51 -typedef struct 25.52 -{ 25.53 - char *author; 25.54 - char *creator; 25.55 - char *title; 25.56 - char *subject; 25.57 - char *keywords; 25.58 - bool has_bookmarks; 25.59 -} pdf_file_attributes_t; 25.60 - 25.61 -bool open_pdf_output_file (char *name, 25.62 - pdf_file_attributes_t *attributes); 25.63 - 25.64 - 25.65 -void process_page_numbers (int page_index, 25.66 - int count, 25.67 - int base, 25.68 - page_label_t *page_label); 25.69 - 25.70 - 25.71 - 25.72 -bool process_page (int image, /* range 1 .. n */ 25.73 - input_attributes_t input_attributes, 25.74 - bookmark_t *bookmarks);
26.1 --- a/tumble.c Thu Mar 13 08:03:11 2003 +0000 26.2 +++ b/tumble.c Thu Mar 13 08:57:05 2003 +0000 26.3 @@ -1,10 +1,8 @@ 26.4 /* 26.5 - * t2p: Create a PDF file from the contents of one or more TIFF 26.6 - * bilevel image files. The images in the resulting PDF file 26.7 - * will be compressed using ITU-T T.6 (G4) fax encoding. 26.8 + * tumble: build a PDF file from image files 26.9 * 26.10 * Main program 26.11 - * $Id: tumble.c,v 1.31 2003/03/12 23:59:10 eric Exp $ 26.12 + * $Id: tumble.c,v 1.32 2003/03/13 00:57:05 eric Exp $ 26.13 * Copyright 2001, 2002, 2003 Eric Smith <eric@brouhaha.com> 26.14 * 26.15 * This program is free software; you can redistribute it and/or modify 26.16 @@ -38,7 +36,7 @@ 26.17 #include "bitblt.h" 26.18 #include "semantics.h" 26.19 #include "parser.tab.h" 26.20 -#include "t2p.h" 26.21 +#include "tumble.h" 26.22 #include "pdf.h" 26.23 26.24 26.25 @@ -78,8 +76,8 @@ 26.26 void usage (void) 26.27 { 26.28 fprintf (stderr, "\n"); 26.29 - fprintf (stderr, "t2p - Copyright 2001-2003 Eric Smith <eric@brouhaha.com>\n"); 26.30 - fprintf (stderr, "http://www.brouhaha.com/~eric/software/t2p/\n"); 26.31 + fprintf (stderr, "tumble - Copyright 2001-2003 Eric Smith <eric@brouhaha.com>\n"); 26.32 + fprintf (stderr, "http://www.brouhaha.com/~eric/software/tumble/\n"); 26.33 fprintf (stderr, "\n"); 26.34 fprintf (stderr, "usage:\n"); 26.35 fprintf (stderr, " %s [options] -s spec\n", progname);
27.1 --- a/tumble.h Thu Mar 13 08:03:11 2003 +0000 27.2 +++ b/tumble.h Thu Mar 13 08:57:05 2003 +0000 27.3 @@ -1,9 +1,7 @@ 27.4 /* 27.5 - * t2p: Create a PDF file from the contents of one or more TIFF 27.6 - * bilevel image files. The images in the resulting PDF file 27.7 - * will be compressed using ITU-T T.6 (G4) fax encoding. 27.8 + * tumble: build a PDF file from image files 27.9 * 27.10 - * $Id: tumble.h,v 1.12 2003/03/12 23:59:10 eric Exp $ 27.11 + * $Id: tumble.h,v 1.13 2003/03/13 00:57:05 eric Exp $ 27.12 * Copyright 2001, 2002, 2003 Eric Smith <eric@brouhaha.com> 27.13 * 27.14 * This program is free software; you can redistribute it and/or modify