remove eb.lib and use source directly

update eb submodule
This commit is contained in:
xiaoyifang 2023-05-01 09:09:19 +08:00
parent e8b5e8d19a
commit 731e54d718
27 changed files with 21 additions and 2191 deletions

View file

@ -56,6 +56,7 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true
- name: version-file
shell: bash
run: |

View file

@ -60,6 +60,7 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 1
submodules: true
- name: install deps on macos
run: |

View file

@ -45,6 +45,7 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 1
submodules: true
- name: Set outputs
id: githash
run: |

View file

@ -52,6 +52,7 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true
- name: Set outputs
id: githash
run: |

View file

@ -52,6 +52,7 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true
- name: Set outputs
id: githash
run: |

View file

@ -58,6 +58,7 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true
- name: version-file
shell: bash

View file

@ -74,6 +74,7 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true
- name: version-file
shell: bash

View file

@ -65,6 +65,7 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true
- name: version-file
shell: bash

View file

@ -64,6 +64,7 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 1
submodules: true
- name: build goldendict
run: |

View file

@ -58,6 +58,7 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true
- name: version-file
shell: bash

View file

@ -49,7 +49,8 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0
fetch-depth: 200
submodules: true
- name: changelog
id: changelog

View file

@ -49,7 +49,8 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0
fetch-depth: 200
submodules: true
- name: Set outputs

View file

@ -53,6 +53,7 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 1
submodules: true
- uses: ilammy/msvc-dev-cmd@v1
# with:

View file

@ -52,7 +52,8 @@ jobs:
# 拉取代码
- uses: actions/checkout@v3
with:
fetch-depth: 0
fetch-depth: 200
submodules: true
- name: changelog
id: changelog

View file

@ -283,7 +283,6 @@ mac {
}
else{
QMAKE_POST_LINK = mkdir -p GoldenDict.app/Contents/Frameworks && \
cp -nR $${PWD}/maclibs/lib/libeb.dylib GoldenDict.app/Contents/Frameworks/ && \
mkdir -p GoldenDict.app/Contents/MacOS/locale && \
cp -R locale/*.qm GoldenDict.app/Contents/MacOS/locale/
}
@ -584,7 +583,9 @@ CONFIG( no_epwing_support ) {
SOURCES += src/dict/epwing.cc \
src/dict/epwing_book.cc \
src/dict/epwing_charmap.cc
LIBS += -leb
INCLUDEPATH += thirdparty
HEADERS += $$files(thirdparty/eb/*.h)
SOURCES += $$files(thirdparty/eb/*.c)
}
CONFIG( chinese_conversion_support ) {

2
thirdparty/eb vendored

@ -1 +1 @@
Subproject commit f45db88f160a9e597c3e050d37c011934fa5e773
Subproject commit e62cc10e23a0c5afdab0a78d3197825df61b9802

View file

@ -1,100 +0,0 @@
/* -*- C -*-
* Copyright (c) 1997-2006 Motoyuki Kasahara
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef EB_APPENDIX_H
#define EB_APPENDIX_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef EB_BUILD_LIBRARY
#include "eb.h"
#else
#include <eb/eb.h>
#endif
/*
* Function declarations.
*/
/* appendix.c */
void eb_initialize_appendix(EB_Appendix *appendix);
void eb_finalize_appendix(EB_Appendix *appendix);
EB_Error_Code eb_bind_appendix(EB_Appendix *appendix, const char *path);
int eb_is_appendix_bound(EB_Appendix *appendix);
EB_Error_Code eb_appendix_path(EB_Appendix *appendix, char *path);
/* appsub.c */
EB_Error_Code eb_load_all_appendix_subbooks(EB_Appendix *appendix);
EB_Error_Code eb_appendix_subbook_list(EB_Appendix *appendix,
EB_Subbook_Code *subbook_list, int *subbook_count);
EB_Error_Code eb_appendix_subbook(EB_Appendix *appendix,
EB_Subbook_Code *subbook_code);
EB_Error_Code eb_appendix_subbook_directory(EB_Appendix *appendix,
char *directory);
EB_Error_Code eb_appendix_subbook_directory2(EB_Appendix *appendix,
EB_Subbook_Code subbook_code, char *directory);
EB_Error_Code eb_set_appendix_subbook(EB_Appendix *appendix,
EB_Subbook_Code subbook_code);
void eb_unset_appendix_subbook(EB_Appendix *appendix);
/* narwalt.c */
int eb_have_narrow_alt(EB_Appendix *appendix);
EB_Error_Code eb_narrow_alt_start(EB_Appendix *appendix, int *start);
EB_Error_Code eb_narrow_alt_end(EB_Appendix *appendix, int *end);
EB_Error_Code eb_narrow_alt_character_text(EB_Appendix *appendix,
int character_number, char *text);
EB_Error_Code eb_forward_narrow_alt_character(EB_Appendix *appendix,
int n, int *character_number);
EB_Error_Code eb_backward_narrow_alt_character(EB_Appendix *appendix,
int n, int *character_number);
/* stopcode.c */
int eb_have_stop_code(EB_Appendix *appendix);
EB_Error_Code eb_stop_code(EB_Appendix *appendix, int *);
/* widealt.c */
int eb_have_wide_alt(EB_Appendix *appendix);
EB_Error_Code eb_wide_alt_start(EB_Appendix *appendix, int *start);
EB_Error_Code eb_wide_alt_end(EB_Appendix *appendix, int *end);
EB_Error_Code eb_wide_alt_character_text(EB_Appendix *appendix,
int character_number, char *text);
EB_Error_Code eb_forward_wide_alt_character(EB_Appendix *appendix, int n,
int *character_number);
EB_Error_Code eb_backward_wide_alt_character(EB_Appendix *appendix, int n,
int *character_number);
/* for backward compatibility */
#define eb_suspend_appendix eb_unset_appendix_subbook
#define eb_initialize_all_appendix_subbooks eb_load_all_appendix_subbooks
#ifdef __cplusplus
}
#endif
#endif /* not EB_APPENDIX_H */

