Mon, 26 Aug 2002 06:03:55 +0000
now use C99 stdint.h and stdbool.h
Makefile | file | annotate | diff | revisions | |
bitblt.c | file | annotate | diff | revisions | |
bitblt.h | file | annotate | diff | revisions | |
bitblt_test.c | file | annotate | diff | revisions | |
parser.y | file | annotate | diff | revisions | |
scanner.l | file | annotate | diff | revisions | |
semantics.c | file | annotate | diff | revisions | |
semantics.h | file | annotate | diff | revisions | |
t2p.c | file | annotate | diff | revisions | |
t2p.h | file | annotate | diff | revisions | |
tumble.c | file | annotate | diff | revisions | |
tumble.h | file | annotate | diff | revisions | |
type.h | file | annotate | diff | revisions |
1.1 diff -r bfc6aaa089b0 -r 3d0be1c1c1b2 Makefile 1.2 --- a/Makefile Mon Aug 26 05:43:49 2002 +0000 1.3 +++ b/Makefile Mon Aug 26 06:03:55 2002 +0000 1.4 @@ -1,6 +1,6 @@ 1.5 # t2p: build a PDF file out of one or more TIFF Class F Group 4 files 1.6 # Makefile 1.7 -# $Id: Makefile,v 1.9 2002/01/30 00:55:53 eric Exp $ 1.8 +# $Id: Makefile,v 1.10 2002/08/25 22:03:55 eric Exp $ 1.9 # Copyright 2001 Eric Smith <eric@brouhaha.com> 1.10 # 1.11 # This program is free software; you can redistribute it and/or modify 1.12 @@ -25,7 +25,7 @@ 1.13 YFLAGS = -d -v 1.14 1.15 SRCS = bitblt.c bitblt_test.c t2p.c semantics.c 1.16 -HDRS = type.h bitblt.h t2p.h semantics.h 1.17 +HDRS = bitblt.h t2p.h semantics.h 1.18 MISC = Makefile scanner.l parser.y 1.19 1.20 TARGETS = t2p bitblt_test
2.1 diff -r bfc6aaa089b0 -r 3d0be1c1c1b2 bitblt.c 2.2 --- a/bitblt.c Mon Aug 26 05:43:49 2002 +0000 2.3 +++ b/bitblt.c Mon Aug 26 06:03:55 2002 +0000 2.4 @@ -1,16 +1,17 @@ 2.5 +#include <stdbool.h> 2.6 +#include <stdint.h> 2.7 #include <assert.h> 2.8 #include <stdio.h> 2.9 #include <stdlib.h> 2.10 #include <string.h> 2.11 2.12 -#include "type.h" 2.13 #include "bitblt.h" 2.14 2.15 2.16 #define DIV_ROUND_UP(count,pow2) (((count) - 1) / (pow2) + 1) 2.17 2.18 2.19 -static const u8 bit_reverse_byte [0x100] = 2.20 +static const uint8_t bit_reverse_byte [0x100] = 2.21 { 2.22 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, 2.23 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0, 2.24 @@ -47,7 +48,7 @@ 2.25 }; 2.26 2.27 2.28 -void reverse_bits (u8 *p, int byte_count) 2.29 +void reverse_bits (uint8_t *p, int byte_count) 2.30 { 2.31 while (byte_count--) 2.32 { 2.33 @@ -69,7 +70,7 @@ 2.34 static word_type *temp_buffer; 2.35 static word_type temp_buffer_size; 2.36 2.37 -static void realloc_temp_buffer (u32 size) 2.38 +static void realloc_temp_buffer (uint32_t size) 2.39 { 2.40 if (size <= temp_buffer_size) 2.41 return; 2.42 @@ -121,8 +122,8 @@ 2.43 Bitmap *create_bitmap (Rect *rect) 2.44 { 2.45 Bitmap *bitmap; 2.46 - u32 width = rect_width (rect); 2.47 - u32 height = rect_height (rect); 2.48 + uint32_t width = rect_width (rect); 2.49 + uint32_t height = rect_height (rect); 2.50 2.51 if ((width <= 0) || (height <= 0)) 2.52 return (NULL); 2.53 @@ -147,7 +148,7 @@ 2.54 free (bitmap); 2.55 } 2.56 2.57 -boolean get_pixel (Bitmap *bitmap, Point coord) 2.58 +bool get_pixel (Bitmap *bitmap, Point coord) 2.59 { 2.60 word_type *p; 2.61 int w,b; 2.62 @@ -165,7 +166,7 @@ 2.63 return (((*p) & pixel_mask (b)) != 0); 2.64 } 2.65 2.66 -void set_pixel (Bitmap *bitmap, Point coord, boolean value) 2.67 +void set_pixel (Bitmap *bitmap, Point coord, bool value) 2.68 { 2.69 word_type *p; 2.70 int w,b; 2.71 @@ -189,7 +190,7 @@ 2.72 2.73 /* modifies rect1 to be the intersection of rect1 and rect2; 2.74 returns true if intersection is non-null */ 2.75 -static boolean clip_rect (Rect *rect1, Rect *rect2) 2.76 +static bool clip_rect (Rect *rect1, Rect *rect2) 2.77 { 2.78 if (rect1->min.y > rect2->max.y) 2.79 goto empty; 2.80 @@ -223,12 +224,12 @@ 2.81 static void blt_background (Bitmap *dest_bitmap, 2.82 Rect dest_rect) 2.83 { 2.84 - u32 y; 2.85 + uint32_t y; 2.86 word_type *rp; 2.87 - u32 left_bit, left_word; 2.88 - u32 right_bit, right_word; 2.89 + uint32_t left_bit, left_word; 2.90 + uint32_t right_bit, right_word; 2.91 word_type left_mask, right_mask; 2.92 - s32 word_count; 2.93 + int32_t word_count; 2.94 2.95 /* This function requires a non-null dest rect */ 2.96 assert (dest_rect.min.x < dest_rect.max.x); 2.97 @@ -289,7 +290,7 @@ 2.98 /* use Duff's Device for the full words */ 2.99 if (word_count) 2.100 { 2.101 - s32 i = word_count; 2.102 + int32_t i = word_count; 2.103 switch (i % 8) 2.104 { 2.105 while (i > 0) 2.106 @@ -323,7 +324,7 @@ 2.107 Bitmap *dest_bitmap, 2.108 Rect *dest_rect) 2.109 { 2.110 - s32 y; 2.111 + int32_t y; 2.112 word_type *rp; 2.113 2.114 /* This function requires a non-null src rect */ 2.115 @@ -402,18 +403,18 @@ 2.116 { 2.117 Rect sr, dr; /* src and dest rects, clipped to visible portion of 2.118 dest rect */ 2.119 - u32 drw, drh; /* dest rect width, height - gets adjusted */ 2.120 + uint32_t drw, drh; /* dest rect width, height - gets adjusted */ 2.121 Point src_point, dest_point; 2.122 2.123 /* dest coordinates: */ 2.124 - u32 x0, x1, x2, x3; 2.125 - u32 y0, y1, y2, y3; 2.126 + uint32_t x0, x1, x2, x3; 2.127 + uint32_t y0, y1, y2, y3; 2.128 2.129 { 2.130 sr = * src_rect; 2.131 2.132 - u32 srw = rect_width (& sr); 2.133 - u32 srh = rect_height (& sr); 2.134 + uint32_t srw = rect_width (& sr); 2.135 + uint32_t srh = rect_height (& sr); 2.136 2.137 if ((srw < 0) || (srh < 0)) 2.138 goto done; /* the source rect is empty! */ 2.139 @@ -595,7 +596,7 @@ 2.140 src_point.x < src_rect->max.x; 2.141 src_point.x++) 2.142 { 2.143 - boolean a; 2.144 + bool a; 2.145 2.146 dest_point.x = dest_min->x + src_point.x - src_rect->min.x; 2.147 2.148 @@ -616,7 +617,7 @@ 2.149 src_point.x < src_rect->max.x; 2.150 src_point.x++) 2.151 { 2.152 - boolean a, b, c; 2.153 + bool a, b, c; 2.154 2.155 dest_point.x = dest_min->x + src_point.x - src_rect->min.x; 2.156 2.157 @@ -639,7 +640,7 @@ 2.158 word_type *rp; /* row pointer */ 2.159 word_type *p1; /* work src ptr */ 2.160 word_type *p2; /* work dest ptr */ 2.161 - s32 y; 2.162 + int32_t y; 2.163 int shift1, shift2; 2.164 2.165 realloc_temp_buffer ((src->row_words + 1) * sizeof (word_type)); 2.166 @@ -713,7 +714,7 @@ 2.167 /* "in-place" transformations - will allocate new memory and free old */ 2.168 void transpose (Bitmap *src) 2.169 { 2.170 - u32 new_row_words = DIV_ROUND_UP (rect_height (& src->rect), 32); 2.171 + uint32_t new_row_words = DIV_ROUND_UP (rect_height (& src->rect), 32); 2.172 word_type *new_bits; 2.173 2.174 new_bits = calloc (1, new_row_words * rect_width (& src->rect) * sizeof (word_type));
3.1 diff -r bfc6aaa089b0 -r 3d0be1c1c1b2 bitblt.h 3.2 --- a/bitblt.h Mon Aug 26 05:43:49 2002 +0000 3.3 +++ b/bitblt.h Mon Aug 26 06:03:55 2002 +0000 3.4 @@ -1,7 +1,7 @@ 3.5 typedef struct Point 3.6 { 3.7 - s32 x; 3.8 - s32 y; 3.9 + int32_t x; 3.10 + int32_t y; 3.11 } Point; 3.12 3.13 typedef struct Rect 3.14 @@ -10,18 +10,18 @@ 3.15 Point max; 3.16 } Rect; 3.17 3.18 -static inline s32 rect_width (Rect *r) 3.19 +static inline int32_t rect_width (Rect *r) 3.20 { 3.21 return (r->max.x - r->min.x); 3.22 } 3.23 3.24 -static inline s32 rect_height (Rect *r) 3.25 +static inline int32_t rect_height (Rect *r) 3.26 { 3.27 return (r->max.y - r->min.y); 3.28 } 3.29 3.30 3.31 -typedef u32 word_type; 3.32 +typedef uint32_t word_type; 3.33 #define BITS_PER_WORD (8 * sizeof (word_type)) 3.34 #define ALL_ONES (~ 0U) 3.35 3.36 @@ -30,7 +30,7 @@ 3.37 { 3.38 word_type *bits; 3.39 Rect rect; 3.40 - u32 row_words; 3.41 + uint32_t row_words; 3.42 } Bitmap; 3.43 3.44 3.45 @@ -43,8 +43,8 @@ 3.46 Bitmap *create_bitmap (Rect *rect); 3.47 void free_bitmap (Bitmap *bitmap); 3.48 3.49 -boolean get_pixel (Bitmap *bitmap, Point coord); 3.50 -void set_pixel (Bitmap *bitmap, Point coord, boolean value); 3.51 +bool get_pixel (Bitmap *bitmap, Point coord); 3.52 +void set_pixel (Bitmap *bitmap, Point coord, bool value); 3.53 3.54 3.55 Bitmap *bitblt (Bitmap *src_bitmap, 3.56 @@ -68,4 +68,4 @@ 3.57 void rot_270 (Bitmap *src); /* transpose + flip_v */ 3.58 3.59 3.60 -void reverse_bits (u8 *p, int byte_count); 3.61 +void reverse_bits (uint8_t *p, int byte_count);
4.1 diff -r bfc6aaa089b0 -r 3d0be1c1c1b2 bitblt_test.c 4.2 --- a/bitblt_test.c Mon Aug 26 05:43:49 2002 +0000 4.3 +++ b/bitblt_test.c Mon Aug 26 06:03:55 2002 +0000 4.4 @@ -1,7 +1,8 @@ 4.5 +#include <stdbool.h> 4.6 +#include <stdint.h> 4.7 #include <stdio.h> 4.8 #include <stdlib.h> 4.9 4.10 -#include "type.h" 4.11 #include "bitblt.h" 4.12 4.13
5.1 diff -r bfc6aaa089b0 -r 3d0be1c1c1b2 parser.y 5.2 --- a/parser.y Mon Aug 26 05:43:49 2002 +0000 5.3 +++ b/parser.y Mon Aug 26 06:03:55 2002 +0000 5.4 @@ -1,6 +1,7 @@ 5.5 %{ 5.6 + #include <stdbool.h> 5.7 + #include <stdint.h> 5.8 #include <stdio.h> 5.9 - #include "type.h" 5.10 #include "semantics.h" 5.11 %} 5.12 5.13 @@ -186,7 +187,7 @@ 5.14 5.15 output_file_clause: 5.16 FILE_KEYWORD STRING { output_set_file ($2); } 5.17 - pdf_file_attributes ';' 5.18 + pdf_file_attributes ';' ; 5.19 5.20 label_clause: 5.21 LABEL ';' { page_label_t label = { NULL, '\0' }; output_set_page_label (label); }
6.1 diff -r bfc6aaa089b0 -r 3d0be1c1c1b2 scanner.l 6.2 --- a/scanner.l Mon Aug 26 05:43:49 2002 +0000 6.3 +++ b/scanner.l Mon Aug 26 06:03:55 2002 +0000 6.4 @@ -1,14 +1,15 @@ 6.5 /* 6.6 -$Id: scanner.l,v 1.15 2002/01/02 02:17:24 eric Exp $ 6.7 +$Id: scanner.l,v 1.16 2002/08/25 22:02:31 eric Exp $ 6.8 */ 6.9 6.10 %option case-insensitive 6.11 %option noyywrap 6.12 6.13 %{ 6.14 +#include <stdbool.h> 6.15 +#include <stdint.h> 6.16 #include <stdio.h> 6.17 #include <string.h> 6.18 -#include "type.h" 6.19 #include "semantics.h" 6.20 #include "parser.tab.h" 6.21
7.1 diff -r bfc6aaa089b0 -r 3d0be1c1c1b2 semantics.c 7.2 --- a/semantics.c Mon Aug 26 05:43:49 2002 +0000 7.3 +++ b/semantics.c Mon Aug 26 06:03:55 2002 +0000 7.4 @@ -1,8 +1,9 @@ 7.5 +#include <stdbool.h> 7.6 +#include <stdint.h> 7.7 #include <stdlib.h> 7.8 #include <string.h> 7.9 #include <stdio.h> 7.10 7.11 -#include "type.h" 7.12 #include "semantics.h" 7.13 #include "parser.tab.h" 7.14 #include "t2p.h" 7.15 @@ -10,13 +11,13 @@ 7.16 7.17 typedef struct 7.18 { 7.19 - boolean has_page_size; 7.20 + bool has_page_size; 7.21 page_size_t page_size; 7.22 7.23 - boolean has_rotation; 7.24 + bool has_rotation; 7.25 int rotation; 7.26 7.27 - boolean has_crop; 7.28 + bool has_crop; 7.29 crop_t crop; 7.30 } input_modifiers_t; 7.31 7.32 @@ -57,7 +58,7 @@ 7.33 bookmark_t *first_bookmark; 7.34 bookmark_t *last_bookmark; 7.35 7.36 - boolean has_page_label; 7.37 + bool has_page_label; 7.38 page_label_t page_label; 7.39 } output_context_t; 7.40 7.41 @@ -432,9 +433,9 @@ 7.42 exit (2); 7.43 } 7.44 7.45 -static boolean get_input_rotation (input_context_t *context, 7.46 - input_modifier_type_t type, 7.47 - int *rotation) 7.48 +static bool get_input_rotation (input_context_t *context, 7.49 + input_modifier_type_t type, 7.50 + int *rotation) 7.51 { 7.52 for (; context; context = context->parent) 7.53 { 7.54 @@ -452,9 +453,9 @@ 7.55 return (0); /* default */ 7.56 } 7.57 7.58 -static boolean get_input_page_size (input_context_t *context, 7.59 - input_modifier_type_t type, 7.60 - page_size_t *page_size) 7.61 +static bool get_input_page_size (input_context_t *context, 7.62 + input_modifier_type_t type, 7.63 + page_size_t *page_size) 7.64 { 7.65 for (; context; context = context->parent) 7.66 { 7.67 @@ -510,7 +511,7 @@ 7.68 for (i = image->range.first; i <= image->range.last; i++) 7.69 { 7.70 input_modifier_type_t parity = (i % 2) ? INPUT_MODIFIER_ODD : INPUT_MODIFIER_EVEN; 7.71 - boolean has_rotation, has_page_size; 7.72 + bool has_rotation, has_page_size; 7.73 int rotation; 7.74 page_size_t page_size; 7.75 7.76 @@ -571,9 +572,9 @@ 7.77 } 7.78 7.79 7.80 -boolean parse_spec_file (char *fn) 7.81 +bool parse_spec_file (char *fn) 7.82 { 7.83 - boolean result = 0; 7.84 + bool result = 0; 7.85 7.86 yyin = fopen (fn, "r"); 7.87 if (! yyin) 7.88 @@ -617,7 +618,7 @@ 7.89 } 7.90 7.91 7.92 -boolean process_specs (void) 7.93 +bool process_specs (void) 7.94 { 7.95 input_image_t *image = NULL; 7.96 output_page_t *page = NULL;
8.1 diff -r bfc6aaa089b0 -r 3d0be1c1c1b2 semantics.h 8.2 --- a/semantics.h Mon Aug 26 05:43:49 2002 +0000 8.3 +++ b/semantics.h Mon Aug 26 06:03:55 2002 +0000 8.4 @@ -72,5 +72,5 @@ 8.5 8.6 8.7 /* functions to be called from main program: */ 8.8 -boolean parse_spec_file (char *fn); 8.9 -boolean process_specs (void); 8.10 +bool parse_spec_file (char *fn); 8.11 +bool process_specs (void);
9.1 diff -r bfc6aaa089b0 -r 3d0be1c1c1b2 t2p.c 9.2 --- a/t2p.c Mon Aug 26 05:43:49 2002 +0000 9.3 +++ b/t2p.c Mon Aug 26 06:03:55 2002 +0000 9.4 @@ -4,7 +4,7 @@ 9.5 * will be compressed using ITU-T T.6 (G4) fax encoding. 9.6 * 9.7 * Main program 9.8 - * $Id: t2p.c,v 1.18 2002/08/25 21:43:49 eric Exp $ 9.9 + * $Id: t2p.c,v 1.19 2002/08/25 22:02:31 eric Exp $ 9.10 * Copyright 2001 Eric Smith <eric@brouhaha.com> 9.11 * 9.12 * This program is free software; you can redistribute it and/or modify 9.13 @@ -23,6 +23,8 @@ 9.14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA */ 9.15 9.16 9.17 +#include <stdbool.h> 9.18 +#include <stdint.h> 9.19 #include <stdio.h> 9.20 #include <stdlib.h> 9.21 #include <unistd.h> 9.22 @@ -33,7 +35,6 @@ 9.23 #include <panda/functions.h> 9.24 #include <panda/constants.h> 9.25 9.26 -#include "type.h" 9.27 #include "bitblt.h" 9.28 #include "semantics.h" 9.29 #include "parser.tab.h" 9.30 @@ -62,7 +63,7 @@ 9.31 /* panda_pdf *out; */ 9.32 9.33 9.34 -boolean close_tiff_input_file (void) 9.35 +bool close_tiff_input_file (void) 9.36 { 9.37 if (in) 9.38 { 9.39 @@ -74,7 +75,7 @@ 9.40 return (1); 9.41 } 9.42 9.43 -boolean open_tiff_input_file (char *name) 9.44 +bool open_tiff_input_file (char *name) 9.45 { 9.46 if (in) 9.47 { 9.48 @@ -99,7 +100,7 @@ 9.49 } 9.50 9.51 9.52 -boolean close_pdf_output_files (void) 9.53 +bool close_pdf_output_files (void) 9.54 { 9.55 output_file_t *o, *n; 9.56 9.57 @@ -115,8 +116,8 @@ 9.58 return (1); 9.59 } 9.60 9.61 -boolean open_pdf_output_file (char *name, 9.62 - pdf_file_attributes_t *attributes) 9.63 +bool open_pdf_output_file (char *name, 9.64 + pdf_file_attributes_t *attributes) 9.65 { 9.66 output_file_t *o; 9.67 9.68 @@ -225,23 +226,23 @@ 9.69 9.70 #define SWAP(type,a,b) do { type temp; temp = a; a = b; b = temp; } while (0) 9.71 9.72 -boolean process_page (int image, /* range 1 .. n */ 9.73 - input_attributes_t input_attributes, 9.74 - bookmark_t *bookmarks) 9.75 +bool process_page (int image, /* range 1 .. n */ 9.76 + input_attributes_t input_attributes, 9.77 + bookmark_t *bookmarks) 9.78 { 9.79 int result = 0; 9.80 9.81 - u32 image_length, image_width; 9.82 - u32 dest_image_length, dest_image_width; 9.83 + uint32_t image_length, image_width; 9.84 + uint32_t dest_image_length, dest_image_width; 9.85 #ifdef CHECK_DEPTH 9.86 - u32 image_depth; 9.87 + uint32_t image_depth; 9.88 #endif 9.89 9.90 - u16 samples_per_pixel; 9.91 - u16 bits_per_sample; 9.92 - u16 planar_config; 9.93 + uint16_t samples_per_pixel; 9.94 + uint16_t bits_per_sample; 9.95 + uint16_t planar_config; 9.96 9.97 - u16 resolution_unit; 9.98 + uint16_t resolution_unit; 9.99 float x_resolution, y_resolution; 9.100 float dest_x_resolution, dest_y_resolution; 9.101 9.102 @@ -381,7 +382,7 @@ 9.103 } 9.104 9.105 #ifdef TIFF_REVERSE_BITS 9.106 - reverse_bits ((u8 *) bitmap->bits, 9.107 + reverse_bits ((uint8_t *) bitmap->bits, 9.108 image_length * bitmap->row_words * sizeof (word_type)); 9.109 #endif /* TIFF_REVERSE_BITS */ 9.110 9.111 @@ -424,7 +425,7 @@ 9.112 TIFFSetField (tiff_temp, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISWHITE); 9.113 9.114 #ifdef TIFF_REVERSE_BITS 9.115 - reverse_bits ((u8 *) bitmap->bits, 9.116 + reverse_bits ((uint8_t *) bitmap->bits, 9.117 image_length * bitmap->row_words * sizeof (word_type)); 9.118 #endif /* TIFF_REVERSE_BITS */ 9.119
10.1 diff -r bfc6aaa089b0 -r 3d0be1c1c1b2 t2p.h 10.2 --- a/t2p.h Mon Aug 26 05:43:49 2002 +0000 10.3 +++ b/t2p.h Mon Aug 26 06:03:55 2002 +0000 10.4 @@ -1,21 +1,21 @@ 10.5 typedef struct 10.6 { 10.7 - boolean has_resolution; 10.8 + bool has_resolution; 10.9 double x_resolution; 10.10 double y_resolution; 10.11 10.12 - boolean has_page_size; 10.13 + bool has_page_size; 10.14 page_size_t page_size; 10.15 10.16 - boolean has_rotation; 10.17 + bool has_rotation; 10.18 int rotation; 10.19 10.20 - boolean has_crop; 10.21 + bool has_crop; 10.22 crop_t crop; 10.23 } input_attributes_t; 10.24 10.25 -boolean open_tiff_input_file (char *name); 10.26 -boolean close_tiff_input_file (void); 10.27 +bool open_tiff_input_file (char *name); 10.28 +bool close_tiff_input_file (void); 10.29 10.30 10.31 typedef struct 10.32 @@ -27,8 +27,8 @@ 10.33 char *keywords; 10.34 } pdf_file_attributes_t; 10.35 10.36 -boolean open_pdf_output_file (char *name, 10.37 - pdf_file_attributes_t *attributes); 10.38 +bool open_pdf_output_file (char *name, 10.39 + pdf_file_attributes_t *attributes); 10.40 10.41 10.42 void process_page_numbers (int page_index, 10.43 @@ -36,6 +36,6 @@ 10.44 int base, 10.45 page_label_t *page_label); 10.46 10.47 -boolean process_page (int image, /* range 1 .. n */ 10.48 - input_attributes_t input_attributes, 10.49 - bookmark_t *bookmarks); 10.50 +bool process_page (int image, /* range 1 .. n */ 10.51 + input_attributes_t input_attributes, 10.52 + bookmark_t *bookmarks);
11.1 diff -r bfc6aaa089b0 -r 3d0be1c1c1b2 tumble.c 11.2 --- a/tumble.c Mon Aug 26 05:43:49 2002 +0000 11.3 +++ b/tumble.c Mon Aug 26 06:03:55 2002 +0000 11.4 @@ -4,7 +4,7 @@ 11.5 * will be compressed using ITU-T T.6 (G4) fax encoding. 11.6 * 11.7 * Main program 11.8 - * $Id: tumble.c,v 1.18 2002/08/25 21:43:49 eric Exp $ 11.9 + * $Id: tumble.c,v 1.19 2002/08/25 22:02:31 eric Exp $ 11.10 * Copyright 2001 Eric Smith <eric@brouhaha.com> 11.11 * 11.12 * This program is free software; you can redistribute it and/or modify 11.13 @@ -23,6 +23,8 @@ 11.14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA */ 11.15 11.16 11.17 +#include <stdbool.h> 11.18 +#include <stdint.h> 11.19 #include <stdio.h> 11.20 #include <stdlib.h> 11.21 #include <unistd.h> 11.22 @@ -33,7 +35,6 @@ 11.23 #include <panda/functions.h> 11.24 #include <panda/constants.h> 11.25 11.26 -#include "type.h" 11.27 #include "bitblt.h" 11.28 #include "semantics.h" 11.29 #include "parser.tab.h" 11.30 @@ -62,7 +63,7 @@ 11.31 /* panda_pdf *out; */ 11.32 11.33 11.34 -boolean close_tiff_input_file (void) 11.35 +bool close_tiff_input_file (void) 11.36 { 11.37 if (in) 11.38 { 11.39 @@ -74,7 +75,7 @@ 11.40 return (1); 11.41 } 11.42 11.43 -boolean open_tiff_input_file (char *name) 11.44 +bool open_tiff_input_file (char *name) 11.45 { 11.46 if (in) 11.47 { 11.48 @@ -99,7 +100,7 @@ 11.49 } 11.50 11.51 11.52 -boolean close_pdf_output_files (void) 11.53 +bool close_pdf_output_files (void) 11.54 { 11.55 output_file_t *o, *n; 11.56 11.57 @@ -115,8 +116,8 @@ 11.58 return (1); 11.59 } 11.60 11.61 -boolean open_pdf_output_file (char *name, 11.62 - pdf_file_attributes_t *attributes) 11.63 +bool open_pdf_output_file (char *name, 11.64 + pdf_file_attributes_t *attributes) 11.65 { 11.66 output_file_t *o; 11.67 11.68 @@ -225,23 +226,23 @@ 11.69 11.70 #define SWAP(type,a,b) do { type temp; temp = a; a = b; b = temp; } while (0) 11.71 11.72 -boolean process_page (int image, /* range 1 .. n */ 11.73 - input_attributes_t input_attributes, 11.74 - bookmark_t *bookmarks) 11.75 +bool process_page (int image, /* range 1 .. n */ 11.76 + input_attributes_t input_attributes, 11.77 + bookmark_t *bookmarks) 11.78 { 11.79 int result = 0; 11.80 11.81 - u32 image_length, image_width; 11.82 - u32 dest_image_length, dest_image_width; 11.83 + uint32_t image_length, image_width; 11.84 + uint32_t dest_image_length, dest_image_width; 11.85 #ifdef CHECK_DEPTH 11.86 - u32 image_depth; 11.87 + uint32_t image_depth; 11.88 #endif 11.89 11.90 - u16 samples_per_pixel; 11.91 - u16 bits_per_sample; 11.92 - u16 planar_config; 11.93 + uint16_t samples_per_pixel; 11.94 + uint16_t bits_per_sample; 11.95 + uint16_t planar_config; 11.96 11.97 - u16 resolution_unit; 11.98 + uint16_t resolution_unit; 11.99 float x_resolution, y_resolution; 11.100 float dest_x_resolution, dest_y_resolution; 11.101 11.102 @@ -381,7 +382,7 @@ 11.103 } 11.104 11.105 #ifdef TIFF_REVERSE_BITS 11.106 - reverse_bits ((u8 *) bitmap->bits, 11.107 + reverse_bits ((uint8_t *) bitmap->bits, 11.108 image_length * bitmap->row_words * sizeof (word_type)); 11.109 #endif /* TIFF_REVERSE_BITS */ 11.110 11.111 @@ -424,7 +425,7 @@ 11.112 TIFFSetField (tiff_temp, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISWHITE); 11.113 11.114 #ifdef TIFF_REVERSE_BITS 11.115 - reverse_bits ((u8 *) bitmap->bits, 11.116 + reverse_bits ((uint8_t *) bitmap->bits, 11.117 image_length * bitmap->row_words * sizeof (word_type)); 11.118 #endif /* TIFF_REVERSE_BITS */ 11.119
12.1 diff -r bfc6aaa089b0 -r 3d0be1c1c1b2 tumble.h 12.2 --- a/tumble.h Mon Aug 26 05:43:49 2002 +0000 12.3 +++ b/tumble.h Mon Aug 26 06:03:55 2002 +0000 12.4 @@ -1,21 +1,21 @@ 12.5 typedef struct 12.6 { 12.7 - boolean has_resolution; 12.8 + bool has_resolution; 12.9 double x_resolution; 12.10 double y_resolution; 12.11 12.12 - boolean has_page_size; 12.13 + bool has_page_size; 12.14 page_size_t page_size; 12.15 12.16 - boolean has_rotation; 12.17 + bool has_rotation; 12.18 int rotation; 12.19 12.20 - boolean has_crop; 12.21 + bool has_crop; 12.22 crop_t crop; 12.23 } input_attributes_t; 12.24 12.25 -boolean open_tiff_input_file (char *name); 12.26 -boolean close_tiff_input_file (void); 12.27 +bool open_tiff_input_file (char *name); 12.28 +bool close_tiff_input_file (void); 12.29 12.30 12.31 typedef struct 12.32 @@ -27,8 +27,8 @@ 12.33 char *keywords; 12.34 } pdf_file_attributes_t; 12.35 12.36 -boolean open_pdf_output_file (char *name, 12.37 - pdf_file_attributes_t *attributes); 12.38 +bool open_pdf_output_file (char *name, 12.39 + pdf_file_attributes_t *attributes); 12.40 12.41 12.42 void process_page_numbers (int page_index, 12.43 @@ -36,6 +36,6 @@ 12.44 int base, 12.45 page_label_t *page_label); 12.46 12.47 -boolean process_page (int image, /* range 1 .. n */ 12.48 - input_attributes_t input_attributes, 12.49 - bookmark_t *bookmarks); 12.50 +bool process_page (int image, /* range 1 .. n */ 12.51 + input_attributes_t input_attributes, 12.52 + bookmark_t *bookmarks);
13.1 diff -r bfc6aaa089b0 -r 3d0be1c1c1b2 type.h 13.2 --- a/type.h Mon Aug 26 05:43:49 2002 +0000 13.3 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 13.4 @@ -1,7 +0,0 @@ 13.5 -typedef unsigned char u8; 13.6 -typedef unsigned short u16; 13.7 -typedef unsigned int u32; 13.8 - 13.9 -typedef int s32; 13.10 - 13.11 -typedef int boolean;