2013-05-08 20:59:40 +02:00
|
|
|
/*
|
|
|
|
* stardict-private.h: internal StarDict API
|
|
|
|
*
|
2020-09-02 16:27:45 +02:00
|
|
|
* Copyright (c) 2013 - 2015, Přemysl Eric Janouch <p@janouch.name>
|
2013-05-08 20:59:40 +02:00
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, and/or distribute this software for any
|
2018-06-24 05:23:31 +02:00
|
|
|
* purpose with or without fee is hereby granted.
|
2013-05-08 20:59:40 +02:00
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
|
|
|
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
|
|
|
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
|
|
|
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef STARDICTPRIVATE_H
|
|
|
|
#define STARDICTPRIVATE_H
|
|
|
|
|
2015-02-26 23:26:52 +01:00
|
|
|
/// Describes a single entry in the dictionary index.
|
2013-05-08 20:59:40 +02:00
|
|
|
typedef struct stardict_index_entry StardictIndexEntry;
|
|
|
|
|
2015-02-26 23:26:52 +01:00
|
|
|
/// Describes a single entry in the synonyms index.
|
2013-05-08 20:59:40 +02:00
|
|
|
typedef struct stardict_synonym_entry StardictSynonymEntry;
|
|
|
|
|
|
|
|
|
|
|
|
typedef enum stardict_version StardictVersion;
|
|
|
|
enum stardict_version { SD_VERSION_2_4_2, SD_VERSION_3_0_0 };
|
|
|
|
|
|
|
|
struct stardict_info
|
|
|
|
{
|
|
|
|
gchar * path;
|
|
|
|
StardictVersion version;
|
|
|
|
|
|
|
|
gchar * book_name;
|
|
|
|
gulong word_count;
|
|
|
|
gulong syn_word_count;
|
|
|
|
gulong idx_filesize;
|
|
|
|
gulong idx_offset_bits;
|
|
|
|
gchar * author;
|
|
|
|
gchar * email;
|
|
|
|
gchar * website;
|
|
|
|
gchar * description;
|
|
|
|
gchar * date;
|
|
|
|
gchar * same_type_sequence;
|
2015-02-24 08:38:28 +01:00
|
|
|
|
|
|
|
gchar * collation;
|
2013-05-08 20:59:40 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct stardict_index_entry
|
|
|
|
{
|
2015-02-26 23:26:52 +01:00
|
|
|
gchar * name; ///< The word in utf-8
|
|
|
|
guint64 data_offset; ///< Offset of the definition
|
|
|
|
guint32 data_size; ///< Size of the definition
|
2016-10-08 00:54:24 +02:00
|
|
|
guint32 reverse_index; ///< Word at this index before sorting
|
2013-05-08 20:59:40 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct stardict_synonym_entry
|
|
|
|
{
|
2015-02-26 23:26:52 +01:00
|
|
|
gchar * word; ///< A synonymous word
|
|
|
|
guint32 original_word; ///< The original word's index
|
2013-05-08 20:59:40 +02:00
|
|
|
};
|
|
|
|
|
2013-05-09 00:49:45 +02:00
|
|
|
struct stardict_ifo_key
|
|
|
|
{
|
2015-02-26 23:26:52 +01:00
|
|
|
const gchar *name; ///< Name of the key
|
2013-05-09 00:49:45 +02:00
|
|
|
enum {
|
2015-02-26 23:26:52 +01:00
|
|
|
IFO_STRING, ///< A @code gchar * @endcode value
|
|
|
|
IFO_NUMBER ///< A @code gulong @endcode value
|
|
|
|
} type; ///< Type of the value
|
|
|
|
size_t offset; ///< Offset within StardictInfo
|
2013-05-09 00:49:45 +02:00
|
|
|
};
|
|
|
|
|
2015-02-26 23:26:52 +01:00
|
|
|
/// Lists all the entries in StardictInfo.
|
2013-05-09 00:49:45 +02:00
|
|
|
extern const struct stardict_ifo_key _stardict_ifo_keys[];
|
|
|
|
|
2015-02-26 23:26:52 +01:00
|
|
|
/// Denotes the length of _stardict_ifo_keys.
|
2013-05-09 00:49:45 +02:00
|
|
|
extern gsize _stardict_ifo_keys_length;
|
|
|
|
|
2021-10-07 16:26:57 +02:00
|
|
|
void stardict_info_copy (StardictInfo *dest, const StardictInfo *src);
|
|
|
|
|
2015-02-26 23:26:52 +01:00
|
|
|
#endif // ! STARDICTPRIVATE_H
|