1
This commit is contained in:
Alex Yatskov 2016-11-21 08:59:06 -08:00
parent a2b6d36fe7
commit fb8f86dde1
2 changed files with 25 additions and 0 deletions

14
gaiji.c
View File

@ -18,6 +18,7 @@
#include <string.h>
#include <stdbool.h>
#include <stdlib.h>
#include <assert.h>
#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;
}

11
gaiji.h
View File

@ -19,6 +19,8 @@
#ifndef GAIJI_H
#define GAIJI_H
#include <stdbool.h>
/*
* 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[]);