diff options
author | Přemysl Janouch <p.janouch@gmail.com> | 2013-05-08 20:59:40 +0200 |
---|---|---|
committer | Přemysl Janouch <p.janouch@gmail.com> | 2013-05-08 20:59:40 +0200 |
commit | 5b7af35cfa1f05a80539b0ad068012aaa03603de (patch) | |
tree | 9eb976cd0a77948040a9762428e007d1a487fbb0 /src/stardict.c | |
parent | febff16ed4736c9fcb4dc65c04f0260dc2fe2b33 (diff) | |
download | tdv-5b7af35cfa1f05a80539b0ad068012aaa03603de.tar.gz tdv-5b7af35cfa1f05a80539b0ad068012aaa03603de.tar.xz tdv-5b7af35cfa1f05a80539b0ad068012aaa03603de.zip |
Create a private header
Diffstat (limited to 'src/stardict.c')
-rw-r--r-- | src/stardict.c | 69 |
1 files changed, 15 insertions, 54 deletions
diff --git a/src/stardict.c b/src/stardict.c index 4439022..bebe3d2 100644 --- a/src/stardict.c +++ b/src/stardict.c @@ -27,62 +27,9 @@ #include <gio/gio.h> #include "stardict.h" +#include "stardict-private.h" -/** Describes a single entry in the dictionary index. */ -typedef struct stardict_index_entry StardictIndexEntry; - -/** Describes a single entry in the synonyms index. */ -typedef struct stardict_synonym_entry StardictSynonymEntry; - -/** Helper class for reading .ifo files. */ -typedef struct ifo_reader IfoReader; - - -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; -}; - -struct stardict_index_entry -{ - gchar * name; //!< The word in utf-8 - guint64 data_offset; //!< Offset of the definition - guint32 data_size; //!< Size of the definition -}; - -struct stardict_synonym_entry -{ - gchar * word; //!< A synonymous word - guint32 original_word; //!< The original word's index -}; - struct ifo_reader -{ - gchar * data; //!< File data terminated with \0 - gchar * data_end; //!< Where the final \0 char. is - - gchar * start; //!< Start of the current token - - gchar * key; //!< The key (points into @a data) - gchar * value; //!< The value (points into @a data) -}; - // --- Utilities --------------------------------------------------------------- /** Read the whole stream into a byte array. */ @@ -159,6 +106,20 @@ stardict_error_quark (void) // --- IFO reader -------------------------------------------------------------- +/** Helper class for reading .ifo files. */ +typedef struct ifo_reader IfoReader; + +struct ifo_reader +{ + gchar * data; //!< File data terminated with \0 + gchar * data_end; //!< Where the final \0 char. is + + gchar * start; //!< Start of the current token + + gchar * key; //!< The key (points into @a data) + gchar * value; //!< The value (points into @a data) +}; + static gboolean ifo_reader_init (IfoReader *ir, const gchar *path, GError **error) { |