semantics.c

changeset 26
4368c5fd9242
parent 25
139b91f9a224
child 30
35fad7ec7732
     1.1 --- a/semantics.c	Mon Dec 31 16:44:24 2001 +0000
     1.2 +++ b/semantics.c	Tue Jan 01 03:44:40 2002 +0000
     1.3 @@ -478,60 +478,6 @@
     1.4  }
     1.5  
     1.6  
     1.7 -void doit (void)
     1.8 -{
     1.9 -  input_image_t *image = NULL;
    1.10 -  output_page_t *page = NULL;
    1.11 -  int i = 0;
    1.12 -  int p = 0;
    1.13 -  int page_index = 0;
    1.14 -  input_attributes_t input_attributes;
    1.15 -  input_modifier_type_t parity;
    1.16 -  page_label_t *page_label;
    1.17 -
    1.18 -  for (;;)
    1.19 -    {
    1.20 -      if ((! image) || (i >= range_count (image->range)))
    1.21 -	{
    1.22 -	  if (image)
    1.23 -	    image = image->next;
    1.24 -	  else
    1.25 -	    image = first_input_image;
    1.26 -	  if (! image)
    1.27 -	    return;
    1.28 -	  i = 0;
    1.29 -	}
    1.30 -
    1.31 -      if ((! page) || (p >= range_count (page->range)))
    1.32 -	{
    1.33 -	  if (page)
    1.34 -	    page = page->next;
    1.35 -	  else
    1.36 -	    page = first_output_page;
    1.37 -	  p = 0;
    1.38 -	  page_label = get_output_page_label (page->output_context);
    1.39 -	  process_page_numbers (page_index,
    1.40 -				range_count (page->range),
    1.41 -				page->range.first,
    1.42 -				page_label);
    1.43 -	}
    1.44 -
    1.45 -      parity = ((image->range.first + i) % 2) ? INPUT_MODIFIER_ODD : INPUT_MODIFIER_EVEN;
    1.46 -
    1.47 -      memset (& input_attributes, 0, sizeof (input_attributes));
    1.48 -      input_attributes.rotation = get_input_rotation (image->input_context,
    1.49 -						      parity);;
    1.50 -
    1.51 -      process_page (image->range.first + i,
    1.52 -		    input_attributes,
    1.53 -		    page->bookmark_list);
    1.54 -      i++;
    1.55 -      p++;
    1.56 -      page_index++;
    1.57 -    }
    1.58 -}
    1.59 -
    1.60 -
    1.61  boolean parse_spec_file (char *fn)
    1.62  {
    1.63    boolean result = 0;
    1.64 @@ -576,3 +522,63 @@
    1.65  
    1.66    return (result);
    1.67  }
    1.68 +
    1.69 +
    1.70 +boolean process_specs (void)
    1.71 +{
    1.72 +  input_image_t *image = NULL;
    1.73 +  output_page_t *page = NULL;
    1.74 +  int i = 0;
    1.75 +  int p = 0;
    1.76 +  int page_index = 0;
    1.77 +  input_attributes_t input_attributes;
    1.78 +  input_modifier_type_t parity;
    1.79 +  page_label_t *page_label;
    1.80 +
    1.81 +  for (;;)
    1.82 +    {
    1.83 +      if ((! image) || (i >= range_count (image->range)))
    1.84 +	{
    1.85 +	  if (image)
    1.86 +	    image = image->next;
    1.87 +	  else
    1.88 +	    image = first_input_image;
    1.89 +	  if (! image)
    1.90 +	    return (0);
    1.91 +	  i = 0;
    1.92 +	  if (! open_tiff_input_file (get_input_file (image->input_context)))
    1.93 +	    return (0);
    1.94 +	}
    1.95 +
    1.96 +      if ((! page) || (p >= range_count (page->range)))
    1.97 +	{
    1.98 +	  if (page)
    1.99 +	    page = page->next;
   1.100 +	  else
   1.101 +	    page = first_output_page;
   1.102 +	  p = 0;
   1.103 +	  if (! open_pdf_output_file (get_output_file (page->output_context)))
   1.104 +	    return (0);
   1.105 +	  page_label = get_output_page_label (page->output_context);
   1.106 +	  process_page_numbers (page_index,
   1.107 +				range_count (page->range),
   1.108 +				page->range.first,
   1.109 +				page_label);
   1.110 +	}
   1.111 +
   1.112 +      parity = ((image->range.first + i) % 2) ? INPUT_MODIFIER_ODD : INPUT_MODIFIER_EVEN;
   1.113 +
   1.114 +      memset (& input_attributes, 0, sizeof (input_attributes));
   1.115 +      input_attributes.rotation = get_input_rotation (image->input_context,
   1.116 +						      parity);;
   1.117 +
   1.118 +      process_page (image->range.first + i,
   1.119 +		    input_attributes,
   1.120 +		    page->bookmark_list);
   1.121 +      i++;
   1.122 +      p++;
   1.123 +      page_index++;
   1.124 +    }
   1.125 +
   1.126 +  return (1);
   1.127 +}