/[groff]/groff/src/roff/troff/div.cpp
ViewVC logotype

Diff of /groff/src/roff/troff/div.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.6 by wlemb, Mon Apr 19 06:17:47 2004 UTC revision 1.7 by wl, Sun Oct 10 19:08:03 2004 UTC
# Line 51  static vunits needed_space; Line 51  static vunits needed_space;
51    
52  diversion::diversion(symbol s)  diversion::diversion(symbol s)
53  : prev(0), nm(s), vertical_position(V0), high_water_mark(V0),  : prev(0), nm(s), vertical_position(V0), high_water_mark(V0),
54    no_space_mode(0), marked_place(V0)    no_space_mode(0), needs_push(0), marked_place(V0),
55      any_chars_added(0), saved_seen_break(0), saved_seen_space(0),
56      saved_seen_eol(0), saved_suppress_next_eol(0)
57  {  {
58  }  }
59    
# Line 97  void do_divert(int append, int boxing) Line 99  void do_divert(int append, int boxing)
99    symbol nm = get_name();    symbol nm = get_name();
100    if (nm.is_null()) {    if (nm.is_null()) {
101      if (curdiv->prev) {      if (curdiv->prev) {
102          curenv->seen_break = curdiv->saved_seen_break;
103          curenv->seen_space = curdiv->saved_seen_space;
104          curenv->seen_eol = curdiv->saved_seen_eol;
105          curenv->suppress_next_eol = curdiv->saved_suppress_next_eol;
106        if (boxing) {        if (boxing) {
107          curenv->line = curdiv->saved_line;          curenv->line = curdiv->saved_line;
108          curenv->width_total = curdiv->saved_width_total;          curenv->width_total = curdiv->saved_width_total;
# Line 116  void do_divert(int append, int boxing) Line 122  void do_divert(int append, int boxing)
122      macro_diversion *md = new macro_diversion(nm, append);      macro_diversion *md = new macro_diversion(nm, append);
123      md->prev = curdiv;      md->prev = curdiv;
124      curdiv = md;      curdiv = md;
125        curdiv->saved_seen_break = curenv->seen_break;
126        curdiv->saved_seen_space = curenv->seen_space;
127        curdiv->saved_seen_eol = curenv->seen_eol;
128        curdiv->saved_suppress_next_eol = curenv->suppress_next_eol;
129        curenv->seen_break = 0;
130        curenv->seen_space = 0;
131        curenv->seen_eol = 0;
132      if (boxing) {      if (boxing) {
133        curdiv->saved_line = curenv->line;        curdiv->saved_line = curenv->line;
134        curdiv->saved_width_total = curenv->width_total;        curdiv->saved_width_total = curenv->width_total;
# Line 202  macro_diversion::macro_diversion(symbol Line 215  macro_diversion::macro_diversion(symbol
215    // We can now catch the situation described above by comparing    // We can now catch the situation described above by comparing
216    // the length of the charlist in the macro_header with the length    // the length of the charlist in the macro_header with the length
217    // stored in the macro. When we detect this, we copy the contents.    // stored in the macro. When we detect this, we copy the contents.
218    mac = new macro;    mac = new macro(1);
219    if (append) {    if (append) {
220      request_or_macro *rm      request_or_macro *rm
221        = (request_or_macro *)request_dictionary.lookup(s);        = (request_or_macro *)request_dictionary.lookup(s);
# Line 257  void macro_diversion::output(node *nd, i Line 270  void macro_diversion::output(node *nd, i
270      nd->set_vertical_size(&v);      nd->set_vertical_size(&v);
271      node *temp = nd;      node *temp = nd;
272      nd = nd->next;      nd = nd->next;
273      if (temp->interpret(mac)) {      if (temp->interpret(mac))
274        delete temp;        delete temp;
     }  
275      else {      else {
276  #if 1  #if 1
277        temp->freeze_space();        temp->freeze_space();
# Line 445  void top_level_diversion::space(vunits n Line 457  void top_level_diversion::space(vunits n
457    vunits next_trap_pos;    vunits next_trap_pos;
458    trap *next_trap = find_next_trap(&next_trap_pos);    trap *next_trap = find_next_trap(&next_trap_pos);
459    vunits y = vertical_position + n;    vunits y = vertical_position + n;
460      curenv->seen_space += n.to_units()
461                            / curenv->get_vertical_spacing().to_units();
462    if (vertical_position_traps_flag && next_trap != 0 && y >= next_trap_pos) {    if (vertical_position_traps_flag && next_trap != 0 && y >= next_trap_pos) {
463      vertical_position = next_trap_pos;      vertical_position = next_trap_pos;
464      nl_reg_contents = vertical_position.to_units();      nl_reg_contents = vertical_position.to_units();
# Line 639  void page_offset() Line 653  void page_offset()
653      n = topdiv->prev_page_offset;      n = topdiv->prev_page_offset;
654    topdiv->prev_page_offset = topdiv->page_offset;    topdiv->prev_page_offset = topdiv->page_offset;
655    topdiv->page_offset = n;    topdiv->page_offset = n;
656    curenv->add_html_tag(0, ".po", n.to_units());    topdiv->modified_tag.incl(MTSM_PO);
657    skip_line();    skip_line();
658  }  }
659    
# Line 732  void restore_spacing() Line 746  void restore_spacing()
746    skip_line();    skip_line();
747  }  }
748    
749  /* It is necessary to generate a break before before reading the argument,  /* It is necessary to generate a break before reading the argument,
750  because otherwise arguments using | will be wrong. But if we just  because otherwise arguments using | will be wrong.  But if we just
751  generate a break as usual, then the line forced out may spring a trap  generate a break as usual, then the line forced out may spring a trap
752  and thus push a macro onto the input stack before we have had a chance  and thus push a macro onto the input stack before we have had a chance
753  to read the argument to the sp request. We resolve this dilemma by  to read the argument to the sp request.  We resolve this dilemma by
754  setting, before generating the break, a flag which will postpone the  setting, before generating the break, a flag which will postpone the
755  actual pushing of the macro associated with the trap sprung by the  actual pushing of the macro associated with the trap sprung by the
756  outputting of the line forced out by the break till after we have read  outputting of the line forced out by the break till after we have read
# Line 758  void space_request() Line 772  void space_request()
772    else    else
773      // The line might have had line spacing that was truncated.      // The line might have had line spacing that was truncated.
774      truncated_space += n;      truncated_space += n;
775    curenv->add_html_tag(1, ".sp", n.to_units());    
776    tok.next();    tok.next();
777  }  }
778    
779  void blank_line()  void blank_line()
780  {  {
781    curenv->do_break();    curenv->do_break();
782    if (!trap_sprung_flag && !curdiv->no_space_mode) {    if (!trap_sprung_flag && !curdiv->no_space_mode)
783      curdiv->space(curenv->get_vertical_spacing());      curdiv->space(curenv->get_vertical_spacing());
     curenv->add_html_tag(1, ".sp", 1);  
   }  
784    else    else
785      truncated_space += curenv->get_vertical_spacing();      truncated_space += curenv->get_vertical_spacing();
786  }  }
# Line 832  void flush_output() Line 844  void flush_output()
844      curenv->do_break();      curenv->do_break();
845    if (the_output)    if (the_output)
846      the_output->flush();      the_output->flush();
   curenv->add_html_tag(1, ".fl");  
847    tok.next();    tok.next();
848  }  }
849    

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26