semantics.c

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