KNF
Formatter: knfmt 4.2.0 Signed-off-by: Masanori Ogino <mogino@acm.org>
This commit is contained in:
parent
30ce025382
commit
a7ba8b5e60
1 changed files with 122 additions and 143 deletions
179
sj3lib.h
179
sj3lib.h
|
|
@ -35,8 +35,6 @@
|
||||||
#define SJ3_NORMAL_END 0
|
#define SJ3_NORMAL_END 0
|
||||||
#define SJ3_SERVER_DEAD (1 << 0)
|
#define SJ3_SERVER_DEAD (1 << 0)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define SJ3_CONNECT_ERROR (1 << 1)
|
#define SJ3_CONNECT_ERROR (1 << 1)
|
||||||
#define SJ3_ALREADY_CONNECTED (1 << 2)
|
#define SJ3_ALREADY_CONNECTED (1 << 2)
|
||||||
#define SJ3_CANNOT_OPEN_MDICT (1 << 3)
|
#define SJ3_CANNOT_OPEN_MDICT (1 << 3)
|
||||||
|
|
@ -46,8 +44,6 @@
|
||||||
#define SJ3_CANNOT_MAKE_UDICT (1 << 7)
|
#define SJ3_CANNOT_MAKE_UDICT (1 << 7)
|
||||||
#define SJ3_CANNOT_MAKE_STUDY (1 << 8)
|
#define SJ3_CANNOT_MAKE_STUDY (1 << 8)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define SJ3_DISCONNECT_ERROR (1 << 1)
|
#define SJ3_DISCONNECT_ERROR (1 << 1)
|
||||||
#define SJ3_NOT_CONNECTED (1 << 2)
|
#define SJ3_NOT_CONNECTED (1 << 2)
|
||||||
#define SJ3_NOT_OPENED_MDICT (1 << 3)
|
#define SJ3_NOT_OPENED_MDICT (1 << 3)
|
||||||
|
|
@ -57,8 +53,6 @@
|
||||||
#define SJ3_CLOSE_UDICT_ERROR (1 << 7)
|
#define SJ3_CLOSE_UDICT_ERROR (1 << 7)
|
||||||
#define SJ3_CLOSE_STUDY_ERROR (1 << 8)
|
#define SJ3_CLOSE_STUDY_ERROR (1 << 8)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define SJ3_DICT_ERROR 1
|
#define SJ3_DICT_ERROR 1
|
||||||
#define SJ3_DICT_LOCKED 2
|
#define SJ3_DICT_LOCKED 2
|
||||||
#define SJ3_BAD_YOMI_STR 3
|
#define SJ3_BAD_YOMI_STR 3
|
||||||
|
|
@ -74,49 +68,33 @@
|
||||||
#define SJ3_WORD_NOT_EXIST 6
|
#define SJ3_WORD_NOT_EXIST 6
|
||||||
#define SJ3_SYOUKYO_FAILED 10
|
#define SJ3_SYOUKYO_FAILED 10
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define SJ3_IKKATU_YOMI 512
|
#define SJ3_IKKATU_YOMI 512
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define SJ3_BUNSETU_YOMI 128
|
#define SJ3_BUNSETU_YOMI 128
|
||||||
#define SJ3_BUNSETU_KANJI 512
|
#define SJ3_BUNSETU_KANJI 512
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef SJ3_WORD_ID_SIZE
|
#ifndef SJ3_WORD_ID_SIZE
|
||||||
# define SJ3_WORD_ID_SIZE 32
|
#define SJ3_WORD_ID_SIZE 32
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct studyrec {
|
typedef struct studyrec {
|
||||||
unsigned char dummy[SJ3_WORD_ID_SIZE];
|
unsigned char dummy[SJ3_WORD_ID_SIZE];
|
||||||
} SJ3_STUDYREC;
|
} SJ3_STUDYREC;
|
||||||
|
|
||||||
|
typedef struct bunsetu {
|
||||||
|
int srclen;
|
||||||
|
int destlen;
|
||||||
typedef struct bunsetu {
|
|
||||||
int srclen;
|
|
||||||
int destlen;
|
|
||||||
unsigned char *srcstr;
|
unsigned char *srcstr;
|
||||||
unsigned char *deststr;
|
unsigned char *deststr;
|
||||||
struct studyrec dcid;
|
struct studyrec dcid;
|
||||||
} SJ3_BUNSETU;
|
} SJ3_BUNSETU;
|
||||||
|
|
||||||
|
typedef struct douon {
|
||||||
|
|
||||||
typedef struct douon {
|
|
||||||
unsigned char ddata[SJ3_BUNSETU_KANJI];
|
unsigned char ddata[SJ3_BUNSETU_KANJI];
|
||||||
int dlen;
|
int dlen;
|
||||||
SJ3_STUDYREC dcid;
|
SJ3_STUDYREC dcid;
|
||||||
} SJ3_DOUON;
|
} SJ3_DOUON;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define SJ3_H_NRMNOUN 1
|
#define SJ3_H_NRMNOUN 1
|
||||||
#define SJ3_H_PRONOUN 12
|
#define SJ3_H_PRONOUN 12
|
||||||
#define SJ3_H_LNAME 21
|
#define SJ3_H_LNAME 21
|
||||||
|
|
@ -146,101 +124,102 @@ typedef struct douon {
|
||||||
#define SJ3_H_WAVERB 99
|
#define SJ3_H_WAVERB 99
|
||||||
#define SJ3_H_SINGLE 189
|
#define SJ3_H_SINGLE 189
|
||||||
|
|
||||||
|
typedef struct sj3_client_env {
|
||||||
typedef struct sj3_client_env {
|
|
||||||
int fd;
|
int fd;
|
||||||
int serv_dead_flg;
|
int serv_dead_flg;
|
||||||
int stdy_size;
|
int stdy_size;
|
||||||
short svr_version;
|
short svr_version;
|
||||||
short cli_version;
|
short cli_version;
|
||||||
char default_char[2];
|
char default_char[2];
|
||||||
} SJ3_CLIENT_ENV;
|
} SJ3_CLIENT_ENV;
|
||||||
|
|
||||||
#ifndef SJ3_NAME_LENGTH
|
#ifndef SJ3_NAME_LENGTH
|
||||||
# define SJ3_NAME_LENGTH 128
|
#define SJ3_NAME_LENGTH 128
|
||||||
#endif
|
#endif
|
||||||
typedef struct sj3_who_struct {
|
typedef struct sj3_who_struct {
|
||||||
int fd;
|
int fd;
|
||||||
char hostname[SJ3_NAME_LENGTH];
|
char hostname[SJ3_NAME_LENGTH];
|
||||||
char username[SJ3_NAME_LENGTH];
|
char username[SJ3_NAME_LENGTH];
|
||||||
char progname[SJ3_NAME_LENGTH];
|
char progname[SJ3_NAME_LENGTH];
|
||||||
} SJ3_WHO_STRUCT;
|
} SJ3_WHO_STRUCT;
|
||||||
|
|
||||||
|
|
||||||
#define MBCODE_SJIS 1
|
#define MBCODE_SJIS 1
|
||||||
#define MBCODE_EUC 2
|
#define MBCODE_EUC 2
|
||||||
|
|
||||||
/* level1.c */
|
/* level1.c */
|
||||||
void sj3_set_timeout(int timeout);
|
void sj3_set_timeout(int);
|
||||||
int sj3_make_connection(SJ3_CLIENT_ENV *client, char *serv, char *user, char *prog);
|
int sj3_make_connection(SJ3_CLIENT_ENV *, char *, char *, char *);
|
||||||
int sj3_erase_connection(SJ3_CLIENT_ENV *client);
|
int sj3_erase_connection(SJ3_CLIENT_ENV *);
|
||||||
long sj3_open_dictionary(SJ3_CLIENT_ENV *client, char *dictname, char *password);
|
long sj3_open_dictionary(SJ3_CLIENT_ENV *, char *, char *);
|
||||||
int sj3_close_dictionary(SJ3_CLIENT_ENV *client, long dicid);
|
int sj3_close_dictionary(SJ3_CLIENT_ENV *, long);
|
||||||
int sj3_open_study_file(SJ3_CLIENT_ENV *client, char *stdyname, char *password);
|
int sj3_open_study_file(SJ3_CLIENT_ENV *, char *, char *);
|
||||||
int sj3_close_study_file(SJ3_CLIENT_ENV *client);
|
int sj3_close_study_file(SJ3_CLIENT_ENV *);
|
||||||
int sj3_get_id_size(SJ3_CLIENT_ENV *client);
|
int sj3_get_id_size(SJ3_CLIENT_ENV *);
|
||||||
int sj3_lock_server(SJ3_CLIENT_ENV *client);
|
int sj3_lock_server(SJ3_CLIENT_ENV *);
|
||||||
int sj3_unlock_server(SJ3_CLIENT_ENV *client);
|
int sj3_unlock_server(SJ3_CLIENT_ENV *);
|
||||||
int sj3_ikkatu_henkan(SJ3_CLIENT_ENV *client, u_char *src, u_char *dst, int dstsiz, int mb_flag);
|
int sj3_ikkatu_henkan(SJ3_CLIENT_ENV *, u_char *, u_char *, int, int);
|
||||||
int sj3_bunsetu_henkan(SJ3_CLIENT_ENV *client, u_char *yomi, int len, u_char *kanji, int mb_flag);
|
int sj3_bunsetu_henkan(SJ3_CLIENT_ENV *, u_char *, int, u_char *, int);
|
||||||
int sj3_bunsetu_jikouho(SJ3_CLIENT_ENV *client, u_char *kanji, int mode, int mb_flag);
|
int sj3_bunsetu_jikouho(SJ3_CLIENT_ENV *, u_char *, int, int);
|
||||||
int sj3_bunsetu_maekouho(SJ3_CLIENT_ENV *client, u_char *kanji, int mode, int mb_flag);
|
int sj3_bunsetu_maekouho(SJ3_CLIENT_ENV *, u_char *, int, int);
|
||||||
int sj3_bunsetu_kouhosuu(SJ3_CLIENT_ENV *client, u_char *yomi, int len, int mb_flag);
|
int sj3_bunsetu_kouhosuu(SJ3_CLIENT_ENV *, u_char *, int, int);
|
||||||
int sj3_bunsetu_zenkouho(SJ3_CLIENT_ENV *client, u_char *yomi, int len, SJ3_DOUON *douon, int mb_flag);
|
int sj3_bunsetu_zenkouho(SJ3_CLIENT_ENV *, u_char *, int, SJ3_DOUON *, int);
|
||||||
int sj3_tango_gakusyuu(SJ3_CLIENT_ENV *client, SJ3_STUDYREC *stdy);
|
int sj3_tango_gakusyuu(SJ3_CLIENT_ENV *, SJ3_STUDYREC *);
|
||||||
int sj3_bunsetu_gakusyuu(SJ3_CLIENT_ENV *client, u_char *yomi1, u_char *yomi2, SJ3_STUDYREC *stdy, int mb_flag);
|
int sj3_bunsetu_gakusyuu(SJ3_CLIENT_ENV *, u_char *, u_char *, SJ3_STUDYREC *,
|
||||||
int sj3_tango_touroku(SJ3_CLIENT_ENV *client, long dicid, u_char *yomi, u_char *kanji, int code, int mb_flag);
|
int);
|
||||||
int sj3_tango_sakujo(SJ3_CLIENT_ENV *client, long dicid, u_char *yomi, u_char *kanji, int code, int mb_flag);
|
int sj3_tango_touroku(SJ3_CLIENT_ENV *, long, u_char *, u_char *, int, int);
|
||||||
int sj3_tango_syutoku(SJ3_CLIENT_ENV *client, int dicid, u_char *buf, int mb_flag);
|
int sj3_tango_sakujo(SJ3_CLIENT_ENV *, long, u_char *, u_char *, int, int);
|
||||||
int sj3_tango_jikouho(SJ3_CLIENT_ENV *client, int dicid, u_char *buf, int mb_flag);
|
int sj3_tango_syutoku(SJ3_CLIENT_ENV *, int, u_char *, int);
|
||||||
int sj3_tango_maekouho(SJ3_CLIENT_ENV *client, int dicid, u_char *buf, int mb_flag);
|
int sj3_tango_jikouho(SJ3_CLIENT_ENV *, int, u_char *, int);
|
||||||
int sj3_make_dict_file(SJ3_CLIENT_ENV *client, char *path, int idxlen, int seglen, int segnum);
|
int sj3_tango_maekouho(SJ3_CLIENT_ENV *, int, u_char *, int);
|
||||||
int sj3_make_study_file(SJ3_CLIENT_ENV *client, char *path, int stynum, int clstep, int cllen);
|
int sj3_make_dict_file(SJ3_CLIENT_ENV *, char *, int, int, int);
|
||||||
int sj3_make_directory(SJ3_CLIENT_ENV *client, char *path);
|
int sj3_make_study_file(SJ3_CLIENT_ENV *, char *, int, int, int);
|
||||||
int sj3_access(SJ3_CLIENT_ENV *client, char *path, int mode);
|
int sj3_make_directory(SJ3_CLIENT_ENV *, char *);
|
||||||
int sj3_who(SJ3_CLIENT_ENV *client, SJ3_WHO_STRUCT *ret, int num);
|
int sj3_access(SJ3_CLIENT_ENV *, char *, int);
|
||||||
int sj3_quit(SJ3_CLIENT_ENV *client);
|
int sj3_who(SJ3_CLIENT_ENV *, SJ3_WHO_STRUCT *, int);
|
||||||
int sj3_kill(SJ3_CLIENT_ENV *client);
|
int sj3_quit(SJ3_CLIENT_ENV *);
|
||||||
int sj3_version(SJ3_CLIENT_ENV *client, char *dst, int dstsiz);
|
int sj3_kill(SJ3_CLIENT_ENV *);
|
||||||
|
int sj3_version(SJ3_CLIENT_ENV *, char *, int);
|
||||||
|
|
||||||
/* sj.c */
|
/* sj.c */
|
||||||
int sj3_open(char *host, char *user);
|
int sj3_open(char *, char *);
|
||||||
int sj3_open_with_list(char *host, char *user, int dicts_num, char **dicts, int *error_num, int **error_index);
|
int sj3_open_with_list(char *, char *, int, char **, int *, int **);
|
||||||
int sj3_close(void);
|
int sj3_close(void);
|
||||||
int sj3_getkan(u_char *yomi, SJ3_BUNSETU *bun, u_char *knj, int knjsiz);
|
int sj3_getkan(u_char *, SJ3_BUNSETU *, u_char *, int);
|
||||||
int sj3_getkan_euc(u_char *yomi, SJ3_BUNSETU *bun, u_char *knj, int knjsiz);
|
int sj3_getkan_euc(u_char *, SJ3_BUNSETU *, u_char *, int);
|
||||||
int sj3_getkan_mb(u_char *yomi, SJ3_BUNSETU *bun, u_char *knj, int knjsiz);
|
int sj3_getkan_mb(u_char *, SJ3_BUNSETU *, u_char *, int);
|
||||||
int sj3_douoncnt(u_char *yomi);
|
int sj3_douoncnt(u_char *);
|
||||||
int sj3_douoncnt_euc(u_char *yomi);
|
int sj3_douoncnt_euc(u_char *);
|
||||||
int sj3_douoncnt_mb(u_char *yomi);
|
int sj3_douoncnt_mb(u_char *);
|
||||||
int sj3_getdouon(u_char *yomi, SJ3_DOUON *dou);
|
int sj3_getdouon(u_char *, SJ3_DOUON *);
|
||||||
int sj3_getdouon_euc(u_char *yomi, SJ3_DOUON *dou);
|
int sj3_getdouon_euc(u_char *, SJ3_DOUON *);
|
||||||
int sj3_getdouon_mb(u_char *yomi, SJ3_DOUON *dou);
|
int sj3_getdouon_mb(u_char *, SJ3_DOUON *);
|
||||||
int sj3_gakusyuu(SJ3_STUDYREC *dcid);
|
int sj3_gakusyuu(SJ3_STUDYREC *);
|
||||||
int sj3_gakusyuu2(u_char *yomi1, u_char *yomi2, SJ3_STUDYREC *dcid);
|
int sj3_gakusyuu2(u_char *, u_char *, SJ3_STUDYREC *);
|
||||||
int sj3_gakusyuu2_euc(u_char *yomi1, u_char *yomi2, SJ3_STUDYREC *dcid);
|
int sj3_gakusyuu2_euc(u_char *, u_char *, SJ3_STUDYREC *);
|
||||||
int sj3_gakusyuu2_mb(u_char *yomi1, u_char *yomi2, SJ3_STUDYREC *dcid);
|
int sj3_gakusyuu2_mb(u_char *, u_char *, SJ3_STUDYREC *);
|
||||||
int sj3_touroku(u_char *yomi, u_char *kanji, int code);
|
int sj3_touroku(u_char *, u_char *, int);
|
||||||
int sj3_touroku_euc(u_char *yomi, u_char *kanji, int code);
|
int sj3_touroku_euc(u_char *, u_char *, int);
|
||||||
int sj3_touroku_mb(u_char *yomi, u_char *kanji, int code);
|
int sj3_touroku_mb(u_char *, u_char *, int);
|
||||||
int sj3_syoukyo(u_char *yomi, u_char *kanji, int code);
|
int sj3_syoukyo(u_char *, u_char *, int);
|
||||||
int sj3_syoukyo_euc(u_char *yomi, u_char *kanji, int code);
|
int sj3_syoukyo_euc(u_char *, u_char *, int);
|
||||||
int sj3_syoukyo_mb(u_char *yomi, u_char *kanji, int code);
|
int sj3_syoukyo_mb(u_char *, u_char *, int);
|
||||||
int sj3_getdict(u_char *buf);
|
int sj3_getdict(u_char *);
|
||||||
int sj3_getdict_euc(u_char *buf);
|
int sj3_getdict_euc(u_char *);
|
||||||
int sj3_getdict_mb(u_char *buf);
|
int sj3_getdict_mb(u_char *);
|
||||||
int sj3_nextdict(u_char *buf);
|
int sj3_nextdict(u_char *);
|
||||||
int sj3_nextdict_euc(u_char *buf);
|
int sj3_nextdict_euc(u_char *);
|
||||||
int sj3_nextdict_mb(u_char *buf);
|
int sj3_nextdict_mb(u_char *);
|
||||||
int sj3_prevdict(u_char *buf);
|
int sj3_prevdict(u_char *);
|
||||||
int sj3_prevdict_euc(u_char *buf);
|
int sj3_prevdict_euc(u_char *);
|
||||||
int sj3_prevdict_mb(u_char *buf);
|
int sj3_prevdict_mb(u_char *);
|
||||||
int sj3_lockserv(void);
|
int sj3_lockserv(void);
|
||||||
int sj3_unlockserv(void);
|
int sj3_unlockserv(void);
|
||||||
|
|
||||||
/* string.c */
|
/* string.c */
|
||||||
int sj3_str_sjistoeuc(unsigned char *, int, unsigned char *, unsigned char *, int *);
|
int sj3_str_sjistoeuc(unsigned char *, int, unsigned char *, unsigned char *,
|
||||||
int sj3_str_euctosjis(unsigned char *, int, unsigned char *, unsigned char *, int *);
|
int *);
|
||||||
|
int sj3_str_euctosjis(unsigned char *, int, unsigned char *, unsigned char *,
|
||||||
|
int *);
|
||||||
int sj3_sjistoeuclen(unsigned char *, int);
|
int sj3_sjistoeuclen(unsigned char *, int);
|
||||||
int sj3_sjistoeuc(unsigned char *, int, unsigned char *, int);
|
int sj3_sjistoeuc(unsigned char *, int, unsigned char *, int);
|
||||||
int sj3_euctosjis(unsigned char *, int, unsigned char *, int);
|
int sj3_euctosjis(unsigned char *, int, unsigned char *, int);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue