diff --git a/semantics.c b/semantics.c index effe569..394d5ec 100644 --- a/semantics.c +++ b/semantics.c @@ -42,13 +42,6 @@ typedef struct input_image_t } input_image_t; -typedef struct bookmark_t -{ - struct bookmark_t *next; - char *name; -} bookmark_t; - - typedef struct output_context_t { struct output_context_t *parent; @@ -84,6 +77,7 @@ typedef struct output_page_t FILE *yyin; int line; /* line number in spec file */ +int bookmark_level; input_context_t *first_input_context; input_context_t *last_input_context; @@ -309,6 +303,7 @@ void output_set_bookmark (char *name) return; } + new_bookmark->level = bookmark_level; new_bookmark->name = name; if (last_output_context->first_bookmark) last_output_context->last_bookmark->next = new_bookmark; @@ -452,8 +447,7 @@ void dump_output_tree (void) if (page->bookmark_list) { for (bookmark = page->bookmark_list; bookmark; bookmark = bookmark->next) - printf ("bookmark '%s' ", bookmark->name); - printf ("\n"); + printf ("bookmark %d '%s'\n", bookmark->level, bookmark->name); } for (i = page->range.first; i <= page->range.last; i++) { diff --git a/semantics.h b/semantics.h index 22dcdd5..f632645 100644 --- a/semantics.h +++ b/semantics.h @@ -28,7 +28,16 @@ typedef enum } input_modifier_type_t; +typedef struct bookmark_t +{ + struct bookmark_t *next; + int level; /* 1 is outermost */ + char *name; +} bookmark_t; + + extern int line; /* line number in spec file */ +extern int bookmark_level; boolean parse_spec_file (char *fn); @@ -43,6 +52,8 @@ void input_set_rotation (int rotation); void input_images (range_t range); /* semantic routines for output statements */ +void output_push_context (void); +void output_pop_context (void); void output_set_file (char *name); void output_set_bookmark (char *name); void output_set_page_number_format (char *format);