summaryrefslogtreecommitdiff
path: root/src/roff/troff/number.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [troff]: Refactor and fix code style nits.G. Branden Robinson2022-10-061-82/+91
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/roff/troff/number.cpp: Refactor and fix code style nits. Boolify and rename static (local) functions. - parse_expr -> is_valid_expression - start_number -> is_valid_expression_start - parse_term -> is_valid_term Rename preprocessor macro `SCALE_INDICATOR_CHARS` to `SCALING_UNITS`. (is_valid_expression, is_valid_term): Rename parameters and demote them from `int` to `bool`. - scaling_indicator -> scaling_unit (no demotion) - parenthesised -> is_parenthesized - rigid -> is_mandatory (is_valid_expression_start, is_valid_expression, is_valid_term): Return Boolean rather than integer literals. (get_vunits, get_hunits, get_number_rigidly, get_number, get_integer): Update call sites of renamed functions. Replace Boolean-valued integer literals used as Booleans with Boolean literals and annotate their purposes. (See <https://stackoverflow.com/questions/38076786/\ why-doesnt-c-support-named-parameters>.) (get_vunits, get_hunits, get_number, get_integer): Replace `0` in assertions with a communicative predicate. In all of these it's an unhandled `switch()` case. Also put space around binary operators in expressions, parenthesize complex expressions more, tighten some comments, and wrap long lines.
* src/roff/troff/number.cpp: Fix typo in diagnostic.G. Branden Robinson2022-07-011-1/+1
|
* [troff]: Revise some diagnostic messages.G. Branden Robinson2022-03-071-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | * src/roff/troff/input.cpp (get_char_for_escape_name): Recast diagnostic messages to more accurately refer to escape "sequence" rather than "name". "Name" is a confusing term here, given that it also applies to a group of objects sharing a name space (natch): requests, macros, strings, and diversions. Further, the "escape name" cited by these diagnostics is not the escape function selector; that is, the character after the escape character which determines how the escape sequence is to be interpreted. These diagnostics are only thrown after that function is known, however, when parsing of an escape sequence parameter is attempted. (input_char_description): Drop leading articles ("a") from descriptions, to economize in diagnostic messages this function helps produce. * src/roff/troff/input.cpp (read_size): * src/roff/troff/number.cpp (start_number, parse_term): Recast messages to more consistently use the form "expected X, got Y" where feasible. * src/roff/troff/number.cpp (start_number): Say "numeric expression missing" instead of "missing number"; we don't require a terminal symbol in the expression grammar here.
* [grops,troff]: Migrate to term "scaling unit".G. Branden Robinson2022-02-121-4/+4
| | | | | | | | | | ...in diagnostics. * src/devices/grops/ps.cpp (ps_printer::do_import): * src/roff/troff/input.cpp (warnscale_request): * src/roff/troff/number.cpp (parse_term): Do it. Much of our documentation remains to be updated.
* [troff]: Boolify members of `token` class.G. Branden Robinson2021-09-061-6/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/roff/troff/token.h (class token): Demote return type of several member functions from `int` to `bool` and rename them. - `backspace` -> `is_backspace` - `delimiter` -> `usable_as_delimiter` - `dummy` -> `is_dummy` - `eof` -> `is_eof` - `horizontal_space` -> `is_horizontal_space` - `hyphen_indicator` -> `is_hyphen_indicator` - `leader` -> `is_leader` - `left_brace` -> `is_left_brace` - `newline` -> `is_newline` - `page_ejector` -> `is_page_ejector` - `right_brace` -> `is_right_brace` - `space` -> `is_space` - `special` -> `is_special` - `stretchable_space` -> `is_stretchable_space` - `tab` -> `is_tab` - `transparent_dummy` -> `is_transparent_dummy` - `transparent` -> `is_transparent` - `unstretchable_space` -> `is_unstretchable_space` - `white_space` -> `is_white_space` - `zero_width_break` -> `is_zero_width_break` (class token): Drop 1991 comment anticipating that member function `nspaces` could return "2" for a "double space"; this was apparently never implemented. (class token): Drop parameter names from declarations; the prevailing style (familiar from Stroustrup) is not to use them. (token::is_special): Simplify implementation. * src/roff/troff/input.cpp (has_arg, token::usable_as_delimiter): Update definitions of above member functions not defined in token.h. * src/roff/troff/div.cpp (begin_page, space_request, need_space, output_saved_vertical_space, flush_output): * src/roff/troff/env.cpp (fill, no_fill, center, right_justify, indent, temporary_indent, margin_character, number_lines, do_break_request, hyphen_word): * src/roff/troff/input.cpp (next_file, do_overstrike, do_bracket, do_name_test, do_expr_test, do_zero_width, token::skip, has_arg, skip_line, empty_name_warning, non_empty_name_warning, do_get_long_name, process_input_stack, flush_pending_lines, decode_args, read_request, do_define_string, do_define_character, remove_character, do_define_macro, length_request, get_delim_number, get_line_arg, read_size, get_delim_name, do_register, do_width, read_title_parts, encode_char, do_special, device_request, output_request, skip_alternative, begin_alternative, nop_request, do_if_request, do_source, pipe_source, ps_bbox_request, tag, taga, do_terminal, do_translate, hyphenation_code, hyphenation_patterns_file_code, define_class, get_optional_char, check_missing_character, abort_request, copy_file, transparent_file, do_macro_source, charinfo_to_node_list, read_draw_node, read_color_draw_node): * src/roff/troff/node.cpp (get_fontno, remove_font_special_character, bold_font): * src/roff/troff/number.cpp (start_number, parse_term): * src/roff/troff/reg.cpp (define_number_reg, alter_format): Update call sites to use new names. * src/roff/troff/input.cpp (token::usable_as_delimiter, read_draw_node): Return Boolean, not integer, literals. Also add editor aid comments to ends of files lacking them. Remove old-style Emacs file-local local variable at file beginnings. Also fix white space nits.
* [troff]: Mark `H0`, `V0` objects as `const`.G. Branden Robinson2021-09-061-2/+2
| | | | | * src/roff/troff/hvunits.h: * src/roff/groff/number.cpp: Mark `H0`, `V0` objects as `const`.
* [troff]: Tweak diagnostic messages.G. Branden Robinson2021-07-211-23/+23
| | | | | | | | | | | | | * src/roff/troff/number.cpp (parse_term): Tweak diagnostic messages. When a left operand to a binary operator is empty, report the operator in question (helpful for string interpolations in complex expressions). When handling input scaling indicators, drop word "this" from "this context", since the parser's context might not be clear from a file name and line number. Say "scaling indicator" instead of "scale indicator". (parse_expr, parse_term): Rename function parameter from `scale_indicator` to `scaling_indictor`.
* Update copyright1.23.0.rc1Bertrand Garrigues2020-11-111-1/+1
| | | | | | | | * 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-251-1/+1
| | | | | | This reverts commit a2e955e07354c83939fabffebcf720d3333d1f6b. Some files (COPYING, FDL, bootstrap) should not have been updated
* Update copyrightBertrand Garrigues2020-10-251-1/+1
| | | | | | | | 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.
* Update copyright (use gnulib's update-copyright script)Bertrand Garrigues2018-07-031-1/+1
|
* src: Fix `quote style' in comments and plaintext.G. Branden Robinson2017-11-091-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* src: Migrate diagnostics away from `these quotes'.G. Branden Robinson2017-11-091-5/+5
| | | | | | Fix bug https://savannah.gnu.org/bugs/?52374. Signed-off-by: G. Branden Robinson <g.branden.robinson@gmail.com>
* Put two spaces between sentences in GPL notice.G. Branden Robinson2017-10-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | 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>
* src/roff/troff/*: Improve the license information.Bernd Warken2014-09-181-2/+1
|
* Fix compiler warnings.Werner LEMBERG2012-03-101-2/+2
| | | | | | | | | | | | | | | * src/preproc/html/pre-html.cpp (alterDeviceTo): Avoid ambiguous if-else clause. * src/preproc/grn/main.cpp (sccsid): Comment out. * src/roff/troff/number.cpp (parse_expr) <case '*'>: Add cast. * src/devices/xditview/Makefile.sub (EXTRA_CFLAGS): Add `-Dlint' so that unused static ID arrays don't cause a warning. (Some) problems reported by Bjarni Ingi Gislason <bjarniig@rhi.hi.is>.
* Update copyright year.Werner LEMBERG2009-01-051-1/+1
|
* * */*: Update GPL2 to GPL3.Werner LEMBERG2009-01-041-5/+4
|
* * All affected files: Update postal address of FSF.Werner LEMBERG2005-05-261-1/+1
|
* * src/devices/grohtml/html-text.cpp (html_text_get_alignment),Werner LEMBERG2004-10-151-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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'.
* Implement string-valued registers \n[.m] and \n[.M] to return theWerner LEMBERG2004-01-071-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | name of the current drawing and background color, respectively. * src/roff/troff/symbol.h: Moved to... * src/include/symbol.h: Here. Small fixes to make it work outside of the `troff' directory. * src/roff/troff/symbol.cpp: Moved to... * src/libs/libgroff/symbol.cpp: Here. Small fixes to make it work outside of the `troff' directory. * src/include/Makefile.sub (HDRS), src/libs/libgroff/Makefile.sub (OBJS, CCSRCS), src/roff/troff/Makefile.sub (OBJS, CCSRCS, HDRS): Updated. * src/include/color.h: Include symbol.h. (color): Add new field `nm'. * src/libs/libgroff/color.cpp (color::color): Updated. * src/roff/troff/dictionary.cpp, src/roff/troff/div.cpp, src/roff/troff/node.cpp, src/roff/troff/number.cpp, src/roff/troff/reg.cpp: Don't include symbol.h. * src/roff/troff/env.cpp: Don't include symbol.h. (environment::get_glyph_color_string, environment_get_fill_color_string): New member functions. (init_env_requests): Handle `.m' and `.M' registers. * src/roff/troff/input.cpp: Don't include symbol.h. (default_symbol): Moved to symbol.cpp/symbol.h. (do_glyph_color, do_fill_color, define_color): Pass symbol name to color constructor. * src/roff/troff/env.h: Updated. * NEWS, man/groff_diff.man, man/groff.man, doc/groff.texinfo: Document new registers.
* Renamed all `*.cc' files to `*.cpp'.Werner LEMBERG2003-04-151-0/+697
Updated all configuration files, makefiles, and documentation.