[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: handle @novalidate in a more common way
From: |
Patrice Dumas |
Subject: |
branch master updated: handle @novalidate in a more common way |
Date: |
Wed, 25 Aug 2021 17:14:03 -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 6c1f17e handle @novalidate in a more common way
6c1f17e is described below
commit 6c1f17e6451907b42ca2547a241f1b4e17ad158f
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed Aug 25 23:13:53 2021 +0200
handle @novalidate in a more common way
* tp/Texinfo/Common.pm (%default_parser_customization_values):
add novalidate.
* tp/texi2any.pl: do not set {'info'}->{'novalidate'} here.
* tp/Texinfo/ParserNonXS.pm (_set_global_informations, _parse_texi)
tp/Texinfo/XS/parsetexi/Parsetexi.pm (parser, get_parser_info)
tp/Texinfo/XS/parsetexi/handle_commands.c (handle_line_command):
Handle @novalidate more like other commands by setting
{'info'}->{'novalidate'} based on global unique
command information and configuration.
* tp/Texinfo/XS/parsetexi/Parsetexi.xs (set_novalidate),
tp/Texinfo/XS/parsetexi/parser.c (set_novalidate): remove.
* tp/Texinfo/XS/parsetexi/api.c (build_global_info)
(build_global_info2), tp/Texinfo/XS/parsetexi/parser.c
(register_global_command), tp/Texinfo/XS/parsetexi/parser.h:
register novalidate as a global command.
---
ChangeLog | 21 ++++++++++++++++++++
tp/Texinfo/Common.pm | 1 +
tp/Texinfo/ParserNonXS.pm | 32 ++++++++++++++++++++-----------
tp/Texinfo/XS/parsetexi/Parsetexi.pm | 10 ++++++----
tp/Texinfo/XS/parsetexi/Parsetexi.xs | 3 ---
tp/Texinfo/XS/parsetexi/api.c | 7 +------
tp/Texinfo/XS/parsetexi/handle_commands.c | 4 ----
tp/Texinfo/XS/parsetexi/parser.c | 7 +------
tp/Texinfo/XS/parsetexi/parser.h | 3 +--
tp/texi2any.pl | 1 -
10 files changed, 52 insertions(+), 37 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 7fc3de7..3e21411 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,26 @@
2021-08-25 Patrice Dumas <pertusus@free.fr>
+ handle @novalidate in a more common way
+
+ * tp/Texinfo/Common.pm (%default_parser_customization_values):
+ add novalidate.
+ * tp/texi2any.pl: do not set {'info'}->{'novalidate'} here.
+ * tp/Texinfo/ParserNonXS.pm (_set_global_informations, _parse_texi)
+ tp/Texinfo/XS/parsetexi/Parsetexi.pm (parser, get_parser_info)
+ tp/Texinfo/XS/parsetexi/handle_commands.c (handle_line_command):
+ Handle @novalidate more like other commands by setting
+ {'info'}->{'novalidate'} based on global unique
+ command information and configuration.
+ * tp/Texinfo/XS/parsetexi/Parsetexi.xs (set_novalidate),
+ tp/Texinfo/XS/parsetexi/parser.c (set_novalidate): remove.
+ * tp/Texinfo/XS/parsetexi/api.c (build_global_info)
+ (build_global_info2), tp/Texinfo/XS/parsetexi/parser.c
+ (register_global_command), tp/Texinfo/XS/parsetexi/parser.h:
+ register novalidate as a global command.
+
+
+2021-08-25 Patrice Dumas <pertusus@free.fr>
+
* tp/Texinfo/Common.pm (%default_parser_state_configuration)
(%default_parser_customization_values, @variable_other_settables)
(@parser_options), tp/Texinfo/Convert/Text.pm (converter),
diff --git a/tp/Texinfo/Common.pm b/tp/Texinfo/Common.pm
index 4c9d7c3..adea3d4 100644
--- a/tp/Texinfo/Common.pm
+++ b/tp/Texinfo/Common.pm
@@ -102,6 +102,7 @@ sub __p($$) {
# Customization variables obeyed by the parser, and the default values.
our %default_parser_customization_values = (
'documentlanguage' => undef,
+ 'novalidate' => undef,
'EXPANDED_FORMATS' => [],
'DEBUG' => 0, # if >= 10, tree is printed in texi2any.pl after parsing.
# If >= 100 tree is printed every line.
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index 7aca82e..1ed47c0 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -135,22 +135,21 @@ my %parser_state_configuration = (
# that is set to mark that @ifcommandnotdefined
# is implemented
'info' => {
- 'novalidate' => 0, # same as setting @novalidate.
'input_encoding_name' => 'utf-8',
'input_perl_encoding' => 'utf-8'
},
- 'in_gdt' => 0 # whether we are being called by gdt
+ 'in_gdt' => 0, # whether we are being called by gdt
+ 'clickstyle' => 'arrow',
+ 'kbdinputstyle' => 'distinct',
+ # this is not really used, but this allows to have an
+ # output more similar to the XS parser output.
+ 'floats' => {},
);
my %parser_default_configuration = (
%parser_state_configuration,
%Texinfo::Common::default_parser_customization_values,
%Texinfo::Common::default_structure_customization_values,
- 'clickstyle' => 'arrow',
- 'kbdinputstyle' => 'distinct',
- # this is not really used, but this allows to have an
- # output more similar to the XS parser output.
- 'floats' => {},
);
# the other possible keys for the parser state are:
@@ -843,6 +842,9 @@ sub parse_texi_text($$;$$$$)
$self = parser() if (!defined($self));
$self->{'input'} = [{'pending' => $lines_array}];
my $tree = $self->_parse_texi();
+
+ $self->_set_global_informations();
+
return $tree;
}
@@ -868,6 +870,15 @@ sub _open_in {
}
}
+sub _set_global_informations($)
+{
+ my $self = shift;
+
+ if ($self->get_conf('novalidate') or $self->{'extra'}->{'novalidate'}) {
+ $self->{'info'}->{'novalidate'} = 1;
+ }
+}
+
# parse a texi file
sub parse_texi_file($$)
{
@@ -921,7 +932,7 @@ sub parse_texi_file($$)
}];
$self->{'info'}->{'input_file_name'} = $file_name;
$self->{'info'}->{'input_directory'} = $directories;
-
+
my $tree = $self->_parse_texi($root);
# Find 'text_root', which contains everything before first node/section.
@@ -951,7 +962,8 @@ sub parse_texi_file($$)
unshift (@{$text_root->{'contents'}}, $before_setfilename)
if (@{$before_setfilename->{'contents'}});
}
- #$self->_check_contents_location($tree);
+
+ $self->_set_global_informations();
return $tree;
}
@@ -4439,8 +4451,6 @@ sub _parse_texi($;$)
$self->{'sections_level'}++;
} elsif ($command eq 'lowersections') {
$self->{'sections_level'}--;
- } elsif ($command eq 'novalidate') {
- $self->{'info'}->{'novalidate'} = 1;
}
_register_global_command($self, $misc, $line_nr)
if $misc;
diff --git a/tp/Texinfo/XS/parsetexi/Parsetexi.pm
b/tp/Texinfo/XS/parsetexi/Parsetexi.pm
index d972758..b9a355f 100644
--- a/tp/Texinfo/XS/parsetexi/Parsetexi.pm
+++ b/tp/Texinfo/XS/parsetexi/Parsetexi.pm
@@ -69,6 +69,7 @@ sub parser (;$$)
if (defined($conf)) {
foreach my $key (keys (%$conf)) {
# Copy conf to parser object. Not used in parser module itself
+ # except to set {'info'}->{'novalidate'}
# but some settings may be used elsewhere, especially in
# Structuring.pm.
if ($key ne 'values' and ref($conf->{$key})) {
@@ -104,10 +105,6 @@ sub parser (;$$)
if (defined ($conf->{$key})) {
set_documentlanguage ($conf->{$key});
}
- } elsif ($key eq 'info') {
- if (defined($conf->{$key}->{'novalidate'})) {
- set_novalidate($conf->{$key}->{'novalidate'});
- }
} elsif ($key eq 'FORMAT_MENU') {
if ($conf->{$key} eq 'menu') {
conf_set_show_menu (1);
@@ -122,6 +119,7 @@ sub parser (;$$)
set_debug($conf->{$key}) if $conf->{'key'};
} elsif ($key eq 'in_gdt'
or $key eq 'ENABLE_ENCODING'
+ or $key eq 'novalidate'
or
defined($Texinfo::Common::default_structure_customization_values{$key})) {
# no action needed
} else {
@@ -193,6 +191,10 @@ sub get_parser_info {
$self->{'info'} = $GLOBAL_INFO;
$self->{'extra'} = $GLOBAL_INFO2;
+ if ($self->get_conf('novalidate') or $self->{'extra'}->{'novalidate'}) {
+ $self->{'info'}->{'novalidate'} = 1;
+ }
+
# Propagate these settings from 'info' hash to 'values' hash.
# The 'values' hash is not otherwise used. Maybe we should use
# the 'info' hash for this instead in the pure Perl code.
diff --git a/tp/Texinfo/XS/parsetexi/Parsetexi.xs
b/tp/Texinfo/XS/parsetexi/Parsetexi.xs
index bbf3b76..9e3546e 100644
--- a/tp/Texinfo/XS/parsetexi/Parsetexi.xs
+++ b/tp/Texinfo/XS/parsetexi/Parsetexi.xs
@@ -103,9 +103,6 @@ void
conf_set_IGNORE_SPACE_AFTER_BRACED_COMMAND_NAME (int i)
void
-set_novalidate (int i)
-
-void
set_documentlanguage (value)
char *value
diff --git a/tp/Texinfo/XS/parsetexi/api.c b/tp/Texinfo/XS/parsetexi/api.c
index f85ceff..1655c1c 100644
--- a/tp/Texinfo/XS/parsetexi/api.c
+++ b/tp/Texinfo/XS/parsetexi/api.c
@@ -892,12 +892,6 @@ build_global_info (void)
}
}
- if (global_info.novalidate)
- {
- hv_store (hv, "novalidate", strlen ("novalidate"),
- newSVpv ("1", 0), 0);
- }
-
char *txi_flags[] = { "txiindexatsignignore", "txiindexbackslashignore",
"txiindexhyphenignore", "txiindexlessthanignore", 0};
char **p;
@@ -958,6 +952,7 @@ build_global_info2 (void)
BUILD_GLOBAL_UNIQ(oddfootingmarks);
BUILD_GLOBAL_UNIQ(shorttitlepage);
BUILD_GLOBAL_UNIQ(title);
+ BUILD_GLOBAL_UNIQ(novalidate);
#undef BUILD_GLOBAL_UNIQ
/* NOTE: Same list in handle_commands.c:register_global_command. */
diff --git a/tp/Texinfo/XS/parsetexi/handle_commands.c
b/tp/Texinfo/XS/parsetexi/handle_commands.c
index 7b9bfbe..cb088e7 100644
--- a/tp/Texinfo/XS/parsetexi/handle_commands.c
+++ b/tp/Texinfo/XS/parsetexi/handle_commands.c
@@ -498,10 +498,6 @@ handle_line_command (ELEMENT *current, char **line_inout,
{
global_info.sections_level--;
}
- else if (cmd == CM_novalidate)
- {
- global_info.novalidate = 1;
- }
if (misc)
register_global_command (misc);
diff --git a/tp/Texinfo/XS/parsetexi/parser.c b/tp/Texinfo/XS/parsetexi/parser.c
index 65498f0..d744aa5 100644
--- a/tp/Texinfo/XS/parsetexi/parser.c
+++ b/tp/Texinfo/XS/parsetexi/parser.c
@@ -146,12 +146,6 @@ set_documentlanguage (char *value)
global_documentlanguage = strdup (value);
}
-void
-set_novalidate (int value)
-{
- global_info.novalidate = value;
-}
-
/* Record the information from a command of global effect. */
int
register_global_command (ELEMENT *current)
@@ -253,6 +247,7 @@ register_global_command (ELEMENT *current)
GLOBAL_UNIQUE_CASE(oddfootingmarks);
GLOBAL_UNIQUE_CASE(shorttitlepage);
GLOBAL_UNIQUE_CASE(title);
+ GLOBAL_UNIQUE_CASE(novalidate);
#undef GLOBAL_UNIQUE_CASE
/* NOTE: Same list in api.c:build_global_info2 and wipe_global_info. */
default:
diff --git a/tp/Texinfo/XS/parsetexi/parser.h b/tp/Texinfo/XS/parsetexi/parser.h
index 9cc2f24..2ae42bc 100644
--- a/tp/Texinfo/XS/parsetexi/parser.h
+++ b/tp/Texinfo/XS/parsetexi/parser.h
@@ -35,7 +35,6 @@ typedef struct GLOBAL_INFO {
char *input_encoding_name;
char *input_perl_encoding;
int sections_level;
- int novalidate;
ELEMENT dircategory_direntry; /* an array of elements */
/* Elements that should be unique. */
@@ -63,6 +62,7 @@ typedef struct GLOBAL_INFO {
ELEMENT *evenfootingmarks;
ELEMENT *oddfootingmarks;
ELEMENT *shorttitlepage;
+ ELEMENT *novalidate;
/* Arrays of elements */
ELEMENT footnotes;
@@ -157,7 +157,6 @@ int format_expanded_p (char *format);
int is_end_current_command (ELEMENT *current, char **line,
enum command_id *end_cmd);
void set_documentlanguage (char *);
-void set_novalidate (int value);
char *element_type_name (ELEMENT *e);
/* Return values */
diff --git a/tp/texi2any.pl b/tp/texi2any.pl
index d3f7d99..6fe26ab 100755
--- a/tp/texi2any.pl
+++ b/tp/texi2any.pl
@@ -894,7 +894,6 @@ There is NO WARRANTY, to the extent permitted by law.\n"),
"2021";
},
'no-validate|no-pointer-validate' => sub {
set_from_cmdline('novalidate',$_[1]);
- $parser_options->{'info'}->{'novalidate'} = $_[1];
},
'no-warn' => sub { set_from_cmdline('NO_WARN', $_[1]); },
'verbose|v!' => sub {set_from_cmdline('VERBOSE', $_[1]);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: handle @novalidate in a more common way,
Patrice Dumas <=