[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/XS/parsetexi/end_line.c: defined flo
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/XS/parsetexi/end_line.c: defined floats lists related symbols to avoid non-defined symbols linking errors, even if there is no code run that uses those symbols. |
Date: |
Tue, 27 Dec 2022 18:30:16 -0500 |
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 7cdcd0bb9c * tp/Texinfo/XS/parsetexi/end_line.c: defined floats lists
related symbols to avoid non-defined symbols linking errors, even if there is
no code run that uses those symbols.
7cdcd0bb9c is described below
commit 7cdcd0bb9c9582b76968b1aada4d6ad93ca9c58f
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed Dec 28 00:29:32 2022 +0100
* tp/Texinfo/XS/parsetexi/end_line.c: defined floats lists related
symbols to avoid non-defined symbols linking errors, even if there
is no code run that uses those symbols.
* tp/Texinfo/XS/parsetexi/end_line.c (end_line_starting_block):
fix check of variadic flag and negation precedence.
* tp/Texinfo/XS/parsetexi/parser.c (parse_texi): wipe input stack
after getting the text after @bye.
* tp/Texinfo/XS/parsetexi/api.c (build_global_info2),
tp/Texinfo/XS/parsetexi/parser.c (register_global_command)
(wipe_global_info): really register float as a global command. Use
floats for global_info for float as using float breaks, most likely
because it is a type.
* tp/Texinfo/Convert/NodeNameNormalization.pm (set_float_types):
initialize $self->{'floats'}.
* tp/Texinfo/XS/parsetexi/parser.c (read_comment),
tp/Texinfo/XS/parsetexi/parser.c (process_remaining_on_line):
fix a one off string length error in read_comment. Fix a typo
in comments searching on nested @ignore line. Avoid an infinite loop
when there is a comment.
* t/55conditionals.t: add nested_ignore_with_comments, skipped for now
as the results are incorrect.
---
ChangeLog | 30 ++
tp/Texinfo/Convert/NodeNameNormalization.pm | 2 +
tp/Texinfo/XS/parsetexi/api.c | 14 +
tp/Texinfo/XS/parsetexi/end_line.c | 6 +-
tp/Texinfo/XS/parsetexi/parser.c | 15 +-
tp/Texinfo/XS/parsetexi/parser.h | 1 +
tp/t/55conditionals.t | 28 ++
.../conditionals/nested_ignore_with_comments.pl | 474 +++++++++++++++++++++
8 files changed, 562 insertions(+), 8 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 42341bf7cf..c329bfab8e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,33 @@
+2022-12-27 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/parsetexi/end_line.c: defined floats lists related
+ symbols to avoid non-defined symbols linking errors, even if there
+ is no code run that uses those symbols.
+
+ * tp/Texinfo/XS/parsetexi/end_line.c (end_line_starting_block):
+ fix check of variadic flag and negation precedence.
+
+ * tp/Texinfo/XS/parsetexi/parser.c (parse_texi): wipe input stack
+ after getting the text after @bye.
+
+ * tp/Texinfo/XS/parsetexi/api.c (build_global_info2),
+ tp/Texinfo/XS/parsetexi/parser.c (register_global_command)
+ (wipe_global_info): really register float as a global command. Use
+ floats for global_info for float as using float breaks, most likely
+ because it is a type.
+
+ * tp/Texinfo/Convert/NodeNameNormalization.pm (set_float_types):
+ initialize $self->{'floats'}.
+
+ * tp/Texinfo/XS/parsetexi/parser.c (read_comment),
+ tp/Texinfo/XS/parsetexi/parser.c (process_remaining_on_line):
+ fix a one off string length error in read_comment. Fix a typo
+ in comments searching on nested @ignore line. Avoid an infinite loop
+ when there is a comment.
+
+ * t/55conditionals.t: add nested_ignore_with_comments, skipped for now
+ as the results are incorrect.
+
2022-12-27 Gavin Smith <gavinsmith0123@gmail.com>
* doc/texinfo.tex (\indexnofonts): Remove superfluous space
diff --git a/tp/Texinfo/Convert/NodeNameNormalization.pm
b/tp/Texinfo/Convert/NodeNameNormalization.pm
index 2740caaaa4..3c6f05fa55 100644
--- a/tp/Texinfo/Convert/NodeNameNormalization.pm
+++ b/tp/Texinfo/Convert/NodeNameNormalization.pm
@@ -442,6 +442,8 @@ sub set_float_types
my $global_commands = $self->global_commands_information();
+ $self->{'floats'} = {};
+
if ($global_commands->{'float'}) {
foreach my $current (@{$global_commands->{'float'}}) {
my $type = '';
diff --git a/tp/Texinfo/XS/parsetexi/api.c b/tp/Texinfo/XS/parsetexi/api.c
index 03e5d73fda..a54707632f 100644
--- a/tp/Texinfo/XS/parsetexi/api.c
+++ b/tp/Texinfo/XS/parsetexi/api.c
@@ -1017,6 +1017,20 @@ build_global_info2 (void)
}
}
+ /* float is a type, it does not work there, use floats instead */
+ if (global_info.floats.contents.number > 0)
+ {
+ av = newAV ();
+ hv_store (hv, "float", strlen ("float"),
+ newRV_inc ((SV *) av), 0);
+ for (i = 0; i < global_info.floats.contents.number; i++)
+ {
+ e = contents_child_by_index (&global_info.floats, i);
+ if (e->hv)
+ av_push (av, newRV_inc ((SV *) e->hv));
+ }
+ }
+
#define BUILD_GLOBAL_ARRAY(cmd) \
if (global_info.cmd.contents.number > 0) \
{ \
diff --git a/tp/Texinfo/XS/parsetexi/end_line.c
b/tp/Texinfo/XS/parsetexi/end_line.c
index b99ff1a836..fbedf51bf5 100644
--- a/tp/Texinfo/XS/parsetexi/end_line.c
+++ b/tp/Texinfo/XS/parsetexi/end_line.c
@@ -971,11 +971,11 @@ parse_node_manual (ELEMENT *node)
/* for now done in Texinfo::Convert::NodeNameNormalization, but could be
good to do in Parser/XS */
/* Array of recorded @float's. */
-/*
+
FLOAT_RECORD *floats_list = 0;
size_t floats_number = 0;
size_t floats_space = 0;
-*/
+
int
parse_float_type (ELEMENT *current)
@@ -1299,7 +1299,7 @@ end_line_starting_block (ELEMENT *current)
}
} /* CF_blockitem */
else if (command_data (current->cmd).args_number == 0
- && ! command_data (current->cmd).flags & CF_variadic
+ && (! (command_data (current->cmd).flags & CF_variadic))
&& current->args.number > 0
&& current->args.list[0]->contents.number > 0)
{
diff --git a/tp/Texinfo/XS/parsetexi/parser.c b/tp/Texinfo/XS/parsetexi/parser.c
index 4cb23fd774..97ae19a46e 100644
--- a/tp/Texinfo/XS/parsetexi/parser.c
+++ b/tp/Texinfo/XS/parsetexi/parser.c
@@ -99,8 +99,7 @@ read_comment (char *line, char **comment_command)
p += 7;
if (*p && *p != '@' && !strchr (whitespace_chars, *p))
return 0; /* @c or @comment not terminated. */
- /* FIXME check -1 is correct */
- *comment_command = strndup(line, p - line - 1);
+ *comment_command = strndup(line, p - line);
}
else
return 0; /* Trailing characters on line. */
@@ -231,6 +230,10 @@ register_global_command (ELEMENT *current)
add_to_contents_as_array (&global_info.footnotes, current);
break;
+ case CM_float:
+ add_to_contents_as_array (&global_info.floats, current);
+ break;
+
GLOBAL_CASE(hyphenation);
GLOBAL_CASE(insertcopying);
GLOBAL_CASE(printindex);
@@ -366,6 +369,7 @@ wipe_global_info (void)
GLOBAL_CASE(listoffloats);
GLOBAL_CASE(detailmenu);
GLOBAL_CASE(part);
+ GLOBAL_CASE(floats);
GLOBAL_CASE(allowcodebreaks);
GLOBAL_CASE(clickstyle);
GLOBAL_CASE(codequotebacktick);
@@ -1170,7 +1174,7 @@ process_remaining_on_line (ELEMENT **current_inout, char
**line_inout)
}
while (*p)
{
- p = strchr (p, 'p');
+ p = strchr (p, '@');
if (p)
{
char *cmd_name;
@@ -1210,6 +1214,7 @@ process_remaining_on_line (ELEMENT **current_inout, char
**line_inout)
"comment_at_end",
comment_e);
}
+ break;
}
else
break;
@@ -2234,8 +2239,6 @@ finished_totally:
current = current->parent;
}
- input_reset_input_stack (); /* to avoid a memory leak if @bye is given */
-
/* TODO: Check for "unclosed stacks". */
/* Gather text after @bye */
@@ -2265,5 +2268,7 @@ finished_totally:
}
}
+ input_reset_input_stack (); /* to avoid a memory leak if @bye is given */
+
return current;
}
diff --git a/tp/Texinfo/XS/parsetexi/parser.h b/tp/Texinfo/XS/parsetexi/parser.h
index 42388ce8b1..f4a128536f 100644
--- a/tp/Texinfo/XS/parsetexi/parser.h
+++ b/tp/Texinfo/XS/parsetexi/parser.h
@@ -80,6 +80,7 @@ typedef struct GLOBAL_INFO {
ELEMENT listoffloats;
ELEMENT detailmenu;
ELEMENT part;
+ ELEMENT floats;
ELEMENT allowcodebreaks;
ELEMENT clickstyle;
diff --git a/tp/t/55conditionals.t b/tp/t/55conditionals.t
index 5f21da1582..71ec2391bf 100644
--- a/tp/t/55conditionals.t
+++ b/tp/t/55conditionals.t
@@ -68,6 +68,34 @@ Space Comment
@ifclear
@end ignore
'],
+['nested_ignore_with_comments',
+'@ignore
+@ignore
+No space no comment
+@end ignore
+
+@ignore
+Spaces no comment
+@end ignore
+
+@ignore@c no space comment
+Comment
+@end ignore
+
+@ignore @c space comment
+Space Comment
+@end ignore
+
+@ignore something @comment comment after text
+Text comment
+@end ignore
+
+@ignore some @code{variable} @comment comment after command
+Command comment
+@end ignore
+
+@end ignore
+', {'skip' => 1}],
['empty_set_in_ifset',
'@set a
diff --git a/tp/t/results/conditionals/nested_ignore_with_comments.pl
b/tp/t/results/conditionals/nested_ignore_with_comments.pl
new file mode 100644
index 0000000000..b41f6ca029
--- /dev/null
+++ b/tp/t/results/conditionals/nested_ignore_with_comments.pl
@@ -0,0 +1,474 @@
+use vars qw(%result_texis %result_texts %result_trees %result_errors
+ %result_indices %result_sectioning %result_nodes %result_menus
+ %result_floats %result_converted %result_converted_errors
+ %result_elements %result_directions_text %result_indices_sort_strings);
+
+use utf8;
+
+$result_trees{'nested_ignore_with_comments'} = {
+ 'contents' => [
+ {
+ 'contents' => [
+ {
+ 'args' => [
+ {
+ 'info' => {
+ 'spaces_after_argument' => '
+'
+ },
+ 'type' => 'block_line_arg'
+ }
+ ],
+ 'cmdname' => 'ignore',
+ 'contents' => [
+ {
+ 'args' => [
+ {
+ 'info' => {
+ 'spaces_after_argument' => '
+'
+ },
+ 'type' => 'block_line_arg'
+ }
+ ],
+ 'cmdname' => 'ignore',
+ 'contents' => [
+ {
+ 'text' => 'No space no comment
+',
+ 'type' => 'raw'
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'ignore'
+ }
+ ],
+ 'info' => {
+ 'spaces_after_argument' => '
+'
+ },
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'end',
+ 'extra' => {
+ 'text_arg' => 'ignore'
+ },
+ 'info' => {
+ 'spaces_before_argument' => ' '
+ },
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 4,
+ 'macro' => ''
+ }
+ }
+ ]
+ },
+ {
+ 'text' => '
+',
+ 'type' => 'raw'
+ },
+ {
+ 'args' => [
+ {
+ 'info' => {
+ 'spaces_after_argument' => '
+'
+ },
+ 'type' => 'block_line_arg'
+ }
+ ],
+ 'cmdname' => 'ignore',
+ 'contents' => [
+ {
+ 'text' => 'Spaces no comment
+',
+ 'type' => 'raw'
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'ignore'
+ }
+ ],
+ 'info' => {
+ 'spaces_after_argument' => '
+'
+ },
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'end',
+ 'extra' => {
+ 'text_arg' => 'ignore'
+ },
+ 'info' => {
+ 'spaces_before_argument' => ' '
+ },
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 8,
+ 'macro' => ''
+ }
+ }
+ ]
+ },
+ {
+ 'text' => '
+',
+ 'type' => 'raw'
+ },
+ {
+ 'args' => [
+ {
+ 'info' => {
+ 'comment_at_end' => {
+ 'args' => [
+ {
+ 'text' => ' no space comment
+',
+ 'type' => 'misc_arg'
+ }
+ ],
+ 'cmdname' => 'c',
+ 'extra' => {
+ 'misc_args' => [
+ ' no space comment
+'
+ ]
+ }
+ }
+ },
+ 'type' => 'block_line_arg'
+ }
+ ],
+ 'cmdname' => 'ignore',
+ 'contents' => [
+ {
+ 'text' => 'Comment
+',
+ 'type' => 'raw'
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'ignore'
+ }
+ ],
+ 'info' => {
+ 'spaces_after_argument' => '
+'
+ },
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'end',
+ 'extra' => {
+ 'text_arg' => 'ignore'
+ },
+ 'info' => {
+ 'spaces_before_argument' => ' '
+ },
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 12,
+ 'macro' => ''
+ }
+ }
+ ]
+ },
+ {
+ 'text' => '
+',
+ 'type' => 'raw'
+ },
+ {
+ 'args' => [
+ {
+ 'info' => {
+ 'comment_at_end' => {
+ 'args' => [
+ {
+ 'text' => ' space comment
+',
+ 'type' => 'misc_arg'
+ }
+ ],
+ 'cmdname' => 'c',
+ 'extra' => {
+ 'misc_args' => [
+ ' space comment
+'
+ ]
+ }
+ },
+ 'spaces_after_argument' => ' '
+ },
+ 'type' => 'block_line_arg'
+ }
+ ],
+ 'cmdname' => 'ignore',
+ 'contents' => [
+ {
+ 'text' => 'Space Comment
+',
+ 'type' => 'raw'
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'ignore'
+ }
+ ],
+ 'info' => {
+ 'spaces_after_argument' => '
+'
+ },
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'end',
+ 'extra' => {
+ 'text_arg' => 'ignore'
+ },
+ 'info' => {
+ 'spaces_before_argument' => ' '
+ },
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 16,
+ 'macro' => ''
+ }
+ }
+ ]
+ },
+ {
+ 'text' => '
+',
+ 'type' => 'raw'
+ },
+ {
+ 'args' => [
+ {
+ 'info' => {
+ 'comment_at_end' => {
+ 'args' => [
+ {
+ 'text' => ' comment after text
+',
+ 'type' => 'misc_arg'
+ }
+ ],
+ 'cmdname' => 'comment',
+ 'extra' => {
+ 'misc_args' => [
+ ' comment after text
+'
+ ]
+ }
+ },
+ 'spaces_after_argument' => ' '
+ },
+ 'type' => 'block_line_arg'
+ }
+ ],
+ 'cmdname' => 'ignore',
+ 'contents' => [
+ {
+ 'text' => 'Text comment
+',
+ 'type' => 'raw'
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'ignore'
+ }
+ ],
+ 'info' => {
+ 'spaces_after_argument' => '
+'
+ },
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'end',
+ 'extra' => {
+ 'text_arg' => 'ignore'
+ },
+ 'info' => {
+ 'spaces_before_argument' => ' '
+ },
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 20,
+ 'macro' => ''
+ }
+ }
+ ]
+ },
+ {
+ 'text' => '
+',
+ 'type' => 'raw'
+ },
+ {
+ 'args' => [
+ {
+ 'info' => {
+ 'comment_at_end' => {
+ 'args' => [
+ {
+ 'text' => ' comment after command
+',
+ 'type' => 'misc_arg'
+ }
+ ],
+ 'cmdname' => 'comment',
+ 'extra' => {
+ 'misc_args' => [
+ ' comment after command
+'
+ ]
+ }
+ },
+ 'spaces_after_argument' => ' '
+ },
+ 'type' => 'block_line_arg'
+ }
+ ],
+ 'cmdname' => 'ignore',
+ 'contents' => [
+ {
+ 'text' => 'Command comment
+',
+ 'type' => 'raw'
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'ignore'
+ }
+ ],
+ 'info' => {
+ 'spaces_after_argument' => '
+'
+ },
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'end',
+ 'extra' => {
+ 'text_arg' => 'ignore'
+ },
+ 'info' => {
+ 'spaces_before_argument' => ' '
+ },
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 24,
+ 'macro' => ''
+ }
+ }
+ ]
+ },
+ {
+ 'text' => '
+',
+ 'type' => 'raw'
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'ignore'
+ }
+ ],
+ 'info' => {
+ 'spaces_after_argument' => '
+'
+ },
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'end',
+ 'extra' => {
+ 'text_arg' => 'ignore'
+ },
+ 'info' => {
+ 'spaces_before_argument' => ' '
+ },
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 26,
+ 'macro' => ''
+ }
+ }
+ ],
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 1,
+ 'macro' => ''
+ }
+ }
+ ],
+ 'type' => 'before_node_section'
+ }
+ ],
+ 'type' => 'document_root'
+};
+
+$result_texis{'nested_ignore_with_comments'} = '@ignore
+@ignore
+No space no comment
+@end ignore
+
+@ignore
+Spaces no comment
+@end ignore
+
+@ignore@c no space comment
+Comment
+@end ignore
+
+@ignore @c space comment
+Space Comment
+@end ignore
+
+@ignore @comment comment after text
+Text comment
+@end ignore
+
+@ignore @comment comment after command
+Command comment
+@end ignore
+
+@end ignore
+';
+
+
+$result_texts{'nested_ignore_with_comments'} = '';
+
+$result_errors{'nested_ignore_with_comments'} = [];
+
+
+$result_floats{'nested_ignore_with_comments'} = {};
+
+
+1;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/XS/parsetexi/end_line.c: defined floats lists related symbols to avoid non-defined symbols linking errors, even if there is no code run that uses those symbols.,
Patrice Dumas <=