summaryrefslogtreecommitdiff
path: root/src/roff/troff/input.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Speed up access to cflags values.wl2010-12-201-8/+21
| | | | | | | | | | | | | | | | | | | | | | | We now recompute the cflags values for all charinfo objects if `.class' has been called. * src/roff/troff/charinfo.h: Add external references to `class_flag' and `get_flags'. (charinfo): `get_flags' no longer has a return value. (charinfo::overlaps_horizontally, charinfo::overlaps_vertically, charinfo::can_break_before, charinfo::can_break_after, charinfo::can_break_after, charinfo::ends_sentence, charinfo::transparent,, charinfo:ignore_hcodes, charinfo::prohibit_break_before, charinfo::prohibit_break_after, charinfo::inter_char_space): Call global `get_flags' only if necessary. (charinfo::add_to_class): Set `class_flag'. * src/roff/troff/input.cpp (class_flag): New global flag. (charinfo::charinfo): Call `get_flags' member function. (get_flags): New global function which iterates over all entries in the charinfo dictionary. (charinfo::get_flags): Set `flags' directly.
* Protect `.class' against cyclic nesting.wl2010-12-191-7/+31
| | | | | | | * src/roff/troff/charinfo.h (charinfo::contains): Add optional boolean argument. * src/roff/troff/input.cpp (define_class, charinfo::contains): Check for cyclic nesting.
* Improve CJK support with new values for `.cflags'.wl2010-12-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch introduces three new values to `.cflags': don't break before character: 128 don't break after character: 256 allow inter-character break: 512 They are handled differently if compared to other cflags values: (1) hcode values are completely ignored (2) similar to kern values, and contrary to the other cflags values, troff looks at pairs of characters to decide whether a break gets inserted A yet-to-be-written patch should add inter-character spacing if those flags are active; currently, only zero-width breakpoints are inserted. * src/roff/troff/charinfo.h (charinfo): Change type of `flags' to `int'. Update callers accordingly. New enum values `DONT_BREAK_BEFORE', `DONT_BREAK_AFTER', and `INTER_CHAR_SPACE'. New member functions `prohibit_break_before', `prohibit_break_after', and `inter_char_space'. * src/roff/troff/input.cpp: Updated. * src/roff/troff/node.cpp (inter_char_space_node): New class similar to kern_pair_node, collecting charinfo entities with the abovementioned cflags values. (break_char_type): Add new enum values. (glyph_node::merge_glyph_node): Handle abovementioned cflags values and emit an `inter_char_space_node' if necessary. * tmac/ja.tmac: Use new cflags values. * doc/groff.texinfo, NEWS, man/groff_diff.man: Document new values.
* Add wide character support to grotty.wl2010-12-131-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a huge patch, mainly by adding the gnulib infrastructure in a separate directory tree (in `src/libs/gnulib/lib') for its `wcwidth' module. However, the actual changes to native groff source files are just a few lines. * Makefile.comm (INCLUDES): Updated. (LIBGNU): Define. * Makefile.in (NOMAKEDIRS): Updated. (GNULLIBDIRS): Define. (DISTDIRS): Add GNULLIBDIRS. ($LIBDIRS): Depend on GNULLIBDIRS. ($GNULLIBDIRS): New target. * src/libs/libgroff/font.cpp (font::get_width, font::load) [is_unicode]: Use `wcwidth'. * src/roff/troff/Makefile.sub (XLIBS): Add LIBGNU. * src/roff/troff/input.cpp (main): Set LC_CTYPE. * src/devices/grotty/Makefile.sub (XLIBS): Add LIBGNU. * src/devices/grotty/tty.cpp (main): Set LC_CTYPE. * src/libs/gnulib/*: New files. The import was done as follows: . Call gnulib-tool --create-testdir \ --dir=src/libs/gnulib \ wcwidth to get a testbed. . Manually move directories src/libs/gl{lib,m4} to src/libs/{lib,m4}, and do s/gllib/lib/ and s/glm4/m4/ everywhere to `convert' the gnulib testbed to a standard gnulib configuration as maintained by gnulib-tool. . Call gnulib-tool --add-import \ --dir=src/libs/gnulib \ wcwidth to update everything.
* `.class' must not emit empty lines.wl2010-12-131-0/+2
| | | | | * src/roff/troff/input.cpp (define_class): Add missing `skip_line' calls.
* Implement support for character classes.wl2010-12-131-1/+170
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch uses standard C++ headers, contrary to the rest of groff. Ideally, everything in groff should be updated to do the same. * src/include/font.h (glyph_to_unicode): New function. * src/libs/libgroff/font.cpp (glyph_to_unicode): Implement it. (font::contains, font::get_code): Use it. * src/roff/troff/charinfo.h: Include <vector> and <utility>. (charinfo): New members `ranges' and `nested_classes'. New member functions `get_unicode_code' and `get_flags'. New member functions `add_to_class', `is_class', and `contains'. (charinfo::overlaps_horizontally, charinfo::overlaps_vertically, charinfo::can_break_before, charinfo::can_break_after, charinfo::can_break_after, charinfo::ends_sentence, charinfo::transparent,, charinfo:ignore_hcodes): Use `get_flags', which handles character classes also. * src/roff/troff/input.cpp (char_class_dictionary): New global variable. (define_class): New function. (init_input_requests): Register `class'. (charinfo::get_unicode_code, charinfo::get_flags, charinfo::contains): Implement it. * NEWS, doc/groff.texinfo (Character Classes), man/groff_diff.man, man/groff.man: Document it.
* Make patterns with uppercase letters work.wl2009-12-311-1/+1
| | | | | | | | Problem reported by Bjarni Ingi Gislason <bjarniig@rhi.hi.is>. * src/roff/troff/input.cpp (init_hpf_code_table): Use `cmlower'. * doc/groff.texinfo, man/groff_diff.man: Update documentation of `hpfcode' request.
* Fix double frees and memory leaks.wl2009-11-241-0/+5
| | | | | | | | * src/roff/troff/env.cpp (environment::make_tag): Use local object. * src/roff/troff/input.cpp (input_stack::check_end_diversion): Free `diversion_state' here. (interpolate_arg): Fix memory leaks. * src/roff/troff/mtsm.cpp (mtsm::pop_state): Don't free `sp->state'.
* Accept \0 and friends within \o.wl2009-05-071-11/+27
| | | | | | | | | | | | | | Reported by Doug McIlroy <doug@cs.dartmouth.edu>. * src/roff/troff/token.h (token): Add TOKEN_HORIZONTAL_SPACE enumeration value together with `horizontal_space' member function. Add `do_overstrike' as a friend. * src/roff/troff/input.cpp: Use TOKEN_HORIZONTAL_SPACE for \0, \|, \^, and \h. Update all affected places. (do_overstrike): Remove `static' attribute. Accept all escapes which produce a fixed horizontal space.
* Add a new `file' warning category.wl2009-02-211-2/+3
| | | | | | | | | | | * src/roff/troff/troff.h (warning_type): Add WARN_FILE. * src/roff/troff/input.cpp (DEFAULT_WARNING_MASK): Include WARN_FILE. (warning_table): Add `file' category. (macro_source): Convert error on missing macro file to a warning. * NEWS, doc/groff.texinfo (I/O, Warnings), man/groff_diff.man, src/roff/troff/troff.man: Document new warning category.
* Implement a leading spaces macro request, `lsm', in analogy towl2009-02-141-6/+26
| | | | | | | | | | | | | | | | | `blm'. Implement two new number registers, \n[lsn] and \n[lss], which hold the number of spaces and the horizontal space, respectively, which would be inserted if the macro registered by `lsm' wasn't called. * src/roff/troff/input.cpp (leading_spaces_macro_name, leading_spaces_number, leading_spaces_space): New global variables. (leading_spaces_macro): New function. (process_input_stack) <token::TOKEN_SPACE>: Handle `lsm'. (init_input_requests): Register `lsm', \n[lsn], and \n[lss]. * NEWS, man/groff_diff.man, man/groff.man, doc/groff.texinfo (Leading Spaces Traps): Document new requests and registers.
* Update copyright year.wl2009-01-051-1/+1
|
* * */*: Update GPL2 to GPL3.wl2009-01-041-5/+4
|
* * src/roff/troff/input.cpp (do_suppress): Make \O[3], \O[4], andwl2008-10-041-2/+6
| | | | | \O[5] non-transparent w.r.t. beginning-of-line recognition (similar to the other \O variants).
* Restore behaviour of \$0 if a macro is called with string syntaxwl2008-09-301-1/+20
| | | | | | | | (problem caused by change on 2008-09-29). * src/roff/troff/input.cpp (input_iterator, input_stack, macro_iterator): Add `get_macro_name' member function. (interpolate_string): Use it.
* Make \\*[xxx]\\ within a macro (with `xxx' a macro too) work aswl2008-09-291-9/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | expected. Without the patch, .de aaa \\*[bbb]\\ . tm \\$* .. .de bbb . shift .. .aaa 1 2 3 prints `2 3' instead of `1 2 3'. * src/roff/troff/input.cpp (input_iterator, input_stack, macro_iterator): Add `get_arg_list' member function. (macro): Add `is_a_string', `is_string', and `clear_string_flag' members. Update constructors and operators. (arg_list): Add copy constructor. (macro_iterator): Add optional argument to constructor to indicate whether arguments shall be inherited from calling macro. (interpolate_string): If string argument is a macro, push a macro iterator on the stack. (do_define_macro): Call clear_string_flag if macro data contains a newline. * src/roff/troff/request.h: Updated.
* If a macro is called as a string, inherit value of \n[.br] from thewl2008-09-281-1/+5
| | | | | | | | | | | | caller. This is useful for `trace.tmac'. * src/roff/troff/input.cpp (string_iterator): New members `with_break' and `get_break_flag'. (string_iterator::string_iterator): Updated. * doc/groff.texinfo: Improve documentation of \$0 and string syntax calling of macros. Document behaviour of \n[.br] within strings.
* Fix incompatibility between `.de1' and `.do'. Without this change,wl2008-09-251-7/+14
| | | | | | | | | | | | | | | | | | | | | | | the following snippet .de1 xx . tm \\n(.C .. .cp 1 .do xx prints 1 instead of 0. * src/roff/troff/input.cc (do_request): If a macro gets processed, call tok.next(). (interpolate_macro): Add optional argument. Update callers. (request::invoke): Add optional argument. (macro::invoke): Add optional argument to delay call of tok.next(). * src/roff/troff/request.h (request_or_macro): Add argument to `invoke' member. Update all derived classes. * doc/groff.texinfo: Improve documentation of .do request.
* * src/roff/troff/input.cpp: s/safer_flag/unsafe_flag/.wl2008-02-261-9/+9
| | | | | Update all occurrences so that \n[.U] works as advertised. Bug reported by Dorai Sitaram.
* name_to_glyph() exists two times. Explain this.wl2008-01-161-1/+6
|
* * src/roff/troff/input.cpp (do_ps_file): Handle `%X' in headerwl2007-10-211-4/+11
| | | | | comments correctly. Reported by Frank Jahnke <jahnke@sonatabio.com>.
* * src/roff/troff/input.cpp (interpolate_arg): Remove compilerwl2007-09-201-2/+2
| | | | | | | | | | | warning. * src/preproc/eqn/pile.cpp (pile_box::output, matrix_box::output): Remove compiler warning. * src/preproc/refer/label.y: Remove compiler warning. * src/preproc/pic/pic.y: Remove doubled token entries.
* * doc/groff.texinfo: Document new .O register and add crosswl2007-09-191-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | reference entries. * NEWS: Updated. * src/devices/grohtml/grohtml.man: Document new -V and -y options. * src/devices/grohtml/html-table.cpp: Add support for XHTML 1.1. (html_table:: emit_colspan, html_table::emit_td): New methods. (html_table::emit_col): Use html_table::emit_td. (html_table::emit_table_header): Use html_table::emit_colspan if dialect xhtml is specified. (html_table::finish_row): Updated. * src/devices/grohtml/html-table.h (html_table): Declare emit_colspan, emit_td. * src/devices/grohtml/html-text.cpp: Modified tags to comply with xhtml if this dialect was requested. * src/devices/grohtml/html-text.h (html_dialect): New enumeration. (html_text): Add new variable `dialect'. * src/devices/grohtml/post-html.cpp: Modify header tags to be XHTML compliant. (valid_flag, groff_sig, dialect): New global variables. (html_printer::handle_valid_flag, html_printer::do_math, html_printer::write_html_anchor, html_printer::write_xhtml_anchor, html_printer::do_math, html_printer::handle_valid_flag): New methods. (html_printer::emit_line, html_printer::emit_raw, html_printer::do_check_center, html_printer::write_title, write_rule, html_printer::writeHeadMetaStyle, generate_img_src, html_printer::begin_page): Altered to be XHTML compliant. (html_printer::write_header): Updated. (html_printer::troff_tag): Call do_math. (html_printer::insert_split_file, html_printer::do_file_components, html_printer::write_navigation): Create XHTML file components if necessary and also produces a groff signature if requested. (~html_printer): Call writeHeadMetaStyle at appropriate places depending upon html_dialect. (html_printer::special): Handle new tags `html<?p>' and `math<?p>'. (main): Added options -x, -V, and -y. (usage): Updated. * src/preproc/eqn/box.cpp: Create a distinction between the MathML device and the XHTML device. (do_text): Issue a newline at the end of the equation if XHTML was specified. (box::top_level): Prefix the output of an equation by the .MATHML macro. (output_string): Suppress \n if XHTML was specified. * src/preproc/eqn/main.cpp (xhtml): New global flag. (inline_equation): Skip leading spaces after inline equation for XHTML device. (main): Set `xhtml' flag if `-Tmathml:xhtml' is specified. * src/preproc/eqn/eqn.h (xhtml): New external flag. * src/preproc/eqn/text.cpp (entity_table): Fix typo. * src/preproc/html/pre-html.cpp (html_dialect): New enumeration. (dialect, eqn_flag): New global variables. (html_system): Improve debugging support. (alterDeviceTo): Test for -Txhtml when altering device to the image device and reset to -Txhtml. (addZ): Renamed to... (addArg): This. Introducea a general parameter. (print_args): New debugging function. (char_buffer::run_output_filter): Use print_args and addArg rather than addZ. (char_buffer::do_html, char_buffer::do_image): Add -rxhtml=1 command line parameter as an argument to the html generation of text when xhtml is needed. Include -e on the command line if mathml is required. (scanArguments): Allow -e, -V, -y and -x options. -V, -y are handled by the back end. -e sets `eqn_flag'. -x determines HTML dialect. * src/roff/groff/groff.cpp (possible_command): New method `clear_name'. (main): Set eflag if -e is present on command line. Set is_xhtml if -Txhtml is present. Pass `-x x' to the HTML pre and post processors. Pass `-e' to the HTML pre processor if required. Pass `-Tmathml:xhtml' to eqn if XHTML is requested. * src/roff/troff/input.cpp (init_input_requests): Introduce new number register `\n[.O]'. * tmac/s.tmac: (LP): Use .nop for semantic sugar. (cov*ab-init) reformat. (@EQ): Use EQN-HTML-IMAGE and friends rather than HTML-IMAGE. (CHECK-FOOTER-AND-KEEP): Define FS, FE such that they use <cite></cite> for the html device rather than generate images for footnotes. * tmac/troffrc-end: Define EQN-HTML-IMAGE, EQN-HTML-IMAGE-END, EQN-HTML-IMAGE-RIGHT, EQN-HTML-IMAGE-LEFT, EQN-HTML-IMAGE-INLINE, EQN-HTML-DO-IMAGE, EQN-HTML-IMAGE-END as null strings. * tmac/www.tmac: (HTML<?p>): New macro. (MATH<?p>): New macro. (IMG, PIMG, MPIMG, HR): Use XHTML compliant syntax. (www-emit-ltag): New macro. (www-push-li): Updated. (ULS): Ensure that tags are balanced in order by use of www-emit-ltag. (ULE): Likewise: Use www-emit-ltag and shut down paragraphs in order. (OLS, OLE, DLS, DLE): Ditto. <global>: Define EQ and EN to EQN-HTML-IMAGE and EQN-HTML-IMAGE-END respectively. (www-li-ul, www-li-ol, www-li-dl): Updated. (EQN-HTML-IMAGE, EQN-HTML-IMAGE-RIGHT, EQN-HTML-IMAGE-LEFT, EQN-HTML-IMAGE-INLINE, EQN-HTML-DO-IMAGE, EQN-HTML-IMAGE-END, MATHML): New macros.
* * tmac/unicode.tmac: Make `-' a pure input character by mapping itwl2007-09-141-0/+1
| | | | | | to `hy'. * src/roff/troff/input.cpp (init_charset_table): Handle `hy'.
* * src/roff/troff/input.cpp (get_copy): Add third argument to controlwl2007-03-191-6/+11
| | | | | whether \E shall be expanded. (get_char_for_escape_name): Allow \E.
* Add `\%^' escape to handle the parameters to a macro as a stringwl2006-10-261-17/+73
| | | | | | | | | | | | | | | | | | | | | | argument. * src/roff/troff/input.h (DOUBLE_QUOTE): New special character. * src/roff/troff/input.cpp (input_iterator, input_stack, macro_iterator): Add `space_follows_arg' member function. (macro_iterator::add_arg): Add parameter to set the `space_follows' flag. (arg_list): Add member `space_follows'. Update constructor and all callers. (decode_args): Store discarded double quotes. (interpolate_args): Handle DOUBLE_QUOTE. Add `\%^' escape. (get_copy, token::next, composite_glyph_name): Handle DOUBLE_QUOTE. * tmac/trace.tmac: Trace .nr, .ds, .ds1, .as, .as1. * docs/groff.texinfo (Parameters), man/groff.man, man/groff_diff.man, NEWS: Document it.
* * src/roff/troff/input.cpp (read_size): Revert previous changewl2006-09-101-10/+3
| | | | | | w.r.t. `\s-[-...]'. * doc/groff.texinfo (Fractional Size Types): Clarify syntax of \s.
* * src/roff/troff/input.cpp (read_size): Fix `\s[-\n[.s]]' so that itwl2006-09-091-4/+14
| | | | | | behave the same as `\s-[\n[.s]]' (this is, emit a warning and set point size to 1). Reported by Gunnar Ritter. Also catch `\s-[-...]' and friends (causing an error).
* * src/roff/troff/input.cpp (interpolate_macro):wl2006-06-291-1/+1
| | | | s/probably/possibly/, as suggested by Keith.
* * src/roff/troff/input.cpp (token::next) <\N>: Catch negative valueswl2006-05-311-0/+4
| | | | | | | here. * doc/Makefile.sub (EXAMPLEFILES): Move gnu.eps to... (PROCESSEDEXAMPLEFILES): Here.
* * src/libs/libgroff/font.cpp (font::load): Reject fonts calledwl2006-05-301-4/+2
| | | | | | | | | | | | | | | | | | | | `DESC'. Reduce number of false positives for `.if F ...' conditionals. Improve warning messages. * tmac/Makefile.sub: Add copyright notice. (NORMALFILES): Add man.tmac and ms.tmac. (SPECIALFILES): Remove man.tmac and ms.tmac. (CLEANADD): Remove man.tmac-sed and ms.tmac-sed. (install_data, uninstall_sub): Don't handle man.tmac and ms.tmac specially. (stamp-sed): Don't handle man.tmac and ms.tmac. Remove obsolete components in sed's regexp. * doc/Makefile.sub (EXAMPLEFILES): Add gnu.eps. * Makefile.in (OTHERDIRS, NOMAKEDIRS): Add hdtbl.
* Surround the (pseudo) file name for the .pso request with `<' andwl2006-04-261-2/+2
| | | | | | | | | | | | | `>'. * src/roff/troff/node.cpp (real_output_file, troff_output_file): Add second parameter to `really_put_filename' and `put_filename'. (troff_output_file::really_put_filename): Emit `<' and `>' around filename if second argument is set. * src/roff/troff/node.h: Updated. * src/roff/troff/input.cpp (file_iterator::file_iterator, file_iterator::set_location): Update to changes in node.cpp.
* Implement new number register `.br' which is set to 1 if a macro haswl2006-04-041-6/+26
| | | | | | | | | | | | | | | | | | | | | | been called as .foo and to 0 if called as 'bar. This is useful for -mtrace so that requests can be reliably traced too. * src/roff/troff/input.cpp (input_iterator): Add virtual function `get_break_flag'. (macro_iterator): Add `with_break' member and `get_break_flag' function. Update constructors. (input_stack): Add function `get_break_flag'. (break_flag_reg): New number register class. (input_init_requests): Register `.br'. * src/roff/troff/TODO: Updated. * tmac/trace.tmac: s/!!sp/!!!sp/. Modify definitions of `de', `de1', `am', and `am1' to use \n[.br]. * docs/groff.texinfo, man/groff.man, man/groff_diff.man, NEWS: Document it.
* Add two request `.device' and `.devicem' which are equivalent towl2006-03-271-0/+37
| | | | | | | | | | | `\X' and `\Y', respectively. * src/roff/troff/input.cpp (device_request, device_macro_request): New functions. (init_input_requests): Register them. * doc/groff.texinfo, man/groff_diff.man, man/groff.man, NEWS: Document them.
* * src/roff/troff/input.cpp (encode_char): Emit special characterswl2006-03-271-3/+2
| | | | | | | for -Thtml as `\[...]'. * src/devices/grohtml/post-html.cpp (page::add_and_encode): Updated. * doc/groff.texinfo (\X): Updated.
* Concretize the glyph datatype.wl2006-02-231-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/include/font.h (struct glyph): Remove class. (struct glyph): Renamed from struct glyphinfo. (glyph_to_index): New inline function. (glyph_to_name): Make extern, not inline. (glyph_to_number): Update. (font): Use `glyph *' instead of `glyph'. * src/libs/libgroff/nametoindex.cpp (charinfo): Inherit from class `glyph'. Make `name' field public. (character_indexer, number_to_glyph, name_to_glyph): Use `glyph *' instead of `glyph'. (glyph_to_name): Renamed from `glyph::glyph_name'. * src/roff/troff/charinfo.h (charinfo): Inherit from class `glyph'. Use `glyph *' instead of `glyph'. * src/roff/troff/input.cpp (name_to_glyph, number_to_glyph): Use `glyph *' instead of `glyph'. (glyph_to_name): Renamed from `glyph::glyph_name'. * src/libs/libgroff/font.cpp: Use `glyph *' instead of `glyph', and `glyph_to_index' instead of `glyph::glyph_index'. * src/include/printer.h (printer): Use `glyph *' instead of `glyph'. * src/libs/libdriver/printer.cpp: Likewise. * src/devices/grodvi/dvi.cpp: Likewise. * src/devices/grohtml/post-html.cpp: Likewise. * src/devices/grolbp/lbp.cpp: Likewise. * src/devices/grolj4/lj4.cpp: Likewise. * src/devices/grops/ps.cpp: Likewise. * src/devices/grotty/tty.cpp: Likewise.
* * src/include/font.h (name_to_glyph): Renamed fromwl2006-02-171-7/+4
| | | | | | | | | | | | | | | | | font::name_to_index. (number_to_glyph): Renamed from font::number_to_index. (glyph_to_name): Renamed from font::index_to_name. (glyph_to_number): Renamed from font::index_to_number. * src/libs/libgroff/nametoindex.cpp: Likewise. * src/roff/troff/charinfo.h (charinfo::as_glyph): Renamed from charinfo::get_index. * src/roff/troff/input.cpp: All callers changed. * src/roff/troff/node.cpp: Likewise. * src/libs/libgroff/font.cpp: Likewise. * src/devices/grops/ps.cpp: Likewise. * src/devices/grohtml/post-html.cpp: Likewise. * src/libs/libdriver/printer.cpp: Likewise.
* * src/include/font.h (struct glyphinfo): New class.wl2006-02-171-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (struct glyph): Change internal representation. Change constructor signature. New method glyph::glyph_number(). (glyph::glyph, glyph glyph::undefined_glyph, glyph::glyph_index, glyph::operator==, glyph::operator!=): Update. (font::index_to_name, font::index_to_number): New functions. * src/include/itable.h: New file, based on src/include/ptable.h. * src/libs/libgroff/nametoindex.cpp: Include itable.h. (class charinfo): New class. (class character_indexer): Change table result type from `int' to `class charinfo'. Add table with integer key. (character_indexer::character_indexer): Update. (character_indexer::ascii_char_index): Update. (character_indexer::numbered_char_index): Use NULL as name, not a string starting with a space. (character_indexer::named_char_index): Update. (font::number_to_index, font::name_to_index): Remove no-op cast. (glyph::glyph_name): New method. * src/roff/troff/charinfo.h (class charinfo): Inherit from class glyphinfo. (NUMBERED): Remove flag bit. (charinfo::numbered, charinfo::get_index): Update. * src/roff/troff/input.cpp (charinfo::charinfo): Update. (charinfo::set_number, charinfo::get_number): Update. (glyph::glyph_name): New method.
* * src/include/font.h: s/glyph_t/glyph/.wl2006-02-111-3/+3
| | | | | | | Update all callers. * src/devices/grotty/tty.cpp: s/glyph/tty_glyph/. s/output_character_t/output_character/.
* New accessor method glyph_t::glyph_name().wl2006-02-111-1/+1
| | | | | | | | | | | | | | | | | | | | | * src/include/ptable.h (declare_ptable): Add a return value to the 'define' method, and declare a 'lookupassoc' method. (implement_ptable): Return the stored key in 'define'. Implement lookupassoc. * src/include/font.h (glyph_t): Add 'name' field. Add an argument to the constructor. (glyph_t::glyph_name): New method. * src/libs/libgroff/nametoindex.cpp (character_indexer): Change return type of methods and field member type to glyph_t. (character_indexer::character_indexer): Update. (character_indexer::ascii_char_index): Allocate a name for the glyph. Return a glyph_t with name. (character_indexer::numbered_char_index): Return a glyph_t without a name. (character_indexer::named_char_index): Return a glyph_t with a name. (font::number_to_index, font::name_to_index): Update. * src/roff/troff/input.cpp (charinfo::charinfo): Use the symbol as the glyph's name.
* Make the glyph data type abstract.wl2006-02-111-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/include/font.h (glyph_t): New class. (name_to_index, number_to_index): Change return type to glyph_t. (font::contains, font::get_width, font::get_height, font::get_depth, font::get_character_type, font::get_kern, font::get_skew, font::get_italic_correction, font::get_left_italic_correction, font::get_subscript_correction, font::get_code, font::get_special_device_encoding, font::add_entry, font::copy_entry, font::add_kern, font::hash_kern): Change argument type to glyph_t. * src/libs/libgroff/font.cpp (struct font_kern_list): Change members type and constructor argument types to glyph_t. (font::contains, font::get_width, font::get_height, font::get_depth, font::get_character_type, font::get_kern, font::get_skew, font::get_italic_correction, font::get_left_italic_correction, font::get_subscript_correction, font::get_code, font::get_special_device_encoding, font::add_entry, font::copy_entry, font::add_kern, font::hash_kern): Change argument type to glyph_t. (font::load): Use glyph_t variables. * src/libs/libgroff/nametoindex.cpp (name_to_index, number_to_index): Change return type to glyph_t. * src/roff/troff/charinfo.h (charinfo::index): Change type to glyph_t. (charinfo::get_index): Change return type to glyph_t. * src/roff/troff/env.cpp: Include font.h. * src/roff/troff/node.cpp: Include font.h before charinfo.h. * src/roff/troff/input.cpp: Include font.h before charinfo.h. (charinfo::charinfo): Update. (name_to_index, number_to_index): Change return type to glyph_t. * src/include/printer.h (printer::set_char_and_width): Change return type to glyph_t. * src/libs/libdriver/printer.cpp (printer::set_char_and_width): Change return type to glyph_t. * src/devices/grodvi/dvi.cpp (dvi_printer::set_char): Change argument type to glyph_t. * src/devices/grohtml/post-html.cpp (page::add_and_encode): Update. (html_printer::space_glyph): Renamed from space_char_index. (html_printer::add_to_sbuf, html_printer::sbuf_continuation, html_printer::overstrike, html_printer::set_char): Change argument type to glyph_t. (html_printer::set_char_and_width): Change return type to glyph_t. * src/devices/grolbp/lbp.cpp (lbp_printer::set_char): Change argument type to glyph_t. * src/devices/grolj4/lj4.cpp (lj4_printer::set_char): Change argument type to glyph_t. * src/devices/grops/ps.cpp (ps_printer::space_glyph): Renamed from space_char_index. (ps_printer::set_subencoding, ps_printer::set_char): Change argument type to glyph_t. * src/devices/grotty/tty.cpp (tty_printer::set_char): Change argument type to glyph_t.
* * src/roff/troff/input.cpp (font::name_to_index): Never return awl2006-02-111-2/+3
| | | | | | negative value. * src/libs/libgroff/font.cpp (font::load): Remove failure tests for font::name_to_index.
* Another try to update getopt files. This time we add a dummywl2005-06-161-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | gettext.h file to satisfy the dependency. * src/include/getopt.h, src/libs/libgroff/getopt.c, src/libs/libgroff/getopt1.c: Updated from GNU libc CVS. * src/include/getopt_int.h: New file (from GNU libc CVS). * src/include/gettext.h: Dummy file which just defines a gettext() macro. * src/include/groff-getopt.h: Updated. * src/include/Makefile.sub (HDRS): Add getopt_int.h and gettext.h. * src/libs/libdriver/input.cpp (IntArray): Remove superfluous `const' keywords in return value. * src/preproc/html/pushback.cpp (pushBackBuffer::~pushBackBuffer): Remove redundant variable `old'. (pushBackBuffer::skipToNewline): Remove redundant variable `ch'. * src/preproc/tbl/main.cpp (process_table): Remove redundant variable `c'. Fix more friend name injection problems since modern C++ compilers fail otherwise. We simply provide (global) declarations for all functions declared as friends. This is not really necessary but doesn't harm. * src/preproc/eqn/lex.cpp: Provide declarations for get_char, peek_char, and get_location. * src/preproc/refer/ref.h: Provide declarations for compare_reference, same_reference, same_year, same_date, same_author_last_name, and same_author_name. * src/roff/troff/div.h: Provide declarations for do_divert and page_offset. * src/roff/troff/env.h: Provide declarations for title_length, space_size, fill, no_fill, adjust, no_adjust, center, right_justify, vertical_spacing, post_vertical_spacing, line_spacing, line_length, indent, temporary_indent, do_underline, do_input_trap, set_tabs, margin_character, no_number, number_lines, leader_character, tab_character, hyphenate_request, no_hyphenate, hyphen_line_max_request, hyphenation_space_request, hyphenation_margin_request, line_width, tabs_save, tabs_restore, line_tabs_request, widow_control_request, and do_divert. * src/roff/troff/input.cpp: Provide declaration for chop_macro. * src/roff/troff/node.cpp: Provide declarations for class tfont_spec. Provide declaration for make_tfont.
* * All affected files: Update postal address of FSF.wl2005-05-261-1/+1
|
* * src/roff/troff/input.cpp (string_iterator::fill): Protect againstwl2005-02-281-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | null pointer. * tmac/papersize.tmac: Convert `paper' string contents to lowercase. * configure: Regenerated. * NEWS: Updated. Integrate `pdfmark' into normal groff build system; install macro `pdfmark' packages, build and install `pdfroff', and PDF format documentation. * Makefile.comm: Add PDFDOCDIR. * Makefile.in: (MDEFINES) ALT_AWK_PROGS, ALT_GHOSTSCRIPT_PROGS, pdfdocdir, make_pdfdoc, make_install_pdfdoc: New variables. (unstall_dirs): Add pdfdocdir. * aclocal.m4: (GROFF_APPRESDIR_OPTION): use AC_HELP_STRING instead of AS_HELP_STRING. (GROFF_GHOSTSCRIPT_PREFS): New function; support `--with-alt-gs' option, set ALT_GHOSTSCRIPT_PROGS. (GROFF_GHOSTSCRIPT_PATH): Support `--with-gs' option, force use of GROFF_GHOSTSCRIPT_PREFS, set GHOSTSCRIPT. (GROFF_HTML_PROGRAMS): Force use of GROFF_GHOSTSCRIPT_PATH; tidy up. (GROFF_AWK_PREFS): New function; support `--with-alt-awk' option, set ALT_AWK_PROGS. (GROFF_AWK_PATH): New function; support `--with-awk' option, force use of GROFF_AWK_PREFS. (GROFF_PDFDOC_PROGRAMS): New function; force use of GROFF_AWK_PATH and GROFF_GHOSTSCRIPT_PATH, set make_pdfdoc and make_install_pdfdoc. * configure.ac: Add AC_PREREQ(2.56), GROFF_PDFDOC_PROGRAMS. Remove GROFF_GHOSTSCRIPT_PATH, (forced by GROFF_PDFDOC_PROGRAMS, and also by modified GROFF_HTML_PROGRAMS).
* Make `test-groff' work again -- previously, wrong paths have beenwl2004-12-161-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | used. Additionally, it can now be called from anywhere. * test-groff.in: Don't test for groff binary. This is no longer necessary since the proper paths are determined by `configure'. (EXEEXT): Removed. No longer used. (srcdir, builddir): Use values provided by the configure script. (XENVIRONMENT): Updated. * INSTALL: Updated. Make .tag and .taga work for all devices (but only grohtml actually handles them). * src/devices/grohtml/post-html.cpp: s/html-tag/devtag/. (text_glob::is_br, page::add_tag, html_printer::troff_tag, html_printer::handle_assertion): Don't use hard-coded string lengths. (html_printer::lookahead_for_table): Reset `tbl' properly if necessary. (html_printer::devtag): New function, handling `devtag'. (html_printer::special): Don't handle `html-tag'. * src/include/printer.h, src/libs/libdriver/printer.cpp (printer::devtag): New virtual function. * src/libs/libdriver/input.cpp (parse_x_command) <'X'>: Handle `devtag'. * src/roff/troff/env.cpp, src/roff/troff/mtsm.cpp, src/roff/troff/node.cpp: s/html-tag/devtag/. * src/roff/troff/input.cpp (tag, taga): Always call curenv->add_node. * tmac/an-old.tmac, tmac/s.tmac, tmac/troffrc-end: Use DEVTAG* macros instead of HTML-TAG*. * tmac/devtag.tmac: New file, defining the DEVTAG-* macros. * tmac/www.tmac: Load devtag.tmac. Replace HTML-TAG* macros with DEVTAG* macros. (HTML, HTML-NS): Changed definitions. (URL): Use HTML-NS. (HTML-TAG, HTML-TAG-NS, HTML-TAG-NEXT): Removed. * tmac/Makefile.sub (NORMALFILES): Add devtag.tmac.
* formattingwl2004-11-221-3/+5
|
* * src/devices/grohtml/html-text.cpp (html_text_get_alignment),wl2004-10-151-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | src/devices/grohtml/post-html.cpp (make_val, html_printer::handle_state_assertion): Fix compiler warnings. * src/roff/troff/div.cpp: Include `stringclass.h' and `mtsm.h'. (diversion::diversion): Fix order of initializers. * src/roff/troff/div.h: Don't include `mtsm.h'. * src/roff/troff/env.cpp: Include `stringclass.h' and `mtsm.h'. (environment::environment): Fix order of initializers. (environment::make_tag, environment::construct_format_state): Fix compiler warnings. * src/roff/troff/input.cpp: Include `stringclass.h' and `mtsm.h'. (input_iterator::input_iterator, macro::macro): Fix order of initializers. * src/roff/troff/mtsm.cpp: Include only necessary header files. (state_set::add, state_set::val): Fix compiler warnings. * src/roff/troff/mtsm.h: Don't include `stringclass.h'. (bool_value_state, int_value_state, units_value_state, string_value_state): Remove comma after last element which causes an error with g++ 3.3.3. * src/roff/troff/node.cpp: Include `stringclass.h'. (hline_node::hline_node, vline_node::vline_node, space_char_hmotion_node, left_italic_corrected_node): Fix compiler warnings. (zero_width_node::zero_width_node): Fix order of initializers. * src/roff/troff/node.h: Don't include `mtsm.h'. (hmotion_node): Fix compiler warnings. * src/roff/troff/number.cpp: Include `stringclass.h' and `mtsm.h'.
* * src/roff/troff/column.cpp (vjustify_node::copy): Updated.wl2004-10-101-10/+224
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/roff/troff/div.h: Include `mtsm.h'. (diversion): New variables `any_chars_added', `needs_push', `saved_seen_break', `saved_seen_space', `saved_seen_eol', `saved_suppress_next_eol', `modified_tag'. New virtual member function `is_diversion'. Update all descendants. * src/roff/troff/div.cpp (diversion::diversion, macro_diversion::macro_diversion): Updated. (do_divert): Handle `seen_break', `seen_space', `seen_eol', `suppress_next_eol'. (top_level_diversion::space): Handle `curenv->seen_space'. (page_offset): Update tag handling. (space_request, blank_line, flush_output): Don't call `add_html_tag'. * src/roff/troff/env.h (environment): Make `tabs' public. Remove `ignore_next_eol', `emitted_node'. Update `output_line', `output'. New variables `seen_space', `seen_eol', `suppress_next_eol', `seen_break'. New member functions `construct_state', `make_tag', `construct_format_state, `construct_new_line_state, `dump_troff_state'. Remove `add_html_tag', `make_html_tag'. * src/roff/troff/env.cpp: New externs `suppress_push', `get_diversion_state', `global_diverted_space'. (pending_output_line): New variable `was_centered'. Update constructor and all callers. (pending_output_line::output): Call `curenv->construct_format_state'. (environment::environment, environment::copy): Updated. (environment::output): Handle `was_centered'. (environment::add_char): Handle construct and diversion state. (environment::add_node): Handle construct state. (environment::newline): Handle `was_centered'. (environment::output_line): Updated. (environment::possibly_break_line): Updated. Update tag handling. (environment::add_html_tag): Replaced with... (environment::make_tag): New function. (environment::add_html_tag_tabs, environment::make_html_tag): Removed. (environment::dump_troff_state): New debugging function. (environment::construct_state, environment::construct_format_state, environment::construct_new_line_state): New functions. (environment::do_break): Updated. Handle `global_diverted_space'. (environment::handle_tag): Update tag handling. (point_size, fill, do_break_request): Don't call `add_html_tag'. (no_fill): Don't call `add_html_tag'. Set `suppress_next_eol'. (center, right_justify, line_length, indent, temporary_indent, set_tabs): Update tag handling. * src/roff/troff/input.cpp: Don't include `stringclass.h'. (input_iterator): New variables `is_diversion', `diversion_state'. Update constructors. (input_stack): New member functions `get_div_level', `get_diversion_state', `check_end_diversion'. New variables `div_level', `diversion_state'. Initialize them. (suppress_push, global_diverted_space): New global variables. (input_stack::finish_get, input_stack::finish_peek, input_stack::remove_boundary, input_stack::end_file, input_stack::clear, input_stack::pop_macro): Call `check_end_diversion'. (input_stack::push): Handle `div_level' and `diversion_state'. (get_diversion_state): New function. (diverted_space_node::reread): Handle `global_diverted_space'. (macro::macro): Update constructors. (macro::is_diversion): New function. (macro::operator=): Set `is_a_diversion'. (string_iterator): New member function `is_diversion'. (string_iterator::string_iterator): Update constructors. (string_iterator::fill): Set `div_nest_level'. (macro_iterator): New member function `is_diversion'. (do_if_request): Handle `suppress_push'. (tag, taga): New functions. (init_input_requests): Add `tag' and `taga' requests.
* Fix \$@ and \$* to handle any number of arguments.wl2004-09-271-30/+57
| | | | | | | | | | | | | | | * src/roff/troff/input.h (BEGIN_QUOTE, END_QUOTE): New special characters. * src/roff/troff/input.cpp (input_iterator::internal_level): Removed. (input_stack): New member functions `increase_level' and `decrease_level'. (input_stack::get_level): Don't use `internal_level'. (get_copy, token::next): Handle BEGIN_QUOTE and END_QUOTE. (end_quote_iterator): Completely removed. (interpolate_arg): Build string for \$@ and \$* which is then pushed onto the input stack.