semantics.c

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