diff --git a/gaiji.c b/gaiji.c index 4e84a64..3e81bb4 100644 --- a/gaiji.c +++ b/gaiji.c @@ -40,7 +40,7 @@ #include "gaiji_table_daijisen.h" -static const Gaiji_context gaiji_contexts[] = { +static const Gaiji_Context gaiji_contexts[] = { GAIJI_CONTEXT("大辞泉", daijisen), }; @@ -84,9 +84,9 @@ 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_select_context(const char name[]) { 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) { return context; } @@ -95,13 +95,13 @@ 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_build_stub(char output[], int size, int code, const Gaiji_Context* context, Gaiji_Width width) { do { if (context == NULL) { break; } - const Gaiji_entry* entries = NULL; + const Gaiji_Entry* entries = NULL; int count = 0; switch (width) { @@ -118,7 +118,7 @@ void gaiji_build_stub(char output[], int size, int code, const Gaiji_context* co assert(entries != NULL); for (int i = 0; i < count; ++i) { - const Gaiji_entry* entry = entries + i; + const Gaiji_Entry* entry = entries + i; if (entry->code == code) { encode_sequence(output, size, entry->utf8); return; diff --git a/gaiji.h b/gaiji.h index 2fbf15a..00de47c 100644 --- a/gaiji.h +++ b/gaiji.h @@ -25,7 +25,7 @@ #define MAX_UTF8_BYTES 9 #define MAX_STUB_BYTES 32 -#define MAX_TABLE_NAME 256 +#define MAX_CONTEXT_NAME 256 /* * Types @@ -34,27 +34,27 @@ typedef struct { int code; char utf8[MAX_UTF8_BYTES]; -} Gaiji_entry; +} Gaiji_Entry; typedef struct { - char name[MAX_TABLE_NAME]; - const Gaiji_entry* table_wide; + char name[MAX_CONTEXT_NAME]; + const Gaiji_Entry* table_wide; int count_wide; - const Gaiji_entry* table_narrow; + const Gaiji_Entry* table_narrow; int count_narrow; -} Gaiji_context; +} Gaiji_Context; typedef enum { GAIJI_WIDTH_WIDE, GAIJI_WIDTH_NARROW, -} Gaiji_width; +} Gaiji_Width; /* * 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); +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[]); #endif /* GAIJI_H */ diff --git a/gaiji_table_daijisen.h b/gaiji_table_daijisen.h index 995939f..d3ea8a0 100644 --- a/gaiji_table_daijisen.h +++ b/gaiji_table_daijisen.h @@ -22,7 +22,7 @@ #include "gaiji.h" -static const Gaiji_entry gaiji_table_daijisen_narrow[] = { +static const Gaiji_Entry gaiji_table_daijisen_narrow[] = { { 0xA121, { 0xC2, 0xA0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, /*   */ { 0xA122, { 0xC2, 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, /* ¡ */ { 0xA123, { 0xC2, 0xA2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, /* ¢ */ @@ -252,7 +252,7 @@ static const Gaiji_entry gaiji_table_daijisen_narrow[] = { { 0xA34F, { 0xCB, 0x9C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, /* ˜ */ }; -static const Gaiji_entry gaiji_table_daijisen_wide[] = { +static const Gaiji_Entry gaiji_table_daijisen_wide[] = { { 0xB322, { 0xE3, 0x8B, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, /* ㋘ cb4960 */ { 0xB323, { 0xE3, 0x8B, 0x99, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, /* ㋙ cb4960 */ { 0xB324, { 0xE3, 0x8B, 0x9A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, /* ㋚ cb4960 */ diff --git a/main.c b/main.c index a94b469..d485fab 100644 --- a/main.c +++ b/main.c @@ -32,7 +32,7 @@ * Local functions */ -static void export_subbook_entries(Subbook* subbook, EB_Book* eb_book, EB_Hookset* eb_hookset, Gaiji_context* context) { +static void export_subbook_entries(Subbook* subbook, EB_Book* eb_book, EB_Hookset* eb_hookset, Gaiji_Context* context) { if (subbook->entry_cap == 0) { subbook->entry_cap = 16384; subbook->entries = malloc(subbook->entry_cap * sizeof(Entry)); @@ -75,7 +75,7 @@ static void export_subbook_entries(Subbook* subbook, EB_Book* eb_book, EB_Hookse } static void export_subbook(Subbook* subbook, EB_Book* eb_book, EB_Hookset* eb_hookset) { - Gaiji_context context = {}; + Gaiji_Context context = {}; char title[EB_MAX_TITLE_LENGTH + 1]; if (eb_subbook_title(eb_book, title) == EB_SUCCESS) { subbook->title = eucjp_to_utf8(title); diff --git a/util.c b/util.c index 2958b42..d0de669 100644 --- a/util.c +++ b/util.c @@ -79,7 +79,7 @@ static void encode_book(Book* book, json_t* book_json) { * Exported functions */ -char* read_book_data(EB_Book* book, EB_Hookset* hookset, Gaiji_context* context, const EB_Position* position, ReadMode mode) { +char* read_book_data(EB_Book* book, EB_Hookset* hookset, Gaiji_Context* context, const EB_Position* position, Read_Mode mode) { if (eb_seek_text(book, position) != EB_SUCCESS) { return NULL; } diff --git a/util.h b/util.h index ad9e23e..5559ddb 100644 --- a/util.h +++ b/util.h @@ -40,7 +40,7 @@ typedef struct { char* heading; char* text; -} TextBlock; +} Text_Block; typedef struct { char* heading; @@ -67,13 +67,13 @@ typedef struct { typedef enum { READ_MODE_TEXT, READ_MODE_HEADING, -} ReadMode; +} Read_Mode; /* * Functions */ -char* read_book_data(EB_Book* book, EB_Hookset* hookset, Gaiji_context* context, const EB_Position* position, ReadMode mode); +char* read_book_data(EB_Book* book, EB_Hookset* hookset, Gaiji_Context* context, const EB_Position* position, Read_Mode mode); void free_book(Book* book); void dump_book(Book* book, bool pretty_print, FILE* fp);