1.1 --- a/semantics.c Mon Dec 31 07:44:23 2001 +0000 1.2 +++ b/semantics.c Mon Dec 31 08:12:58 2001 +0000 1.3 @@ -7,6 +7,72 @@ 1.4 #include "parser.tab.h" 1.5 1.6 1.7 +typedef struct 1.8 +{ 1.9 + boolean has_size; 1.10 + page_size_t size; 1.11 + 1.12 + boolean has_rotation; 1.13 + int rotation; 1.14 + 1.15 + boolean has_crop; 1.16 + crop_t crop; 1.17 +} input_modifiers_t; 1.18 + 1.19 + 1.20 +typedef struct input_context_t 1.21 +{ 1.22 + struct input_context_t *parent; 1.23 + struct input_context_t *next; 1.24 + 1.25 + int image_count; /* how many pages reference this context, 1.26 + including those from subcontexts */ 1.27 + 1.28 + char *input_file; 1.29 + 1.30 + input_modifiers_t modifiers [INPUT_MODIFIER_TYPE_COUNT]; 1.31 +} input_context_t; 1.32 + 1.33 + 1.34 +typedef struct input_image_t 1.35 +{ 1.36 + struct input_image_t *next; 1.37 + input_context_t *input_context; 1.38 + range_t range; 1.39 +} input_image_t; 1.40 + 1.41 + 1.42 +typedef struct bookmark_t 1.43 +{ 1.44 + struct bookmark_t *next; 1.45 + char *name; 1.46 +} bookmark_t; 1.47 + 1.48 + 1.49 +typedef struct output_context_t 1.50 +{ 1.51 + struct output_context_t *parent; 1.52 + struct output_context_t *next; 1.53 + 1.54 + int page_count; /* how many pages reference this context, 1.55 + including those from subcontexts */ 1.56 + 1.57 + char *output_file; 1.58 + bookmark_t *first_bookmark; 1.59 + bookmark_t *last_bookmark; 1.60 + char *page_number_format; 1.61 +} output_context_t; 1.62 + 1.63 + 1.64 +typedef struct output_page_t 1.65 +{ 1.66 + struct output_page_t *next; 1.67 + output_context_t *output_context; 1.68 + range_t range; 1.69 + bookmark_t *bookmark_list; 1.70 +} output_page_t; 1.71 + 1.72 + 1.73 #define SEMANTIC_DEBUG 1.74 #ifdef SEMANTIC_DEBUG 1.75 #define SDBG(x) printf x 1.76 @@ -87,7 +153,7 @@ 1.77 #endif /* SEMANTIC_DEBUG */ 1.78 } 1.79 1.80 -void input_clone (void) 1.81 +static void input_clone (void) 1.82 { 1.83 input_context_t *new_input_context; 1.84 1.85 @@ -119,7 +185,7 @@ 1.86 SDBG(("rotation %d\n", rotation)); 1.87 } 1.88 1.89 -void increment_input_image_count (int count) 1.90 +static void increment_input_image_count (int count) 1.91 { 1.92 input_context_t *context; 1.93 1.94 @@ -199,7 +265,7 @@ 1.95 last_output_context = last_output_context->parent; 1.96 }; 1.97 1.98 -void output_clone (void) 1.99 +static void output_clone (void) 1.100 { 1.101 output_context_t *new_output_context; 1.102 1.103 @@ -257,7 +323,7 @@ 1.104 last_output_context->page_number_format = format; 1.105 } 1.106 1.107 -void increment_output_page_count (int count) 1.108 +static void increment_output_page_count (int count) 1.109 { 1.110 output_context_t *context; 1.111 1.112 @@ -317,7 +383,7 @@ 1.113 } 1.114 1.115 1.116 -char *get_input_file (input_context_t *context) 1.117 +static char *get_input_file (input_context_t *context) 1.118 { 1.119 for (; context; context = context->parent) 1.120 if (context->input_file) 1.121 @@ -326,7 +392,7 @@ 1.122 exit (2); 1.123 } 1.124 1.125 -int get_input_rotation (input_context_t *context, input_modifier_type_t type) 1.126 +static int get_input_rotation (input_context_t *context, input_modifier_type_t type) 1.127 { 1.128 for (; context; context = context->parent) 1.129 { 1.130 @@ -338,7 +404,7 @@ 1.131 return (0); /* default */ 1.132 } 1.133 1.134 -char *get_output_file (output_context_t *context) 1.135 +static char *get_output_file (output_context_t *context) 1.136 { 1.137 for (; context; context = context->parent) 1.138 if (context->output_file) 1.139 @@ -347,7 +413,7 @@ 1.140 exit (2); 1.141 } 1.142 1.143 -char *get_output_page_number_format (output_context_t *context) 1.144 +static char *get_output_page_number_format (output_context_t *context) 1.145 { 1.146 for (; context; context = context->parent) 1.147 if (context->page_number_format)