View file

@ -1,73 +0,0 @@
/* -*- C -*-
* Copyright (c) 2001-2006 Motoyuki Kasahara
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef EB_BINARY_H
#define EB_BINARY_H
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/types.h>
#ifdef EB_BUILD_LIBRARY
#include "defs.h"
#else
#include <eb/defs.h>
#endif
/*
* Function declarations.
*/
/* binary.c */
EB_Error_Code eb_set_binary_mono_graphic(EB_Book *book,
const EB_Position *position, int width, int height);
EB_Error_Code eb_set_binary_gray_graphic(EB_Book *book,
const EB_Position *position, int width, int height);
EB_Error_Code eb_set_binary_wave(EB_Book *book,
const EB_Position *start_position, const EB_Position *end_position);
EB_Error_Code eb_set_binary_color_graphic(EB_Book *book,
const EB_Position *position);
EB_Error_Code eb_set_binary_mpeg(EB_Book *book, const unsigned int *argv);
EB_Error_Code eb_read_binary(EB_Book *book, size_t binary_max_length,
char *binary, ssize_t *binary_length);
void eb_unset_binary(EB_Book *book);
/* filename.c */
EB_Error_Code eb_compose_movie_file_name(const unsigned int *argv,
char *composed_file_name);
EB_Error_Code eb_compose_movie_path_name(EB_Book *book,
const unsigned int *argv, char *composed_path_name);
EB_Error_Code eb_decompose_movie_file_name(unsigned int *argv,
const char *composed_file_name);
#ifdef __cplusplus
}
#endif
#endif /* not EB_BINARY_H */

View file

@ -1,60 +0,0 @@
/* -*- C -*-
* Copyright (c) 1997-2006 Motoyuki Kasahara
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef EB_BOOKLIST_H
#define EB_BOOKLIST_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef EB_BUILD_LIBRARY
#include "eb.h"
#else
#include <eb/eb.h>
#endif
/*
* Function declarations.
*/
/* booklist.c */
void eb_initialize_booklist(EB_BookList *booklist);
void eb_finalize_booklist(EB_BookList *booklist);
EB_Error_Code eb_bind_booklist(EB_BookList *booklist, const char *path);
EB_Error_Code eb_booklist_book_count(EB_BookList *booklist, int *book_count);
EB_Error_Code eb_booklist_book_name(EB_BookList *booklist, int book_index,
char **book_name);
EB_Error_Code eb_booklist_book_title(EB_BookList *booklist, int book_index,
char **book_title);
#ifdef __cplusplus
}
#endif
#endif /* not EB_BOOKLIST_H */

File diff suppressed because it is too large Load diff

View file

