WIP
This commit is contained in:
parent
f6a10aecc2
commit
3aeee4b0ee
6
gaiji.c
6
gaiji.c
@ -105,7 +105,7 @@ static void encode_sequence(char output[], int size, const char utf8[]) {
|
||||
* Exported functions
|
||||
*/
|
||||
|
||||
const Gaiji_Context* gaiji_select_context(const char name[]) {
|
||||
const Gaiji_Context* gaiji_context_select(const char name[]) {
|
||||
for (unsigned i = 0; i < ARRSIZE(gaiji_contexts); ++i) {
|
||||
const Gaiji_Context* context = gaiji_contexts + i;
|
||||
if (strcmp(context->name, name) == 0) {
|
||||
@ -116,7 +116,7 @@ const Gaiji_Context* gaiji_select_context(const char name[]) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void gaiji_build_stub(char output[], int size, int code, const Gaiji_Context* context, Gaiji_Width width) {
|
||||
void gaiji_stub_encode(char output[], int size, int code, const Gaiji_Context* context, Gaiji_Width width) {
|
||||
do {
|
||||
if (context == NULL) {
|
||||
break;
|
||||
@ -153,7 +153,7 @@ void gaiji_build_stub(char output[], int size, int code, const Gaiji_Context* co
|
||||
output[size - 1] = 0;
|
||||
}
|
||||
|
||||
void gaiji_fixup_stub(char output[], int size, const char input[]) {
|
||||
void gaiji_stub_decode(char output[], int size, const char input[]) {
|
||||
const char* ptr_in = input;
|
||||
char* ptr_out = output;
|
||||
bool decode = false;
|
||||
|
10
gaiji.h
10
gaiji.h
@ -23,8 +23,8 @@
|
||||
* Constants
|
||||
*/
|
||||
|
||||
#define MAX_UTF8_BYTES 9
|
||||
#define MAX_STUB_BYTES 32
|
||||
#define MAX_UTF8_BYTES 9
|
||||
#define MAX_STUB_BYTES 32
|
||||
#define MAX_CONTEXT_NAME 256
|
||||
|
||||
/*
|
||||
@ -53,8 +53,8 @@ typedef enum {
|
||||
* Functions
|
||||
*/
|
||||
|
||||
const Gaiji_Context* gaiji_select_context(const char name[]);
|
||||
void gaiji_build_stub(char output[], int size, int code, const Gaiji_Context* context, Gaiji_Width width);
|
||||
void gaiji_fixup_stub(char output[], int size, const char input[]);
|
||||
const Gaiji_Context* gaiji_context_select(const char name[]);
|
||||
void gaiji_stub_encode(char output[], int size, int code, const Gaiji_Context* context, Gaiji_Width width);
|
||||
void gaiji_stub_decode(char output[], int size, const char input[]);
|
||||
|
||||
#endif /* GAIJI_H */
|
||||
|
4
hooks.c
4
hooks.c
@ -107,7 +107,7 @@ static EB_Error_Code hook_narrow_font( /* EB_HOOK_NARROW_FONT */
|
||||
|
||||
assert(argc > 0);
|
||||
char stub[MAX_STUB_BYTES];
|
||||
gaiji_build_stub(stub, ARRSIZE(stub), argv[0], container, GAIJI_WIDTH_NARROW);
|
||||
gaiji_stub_encode(stub, ARRSIZE(stub), argv[0], container, GAIJI_WIDTH_NARROW);
|
||||
eb_write_text_string(book, stub);
|
||||
|
||||
return 0;
|
||||
@ -126,7 +126,7 @@ static EB_Error_Code hook_wide_font( /* EB_HOOK_WIDE_FONT */
|
||||
|
||||
assert(argc > 0);
|
||||
char stub[MAX_STUB_BYTES];
|
||||
gaiji_build_stub(stub, ARRSIZE(stub), argv[0], container, GAIJI_WIDTH_WIDE);
|
||||
gaiji_stub_encode(stub, ARRSIZE(stub), argv[0], container, GAIJI_WIDTH_WIDE);
|
||||
eb_write_text_string(book, stub);
|
||||
|
||||
return 0;
|
||||
|
2
main.c
2
main.c
@ -79,7 +79,7 @@ static void export_subbook(Subbook* subbook, EB_Book* eb_book, EB_Hookset* eb_ho
|
||||
char title[EB_MAX_TITLE_LENGTH + 1];
|
||||
if (eb_subbook_title(eb_book, title) == EB_SUCCESS) {
|
||||
subbook->title = eucjp_to_utf8(title);
|
||||
context = *gaiji_select_context(subbook->title);
|
||||
context = *gaiji_context_select(subbook->title);
|
||||
}
|
||||
|
||||
if (eb_have_copyright(eb_book)) {
|
||||
|
Loading…
Reference in New Issue
Block a user