Compare commits

...

10 Commits

Author SHA1 Message Date
c9d1015f9e README => README.md 2017-04-01 14:10:33 -07:00
eeab07ed9d updating readme 2017-04-01 14:08:55 -07:00
6d0af07d88 fix windows issues with drive letters 2016-12-30 21:13:57 -08:00
6c26d968ba Fixing multiple getopt definitions 2016-12-02 09:15:35 -08:00
3c455a6426 WIP 2016-10-30 18:39:27 -07:00
cee4e0ae17 Custom search method 2016-10-30 14:16:14 -07:00
0d7849f6d5 WIP 2016-10-30 13:59:49 -07:00
f18a4b1601 WIP 2016-10-30 13:54:42 -07:00
426b8b1d87 WIP 2016-10-30 13:36:03 -07:00
537eebdf6d WIP 2016-10-30 13:32:12 -07:00
11 changed files with 214 additions and 76 deletions

40
.gitignore vendored Normal file
View File

@ -0,0 +1,40 @@
*.o
*.lo
*.la
*.html
.deps
.libs
Makefile
config.h
config.log
config.status
doc/Makefile
eb.conf
eb/Makefile
eb/build-post.h
eb/stamp-build-post-h
eb/stamp-sysdefs-h
eb/sysdefs.h
ebappendix/Makefile
ebappendix/ebappendix
ebfont/Makefile
ebfont/ebfont
ebinfo/Makefile
ebinfo/ebinfo
ebrefile/Makefile
ebrefile/ebrefile
ebstopcode/Makefile
ebstopcode/ebstopcode
ebzip/Makefile
ebzip/ebzip
libebutils/Makefile
libebutils/ebutils.h
libebutils/libebutils.a
libebutils/stamp-ebutils-h
libtool
m4/Makefile
po-eb/Makefile
po-ebutils/Makefile
samples/Makefile
stamp-h1

71
README
View File

