From fb8f86dde1b53ff878092f8402479e9a4c5b110e Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Mon, 21 Nov 2016 08:59:06 -0800 Subject: [PATCH] WIP --- gaiji.c | 14 ++++++++++++++ gaiji.h | 11 +++++++++++ 2 files changed, 25 insertions(+) diff --git a/gaiji.c b/gaiji.c index 93b788e..0fb76e9 100644 --- a/gaiji.c +++ b/gaiji.c @@ -18,6 +18,7 @@ #include #include +#include #include #include "util.h" @@ -207,3 +208,16 @@ void gaiji_stub_decode(char output[], int size, const char input[]) { *ptr_out = 0; } + +bool gaiji_context_init(Gaiji_Context* context, const char path[]) { + (void)path; + context->count = 0; + context->tables = NULL; + return true; +} + +void gaiji_context_destroy(Gaiji_Context* context) { + free(context->tables); + context->tables = NULL; + context->count = 0; +} diff --git a/gaiji.h b/gaiji.h index 01da232..668f1ea 100644 --- a/gaiji.h +++ b/gaiji.h @@ -19,6 +19,8 @@ #ifndef GAIJI_H #define GAIJI_H +#include + /* * Constants */ @@ -44,6 +46,11 @@ typedef struct { int count_narrow; } Gaiji_Table; +typedef struct { + Gaiji_Table* tables; + int count; +} Gaiji_Context; + typedef enum { GAIJI_WIDTH_WIDE, GAIJI_WIDTH_NARROW, @@ -53,7 +60,11 @@ typedef enum { * Functions */ +bool gaiji_context_init(Gaiji_Context* context, const char path[]); +void gaiji_context_destroy(Gaiji_Context* context); + const Gaiji_Table* gaiji_table_select(const char name[]); + void gaiji_stub_encode(char output[], int size, int code, const Gaiji_Table* table, Gaiji_Width width); void gaiji_stub_decode(char output[], int size, const char input[]);