@ -1,155 +0,0 @@
/* -*- C -*-
* Copyright (c) 1997-2006 Motoyuki Kasahara
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef EB_EB_H
#define EB_EB_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef EB_BUILD_LIBRARY
#include "defs.h"
#else
#include <eb/defs.h>
#endif
#include <stdarg.h>
/*
* Function declarations.
*/
/* book.c */
void eb_initialize_book(EB_Book *book);
EB_Error_Code eb_bind(EB_Book *book, const char *path);
void eb_finalize_book(EB_Book *book);
int eb_is_bound(EB_Book *book);
EB_Error_Code eb_path(EB_Book *book, char *path);
EB_Error_Code eb_disc_type(EB_Book *book, EB_Disc_Code *disc_code);
EB_Error_Code eb_character_code(EB_Book *book,
EB_Character_Code *character_code);
/* copyright.h */
int eb_have_copyright(EB_Book *book);
EB_Error_Code eb_copyright(EB_Book *book, EB_Position *position);
EB_Error_Code eb_search_cross(EB_Book *book,
const char * const input_words[]);
/* cross.c */
int eb_have_cross_search(EB_Book *book);
/* eb.c */
EB_Error_Code eb_initialize_library(void);
void eb_finalize_library(void);
/* endword.c */
int eb_have_endword_search(EB_Book *book);
EB_Error_Code eb_search_endword(EB_Book *book, const char *input_word);
/* exactword.c */
int eb_have_exactword_search(EB_Book *book);
EB_Error_Code eb_search_exactword(EB_Book *book, const char *input_word);
/* graphic.c */
int eb_have_graphic_search(EB_Book *book);
/* keyword.c */
int eb_have_keyword_search(EB_Book *book);
EB_Error_Code eb_search_keyword(EB_Book *book,
const char * const input_words[]);
/* lock.c */
int eb_pthread_enabled(void);
/* log.c */
void eb_set_log_function(void (*function)(const char *message, va_list ap));
void eb_enable_log(void);
void eb_disable_log(void);
void eb_log(const char *message, ...);
void eb_log_stderr(const char *message, va_list ap);
/* menu.c */
int eb_have_menu(EB_Book *book);
EB_Error_Code eb_menu(EB_Book *book, EB_Position *position);
int eb_have_image_menu(EB_Book *book);
EB_Error_Code eb_image_menu(EB_Book *book, EB_Position *position);
/* multi.c */
int eb_have_multi_search(EB_Book *book);
EB_Error_Code eb_multi_title(EB_Book *book, EB_Multi_Search_Code multi_id,
char *title);
EB_Error_Code eb_multi_search_list(EB_Book *book,
EB_Multi_Search_Code *search_list, int *search_count);
EB_Error_Code eb_multi_entry_count(EB_Book *book,
EB_Multi_Search_Code multi_id, int *entry_count);
EB_Error_Code eb_multi_entry_list(EB_Book *book,
EB_Multi_Search_Code multi_id, int *entry_list, int *entry_count);
EB_Error_Code eb_multi_entry_label(EB_Book *book,
EB_Multi_Search_Code multi_id, int entry_index, char *label);
int eb_multi_entry_have_candidates(EB_Book *book,
EB_Multi_Search_Code multi_id, int entry_index);
EB_Error_Code eb_multi_entry_candidates(EB_Book *book,
EB_Multi_Search_Code multi_id, int entry_index, EB_Position *position);
EB_Error_Code eb_search_multi(EB_Book *book, EB_Multi_Search_Code multi_id,
const char * const input_words[]);
/* text.c */
int eb_have_text(EB_Book *book);
EB_Error_Code eb_text(EB_Book *book, EB_Position *position);
/* search.c */
EB_Error_Code eb_hit_list(EB_Book *book, int max_hit_count, EB_Hit *hit_list,
int *hit_count);
/* subbook.c */
EB_Error_Code eb_load_all_subbooks(EB_Book *book);
EB_Error_Code eb_subbook_list(EB_Book *book, EB_Subbook_Code *subbook_list,
int *subbook_count);
EB_Error_Code eb_subbook(EB_Book *book, EB_Subbook_Code *subbook_code);
EB_Error_Code eb_subbook_title(EB_Book *book, char *title);
EB_Error_Code eb_subbook_title2(EB_Book *book, EB_Subbook_Code subbook_code,
char *title);
EB_Error_Code eb_subbook_directory(EB_Book *book, char *directory);
EB_Error_Code eb_subbook_directory2(EB_Book *book,
EB_Subbook_Code subbook_code, char *directory);
EB_Error_Code eb_set_subbook(EB_Book *book, EB_Subbook_Code subbook_code);
void eb_unset_subbook(EB_Book *book);
/* word.c */
int eb_have_word_search(EB_Book *book);
EB_Error_Code eb_search_word(EB_Book *book, const char *input_word);
/* for backward compatibility */
#define eb_suspend eb_unset_subbook
#define eb_initialize_all_subbooks eb_load_all_subbooks
#ifdef __cplusplus
}
#endif
#endif /* not EB_EB_H */

View file

