1.1 diff -r 3de372e4b230 -r e9bf1ed4f331 semantics.c 1.2 --- a/semantics.c Sun Dec 30 17:09:08 2001 +0000 1.3 +++ b/semantics.c Mon Dec 31 02:33:50 2001 +0000 1.4 @@ -7,6 +7,14 @@ 1.5 #include "parser.tab.h" 1.6 1.7 1.8 +#define SEMANTIC_DEBUG 1.9 +#ifdef SEMANTIC_DEBUG 1.10 +#define SDBG(x) printf x 1.11 +#else 1.12 +#define SDBG(x) 1.13 +#endif 1.14 + 1.15 + 1.16 FILE *yyin; 1.17 int line; /* line number in spec file */ 1.18 1.19 @@ -16,9 +24,10 @@ 1.20 1.21 1.22 input_context_t *current_input_context; 1.23 +input_modifier_type_t current_modifier_context; 1.24 1.25 1.26 -void input_push_context (input_context_type_t type) 1.27 +void input_push_context (void) 1.28 { 1.29 input_context_t *new_input_context; 1.30 1.31 @@ -52,17 +61,42 @@ 1.32 current_input_context = current_input_context->parent_input_context; 1.33 }; 1.34 1.35 +void input_set_modifier_context (input_modifier_type_t type) 1.36 +{ 1.37 + current_modifier_context = type; 1.38 +#ifdef SEMANTIC_DEBUG 1.39 + SDBG(("modifier type ")); 1.40 + switch (type) 1.41 + { 1.42 + case INPUT_MODIFIER_ALL: SDBG(("all")); break; 1.43 + case INPUT_MODIFIER_ODD: SDBG(("odd")); break; 1.44 + case INPUT_MODIFIER_EVEN: SDBG(("even")); break; 1.45 + default: SDBG(("unknown %d", type)); 1.46 + } 1.47 + SDBG(("\n")); 1.48 +#endif /* SEMANTIC_DEBUG */ 1.49 +} 1.50 + 1.51 void input_set_file (char *name) 1.52 { 1.53 }; 1.54 1.55 +void input_set_rotation (int rotation) 1.56 +{ 1.57 + current_input_context->modifiers [current_modifier_context].has_rotation = 1; 1.58 + current_input_context->modifiers [current_modifier_context].rotation = rotation; 1.59 + SDBG(("rotation %d\n", rotation)); 1.60 +} 1.61 + 1.62 void input_images (int first, int last) 1.63 { 1.64 input_page_count += ((last - first) + 1); 1.65 +#ifdef SEMANTIC_DEBUG 1.66 if (first == last) 1.67 - printf ("image %d\n", first); 1.68 + SDBG(("image %d\n", first)); 1.69 else 1.70 - printf ("images %d..%d\n", first, last); 1.71 + SDBG(("images %d..%d\n", first, last)); 1.72 +#endif /* SEMANTIC_DEBUG */ 1.73 } 1.74 1.75 1.76 @@ -77,10 +111,12 @@ 1.77 void output_pages (int first, int last) 1.78 { 1.79 output_page_count += ((last - first) + 1); 1.80 +#ifdef SEMANTIC_DEBUG 1.81 if (first == last) 1.82 - printf ("page %d\n", first); 1.83 + SDBG(("page %d\n", first)); 1.84 else 1.85 - printf ("pages %d..%d\n", first, last); 1.86 + SDBG(("pages %d..%d\n", first, last)); 1.87 +#endif /* SEMANTIC_DEBUG */ 1.88 } 1.89 1.90 1.91 @@ -103,7 +139,7 @@ 1.92 1.93 line = 1; 1.94 1.95 - input_push_context (INPUT_CONTEXT_ALL); /* create initial input context */ 1.96 + input_push_context (); /* create initial input context */ 1.97 output_push_context (); /* create initial output context */ 1.98 1.99 yyparse ();