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
|
* 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) {
|
for (unsigned i = 0; i < ARRSIZE(gaiji_contexts); ++i) {
|
||||||
const Gaiji_Context* context = gaiji_contexts + i;
|
const Gaiji_Context* context = gaiji_contexts + i;
|
||||||
if (strcmp(context->name, name) == 0) {
|
if (strcmp(context->name, name) == 0) {
|
||||||
@ -116,7 +116,7 @@ const Gaiji_Context* gaiji_select_context(const char name[]) {
|
|||||||
return NULL;
|
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 {
|
do {
|
||||||
if (context == NULL) {
|
if (context == NULL) {
|
||||||
break;
|
break;
|
||||||
@ -153,7 +153,7 @@ void gaiji_build_stub(char output[], int size, int code, const Gaiji_Context* co
|
|||||||
output[size - 1] = 0;
|
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;
|
const char* ptr_in = input;
|
||||||
char* ptr_out = output;
|
char* ptr_out = output;
|
||||||
bool decode = false;
|
bool decode = false;
|
||||||
|
6
gaiji.h
6
gaiji.h
@ -53,8 +53,8 @@ typedef enum {
|
|||||||
* Functions
|
* Functions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const Gaiji_Context* gaiji_select_context(const char name[]);
|
const Gaiji_Context* gaiji_context_select(const char name[]);
|
||||||
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);
|
||||||
void gaiji_fixup_stub(char output[], int size, const char input[]);
|
void gaiji_stub_decode(char output[], int size, const char input[]);
|
||||||
|
|
||||||
#endif /* GAIJI_H */
|
#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);
|
assert(argc > 0);
|
||||||
char stub[MAX_STUB_BYTES];
|
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);
|
eb_write_text_string(book, stub);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -126,7 +126,7 @@ static EB_Error_Code hook_wide_font( /* EB_HOOK_WIDE_FONT */
|
|||||||
|
|
||||||
assert(argc > 0);
|
assert(argc > 0);
|
||||||
char stub[MAX_STUB_BYTES];
|
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);
|
eb_write_text_string(book, stub);
|
||||||
|
|
||||||
return 0;
|
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];
|
char title[EB_MAX_TITLE_LENGTH + 1];
|
||||||
if (eb_subbook_title(eb_book, title) == EB_SUCCESS) {
|
if (eb_subbook_title(eb_book, title) == EB_SUCCESS) {
|
||||||
subbook->title = eucjp_to_utf8(title);
|
subbook->title = eucjp_to_utf8(title);
|
||||||
context = *gaiji_select_context(subbook->title);
|
context = *gaiji_context_select(subbook->title);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (eb_have_copyright(eb_book)) {
|
if (eb_have_copyright(eb_book)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user