texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/Convert/HTML.pm (import, _sort_index


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/Convert/HTML.pm (import, _sort_index_entries), tp/Texinfo/XS/convert/ConvertXS.xs (sort_sortable_index_entries_by_letter), tp/Texinfo/XS/convert/indices_in_conversion.c (sort_indices_by_letter): remove code related to sorting in C based on sortable entries from perl, as it is unfinished because it requires a collation function in C, and the passing of data from perl need to be redone, it would be better to restart from scratch.
Date: Sun, 05 Nov 2023 14:39:12 -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 2cfd903138 * tp/Texinfo/Convert/HTML.pm (import, _sort_index_entries), 
tp/Texinfo/XS/convert/ConvertXS.xs (sort_sortable_index_entries_by_letter), 
tp/Texinfo/XS/convert/indices_in_conversion.c (sort_indices_by_letter): remove 
code related to sorting in C based on sortable entries from perl, as it is 
unfinished because it requires a collation function in C, and the passing of 
data from perl need to be redone, it would be better to restart from scratch.
2cfd903138 is described below

commit 2cfd90313885b8a0c9785bc730fa68f224051f41
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Nov 5 20:39:04 2023 +0100

    * tp/Texinfo/Convert/HTML.pm (import, _sort_index_entries),
    tp/Texinfo/XS/convert/ConvertXS.xs
    (sort_sortable_index_entries_by_letter),
    tp/Texinfo/XS/convert/indices_in_conversion.c
    (sort_indices_by_letter): remove code related to sorting in C based on
    sortable entries from perl, as it is unfinished because it requires
    a collation function in C, and the passing of data from perl need to
    be redone, it would be better to restart from scratch.
---
 ChangeLog                                     |  11 +++
 tp/Texinfo/Convert/HTML.pm                    |  43 ---------
 tp/Texinfo/XS/convert/ConvertXS.xs            |  15 ---
 tp/Texinfo/XS/convert/indices_in_conversion.c | 128 --------------------------
 tp/Texinfo/XS/convert/indices_in_conversion.h |  18 ----
 5 files changed, 11 insertions(+), 204 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b031d5e694..87321961d1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2023-11-05  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Convert/HTML.pm (import, _sort_index_entries),
+       tp/Texinfo/XS/convert/ConvertXS.xs
+       (sort_sortable_index_entries_by_letter),
+       tp/Texinfo/XS/convert/indices_in_conversion.c
+       (sort_indices_by_letter): remove code related to sorting in C based on
+       sortable entries from perl, as it is unfinished because it requires
+       a collation function in C, and the passing of data from perl need to
+       be redone, it would be better to restart from scratch.
+
 2023-11-05  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Convert/Converter.pm (converter_options_for_output):
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 0d43e18bd9..11691aa253 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -120,9 +120,6 @@ sub import {
       "Texinfo::Convert::HTML::_pop_document_context",
       "Texinfo::Convert::ConvertXS::html_pop_document_context");
       Texinfo::XSLoader::override(
-      "Texinfo::Convert::HTML::_XS_sort_sortable_index_entries_by_letter",
-      "Texinfo::Convert::ConvertXS::sort_sortable_index_entries_by_letter");
-      Texinfo::XSLoader::override(
       "Texinfo::Convert::HTML::_XS_get_index_entries_sorted_by_letter",
       "Texinfo::Convert::ConvertXS::get_index_entries_sorted_by_letter");
       Texinfo::XSLoader::override(
@@ -9845,10 +9842,6 @@ sub _prepare_output_units_global_targets($$$$)
   }
 }
 
-sub _XS_sort_sortable_index_entries_by_letter($$)
-{
-}
-
 sub _XS_get_index_entries_sorted_by_letter($$)
 {
 }
@@ -9864,42 +9857,6 @@ sub _sort_index_entries($)
         = Texinfo::Structuring::merge_indices($indices_information);
     my $index_entries_sort_strings;
 