@ -1,150 +0,0 @@
/* -*- C -*-
* Copyright (c) 1997-2006 Motoyuki Kasahara
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef EB_ERROR_H
#define EB_ERROR_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef EB_BUILD_LIBRARY
#include "defs.h"
#else
#include <eb/defs.h>
#endif
/*
* Error codes.
*/
#define EB_SUCCESS 0
#define EB_ERR_MEMORY_EXHAUSTED 1
#define EB_ERR_EMPTY_FILE_NAME 2
#define EB_ERR_TOO_LONG_FILE_NAME 3
#define EB_ERR_BAD_FILE_NAME 4
#define EB_ERR_BAD_DIR_NAME 5
#define EB_ERR_TOO_LONG_WORD 6
#define EB_ERR_BAD_WORD 7
#define EB_ERR_EMPTY_WORD 8
#define EB_ERR_FAIL_GETCWD 9
#define EB_ERR_FAIL_OPEN_CAT 10
#define EB_ERR_FAIL_OPEN_CATAPP 11
#define EB_ERR_FAIL_OPEN_TEXT 12
#define EB_ERR_FAIL_OPEN_FONT 13
#define EB_ERR_FAIL_OPEN_APP 14
#define EB_ERR_FAIL_OPEN_BINARY 15
#define EB_ERR_FAIL_READ_CAT 16
#define EB_ERR_FAIL_READ_CATAPP 17
#define EB_ERR_FAIL_READ_TEXT 18
#define EB_ERR_FAIL_READ_FONT 19
#define EB_ERR_FAIL_READ_APP 20
#define EB_ERR_FAIL_READ_BINARY 21
#define EB_ERR_FAIL_SEEK_CAT 22
#define EB_ERR_FAIL_SEEK_CATAPP 23
#define EB_ERR_FAIL_SEEK_TEXT 24
#define EB_ERR_FAIL_SEEK_FONT 25
#define EB_ERR_FAIL_SEEK_APP 26
#define EB_ERR_FAIL_SEEK_BINARY 27
#define EB_ERR_UNEXP_CAT 28
#define EB_ERR_UNEXP_CATAPP 29
#define EB_ERR_UNEXP_TEXT 30
#define EB_ERR_UNEXP_FONT 31
#define EB_ERR_UNEXP_APP 32
#define EB_ERR_UNEXP_BINARY 33
#define EB_ERR_UNBOUND_BOOK 34
#define EB_ERR_UNBOUND_APP 35
#define EB_ERR_NO_SUB 36
#define EB_ERR_NO_APPSUB 37
#define EB_ERR_NO_FONT 38
#define EB_ERR_NO_TEXT 39
#define EB_ERR_NO_STOPCODE 40
#define EB_ERR_NO_ALT 41
#define EB_ERR_NO_CUR_SUB 42
#define EB_ERR_NO_CUR_APPSUB 43
#define EB_ERR_NO_CUR_FONT 44
#define EB_ERR_NO_CUR_BINARY 45
#define EB_ERR_NO_SUCH_SUB 46
#define EB_ERR_NO_SUCH_APPSUB 47
#define EB_ERR_NO_SUCH_FONT 48
#define EB_ERR_NO_SUCH_CHAR_BMP 49
#define EB_ERR_NO_SUCH_CHAR_TEXT 50
#define EB_ERR_NO_SUCH_SEARCH 51
#define EB_ERR_NO_SUCH_HOOK 52
#define EB_ERR_NO_SUCH_BINARY 53
#define EB_ERR_DIFF_CONTENT 54
#define EB_ERR_NO_PREV_SEARCH 55
#define EB_ERR_NO_SUCH_MULTI_ID 56
#define EB_ERR_NO_SUCH_ENTRY_ID 57
#define EB_ERR_TOO_MANY_WORDS 58
#define EB_ERR_NO_WORD 59
#define EB_ERR_NO_CANDIDATES 60
#define EB_ERR_END_OF_CONTENT 61
#define EB_ERR_NO_PREV_SEEK 62
#define EB_ERR_EBNET_UNSUPPORTED 63
#define EB_ERR_EBNET_FAIL_CONNECT 64
#define EB_ERR_EBNET_SERVER_BUSY 65
#define EB_ERR_EBNET_NO_PERMISSION 66
#define EB_ERR_UNBOUND_BOOKLIST 67
#define EB_ERR_NO_SUCH_BOOK 68
/*
* The number of error codes.
*/
#define EB_NUMBER_OF_ERRORS 69
/*
* The maximum length of an error message.
*/
#define EB_MAX_ERROR_MESSAGE_LENGTH 127
/*
* Function declarations.
*/
/* error.c */
const char *eb_error_string(EB_Error_Code error_code);
const char *eb_error_message(EB_Error_Code error_code);
#ifdef __cplusplus
}
#endif
#endif /* not EB_ERROR_H */

View file

