[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/XS/parsetexi/parser.h (GLOBAL_INFO),
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/XS/parsetexi/parser.h (GLOBAL_INFO), tp/Texinfo/XS/parsetexi/parser.c (register_global_command) (wipe_global_info), tp/Texinfo/XS/parsetexi/api.c (build_global_info2): add author to global info, to be consistent with global in command_data.txt. Remove a useless TODO. |
Date: |
Sat, 04 Mar 2023 17:58:32 -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 90fd1d464c * tp/Texinfo/XS/parsetexi/parser.h (GLOBAL_INFO),
tp/Texinfo/XS/parsetexi/parser.c (register_global_command) (wipe_global_info),
tp/Texinfo/XS/parsetexi/api.c (build_global_info2): add author to global info,
to be consistent with global in command_data.txt. Remove a useless TODO.
90fd1d464c is described below
commit 90fd1d464caa60d5875d2bc262c7f83f286a327f
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Mar 4 23:54:30 2023 +0100
* tp/Texinfo/XS/parsetexi/parser.h (GLOBAL_INFO),
tp/Texinfo/XS/parsetexi/parser.c (register_global_command)
(wipe_global_info), tp/Texinfo/XS/parsetexi/api.c
(build_global_info2): add author to global info, to be consistent with
global in command_data.txt.
Remove a useless TODO.
* tp/Texinfo/ParserNonXS.pm (_process_remaining_on_line),
tp/Texinfo/XS/parsetexi/parser.c (process_remaining_on_line): minor
changes: change order of code, remove useless retval set, changein
comments, more similar codes in XS and perl parsers.
---
ChangeLog | 14 ++++++++++++++
tp/Texinfo/ParserNonXS.pm | 30 +++++++++++++++++-------------
tp/Texinfo/XS/parsetexi/api.c | 7 ++++---
tp/Texinfo/XS/parsetexi/commands.c | 4 +++-
tp/Texinfo/XS/parsetexi/parser.c | 34 ++++++++++++++--------------------
tp/Texinfo/XS/parsetexi/parser.h | 9 +++++----
6 files changed, 57 insertions(+), 41 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 401400c3b7..ba28d4d172 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2023-03-04 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/parsetexi/parser.h (GLOBAL_INFO),
+ tp/Texinfo/XS/parsetexi/parser.c (register_global_command)
+ (wipe_global_info), tp/Texinfo/XS/parsetexi/api.c
+ (build_global_info2): add author to global info, to be consistent with
+ global in command_data.txt.
+ Remove a useless TODO.
+
+ * tp/Texinfo/ParserNonXS.pm (_process_remaining_on_line),
+ tp/Texinfo/XS/parsetexi/parser.c (process_remaining_on_line): minor
+ changes: change order of code, remove useless retval set, changein
+ comments, more similar codes in XS and perl parsers.
+
2023-03-04 Gavin Smith <gavinsmith0123@gmail.com>
Multiple @defline in @defblock in texi2any
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index 3c40e3ebb7..367d2f723a 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -5814,17 +5814,20 @@ sub _process_remaining_on_line($$$$)
($argument_container, $line, $source_info)
= _handle_macro($self, $current, $line, $source_info, $command);
if ($argument_container) {
- # directly get the following input (macro expansion text) instead
- # of going through the next call of process_remaining_on_line and
- # the processing of empty text. No difference in output, more
- # efficient.
- ($line, $source_info) = _next_text($self, $current);
if ($from_alias) {
$argument_container->{'info'} = {}
if (!$argument_container->{'info'});
$argument_container->{'info'}->{'alias_of'} = $from_alias;
}
+
+ # directly get the following input (macro expansion text) instead
+ # of going through the next call of process_remaining_on_line and
+ # the processing of empty text. No difference in output, more
+ # efficient.
+
+ ($line, $source_info) = _next_text($self, $current);
+
}
return ($current, $line, $source_info, $retval);
# goto funexit; # used in XS code
@@ -6119,7 +6122,8 @@ sub _process_remaining_on_line($$$$)
$current = _end_preformatted($self, $current, $source_info);
}
- # command used for gathering data on the command. For @item command
+ # command used to get command data. Needed for the multicategory
+ # @item command
my $data_cmdname = $command;
# cannot check parent before closing paragraph/preformatted
$data_cmdname = 'item_LINE'
@@ -6166,22 +6170,23 @@ sub _process_remaining_on_line($$$$)
if (defined($nobrace_commands{$data_cmdname})) {
($current, $line, $retval, $command_element)
= _handle_other_command($self, $current, $command, $line,
$source_info);
- # in the XS parser return here if GET_A_NEW_LINE or FINISHED_TOTALLY
- # line commands
+
} elsif (defined($self->{'line_commands'}->{$data_cmdname})) {
+ # line commands
($current, $line, $retval, $command_element)
= _handle_line_command($self, $current, $command, $data_cmdname, $line,
$source_info);
- # in the XS parser return here if GET_A_NEW_LINE or FINISHED_TOTALLY
- # @-command with matching @end opening
+
} elsif (exists($block_commands{$data_cmdname})) {
+ # @-command with matching @end opening
($current, $line, $retval, $command_element)
= _handle_block_command($self, $current, $command, $line, $source_info);
- # in the XS parser return here if GET_A_NEW_LINE
+
} elsif (defined($self->{'brace_commands'}->{$data_cmdname})) {
($current, $command_element)
= _handle_brace_command($self, $current, $command, $source_info);
}
+
if ($from_alias and $command_element) {
$command_element->{'info'} = {} if (!$command_element->{'info'});
$command_element->{'info'}->{'alias_of'} = $from_alias;
@@ -6790,8 +6795,7 @@ sub _process_remaining_on_line($$$$)
die;
}
$current = _end_line($self, $current, $source_info);
- return ($current, $line, $source_info, $GET_A_NEW_LINE);
- # goto funexit; # used in XS code
+ $retval = $GET_A_NEW_LINE;
}
funexit:
diff --git a/tp/Texinfo/XS/parsetexi/api.c b/tp/Texinfo/XS/parsetexi/api.c
index 5d705fba2b..e1929d4736 100644
--- a/tp/Texinfo/XS/parsetexi/api.c
+++ b/tp/Texinfo/XS/parsetexi/api.c
@@ -1011,14 +1011,15 @@ build_global_info2 (void)
} \
}
+ BUILD_GLOBAL_ARRAY(author);
+ BUILD_GLOBAL_ARRAY(detailmenu);
BUILD_GLOBAL_ARRAY(hyphenation);
BUILD_GLOBAL_ARRAY(insertcopying);
+ BUILD_GLOBAL_ARRAY(listoffloats);
+ BUILD_GLOBAL_ARRAY(part);
BUILD_GLOBAL_ARRAY(printindex);
BUILD_GLOBAL_ARRAY(subtitle);
BUILD_GLOBAL_ARRAY(titlefont);
- BUILD_GLOBAL_ARRAY(listoffloats);
- BUILD_GLOBAL_ARRAY(detailmenu);
- BUILD_GLOBAL_ARRAY(part);
/* from Common.pm %document_settable_multiple_at_commands */
BUILD_GLOBAL_ARRAY(allowcodebreaks);
diff --git a/tp/Texinfo/XS/parsetexi/commands.c
b/tp/Texinfo/XS/parsetexi/commands.c
index 14024863cc..9265a7cf11 100644
--- a/tp/Texinfo/XS/parsetexi/commands.c
+++ b/tp/Texinfo/XS/parsetexi/commands.c
@@ -98,7 +98,9 @@ add_texinfo_command (char *name)
enum command_id user_data_cmd = existing_cmd & ~USER_COMMAND_BIT;
/* FIXME it is consistent with silent replacement of macro
by another user-defined command to remove the information
- on a previously defined macro, but it may not be right. */
+ on a previously defined macro, but it may not be right, or
+ at least there could be a warning as there is a warning when
+ a macro is redefined. */
if (user_defined_command_data[user_data_cmd].flags & CF_MACRO)
{
MACRO *m = lookup_macro (existing_cmd);
diff --git a/tp/Texinfo/XS/parsetexi/parser.c b/tp/Texinfo/XS/parsetexi/parser.c
index b0082ca533..3df99e4714 100644
--- a/tp/Texinfo/XS/parsetexi/parser.c
+++ b/tp/Texinfo/XS/parsetexi/parser.c
@@ -308,14 +308,16 @@ register_global_command (ELEMENT *current)
add_to_contents_as_array (&global_info.floats, current);
break;
+ /* global in command_data.txt */
+ GLOBAL_CASE(author);
+ GLOBAL_CASE(detailmenu);
GLOBAL_CASE(hyphenation);
GLOBAL_CASE(insertcopying);
+ GLOBAL_CASE(listoffloats);
+ GLOBAL_CASE(part);
GLOBAL_CASE(printindex);
GLOBAL_CASE(subtitle);
GLOBAL_CASE(titlefont);
- GLOBAL_CASE(listoffloats);
- GLOBAL_CASE(detailmenu);
- GLOBAL_CASE(part);
/* from Common.pm %document_settable_multiple_at_commands */
GLOBAL_CASE(allowcodebreaks);
@@ -341,7 +343,6 @@ register_global_command (ELEMENT *current)
/* do nothing; just silence -Wswitch about lots of un-covered cases
*/
break;
}
- /* TODO: Check if all of these are necessary. */
return 1;
}
else if ((command_data(cmd).flags & CF_global_unique))
@@ -435,13 +436,14 @@ wipe_global_info (void)
#define GLOBAL_CASE(cmx) \
free (global_info.cmx.contents.list)
+ GLOBAL_CASE(author);
+ GLOBAL_CASE(detailmenu);
GLOBAL_CASE(hyphenation);
GLOBAL_CASE(insertcopying);
GLOBAL_CASE(printindex);
GLOBAL_CASE(subtitle);
GLOBAL_CASE(titlefont);
GLOBAL_CASE(listoffloats);
- GLOBAL_CASE(detailmenu);
GLOBAL_CASE(part);
GLOBAL_CASE(floats);
GLOBAL_CASE(allowcodebreaks);
@@ -1689,6 +1691,10 @@ process_remaining_on_line (ELEMENT **current_inout, char
**line_inout)
macro_call_element = handle_macro (current, &line, cmd);
if (macro_call_element)
{
+ if (from_alias != CM_NONE)
+ add_info_string_dup (macro_call_element, "alias_of",
+ command_name (from_alias));
+
/* directly get the following input (macro expansion text) instead
of going through the next call of process_remaining_on_line and
the processing of empty text. No difference in output, more
@@ -1698,12 +1704,7 @@ process_remaining_on_line (ELEMENT **current_inout, char
**line_inout)
free (allocated_line);
allocated_line = next_text (current);
line = allocated_line;
-
- if (from_alias != CM_NONE)
- add_info_string_dup (macro_call_element, "alias_of",
- command_name (from_alias));
}
- retval = STILL_MORE_TO_PROCESS;
goto funexit;
}
/* expand value if it actually expands and changes the line. It is
@@ -1769,7 +1770,6 @@ process_remaining_on_line (ELEMENT **current_inout, char
**line_inout)
/* Move 'line' to end of string so next input to
be processed is taken from input stack. */
line = remaining_line + strlen (remaining_line);
- retval = STILL_MORE_TO_PROCESS;
}
if (value)
{
@@ -1857,7 +1857,6 @@ process_remaining_on_line (ELEMENT **current_inout, char
**line_inout)
current = paragraph;
line = line_after_command;
- retval = STILL_MORE_TO_PROCESS;
goto funexit;
}
@@ -1993,7 +1992,8 @@ process_remaining_on_line (ELEMENT **current_inout, char
**line_inout)
else if (cmd)
{
int def_line_continuation;
- /* command used for gathering data on the command. For @item command */
+ /* command used to get command data. Needed for the multicategory
+ @item command. */
enum command_id data_cmd = cmd;
ELEMENT *command_element;
@@ -2045,13 +2045,10 @@ process_remaining_on_line (ELEMENT **current_inout,
char **line_inout)
add_to_element_contents (current, value_elt);
line++; /* past '}' */
- retval = STILL_MORE_TO_PROCESS;
}
/* expansion of value already done above
else
- {
- value is set
- }
+ value is set
*/
free (flag);
goto funexit;
@@ -2068,7 +2065,6 @@ process_remaining_on_line (ELEMENT **current_inout, char
**line_inout)
add_to_element_contents (current, txiinternalvalue_elt);
line++; /* past '}' */
- retval = STILL_MORE_TO_PROCESS;
free (flag);
goto funexit;
@@ -2078,7 +2074,6 @@ process_remaining_on_line (ELEMENT **current_inout, char
**line_inout)
{
value_invalid:
line_error ("bad syntax for @%s", command_name(cmd));
- retval = STILL_MORE_TO_PROCESS;
goto funexit;
}
}
@@ -2263,7 +2258,6 @@ process_remaining_on_line (ELEMENT **current_inout, char
**line_inout)
*line = saved;
}
- retval = STILL_MORE_TO_PROCESS;
goto funexit;
}
else /* End of line */
diff --git a/tp/Texinfo/XS/parsetexi/parser.h b/tp/Texinfo/XS/parsetexi/parser.h
index 98be29deed..19d72ccb61 100644
--- a/tp/Texinfo/XS/parsetexi/parser.h
+++ b/tp/Texinfo/XS/parsetexi/parser.h
@@ -71,16 +71,17 @@ typedef struct GLOBAL_INFO {
ELEMENT *smallbook;
/* Arrays of elements */
+ ELEMENT author;
+ ELEMENT detailmenu;
+ ELEMENT floats;
ELEMENT footnotes;
ELEMENT hyphenation;
ELEMENT insertcopying;
+ ELEMENT listoffloats;
+ ELEMENT part;
ELEMENT printindex;
ELEMENT subtitle;
ELEMENT titlefont;
- ELEMENT listoffloats;
- ELEMENT detailmenu;
- ELEMENT part;
- ELEMENT floats;
ELEMENT allowcodebreaks;
ELEMENT clickstyle;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/XS/parsetexi/parser.h (GLOBAL_INFO), tp/Texinfo/XS/parsetexi/parser.c (register_global_command) (wipe_global_info), tp/Texinfo/XS/parsetexi/api.c (build_global_info2): add author to global info, to be consistent with global in command_data.txt. Remove a useless TODO.,
Patrice Dumas <=