gettext
75f39124 - xgettext: Refactor the formatstring code.

Commit
1 year ago
xgettext: Refactor the formatstring code. * gettext-tools/src/xg-formatstring.h (NXFORMATS, XFORMAT_PRIMARY, XFORMAT_SECONDARY, XFORMAT_TERTIARY, XFORMAT_FOURTH): New macros. (current_formatstring_parser1, current_formatstring_parser2, current_formatstring_parser3, current_formatstring_parser4): Remove declarations. (current_formatstring_parser): New declaration. * gettext-tools/src/xg-formatstring.c (current_formatstring_parser1, current_formatstring_parser2, current_formatstring_parser3, current_formatstring_parser4): Remove variables. (current_formatstring_parser): New variable. * gettext-tools/src/xg-arglist-context.h: Include xg-formatstring.h. (struct formatstring_context_ty): New type. (struct flag_context_ty): Replace individual fields with an array. (flag_context_list_table_add): Rename parameter 'index' to 'fi'. * gettext-tools/src/xg-arglist-context.c (null_context, passthrough_context): Update. (inherited_context): Loop over the four formatstring types. (passthrough_context_circular_list): Update. (set_flags_for_formatstring_type): Simplify. (flag_context_list_table_add): Rename parameter 'index' to 'fi'. * gettext-tools/src/xg-arglist-parser.c (arglist_parser_done): Update. * gettext-tools/src/xg-message.c (set_format_flags_from_context): Loop over the four formatstring types. (is_relevant): New function. (decide_is_format, remember_a_message_plural): Use it. * gettext-tools/src/xgettext.c (struct extractor_ty): Replace individual fields with an array. (main): Update. (flag_context_list_table_insert): Rename parameter 'index' to 'fi'. (xgettext_record_flag): Use XFORMAT_* macros. (extract_from_file): Loop over the four formatstring types. (recognize_qt_formatstrings): Update. (language_to_extractor): Use XFORMAT_* macros and a loop.
Author
Committer
Parents
Loading