@ -1,200 +0,0 @@
/* -*- C -*-
* Copyright (c) 1997-2006 Motoyuki Kasahara
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef EB_FONT_H
#define EB_FONT_H
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/types.h>
#ifdef EB_BUILD_LIBRARY
#include "defs.h"
#else
#include <eb/defs.h>
#endif
/*
* Font types.
*/
#define EB_FONT_16 0
#define EB_FONT_24 1
#define EB_FONT_30 2
#define EB_FONT_48 3
#define EB_FONT_INVALID -1
/*
* Font sizes.
*/
#define EB_SIZE_NARROW_FONT_16 16
#define EB_SIZE_WIDE_FONT_16 32
#define EB_SIZE_NARROW_FONT_24 48
#define EB_SIZE_WIDE_FONT_24 72
#define EB_SIZE_NARROW_FONT_30 60
#define EB_SIZE_WIDE_FONT_30 120
#define EB_SIZE_NARROW_FONT_48 144
#define EB_SIZE_WIDE_FONT_48 288
/*
* Font width.
*/
#define EB_WIDTH_NARROW_FONT_16 8
#define EB_WIDTH_WIDE_FONT_16 16
#define EB_WIDTH_NARROW_FONT_24 16
#define EB_WIDTH_WIDE_FONT_24 24
#define EB_WIDTH_NARROW_FONT_30 16
#define EB_WIDTH_WIDE_FONT_30 32
#define EB_WIDTH_NARROW_FONT_48 24
#define EB_WIDTH_WIDE_FONT_48 48
/*
* Font height.
*/
#define EB_HEIGHT_FONT_16 16
#define EB_HEIGHT_FONT_24 24
#define EB_HEIGHT_FONT_30 30
#define EB_HEIGHT_FONT_48 48
/*
* Bitmap image sizes.
*/
#define EB_SIZE_NARROW_FONT_16_XBM 184
#define EB_SIZE_WIDE_FONT_16_XBM 284
#define EB_SIZE_NARROW_FONT_16_XPM 266
#define EB_SIZE_WIDE_FONT_16_XPM 395
#define EB_SIZE_NARROW_FONT_16_GIF 186
#define EB_SIZE_WIDE_FONT_16_GIF 314
#define EB_SIZE_NARROW_FONT_16_BMP 126
#define EB_SIZE_WIDE_FONT_16_BMP 126
#define EB_SIZE_NARROW_FONT_16_PNG 131
#define EB_SIZE_WIDE_FONT_16_PNG 147
#define EB_SIZE_NARROW_FONT_24_XBM 383
#define EB_SIZE_WIDE_FONT_24_XBM 533
#define EB_SIZE_NARROW_FONT_24_XPM 555
#define EB_SIZE_WIDE_FONT_24_XPM 747
#define EB_SIZE_NARROW_FONT_24_GIF 450
#define EB_SIZE_WIDE_FONT_24_GIF 642
#define EB_SIZE_NARROW_FONT_24_BMP 158
#define EB_SIZE_WIDE_FONT_24_BMP 158
#define EB_SIZE_NARROW_FONT_24_PNG 171
#define EB_SIZE_WIDE_FONT_24_PNG 195
#define EB_SIZE_NARROW_FONT_30_XBM 458
#define EB_SIZE_WIDE_FONT_30_XBM 833
#define EB_SIZE_NARROW_FONT_30_XPM 675
#define EB_SIZE_WIDE_FONT_30_XPM 1155
#define EB_SIZE_NARROW_FONT_30_GIF 552
#define EB_SIZE_WIDE_FONT_30_GIF 1032
#define EB_SIZE_NARROW_FONT_30_BMP 182
#define EB_SIZE_WIDE_FONT_30_BMP 182
#define EB_SIZE_NARROW_FONT_30_PNG 189
#define EB_SIZE_WIDE_FONT_30_PNG 249
#define EB_SIZE_NARROW_FONT_48_XBM 983
#define EB_SIZE_WIDE_FONT_48_XBM 1883
#define EB_SIZE_NARROW_FONT_48_XPM 1419
#define EB_SIZE_WIDE_FONT_48_XPM 2571
#define EB_SIZE_NARROW_FONT_48_GIF 1242
#define EB_SIZE_WIDE_FONT_48_GIF 2394
#define EB_SIZE_NARROW_FONT_48_BMP 254
#define EB_SIZE_WIDE_FONT_48_BMP 446
#define EB_SIZE_NARROW_FONT_48_PNG 291
#define EB_SIZE_WIDE_FONT_48_PNG 435
#define EB_SIZE_FONT_IMAGE EB_SIZE_WIDE_FONT_48_XPM
/*
* Function declarations.
*/
/* bitmap.c */
EB_Error_Code eb_narrow_font_xbm_size(EB_Font_Code font_code, size_t *size);
EB_Error_Code eb_narrow_font_xpm_size(EB_Font_Code font_code, size_t *size);
EB_Error_Code eb_narrow_font_gif_size(EB_Font_Code font_code, size_t *size);
EB_Error_Code eb_narrow_font_bmp_size(EB_Font_Code font_code, size_t *size);
EB_Error_Code eb_narrow_font_png_size(EB_Font_Code font_code, size_t *size);
EB_Error_Code eb_wide_font_xbm_size(EB_Font_Code font_code, size_t *size);
EB_Error_Code eb_wide_font_xpm_size(EB_Font_Code font_code, size_t *size);
EB_Error_Code eb_wide_font_gif_size(EB_Font_Code font_code, size_t *size);
EB_Error_Code eb_wide_font_bmp_size(EB_Font_Code font_code, size_t *size);
EB_Error_Code eb_wide_font_png_size(EB_Font_Code font_code, size_t *size);
EB_Error_Code eb_bitmap_to_xbm(const char *bitmap, int width, int height,
char *xbm, size_t *xbm_length);
EB_Error_Code eb_bitmap_to_xpm(const char *bitmap, int width, int height,
char *xpm, size_t *xpm_length);
EB_Error_Code eb_bitmap_to_gif(const char *bitmap, int width, int height,
char *gif, size_t *gif_length);
EB_Error_Code eb_bitmap_to_bmp(const char *bitmap, int width, int height,
char *bmp, size_t *bmp_length);
EB_Error_Code eb_bitmap_to_png(const char *bitmap, int width, int height,
char *png, size_t *png_length);
/* font.c */
EB_Error_Code eb_font(EB_Book *book, EB_Font_Code *font_code);
EB_Error_Code eb_set_font(EB_Book *book, EB_Font_Code font_code);
void eb_unset_font(EB_Book *book);
EB_Error_Code eb_font_list(EB_Book *book, EB_Font_Code *font_list,
int *font_count);
int eb_have_font(EB_Book *book, EB_Font_Code font_code);
EB_Error_Code eb_font_height(EB_Book *book, int *height);
EB_Error_Code eb_font_height2(EB_Font_Code font_code, int *height);
/* narwfont.c */
int eb_have_narrow_font(EB_Book *book);
EB_Error_Code eb_narrow_font_width(EB_Book *book, int *width);
EB_Error_Code eb_narrow_font_width2(EB_Font_Code font_code, int *width);
EB_Error_Code eb_narrow_font_size(EB_Book *book, size_t *size);
EB_Error_Code eb_narrow_font_size2(EB_Font_Code font_code, size_t *size);
EB_Error_Code eb_narrow_font_start(EB_Book *book, int *start);
EB_Error_Code eb_narrow_font_end(EB_Book *book, int *end);
EB_Error_Code eb_narrow_font_character_bitmap(EB_Book *book, int, char *);
EB_Error_Code eb_forward_narrow_font_character(EB_Book *book, int, int *);
EB_Error_Code eb_backward_narrow_font_character(EB_Book *book, int, int *);
/* widefont.c */
int eb_have_wide_font(EB_Book *book);
EB_Error_Code eb_wide_font_width(EB_Book *book, int *width);
EB_Error_Code eb_wide_font_width2(EB_Font_Code font_code, int *width);
EB_Error_Code eb_wide_font_size(EB_Book *book, size_t *size);
EB_Error_Code eb_wide_font_size2(EB_Font_Code font_code, size_t *size);
EB_Error_Code eb_wide_font_start(EB_Book *book, int *start);
EB_Error_Code eb_wide_font_end(EB_Book *book, int *end);
EB_Error_Code eb_wide_font_character_bitmap(EB_Book *book,
int character_number, char *bitmap);
EB_Error_Code eb_forward_wide_font_character(EB_Book *book, int n,
int *character_number);
EB_Error_Code eb_backward_wide_font_character(EB_Book *book, int n,
int *character_number);
#ifdef __cplusplus
}
#endif
#endif /* not EB_FONT_H */

