[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/XS/main/convert_to_text.c (ascii_acc
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/XS/main/convert_to_text.c (ascii_accent) (ascii_accents_internal): call encoded_accents with ascii_accent as argument, not ascii_accents_internal. Add an unused set_case argument to ascii_accent to have a prototype matching with the prototype used by encoded_accents. |
Date: |
Sun, 12 Nov 2023 12:21:55 -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 3b91c253c6 * tp/Texinfo/XS/main/convert_to_text.c (ascii_accent)
(ascii_accents_internal): call encoded_accents with ascii_accent as argument,
not ascii_accents_internal. Add an unused set_case argument to ascii_accent to
have a prototype matching with the prototype used by encoded_accents.
3b91c253c6 is described below
commit 3b91c253c645d427b3416c77774b8d106e60430f
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Nov 12 18:21:48 2023 +0100
* tp/Texinfo/XS/main/convert_to_text.c (ascii_accent)
(ascii_accents_internal): call encoded_accents with ascii_accent as
argument, not ascii_accents_internal. Add an unused set_case argument
to ascii_accent to have a prototype matching with the prototype used
by encoded_accents.
* tp/Texinfo/XS/main/convert_to_text.c (ascii_accents_internal),
tp/Texinfo/XS/main/convert_utils.c (find_innermost_accent_contents)
(destroy_accent_stack), tp/Texinfo/XS/main/convert_utils.h
(ACCENTS_STACK), tp/Texinfo/XS/main/unicode.c
(format_eight_bit_accents_stack, encoded_accents)
(format_unicode_accents_stack_internal): use an ELEMENT_LIST for the
ACCENTS_STACK stack.
---
ChangeLog | 16 ++++++++++++++++
tp/Texinfo/XS/main/convert_to_text.c | 12 ++++++------
tp/Texinfo/XS/main/convert_utils.c | 9 +++++----
tp/Texinfo/XS/main/convert_utils.h | 2 +-
tp/Texinfo/XS/main/unicode.c | 21 +++++++++++----------
tp/Texinfo/XS/main/unicode.h | 2 +-
6 files changed, 40 insertions(+), 22 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index a91b79d5e9..0a4b610e32 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2023-11-12 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/main/convert_to_text.c (ascii_accent)
+ (ascii_accents_internal): call encoded_accents with ascii_accent as
+ argument, not ascii_accents_internal. Add an unused set_case argument
+ to ascii_accent to have a prototype matching with the prototype used
+ by encoded_accents.
+
+ * tp/Texinfo/XS/main/convert_to_text.c (ascii_accents_internal),
+ tp/Texinfo/XS/main/convert_utils.c (find_innermost_accent_contents)
+ (destroy_accent_stack), tp/Texinfo/XS/main/convert_utils.h
+ (ACCENTS_STACK), tp/Texinfo/XS/main/unicode.c
+ (format_eight_bit_accents_stack, encoded_accents)
+ (format_unicode_accents_stack_internal): use an ELEMENT_LIST for the
+ ACCENTS_STACK stack.
+
2023-11-12 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/XS/convert/convert_html.c (prepare_special_units)
diff --git a/tp/Texinfo/XS/main/convert_to_text.c
b/tp/Texinfo/XS/main/convert_to_text.c
index bd5ee9e4e0..e0cc675868 100644
--- a/tp/Texinfo/XS/main/convert_to_text.c
+++ b/tp/Texinfo/XS/main/convert_to_text.c
@@ -43,7 +43,7 @@
#include "cmd_text.c"
char *
-ascii_accent (char *text, ELEMENT *command)
+ascii_accent (char *text, ELEMENT *command, int set_case)
{
enum command_id cmd = command->cmd;
TEXT accent_text;
@@ -81,7 +81,7 @@ ascii_accent (char *text, ELEMENT *command)
}
char *
-ascii_accents_internal (char *text, ELEMENT *stack, int set_case)
+ascii_accents_internal (char *text, ELEMENT_LIST *stack, int set_case)
{
char *result;
int i;
@@ -91,10 +91,10 @@ ascii_accents_internal (char *text, ELEMENT *stack, int
set_case)
else
result = strdup (text);
- for (i = stack->contents.number - 1; i >= 0; i--)
+ for (i = stack->number - 1; i >= 0; i--)
{
- ELEMENT *accent_command = stack->contents.list[i];
- char *formatted_accent = ascii_accent (result, accent_command);
+ ELEMENT *accent_command = stack->list[i];
+ char *formatted_accent = ascii_accent (result, accent_command, set_case);
free (result);
result = formatted_accent;
}
@@ -191,7 +191,7 @@ text_accents (ELEMENT *accent, char *encoding, int set_case)
text = strdup ("");
result = encoded_accents (text, accent_stack->stack, encoding,
- ascii_accents_internal, set_case);
+ ascii_accent, set_case);
if (!result)
result = ascii_accents_internal (text, accent_stack->stack, set_case);
diff --git a/tp/Texinfo/XS/main/convert_utils.c
b/tp/Texinfo/XS/main/convert_utils.c
index b22e5d16fe..d5307496b9 100644
--- a/tp/Texinfo/XS/main/convert_utils.c
+++ b/tp/Texinfo/XS/main/convert_utils.c
@@ -56,9 +56,10 @@ find_innermost_accent_contents (ELEMENT *element)
{
ELEMENT *current = element;
ELEMENT *argument = 0;
- ACCENTS_STACK *accent_stack = malloc (sizeof (ACCENTS_STACK));
+ ACCENTS_STACK *accent_stack = (ACCENTS_STACK *)
+ malloc (sizeof (ACCENTS_STACK));
- accent_stack->stack = new_element (ET_NONE);
+ accent_stack->stack = new_list ();
accent_stack->argument = 0;
while (1)
@@ -69,7 +70,7 @@ find_innermost_accent_contents (ELEMENT *element)
/* the following can happen if called with a bad tree */
if (!current->cmd || !(builtin_command_flags(current) & CF_accent))
return accent_stack;
- add_to_contents_as_array (accent_stack->stack, current);
+ add_to_element_list (accent_stack->stack, current);
/* A bogus accent, that may happen */
if (current->args.number <= 0)
return accent_stack;
@@ -112,7 +113,7 @@ find_innermost_accent_contents (ELEMENT *element)
void
destroy_accent_stack (ACCENTS_STACK *accent_stack)
{
- destroy_element (accent_stack->stack);
+ destroy_list (accent_stack->stack);
if (accent_stack->argument)
destroy_element (accent_stack->argument);
free (accent_stack);
diff --git a/tp/Texinfo/XS/main/convert_utils.h
b/tp/Texinfo/XS/main/convert_utils.h
index 50c4832d67..3c1b31dc13 100644
--- a/tp/Texinfo/XS/main/convert_utils.h
+++ b/tp/Texinfo/XS/main/convert_utils.h
@@ -13,7 +13,7 @@
extern char *convert_utils_month_name[12];
typedef struct ACCENTS_STACK {
- ELEMENT *stack;
+ ELEMENT_LIST *stack;
ELEMENT *argument;
} ACCENTS_STACK;
diff --git a/tp/Texinfo/XS/main/unicode.c b/tp/Texinfo/XS/main/unicode.c
index b1cb8ca776..ff02bb9d2c 100644
--- a/tp/Texinfo/XS/main/unicode.c
+++ b/tp/Texinfo/XS/main/unicode.c
@@ -172,7 +172,8 @@ compare_strings (const void *a, const void *b)
}
char *
-format_eight_bit_accents_stack (char *text, ELEMENT *stack, int encoding_index,
+format_eight_bit_accents_stack (char *text, ELEMENT_LIST *stack,
+ int encoding_index,
char *(*format_accent)(char *text, ELEMENT *element, int set_case),
int set_case)
{
@@ -180,7 +181,7 @@ format_eight_bit_accents_stack (char *text, ELEMENT *stack,
int encoding_index,
char *result = strdup (text);
char *prev_eight_bit;
char *new_eight_bit;
- int stack_nr = stack->contents.number;
+ int stack_nr = stack->number;
char **results_stack
= malloc ((stack_nr +1) * sizeof (char *));
@@ -190,7 +191,7 @@ format_eight_bit_accents_stack (char *text, ELEMENT *stack,
int encoding_index,
for (i = stack_nr -1; i >= 0; i--)
{
- ELEMENT *accent_command = stack->contents.list[i];
+ ELEMENT *accent_command = stack->list[i];
results_stack[i] = unicode_accent (results_stack[i+1],
accent_command);
if (!results_stack[i])
@@ -271,7 +272,7 @@ format_eight_bit_accents_stack (char *text, ELEMENT *stack,
int encoding_index,
# underbar.
*/
if (!strcmp (new_eight_bit, prev_eight_bit)
- && !(stack->contents.list[j]->cmd == CM_dotless
+ && !(stack->list[j]->cmd == CM_dotless
&& !strcmp (results_stack[j], "i")))
break;
free (result);
@@ -289,7 +290,7 @@ format_eight_bit_accents_stack (char *text, ELEMENT *stack,
int encoding_index,
*/
for (; j >= 0; j--)
{
- ELEMENT *accent_command = stack->contents.list[j];
+ ELEMENT *accent_command = stack->list[j];
char *formatted_result
= (*format_accent) (result, accent_command, set_case);
free (result);
@@ -307,16 +308,16 @@ format_eight_bit_accents_stack (char *text, ELEMENT
*stack, int encoding_index,
/* FIXME converter in perl for (*format_accent), see encoded_accents comment*/
char *
-format_unicode_accents_stack_internal (char *text, ELEMENT *stack,
+format_unicode_accents_stack_internal (char *text, ELEMENT_LIST *stack,
char *(*format_accent)(char *text, ELEMENT *element, int set_case),
int set_case)
{
int i;
char *result = strdup (text);
- for (i = stack->contents.number - 1; i >= 0; i--)
+ for (i = stack->number - 1; i >= 0; i--)
{
- ELEMENT *accent_command = stack->contents.list[i];
+ ELEMENT *accent_command = stack->list[i];
char *formatted_result = unicode_accent (result, accent_command);
if (formatted_result)
{
@@ -336,7 +337,7 @@ format_unicode_accents_stack_internal (char *text, ELEMENT
*stack,
for (; i >= 0; i--)
{
- ELEMENT *accent_command = stack->contents.list[i];
+ ELEMENT *accent_command = stack->list[i];
char *formatted_result
= (*format_accent) (result, accent_command, set_case);
free (result);
@@ -349,7 +350,7 @@ format_unicode_accents_stack_internal (char *text, ELEMENT
*stack,
directly and through functions. It is not clear whether it is
actually used in perl, nor if it could be useful in C */
char *
-encoded_accents (char *text, ELEMENT *stack, char *encoding,
+encoded_accents (char *text, ELEMENT_LIST *stack, char *encoding,
char *(*format_accent)(char *text, ELEMENT *element, int set_case),
int set_case)
{
diff --git a/tp/Texinfo/XS/main/unicode.h b/tp/Texinfo/XS/main/unicode.h
index 1e333e4373..85d67d5ec8 100644
--- a/tp/Texinfo/XS/main/unicode.h
+++ b/tp/Texinfo/XS/main/unicode.h
@@ -25,7 +25,7 @@ char *normalize_NFC (const char *text);
char *normalize_NFKD (const char *text);
char *unicode_accent (const char *text, ELEMENT *e);
-char *encoded_accents (char *text, ELEMENT *stack, char *encoding,
+char *encoded_accents (char *text, ELEMENT_LIST *stack, char *encoding,
char *(*format_accent)(char *text, ELEMENT *element, int set_case),
int set_case);
char *unicode_brace_no_arg_command (enum command_id cmd, char *encoding);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/XS/main/convert_to_text.c (ascii_accent) (ascii_accents_internal): call encoded_accents with ascii_accent as argument, not ascii_accents_internal. Add an unused set_case argument to ascii_accent to have a prototype matching with the prototype used by encoded_accents.,
Patrice Dumas <=
- Prev by Date:
branch master updated: * tp/Texinfo/XS/convert/convert_html.c (prepare_special_units) (set_root_commands_targets_node_files), tp/Texinfo/XS/main/build_perl_info.c (build_elements_list) (build_document), tp/Texinfo/XS/main/converter_types.h (DOCUMENT), tp/Texinfo/XS/main/document.c (register_document_nodes_list) (register_document_sections_list) (destroy_document_information_except_tree), tp/Texinfo/XS/structuring_transfo/StructuringTransfo.xs (sectioning_structure, nodes_tree), tp/Texinfo/XS/structuring_transfo/ [...]
- Next by Date:
branch master updated: * tp/Texinfo/XS/main/convert_to_text.c (ascii_accent) (ascii_accents_internal), tp/Texinfo/XS/main/unicode.c (unicode_accent, format_eight_bit_accents_stack) (format_unicode_accents_stack_internal, encoded_accents), tp/Texinfo/XS/main/utils.c (normalize_encoding_name): make some variables const to make sure that the accent formatting function do not modify their associated elements, texts or accent commands lists.
- Previous by thread:
branch master updated: * tp/Texinfo/XS/convert/convert_html.c (prepare_special_units) (set_root_commands_targets_node_files), tp/Texinfo/XS/main/build_perl_info.c (build_elements_list) (build_document), tp/Texinfo/XS/main/converter_types.h (DOCUMENT), tp/Texinfo/XS/main/document.c (register_document_nodes_list) (register_document_sections_list) (destroy_document_information_except_tree), tp/Texinfo/XS/structuring_transfo/StructuringTransfo.xs (sectioning_structure, nodes_tree), tp/Texinfo/XS/structuring_transfo/ [...]
- Next by thread:
branch master updated: * tp/Texinfo/XS/main/convert_to_text.c (ascii_accent) (ascii_accents_internal), tp/Texinfo/XS/main/unicode.c (unicode_accent, format_eight_bit_accents_stack) (format_unicode_accents_stack_internal, encoded_accents), tp/Texinfo/XS/main/utils.c (normalize_encoding_name): make some variables const to make sure that the accent formatting function do not modify their associated elements, texts or accent commands lists.
- Index(es):