-    ## see TODO in convert/indices_in_conversion.c sort_indices_by_letter,
-    ## sorting letters requires a collation in C, so this cannot be done,
-    ## even when starting from index_sortable_index_entries
-    #if ($self->{'converter_descriptor'}) {
-    #  my ($index_sortable_index_entries, $collator, 
$index_entries_sort_strings)
-    #   = Texinfo::Structuring::setup_sortable_index_entries ($self, $self,
-    #                        $merged_index_entries, $indices_information, 1, 
1);
-    #  if ($index_sortable_index_entries) {
-    #    # encode and pass as arrays only, in reproducible order
-    #    my $index_encoded_sortable_entries = [];
-    #    foreach my $index_name (sort(keys(%$index_sortable_index_entries))) {
-    #      my $encoded_index_name = Encode::encode('UTF-8', $index_name);
-    #      my $encoded_sortable_entries = [];
-    #      foreach my $sortable_entry
-    #          (@{$index_sortable_index_entries->{$index_name}}) {
-    #        my $encoded_sortable_entry = {
-    #          'keys' => $sortable_entry->{'keys'},
-    #          'index_name'
-    #            => Encode::encode('UTF-8', $sortable_entry->{'index_name'}),
-    #          'number' => $sortable_entry->{'number'},
-    #          'entry_keys' => [],
-    #        };
-    #        foreach my $entry_key (@{$sortable_entry->{'entry_keys'}}) {
-    #          push @{$encoded_sortable_entry->{'entry_keys'}},
-    #            Encode::encode('UTF-8', $entry_key);
-    #        }
-    #        push @$encoded_sortable_entries, $encoded_sortable_entry;
-    #      }
-    #      push @{$index_encoded_sortable_entries},
-    #       [$encoded_index_name, $encoded_sortable_entries],
-    #    }
-    #    _XS_sort_sortable_index_entries_by_letter($self,
-    #                                $index_encoded_sortable_entries);
-    #  }
-    #}
-
     ($self->{'index_entries_by_letter'}, $index_entries_sort_strings)
             = Texinfo::Structuring::sort_indices_by_letter($self,
                                     $self, $merged_index_entries,
diff --git a/tp/Texinfo/XS/convert/ConvertXS.xs 
b/tp/Texinfo/XS/convert/ConvertXS.xs
index 246d321d25..6ac9cfd86d 100644
--- a/tp/Texinfo/XS/convert/ConvertXS.xs
+++ b/tp/Texinfo/XS/convert/ConvertXS.xs
@@ -210,21 +210,6 @@ html_pop_document_context (SV *converter_in)
            }
 
 
-# unfinished, see sort_indices_by_letter comment
-void
-sort_sortable_index_entries_by_letter (SV *converter_in, SV 
*sortable_entries_in)
-      PREINIT:
-         CONVERTER *self;
-         INDEX_SORTABLE_ENTRIES **sortable_entries = 0;
-         INDEX_SORTED_BY_LETTER **indices_sorted_by_letter = 0;
-      CODE:
-         /* add warn string? */
-         self = get_sv_converter (converter_in, 0);
-         sortable_entries = get_sv_sortable_entries (sortable_entries_in);
-         indices_sorted_by_letter = sort_indices_by_letter (self,
-                                                      sortable_entries);
-         self->index_entries_by_letter = indices_sorted_by_letter;
-
 void
 get_index_entries_sorted_by_letter (SV *converter_in, SV 
*index_entries_sorted_by_letter)
       PREINIT:
diff --git a/tp/Texinfo/XS/convert/indices_in_conversion.c 
b/tp/Texinfo/XS/convert/indices_in_conversion.c
index e5607961a1..6a3b49bcc9 100644
--- a/tp/Texinfo/XS/convert/indices_in_conversion.c
+++ b/tp/Texinfo/XS/convert/indices_in_conversion.c
@@ -114,131 +114,3 @@ index_content_element (ELEMENT *element, int 
prefer_reference_element)
    }
 }
 
