texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]


From: Gavin D. Smith
Date: Fri, 18 Oct 2024 10:55:20 -0400 (EDT)

branch: master
commit eb19724bd88aff30cac0d41fe29dc8550bd5cc34
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Fri Oct 18 14:39:45 2024 +0100

    Function to estimate number of "targets" for a manual
    
    * tp/Texinfo/XS/convert/html_prepare_converter.c
    (ids_hashmap_predicted_values): New function.
---
 ChangeLog                                      |  7 +++++
 tp/Texinfo/XS/convert/html_prepare_converter.c | 40 ++++++++++++++++++++++++++
 2 files changed, 47 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 6788c55be5..7c3672824c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2024-10-18  Patrice Dumas  <pertusus@free.fr>
+
+       Function to estimate number of "targets" for a manual
+
+       * tp/Texinfo/XS/convert/html_prepare_converter.c
+       (ids_hashmap_predicted_values): New function.
+
 2024-10-18  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Translations.pm (translate_string),
diff --git a/tp/Texinfo/XS/convert/html_prepare_converter.c 
b/tp/Texinfo/XS/convert/html_prepare_converter.c
index 3d786e1c1f..3faa81de6c 100644
--- a/tp/Texinfo/XS/convert/html_prepare_converter.c
+++ b/tp/Texinfo/XS/convert/html_prepare_converter.c
@@ -4531,6 +4531,46 @@ sort_cmd_targets (CONVERTER *self)
     }
 }
 
+/* return the approximate number of targets for that manual */
+static size_t
+ids_hashmap_predicted_values (CONVERTER *self)
+{
+  size_t sectioning_commands_nr = 0;
+  size_t index_entries_nr = 0;
+  size_t heading_commands_nr = 0;
+  size_t i;
+
+  OUTPUT_UNIT_LIST *special_units = retrieve_output_units
+    (self->document, self->output_units_descriptors[OUDT_special_units]);
+  OUTPUT_UNIT_LIST *associated_special_units = retrieve_output_units
+   (self->document,
+    self->output_units_descriptors[OUDT_associated_special_units]);
+
+  if (self->document->sections_list)
+    sectioning_commands_nr = self->document->sections_list->number;
+
+  if (self->document->indices_info.number > 0)
+    {
+      size_t i;
+      for (i = 0; i < self->sorted_index_names.number; i++)
+        index_entries_nr += self->sorted_index_names.list[i]->entries_number;
+    }
+
+  for (i = 0; heading_commands_list[i]; i++)
+    {
+      enum command_id cmd = heading_commands_list[i];
+      const ELEMENT_LIST *global_command
+        = get_cmd_global_multi_command (&self->document->global_commands, cmd);
+      heading_commands_nr += global_command->number;
+    }
+
+  return special_units->number + associated_special_units->number
+   + self->document->identifiers_target.number
+   + 3 * sectioning_commands_nr
+   + index_entries_nr
+   + self->document->global_commands.footnotes.number * 2;
+}
+
 /* indirectly calls all the functions calling customization function
    requiring elements and output units except for external nodes formatting */
 /* for conversion units except for associated special units that require



reply via email to

[Prev in Thread] Current Thread [Next in Thread]