[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Gavin D. Smith |
Date: |
Mon, 21 Oct 2024 11:35:18 -0400 (EDT) |
branch: master
commit c11674aba4ccd759fd9609a7c715b9207cb28ff4
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Mon Oct 21 16:34:58 2024 +0100
Remove Perl and string list implementations for "registered ids"
* tp/Texinfo/XS/main/converter_types.h (CONVERTER): remove
fields ids_data_type, registered_ids, registered_ids_hv.
(enum ids_data_type): Remove.
* tp/Texinfo/XS/convert/converter.c (new_converter)
(converter_converter): Flags argument removed. Callers updated.
* tp/Texinfo/XS/convert/call_html_perl_function.c,
* tp/Texinfo/XS/convert/replace_perl_call_html_function.c
(init_registered_ids_hv, is_hv_registered_id, hv_register_id)
(clear_registered_ids_hv, free_registered_ids_hv): Remove.
* tp/Texinfo/XS/convert/html_prepare_converter.c
(html_prepare_conversion_units_targets, html_register_id)
(html_id_is_registered),
* tp/Texinfo/XS/convert/html_converter_finish.c
(html_reset_converter, html_free_converter):
Unconditionally use C hashmap implementation.
---
ChangeLog | 23 +++++++++++
tp/Texinfo/XS/convert/call_html_perl_function.c | 46 ----------------------
tp/Texinfo/XS/convert/call_html_perl_function.h | 7 ----
tp/Texinfo/XS/convert/convert_html.h | 3 +-
tp/Texinfo/XS/convert/converter.c | 26 ++----------
tp/Texinfo/XS/convert/converter.h | 5 +--
tp/Texinfo/XS/convert/get_converter_perl_info.c | 6 +--
tp/Texinfo/XS/convert/html_converter_finish.c | 19 +--------
tp/Texinfo/XS/convert/html_prepare_converter.c | 25 ++----------
.../XS/convert/replace_perl_call_html_function.c | 37 -----------------
tp/Texinfo/XS/convert/texinfo.c | 5 +--
tp/Texinfo/XS/convert/texinfo.h | 3 +-
tp/Texinfo/XS/main/converter_types.h | 15 -------
tp/Texinfo/XS/teximakehtml.c | 6 +--
14 files changed, 41 insertions(+), 185 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index ba36675336..e5eaced142 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,26 @@
+2024-10-21 Gavin Smith <gavinsmith0123@gmail.com>
+
+ Remove Perl and string list implementations for "registered ids"
+
+ * tp/Texinfo/XS/main/converter_types.h (CONVERTER): remove
+ fields ids_data_type, registered_ids, registered_ids_hv.
+ (enum ids_data_type): Remove.
+
+ * tp/Texinfo/XS/convert/converter.c (new_converter)
+ (converter_converter): Flags argument removed. Callers updated.
+
+ * tp/Texinfo/XS/convert/call_html_perl_function.c,
+ * tp/Texinfo/XS/convert/replace_perl_call_html_function.c
+ (init_registered_ids_hv, is_hv_registered_id, hv_register_id)
+ (clear_registered_ids_hv, free_registered_ids_hv): Remove.
+
+ * tp/Texinfo/XS/convert/html_prepare_converter.c
+ (html_prepare_conversion_units_targets, html_register_id)
+ (html_id_is_registered),
+ * tp/Texinfo/XS/convert/html_converter_finish.c
+ (html_reset_converter, html_free_converter):
+ Unconditionally use C hashmap implementation.
+
2024-10-21 Gavin Smith <gavinsmith0123@gmail.com>
* tp/Texinfo/XS/main/converter_types.h (CONVERTER) [HAVE_CXX_HASHMAP]:
diff --git a/tp/Texinfo/XS/convert/call_html_perl_function.c
b/tp/Texinfo/XS/convert/call_html_perl_function.c
index dfa32a5e4c..41634d615d 100644
--- a/tp/Texinfo/XS/convert/call_html_perl_function.c
+++ b/tp/Texinfo/XS/convert/call_html_perl_function.c
@@ -2401,49 +2401,3 @@ call_stage_handler (CONVERTER *self, void
*stage_handler_sv,
return status;
}
-
-
-/* Interface with Perl hash map for registered ids */
-
-void
-init_registered_ids_hv (CONVERTER *self)
-{
- dTHX;
-
- self->registered_ids_hv = newHV ();
-}
-
-int
-is_hv_registered_id (CONVERTER *self, const char *string)
-{
- dTHX;
-
- return hv_exists (self->registered_ids_hv, string, strlen (string));
-}
-
-void
-hv_register_id (CONVERTER *self, const char *string)
-{
- dTHX;
-
- hv_store (self->registered_ids_hv, string, strlen (string),
- newSViv (1), 0);
-}
-
-void
-clear_registered_ids_hv (CONVERTER *self)
-{
- dTHX;
-
- if (self->registered_ids_hv)
- hv_clear (self->registered_ids_hv);
-}
-
-void
-free_registered_ids_hv (CONVERTER *self)
-{
- dTHX;
-
- if (self->registered_ids_hv)
- hv_undef (self->registered_ids_hv);
-}
diff --git a/tp/Texinfo/XS/convert/call_html_perl_function.h
b/tp/Texinfo/XS/convert/call_html_perl_function.h
index d7552cd6f6..548e65403a 100644
--- a/tp/Texinfo/XS/convert/call_html_perl_function.h
+++ b/tp/Texinfo/XS/convert/call_html_perl_function.h
@@ -151,11 +151,4 @@ int call_stage_handler (CONVERTER *self, void
*stage_handler_sv,
char *call_latex_convert_to_latex_math (CONVERTER *self,
const ELEMENT *element);
-/* Interface with Perl hash map for registered ids */
-void init_registered_ids_hv (CONVERTER *self);
-int is_hv_registered_id (CONVERTER *self, const char *string);
-void hv_register_id (CONVERTER *self, const char *string);
-void clear_registered_ids_hv (CONVERTER *self);
-void free_registered_ids_hv (CONVERTER *self);
-
#endif
diff --git a/tp/Texinfo/XS/convert/convert_html.h
b/tp/Texinfo/XS/convert/convert_html.h
index 4dd73e3993..718e784912 100644
--- a/tp/Texinfo/XS/convert/convert_html.h
+++ b/tp/Texinfo/XS/convert/convert_html.h
@@ -21,7 +21,8 @@
#include "tree_types.h"
#include "converter_types.h"
#include "html_converter_types.h"
-
+/* for NAMED_STRING_ELEMENT_LIST */
+#include "translations.h"
/* NOTE the intermediate level functions are declared in
html_conversion_api.h */
diff --git a/tp/Texinfo/XS/convert/converter.c
b/tp/Texinfo/XS/convert/converter.c
index fd29d299e6..e2a690a28a 100644
--- a/tp/Texinfo/XS/convert/converter.c
+++ b/tp/Texinfo/XS/convert/converter.c
@@ -249,10 +249,8 @@ init_generic_converter (CONVERTER *self)
}
/* descriptor starts at 1, 0 is not found or an error */
-/* flags set low-level implementation choices, currently hash map
- implementation */
size_t
-new_converter (enum converter_format format, unsigned long flags)
+new_converter (enum converter_format format)
{
size_t converter_index;
int slot_found = 0;
@@ -284,14 +282,6 @@ new_converter (enum converter_format format, unsigned long
flags)
converter->format = format;
- /* set low level data representations options */
- if (flags & CONVF_string_list)
- converter->ids_data_type = IDT_string_list;
- else if (flags & CONVF_perl_hashmap)
- converter->ids_data_type = IDT_perl_hashmap;
- else /* default */
- converter->ids_data_type = IDT_hashmap;
-
init_generic_converter (converter);
converter_list[converter_index] = converter;
@@ -456,22 +446,12 @@ converter_initialize (CONVERTER *converter)
/* only called from C, not from Perl */
CONVERTER *
converter_converter (enum converter_format format,
- const CONVERTER_INITIALIZATION_INFO *input_user_conf,
- unsigned long converter_flags)
+ const CONVERTER_INITIALIZATION_INFO *input_user_conf)
{
CONVERTER_INITIALIZATION_INFO *format_defaults;
unsigned long flags;
- if (!converter_flags)
- flags = CONVF_hashmap;
- /*
- To use a string list. Slower.
- flags = CONVF_string_list;
- */
- else
- flags = converter_flags;
-
- size_t converter_descriptor = new_converter (format, flags);
+ size_t converter_descriptor = new_converter (format);
CONVERTER *converter = retrieve_converter (converter_descriptor);
CONVERTER_INITIALIZATION_INFO *user_conf
diff --git a/tp/Texinfo/XS/convert/converter.h
b/tp/Texinfo/XS/convert/converter.h
index 797a2c444a..e78c11a127 100644
--- a/tp/Texinfo/XS/convert/converter.h
+++ b/tp/Texinfo/XS/convert/converter.h
@@ -135,7 +135,7 @@ enum converter_format
find_perl_converter_class_converter_format (
const char *class_name);
CONVERTER *retrieve_converter (size_t converter_descriptor);
-size_t new_converter (enum converter_format format, unsigned long flags);
+size_t new_converter (enum converter_format format);
void set_converter_init_information (CONVERTER *converter,
CONVERTER_INITIALIZATION_INFO *format_defaults,
@@ -145,8 +145,7 @@ CONVERTER_INITIALIZATION_INFO *converter_defaults (
enum converter_format converter_format,
CONVERTER_INITIALIZATION_INFO *user_conf);
CONVERTER *converter_converter (enum converter_format format,
- const CONVERTER_INITIALIZATION_INFO *input_user_conf,
- unsigned long converter_flags);
+ const CONVERTER_INITIALIZATION_INFO *input_user_conf);
CONVERTER_INITIALIZATION_INFO *new_converter_initialization_info (void);
void destroy_converter_initialization_info (
diff --git a/tp/Texinfo/XS/convert/get_converter_perl_info.c
b/tp/Texinfo/XS/convert/get_converter_perl_info.c
index 54f6ddc537..46f1df41d0 100644
--- a/tp/Texinfo/XS/convert/get_converter_perl_info.c
+++ b/tp/Texinfo/XS/convert/get_converter_perl_info.c
@@ -104,11 +104,7 @@ get_or_create_sv_converter (SV *converter_in, const char
*input_class)
= find_perl_converter_class_converter_format (class_name);
}
- converter_descriptor = new_converter (converter_format,
- CONVF_hashmap);
- /*
- CONVF_string_list);
- */
+ converter_descriptor = new_converter (converter_format);
converter = retrieve_converter (converter_descriptor);
}
return converter;
diff --git a/tp/Texinfo/XS/convert/html_converter_finish.c
b/tp/Texinfo/XS/convert/html_converter_finish.c
index 9352abbe42..8509ef09d7 100644
--- a/tp/Texinfo/XS/convert/html_converter_finish.c
+++ b/tp/Texinfo/XS/convert/html_converter_finish.c
@@ -29,7 +29,6 @@
#include "convert_utils.h"
#include "converter.h"
#include "api_to_perl.h"
-#include "call_html_perl_function.h"
#include "hashmap.h"
/* html_reset_translated_special_unit_info_tree
html_clear_direction_string_type */
@@ -159,12 +158,7 @@ html_reset_converter (CONVERTER *self)
/* targets */
reset_html_targets (self, self->html_targets);
- if (self->ids_data_type == IDT_perl_hashmap)
- clear_registered_ids_hv (self);
- else if (self->ids_data_type == IDT_hashmap)
- clear_registered_ids_c_hashmap (self);
- else if (self->registered_ids)
- clear_strings_list (self->registered_ids);
+ clear_registered_ids_c_hashmap (self);
for (i = 0; i < ST_footnote_location+1; i++)
{
@@ -338,16 +332,7 @@ html_free_converter (CONVERTER *self)
free (self->html_target_cmds.stack);
- if (self->ids_data_type == IDT_perl_hashmap)
- free_registered_ids_hv (self);
- else if (self->ids_data_type == IDT_hashmap)
- free_registered_ids_c_hashmap (self);
- else
- {
- if (self->registered_ids)
- destroy_strings_list (self->registered_ids);
- self->registered_ids = 0;
- }
+ free_registered_ids_c_hashmap (self);
if (self->pl_info_hv)
{
diff --git a/tp/Texinfo/XS/convert/html_prepare_converter.c
b/tp/Texinfo/XS/convert/html_prepare_converter.c
index 28eb7e2a6e..c1a809bbfd 100644
--- a/tp/Texinfo/XS/convert/html_prepare_converter.c
+++ b/tp/Texinfo/XS/convert/html_prepare_converter.c
@@ -3757,23 +3757,13 @@ html_prepare_conversion_units (CONVERTER *self)
int
html_id_is_registered (CONVERTER *self, const char *string)
{
- if (self->ids_data_type == IDT_perl_hashmap)
- return is_hv_registered_id (self, string);
- else if (self->ids_data_type == IDT_hashmap)
- return is_c_hashmap_registered_id (self, string);
- else
- return find_string (self->registered_ids, string);
+ return is_c_hashmap_registered_id (self, string);
}
void
html_register_id (CONVERTER *self, const char *string)
{
- if (self->ids_data_type == IDT_perl_hashmap)
- hv_register_id (self, string);
- else if (self->ids_data_type == IDT_hashmap)
- c_hashmap_register_id (self, string);
- else
- add_string (string, self->registered_ids);
+ c_hashmap_register_id (self, string);
}
/* used for diverse elements: tree units, indices, footnotes, special
@@ -4566,15 +4556,8 @@ void
html_prepare_conversion_units_targets (CONVERTER *self,
const char *document_name)
{
- if (self->ids_data_type == IDT_perl_hashmap)
- init_registered_ids_hv (self);
- else if (self->ids_data_type == IDT_hashmap)
- {
- size_t predicted_values = ids_hashmap_predicted_values (self);
- init_registered_ids_c_hashmap (self, predicted_values);
- }
- else
- self->registered_ids = new_string_list ();
+ size_t predicted_values = ids_hashmap_predicted_values (self);
+ init_registered_ids_c_hashmap (self, predicted_values);
/*
Do that before the other elements, to be sure that special page ids
diff --git a/tp/Texinfo/XS/convert/replace_perl_call_html_function.c
b/tp/Texinfo/XS/convert/replace_perl_call_html_function.c
index 325cb07c16..1a51d1db08 100644
--- a/tp/Texinfo/XS/convert/replace_perl_call_html_function.c
+++ b/tp/Texinfo/XS/convert/replace_perl_call_html_function.c
@@ -336,40 +336,3 @@ call_stage_handler(CONVERTER *self, void *stage_handler_sv,
return 0;
}
-
-
-/* Interface without Perl hash map for registered ids */
-void
-init_registered_ids_hv (CONVERTER *self)
-{
- self->registered_ids = new_string_list ();
-}
-
-int
-is_hv_registered_id (CONVERTER *self, const char *string)
-{
- return find_string (self->registered_ids, string);
-}
-
-
-void
-hv_register_id (CONVERTER *self, const char *string)
-{
- add_string (string, self->registered_ids);
-}
-
-void
-clear_registered_ids_hv (CONVERTER *self)
-{
- if (self->registered_ids)
- clear_strings_list (self->registered_ids);
-}
-
-void
-free_registered_ids_hv (CONVERTER *self)
-{
- if (self->registered_ids)
- destroy_strings_list (self->registered_ids);
- self->registered_ids = 0;
-}
-
diff --git a/tp/Texinfo/XS/convert/texinfo.c b/tp/Texinfo/XS/convert/texinfo.c
index a6435e1889..5d29cb4234 100644
--- a/tp/Texinfo/XS/convert/texinfo.c
+++ b/tp/Texinfo/XS/convert/texinfo.c
@@ -345,8 +345,7 @@ txi_converter_setup (const char *format_str,
const char *locale_encoding,
const char *program_file,
const STRING_LIST *texinfo_language_config_dirs,
- OPTIONS_LIST *customizations,
- unsigned long converter_flags)
+ OPTIONS_LIST *customizations)
{
enum converter_format converter_format
= find_format_name_converter_format (format_str);
@@ -412,7 +411,7 @@ txi_converter_setup (const char *format_str,
copy_options_list (&conf->conf, customizations);
}
- self = converter_converter (converter_format, conf, converter_flags);
+ self = converter_converter (converter_format, conf);
destroy_converter_initialization_info (conf);
return self;
diff --git a/tp/Texinfo/XS/convert/texinfo.h b/tp/Texinfo/XS/convert/texinfo.h
index 52dc65dd69..dc7b9dbcd6 100644
--- a/tp/Texinfo/XS/convert/texinfo.h
+++ b/tp/Texinfo/XS/convert/texinfo.h
@@ -47,8 +47,7 @@ CONVERTER *txi_converter_setup (const char *converter_format,
const char *locale_encoding,
const char *program_file,
const STRING_LIST *texinfo_language_config_dirs,
- OPTIONS_LIST *customizations,
- unsigned long converter_flags);
+ OPTIONS_LIST *customizations);
char *txi_converter_output (CONVERTER *converter, DOCUMENT *document);
char *txi_converter_convert (CONVERTER *converter, DOCUMENT *document);
diff --git a/tp/Texinfo/XS/main/converter_types.h
b/tp/Texinfo/XS/main/converter_types.h
index c9ca701033..290f491557 100644
--- a/tp/Texinfo/XS/main/converter_types.h
+++ b/tp/Texinfo/XS/main/converter_types.h
@@ -38,17 +38,6 @@ enum converter_format {
COF_html,
};
-enum ids_data_type {
- IDT_perl_hashmap,
- IDT_string_list,
- IDT_hashmap,
-};
-
-/* converter low level customization */
-#define CONVF_perl_hashmap 0x0001
-#define CONVF_string_list 0x0002
-#define CONVF_hashmap 0x0004
-
/* for string information passing to/from perl */
enum sv_string_type {
svt_byte,
@@ -815,7 +804,6 @@ typedef struct CONVERTER {
/* HTML specific */
/* set for a converter */
- enum ids_data_type ids_data_type;
int external_references_number; /* total number of external references
that could be called */
int code_types[TXI_TREE_TYPES_NUMBER];
@@ -883,9 +871,6 @@ typedef struct CONVERTER {
SPECIAL_UNIT_DIRECTION_LIST global_units_direction_name;
ELEMENT **special_unit_info_tree[SUIT_type_heading+1];
SORTED_INDEX_NAMES sorted_index_names;
- STRING_LIST *registered_ids;
- /* actually HV * but we do not want to drag in Perl headers */
- void *registered_ids_hv;
void *registered_ids_c_hashmap;
/* potentially one target list per command (only for some actually) */
HTML_TARGET_LIST html_targets[BUILTIN_CMD_NUMBER];
diff --git a/tp/Texinfo/XS/teximakehtml.c b/tp/Texinfo/XS/teximakehtml.c
index a886518ec7..9f55133958 100644
--- a/tp/Texinfo/XS/teximakehtml.c
+++ b/tp/Texinfo/XS/teximakehtml.c
@@ -323,11 +323,7 @@ main (int argc, char *argv[])
converter = txi_converter_setup ("html", "html", locale_encoding,
program_file,
&converter_texinfo_language_config_dirs,
- &convert_options,
- CONVF_hashmap);
- /* to test linear search
- CONVF_string_list);
- */
+ &convert_options);
free_strings_list (&converter_texinfo_language_config_dirs);
free_strings_list (&texinfo_language_config_dirs);
- Prev by Date:
master updated (0e4799d6e3 -> c11674aba4)
- Next by Date:
branch master updated: * tp/maintain/generate_code_convert_data.pl, tp/Makefile.am (dist_modules_DATA, Texinfo/HTMLData.pm, MAINTAINERCLEANFILES), tp/Texinfo/XS/Makefile.am (C_libtexinfo_sources, EXTRA_DIST) (BUILT_SOURCES, main/html_conversion_data.c, MAINTAINERCLEANFILES): rename Texinfo/Data.pm as Texinfo/HTMLData.pm and main/conversion_data.c as main/html_conversion_data.c. Report from Gavin.
- Previous by thread:
[no subject]
- Next by thread:
branch master updated: * tp/maintain/generate_code_convert_data.pl, tp/Makefile.am (dist_modules_DATA, Texinfo/HTMLData.pm, MAINTAINERCLEANFILES), tp/Texinfo/XS/Makefile.am (C_libtexinfo_sources, EXTRA_DIST) (BUILT_SOURCES, main/html_conversion_data.c, MAINTAINERCLEANFILES): rename Texinfo/Data.pm as Texinfo/HTMLData.pm and main/conversion_data.c as main/html_conversion_data.c. Report from Gavin.
- Index(es):