View file

@ -1,4 +0,0 @@
/* automatically generated by Makefile. */
#define EB_VERSION_STRING "4.4.3"
#define EB_VERSION_MAJOR 4
#define EB_VERSION_MINOR 4

View file

@ -1,166 +0,0 @@
/* -*- C -*-
* Copyright (c) 1997-2006 Motoyuki Kasahara
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef EB_TEXT_H
#define EB_TEXT_H
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/types.h>
#ifdef EB_BUILD_LIBRARY
#include "defs.h"
#else
#include <eb/defs.h>
#endif
/*
* Hook codes.
* (When you add or remove a hook, update EB_NUMER_OF_HOOKS in defs.h.)
*/
#define EB_HOOK_NULL -1
#define EB_HOOK_INITIALIZE 0
#define EB_HOOK_BEGIN_NARROW 1
#define EB_HOOK_END_NARROW 2
#define EB_HOOK_BEGIN_SUBSCRIPT 3
#define EB_HOOK_END_SUBSCRIPT 4
#define EB_HOOK_SET_INDENT 5
#define EB_HOOK_NEWLINE 6
#define EB_HOOK_BEGIN_SUPERSCRIPT 7
#define EB_HOOK_END_SUPERSCRIPT 8
#define EB_HOOK_BEGIN_NO_NEWLINE 9
#define EB_HOOK_END_NO_NEWLINE 10
#define EB_HOOK_BEGIN_EMPHASIS 11
#define EB_HOOK_END_EMPHASIS 12
#define EB_HOOK_BEGIN_CANDIDATE 13
#define EB_HOOK_END_CANDIDATE_GROUP 14
#define EB_HOOK_END_CANDIDATE_LEAF 15
#define EB_HOOK_BEGIN_REFERENCE 16
#define EB_HOOK_END_REFERENCE 17
#define EB_HOOK_BEGIN_KEYWORD 18
#define EB_HOOK_END_KEYWORD 19
#define EB_HOOK_NARROW_FONT 20
#define EB_HOOK_WIDE_FONT 21
#define EB_HOOK_ISO8859_1 22
#define EB_HOOK_NARROW_JISX0208 23
#define EB_HOOK_WIDE_JISX0208 24
#define EB_HOOK_GB2312 25
#define EB_HOOK_BEGIN_MONO_GRAPHIC 26
#define EB_HOOK_END_MONO_GRAPHIC 27
#define EB_HOOK_BEGIN_GRAY_GRAPHIC 28
#define EB_HOOK_END_GRAY_GRAPHIC 29
#define EB_HOOK_BEGIN_COLOR_BMP 30
#define EB_HOOK_BEGIN_COLOR_JPEG 31
#define EB_HOOK_BEGIN_IN_COLOR_BMP 32
#define EB_HOOK_BEGIN_IN_COLOR_JPEG 33
#define EB_HOOK_END_COLOR_GRAPHIC 34
#define EB_HOOK_END_IN_COLOR_GRAPHIC 35
#define EB_HOOK_BEGIN_WAVE 36
#define EB_HOOK_END_WAVE 37
#define EB_HOOK_BEGIN_MPEG 38
#define EB_HOOK_END_MPEG 39
#define EB_HOOK_BEGIN_GRAPHIC_REFERENCE 40
#define EB_HOOK_END_GRAPHIC_REFERENCE 41
#define EB_HOOK_GRAPHIC_REFERENCE 42
#define EB_HOOK_BEGIN_DECORATION 43
#define EB_HOOK_END_DECORATION 44
#define EB_HOOK_BEGIN_IMAGE_PAGE 45
#define EB_HOOK_END_IMAGE_PAGE 46
#define EB_HOOK_BEGIN_CLICKABLE_AREA 47
#define EB_HOOK_END_CLICKABLE_AREA 48
#define EB_HOOK_BEGIN_UNICODE 49
#define EB_HOOK_END_UNICODE 50
#define EB_HOOK_BEGIN_EBXAC_GAIJI 51
#define EB_HOOK_END_EBXAC_GAIJI 52
#define EB_HOOK_EBXAC_GAIJI 53
/*
* Function declarations.
*/
/* hook.c */
void eb_initialize_hookset(EB_Hookset *hookset);
void eb_finalize_hookset(EB_Hookset *hookset);
EB_Error_Code eb_set_hook(EB_Hookset *hookset, const EB_Hook *hook);
EB_Error_Code eb_set_hooks(EB_Hookset *hookset, const EB_Hook *hook);
EB_Error_Code eb_hook_euc_to_ascii(EB_Book *book, EB_Appendix *appendix,
void *container, EB_Hook_Code hook_code, int argc,
const unsigned int *argv);
EB_Error_Code eb_hook_stop_code(EB_Book *book, EB_Appendix *appendix,
void *container, EB_Hook_Code hook_code, int argc,
const unsigned int *argv);
EB_Error_Code eb_hook_narrow_character_text(EB_Book *book,
EB_Appendix *appendix, void *container, EB_Hook_Code hook_code, int argc,
const unsigned int *argv);
EB_Error_Code eb_hook_wide_character_text(EB_Book *book,
EB_Appendix *appendix, void *container, EB_Hook_Code hook_code, int argc,
const unsigned int *argv);
EB_Error_Code eb_hook_newline(EB_Book *book, EB_Appendix *appendix,
void *container, EB_Hook_Code hook_code, int argc,
const unsigned int *argv);
EB_Error_Code eb_hook_empty(EB_Book *book, EB_Appendix *appendix,
void *container, EB_Hook_Code hook_code, int argc,
const unsigned int *argv);
/* readtext.c */
EB_Error_Code eb_seek_text(EB_Book *book, const EB_Position *position);
EB_Error_Code eb_tell_text(EB_Book *book, EB_Position *position);
EB_Error_Code eb_read_text(EB_Book *book, EB_Appendix *appendix,
EB_Hookset *hookset, void *container, size_t text_max_length, char *text,
ssize_t *text_length);
EB_Error_Code eb_read_heading(EB_Book *book, EB_Appendix *appendix,
EB_Hookset *hookset, void *container, size_t text_max_length, char *text,
ssize_t *text_length);
EB_Error_Code eb_read_rawtext(EB_Book *book, size_t text_max_length,
char *text, ssize_t *text_length);
int eb_is_text_stopped(EB_Book *book);
EB_Error_Code eb_write_text_byte1(EB_Book *book, int byte1);
EB_Error_Code eb_write_text_byte2(EB_Book *book, int byte1, int byte2);
EB_Error_Code eb_write_text_string(EB_Book *book, const char *string);
EB_Error_Code eb_write_text(EB_Book *book, const char * stream,
size_t stream_length);
const char *eb_current_candidate(EB_Book *book);
EB_Error_Code eb_forward_text(EB_Book *book, EB_Appendix *appendix);
EB_Error_Code eb_backward_text(EB_Book *book, EB_Appendix *appendix);
#ifdef __cplusplus
}
#endif
#endif /* not EB_TEXT_H */

