[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/XS/main/utils.c (store_value, clear_
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/XS/main/utils.c (store_value, clear_value), tp/Texinfo/XS/parsetexi/macro.c (store_value_parsed_document) (store_parser_value_parsed_document, clear_value_parsed_document) (clear_parser_value_parsed_document): move the part of store_value and clear_value strctly related to setting or clearing values in a values list to utils.c, adding a vluaes list argument to clear_value. Rename functions in macro.c that apply on parser and also set internal flags in parsed document to store_ [...] |
Date: |
Mon, 23 Dec 2024 18:40:21 -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 00f22028af * tp/Texinfo/XS/main/utils.c (store_value, clear_value),
tp/Texinfo/XS/parsetexi/macro.c (store_value_parsed_document)
(store_parser_value_parsed_document, clear_value_parsed_document)
(clear_parser_value_parsed_document): move the part of store_value and
clear_value strctly related to setting or clearing values in a values list to
utils.c, adding a vluaes list argument to clear_value. Rename functions in
macro.c that apply on parser and also set internal flags in pars [...]
00f22028af is described below
commit 00f22028af2f0fcc756431cfafeb5460e30143ac
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Dec 21 14:33:01 2024 +0100
* tp/Texinfo/XS/main/utils.c (store_value, clear_value),
tp/Texinfo/XS/parsetexi/macro.c (store_value_parsed_document)
(store_parser_value_parsed_document, clear_value_parsed_document)
(clear_parser_value_parsed_document): move the part of store_value
and clear_value strctly related to setting or clearing values in a
values list to utils.c, adding a vluaes list argument to clear_value.
Rename functions in macro.c that apply on parser and also set internal
flags in parsed document to store_value_parsed_document,
store_parser_value_parsed_document, clear_value_parsed_document and
add clear_parser_value_parsed_document. Update callers.
---
ChangeLog | 13 +++++++
tp/Texinfo/XS/main/utils.c | 49 ++++++++++++++++++++++++
tp/Texinfo/XS/main/utils.h | 2 +
tp/Texinfo/XS/parsetexi/api.c | 2 +-
tp/Texinfo/XS/parsetexi/conf.c | 1 -
tp/Texinfo/XS/parsetexi/handle_commands.c | 6 +--
tp/Texinfo/XS/parsetexi/macro.c | 62 ++++++++-----------------------
tp/Texinfo/XS/parsetexi/macro.h | 7 ++--
8 files changed, 88 insertions(+), 54 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 91bc7ce95b..e304b21548 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2024-12-21 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/main/utils.c (store_value, clear_value),
+ tp/Texinfo/XS/parsetexi/macro.c (store_value_parsed_document)
+ (store_parser_value_parsed_document, clear_value_parsed_document)
+ (clear_parser_value_parsed_document): move the part of store_value
+ and clear_value strctly related to setting or clearing values in a
+ values list to utils.c, adding a vluaes list argument to clear_value.
+ Rename functions in macro.c that apply on parser and also set internal
+ flags in parsed document to store_value_parsed_document,
+ store_parser_value_parsed_document, clear_value_parsed_document and
+ add clear_parser_value_parsed_document. Update callers.
+
2024-12-21 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/XS/teximakehtml.c (long_options, main): add command line
diff --git a/tp/Texinfo/XS/main/utils.c b/tp/Texinfo/XS/main/utils.c
index ef217f0047..d7e72c99f9 100644
--- a/tp/Texinfo/XS/main/utils.c
+++ b/tp/Texinfo/XS/main/utils.c
@@ -1232,6 +1232,55 @@ locate_file_in_dirs (const char *filename,
/* code related to values used in files not in parsetexi */
+void
+store_value (VALUE_LIST *values, const char *name, const char *value)
+{
+ size_t i;
+ VALUE *v = 0;
+ int len;
+
+ len = strlen (name);
+
+ /* Check if already defined. */
+ for (i = 0; i < values->number; i++)
+ {
+ if (!strncmp (values->list[i].name, name, len)
+ && !values->list[i].name[len])
+ {
+ v = &values->list[i];
+ free (v->name); free (v->value);
+ break;
+ }
+ }
+
+ if (!v)
+ {
+ if (values->number == values->space)
+ {
+ values->list = realloc (values->list,
+ (values->space += 5) * sizeof (VALUE));
+ }
+ v = &values->list[values->number++];
+ }
+
+ v->name = strdup (name);
+ v->value = strdup (value);
+}
+
+void
+clear_value (VALUE_LIST *values, const char *name)
+{
+ size_t i;
+ for (i = 0; i < values->number; i++)
+ {
+ if (!strcmp (values->list[i].name, name))
+ {
+ values->list[i].name[0] = '\0';
+ values->list[i].value[0] = '\0';
+ }
+ }
+}
+
void
wipe_values (VALUE_LIST *values)
{
diff --git a/tp/Texinfo/XS/main/utils.h b/tp/Texinfo/XS/main/utils.h
index 8b7b997af9..0a48857e66 100644
--- a/tp/Texinfo/XS/main/utils.h
+++ b/tp/Texinfo/XS/main/utils.h
@@ -122,6 +122,8 @@ int word_bytes_len_multibyte (const char *text);
void messages_and_encodings_setup (void);
+void store_value (VALUE_LIST *values, const char *name, const char *value);
+void clear_value (VALUE_LIST *values, const char *name);
void wipe_values (VALUE_LIST *values);
void delete_global_info (GLOBAL_INFO *global_info_ref);
diff --git a/tp/Texinfo/XS/parsetexi/api.c b/tp/Texinfo/XS/parsetexi/api.c
index 4f27d137be..0e219cd20a 100644
--- a/tp/Texinfo/XS/parsetexi/api.c
+++ b/tp/Texinfo/XS/parsetexi/api.c
@@ -224,6 +224,6 @@ parser_conf_reset_values (void)
void
parser_conf_add_value (const char *name, const char *value)
{
- store_value (&global_parser_conf.values, name, value);
+ store_value_parsed_document (&global_parser_conf.values, name, value);
}
diff --git a/tp/Texinfo/XS/parsetexi/conf.c b/tp/Texinfo/XS/parsetexi/conf.c
index 1f4369190b..6757ffde3d 100644
--- a/tp/Texinfo/XS/parsetexi/conf.c
+++ b/tp/Texinfo/XS/parsetexi/conf.c
@@ -19,7 +19,6 @@
#include "utils.h"
#include "parser_conf.h"
-#include "macro.h"
#include "conf.h"
void
diff --git a/tp/Texinfo/XS/parsetexi/handle_commands.c
b/tp/Texinfo/XS/parsetexi/handle_commands.c
index 7ee27dd621..2eb4938f8c 100644
--- a/tp/Texinfo/XS/parsetexi/handle_commands.c
+++ b/tp/Texinfo/XS/parsetexi/handle_commands.c
@@ -236,8 +236,8 @@ parse_rawline_command (const char *line, enum command_id
cmd,
else
ADD_ARG("", 0);
- store_parser_value (args->list[0]->e.text->text,
- args->list[1]->e.text->text);
+ store_parser_value_parsed_document (args->list[0]->e.text->text,
+ args->list[1]->e.text->text);
break;
set_no_name:
@@ -266,7 +266,7 @@ parse_rawline_command (const char *line, enum command_id
cmd,
ADD_ARG (p, flag_len);
flag = strndup (p, flag_len);
- clear_value (flag);
+ clear_parser_value_parsed_document (flag);
free (flag);
break;
diff --git a/tp/Texinfo/XS/parsetexi/macro.c b/tp/Texinfo/XS/parsetexi/macro.c
index 3de00fdf0b..409f117c52 100644
--- a/tp/Texinfo/XS/parsetexi/macro.c
+++ b/tp/Texinfo/XS/parsetexi/macro.c
@@ -28,7 +28,7 @@
#include "base_utils.h"
#include "tree.h"
#include "extra.h"
-/* for whitespace_chars wipe_values */
+/* for whitespace_chars store_value clear_value wipe_values */
#include "utils.h"
#include "convert_to_texinfo.h"
/* for global_parser_conf */
@@ -1003,38 +1003,10 @@ init_values (void)
}
void
-store_value (VALUE_LIST *values, const char *name, const char *value)
+store_value_parsed_document (VALUE_LIST *values, const char *name,
+ const char *value)
{
- size_t i;
- VALUE *v = 0;
- int len;
-
- len = strlen (name);
-
- /* Check if already defined. */
- for (i = 0; i < values->number; i++)
- {
- if (!strncmp (values->list[i].name, name, len)
- && !values->list[i].name[len])
- {
- v = &values->list[i];
- free (v->name); free (v->value);
- break;
- }
- }
-
- if (!v)
- {
- if (values->number == values->space)
- {
- values->list = realloc (values->list,
- (values->space += 5) * sizeof (VALUE));
- }
- v = &values->list[values->number++];
- }
-
- v->name = strdup (name);
- v->value = strdup (value);
+ store_value (values, name, value);
/* Internal Texinfo flag */
if (!strncmp (name, "txi", 3) && parsed_document)
@@ -1057,24 +1029,16 @@ store_value (VALUE_LIST *values, const char *name,
const char *value)
}
void
-store_parser_value (const char *name, const char *value)
+store_parser_value_parsed_document (const char *name, const char *value)
{
- store_value (&parser_values, name, value);
+ store_value_parsed_document (&parser_values, name, value);
}
-void
-clear_value (const char *name)
+static void
+clear_value_parsed_document (VALUE_LIST *values, const char *name)
{
- size_t i;
- VALUE_LIST *values = &parser_values;
- for (i = 0; i < values->number; i++)
- {
- if (!strcmp (values->list[i].name, name))
- {
- values->list[i].name[0] = '\0';
- values->list[i].value[0] = '\0';
- }
- }
+ clear_value (values, name);
+
/* Internal Texinfo flag */
if (!strncmp (name, "txi", 3))
{
@@ -1094,6 +1058,12 @@ clear_value (const char *name)
}
}
+void
+clear_parser_value_parsed_document (const char *name)
+{
+ clear_value_parsed_document (&parser_values, name);
+}
+
char *
fetch_value (const char *name)
{
diff --git a/tp/Texinfo/XS/parsetexi/macro.h b/tp/Texinfo/XS/parsetexi/macro.h
index f0804daa53..3330724e07 100644
--- a/tp/Texinfo/XS/parsetexi/macro.h
+++ b/tp/Texinfo/XS/parsetexi/macro.h
@@ -43,11 +43,12 @@ void unset_macro_record (MACRO *m);
MACRO *lookup_macro (enum command_id cmd);
void wipe_macros (void);
-void store_value (VALUE_LIST *values, const char *name, const char *value);
+void store_value_parsed_document (VALUE_LIST *values, const char *name,
+ const char *value);
char *fetch_value (const char *name);
-void clear_value (const char *name);
+void clear_parser_value_parsed_document (const char *name);
+void store_parser_value_parsed_document (const char *name, const char *value);
void init_values (void);
-void store_parser_value (const char *name, const char *value);
INFO_ENCLOSE *lookup_infoenclose (enum command_id cmd);
void add_infoenclose (enum command_id cmd, const char *begin, const char *end);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/XS/main/utils.c (store_value, clear_value), tp/Texinfo/XS/parsetexi/macro.c (store_value_parsed_document) (store_parser_value_parsed_document, clear_value_parsed_document) (clear_parser_value_parsed_document): move the part of store_value and clear_value strctly related to setting or clearing values in a values list to utils.c, adding a vluaes list argument to clear_value. Rename functions in macro.c that apply on parser and also set internal flags in parsed document to store_ [...],
Patrice Dumas <=