blob: b06cb9e996c9a0e4572ffd3f74ea787d3c27dfeb [file]
/* manipulate_indices.h - definitions for manipulate_indices.c */
#ifndef MANIPULATE_INDICES_H
#define MANIPULATE_INDICES_H
#include "tree_types.h"
#include "document_types.h"
#include "options_data.h"
/* for TEXT_OPTIONS
#include "convert_to_text.h"
*/
/* avoid a dependency on convert_to_text.h */
struct TEXT_OPTIONS;
typedef struct SORTABLE_INDEX_SUBENTRY {
char *sort_string;
BYTES_STRING *sort_key;
int alpha;
} SORTABLE_INDEX_SUBENTRY;
typedef struct SORTABLE_INDEX_ENTRY {
INDEX_ENTRY *entry;
/* in perl 'index_name' => $index_entry->{'index_name'} */
/* in perl 'number' => $index_entry->{'entry_number'} */
size_t subentries_number;
/* both entry_keys and keys in perl */
SORTABLE_INDEX_SUBENTRY *sortable_subentries;
} SORTABLE_INDEX_ENTRY;
typedef struct INDEX_SORTABLE_ENTRIES {
MERGED_INDEX *index;
size_t number;
SORTABLE_INDEX_ENTRY *sortable_entries;
} INDEX_SORTABLE_ENTRIES;
typedef struct INDICES_SORTABLE_ENTRIES {
size_t number;
INDEX_SORTABLE_ENTRIES *indices;
} INDICES_SORTABLE_ENTRIES;
MERGED_INDICES *merge_indices (INDEX_LIST *indices_information);
void destroy_merged_indices (MERGED_INDICES *merged_indices);
void destroy_indices_sorted_by_index (
INDEX_SORTED_BY_INDEX *indices_entries_by_index);
void destroy_indices_sorted_by_letter (
INDEX_SORTED_BY_LETTER *indices_entries_by_letter);
ELEMENT *get_index_content_info_element (const ELEMENT *element,
int prefer_reference_element,
enum command_id *def_command_out,
ELEMENT **name_copy_out,
ELEMENT **class_copy_out);
ELEMENT *document_index_content_element (const ELEMENT *element,
int prefer_reference_element,
DOCUMENT *document, int debug_level);
char *strip_index_ignore_chars (const char *string,
const char *index_ignore_chars);
char *index_entry_element_sort_string (const INDEX_ENTRY *main_entry,
const ELEMENT *index_entry_element,
struct TEXT_OPTIONS *options, int in_code,
int prefer_reference_element,
int debug_level, CONVERTER *converter);
char *entry_tree_element_sort_string (const INDEX_ENTRY *main_entry,
ELEMENT *entry_tree_element,
struct TEXT_OPTIONS *options,
int in_code);
COLLATIONS_INDICES_SORTED_BY_INDEX *
new_base_collations_sorted_indices_by_index (void);
COLLATION_INDICES_SORTED_BY_INDEX *
get_collation_sorted_indices_by_index (
COLLATIONS_INDICES_SORTED_BY_INDEX *collations,
int use_unicode_collation,
const char *input_lang_sorting_locale,
const char *collation_locale,
const char **lang_sorting_locale_out);
COLLATIONS_INDICES_SORTED_BY_LETTER *
new_base_collations_sorted_indices_by_letter (void);
COLLATION_INDICES_SORTED_BY_LETTER *
get_collation_sorted_indices_by_letter (
COLLATIONS_INDICES_SORTED_BY_LETTER *collations,
int use_unicode_collation,
const char *input_lang_sorting_locale,
const char *collation_locale,
const char **lang_sorting_locale_out);
void destroy_index_entries_sort_strings (
INDICES_SORT_STRINGS *indices_sort_strings);
INDICES_SORT_STRINGS *setup_index_entries_sort_strings (
ERROR_MESSAGE_LIST *error_messages,
OPTIONS *options, const MERGED_INDICES *merged_indices,
INDEX_LIST *indices_information,
int prefer_reference_element,
CONVERTER *converter,
char *(*index_entry_element_sort_string_fn) (const INDEX_ENTRY *main_entry,
const ELEMENT *index_entry_element,
struct TEXT_OPTIONS *options, int in_code,
int prefer_reference_element,
int debug_level, CONVERTER *converter)
);
void destroy_sorted_indices_by_index (
COLLATIONS_INDICES_SORTED_BY_INDEX *collations);
void destroy_sorted_indices_by_letter (
COLLATIONS_INDICES_SORTED_BY_LETTER *collations);
INDEX_SORTED_BY_INDEX *sort_indices_by_index (
const INDICES_SORT_STRINGS *indices_sort_strings,
ERROR_MESSAGE_LIST *error_messages,
OPTIONS *options,
int use_unicode_collation,
const char *collation_language,
const char *collation_locale);
INDEX_SORTED_BY_LETTER *sort_indices_by_letter (
const INDICES_SORT_STRINGS *indices_sort_strings,
ERROR_MESSAGE_LIST *error_messages,
OPTIONS *options,
int use_unicode_collation,
const char *collation_language,
const char *collation_locale);
const INDEX **sort_index_names (INDEX_LIST *indices_info);
char *print_indices_information (INDEX_LIST *indices_info);
#endif