-/* This is unfinished, because sorting letters requires a collation
-   in C.
-   converter would be used to find index entries based on index name and 
number */
-INDEX_SORTED_BY_LETTER **
-sort_indices_by_letter (CONVERTER *converter,
-                        INDEX_SORTABLE_ENTRIES **sortable_entries)
-{
-  INDEX_SORTED_BY_LETTER **result;
-  INDEX_SORTABLE_ENTRIES **i;
-  INDEX_SORTABLE_ENTRIES *ise;
-  int index_nr = 0;
-
-  if (!sortable_entries)
-    return 0;
-
-  for (i = sortable_entries; (ise = *i); i++)
-    index_nr++;
-
-   result = (INDEX_SORTED_BY_LETTER **)
-     malloc ((index_nr+1) * sizeof (INDEX_SORTED_BY_LETTER *));
-   result[index_nr] = 0;
-
-  for (i = sortable_entries; (ise = *i); i++)
-    {
-      int j;
-      LETTER_SORTABLE_ENTRIES_LIST *letter_sortable_entries_list
-       = (LETTER_SORTABLE_ENTRIES_LIST *)
-        malloc (sizeof (LETTER_SORTABLE_ENTRIES_LIST));
-      memset (letter_sortable_entries_list, 0,
-              sizeof (LETTER_SORTABLE_ENTRIES_LIST));
-      INDEX_SORTED_BY_LETTER *idx_sorted = (INDEX_SORTED_BY_LETTER *)
-         malloc (sizeof (INDEX_SORTED_BY_LETTER));
-      idx_sorted->name = strdup (ise->name);
-      for (j = 0; j < ise->number; j++)
-        {
-          SORTABLE_ENTRY *sortable_entry = &ise->sortable_entries[j];
-          if (sortable_entry->keys_number)
-            {
-              char *letter = 0;
-              int alpha = 0;
-              char *entry_key = sortable_entry->entry_keys[0];
-              char *uc_entry_key = to_upper_or_lower_multibyte (entry_key, 1);
-              char *normalized = normalize_NFKD (uc_entry_key);
-              uint32_t *encoded_u32;
-              free (uc_entry_key);
-              encoded_u32 = u32_strconv_from_encoding (normalized,
-                                           "UTF-8", iconveh_question_mark);
-              const uint32_t *next = encoded_u32;
-              while (1)
-                {
-                  ucs4_t first_char;
-                  next = u32_next (&first_char, next);
-                  if (!uc_is_general_category (first_char, UC_CATEGORY_Mn))
-                    {
-                      uint8_t *first_char_u8 = malloc (7 * sizeof(uint8_t));
-                      int first_char_len
-                          = u8_uctomb (first_char_u8, first_char, 6);
-                      if (first_char_len < 0)
-                        fatal ("u8_uctomb returns negative value");
-                      letter
-                        = u8_strconv_to_encoding (first_char_u8, "UTF-8",
-                                                  iconveh_question_mark);
-                      free (first_char_u8);
-                      if (uc_is_general_category (first_char, UC_CATEGORY_L))
-                        alpha = 1;
-                      break;
-                    }
-                  else if (next)
-                    continue;
-                  else
-                    break;
-                }
-              free (encoded_u32);
-              if (letter)
-                {
-                  int l;
-                  LETTER_SORTABLE_ENTRIES *letter_sortable_entries = 0;
-                  for (l = 0; l < letter_sortable_entries_list->number; l++)
-                    {
-                      LETTER_SORTABLE_ENTRIES *current
-                       = &letter_sortable_entries_list->list[l];
-                      if (!strcmp (letter, current->letter))
-                        {
-                          letter_sortable_entries = current;
-                          break;
-                        }
-                    }
-                  if (!letter_sortable_entries)
-                    {
-                      if (letter_sortable_entries_list->number
-                           == letter_sortable_entries_list->space)
-                        {
-                          letter_sortable_entries_list->list
-                           = realloc (letter_sortable_entries_list->list,
-                                      (letter_sortable_entries_list->space += 
5)
-                                      * sizeof (LETTER_SORTABLE_ENTRIES));
-                        }
-                      letter_sortable_entries
-                        = &letter_sortable_entries_list->list[
-                                            
letter_sortable_entries_list->number];
-                      letter_sortable_entries_list->number++;
-                      letter_sortable_entries->letter = strdup (letter);
-                      letter_sortable_entries->alpha = alpha;
-                      letter_sortable_entries->number = 0;
-                      letter_sortable_entries->space = 0;
-                      letter_sortable_entries->sortable_entries = 0;
-                    }
-
-                  if (letter_sortable_entries->number
-                      == letter_sortable_entries->space)
-                    {
-                      letter_sortable_entries->sortable_entries
-                       = realloc (letter_sortable_entries->sortable_entries,
-                                  (letter_sortable_entries->space += 5)
-                                  * sizeof (SORTABLE_ENTRY));
-                    }
-                  letter_sortable_entries->sortable_entries[
-                    letter_sortable_entries->number] = sortable_entry;
-                  letter_sortable_entries->number++;
-                }
-            }
-        }
-      /* TODO continue here, by sorting
-        letter_sortable_entries_list->list
-       */
-    }
-  return result;
-}
diff --git a/tp/Texinfo/XS/convert/indices_in_conversion.h 
b/tp/Texinfo/XS/convert/indices_in_conversion.h
index d37ec9c755..5b394f671a 100644
--- a/tp/Texinfo/XS/convert/indices_in_conversion.h
+++ b/tp/Texinfo/XS/convert/indices_in_conversion.h
@@ -5,27 +5,9 @@
 #include "tree_types.h"
 #include "indices_in_conversion.h"
 
-typedef struct LETTER_SORTABLE_ENTRIES {
-    char *letter;
-    int alpha;
-    size_t number;
-    size_t space;
-    SORTABLE_ENTRY **sortable_entries;
-} LETTER_SORTABLE_ENTRIES;
-
-typedef struct LETTER_SORTABLE_ENTRIES_LIST {
-    size_t number;
-    size_t space;
-    LETTER_SORTABLE_ENTRIES *list;
-} LETTER_SORTABLE_ENTRIES_LIST;
-
 MERGED_INDEX **merge_indices (INDEX **index_names);
 
 ELEMENT *index_content_element (ELEMENT *element,
                                 int prefer_reference_element);
 
-INDEX_SORTED_BY_LETTER **sort_indices_by_letter (CONVERTER *converter,
-                                   INDEX_SORTABLE_ENTRIES **sortable_entries);
-
-
 #endif



reply via email to

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