semantics.c

changeset 21
2bb19d98d928
parent 20
a1cd8cb9d09e
child 22
198616589af5
     1.1 diff -r a1cd8cb9d09e -r 2bb19d98d928 semantics.c
     1.2 --- a/semantics.c	Mon Dec 31 07:25:08 2001 +0000
     1.3 +++ b/semantics.c	Mon Dec 31 07:44:23 2001 +0000
     1.4 @@ -175,6 +175,8 @@
     1.5      {
     1.6        memcpy (new_output_context, last_output_context, sizeof (output_context_t));
     1.7        new_output_context->page_count = 0;
     1.8 +      new_output_context->first_bookmark = NULL;
     1.9 +      new_output_context->last_bookmark = NULL;
    1.10      }
    1.11    else
    1.12      {
    1.13 @@ -263,9 +265,11 @@
    1.14      context->page_count += count;
    1.15  }
    1.16  
    1.17 +
    1.18  void output_pages (range_t range)
    1.19  {
    1.20    output_page_t *new_page;
    1.21 +  output_context_t *context;
    1.22    int count = ((range.last - range.first) + 1);
    1.23  
    1.24  #ifdef SEMANTIC_DEBUG
    1.25 @@ -293,10 +297,15 @@
    1.26    new_page->range = range;
    1.27    new_page->output_context = last_output_context;
    1.28  
    1.29 -  /* transfer bookmarks from context to page */
    1.30 -  new_page->bookmark_list = last_output_context->first_bookmark;
    1.31 -  last_output_context->first_bookmark = NULL;
    1.32 -  last_output_context->last_bookmark = NULL;
    1.33 +  /* transfer bookmarks from context(s) to page */
    1.34 +  for (context = last_output_context; context; context = context->parent)
    1.35 +    if (context->first_bookmark)
    1.36 +      {
    1.37 +	context->last_bookmark->next = new_page->bookmark_list;
    1.38 +	new_page->bookmark_list = context->first_bookmark;
    1.39 +	context->first_bookmark = NULL;
    1.40 +	context->last_bookmark = NULL;
    1.41 +      }
    1.42  
    1.43    increment_output_page_count (count);
    1.44  }