--- src/roff/troff/env.cpp.orig 2006-07-24 12:03:45.000000000 -0700 +++ src/roff/troff/env.cpp 2006-07-24 12:32:52.000000000 -0700 @@ -3229,6 +3229,102 @@ const char *environment::get_requested_p return sptoa(curenv->get_requested_point_size()); } +void environment::print_env() +{ + errprint("\tprev_line_length\t%1\n", prev_line_length.to_units()); + errprint("\tline_length\t%1\n", line_length.to_units()); + errprint("\tprev_title_length\t%1\n", prev_title_length.to_units()); + errprint("\ttitle_length\t%1\n", title_length.to_units()); + errprint("\tprev_size\t%1 (scaled %2)\n", prev_size.to_points(), prev_size.to_scaled_points()); + errprint("\tsize\t%1 (scaled %2)\n", size.to_points(), size.to_scaled_points()); + errprint("\trequested_size\t%1\n", requested_size); + errprint("\tprev_requested_size\t%1\n", prev_requested_size); + errprint("\tchar_height\t%1\n", char_height); + errprint("\tchar_slant\t%1\n", char_slant); + errprint("\tprev_fontno\t%1\n", prev_fontno); + errprint("\tfontno\t%1\n", fontno); + errprint("\tprev_family\t%1\n", prev_family->nm.contents()); + errprint("\tfamily\t%1\n", family->nm.contents()); + errprint("\tspace_size\t%1\n", space_size); // in 36ths of an em + errprint("\tsentence_space_size\t%1\n", sentence_space_size); // same but for spaces at the end of sentences + errprint("\tadjust_mode\t%1\n", adjust_mode); + errprint("\tfill\t%1\n", fill); + errprint("\tinterrupted\t%1\n", interrupted); + errprint("\tprev_line_interrupted\t%1\n", prev_line_interrupted); + errprint("\tcenter_lines\t%1\n", center_lines); + errprint("\tright_justify_lines\t%1\n", right_justify_lines); + errprint("\tprev_vertical_spacing\t%1\n", prev_vertical_spacing.to_units()); + errprint("\tvertical_spacing\t%1\n", vertical_spacing.to_units()); + errprint("\tprev_post_vertical_spacing\t%1\n", prev_post_vertical_spacing.to_units()); + errprint("\tpost_vertical_spacing\t%1\n", post_vertical_spacing.to_units()); + errprint("\tprev_line_spacing\t%1\n", prev_line_spacing); + errprint("\tline_spacing\t%1\n", line_spacing); + errprint("\tprev_indent\t%1\n", prev_indent.to_units()); + errprint("\tindent\t%1\n", indent.to_units()); + errprint("\ttemporary_indent\t%1\n", temporary_indent.to_units()); + errprint("\thave_temporary_indent\t%1\n", have_temporary_indent); + errprint("\tsaved_indent\t%1\n", saved_indent.to_units()); + errprint("\ttarget_text_length\t%1\n", target_text_length.to_units()); + errprint("\tpre_underline_fontno\t%1\n", pre_underline_fontno); + errprint("\tunderline_lines\t%1\n", underline_lines); + errprint("\tunderline_spaces\t%1\n", underline_spaces); + errprint("\tinput_trap\t%1\n", input_trap.contents()); + errprint("\tinput_trap_count\t%1\n", input_trap_count); + errprint("\tcontinued_input_trap\t%1\n", continued_input_trap); + errprint("\tprev_text_length\t%1\n", prev_text_length.to_units()); + errprint("\twidth_total\t%1\n", width_total.to_units()); + errprint("\tspace_total\t%1\n", space_total); + errprint("\tinput_line_start\t%1\n", input_line_start.to_units()); + errprint("\ttab_width\t%1\n", tab_width.to_units()); + errprint("\ttab_distance\t%1\n", tab_distance.to_units()); + errprint("\tline_tabs\t%1\n", line_tabs); + errprint("\tcurrent_field\t%1\n", current_field); // is there a current field? + errprint("\tfield_distance\t%1\n", field_distance.to_units()); + errprint("\tpre_field_width\t%1\n", pre_field_width.to_units()); + errprint("\tfield_spaces\t%1\n", field_spaces); + errprint("\ttab_field_spaces\t%1\n", tab_field_spaces); + errprint("\ttab_precedes_field\t%1\n", tab_precedes_field); + errprint("\tdiscarding\t%1\n", discarding); + errprint("\tspread_flag\t%1\n", spread_flag); // set by \p + errprint("\tmargin_character_flags\t%1\n", margin_character_flags); + errprint("\tmargin_character_distance\t%1\n", margin_character_distance.to_units()); + errprint("\tline_number_digit_width\t%1\n", line_number_digit_width.to_units()); + errprint("\tnumber_text_separation\t%1\n", number_text_separation); // in digit spaces + errprint("\tline_number_indent\t%1\n", line_number_indent); // in digit spaces + errprint("\tline_number_multiple\t%1\n", line_number_multiple); + errprint("\tno_number_count\t%1\n", no_number_count); + errprint("\thyphenation_flags\t%1\n", hyphenation_flags); + errprint("\thyphen_line_count\t%1\n", hyphen_line_count); + errprint("\thyphen_line_max\t%1\n", hyphen_line_max); + errprint("\thyphenation_space\t%1\n", hyphenation_space.to_units()); + errprint("\thyphenation_margin\t%1\n", hyphenation_margin.to_units()); + errprint("\tcomposite\t%1\n", composite); // used for construction of composite char? +#ifdef WIDOW_CONTROL + errprint("\twidow_control\t%1\n", widow_control); +#endif /* WIDOW_CONTROL */ +} + +void print_env() +{ + dictionary_iterator iter(env_dictionary); + symbol s; + environment *e; + + errprint("Current Environment:\n"); + curenv->print_env(); + while(iter.get(&s, (void **)&e)) { + assert(!s.is_null()); + if (e != curenv) { + errprint("Environment %1:\n", s.contents()); + e->print_env(); + } else { + errprint("%1: CURRENT ENV\n", s.contents()); + } + } + fflush(stderr); + skip_line(); +} + #define init_int_env_reg(name, func) \ number_reg_dictionary.define(name, new int_env_reg(&environment::func)) @@ -3277,6 +3373,7 @@ void init_env_requests() init_request("nh", no_hyphenate); init_request("nm", number_lines); init_request("nn", no_number); + init_request("pev", print_env); init_request("ps", point_size); init_request("pvs", post_vertical_spacing); init_request("rj", right_justify); --- src/roff/troff/env.h.orig 2006-07-24 12:04:17.000000000 -0700 +++ src/roff/troff/env.h 2006-07-24 11:27:30.000000000 -0700 @@ -264,6 +264,7 @@ public: environment(const environment *); // for temporary environment ~environment(); statem *construct_state(int only_eol); + void print_env(); void copy(const environment *); int is_dummy() { return dummy; } int is_empty(); --- doc/groff.texinfo.orig 2006-07-24 12:38:28.000000000 -0700 +++ doc/groff.texinfo 2006-07-24 12:46:14.000000000 -0700 @@ -13718,6 +13718,14 @@ If it is known in advance that there are output, @code{gtroff} can be forced to suppress formatted output with the @option{-z} flag. address@hidden {pev, } address@hidden dumping environments (@code{pev}) address@hidden environments, dumping (@code{pev}) +Print the contents of the current environment and +all the currently defined named environments +on @code{stderr}. address@hidden + @Defreq {pm, } @cindex dumping symbol table (@code{pm}) @cindex symbol table, dumping (@code{pm})