@ -1,71 +0,0 @@
EB $B%i%$%V%i%j(B
CD-ROM $B=q@R$K%"%/%;%9$9$k$?$a$N(B C $B$N%i%$%V%i%j(B
EB $B%i%$%V%i%j$O(B CD-ROM $B=q@R$K%"%/%;%9$9$k$?$a$N(B C $B$N%i%$%V%i%j$G$9!#(B
UNIX $B7O(B OS $B$*$h$S(B Windows (2000$B0J9_(B) $B$N%7%9%F%`>e$GF0:n$5$;$k$3$H$,$G(B
$B$-$^$9!#(B($B$?$@$7!"(BWindows $B$G%3%s%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@RK\BN(B)
ebnet://<$B%[%9%H(B>:<$B%]!<%H(B>/<$B=q@RL>(B>.app ($BIUO?%Q%C%1!<%8(B)
<$B%[%9%H(B> $B$O1s3V%[%9%H$N(B IP $B%"%I%l%9$b$7$/$O%[%9%HL>$G$9!#$?$@$7!"(BIPv6
$B%"%I%l%9$r;XDj$9$k>l9g$O!"%"%I%l%9$r(B `[' $B$H(B `]' $B$G0O$`I,MW$,$"$j$^$9!#(B
<$B%]!<%H(B> $B$O!"$=$N%[%9%H$,BT$A<u$1$F$$$k%]!<%H$NHV9f$G$9!#%[%9%H$,BT$A(B
$B<u$1$F$$$k%]!<%H$,I8=`$N(B 22010 $BHV$G$"$l$P!"(B`:<$B%]!<%H(B>' $B$NItJ,$O>JN,2D(B
$BG=$G$9!#(B
$B0J2<$KNc$r5-$7$^$9!#(B
ebnet://eb.example.com/dict
ebnet://eb.example.com:22010/dict.app
ebnet://192.168.1.1/dict.app
ebnet://192.168.1.1:22010/dict
ebnet://[fe80::290:27ff:fe3]/dict.app
ebnet://[fe80::290:27ff:fe3]:22010/dict
$B1s3V%"%/%;%9$r9T$&$K$O!"(BEBNETD $B$r(B <$B%[%9%H(B> $B>e$K%$%s%9%H!<%k$9$kI,MW$,(B
$B$"$j$^$9!#(BEBNETD $B$O!"(BEB Library $BMQ$N1s3V%"%/%;%9%5!<%P$N%=%U%H%&%'%"(B
$B$G$9!#(B
EB $B%i%$%V%i%j$O%U%j!<%=%U%H%&%'%"$G$9!#%=!<%9%3!<%I$*$h$S%P%$%J%j$r!"(B
$B$$$o$f$k(B Modified BSD $B%i%$%;%s%9(B $B$N2<$G;HMQ$9$k$3$H$,2DG=$G$9!#(B
($B%P!<%8%g%s(B 4.1$B$h$j$bA0$N$b$N$O!"(BGPL $B$r:NMQ$7$F$$$^$7$?!#(B)
$B%i%$%;%s%9$K4X$7$F!">\$7$/$O(B COPYING $B$H$$$&1QJ8$N%U%!%$%k$r;2>H$7$F(B
$B2<$5$$!#(B
$B:G?7$N(B EB $B%i%$%V%i%j$O<!$N$H$3$m$+$iF~<j$G$-$^$9!#(B
ftp://ftp.sra.co.jp/pub/misc/eb/
EB $B%i%$%V%i%j$K4X$9$k>pJs$O<!$N$H$3$m$+$iF@$k$3$H$,$G$-$^$9!#(B
http://www.sra.co.jp/people/m-kasahr/eb/
$B%3%a%s%H$d%P%0$NJs9p$O(B
m-kasahr@sra.co.jp
$B08$K!"F|K\8l$+1Q8l$G$*Aw$j2<$5$$!#(B

13
README.md Normal file
View File

@ -0,0 +1,13 @@
# Eb #
This is a fork of the last known release of eb (a.k.a. eblib, libeb), version
4.4.3. It includes fixes for the Windows operating system as well as a
capability to dump all data out of EPWING dictionaries (as opposed to simply
executing search queries).
This modified library exists mostly for use by the
[Zero-EPWING](https://foosoft.net/projects/zero-epwing/) project.
## License ##
GPL

View File

@ -11,7 +11,7 @@ libeb_la_SOURCES = appendix.c appsub.c bcd.c binary.c bitmap.c book.c \
booklist.c copyright.c cross.c eb.c endword.c error.c exactword.c \ booklist.c copyright.c cross.c eb.c endword.c error.c exactword.c \
filename.c font.c hook.c jacode.c keyword.c lock.c log.c match.c \ filename.c font.c hook.c jacode.c keyword.c lock.c log.c match.c \
menu.c multi.c narwalt.c narwfont.c readtext.c search.c setword.c \ menu.c multi.c narwalt.c narwfont.c readtext.c search.c setword.c \
stopcode.c strcasecmp.c subbook.c text.c widealt.c widefont.c word.c \ stopcode.c strcasecmp.c subbook.c text.c widealt.c widefont.c word.c all.c \
zio.c $(libeb_ebnet_sources) zio.c $(libeb_ebnet_sources)
libeb_la_LDFLAGS = -no-undefined -version-info @LIBEB_VERSION_INFO@ \ libeb_la_LDFLAGS = -no-undefined -version-info @LIBEB_VERSION_INFO@ \
$(ZLIBLIBS) $(INTLLIBS) $(ZLIBLIBS) $(INTLLIBS)

View File

@ -65,7 +65,7 @@ am__libeb_la_SOURCES_DIST = appendix.c appsub.c bcd.c binary.c \
error.c exactword.c filename.c font.c hook.c jacode.c \ error.c exactword.c filename.c font.c hook.c jacode.c \
keyword.c lock.c log.c match.c menu.c multi.c narwalt.c \ keyword.c lock.c log.c match.c menu.c multi.c narwalt.c \
narwfont.c readtext.c search.c setword.c stopcode.c \ narwfont.c readtext.c search.c setword.c stopcode.c \
strcasecmp.c subbook.c text.c widealt.c widefont.c word.c \ strcasecmp.c subbook.c text.c widealt.c widefont.c word.c all.c \
zio.c ebnet.c multiplex.c linebuf.c urlparts.c getaddrinfo.c \ zio.c ebnet.c multiplex.c linebuf.c urlparts.c getaddrinfo.c \
dummyin6.c dummyin6.c
@ENABLE_EBNET_TRUE@am__objects_1 = ebnet.lo multiplex.lo linebuf.lo \ @ENABLE_EBNET_TRUE@am__objects_1 = ebnet.lo multiplex.lo linebuf.lo \
@ -76,7 +76,7 @@ am_libeb_la_OBJECTS = appendix.lo appsub.lo bcd.lo binary.lo bitmap.lo \
keyword.lo lock.lo log.lo match.lo menu.lo multi.lo narwalt.lo \ keyword.lo lock.lo log.lo match.lo menu.lo multi.lo narwalt.lo \
narwfont.lo readtext.lo search.lo setword.lo stopcode.lo \ narwfont.lo readtext.lo search.lo setword.lo stopcode.lo \
strcasecmp.lo subbook.lo text.lo widealt.lo widefont.lo \ strcasecmp.lo subbook.lo text.lo widealt.lo widefont.lo \
word.lo zio.lo $(am__objects_1) word.lo all.lo zio.lo $(am__objects_1)
libeb_la_OBJECTS = $(am_libeb_la_OBJECTS) libeb_la_OBJECTS = $(am_libeb_la_OBJECTS)
libeb_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ libeb_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(libeb_la_LDFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(libeb_la_LDFLAGS) \
@ -249,7 +249,7 @@ libeb_la_SOURCES = appendix.c appsub.c bcd.c binary.c bitmap.c book.c \
booklist.c copyright.c cross.c eb.c endword.c error.c exactword.c \ booklist.c copyright.c cross.c eb.c endword.c error.c exactword.c \
filename.c font.c hook.c jacode.c keyword.c lock.c log.c match.c \ filename.c font.c hook.c jacode.c keyword.c lock.c log.c match.c \
menu.c multi.c narwalt.c narwfont.c readtext.c search.c setword.c \ menu.c multi.c narwalt.c narwfont.c readtext.c search.c setword.c \
stopcode.c strcasecmp.c subbook.c text.c widealt.c widefont.c word.c \ stopcode.c strcasecmp.c subbook.c text.c widealt.c widefont.c word.c all.c \
zio.c $(libeb_ebnet_sources) zio.c $(libeb_ebnet_sources)
libeb_la_LDFLAGS = -no-undefined -version-info @LIBEB_VERSION_INFO@ \ libeb_la_LDFLAGS = -no-undefined -version-info @LIBEB_VERSION_INFO@ \

143
eb/all.c Normal file
View File

@ -0,0 +1,143 @@
/*
* Copyright (c) 2016 Alex Yatskov <alex@foosoft.net>
* Author: Alex Yatskov <alex@foosoft.net>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "build-pre.h"
#include "eb.h"
#include "error.h"
#include "build-post.h"
static int eb_match_all(const char word[], const char pattern[], size_t length) {
(void) word;
(void) pattern;
(void) length;
return 0;
}
static EB_Error_Code eb_search_all(EB_Book* book, EB_Word_Code word_code) {
EB_Error_Code error_code = EB_SUCCESS;
do {
eb_lock(&book->lock);
LOG(("in: eb_search_all(book=%d)", book->code));
/* Current subbook must have been set. */
if (book->subbook_current == NULL) {
error_code = EB_ERR_NO_CUR_SUB;
break;
}
/* Initialize search context. */
eb_reset_search_contexts(book);
EB_Search_Context* context = book->search_contexts;
context->code = EB_SEARCH_ALL;
context->compare_pre = eb_match_all;
context->compare_single = eb_match_all;
context->compare_group = eb_match_all;
/* Get a page number. */
switch (word_code) {
case EB_WORD_ALPHABET:
if (book->subbook_current->word_alphabet.start_page != 0) {
context->page = book->subbook_current->word_alphabet.start_page;
}
else {
error_code = EB_ERR_NO_SUCH_SEARCH;
}
break;
case EB_WORD_KANA:
if (book->subbook_current->word_kana.start_page != 0) {
context->page = book->subbook_current->word_kana.start_page;
}
else {
error_code = EB_ERR_NO_SUCH_SEARCH;
}
break;
case EB_WORD_OTHER:
if (book->subbook_current->word_asis.start_page != 0) {
context->page = book->subbook_current->word_asis.start_page;
}
else {
error_code = EB_ERR_NO_SUCH_SEARCH;
}
break;
default:
error_code = EB_ERR_NO_SUCH_SEARCH;
break;
}
if (error_code != EB_SUCCESS) {
break;
}
/* Pre-search. */
error_code = eb_presearch_word(book, context);
if (error_code != EB_SUCCESS) {
break;
}
}
while (0);
if (error_code != EB_SUCCESS) {
eb_reset_search_contexts(book);
}
LOG(("out: eb_search_all() = %s", eb_error_string(error_code)));
eb_unlock(&book->lock);
return error_code;
}
int eb_have_all_search(EB_Book* book) {
eb_lock(&book->lock);
LOG(("in: eb_have_all_search(book=%d)", book->code));
int result = 0;
for (;;) {
const EB_Subbook * sb = book->subbook_current;
if (sb == NULL) {
break;
}
if (sb->word_alphabet.start_page == 0 && sb->word_asis.start_page == 0 && sb->word_kana.start_page == 0) {
break;
}
result = 1;
break;
}
LOG(("out: eb_have_all_search() = %d", result));
eb_unlock(&book->lock);
return result;
}
EB_Error_Code eb_search_all_alphabet(EB_Book* book) {
return eb_search_all(book, EB_WORD_ALPHABET);
}
EB_Error_Code eb_search_all_kana(EB_Book* book) {
return eb_search_all(book, EB_WORD_KANA);
}
EB_Error_Code eb_search_all_asis(EB_Book* book) {
return eb_search_all(book, EB_WORD_OTHER);
}

View File

@ -107,6 +107,7 @@
#define EB_SEARCH_KEYWORD 3 #define EB_SEARCH_KEYWORD 3
#define EB_SEARCH_MULTI 4 #define EB_SEARCH_MULTI 4
#define EB_SEARCH_CROSS 5 #define EB_SEARCH_CROSS 5
#define EB_SEARCH_ALL 6
#define EB_SEARCH_NONE -1 #define EB_SEARCH_NONE -1
/* /*

View File

@ -29,6 +29,10 @@
#ifndef EB_BUILD_PRE_H #ifndef EB_BUILD_PRE_H
#define EB_BUILD_PRE_H #define EB_BUILD_PRE_H
#ifdef _WIN32
#define DOS_FILE_PATH
#endif
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"
#endif #endif

View File

@ -144,6 +144,12 @@ void eb_unset_subbook(EB_Book *book);
int eb_have_word_search(EB_Book *book); int eb_have_word_search(EB_Book *book);
EB_Error_Code eb_search_word(EB_Book *book, const char *input_word); EB_Error_Code eb_search_word(EB_Book *book, const char *input_word);
/* all.c */
int eb_have_all_search(EB_Book *book);
EB_Error_Code eb_search_all_alphabet(EB_Book* book);
EB_Error_Code eb_search_all_kana(EB_Book* book);
EB_Error_Code eb_search_all_asis(EB_Book* book);
/* for backward compatibility */ /* for backward compatibility */
#define eb_suspend eb_unset_subbook #define eb_suspend eb_unset_subbook
#define eb_initialize_all_subbooks eb_load_all_subbooks #define eb_initialize_all_subbooks eb_load_all_subbooks

View File

@ -434,6 +434,7 @@ eb_hit_list(EB_Book *book, int max_hit_count, EB_Hit *hit_list, int *hit_count)
switch (book->search_contexts->code) { switch (book->search_contexts->code) {
case EB_SEARCH_EXACTWORD: case EB_SEARCH_EXACTWORD:
case EB_SEARCH_WORD: case EB_SEARCH_WORD:
case EB_SEARCH_ALL:
case EB_SEARCH_ENDWORD: case EB_SEARCH_ENDWORD:
/* /*
* In case of exactword, word of endword search. * In case of exactword, word of endword search.

View File

@ -342,7 +342,6 @@ getopt(int nargc, char * const *nargv, const char *options)
} }
return retval; return retval;
} }
#endif
/* /*
* getopt_long -- * getopt_long --
@ -478,3 +477,5 @@ getopt_long(int nargc, char * const *nargv, const char *options,
} }
return retval; return retval;
} }
#endif