1
0
mirror of synced 2026-04-17 16:52:51 +00:00

handle input and output files properly.

This commit is contained in:
Eric Smith
2002-01-01 03:44:40 +00:00
parent 504bb094cf
commit 15a0a3d8ea
6 changed files with 263 additions and 107 deletions

View File

@@ -478,60 +478,6 @@ static inline int range_count (range_t range)
}
void doit (void)
{
input_image_t *image = NULL;
output_page_t *page = NULL;
int i = 0;
int p = 0;
int page_index = 0;
input_attributes_t input_attributes;
input_modifier_type_t parity;
page_label_t *page_label;
for (;;)
{
if ((! image) || (i >= range_count (image->range)))
{
if (image)
image = image->next;
else
image = first_input_image;
if (! image)
return;
i = 0;
}
if ((! page) || (p >= range_count (page->range)))
{
if (page)
page = page->next;
else
page = first_output_page;
p = 0;
page_label = get_output_page_label (page->output_context);
process_page_numbers (page_index,
range_count (page->range),
page->range.first,
page_label);
}
parity = ((image->range.first + i) % 2) ? INPUT_MODIFIER_ODD : INPUT_MODIFIER_EVEN;
memset (& input_attributes, 0, sizeof (input_attributes));
input_attributes.rotation = get_input_rotation (image->input_context,
parity);;
process_page (image->range.first + i,
input_attributes,
page->bookmark_list);
i++;
p++;
page_index++;
}
}
boolean parse_spec_file (char *fn)
{
boolean result = 0;
@@ -576,3 +522,63 @@ boolean parse_spec_file (char *fn)
return (result);
}
boolean process_specs (void)
{
input_image_t *image = NULL;
output_page_t *page = NULL;
int i = 0;
int p = 0;
int page_index = 0;
input_attributes_t input_attributes;
input_modifier_type_t parity;
page_label_t *page_label;
for (;;)
{
if ((! image) || (i >= range_count (image->range)))
{
if (image)
image = image->next;
else
image = first_input_image;
if (! image)
return (0);
i = 0;
if (! open_tiff_input_file (get_input_file (image->input_context)))
return (0);
}
if ((! page) || (p >= range_count (page->range)))
{
if (page)
page = page->next;
else
page = first_output_page;
p = 0;
if (! open_pdf_output_file (get_output_file (page->output_context)))
return (0);
page_label = get_output_page_label (page->output_context);
process_page_numbers (page_index,
range_count (page->range),
page->range.first,
page_label);
}
parity = ((image->range.first + i) % 2) ? INPUT_MODIFIER_ODD : INPUT_MODIFIER_EVEN;
memset (& input_attributes, 0, sizeof (input_attributes));
input_attributes.rotation = get_input_rotation (image->input_context,
parity);;
process_page (image->range.first + i,
input_attributes,
page->bookmark_list);
i++;
p++;
page_index++;
}
return (1);
}