1 /*
2  *  SKK-like Kana-Kanji translation library
3  *
4  * by A.ITO November, 1991
5  */
6 /*
7        (C) Copyright 1992,1993 by Akinori ITO, Yutaka KANEKO  and
8        Masatoshi WATANABE
9        You may freely use, copy, modify and distribute this soft-
10        ware.  This software is provided "as is" without  warranty
11        of  any  kind.  The entire risk as to the quality and per-
12        formance of the program is with you.
13 */
14 
15 #ifndef SKKLIB_H
16 #define SKKLIB_H
17 
18 #ifndef NO_MALLOC_H
19 #include <malloc.h>
20 #endif
21 
22 #include <time.h>
23 #include <stdio.h>
24 #include "skkconfig.h"
25 
26 #ifdef SKK_SERVER_HOST
27 #define USE_SERVER
28 #endif
29 
30 /*
31  * Structure for Dictionary
32  */
33 typedef struct DicList {
34 	struct CandList *cand;
35 	struct DicList *nextitem;
36 	char kanaword[1];
37 } *DicList;
38 
39 /*
40  * Structure for Candidate
41  */
42 typedef struct CandList {
43 	struct CandList *okuri;
44 	struct CandList *nextcand;
45 	struct CandList *prevcand;
46 	struct DicList *dicitem;
47 	char candword[1];
48 } *CandList;
49 
50 
51 typedef struct Hash {
52 	DicList h_index;
53 	short length;
54 	struct Hash *next;
55 } *Hash;
56 
57 #define HASHSIZE 256
58 
59 typedef struct Dictionary {
60 	DicList dlist;
61 	DicList okuriAriFirst;
62 	DicList okuriNasiFirst;
63 	Hash *dhash;
64 	time_t mtime;
65 } *Dictionary;
66 
67 #define _NEW(type) ((type)malloc(sizeof(struct type)))
68 #define _NEW2(type,add)	((type)malloc(sizeof(struct type)+(add)))
69 
70 Dictionary openSKK();
71 CandList getCand(),getCandList();
72 #ifdef USE_SERVER
73 CandList getCandFromServer();
74 int openSKKserv();
75 void closeSKKserv();
76 #endif
77 CandList deleteCand(),firstCand();
78 CandList searchOkuri();
79 DicList addNewItem();
80 
81 void addHash(Hash *hash, DicList ditem);
82 int isConjugate(char *word, int l);
83 void closeSKK(Dictionary dic, char *dicname);
84 void closeSKKserv();
85 void mergeDictionary(Dictionary dic, char *dicname);
86 void printCand(CandList cl, FILE *f, int fre);
87 void freeCand(CandList cl);
88 
89 /* flags for printCand() */
90 #define NOFREE_CAND 0
91 #define FREE_CAND 1
92 
93 #ifdef USE_SERVER
94 extern
95 char *SKKServerHost;
96 #endif
97 
98 #endif /* SKKLIB_H */
99