1
zero-epwing/gaiji.c

81 lines
1.9 KiB
C
Raw Normal View History

2016-11-19 20:23:06 +00:00
/*
* Copyright (C) 2016 Alex Yatskov <alex@foosoft.net>
* Author: Alex Yatskov <alex@foosoft.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
2016-11-20 02:14:55 +00:00
#include <string.h>
2016-11-19 20:23:06 +00:00
#include "eb/eb/eb.h"
#include "eb/eb/text.h"
2016-11-20 02:14:55 +00:00
#include "util.h"
2016-11-19 20:23:06 +00:00
#include "gaiji.h"
2016-11-20 02:14:55 +00:00
/*
* Macros
*/
#define GAIJI_TABLE(name, ents) {\
name,\
gaiji_table_##ents##_wide,\
ARRSIZE(gaiji_table_##ents##_wide),\
gaiji_table_##ents##_narrow,\
ARRSIZE(gaiji_table_##ents##_narrow)\
}
2016-11-20 01:53:24 +00:00
/*
* Local data
*/
#include "gaiji_table_daijisen.h"
2016-11-20 02:14:55 +00:00
static const Gaiji_table gaiji_tables[] = {
GAIJI_TABLE("大辞泉", daijisen),
};
2016-11-19 20:23:06 +00:00
/*
* Exported functions
*/
2016-11-20 02:14:55 +00:00
const Gaiji_table * gaiji_select_table(const char title[]) {
for (unsigned i = 0; i < ARRSIZE(gaiji_tables); ++i) {
const Gaiji_table* table = gaiji_tables + i;
if (strcmp(table->title, title) == 0) {
return table;
}
}
return NULL;
2016-11-20 01:53:24 +00:00
}
2016-11-20 02:14:55 +00:00
void gaiji_build_stub(char text[MAX_STUB_BYTES], int code, const Gaiji_table* table, Gaiji_width width) {
if (table == NULL) {
strcpy(text, "<?>");
return;
}
2016-11-19 20:23:06 +00:00
(void)code;
(void)text;
2016-11-20 02:14:55 +00:00
(void)table;
2016-11-19 20:23:06 +00:00
(void)width;
}
2016-11-20 02:14:55 +00:00
void gaiji_fixup_stub(char output[], int size, const char input[]) {
2016-11-19 20:23:06 +00:00
(void)output;
(void)size;
(void)input;
}