summaryrefslogtreecommitdiff
path: root/src/include
Commit message (Collapse)AuthorAgeFilesLines
* Use a better type for symbol hashes.G. Branden Robinson2023-03-061-5/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * bootstrap.conf: Add "stdint" module to ensure that the `uintptr_t` type is available. * src/include/symbol.h: Include <stdint.h> for `uintptr_t`. (class symbol): (symbol::hash): Change return type from `unsigned long`, which causes build failures on 64-bit MinGW, to `uintptr_t`. (symbol::hash): Use a C++ type cast, not a C-style one. Thanks to Bruno Haible for reporting the build failure in the 64-bit MinGW environment, and for suggesting a remedy. Also update editor aid comments; drop old style Emacs file-local variable setting. Any day you get to use the foot-Howitzer reinterpret_cast is a good one. Commits since 0221b657fe tested on: Debian bullseye Debian sid 2023-03-06 chroot macOS 12 OpenBSD 7.2 Solaris 10 Solaris 11
* [src]: Group and order standard libc inclusions.G. Branden Robinson2023-02-091-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Inclusion order is not supposed to matter for standard C header files, so treating this as a code style issue. * src/devices/grodvi/dvi.cpp: * src/devices/grolj4/lj4.cpp: * src/include/stringclass.h: * src/libs/libbib/linear.cpp: * src/libs/libbib/search.cpp: * src/libs/libdriver/printer.cpp: * src/libs/libgroff/assert.cpp: * src/libs/libgroff/color.cpp: * src/libs/libgroff/errarg.cpp: * src/libs/libgroff/font.cpp: * src/libs/libgroff/nametoindex.cpp: * src/libs/libgroff/prime.cpp: * src/libs/libgroff/relocate.cpp: * src/libs/libgroff/searchpath.cpp: * src/preproc/eqn/box.cpp: * src/preproc/eqn/delim.cpp: * src/preproc/eqn/pile.cpp: * src/preproc/eqn/script.cpp: * src/preproc/html/pre-html.cpp: * src/preproc/pic/pic.h: * src/preproc/preconv/preconv.cpp: * src/preproc/soelim/soelim.cpp: * src/roff/groff/groff.cpp: * src/roff/troff/troff.h: * src/utils/hpftodit/hpftodit.cpp: * src/utils/indxbib/indxbib.cpp: * src/utils/lkbib/lkbib.cpp: * src/utils/lookbib/lookbib.cpp: * src/utils/tfmtodit/tfmtodit.cpp: Do it.
* src/include/assert.h: Delete.G. Branden Robinson2023-02-093-45/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Switch to using system's assert.h header file. It is futile to attempt to preserve compatibility with ISO C90 systems by providing a bespoke predicate-reporting assert() (a C99 feature) when gnulib, which we require, itself demands C99. This ensures that `static_assert` remains defined so that gnulib can use it. Thanks to Bruno Haible for the consultation. <https://lists.gnu.org/archive/html/groff/2023-02/msg00034.html> * src/include/assert.h: Delete. * src/devices/grodvi/dvi.cpp: * src/devices/grolbp/lbp.cpp: * src/devices/grolj4/lj4.cpp: * src/include/itable.h: * src/include/stringclass.h: * src/libs/libbib/linear.cpp: * src/libs/libbib/search.cpp: * src/libs/libdriver/printer.cpp: * src/libs/libgroff/assert.cpp: * src/libs/libgroff/color.cpp: * src/libs/libgroff/errarg.cpp: * src/libs/libgroff/font.cpp: * src/libs/libgroff/nametoindex.cpp: * src/libs/libgroff/prime.cpp: * src/libs/libgroff/relocate.cpp: * src/libs/libgroff/searchpath.cpp: * src/preproc/eqn/box.cpp: * src/preproc/eqn/delim.cpp: * src/preproc/eqn/pile.cpp: * src/preproc/eqn/script.cpp: * src/preproc/html/pre-html.cpp: * src/preproc/pic/pic.h: * src/preproc/preconv/preconv.cpp: * src/preproc/soelim/soelim.cpp: * src/roff/groff/groff.cpp: * src/roff/troff/troff.h: * src/utils/hpftodit/hpftodit.cpp: * src/utils/indxbib/indxbib.cpp: * src/utils/lkbib/lkbib.cpp: * src/utils/lookbib/lookbib.cpp: * src/utils/tfmtodit/tfmtodit.cpp: Respell "assert.h" inclusion with angle brackets instead of quotation marks. Fixes <https://savannah.gnu.org/bugs/?63078>. * ANNOUNCE: Update bug counts.
* [grodvi, ...]: Trivially refactor.G. Branden Robinson2022-09-255-10/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Tidy up #includes of the "assert.h" header, which we locally provide to ensure a C99-conformant implementation. Drop inclusion of header from files that don't directly need it, add it where they do, and spell the inclusion consistently with double quotes to cue the reader of its local status. * src/devices/grodvi/dvi.cpp: * src/devices/grolj4/lj4.cpp: * src/libs/libdriver/printer.cpp: * src/preproc/eqn/box.cpp: * src/preproc/eqn/delim.cpp: * src/preproc/eqn/pile.cpp: * src/preproc/eqn/script.cpp: Add inclusion. * src/include/driver.h: * src/libs/libgroff/fontfile.cpp: * src/preproc/eqn/eqn.h: * src/preproc/html/pushback.cpp: * src/preproc/refer/refer.h: * src/preproc/tbl/table.h: * src/utils/addftinfo/addftinfo.cpp: Drop inclusion. * src/include/itable.h: * src/include/stringclass.h: * src/libs/libbib/linear.cpp: * src/libs/libbib/search.cpp: * src/libs/libgroff/color.cpp: * src/libs/libgroff/font.cpp: * src/libs/libgroff/nametoindex.cpp: * src/libs/libgroff/prime.cpp: * src/libs/libgroff/searchpath.cpp: * src/preproc/html/pre-html.cpp: * src/preproc/preconv/preconv.cpp: * src/preproc/soelim/soelim.cpp: * src/utils/indxbib/indxbib.cpp: * src/utils/lkbib/lkbib.cpp: * src/utils/lookbib/lookbib.cpp: Respell inclusion. Fixes <https://savannah.gnu.org/bugs/?63079>. Thanks to Bjarni Ingi Gislason for the report. Also annotate our assert.h to indicate why it's there. Also update editor aid comments and drop old style Emacs file-local variable setting.
* [troff, ...]: Trivially refactor.G. Branden Robinson2022-09-251-2/+2
| | | | | | | | | | | | | | | | | | | | | Boolify and rename internal library function from `invalid_input_char` to `is_invalid_input_char`. * src/include/lib.h: Do it. * src/libs/libgroff/font.cpp (text_file::next_line): * src/preproc/eqn/lex.cpp (file_input::read_line): * src/preproc/eqn/main.cpp (read_line, main): * src/preproc/pic/lex.cpp (file_input::read_line, simple_file_input::get, simple_file_input::peek): * src/preproc/pic/main.cpp (top_input::get, top_input::peek, do_file): * src/preproc/refer/command.cpp (input_stack::push_file): * src/preproc/refer/refer.cpp (do_file, do_bib): * src/roff/troff/env.cpp (environment::make_tag): * src/roff/troff/input.cpp (file_iterator::fill, file_iterator::peek) (get_char_for_escape_parameter, transparent_translate, read_request) (asciify, input_char_description, read_string, transparent_file) (set_string): Update call sites.
* [libgroff]: Enable more informative diagnostics.G. Branden Robinson2022-06-211-1/+1
| | | | | | | | | | | | | | | | | | | | [libgroff]: Update return type of `font::load_desc` function to enable more informative diagnostics from callers. * src/include/font.h (font::load_desc): Change return type from `bool` to `const char` pointer. * src/libs/libgroff/font.cpp (font::load_desc): Return null pointer literal on failed `open()` or validation failures. Return filespec on success. * src/libs/libdriver/input.cpp (do_file): * src/preproc/grn/main.cpp (getres): * src/roff/groff/groff.cpp (main): * src/roff/troff/input.cpp (main): Compare `font::load_desc()` return value to null pointer literal instead of treating it as a Boolean. * src/roff/groff/groff.cpp (main): Report full filespec of troublesome "DESC" file when complainiing of missing "postpro" directive.
* [docs]: Improve terminological discipline.G. Branden Robinson2022-01-211-2/+2
| | | | | | | | | | Migrate from "base line" to "baseline". Also drop "baseline" from injection in the midst of the "vertical spacing" term (which is defined in terms of the baseline). Add "baseline" and "vertical spacing" as terms in the at present notional "Concepts" section of roff(7), which the page has long promised but not yet delivered.
* [libbib, libgroff, indxbib]: Slightly refactor.G. Branden Robinson2022-01-051-1/+3
| | | | | | | | | | | | | | | | | | | Also, it's silly to test even numbers > 2 for primality. Stop. * src/include/lib.h: Include `stdbool.h` since this header file is used for both C and C++ code. * src/include/lib.h (is_prime): * src/libs/libgroff/prime.cpp (is_prime): Boolify. Return Boolean instead of integer literals and demote return type to `bool`. Include `assert.h` and add assertion to reject mathematically offensive input. * src/libs/libbib/index.cpp (index_search_item::read_common_words_file): Test only odd numbers for primality. * src/utils/indxbib/indxbib.cpp (main): Same. Since the number comes from user input, make it (a potential hash table size) odd first. Also add editor aid comments.
* [libgroff]: Trivially refactor.G. Branden Robinson2021-11-241-32/+28
| | | | | * src/include/error.h: Drop parameter names from prototypes, in keeping with the Stroustrup-style C++ used in most of groff.
* [libgroff]: Slightly refactor.G. Branden Robinson2021-11-241-37/+42
| | | | | | | | * src/include/error.h: Drop `extern` storage class from diagnostic function prototypes. Also update editor aid comments; drop old style Emacs file-local variable setting.
* [libgroff,grops]: Slightly refactor.G. Branden Robinson2021-11-101-33/+37
| | | | | | | | | | | | | | | | | * src/devices/grops/ps.cpp: Explicitly preprocessor-include "lib.h" since we use the `PI` symbol it defines. * src/include/lib.h: Add inclusion guard. Wrap only `extern "C" and its braces in preprocessor conditionals, so that prototypes are present in the header even for C language code that #includes this header. Add `static` storage class to `PI` symbol to avoid redefinition errors from the linker. Give `path_name_max` a proper prototype, taking a `void` parameter list. * src/libs/libgroff/iftoa.c (if_to_a): * src/libs/libgroff/itoa.c (i_to_a, ui_to_a): Add `const` type qualifier to function definitions for agreement with prototypes in "lib.h". Drop local copies of prototypes.
* [libgroff]: Centralize defs of {U,}INT_DIGITS.G. Branden Robinson2021-11-101-6/+28
| | | | | | | | | | | | | | | | | | * src/libs/libgroff/iftoa.c: * src/libs/libgroff/itoa.c: Move definitions of `INT_DIGITS` and `UINT_DIGITS` from here... * src/include/lib.h: ...to here. * src/libs/libgroff/iftoa.c: * src/libs/libgroff/itoa.c: Preprocessor-include "lib.h". This revealed missing guards around `extern "C"` declarations, so... * src/include/lib.h: Add them where necessary. Also wrap long lines. Also update editor aids where missing; drop old style Emacs file-local variable settings.
* [libgroff]: Use C++98 null pointer constant.G. Branden Robinson2021-09-221-31/+33
| | | | | | | * src/include/font.h (UNDEFINED_GLYPH): Use idiomatic C++98 null pointer constant. Update some comments.
* [libgroff]: Slightly refactor `scan_papersize`.G. Branden Robinson2021-09-191-6/+7
| | | | | | | | | * src/include/font.h (font::scan_papersize): Demote return type from `int` to `bool`. * src/libs/libgroff/font.cpp (font::scan_papersize): As above. Use Boolean instead of integer literals. Also rename `FILE` stream pointer from `f` to `fp` and perform an explicit comparison against the idiomatic C++98 null pointer constant.
* [libgroff, troff]: Slightly refactor.G. Branden Robinson2021-09-171-17/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [libgroff, troff]: Slightly refactor device and font description file loading. Remove dead code. * src/include/font.h (font::load_font): Drop second parameter. It was never used for its intended purpose. (load): Drop first parameter; likewise. * src/libs/libgroff/font.cpp (font::load) (load): As above. * src/libs/libgroff/font.cpp (struct text_file): Rename `skip_comments` to `recognize_comments`. Demote that and `silent` from `int` to `bool`. (text_file::text_file): Use Boolean rather than integer literals in constructor. (text_file::next_line, font::load): Apply above renaming. * src/libs/libgroff/font.cpp (font::load): Rename parameter from `head_only` to `load_header_only` to be more communicative. Drop test of font description file name being `DESC`; this code was not being reached. Stop throwing errors from this function on failure to open the file; the caller will handle this when it sees our false return value. Rename local variable `command` to `directive` for alignment with our documentation. Replace "I dont think this should happen" test and comment with `assert()`. (struct table): Rename member from `command` to `numeric_directive` to indicate its specificity, tracking only a subset of valid `DESC` file directives. * src/libs/libgroff/font.cpp (font::load, font::load_desc): Remove redundant assignments to the member variable formerly known as `skip_comments`. * src/libs/libgroff/font.cpp (font::load_desc): Rename local variable `directive_found` to `numeric_directive_found` to clarify logic. * src/roff/troff/node.cpp (mount_font_no_translate): Simplify call of `font::load_font`. The `not_found` in-out parameter which was so agonizingly passed up through layers of library calls was never actually read. Drop code that has been `#if 0`-ed out since 1993. Before and after of goofing up by trying to mount a font called "DESC". The former is groff 1.22.4. $ groff .fp 5 DESC troff: <standard input>:1: warning: can't find font 'DESC' $ ./build/test-groff .fp 5 DESC troff: .../build/font/devps/DESC:15: error: unrecognized directive 'lpr' after 'kernpairs' or 'charset' directive troff: <standard input>:1: error: cannot load font 'DESC' for mounting
* [libgroff]: Continue font boolification.G. Branden Robinson2021-09-171-6/+6
| | | | | | * src/include/font.h (font::unit_scale): * src/libs/libgroff/font.cpp (font::unit_scale): Demote return type from `int` to `bool`. Use Boolean literals instead of integers.
* [libgroff, troff]: Further boolify.G. Branden Robinson2021-09-161-12/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/include/font.h (load_font, font): Demote parameters from {pointer to} `int` to `bool` and update default literal from integer to Boolean (except for the pointer). Update comment. * src/libs/libgroff/font.cpp (load_font, load): Similarly. * src/roff/troff/node.h (mount_font): * src/roff/troff/node.cpp (mount_font): Demote return type from `int` to `bool`. * src/roff/troff/node.h (mount_style): * src/roff/troff/node.cpp (mount_style): Promote return type from `void` to `bool`. * src/roff/troff/node.cpp (mount_font_no_translate): Demote return type and `check_only` parameter from `int` to `bool` and use Boolean rather than integer literals with them. (check_font): Update call site of `mount_font_no_translate` to use Boolean literal. (font_position): Indicate that "error" is ignored by casting return value of `mount_font` to void instead of using a comment. (style): Cast return value of `mount_style` to `void`. The return value of `mount_style` will be used elsewhere in a forthcoming commit.
* [libbib]: Partially boolify.G. Branden Robinson2021-09-121-2/+7
| | | | | | | | | | | | | | | | | | | * src/include/search.h: * src/libs/libbib/index.cpp: * src/preproc/refer/refer.cpp: * src/utils/lkbib/lkbib.cpp: * src/utils/lookbib/lookbib.cpp: Demote `verify_flag` from an `int` to a `bool`, rename it to `do_verify`, use Boolean instead of integer literals with it, and update call sites. * src/libs/libbib/index.cpp: Rename `do_verify()` member function to `get_invalidity_reason()` (it returns a string). Demote `load()` from `int` to `bool`; do the same for `verify()` and rename it to `is_valid()` as well. Use Boolean instead of integer literals with them. (index_search_item::is_valid, make_index_search_item): Update call sites of renamed member functions.
* [libgroff]: Boolify `font::load_desc()` retval.G. Branden Robinson2021-08-281-3/+4
| | | | | * src/include/font.h (font::load_desc): * src/libs/libgroff/font.cpp (font::load_desc): Do it.
* [libgroff]: Boolify `font::load()` return value.G. Branden Robinson2021-08-281-10/+8
| | | | | * src/include/font.h (font::load): * src/libs/libgroff/font.cpp (font::load): Do it.
* Un-indirect token concatenation via macro.G. Branden Robinson2021-08-282-14/+6
| | | | | * src/include/itable.h: * src/include/ptable.h: Do it.
* [libgroff]: Drop support for `TRADITIONAL_CPP`.G. Branden Robinson2021-08-282-12/+4
| | | | | | | | | | This means a C preprocessor that does not support the ANSI C89/ISO C90 token concatenation operator "##". * src/include/itable.h: * src/include/ptable.h: Do it. * Makefile.am: Undocument preprocessor symbol.
* [libgroff]: Drop `a_delete` preprocessor wrapper.G. Branden Robinson2021-08-283-11/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... for the `delete` operator. It has been rendered unnecessary by the removal of support for ancient C++ compilers. * src/include/lib.h (a_delete): Drop symbol definition. * src/devices/grohtml/output.cpp (word::~word): * src/devices/grohtml/post-html.cpp (char_block::char_block, assert_state::~assert_state, assert_state::add, assert_state::close, replace_negate_str): * src/devices/grops/ps.cpp (ps_font::ps_font, subencoding::subencoding, ps_printer::define_encoding, ps_printer::encode_fonts): * src/devices/grops/psrm.cpp (resource_manager::document_setup, resource_manager::supply_resource): * src/devices/grotty/tty.cpp (tty_printer::tty_color, tty_printer::tty_printer, tty_printer::color_to_idx, tty_printer::add_char): * src/include/itable.h (ITABLE(T)::~ITABLE(T), ITABLE(T)::define): * src/include/ptable.h (PTABLE(T)::~PTABLE(T), PTABLE(T)::define): * src/libs/libbib/index.cpp (index_search_item::~index_search_item, make_index_search_item, index_search_item_iterator::index_search_item_iterator, index_search_item::get_tag, index_search_item::munge_filename, index_search_item::search): * src/libs/libbib/linear.cpp (bmpattern::~bmpattern, file_buffer::file_buffer, file_buffer::load, linear_searcher::linear_searcher, linear_searcher::~linear_searcher): * src/libs/libbib/search.cpp (search_list_iterator::search_list_iterator, search_item::search_item): * src/libs/libdriver/input.cpp (IntArray::~IntArray, IntArray::append, StringBuf::~StringBuf, StringBuf::append, get_integer_arg, parse_x_command, do_file): * src/libs/libdriver/printer.cpp (printer::printer, printer::load_font, text_file::~text_file, text_file::next, font::~font, font_widths_cache::~font_widths_cache, font:alloc_ch_index, font::extend_ch, font::compact, font::load_desc): * src/libs/libgroff/fontfile.cpp (font::open_file): * src/libs/libgroff/relocate.cpp (searchpath, searchpathext, set_current_prefix): * src/libs/libgroff/searchpath.cpp (search_path::search_path, search_path::command_line_dir, search_path::open_file, search_path::open_file_cautious): * src/libs/libgroff/string.cpp (sfree, srealloc, string::remove_spaces): * src/libs/libgroff/symbol.cpp (symbol::symbol, concat): * src/libs/libgroff/tmpfile.cpp (temp_init::temp_init, xtmpfile_list_init::~xtmpfile_list_init, xtmpfile): * src/preproc/eqn/box.cpp (set_gfont, set_grfont, set_gbfont, box_list::append, box_list::~box_list): * src/preproc/eqn/delim.cpp (make_delim_box, delim_box::~delim_box): * src/preproc/eqn/eqn.ypp (number): * src/preproc/eqn/lex.ypp (file_input::~file_input, argument_macro_input::~argument_macro_input): * src/preproc/eqn/pile.ypp (matrix_box::~matrix_box, matrix_box::append): * src/preproc/eqn/special.cpp (special_box::~special_box): * src/preproc/eqn/text.ypp (set_char_type): * src/preproc/html/pre-html.cpp (get_line, scanArguments): * src/preproc/pic/object.cpp (output::~output, output::set_args, text_item::~text_item, object_spec::~object_spec, command_object::~command_object, line_object::~line_object): * src/preproc/pic/pic.ypp (placeless_element, reset_variables, print_args, text_expr, object_spec, text, sprintf_args, path): * src/preproc/refer/command.cpp (input_item::~input_item, input_item::peek_char): * src/preproc/refer/label.ypp (lookup_label): * src/preproc/refer/refer.cpp (store_citation, store_reference): * src/preproc/tbl/main.cpp (format::add_rows, format::~format): * src/preproc/tbl/table.cpp (block_entry::~block_entry, table::~table, table::allocate): * src/roff/groff/groff.cpp (possible_command::~possible_command, possible_command::clear_name): * src/roff/troff/column.cpp (justification_spec::~justification_spec, justification_spec::append): * src/roff/troff/dictionary.cpp (dictionary::lookup): * src/roff/troff/env.cpp (override_sizes, tab_stops::to_string, hyphen_word, hyphen_trie::insert_hyphenation): * src/roff/troff/input.cpp (read_long_escape_name, token::next, do_get_long_name, temp_iterator::~temp_iterator, get_delim_name, pipe_source, read_string, pipe_output, system_request, open_mac_file, do_macro_source, do_register_assignment, do_string_assignment, read_draw_node, copy_mode_error): * src/roff/troff/node.cpp (troff_output_file::set_font, troff_output_file::~troff_output_file, draw_node::is_tag, grow_font_table, font_family::~font_family, font_family::make_definite): * src/utils/hpftodit/hpftodit.cpp (name_list::~name_list, read_map): * src/utils/indxbib/indxbib.cpp (main, get_cwd): * src/utils/tfmtodit/tfmtodit.cpp (tfm::~tfm, tfm::load): Port uses of `a_delete(xxx)` to `delete[]`.
* [libgroff]: Drop `ad_delete` preprocessor wrapper.G. Branden Robinson2021-08-281-3/+1
| | | | | | | | | | | | | ...for the `delete` operator. It has been rendered unnecessary by the removal of support for ancient C++ compilers. * src/include/lib.h (ad_delete): Drop symbol definition. * src/preproc/pic/object.cpp (graphic_object::print_text): * src/preproc/refer/ref.cpp (reference::reference, reference::merge, reference::insert_field, reference::delete_field): * src/preproc/tbl/main.cpp (format::add_rows): Port uses of `ad_delete(xxx)` to `delete[]`.
* Drop support for `ARRAY_DELETE_NEEDS_SIZE`.G. Branden Robinson2021-08-281-8/+0
| | | | | | | | | | * src/include/lib.h [ARRAY_DELETE_NEEDS_SIZE]: Drop preprocessor conditional branch. This abandons support for certain pre-ISO C++98 compilers. (According to a now-removed comment, unsized array deletion was documented in "ARM", meaning _The C++ Annotated Reference Manual_, published in 1989.) * Makefile.am: Undocument preprocessor symbol.
* [libgroff]: Drop redefinition of `INT_MIN`.G. Branden Robinson2021-08-271-18/+0
| | | | | | | | | * src/include/lib.h: Drop redefinition of `INT_MIN`. It was motivated by a bug in the AT&T C++ compiler (cfront), version 2.0, released in June 1989. Implementations have had 30 years to get this right; assume that they have. * PROBLEMS: Drop corresponding item.
* [libgroff]: Rename font class member variable.G. Branden Robinson2021-08-231-1/+1
| | | | | | | | | | | | * src/include/font.h (font class): Rename `unscaled_charwidths` member variable to `use_unscaled_charwidths`: since it is a Boolean, make it read more like a logical predicate. * src/libs/libgroff/font.cpp (font::get_width, font::load_desc): * src/libs/libgroff/fontfile.cpp (font class): Update initialization and assignments. Continues 749502cc, 13 August 2021.
* Convert some font class `int` members to `bool`.G. Branden Robinson2021-08-131-21/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/include/font.h (font class): Demote integers to Booleans and use Boolean literals where possible. Rename some member variables to look like logical predicates. - contains() - is_special() - has_ligature() - tcommand -> has_tcommand - unscaled_charwidths - pass_filenames - use_charnames_in_special - is_unicode - special (private) * src/libs/libgroff/font.cpp (font::font): Construct object using Boolean literal. (font::contains): (font::is_special): (font::has_ligature): Convert return type to `bool`. (font::load): (font::load_desc): Assign to member variables using Boolean literals. * src/libs/libgroff/fontfile.cpp: Initialize appropriate globals using `bool` type and Boolean literals. * src/roff/troff/troff.h: * src/roff/troff/input.cpp (main): * src/roff/troff/node.cpp (troff_output_file::put_char_width): Rename `tcommand_flag` to `device_has_command` to suggest a logical predicate, and to emphasize the formatter's concern with what the output device can accept in the intermediate output language. * src/roff/troff/input.cpp: Initialize `device_has_tcommand` global using `bool` type and Boolean literal.
* [libgroff, troff]: Add debug diagnostic level.G. Branden Robinson2021-07-271-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | * src/include/error.h: Declare functions `debug_with_file_and_line` and `debug`. * src/libs/libgroff/error.cpp: Add `DEBUG` to enum `error_type`. (do_error_with_file_and_line): Add case for `DEBUG` in switch. (debug, debug_with_file_and_line): Add new functions. Do the same for troff since it has a private implementation of the diagnostic functions (thanks to `output_warning()`). * src/roff/troff/input.cpp: Add `DEBUG` to enum `error_type`. (do_error_with_file_and_line): Add case for `DEBUG` in switch. (debug, debug_with_file_and_line): Add new functions. There are no call sites for debug() and I don't plan for there to be; I am adding these for developer convenience because it's the second time I've had to do so and I told myself after the first (ripping them back out after they'd helped me solve a problem) that if I ever needed them again I'd add them permanently.
* Update copyright1.23.0.rc1Bertrand Garrigues2020-11-1136-36/+36
| | | | | | | | * update-copyright.sh: use gnulib's 'update-copyright' script. Pass this script in directories 'arch', 'contrib', 'font', 'man', 'tmac', 'src' and on a list of extra files. * FOR-RELEASE: mention this point.
* Revert "Update copyright"Bertrand Garrigues2020-10-2536-36/+36
| | | | | | This reverts commit a2e955e07354c83939fabffebcf720d3333d1f6b. Some files (COPYING, FDL, bootstrap) should not have been updated
* Update copyrightBertrand Garrigues2020-10-2536-36/+36
| | | | | | | | Use gnulib's update-copyright script. * src/roff/groff/groff.cpp: update the printf displayed when 'groff -v' is invoked. * FOR-RELEASE: mention this point.
* Eliminate "Latest update:" comments.G. Branden Robinson2020-05-031-2/+0
| | | | | | We have a version control system for that. (Cf. 2a1ad5b0bdd9f261e8722407b6c7507f4414df7d and note the distinction.)
* Synchronize Emacs and Vim editor settings.G. Branden Robinson2020-04-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also add some settings (mainly fill columns and character encoding hints) to try to prevent chaos. Gory details follow. * ChangeLog.115: * ChangeLog.116: * ChangeLog.117: * ChangeLog.118: * ChangeLog.119: * ChangeLog.120: * ChangeLog.121: * Makefile.am: * arch/mingw/mingw.am: * arch/misc/misc.am: * contrib/chem/chem.am: * contrib/chem/chem.pl: * contrib/eqn2graph/eqn2graph.am: * contrib/gdiffmk/ChangeLog: * contrib/gdiffmk/gdiffmk.am: * contrib/glilypond/ChangeLog: * contrib/glilypond/ChangeLog.0x: * contrib/glilypond/args.pl: * contrib/glilypond/glilypond.am: * contrib/glilypond/glilypond.pl: * contrib/glilypond/oop_fh.pl: * contrib/glilypond/subs.pl: * contrib/gperl/gperl.am: * contrib/gpinyin/ChangeLog: * contrib/gpinyin/gpinyin.am: * contrib/gpinyin/gpinyin.pl: * contrib/gpinyin/subs.pl: * contrib/grap2graph/grap2graph.am: * contrib/groff_filenames/ChangeLog: * contrib/groff_filenames/groff_filenames.am: * contrib/hdtbl/ChangeLog: * contrib/hdtbl/hdtbl.am: * contrib/mm/mm.am: * contrib/mom/ChangeLog: * contrib/mom/mom.am: * contrib/pdfmark/ChangeLog: * contrib/pdfmark/pdfmark.am: * contrib/pic2graph/pic2graph.am: * font/devX100-12/devX100-12.am: * font/devX100/devX100.am: * font/devX75-12/devX75-12.am: * font/devX75/devX75.am: * font/devascii/devascii.am: * font/devcp1047/devcp1047.am * font/devdvi/devdvi.am: * font/devlbp/devlbp.am: * font/devlj4/devlj4.am: * font/devpdf/devpdf.am: * font/devps/devps.am: * font/devutf8/devutf8.am: * font/scripts/scripts.am: * man/man.am: * src/include/include.am: * src/libs/libbib/libbib.am: * src/libs/libdriver/libdriver.am: * src/libs/libgroff/libgroff.am: * src/libs/libxutil/libxutil.am: * src/roff/groff/groff.am: * src/roff/grog/grog.am: * src/roff/nroff/nroff.am: * src/roff/troff/troff.am: * src/utils/addftinfo/addftinfo.am: * src/utils/afmtodit/afmtodit.am: * src/utils/hpftodit/hpftodit.am: * tmac/tmac.am: Tell Vim to auto-indent the file. * BUG-REPORT: * ChangeLog.115: * ChangeLog.116: * ChangeLog.117: * ChangeLog.118: * ChangeLog.119: * ChangeLog.120: * ChangeLog.121: * INSTALL.extra: * Makefile.am: * arch/mingw/mingw.am: * arch/misc/misc.am: * contrib/chem/README.txt: * contrib/chem/chem.pl: * contrib/chem/examples/122/ch2a_ethyl.chem: * contrib/chem/examples/122/ch4a_stick.chem: * contrib/chem/examples/122/ch4j_ring4.chem: * contrib/chem/examples/README.txt: * contrib/chem/examples/atp.chem: * contrib/chem/examples/cholesterin.chem: * contrib/chem/examples/ethamivan.chem: * contrib/chem/examples/lsd.chem: * contrib/chem/examples/reserpine.chem: * contrib/eqn2graph/eqn2graph.am: * contrib/gdiffmk/ChangeLog: * contrib/gdiffmk/README: * contrib/gdiffmk/gdiffmk.am: * contrib/glilypond/ChangeLog: * contrib/glilypond/ChangeLog.0x: * contrib/glilypond/README.txt: * contrib/glilypond/args.pl: * contrib/glilypond/glilypond.pl: * contrib/glilypond/oop_fh.pl: * contrib/glilypond/subs.pl: * contrib/gpinyin/ChangeLog: * contrib/gpinyin/gpinyin.pl: * contrib/gpinyin/subs.pl: * contrib/grap2graph/grap2graph.am: * contrib/groff_filenames/ChangeLog: * contrib/hdtbl/ChangeLog: * contrib/mm/mm.am: * contrib/mom/ChangeLog: * contrib/mom/mom.am: * contrib/pdfmark/ChangeLog: * contrib/pic2graph/pic2graph.am: Set fill column to 72. * ChangeLog.116: * ChangeLog.117: * ChangeLog.118: * ChangeLog.119: * ChangeLog.120: * ChangeLog.121: * contrib/gdiffmk/ChangeLog: * contrib/glilypond/ChangeLog: * contrib/glilypond/ChangeLog.0x: * contrib/groff_filenames/ChangeLog: * contrib/hdtbl/ChangeLog: * contrib/mom/ChangeLog: * contrib/pdfmark/ChangeLog: Sort Emacs local variables lexicographically. * ChangeLog.115: * ChangeLog.116: * ChangeLog.117: * ChangeLog.118: * ChangeLog.119: * ChangeLog.120: * ChangeLog.121: Tell Emacs the file is a change-log. * Makefile.am: * arch/mingw/mingw.am: * arch/misc/misc.am: * contrib/eqn2graph/eqn2graph.am: Tell Vim the file is an Automake file (it detects at least some in-tree *.am files as ordinary Makefiles). * ChangeLog.115: * contrib/gdiffmk/ChangeLog: * contrib/pdfmark/ChangeLog: Remove Emacs coding declaration. No non-ASCII characters are present. * BUG-REPORT: Prevent Vim filetype detection (Vim thinks it's a generic configuration file due to the hash-commented legal notice). * contrib/glilypond/ChangeLog.0x: Tell Emacs the file is a "change-log" (not "change-log-mode"). * contrib/glilypond/README.txt: Comment the editor settings as is done in top-level plain text documentation. * contrib/gpinyin/ChangeLog: Set Emacs "version-control" variable to "never", in parallel with ChangeLog files elsewhere. (I'm not sure this is necessary with Git, however; maybe we should be removing them everywhere. If so, that's easy to sed.)
* Remove inline notations of file "position".G. Branden Robinson2020-04-291-2/+0
| | | | | | These comments were not used consistently throughout the tree, several had become stale since the rename of man page source files within the tree years ago to include the manual section number.
* Fix nits in current_time() implementation.G. Branden Robinson2020-04-191-0/+4
| | | | | | | | | | | | | | | | | | | | | | | * src/include/curtime.h: #include <time.h> if we're returning a time_t from current_time(). * src/libs/libgroff/curtime.cpp (current_time): Quote $SOURCE_DATE_EPOCH variable content since it's under user control and could have all kinds of bogosity in it (like whitespace). Tested with: // from build directory: // $ c++ -Wall -I ../src/include -I ../gnulib/lib -static thisfile.cc // -L . -lgroff -L lib -lgnu // $ SOURCE_DATE_EPOCH='aa ' ./a.out // $ SOURCE_DATE_EPOCH=1aa ./a.out int main(int argc, char *argv[]) { program_name = "test-curtime"; long t = current_time(); // die here if $SOURCE_EPOCH_DATE is bogus std::cout << "The time is " << t << ".\n"; }
* Delete editor-settings comment banners.G. Branden Robinson2020-04-191-4/+0
| | | | | | | | | Most users and developers have lexical coloring/syntax highlighting available these days (cf. 30 years ago). Leaving them in plain-text files (like READMEs) because these are generally not machine-parsed (except for changelogs...) and the indicator may conceivably be useful to novices who stumble across them.
* Make our assert() C99-conformant.G. Branden Robinson2020-04-131-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | groff has its own implementation of the standard C library's assert() macro. It hasn't been updated since C89. C99 requires that the diagnostic emitted by assert() contain the failing expression and name of the function in scope. * src/include/assert.h: Add additional pointer to const char arguments to do_assert() and assertion_failed() for function name and stringified expression. (assertion_failed): Update prototype. (do_assert): Accept 'func' and 'msg' parameters and pass them to assertion_failed(). (assert): Update macro to collect '__func__' and stringify the expr parameter (as 'msg') and pass them do do_assert(). * src/libs/libgroff/assert.cpp (assertion_failed): Rewrite diagnostic to more closely match GNU Coding Style format and also report function and failing expression. Example output: troff: ../src/roff/troff/input.cpp:2644: do_request(): assertion failed: '0 == "But first, here's a rotten old BBC programme."' We have no excuse to assert(0) ever again. Express the invariant that has been violated.
* Update copyright (use gnulib's update-copyright script)Bertrand Garrigues2018-07-0336-36/+36
|
* Switch to Gnulib implementation of snprintfColin Watson2018-03-111-10/+0
| | | | | | | | | | | | | | | | | | | This is more actively maintained, straightforward to integrate now that we have Gnulib integration, and simplifies groff's overall licensing. * bootstrap.conf (gnulib_modules): Add `snprintf' and `vsnprintf'. * configure.ac: Remove local checks for `snprintf' and `vsnprintf'. * Makefile.am: Remove various comments related to local checks for `snprintf' and `vsnprintf'. * src/include/lib.h: Remove declarations of `snprintf' and `vsnprintf'. * src/libs/libgroff/libgroff.am (EXTRA_DIST): Remove `src/libs/snprintf/snprintf.c'. * src/libs/snprintf/snprintf.c: Remove. * LICENSES: Remove section about `src/libs/snprintf/snprintf.c'. * MANIFEST: Remove entry for `src/libs/libxutil'.
* src/include/.gitignore: Ignore config.hin~ files.G. Branden Robinson2017-11-181-0/+1
| | | | | | These pop up on repeated builds. Signed-off-by: G. Branden Robinson <g.branden.robinson@gmail.com>
* src: Fix `quote style' in comments and plaintext.G. Branden Robinson2017-11-0910-132/+136
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/include/include.am: * src/libs/libbib/libbib.am: * src/libs/libdriver/libdriver.am: * src/libs/libgroff/libgroff.am: * src/libs/libxutil/libxutil.am: * src/roff/groff/groff.am: * src/roff/grog/grog.am: * src/roff/troff/troff.am: * src/utils/addftinfo/addftinfo.am: * src/utils/afmtodit/afmtodit.am: * src/utils/hpftodit/hpftodit.am: + Update and parallelize editor aid comments. * src/include/font.h: * src/libs/libdriver/input.cpp: * src/libs/libgroff/glyphuni.cpp * src/libs/libgroff/quotearg.c: * src/libs/libgroff/spawnvp.c: * src/preproc/grn/main.cpp: * src/preproc/pic/object.cpp: * src/roff/troff/dictionary.cpp: * src/roff/troff/div.cpp: * src/roff/troff/token.h: * src/roff/troff/troff.am: + Remove trailing whitespace from lines near other changes. Signed-off-by: G. Branden Robinson <g.branden.robinson@gmail.com>
* Put two spaces between sentences in GPL notice.G. Branden Robinson2017-10-3133-33/+33
| | | | | | | | | | | | | | | | | | | | | | Fixes half of Savannah #51609 but applies it much more generally. This is a wide-ranging change, but it makes these notices consistent with modern copies of the GPLv3 text. (Some of these files are not GPLv3, but that's where the boilerplate comes from; GPLv2 and LGPLv2.x used semicolons to separate these clauses instead.) If the next resync with Autotools regresses some of these, well, that's a bug in Autotools. I checked with wc -L, and no file grew its longest line to 81 characters due to this change. contrib/hdtbl/hdmisc.tmac-u only: Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is> Blame me for the rest. Signed-off-by: G. Branden Robinson <g.branden.robinson@gmail.com>
* Fix doubled words "the" and "to".G. Branden Robinson2017-10-221-1/+1
| | | | | | | | | Based on (but expanded from) a report by Bjarni Ingi Gislason <bjarniig@rhi.hi.is>. Fixes Savannah #51078. Signed-off-by: G. Branden Robinson <g.branden.robinson@gmail.com>
* Implement `SOURCE_DATE_EPOCH' for reproducible builds.Colin Watson2016-07-291-0/+23
| | | | | | | | | | | | | | | | | | | | | * src/include/curtime.h: New file. * src/libs/libgroff/curtime.cpp: New file. * src/libs/libgroff/libgroff.am (libgroff_a_SOURCES): Add src/libs/libgroff/curtime.cpp. * src/roff/troff/input.cpp (init_registers): Use `current_time' instead of `time(0)'. * src/devices/grohtml/post-html.cpp (html_printer::do_file_components): Likewise. (html_printer::~html_printer): Likewise. * src/devices/grops/ps.cpp (ps_printer::~ps_printer): Likewise. * src/devices/gropdf/gropdf.pl: Use `$ENV{SOURCE_DATE_EPOCH}` if available in preference to `time`. * doc/groff.texi (Environment): Document `SOURCE_DATE_EPOCH'. * src/devices/grohtml/grohtml.1.man (ENVIRONMENT): Likewise. * src/devices/gropdf/gropdf.1.man (ENVIRONMENT): Likewise. * src/devices/grops/grops.1.man (ENVIRONMENT): Likewise.
* Fix many malloc/new vs. free/delete/delete[] mismatches (#47164)Bálint Réczey2016-02-161-5/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/devices/grops/ps.cpp (ps_font::~ps_font, ps_printer::define_encoding): Use `free'. * src/devices/grops/psrm.cpp (resource::~resource, resource_manager::output_prolog, resource_manager::supply_resource, resource_manager::read_download_file): Ditto. * src/include/ptable.h (PTABLE::~PTABLE, PTABLE::define): Ditto. * src/libs/libgroff/searchpath.cpp (search_path::open_file_cautious): Ditto. * src/libs/libgroff/string.cpp: Include `stdlib.h'. (string::extract): Use `malloc'. * src/preproc/eqn/box.cpp (quoted_text_box::~quoted_text_box): Use `free'. * src/preproc/eqn/lex.cpp (definition::~definition, macro_input::~macro_input, top_input::~top_input, do_definition): Ditto. * src/preproc/eqn/main.cpp (main): Ditto. * src/preproc/eqn/other.cpp: Include `stdlib.h'. (size_box::~size_box, font_box::~font_box): Use `free'. * src/preproc/eqn/text.cpp: Include `stdlib.h'. (box::set_spacing_type, special_char_box::~special_char_box, split_text): Use `free'. * src/preproc/grn/main.cpp (conv): Use `free'. * src/preproc/html/pre-html.cpp (get_resolution): Ditto. * src/preproc/pic/lex.cpp (macro_input::~macro_input, argument_macro_input::~argument_macro_input, for_input::~for_input): Ditto. * src/preproc/pic/main.cpp (do_picture): Ditto. * src/preproc/pic/object.cpp: Include `stdlib.h'. (text_piece::~text_piece, string_list::~string_list): Use `free'. * src/preproc/pic/pic.ypp (placeless_element, element, text, label, expr_not_lower_than): Ditto. * src/preproc/pic/troff.cpp (troff_output::reset_color): Ditto. * src/preproc/preconv/preconv.cpp (check_coding_tag): Ditto. * src/preproc/soelim/soelim.cpp (do_file): Ditto. * src/preproc/tbl/table.cpp (text_entry::~text_entry): Ditto. * src/roff/groff/groff.cpp (possible_command::~possible_command, possible_command::set_name): Ditto. * src/roff/troff/env.cpp (hyphen_trie::read_patterns_file): Ditto. * src/roff/troff/node.cpp (suppress_node::tprint): Ditto.
* Simplify memory allocation (#47162).Bálint Réczey2016-02-161-3/+0
| | | | | | | | | | | | | | | | | | | | | | Many invalid memory accesses were caught by UBSAN (e.g., invalid memory access in `small_temp_iterator::operator new') while bootstrapping hardened1-linux-amd64 Debian port in the `free_list' handling because it doesn't properly handle the padding between array elements. Some places were already #if 0-d out anyway. * src/roff/troff/input.cpp (small_temp_iterator): Remove class. (make_temp_iterator): Use `temp_iterator' only. * src/devices/grotty/tty.cpp (tty_glyph): Remove `free_list', `new', and `delete'. * src/include/color.h, src/include/color.cpp (color): Ditto. * src/roff/troff/env.cpp (tab): Ditto. * src/roff/troff/node.cpp (glyph_node): Ditto.
* all *.am: correct Emacs mode to "# End:"Bernd Warken2015-08-131-3/+3
|
* all *.am: add latest update, setup Emacs modeBernd Warken2015-08-061-1/+10
|
* Bug fix: Missing dependency between defs.h and config.status.Bertrand Garrigues2015-01-271-1/+1
| | | | | | After a full build, if configure was re-invoked with a different prefix, defs.h was not regenerated and groff and other binaries not recompiled (thus still using the old prefix).