[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: Remove old TODO
From: |
Gavin D. Smith |
Subject: |
branch master updated: Remove old TODO |
Date: |
Sun, 09 Jan 2022 12:13:32 -0500 |
This is an automated email from the git hooks/post-receive script.
gavin pushed a commit to branch master
in repository texinfo.
The following commit(s) were added to refs/heads/master by this push:
new 516b8b5cfb Remove old TODO
516b8b5cfb is described below
commit 516b8b5cfb364628d1e284770d9f9a19fc0658b1
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Sun Jan 9 17:13:20 2022 +0000
Remove old TODO
* tp/Texinfo/XS/parsetexi/input.c,
* tp/Texinfo/XS/parsetexi/macro.c: Do not define _GNU_SOURCE as
gnulib should deal with this.
* tp/Texinfo/XS/parsetexi/api.c (element_to_perl_hash): Add a
comment regarding use of newSVpv.
* tp/Texinfo/XS/parsetexi/TODO: Remove obsolete file. Report from
Patrice.
---
ChangeLog | 13 +++
tp/Texinfo/XS/parsetexi/TODO | 204 ----------------------------------------
tp/Texinfo/XS/parsetexi/api.c | 5 +-
tp/Texinfo/XS/parsetexi/input.c | 4 +-
tp/Texinfo/XS/parsetexi/macro.c | 4 +-
5 files changed, 18 insertions(+), 212 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 2a07409075..bf0343ceae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2022-01-09 Gavin Smith <gavinsmith0123@gmail.com>
+
+ Remove old TODO
+
+ * tp/Texinfo/XS/parsetexi/input.c,
+ * tp/Texinfo/XS/parsetexi/macro.c: Do not define _GNU_SOURCE as
+ gnulib should deal with this.
+ * tp/Texinfo/XS/parsetexi/api.c (element_to_perl_hash): Add a
+ comment regarding use of newSVpv.
+
+ * tp/Texinfo/XS/parsetexi/TODO: Remove obsolete file. Report from
+ Patrice.
+
2022-01-09 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/ParserNonXS.pm (parse_texi_line),
diff --git a/tp/Texinfo/XS/parsetexi/TODO b/tp/Texinfo/XS/parsetexi/TODO
deleted file mode 100644
index 7d210e3ba1..0000000000
--- a/tp/Texinfo/XS/parsetexi/TODO
+++ /dev/null
@@ -1,204 +0,0 @@
-* conditionals on @set/@value, output format
-* implement command_warn properly
-* floats
-* Check everywhere we store values, we check properly what to do if the
- values are already defined.
-* check valid nestings
-* Implement more parser options
-* Character encoding issues - read and pass to Perl correctly.
-* gnulib integration for strrchr, strchrnul, asprintf, etc. Eliminate
- #define _GNU_SOURCE.
-* gettext integration
-* figure out what to do with parse_texi_line, etc. Integration with the
-test suites.
-* find where "strlen" and "text_append" are used and try to remove them, for
-efficiency. Also newSVpv (..., 0);
-* Add "TODO" anywhere in the code with explanations of what is not done yet.
-
-================================================================
-
-Texinfo::Report::gdt and parse_texi_line -
-
-Multiple Texinfo::Parser objects are created in a run of texi2any. The
-main one is to parse the input file, but it is also used by gdt - the
-string translation function. (I haven't ruled out that it is also used
-somewhere else as well.)
-
-This makes replacing the Texinfo::Parser module more complicated.
-
-gdt parses pieces Texinfo code that are the translations of strings in
-po_document/texinfo_document.pot. It does this by adding "@value"
-before strings surrounded by braces, and then calling "parse_texi_line"
-with these @value's set to the appropriate value. These values could be
-a string, a hash reference (representing a tree element), or an array
-reference (representing a "content array" of tree elements).
-
-parse_texi_line returns a Perl Texinfo tree which is at last converted
-into the output Info/HTML/etc.
-
-These values that are not strings are a challenge for how they can be
-passed back into C. We have code (in api.c) to translate our C
-representations of the Texinfo tree to Perl data structures, but not
-vice versa.
-
-We deal with this by leaving the @value's undefined, letting an element
-representing a use of an unused @value appear in the parse tree, and
-then substituting in the parse trees for the @value's afterwards, in
-Texinfo::Report::gdt. See diff below.
-
-Other suggestions:
-* Don't call parse_texi_line at all. This would be a simplification of
-the overall structure of the makeinfo program and might not lose much
-flexibility in return. Most of the strings in texinfo_document.pot
-don't use any Texinfo commands, and the others could be expressed
-directly in the output format, e.g. instead of
-
-msgid "{category} on {class}: @strong{{name}}
-
-it could be
-
-msgid "{category} on {class}: <strong>{name}</strong>"
-
-Some of the translation strings use Texinfo commands for characters,
-e.g. "@'e". This would have to be replaced with whatever method other
-programs using gettext use for special characters. It would also stop
-translation strings being reused across output formats, creating more
-work for translators.
-
-* Write code translating Perl tree elements into C data structures and
-allow them to be passed to the parser as @value's. I am very reluctant
-to do this.
-
-To use the current implementation, do the following to
-tp/Texinfo/Report.pm:
-
-Index: Texinfo/Report.pm
-===================================================================
---- Texinfo/Report.pm (revision 6344)
-+++ Texinfo/Report.pm (working copy)
-@@ -49,6 +49,7 @@ use File::Basename;
- use Locale::Messages;
- # to be able to load a parser if none was given to gdt.
- use Texinfo::Parser;
-+use Parsetexi;
-
- # return the errors and warnings
- sub errors($)
-@@ -244,7 +245,8 @@ sub _encode_i18n_string($$)
- return Encode::decode($encoding, $string);
- }
-
--# handle translations of in-document strings.
-+# Get document translation - handle translations of in-document strings.
-+# Return a parsed Texinfo tree
- sub gdt($$;$$)
- {
- my $self = shift;
-@@ -376,7 +378,11 @@ sub gdt($$;$$)
- $translation_result =~ s/\{($re)\}/\@value\{_$1\}/g;
- foreach my $substitution(keys %$context) {
- #print STDERR "$translation_result $substitution
$context->{$substitution}\n";
-- $parser_conf->{'values'}->{'_'.$substitution} =
$context->{$substitution};
-+ if (!ref($context->{$substitution})) {
-+ #warn "setting $substitution to $context->{$substitution}\n";
-+ $parser_conf->{'values'}->{'_'.$substitution}
-+ = $context->{$substitution};
-+ }
- }
- }
-
-@@ -399,7 +405,8 @@ sub gdt($$;$$)
- }
- }
- #my $parser = Texinfo::Parser::parser($parser_conf);
-- my $parser = Texinfo::Parser::simple_parser($parser_conf);
-+ #my $parser = Texinfo::Parser::simple_parser($parser_conf);
-+ my $parser = Parsetexi::parser($parser_conf);
- if ($parser->{'DEBUG'}) {
- print STDERR "GDT $translation_result\n";
- }
-@@ -411,10 +418,67 @@ sub gdt($$;$$)
- } else {
- $tree = $parser->parse_texi_line($translation_result);
- }
-+ #warn '--------------------------------------', "\n";
-+ #warn Texinfo::Parser::_print_tree ($tree);
-+ $tree = _substitute ($tree, $context);
-+ #warn Texinfo::Parser::_print_tree ($tree);
-+ #warn '--------------------------------------', "\n";
- return $tree;
- }
-
-+sub _substitute_element_array ($$);
-+sub _substitute_element_array ($$) {
-+ my $array = shift; my $context = shift;
-
-+ # "the push @{$current->{'contents'}}, {}; prevents a trailing
-+ # text to be merged, to avoid having the value tree modified."
-+
-+ # It's not necessary now, but we are yet to update the test
-+ # results to remove the extra {}'s.
-+
-+ @{$array} = map {
-+ if ($_->{'cmdname'} and $_->{'cmdname'} eq 'value'
-+ and $_->{'type'}
-+ ) {
-+ my $name = $_->{'type'};
-+ $name =~ s/^_//;
-+ if (ref($context->{$name}) eq 'HASH') {
-+ ( $context->{$name} , {} );
-+ } elsif (ref($context->{$name}) eq 'ARRAY') {
-+ ( @{$context->{$name}} , {} );
-+ }
-+ } else {
-+ _substitute($_, $context);
-+ ( $_ );
-+ }
-+ } @{$array};
-+}
-+
-+sub _substitute ($$);
-+sub _substitute ($$) {
-+ my $tree = shift; my $context = shift;
-+
-+ if ($tree->{'contents'}) {
-+ _substitute_element_array ($tree->{'contents'}, $context);
-+ }
-+
-+ if ($tree->{'args'}) {
-+ _substitute_element_array ($tree->{'args'}, $context);
-+ }
-+
-+ # Used for @email and @url
-+ if ($tree->{'extra'} and $tree->{'extra'}{'brace_command_contents'}) {
-+ for my $arg (@{$tree->{'extra'}{'brace_command_contents'}}) {
-+ if ($arg) {
-+ _substitute_element_array ($arg, $context);
-+ }
-+ }
-+ }
-+
-+ return $tree;
-+}
-+
-+
- 1;
-
- __END__
-
-
-===================================================================
-
-
-Integration with rest of Perl code:
-
-Passing data as Perl code to be evaluated in very slow, which limits the
-speed-up that is obtained. One way round this would be to access the
-parse tree in the Perl code through an API. This would be done in two
-stages:
-
-* Convert makeinfo backends to use a Perl stub for the C API. The C
-parser will not be used at this point.
-* Substitute the XS API implementation for the Perl API when the C
-parser is good enough.
-
diff --git a/tp/Texinfo/XS/parsetexi/api.c b/tp/Texinfo/XS/parsetexi/api.c
index 22f974b366..59d4ded019 100644
--- a/tp/Texinfo/XS/parsetexi/api.c
+++ b/tp/Texinfo/XS/parsetexi/api.c
@@ -1,4 +1,4 @@
-/* Copyright 2010-2021 Free Software Foundation, Inc.
+/* Copyright 2010-2022 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -294,7 +294,8 @@ element_to_perl_hash (ELEMENT *e)
sv = newSVpv (command_name(e->cmd), 0);
hv_store (e->hv, "cmdname", strlen ("cmdname"), sv, 0);
- /* TODO: Same optimizations as for 'type'. */
+ /* Note we could optimize the call to newSVpv here and
+ elsewhere by passing an appropriate second argument. */
}
/* A lot of special cases for when an empty contents array should be
diff --git a/tp/Texinfo/XS/parsetexi/input.c b/tp/Texinfo/XS/parsetexi/input.c
index 990ad84f38..81120f81a0 100644
--- a/tp/Texinfo/XS/parsetexi/input.c
+++ b/tp/Texinfo/XS/parsetexi/input.c
@@ -1,4 +1,4 @@
-/* Copyright 2010-2020 Free Software Foundation, Inc.
+/* Copyright 2010-2022 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -13,8 +13,6 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#define _GNU_SOURCE
-
#include <config.h>
#include <stdlib.h>
diff --git a/tp/Texinfo/XS/parsetexi/macro.c b/tp/Texinfo/XS/parsetexi/macro.c
index 06e3ed4826..36bb41d9d9 100644
--- a/tp/Texinfo/XS/parsetexi/macro.c
+++ b/tp/Texinfo/XS/parsetexi/macro.c
@@ -1,4 +1,4 @@
-/* Copyright 2010-2019 Free Software Foundation, Inc.
+/* Copyright 2010-2022 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -13,8 +13,6 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#define _GNU_SOURCE
-
#include <config.h>
#include <stdlib.h>
#include <string.h>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: Remove old TODO,
Gavin D. Smith <=