1 /* Copyright 1992 NEC Corporation, Tokyo, Japan.
2  *
3  * Permission to use, copy, modify, distribute and sell this software
4  * and its documentation for any purpose is hereby granted without
5  * fee, provided that the above copyright notice appear in all copies
6  * and that both that copyright notice and this permission notice
7  * appear in supporting documentation, and that the name of NEC
8  * Corporation not be used in advertising or publicity pertaining to
9  * distribution of the software without specific, written prior
10  * permission.  NEC Corporation makes no representations about the
11  * suitability of this software for any purpose.  It is provided "as
12  * is" without express or implied warranty.
13  *
14  * NEC CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
16  * NO EVENT SHALL NEC CORPORATION BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
18  * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
19  * OTHER TORTUOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20  * PERFORMANCE OF THIS SOFTWARE.
21  */
22 
23 /* sccs_id[]="@(#) NEC UNIX( PC-UX/EWS-UX ) rkc.h 2.4 91/11/11 12:01:18"; */
24 /* #ident	"@(#) NEC/V(386) R3.0B rkc.h 5.9 90/03/26 21:04:36" */
25 /* $Id: rkc.h,v 1.5 2003/09/17 08:50:53 aida_s Exp $ */
26 
27 #if defined(ENGINE_SWITCH)
28 #include "RKrename.h"
29 #endif
30 
31 #include "ccompat.h"
32 #include "rkcapi.h"
33 
34 /* ʸ�����쥳����
35  *
36  */
37 
38 #define MAX_HOSTNAME	256
39 
40 typedef struct _RkcBun {
41     unsigned short  *kanji  ;	/* ������ޤ����������� */
42     short	    curcand ;	/* �����ȴ��������ֹ� */
43     short	    maxcand ;	/* ����������� */
44     short	    flags   ;	/* �ե饰 */
45 #define NOTHING_KOUHO	 0x00
46 #define FIRST_KOUHO	0x01	   /* kanji����Ƭ����Τ� */
47 #define NUMBER_KOUHO	0x02	   /* kanji�ϸ�������Υݥ��� */
48 } RkcBun ;			   /* ���ξ�硢curcand��0,maxcand��1 */
49 
50 
51 /*
52  *  ���饤����ȥ���ƥ����ȥ쥳�ݥ�
53  *
54  */
55 typedef struct _RkcContext {
56     short	    server ;  /* ���ݥС�����ƥ������ֹ� */
57     short	    client ;  /* ���饤����ȡ�����ƥ������ֹ� */
58     RkcBun	    *bun   ;  /* ʸ�����쥳��������ؤΥݥ��� */
59     unsigned short *Fkouho ; /* ��������ؤΥݥ��� */
60     short	    curbun ;  /* ������ʸ���ֹ� */
61     short	    maxbun ;  /* ʸ����� */
62     short	    bgnflag ; /* RkBgnBun�Υե饰 */
63     unsigned short *lastyomi;
64     short	    maxyomi;
65 } RkcContext ;
66 
67 extern int ushort2euc(), euc2ushort(), ushort2wchar(), wchar2ushort(),
68     wcharstrlen(), ushortstrlen(), ushortstrcpy() ;
69 
70 typedef long (*initialize_t) pro((char *));
71 typedef int (*finalize_t) pro((void));
72 typedef int (*close_context_t) pro((RkcContext *));
73 typedef int (*create_context_t) pro((void));
74 typedef int (*duplicate_context_t) pro((RkcContext *));
75 typedef int (*dictionary_list_t) pro((RkcContext *, char *, int));
76 typedef int (*define_dic_t) pro((RkcContext *, char *, Ushort *));
77 typedef int (*delete_dic_t) pro((RkcContext *, char *, Ushort *));
78 typedef int (*mount_dictionary_t) pro((RkcContext *, char *, int));
79 typedef int (*remount_dictionary_t) pro((RkcContext *, char *, int));
80 typedef int (*umount_dictionary_t) pro((RkcContext *, char *));
81 typedef int (*mount_list_t) pro((RkcContext *, char *, int));
82 typedef int (*convert_t) pro((RkcContext *, Ushort *, int, int));
83 typedef int (*convert_end_t) pro((RkcContext *, int));
84 typedef int (*get_kanji_list_t) pro((RkcContext *));
85 typedef int (*get_stat_t) pro((RkcContext *, RkStat *));
86 typedef int (*resize_t) pro((RkcContext *, int));
87 typedef int (*store_yomi_t) pro((RkcContext *, Ushort *, int));
88 typedef int (*get_yomi_t) pro((RkcContext *, Ushort *));
89 typedef int (*get_lex_t) pro((RkcContext *, int, RkLex *));
90 typedef int (*autoconv_t) pro((RkcContext *, int, int));
91 typedef int (*subst_yomi_t) pro((RkcContext *, int, int, int, Ushort *, int));
92 typedef int (*flush_yomi_t) pro((RkcContext *));
93 typedef int (*get_last_yomi_t) pro((RkcContext *, Ushort *, int));
94 typedef int (*remove_bun_t) pro((RkcContext *, int));
95 typedef int (*get_simple_kanji_t)
96     pro((RkcContext *, char *, Ushort *, int, Ushort *, int, Ushort *, int));
97 typedef int (*query_dic_t)
98     pro((RkcContext *, char *, char *, struct DicInfo *));
99 typedef int (*get_hinshi_t) pro((RkcContext *, Ushort *, int));
100 typedef int (*store_range_t) pro((RkcContext *, Ushort *, int));
101 typedef int (*set_locale_t) pro((RkcContext *, char *));
102 typedef int (*set_app_name_t) pro((RkcContext *, char *));
103 typedef int (*notice_group_name_t) pro((RkcContext *, char *));
104 typedef int (*through_t) pro((RkcContext *, int, char *, int, int));
105 typedef int (*killserver_t) pro((void));
106 #ifdef EXTENSION
107 typedef int (*list_dictionary_t) pro((RkcContext *, char *, char *, int));
108 typedef int (*create_dictionary_t) pro((RkcContext *, char *, int));
109 typedef int (*remove_dictionary_t) pro((RkcContext *, char *, int));
110 typedef int (*rename_dictionary_t) pro((RkcContext *, char *, char *, int));
111 typedef int (*get_text_dictionary_t)
112      pro((RkcContext *, char *, char *, Ushort *, int));
113 typedef int (*sync_t) pro((RkcContext *, char *));
114 typedef int (*chmod_dic_t) pro((RkcContext *, char *, int));
115 typedef int (*copy_dictionary_t)
116      pro((RkcContext *, char *, char *, char *, int));
117 #endif
118 
119 struct rkcproto {
120   initialize_t initialize;
121   finalize_t finalize;
122   close_context_t close_context;
123   create_context_t create_context;
124   duplicate_context_t duplicate_context;
125   dictionary_list_t dictionary_list;
126   define_dic_t define_dic;
127   delete_dic_t delete_dic;
128   mount_dictionary_t mount_dictionary;
129   remount_dictionary_t remount_dictionary;
130   umount_dictionary_t umount_dictionary;
131   mount_list_t mount_list;
132   convert_t convert;
133   convert_end_t convert_end;
134   get_kanji_list_t get_kanji_list;
135   get_stat_t get_stat;
136   resize_t resize;
137   store_yomi_t store_yomi;
138   get_yomi_t get_yomi;
139   get_lex_t get_lex;
140   autoconv_t autoconv;
141   subst_yomi_t subst_yomi;
142   flush_yomi_t flush_yomi;
143   get_last_yomi_t get_last_yomi;
144   remove_bun_t remove_bun;
145   get_simple_kanji_t get_simple_kanji;
146   query_dic_t query_dic;
147   get_hinshi_t get_hinshi;
148   store_range_t store_range;
149   set_locale_t set_locale;
150   set_app_name_t set_app_name;
151   notice_group_name_t notice_group_name;
152   through_t through;
153   killserver_t killserver;
154 #ifdef EXTENSION
155   list_dictionary_t list_dictionary;
156   create_dictionary_t create_dictionary;
157   remove_dictionary_t remove_dictionary;
158   rename_dictionary_t rename_dictionary;
159   get_text_dictionary_t get_text_dictionary;
160   sync_t sync;
161   chmod_dic_t chmod_dic;
162   copy_dictionary_t copy_dictionary;
163 #endif /* EXTENSION */
164 };
165 
166 /* BASIC TYPE:
167  *	subete no data ha MSB first(Motorolla order) de tenkai sareru
168  *		unsigned char	w
169  *		unsigned short	wx
170  *		unsigned long	wxyz
171  */
172 #define LOMASK(x)	((x)&255)
173 #define	LTOL4(l, l4)	{\
174 	(l4)[0] = LOMASK((l)>>24); (l4)[1] = LOMASK((l)>>16);\
175 	(l4)[2] = LOMASK((l)>> 8); (l4)[3] = LOMASK((l));\
176 }
177 #define	LTOL3(l, l3)	{\
178 (l3)[0] = LOMASK((l)>>16); (l3)[1] = LOMASK((l)>> 8); (l3)[2] = LOMASK((l));\
179 }
180 #define	STOS2(s, s2)	{\
181 	(s2)[0] = LOMASK((s)>> 8); (s2)[1] = LOMASK((s));\
182 }
183 
184 #define RK_LINE_BMAX 1024 /* ����� RKintern.h �Τ�Ʊ���ͤǤʤ���Фʤ�ʤ� */
185 
186 #if 0
187 #define I16toI32(x) (((x) & 0x8000) ? ((x) | 0xffff8000) : (x))
188 #endif
189 #define I16toI32(x) (x)
190 #define I8toI32(x) (((x) & 0x80) ? ((x) | 0xffffff80) : (x))
191 
192 #ifndef YES
193 #define YES 1
194 #endif
195 #ifndef NO
196 #define NO  0
197 #endif
198 
199 #define SIZEOFSHORT 2 /* for protocol */
200 #define SIZEOFLONG  4 /* for protocol */
201 
202 #define MAX_CX 100
203 
204 typedef struct {
205   char *uname;        /* user name */
206   char *gname;        /* group name */
207   char *topdir;       /* install dir */
208 } RkUserInfo;
209 
210 /* function prototypes .. */
211 
212 extern rkc_Connect_Iroha_Server pro((char *));
213