/* esecannaserver --- pseudo canna server that wraps another IME.
* Copyright (C) 1999-2000 Yasuhiro Take
*
* 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 2 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __vje_h__
#define __vje_h__
#define ESECANNA_MODULE_VERSION "VJE-Delta 3.0 1.0.1"
#define MAX_BUNSETU_NUM 80
#define MAX_CHAR_NUM 80
#define MAX_DOUONGO_NUM 768
#define DIC_NAME_SIZE 256
#define DIC_BUF_SIZE 1024
#define DIC_YOMI_BUF_SIZE 32
#define DIC_TANGO_BUF_SIZE 32
#define IN_BUF_SIZE (MAX_CHAR_NUM * 2 + 2)
#define HIRA_BUF_SIZE (MAX_CHAR_NUM * 2 + 3)
#define KEY_BUF_SIZE (MAX_CHAR_NUM * 2 + 1)
#define YOMI_BUF_SIZE (DIC_YOMI_BUF_SIZE * 2 + 2)
#define HYOUKI_BUF_SIZE (DIC_TANGO_BUF_SIZE * 2)
#define SELECT_LEN 7168
#define FRAME_LEN 500
#define LEN_OF_OLDBUF(_buf) (_buf[0])
#define LEN_OF_BUF(_buf) (_buf.len)
#define LEN_OF_BUFP(_buf) (_buf->len)
#define ADD_TO_BUF(_buf,_c) (_buf.str[++LEN_OF_BUF(_buf)] = (_c))
#define ADD_TO_BUFP(_buf,_c) (_buf->str[++LEN_OF_BUFP(_buf)] = (_c))
/* `500 *' の部分は `NUM_CHAR *' に変わる?
* str[0] は reserved のよう。
*/
typedef struct _large_buffer_t {
short len;
uchar str[500 * 2 + 3];
} buff_t, wbuff_t;
typedef struct _key_buffer_t {
short len;
uchar str[500 * 3 + 3];
} kbuff_t;
typedef struct _small_buffer_t {
short len;
uchar str[16 + 1];
} sbuff_t;
typedef struct _pwork_buffer_t {
short len;
uchar str[2];
} pbuff_t;
typedef struct {
uchar max_blk;
uchar blk_cnt;
ushort max_koho;
ushort koho_cnt;
short yomi_pnt;
short yomi_len;
short hyk_pnt;
short hyk_len;
ushort flg;
} vje_kouho_t;
typedef struct {
short error;
short total_yomi;
short max_bun;
short bun_cnt;
vje_kouho_t kouho[MAX_BUNSETU_NUM];
} buninf_t;
typedef struct {
short cnt;
short len;
uchar buf[DIC_BUF_SIZE * 4];
ushort flg[MAX_DOUONGO_NUM];
} doubufx_t;
/*
* vje_send_*_t vje_recv_*_t の定義
*/
typedef struct {
short funcno;
short vje_id;
} vje_send_any_t;
typedef struct {
short retvalue;
} vje_recv_any_t;
/* clear */
/* setmode */
typedef struct {
short funcno;
short vje_id;
short cnvmode1;
short cnvmode2;
short rank;
short loopcnt;
} vje_send_setmode_t;
/* sensemode */
typedef struct {
short retvalue;
short cnvmode1;
short cnvmode2;
short rank;
short loopcnt;
} vje_recv_sensemode_t;
/* henkanb */
typedef struct {
short funcno;
short vje_id;
short mode;
short cnvted;
uchar in_buf[IN_BUF_SIZE + 2];
uchar atrbuf[IN_BUF_SIZE * 2];
uchar keybuf[IN_BUF_SIZE + 2];
} vje_send_henkanb_t;
typedef struct {
short retvalue;
uchar in_buf[IN_BUF_SIZE + 2];
uchar atrbuf[IN_BUF_SIZE * 2];
uchar keybuf[IN_BUF_SIZE + 2];
} vje_recv_henkanb_t;
/* get_koho_all */
typedef struct {
short funcno;
short vje_id;
uchar buninf[sizeof(buninf_t)];
uchar buf[IN_BUF_SIZE + 2];
} vje_send_get_koho_all_t;
typedef struct {
short retvalue;
uchar buninf[sizeof(buninf_t)];
uchar buf[IN_BUF_SIZE + 2];
} vje_recv_get_koho_all_t;
/* ji_bunsetu */
/* zen_bunsetu */
/* set_koho_bno */
typedef struct {
short funcno;
short vje_id;
short bno;
} vje_send_set_koho_bno_t;
/* get_koho_bno */
typedef struct {
short bno;
} vje_recv_get_koho_bno_t;
/* ji_block */
/* zen_block */
/* set_koho */
typedef struct {
short funcno;
short vje_id;
short p;
} vje_send_set_koho_t;
/* get_douon_t */
typedef struct {
short funcno;
short vje_id;
uchar doubufx[sizeof(doubufx_t)];
} vje_send_get_douon_t;
typedef struct {
uchar doubufx[sizeof(doubufx_t)];
} vje_recv_get_douon_t;
/* saihenkan */
typedef struct {
short funcno;
short vje_id;
uchar in_buf[IN_BUF_SIZE + 2];
short nbun;
short len2;
short len;
short mode;
} vje_send_saihenkan_t;
typedef struct {
short retvalue;
uchar in_buf[IN_BUF_SIZE + 2];
} vje_recv_saihenkan_t;
/* kakutei1 */
typedef struct {
short funcno;
short vje_id;
uchar hira_buf[HIRA_BUF_SIZE + 2];
uchar key_buf[KEY_BUF_SIZE + 2];
} vje_send_kakutei1_t;
typedef struct {
short retvalue;
uchar hira_buf[HIRA_BUF_SIZE + 2];
uchar key_buf[KEY_BUF_SIZE + 2];
} vje_recv_kakutei1_t;
/* get_koho2 */
typedef struct {
short funcno;
short vje_id;
uchar yomi[YOMI_BUF_SIZE];
uchar hyouki[HYOUKI_BUF_SIZE];
} vje_send_get_koho2_t;
typedef struct {
short retvalue;
uchar yomi[YOMI_BUF_SIZE];
uchar hyouki[HYOUKI_BUF_SIZE];
} vje_recv_get_koho2_t;
/* vjelibopen */
/* vjelibclose */
/* open_sdic */
typedef struct {
short funcno;
short vje_id;
short dic_id;
short mode;
uchar dicname[DIC_NAME_SIZE];
} vje_send_open_sdic_t;
/* close_sdic */
typedef struct {
short funcno;
short vje_id;
short dic_id;
} vje_send_close_sdic_t;
/* chg_sdic */
typedef struct {
short funcno;
short vje_id;
short dic_id;
} vje_send_chg_sdic_t;
/* set_clienthostname */
typedef struct {
short funcno;
uchar hostname[128 + 2];
} vje_send_set_clienthostname_t;
typedef struct {
short funcno;
short vje_id;
uchar in_buf[IN_BUF_SIZE + 2];
uchar atrbuf[IN_BUF_SIZE * 2];
uchar keybuf[IN_BUF_SIZE + 2];
} vje_send_set_kihonbuff_t;
typedef struct {
short funcno;
short vje_id;
uchar fname[DIC_NAME_SIZE];
uchar uname[DIC_NAME_SIZE];
} vje_send_vroomaji_open_t;
typedef struct {
short funcno;
short vje_id;
uchar fname[DIC_NAME_SIZE];
} vje_send_open_kanji_table_t;
typedef union {
uchar byte[SELECT_LEN];
vje_send_any_t s_any;
vje_recv_any_t r_any;
vje_send_setmode_t s_setmode;
vje_recv_sensemode_t r_sensemode;
vje_send_henkanb_t s_henkanb;
vje_recv_henkanb_t r_henkanb;
vje_send_get_koho_all_t s_get_koho_all;
vje_recv_get_koho_all_t r_get_koho_all;
vje_send_set_koho_bno_t s_set_koho_bno;
vje_recv_get_koho_bno_t r_get_koho_bno;
vje_send_set_koho_t s_set_koho;
vje_send_get_douon_t s_get_douon;
vje_recv_get_douon_t r_get_douon;
vje_send_saihenkan_t s_saihenkan;
vje_recv_saihenkan_t r_saihenkan;
vje_send_kakutei1_t s_kakutei1;
vje_recv_kakutei1_t r_kakutei1;
vje_send_get_koho2_t s_get_koho2;
vje_recv_get_koho2_t r_get_koho2;
vje_send_open_sdic_t s_open_sdic;
vje_send_close_sdic_t s_close_sdic;
vje_send_chg_sdic_t s_chg_sdic;
vje_send_set_clienthostname_t s_set_clienthostname;
vje_send_set_kihonbuff_t s_set_kihonbuff;
vje_send_vroomaji_open_t s_vroomaji_open;
vje_send_open_kanji_table_t s_open_kanji_table;
} vje_request_t;
void vje_proto_clear(short vje_id);
void vje_proto_setmode(short vje_id, short cnvmode1, short cnvmode2,
short rank, short loop_cnt);
int vje_proto_sensemode(short vje_id, short *cnvmode1, short *cnvmode2,
short *rank, short *loop_cnt);
int vje_proto_henkanb(short vje_id, buff_t *in_buf,ushort *atr_buf,
kbuff_t *key_buf, short *mode, short cnvted);
int vje_proto_toku_henkan();
int vje_proto_get_koho_all(short vje_id, buninf_t *buninf, buff_t *buf);
int vje_proto_ji_bunsetu(short vje_id);
int vje_proto_zen_bunsetu(short vje_id);
void vje_proto_set_koho_bno(short vje_fd, short bno);
short vje_proto_get_koho_bno(short vje_id);
short vje_proto_ji_block(short vje_id);
short vje_proto_zen_block(short vje_id);
void vje_proto_set_koho(short vje_id, short p);
void vje_proto_get_douon(short vje_id, doubufx_t *douon);
short vje_proto_saihenkan(short vje_id, buff_t *in_buf, short nbun, short len2,
short len, short mode);
short vje_proto_kakutei1(short vje_id, buff_t *hira_buf, buff_t *key_buf);
short vje_proto_kakutei2(short vje_id, buff_t *hira_buf, buff_t *key_buf);
void vje_proto_finish_session();
short vje_proto_get_koho2(short vje_id, uchar *yomi, uchar *hyouki);
short vje_proto_vjelibopen();
short vje_proto_vjelibclose(short vje_id);
short vje_proto_open_sdic(short vje_id, short dic_id, uchar *dicname,
short mode);
short vje_proto_close_sdic(short vje_id, short dic_id);
short vje_proto_chg_sdic(short vje_id, short dic_id);
void vje_proto_loadcoderange();
int vje_proto_set_clienthostname(char *name);
void vje_proto_set_kihonbuff(short vje_id, buff_t *in_buf, ushort *atrbuf,
kbuff_t *keybuf);
void vje_proto_vroomaji_open(short vje_id, uchar *fname, uchar *uname);
void vje_proto_open_kanji_table(short vje_id, uchar *fname);
#endif
syntax highlighted by Code2HTML, v. 0.9.1