[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/XS/parsetexi/api.c (parse_file), tp
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/XS/parsetexi/api.c (parse_file), tp/Texinfo/XS/parsetexi/end_line.c (end_line_misc_line), tp/Texinfo/XS/parsetexi/macro.c (parse_macro_command_line), tp/Texinfo/XS/parsetexi/parser.c (check_line_directive): rename char variables used as a temporary placeholder for a character replaced by an end of string as saved to be more explicit and consistent. |
Date: |
Sat, 22 Jul 2023 13:11:32 -0400 |
This is an automated email from the git hooks/post-receive script.
pertusus pushed a commit to branch master
in repository texinfo.
The following commit(s) were added to refs/heads/master by this push:
new de7401b2be * tp/Texinfo/XS/parsetexi/api.c (parse_file),
tp/Texinfo/XS/parsetexi/end_line.c (end_line_misc_line),
tp/Texinfo/XS/parsetexi/macro.c (parse_macro_command_line),
tp/Texinfo/XS/parsetexi/parser.c (check_line_directive): rename char variables
used as a temporary placeholder for a character replaced by an end of string as
saved to be more explicit and consistent.
de7401b2be is described below
commit de7401b2be31b76ae128ff11e074c608c07f5bc1
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Jul 22 19:11:22 2023 +0200
* tp/Texinfo/XS/parsetexi/api.c (parse_file),
tp/Texinfo/XS/parsetexi/end_line.c (end_line_misc_line),
tp/Texinfo/XS/parsetexi/macro.c (parse_macro_command_line),
tp/Texinfo/XS/parsetexi/parser.c (check_line_directive): rename
char variables used as a temporary placeholder for a character
replaced by an end of string as saved to be more explicit and
consistent.
---
ChangeLog | 18 ++++++++++++++++++
tp/Texinfo/Common.pm | 21 ++++++++++++++++++---
tp/Texinfo/XS/parsetexi/api.c | 5 ++---
tp/Texinfo/XS/parsetexi/end_line.c | 4 ++--
tp/Texinfo/XS/parsetexi/input.c | 6 +++++-
tp/Texinfo/XS/parsetexi/macro.c | 4 ++--
tp/Texinfo/XS/parsetexi/parser.c | 6 +++---
7 files changed, 50 insertions(+), 14 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index afbd90f798..2c85f008b3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2023-07-22 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/parsetexi/api.c (parse_file),
+ tp/Texinfo/XS/parsetexi/end_line.c (end_line_misc_line),
+ tp/Texinfo/XS/parsetexi/macro.c (parse_macro_command_line),
+ tp/Texinfo/XS/parsetexi/parser.c (check_line_directive): rename
+ char variables used as a temporary placeholder for a character
+ replaced by an end of string as saved to be more explicit and
+ consistent.
+
+2023-07-22 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/Common.pm, tp/Texinfo/XS/parsetexi/input.c: explain
+ the mapping of US-ASCII encoding to ISO-8859-1 for compatibility
+ with old manuals in which US-ASCII could have been considered to
+ be an alias for ISO-8859-1. Based on Gavin input and looking at
+ old Texinfo releases code and manuals.
+
2023-07-22 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/XS/parsetexi/end_line.c (isascii_alpha)
diff --git a/tp/Texinfo/Common.pm b/tp/Texinfo/Common.pm
index d79a84f1cb..c208af2fe7 100644
--- a/tp/Texinfo/Common.pm
+++ b/tp/Texinfo/Common.pm
@@ -547,11 +547,26 @@ sub valid_tree_transformation ($)
# information on encodings
-# map encodings to encodings that extends them in a compatible way
-# to use the extending encoding to do the conversion and avoid errors.
+# in Texinfo up to 5.2, we presume that ISO-8859-1 was considered as
+# the default encoding (although it had never been said explicitly in
+# the manual, it is consistent with HTML output without encoding
+# being the default for makeinfo output in earlier versions and being,
+# at that time, considered as ISO-8859-1). The wording in the Texinfo
+# manual implied that setting US-ASCII had no effect, a possible
+# interpretation being that it was an alias for ISO-8859-1. Since
+# ISO-8859-1 extends US-ASCII in a compatible way, this interpretation
+# is valid. Also, as long as the same 8bit encoding is used for input and
+# output, the precise 8bit encoding used to extend US-ASCII has no
+# practical consequence, something consistent with past makeinfo supporting
+# any 8bit encoding without documentencoding and also when US-ASCII was
+# specified as encoding.
+#
+# To support old manuals in which US-ASCII can be specified although
+# the encoding corresponds to any 8bit encoding compatible with ISO-8859-1,
+# we convert US-ASCII as ISO-8859-1 to avoid errors for characters in
+# ISO-8859-1 but not in US-ASCII.
our %encoding_name_conversion_map;
%encoding_name_conversion_map = (
- # mapping used in HTML in the past
'us-ascii' => 'iso-8859-1',
);
diff --git a/tp/Texinfo/XS/parsetexi/api.c b/tp/Texinfo/XS/parsetexi/api.c
index 7aa621961e..235e68e88a 100644
--- a/tp/Texinfo/XS/parsetexi/api.c
+++ b/tp/Texinfo/XS/parsetexi/api.c
@@ -200,7 +200,6 @@ parse_file (char *filename)
debug_output = 0;
*/
char *p, *q;
- char c;
int status;
@@ -220,10 +219,10 @@ parse_file (char *filename)
if (p)
{
- c = *p;
+ char saved = *p;
*p = '\0';
add_include_directory (filename);
- *p = c;
+ *p = saved;
}
Root = parse_texi_document ();
diff --git a/tp/Texinfo/XS/parsetexi/end_line.c
b/tp/Texinfo/XS/parsetexi/end_line.c
index 8f360d3685..744696994f 100644
--- a/tp/Texinfo/XS/parsetexi/end_line.c
+++ b/tp/Texinfo/XS/parsetexi/end_line.c
@@ -1461,11 +1461,11 @@ end_line_misc_line (ELEMENT *current)
if (p - text > 4)
{
/* looks too long */
- char c = *p;
+ char saved = *p;
*p = 0;
command_warn (current, "%s is not a valid language code",
text);
- *p = c;
+ *p = saved;
}
if (*p == '_')
{
diff --git a/tp/Texinfo/XS/parsetexi/input.c b/tp/Texinfo/XS/parsetexi/input.c
index 0bb8c19d58..bb1d9e7697 100644
--- a/tp/Texinfo/XS/parsetexi/input.c
+++ b/tp/Texinfo/XS/parsetexi/input.c
@@ -75,7 +75,11 @@ set_input_encoding (char *encoding)
int encoding_set = 0;
char *conversion_encoding = encoding;
- /* synced with Texinfo::Common::encoding_name_conversion_map */
+ /* should correspond to
+ Texinfo::Common::encoding_name_conversion_map.
+ Thoughts on this mapping are available near
+ Texinfo::Common::encoding_name_conversion_map definition
+ */
if (!strcmp (encoding, "us-ascii"))
conversion_encoding = "iso-8859-1";
diff --git a/tp/Texinfo/XS/parsetexi/macro.c b/tp/Texinfo/XS/parsetexi/macro.c
index 89648f8fa2..1c78264ebb 100644
--- a/tp/Texinfo/XS/parsetexi/macro.c
+++ b/tp/Texinfo/XS/parsetexi/macro.c
@@ -206,10 +206,10 @@ parse_macro_command_line (enum command_id cmd, char
**line_inout,
{
if (!isascii_alnum (*p) && *p != '_' && *p != '-')
{
- char c = *q2; *q2 = 0;
+ char saved = *q2; *q2 = 0;
line_error ("bad or empty @%s formal argument: %s",
command_name(cmd), args_ptr);
- *q2 = c;
+ *q2 = saved;
add_extra_integer (macro, "invalid_syntax", 1);
break;
}
diff --git a/tp/Texinfo/XS/parsetexi/parser.c b/tp/Texinfo/XS/parsetexi/parser.c
index 5cea32e31c..3607e2ea7b 100644
--- a/tp/Texinfo/XS/parsetexi/parser.c
+++ b/tp/Texinfo/XS/parsetexi/parser.c
@@ -2457,15 +2457,15 @@ check_line_directive (char *line)
p += strspn (p, " \t");
if (*p == '"')
{
- char c;
+ char saved;
p++;
q = strchr (p, '"');
if (!q)
return 0;
- c = *q;
+ saved = *q;
*q = 0;
filename = save_string (p);
- *q = c;
+ *q = saved;
p = q + 1;
p += strspn (p, " \t");
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/XS/parsetexi/api.c (parse_file), tp/Texinfo/XS/parsetexi/end_line.c (end_line_misc_line), tp/Texinfo/XS/parsetexi/macro.c (parse_macro_command_line), tp/Texinfo/XS/parsetexi/parser.c (check_line_directive): rename char variables used as a temporary placeholder for a character replaced by an end of string as saved to be more explicit and consistent.,
Patrice Dumas <=
- Prev by Date:
branch master updated: * tp/Texinfo/XS/parsetexi/end_line.c (isascii_alpha) (parse_line_command_args, end_line_starting_block) (end_line_misc_line), tp/Texinfo/XS/parsetexi/handle_commands.c (parse_rawline_command), tp/Texinfo/XS/parsetexi/macro.c (parse_macro_command_line), tp/Texinfo/XS/parsetexi/parser.c (isascii_alnum, read_command_name, read_flag_name): add isascii_alpha to replace isalpha and isascii_alnum to replace isalnum to make sure that the character is also ascii, both because we want to select asci [...]
- Next by Date:
branch master updated: TODO: update, mostly removing @defblock/@defline
- Previous by thread:
branch master updated: * tp/Texinfo/XS/parsetexi/end_line.c (isascii_alpha) (parse_line_command_args, end_line_starting_block) (end_line_misc_line), tp/Texinfo/XS/parsetexi/handle_commands.c (parse_rawline_command), tp/Texinfo/XS/parsetexi/macro.c (parse_macro_command_line), tp/Texinfo/XS/parsetexi/parser.c (isascii_alnum, read_command_name, read_flag_name): add isascii_alpha to replace isalpha and isascii_alnum to replace isalnum to make sure that the character is also ascii, both because we want to select asci [...]
- Next by thread:
branch master updated: TODO: update, mostly removing @defblock/@defline
- Index(es):