View file

@ -1,237 +0,0 @@
/* -*- C -*-
* Copyright (c) 2001-2006 Motoyuki Kasahara
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef ZIO_H
#define ZIO_H
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/types.h>
#include <time.h>
/*
* Header size of the ebzip compression file.
*/
#define ZIO_SIZE_EBZIP_HEADER 22
/*
* Margin size for ebzip compression buffer.
* (Since compressed data is larger than original in the worst case,
* we must add margin to a compression buffer.)
*/
#define ZIO_SIZE_EBZIP_MARGIN 1024
/*
* Maximum ebzio compression level.
*/
#define ZIO_MAX_EBZIP_LEVEL 5
/*
* Huffman node types.
*/
#define ZIO_HUFFMAN_NODE_INTERMEDIATE 0
#define ZIO_HUFFMAN_NODE_EOF 1
#define ZIO_HUFFMAN_NODE_LEAF8 2
#define ZIO_HUFFMAN_NODE_LEAF16 3
#define ZIO_HUFFMAN_NODE_LEAF32 4
/*
* Compression type codes.
*/
#define ZIO_PLAIN 0
#define ZIO_EBZIP1 1
#define ZIO_EPWING 2
#define ZIO_EPWING6 3
#define ZIO_SEBXA 4
#define ZIO_INVALID -1
#define ZIO_REOPEN -2
/*
* Compression type.
*/
typedef int Zio_Code;
/*
* A node of static Huffman tree.
*/
typedef struct Zio_Huffman_Node_Struct Zio_Huffman_Node;
struct Zio_Huffman_Node_Struct {
/*
* node type (ITNERMEDIATE, LEAF8, LEAF16, LEAF32 or EOF).
*/
int type;
/*
* Value of a leaf node.
*/
unsigned int value;
/*
* Frequency of a node.
*/
int frequency;
/*
* Left child.
*/
Zio_Huffman_Node *left;
/*
* Right child.
*/
Zio_Huffman_Node *right;
};
/*
* Compression information of a book.
*/
typedef struct Zio_Struct Zio;
struct Zio_Struct {
/*
* ID.
*/
int id;
/*
* Zio type. (PLAIN, EBZIP, EPWING, EPWING6 or SEBXA)
*/
Zio_Code code;
/*
* File descriptor.
*/
int file;
/*
* Current location.
*/
off_t location;
/*
* Size of an uncompressed file.
*/
off_t file_size;
/*
* Slice size of an EBZIP compressed file.
*/
size_t slice_size;
/*
* Compression level. (EBZIP compression only)
*/
int zip_level;
/*
* Length of an index. (EBZIP compression only)
*/
int index_width;
/*
* Adler-32 check sum of an uncompressed file. (EBZIP compression only)
*/
unsigned int crc;
/*
* mtime of an uncompressed file. (EBZIP compression only)
*/
time_t mtime;
/*
* Location of an index table. (EPWING and S-EBXA compression only)
*/
off_t index_location;
/*
* Length of an index table. (EPWING and S-EBXA compression only)
*/
size_t index_length;
/*
* Location of a frequency table. (EPWING compression only)
*/
off_t frequencies_location;
/*
* Length of a frequency table. (EPWING compression only)
*/
size_t frequencies_length;
/*
* Huffman tree nodes. (EPWING compression only)
*/
Zio_Huffman_Node *huffman_nodes;
/*
* Root node of a Huffman tree. (EPWING compression only)
*/
Zio_Huffman_Node *huffman_root;
/*
* Region of compressed pages. (S-EBXA compression only)
*/
off_t zio_start_location;
off_t zio_end_location;
/*
* Add this value to offset written in index. (S-EBXA compression only)
*/
off_t index_base;
/*
* ebnet mode flag.
*/
int is_ebnet;
};
/*
* Function declarations.
*/
/* zio.c */
int zio_initialize_library(void);
void zio_finalize_library(void);
void zio_initialize(Zio *zio);
void zio_finalize(Zio *zio);
int zio_set_sebxa_mode(Zio *zio, off_t index_location, off_t index_base,
off_t zio_start_location, off_t zio_end_location);
int zio_open(Zio *zio, const char *file_name, Zio_Code zio_code);
void zio_close(Zio *zio);
int zio_file(Zio *zio);
Zio_Code zio_mode(Zio *zio);
off_t zio_lseek(Zio *zio, off_t offset, int whence);
ssize_t zio_read(Zio *zio, char *buffer, size_t length);
#ifdef __cplusplus
}
#endif
#endif /* not ZIO_H */

Binary file not shown.