WIP
This commit is contained in:
parent
10cabbe554
commit
07021c4a5d
5
hooks.c
5
hooks.c
@ -221,5 +221,8 @@ static const EB_Hook s_hooks[] = {
|
||||
*/
|
||||
|
||||
void hooks_install(EB_Hookset* hookset) {
|
||||
(void)hookset;
|
||||
const int count = sizeof(s_hooks) / sizeof(s_hooks[0]);
|
||||
for (int i = 0; i < count; ++i) {
|
||||
eb_set_hook(hookset, s_hooks + i);
|
||||
}
|
||||
}
|
||||
|
3
hooks.h
3
hooks.h
@ -19,5 +19,8 @@
|
||||
#ifndef HOOKS_H
|
||||
#define HOOKS_H
|
||||
|
||||
#include "eb/eb/eb.h"
|
||||
|
||||
void hooks_install(EB_Hookset* hookset);
|
||||
|
||||
#endif
|
||||
|
8
main.c
8
main.c
@ -23,8 +23,10 @@
|
||||
|
||||
#include "convert.h"
|
||||
#include "util.h"
|
||||
#include "hooks.h"
|
||||
|
||||
#include "eb/eb/eb.h"
|
||||
#include "eb/text.h"
|
||||
#include "eb/eb/error.h"
|
||||
|
||||
#define MAX_HITS 256
|
||||
@ -96,9 +98,14 @@ static void export_book(const char path[], Book* book) {
|
||||
EB_Book eb_book;
|
||||
eb_initialize_book(&eb_book);
|
||||
|
||||
EB_Hookset eb_hookset;
|
||||
eb_initialize_hookset(&eb_hookset);
|
||||
hooks_install(&eb_hookset);
|
||||
|
||||
if ((error = eb_bind(&eb_book, path)) != EB_SUCCESS) {
|
||||
fprintf(stderr, "Failed to bind book: %s\n", eb_error_message(error));
|
||||
eb_finalize_book(&eb_book);
|
||||
eb_finalize_hookset(&eb_hookset);
|
||||
eb_finalize_library();
|
||||
break;
|
||||
}
|
||||
@ -156,6 +163,7 @@ static void export_book(const char path[], Book* book) {
|
||||
}
|
||||
|
||||
eb_finalize_book(&eb_book);
|
||||
eb_finalize_hookset(&eb_hookset);
|
||||
eb_finalize_library();
|
||||
}
|
||||
while(0);
|
||||
|
Loading…
Reference in New Issue
Block a user