#include "config.h"
#include "structure.h"
#include "mobi.h"
Go to the source code of this file.
|
#define | INDX_TAG_GUIDE_TITLE_CNCX (unsigned[]) {1, 0} |
|
#define | INDX_TAG_NCX_FILEPOS (unsigned[]) {1, 0} |
|
#define | INDX_TAG_NCX_TEXT_CNCX (unsigned[]) {3, 0} |
|
#define | INDX_TAG_NCX_LEVEL (unsigned[]) {4, 0} |
|
#define | INDX_TAG_NCX_KIND_CNCX (unsigned[]) {5, 0} |
|
#define | INDX_TAG_NCX_POSFID (unsigned[]) {6, 0} |
|
#define | INDX_TAG_NCX_POSOFF (unsigned[]) {6, 1} |
|
#define | INDX_TAG_NCX_PARENT (unsigned[]) {21, 0} |
|
#define | INDX_TAG_NCX_CHILD_START (unsigned[]) {22, 0} |
|
#define | INDX_TAG_NCX_CHILD_END (unsigned[]) {23, 0} |
|
#define | INDX_TAG_SKEL_COUNT (unsigned[]) {1, 0} |
|
#define | INDX_TAG_SKEL_POSITION (unsigned[]) {6, 0} |
|
#define | INDX_TAG_SKEL_LENGTH (unsigned[]) {6, 1} |
|
#define | INDX_TAG_FRAG_AID_CNCX (unsigned[]) {2, 0} |
|
#define | INDX_TAG_FRAG_FILE_NR (unsigned[]) {3, 0} |
|
#define | INDX_TAG_FRAG_SEQUENCE_NR (unsigned[]) {4, 0} |
|
#define | INDX_TAG_FRAG_POSITION (unsigned[]) {6, 0} |
|
#define | INDX_TAG_FRAG_LENGTH (unsigned[]) {6, 1} |
|
#define | INDX_TAG_ORTH_POSITION (unsigned[]) {1, 0} |
|
#define | INDX_TAG_ORTH_LENGTH (unsigned[]) {2, 0} |
|
#define | INDX_TAGARR_ORTH_INFL 42 |
|
#define | INDX_TAGARR_INFL_GROUPS 5 |
|
#define | INDX_TAGARR_INFL_PARTS_V2 26 |
|
#define | INDX_TAGARR_INFL_PARTS_V1 7 |
|
#define | INDX_LABEL_SIZEMAX 1000 |
|
#define | INDX_INFLTAG_SIZEMAX 25000 |
|
#define | INDX_INFLBUF_SIZEMAX 500 |
|
#define | INDX_INFLSTRINGS_MAX 500 |
|
#define | ORDT_RECORD_MAXCNT 256 /* max entries count in old ordt */ |
|
#define | CNCX_RECORD_MAXCNT 0xf /* max entries count */ |
|
#define | INDX_RECORD_MAXCNT 6000 /* max index entries per record */ |
|
#define | INDX_TOTAL_MAXCNT ((size_t) INDX_RECORD_MAXCNT * 0xffff) /* max total index entries */ |
|
#define | INDX_NAME_SIZEMAX 0xff |
|
#define | INDX_TAGVALUES_MAX 100 |
| Maximum value of tag values in index entry (MOBIIndexTag)
|
|
|
MOBI_RET | mobi_parse_index (const MOBIData *m, MOBIIndx *indx, const size_t indx_record_number) |
| Parser of a set of index records. More...
|
|
MOBI_RET | mobi_parse_indx (const MOBIPdbRecord *indx_record, MOBIIndx *indx, MOBITagx *tagx, MOBIOrdt *ordt) |
| Parser of INDX record. More...
|
|
MOBI_RET | mobi_get_indxentry_tagvalue (uint32_t *tagvalue, const MOBIIndexEntry *entry, const unsigned tag_arr[]) |
| Get a value of tag[tagid][tagindex] for given index entry. More...
|
|
size_t | mobi_get_indxentry_tagarray (uint32_t **tagarr, const MOBIIndexEntry *entry, const size_t tagid) |
| Get array of tagvalues of tag[tagid] for given index entry. More...
|
|
bool | mobi_indx_has_tag (const MOBIIndx *indx, const size_t tagid) |
| Check if given tagid is present in the index. More...
|
|
char * | mobi_get_cncx_string (const MOBIPdbRecord *cncx_record, const uint32_t cncx_offset) |
| Get compiled index entry string. More...
|
|
char * | mobi_get_cncx_string_utf8 (const MOBIPdbRecord *cncx_record, const uint32_t cncx_offset, MOBIEncoding cncx_encoding) |
| Get compiled index entry string, converted to utf8 encoding. More...
|
|
char * | mobi_get_cncx_string_flat (const MOBIPdbRecord *cncx_record, const uint32_t cncx_offset, const size_t length) |
| Get flat index entry string. More...
|
|
MOBI_RET | mobi_decode_infl (unsigned char *decoded, int *decoded_size, const unsigned char *rule) |
| Decode compiled infl index entry. More...
|
|
MOBI_RET | mobi_trie_insert_infl (MOBITrie **root, const MOBIIndx *indx, size_t i) |
| Insert inversed inlection string for given entry into trie structure. More...
|
|
size_t | mobi_trie_get_inflgroups (char **infl_strings, MOBITrie *const root, const char *string) |
| Get all matches for given string from trie structure. More...
|
|
Copyright (c) 2014 Bartek Fabiszewski http://www.fabiszewski.net
This file is part of libmobi. Licensed under LGPL, either version 3, or any later. See http://www.gnu.org/licenses/
◆ INDX_INFLBUF_SIZEMAX
#define INDX_INFLBUF_SIZEMAX 500 |
◆ INDX_INFLSTRINGS_MAX
#define INDX_INFLSTRINGS_MAX 500 |
Max number of inflected strings
◆ INDX_INFLTAG_SIZEMAX
#define INDX_INFLTAG_SIZEMAX 25000 |
Max size of inflections tags per entry
◆ INDX_LABEL_SIZEMAX
#define INDX_LABEL_SIZEMAX 1000 |
◆ mobi_decode_infl()
MOBI_RET mobi_decode_infl |
( |
unsigned char * |
decoded, |
|
|
int * |
decoded_size, |
|
|
const unsigned char * |
rule |
|
) |
| |
Decode compiled infl index entry.
Buffer decoded must be initialized with basic index entry. Basic index entry will be transformed into inflected form, based on compiled rule. Min. size of input buffer (decoded) must be INDX_INFLBUF_SIZEMAX + 1
- Parameters
-
[in,out] | decoded | Decoded entry string |
[in,out] | decoded_size | Decoded entry size |
[in] | rule | Compiled rule |
- Returns
- MOBI_RET status code (on success MOBI_SUCCESS)
◆ mobi_get_cncx_string()
char* mobi_get_cncx_string |
( |
const MOBIPdbRecord * |
cncx_record, |
|
|
const uint32_t |
cncx_offset |
|
) |
| |
Get compiled index entry string.
Allocates memory for the string. Must be freed by caller.
- Parameters
-
[in] | cncx_record | MOBIPdbRecord structure with cncx record |
[in] | cncx_offset | Offset of string entry from the beginning of the record |
- Returns
- Entry string or null if malloc failed
◆ mobi_get_cncx_string_flat()
char* mobi_get_cncx_string_flat |
( |
const MOBIPdbRecord * |
cncx_record, |
|
|
const uint32_t |
cncx_offset, |
|
|
const size_t |
length |
|
) |
| |
Get flat index entry string.
Allocates memory for the string. Must be freed by caller.
- Parameters
-
[in] | cncx_record | MOBIPdbRecord structure with cncx record |
[in] | cncx_offset | Offset of string entry from the beginning of the record |
[in] | length | Length of the string to be extracted |
- Returns
- Entry string
◆ mobi_get_cncx_string_utf8()
char* mobi_get_cncx_string_utf8 |
( |
const MOBIPdbRecord * |
cncx_record, |
|
|
const uint32_t |
cncx_offset, |
|
|
MOBIEncoding |
cncx_encoding |
|
) |
| |
Get compiled index entry string, converted to utf8 encoding.
Allocates memory for the string. Must be freed by caller.
- Parameters
-
[in] | cncx_record | MOBIPdbRecord structure with cncx record |
[in] | cncx_offset | Offset of string entry from the beginning of the record |
[in] | cncx_encoding | Encoding |
- Returns
- Entry string or null if malloc failed
◆ mobi_get_indxentry_tagarray()
size_t mobi_get_indxentry_tagarray |
( |
uint32_t ** |
tagarr, |
|
|
const MOBIIndexEntry * |
entry, |
|
|
const size_t |
tagid |
|
) |
| |
Get array of tagvalues of tag[tagid] for given index entry.
- Parameters
-
[in,out] | tagarr | Pointer to tagvalues array |
[in] | entry | Index entry to be search for the value |
[in] | tagid | Id of the tag |
- Returns
- Size of the array (zero on failure)
◆ mobi_get_indxentry_tagvalue()
MOBI_RET mobi_get_indxentry_tagvalue |
( |
uint32_t * |
tagvalue, |
|
|
const MOBIIndexEntry * |
entry, |
|
|
const unsigned |
tag_arr[] |
|
) |
| |
Get a value of tag[tagid][tagindex] for given index entry.
- Parameters
-
[in,out] | tagvalue | Will be set to a tag value |
[in] | entry | Index entry to be search for the value |
[in] | tag_arr | Array: tag_arr[0] = tagid, tag_arr[1] = tagindex |
- Returns
- MOBI_RET status code (on success MOBI_SUCCESS)
◆ mobi_indx_has_tag()
bool mobi_indx_has_tag |
( |
const MOBIIndx * |
indx, |
|
|
const size_t |
tagid |
|
) |
| |
Check if given tagid is present in the index.
- Parameters
-
[in] | indx | Index MOBIIndx structure |
[in] | tagid | Id of the tag |
- Returns
- True on success, false otherwise
◆ mobi_parse_index()
Parser of a set of index records.
- Parameters
-
[in] | m | MOBIData structure containing MOBI file metadata and data |
[in,out] | indx | MOBIIndx structure to be filled with parsed entries |
[in] | indx_record_number | Number of the first record of the set |
- Returns
- MOBI_RET status code (on success MOBI_SUCCESS)
◆ mobi_parse_indx()
Parser of INDX record.
- Parameters
-
[in] | indx_record | MOBIPdbRecord structure with INDX record |
[in,out] | indx | MOBIIndx structure to be filled with parsed entries |
[in,out] | tagx | MOBITagx structure, will be filled with parsed TAGX section data if present in the INDX record, otherwise TAGX data will be used to parse the record |
[in,out] | ordt | MOBIOrdt structure, will be filled with parsed ORDT sections |
- Returns
- MOBI_RET status code (on success MOBI_SUCCESS)
◆ mobi_trie_get_inflgroups()
size_t mobi_trie_get_inflgroups |
( |
char ** |
infl_strings, |
|
|
MOBITrie *const |
root, |
|
|
const char * |
string |
|
) |
| |
Get all matches for given string from trie structure.
Matches are made agains reversed string and all its substrings
- Parameters
-
[in,out] | infl_strings | Array of returned strings |
[in] | root | Root node of the tree |
[in] | string | Index entry number |
- Returns
- Number of returned strings
◆ mobi_trie_insert_infl()
Insert inversed inlection string for given entry into trie structure.
- Parameters
-
[in,out] | root | Root node of the tree, created if NULL |
[in] | indx | MOBIIndx infl index records |
[in] | i | Index entry number |
- Returns
- MOBI_RET status code (on success MOBI_SUCCESS)