1 /* # skkinput (Simple Kana-Kanji Input)
2 * skkconfig.c --- Read dot.skkinput.
3 * This file is part of skkinput.
4 * Copyright (C) 1997
5 * Takashi SAKAMOTO (sakamoto@yajima.kuis.kyoto-u.ac.jp)
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
10 * any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with skkinput; see the file COPYING. If not, write to
19 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
20 */
21 #include <stdio.h>
22 #include <stdlib.h>
23 #include <unistd.h>
24 #include <string.h>
25 #include <sys/types.h>
26 #include <netinet/in.h>
27 #include <netdb.h>
28 #include <sys/socket.h>
29 #include <X11/Xlib.h>
30 #include <X11/Xatom.h>
31 #include <X11/IntrinsicP.h>
32 #include <X11/StringDefs.h>
33 #include <X11/Shell.h>
34
35 #include "commondef.h"
36 #include "buffers.h"
37 #include "SeparateWin.h"
38 #include "config.h"
39 #include "skkkey.h"
40
41 /*
42 * ����������¤�Τ�����ġ�
43 */
44 enum {
45 PARAM_BOOLEAN,
46 PARAM_INTEGER,
47 PARAM_STRING,
48 PARAM_PATH,
49 PARAM_INPUT_VECTOR,
50 PARAM_ROM_KANA_RULE_LIST,
51 #ifdef THIS_IS_NECESSARY
52 PARAM_DEFINE_KEY_SKKMAP,
53 #endif
54 PARAM_DEFINE_KEY_SKKJMAP,
55 PARAM_DEFINE_KEY_ABBREVMAP,
56 PARAM_SKKINPUTLISP,
57 #ifdef THIS_IS_NECESSARY
58 PARAM_UNDEFINE_KEY_SKKMAP,
59 #endif
60 PARAM_UNDEFINE_KEY_SKKJMAP,
61 PARAM_UNDEFINE_KEY_ABBREVMAP,
62 PARAM_END,
63 } ;
64
65 typedef struct {
66 char *string ;
67 int action ;
68 void *argument ;
69 } SkkInpDef ;
70
71 struct skk_rom_kana_rule_list {
72 struct skk_rom_kana_rule element ;
73 struct skk_rom_kana_rule_list *next ;
74 } ;
75
76 /*
77 * �ץ�ȥ����������
78 */
79 /* skkldic.c */
80 extern int check_skkinput_jisyo_code( char *path ) ;
81 /* parseStr.c */
82 struct myChar *skip_empty_symbols( struct myChar *ptr ) ;
83 struct myChar *parseString
84 ( struct myChar *string, struct myChar **dest, int *result ) ;
85 unsigned char *expand_file_name( unsigned char *path ) ;
86 int parseKeyString
87 ( struct myChar *string, struct myChar *buffer, int bufsize ) ;
88
89 /* lispeval.c */
90 extern int skkinputlisp_weak_eval
91 ( struct myChar *commandstring ) ;
92
93 /* keymap.c */
94 extern int skkinput_CompileDefaultKeyBind( void ) ;
95 extern int skkinput_DefineKey
96 ( struct myChar *string, int length, int func_no, int map ) ;
97 extern int skkinput_UndefineKey
98 ( struct myChar *string, int length, int map ) ;
99
100 /*
101 * skkinput ��ư�����ꤹ���ѿ�����
102 */
103 static int skkserv_portnum ; /* obsoleted, use skkserv_service */
104 extern char *skkserv_host ;
105 extern char *skkserv_service;
106 extern int skkserv_pf;
107 static char *skkserv_protocol_family ;
108 extern char *skkinput_local_jisyo_name ;
109 extern char *skkinput_backup_jisyo_name ;
110 extern char *skk_local_jisyo_name ;
111 extern char *skkinput_record_name ;
112 extern int skk_egg_like_newline ;
113 extern int skkinput_dabbrev_like_completion ;
114 extern int skkinput_chatadaptermode ;
115 extern int skkinput_search_skk_jisyo ;
116 extern int skkinput_keep_record ;
117 extern int skkinput_date_ad ;
118 extern int skkinput_number_style ;
119 extern int skkinput_delete_implies_kakutei ;
120 extern int skkinput_use_numeric_conversion ;
121 extern int skkinput_tab_width ;
122 extern int skkinput_rjj_like_input ;
123
124 extern Boolean skkinput_jisyo_dirty ;
125
126 extern unsigned long skkinput_autosave_interval ;
127
128 /*
129 * ������ϥ٥��ȥ롣
130 */
131 static unsigned char *skkinput_default_input_vector[ 128 ] = {
132 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
133 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
134 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
135 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
136 NULL, "��", NULL, NULL, NULL, NULL, NULL, NULL,
137 NULL, NULL, NULL, NULL, "��", "��", "��", NULL,
138 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
139 NULL, NULL, "��", "��", NULL, NULL, NULL, "��",
140 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
141 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
142 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
143 NULL, NULL, NULL, "��", NULL, "��", NULL, NULL,
144 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
145 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
146 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
147 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
148 } ;
149
150 /*
151 * �ºݤ��Ѵ��˻Ȥ������ϥ٥��ȥ롣
152 */
153 struct myChar *skkinput_input_vector[ 128 ] ;
154
155 /*
156 * ����������ϥ٥��ȥ롣
157 */
158 static unsigned char *skkinput_default_zenkaku_vector[ 128 ] = {
159 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
160 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
161 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
162 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
163 "��", "��", "��", "��", "��", "��", "��", "��",
164 "��", "��", "��", "��", "��", "��", "��", "��",
165 "��", "��", "��", "��", "��", "��", "��", "��",
166 "��", "��", "��", "��", "��", "��", "��", "��",
167 "��", "��", "��", "��", "��", "��", "��", "��",
168 "��", "��", "��", "��", "��", "��", "��", "��",
169 "��", "��", "��", "��", "��", "��", "��", "��",
170 "��", "��", "��", "��", "��", "��", "��", "��",
171 "��", "��", "��", "��", "��", "��", "��", "��",
172 "��", "��", "��", "��", "��", "��", "��", "��",
173 "��", "��", "��", "��", "��", "��", "��", "��",
174 "��", "��", "��", "��", "��", "��", "��", NULL,
175 } ;
176
177 /*
178 * �ºݤ��Ѵ��˻Ȥ������ѥ٥��ȥ롣
179 */
180 struct myChar *skkinput_zenkaku_vector[ 128 ] ;
181
182 /*
183 * ���������̾�Ѵ��롼��ꥹ�ȡ�
184 */
185 static struct skk_rom_kana_rule
186 skkinput_default_rom_kana_rule_list[] = {
187 { NULL, NULL, NULL, NULL },
188 { NULL, NULL, NULL, NULL },
189 { NULL, NULL, NULL, NULL },
190 } ;
191
192 static struct skk_rom_kana_rule_list *skkinput_rom_kana_rule_list_top ;
193
194 extern struct skk_rom_kana_rule *skkinput_rom_kana_rule_list ;
195
196 /*
197 * .skkinput �˵��ҤǤ������ΰ�����
198 */
199 SkkInpDef skkinput_initdef[] = {
200 { "skk-port-num:",
201 PARAM_INTEGER, &skkserv_portnum },
202 { "skk-service:",
203 PARAM_STRING, &skkserv_service },
204 { "skk-server-protocol-family:",
205 PARAM_STRING, &skkserv_protocol_family },
206 { "skk-server-host:",
207 PARAM_STRING, &skkserv_host },
208 { "skkinput-jisyo:",
209 PARAM_PATH, &skkinput_local_jisyo_name },
210 { "skkinput-backup-jisyo:",
211 PARAM_PATH, &skkinput_backup_jisyo_name },
212 { "skk-jisyo:",
213 PARAM_PATH, &skk_local_jisyo_name },
214 { "skkinput-record:",
215 PARAM_PATH, &skkinput_record_name },
216 { "skkinput-egg-like-newline:",
217 PARAM_BOOLEAN, &skk_egg_like_newline },
218 { "skkinput-dabbrev-like-completion:",
219 PARAM_BOOLEAN, &skkinput_dabbrev_like_completion },
220 { "skkinput-chat-adapter-mode:",
221 PARAM_BOOLEAN, &skkinput_chatadaptermode },
222 { "skkinput-keep-record:",
223 PARAM_BOOLEAN, &skkinput_keep_record },
224 { "skkinput-search-skk-jisyo:",
225 PARAM_BOOLEAN, &skkinput_search_skk_jisyo },
226 { "skkinput-date-ad:",
227 PARAM_BOOLEAN, &skkinput_date_ad },
228 { "skkinput-number-style:",
229 PARAM_INTEGER, &skkinput_number_style },
230 { "skkinput-delete-implies-kakutei:",
231 PARAM_BOOLEAN, &skkinput_delete_implies_kakutei },
232 { "skkinput-use-numeric-conversion:",
233 PARAM_BOOLEAN, &skkinput_use_numeric_conversion },
234 { "skkinput-zenkaku-vector:",
235 PARAM_INPUT_VECTOR, skkinput_zenkaku_vector },
236 { "skkinput-input-vector:",
237 PARAM_INPUT_VECTOR, skkinput_input_vector },
238 { "skkinput-rom-kana-rule-list:",
239 PARAM_ROM_KANA_RULE_LIST, &skkinput_rom_kana_rule_list_top },
240 #ifdef THIS_IS_NECESSARY
241 { "define-key-skkmap:",
242 PARAM_DEFINE_KEY_SKKMAP, NULL },
243 { "define-key-skkjmap:",
244 PARAM_DEFINE_KEY_SKKJMAP, NULL },
245 #else
246 { "define-key-skkmap:",
247 PARAM_DEFINE_KEY_SKKJMAP, NULL },
248 #endif
249 { "define-key-abbrevmap:",
250 PARAM_DEFINE_KEY_ABBREVMAP, NULL },
251 #ifdef THIS_IS_NECESSARY
252 { "undefine-key-skkmap:",
253 PARAM_UNDEFINE_KEY_SKKMAP, NULL },
254 { "undefine-key-skkjmap:",
255 PARAM_UNDEFINE_KEY_SKKJMAP, NULL },
256 #else
257 { "undefine-key-skkmap:",
258 PARAM_UNDEFINE_KEY_SKKJMAP, NULL },
259 #endif
260 { "undefine-key-abbrevmap:",
261 PARAM_UNDEFINE_KEY_ABBREVMAP,NULL },
262 { "tab-width:",
263 PARAM_INTEGER, &skkinput_tab_width },
264 { "skkinput-lisp:",
265 PARAM_SKKINPUTLISP, NULL },
266 { "skkinput-rjj-like-input:",
267 PARAM_BOOLEAN, &skkinput_rjj_like_input },
268 { "skkinput-autosave-interval:",
269 PARAM_INTEGER, &skkinput_autosave_interval },
270 { NULL,
271 PARAM_END, NULL },
272 } ;
273
274 /*
275 * ���ꤵ�줿ʸ������ʸ����������ʤ�Τ��ɤ������֤��ؿ���
276 *----
277 * �����Ȱʲ��϶���ʸ���Ǥ���Ȥ��ư�����
278 */
is_empty_line(struct myChar * ptr)279 static int is_empty_line( struct myChar *ptr )
280 {
281 while( !IS_END_OF_STRING( *ptr ) &&
282 !IS_ASCII_EQUAL( *ptr, ';' ) ){
283 if( !IS_ASCII_EQUAL( *ptr, 0x20 ) &&
284 !IS_ASCII_EQUAL( *ptr, '\t' ) &&
285 !IS_ASCII_EQUAL( *ptr, '\n' ) &&
286 !IS_ASCII_EQUAL( *ptr, '\r' ) )
287 return False ;
288 ptr ++ ;
289 }
290 return True ;
291 }
292
293 /*
294 * Boolean �Ĥޤ� "t" �� "nil" �Τɤ��餬���ꤵ��Ƥ��뤫����ؿ���
295 */
skkinput_analyze_boolean(struct myChar * oneline,void * argument)296 static int skkinput_analyze_boolean
297 ( struct myChar *oneline, void *argument )
298 {
299 oneline = skip_empty_symbols( oneline ) ;
300
301 /* ���Ȥ��٤����ꤵ��Ƥ��뤫�ɤ�����Ƚ�Ǥ��롣*/
302 if( IS_ASCII_EQUAL( *oneline, 't' ) && is_empty_line( oneline + 1 ) ){
303 *( int *)argument = True ;
304 return True ;
305 }
306 /* ���Ȥ��٤����ꤵ��Ƥ��뤫�ɤ�����Ƚ�Ǥ��롣*/
307 if( !myCharCharStrncmp( oneline, "nil", 3 ) ){
308 if( is_empty_line( oneline + 3 ) ){
309 *( int *)argument = False ;
310 return True ;
311 }
312 }
313 return False ;
314 }
315
skip_number_digit(struct myChar * ptr)316 static struct myChar *skip_number_digit( struct myChar *ptr )
317 {
318 /* ������³���¤ꥹ���åפ��롣*/
319 while( !IS_END_OF_STRING( *ptr ) ){
320 if( !IS_ASCII_CHARA( *ptr ) || ptr->chara < '0' || ptr->chara > '9' )
321 break ;
322 ptr ++ ;
323 }
324 return ptr ;
325 }
326
analyze_integer_sub(struct myChar * ptr,int * result,int * value)327 static struct myChar *analyze_integer_sub
328 ( struct myChar *ptr, int *result, int *value )
329 {
330 struct myChar *start ;
331 struct myChar ch ;
332 /* �ޤ�����ʸ�����åפ��ơ��ȡ�*/
333 start = skip_empty_symbols( ptr ) ;
334 /* ���줫�顢ʸ����ȳФ�������ȴ���Ф��ޤ���*/
335 ptr = skip_number_digit( start ) ;
336 /* ʸ�����ʤ��ä��顢�ȡ�*/
337 if( start == ptr ){
338 *result = False ;
339 return ptr ;
340 }
341 /* ����������������äƤ����顢�ȡ�*/
342 ch = *ptr ;
343 MYCHAR_SET_END_OF_STRING( *ptr ) ;
344 *value = myCharAtoi( start ) ;
345 *ptr = ch ;
346 *result = True ;
347 return ptr ;
348 }
349
350 /*
351 * �ʤ�����������ꤵ��Ƥ��뤫����ؿ���
352 */
skkinput_analyze_integer(struct myChar * oneline,void * argument)353 static int skkinput_analyze_integer
354 ( struct myChar *oneline, void *argument )
355 {
356 int result, value ;
357 oneline = analyze_integer_sub( oneline, &result, &value ) ;
358 if( !result )
359 return False ;
360 /* ���ͤμ�������ǤϤʤ����ˤϥ��顼��*/
361 if( !is_empty_line( oneline ) ){
362 /* �ͤ�����Ϥ��ʤ���*/
363 return False ;
364 }
365 *( int *)argument = value ;
366 return True ;
367 }
368
369 /*
370 * �ʤ��ʸ�������ꤵ��Ƥ��뤫����ؿ���
371 */
skkinput_analyze_string(struct myChar * oneline,void * argument,int expandFilenameFlag,int convertBackslash)372 static int skkinput_analyze_string
373 ( struct myChar *oneline, void *argument,
374 int expandFilenameFlag, int convertBackslash )
375 {
376 struct myChar *result ;
377 unsigned char *asciiString ;
378 int ret ;
379
380 oneline = parseString( oneline, &result, &ret ) ;
381 /* ���顼��Ƚ�ꡣ*/
382 if( ret < 0 )
383 return False ;
384 if( !is_empty_line( oneline ) ){
385 /* ���˥��ߤ��դ��Ƥ��뤼�����줸�����ܤ������٥��ӡ����� */
386 free( result ) ;
387 return False ;
388 }
389 /* ʸ����ԡ������� */
390 asciiString = myCharStringToAsciiString( result ) ;
391 free( result ) ;
392 if( expandFilenameFlag ){
393 *( unsigned char **)argument = expand_file_name( asciiString ) ;
394 free( asciiString ) ;
395 } else {
396 *( unsigned char **)argument = asciiString ;
397 }
398 return True ;
399 }
400
401 /*
402 * Ϳ����줿��Ԥ����ϥ٥��ȥ������Ǥ��뤫�顢������ᤷ�ơ�
403 * skkinput_input_vector �� skkinput_zenkaku_vector ���������褦������
404 * ����ؿ���
405 */
skkinput_analyze_input_vector(struct myChar * oneline,void * argument)406 static int skkinput_analyze_input_vector
407 ( struct myChar *oneline, void *argument )
408 {
409 struct myChar *ptr ;
410 struct myChar *istring ;
411 int result, value, ret ;
412
413 istring = NULL ;
414 /* �ǽ�ζ���ʸ�����åפ��ޤ���*/
415 oneline = skip_empty_symbols( oneline ) ;
416 /* ( 123 "" ) */
417 if( !IS_ASCII_EQUAL( *oneline, '(' ) )
418 goto err_ret ;
419 oneline ++ ;
420 /* ���ͤ�ȴ���Ф��ޤ���*/
421 ptr = analyze_integer_sub( oneline, &result, &value ) ;
422 /* ��̤��֤äƤ��ʤ��ä��顢���ܤǤ��硣*/
423 if( !result )
424 goto err_ret ;
425 /* input vector ����������ʤ��ͤ��ä��顢�ΤƤޤ��礦��*/
426 if( value > 128 || value < 0 )
427 goto err_ret ;
428 /* ���ΤޤǸ�ޤǹԤäƤ��ޤä��顢���ܤǤ��礦��*/
429 ptr = skip_empty_symbols( ptr ) ;
430 if( !IS_ASCII_EQUAL( *ptr, '.' ) )
431 goto err_ret ;
432 /* ����ʸ�������Ϥ��ޤ���*/
433 ptr = parseString( ptr + 1, &istring, &ret ) ;
434 if( ret < 0 )
435 goto err_ret ;
436 /* ����³������ʸ��������Ф��ޤ���*/
437 ptr = skip_empty_symbols( ptr ) ;
438 /* �Ǹ�� ")" ���Ĥ����Ƥ��ʤ���С����ܤǤ���*/
439 if( !IS_ASCII_EQUAL( *ptr, ')' ) )
440 goto err_ret ;
441 ptr ++ ;
442 /* ���θ�˥��ߤ����äƤϤ����ޤ���*/
443 if( !is_empty_line( ptr ) )
444 goto err_ret ;
445 /* input vector �����ޤ���*/
446 if( ( ( struct myChar ** )argument )[ value ] != NULL ){
447 free( ( ( struct myChar ** )argument )[ value ] ) ;
448 }
449 ( ( struct myChar ** )argument )[ value ] = istring ;
450 return True ;
451
452 err_ret:
453 if( istring != NULL )
454 free( istring ) ;
455 return False ;
456 }
457
add_skkinput_rule_list(struct skk_rom_kana_rule_list ** top,struct skk_rom_kana_rule element)458 static void add_skkinput_rule_list
459 ( struct skk_rom_kana_rule_list **top,
460 struct skk_rom_kana_rule element )
461 {
462 struct skk_rom_kana_rule_list *node ;
463 if( *top == NULL ){
464 *top = node = malloc( sizeof( struct skk_rom_kana_rule_list ) ) ;
465 } else {
466 node = *top ;
467 while( node->next != NULL )
468 node = node->next ;
469 node->next = malloc( sizeof( struct skk_rom_kana_rule_list ) ) ;
470 node = node->next ;
471 }
472 if( node == NULL ){
473 fprintf( stderr, "Fatal: Memory Exhausted.\n" ) ;
474 exit( 1 ) ;
475 }
476 node->next = NULL ;
477 /* ��¤�Τԡ����롣*/
478 node->element = element ;
479 return ;
480 }
481
skkinput_analyze_rule_list(struct myChar * oneline,void * argument)482 static int skkinput_analyze_rule_list
483 ( struct myChar *oneline, void *argument )
484 {
485 struct myChar *ptr, *rstr[ 4 ] ;
486 struct skk_rom_kana_rule node ;
487 int i, ret ;
488
489 /* �ǽ�ζ���ʸ�����åפ��ޤ���*/
490 oneline = skip_empty_symbols( oneline ) ;
491 /* ( "nn" "" "��" "��" ) */
492 if( !IS_ASCII_EQUAL( *oneline, '(' ) )
493 return False ;
494 oneline ++ ;
495 ptr = oneline ;
496 for( i = 0 ; i < 4 ; i ++ ){
497 /* ����ʸ�������Ϥ��ޤ���*/
498 ptr = parseString( ptr, rstr + i, &ret ) ;
499 if( ret < 0 ){
500 while( i < 4 )
501 rstr[ i ++ ] = NULL ;
502 goto err_analyze ;
503 }
504 }
505 /* ʸ������ä��顢")" ���Ĥ��Ƥ���Ȧ��*/
506 ptr = skip_empty_symbols( ptr ) ;
507 if( !IS_ASCII_EQUAL( *ptr, ')' ) )
508 goto err_analyze ;
509 /* �ǡ�")" ��³���϶���ʸ��������Ȧ(�⤷���ϥ����Ȥ����ɤ�) */
510 ptr ++ ;
511 if( !is_empty_line( ptr ) )
512 goto err_analyze ;
513 /* �ǡ�ȴ���Ф��ޤ��ơ��ȡ�*/
514 node.state = rstr[ 0 ] ;
515 node.next = rstr[ 1 ] ;
516 node.houtput = rstr[ 2 ] ;
517 node.koutput = rstr[ 3 ] ;
518 /* ���ߤξ��֤�̵���ä��顢����㥨�顼�ä������Ϥ���������å����ޤ���*/
519 if( node.state == NULL )
520 goto err_analyze ;
521 add_skkinput_rule_list( argument, node ) ;
522 return True ;
523 err_analyze:
524 for( i = 0 ; i < 4 ; i ++ ){
525 if( rstr[ i ] != NULL )
526 free( rstr[ i ] ) ;
527 }
528 return False ;
529 }
530
531 /* ( "@" . "j-self-insert" ) */
skkinput_analyze_define_key(struct myChar * oneline,struct myChar ** rkeystring,struct myChar ** rkeyfunction,int * rlength)532 static int skkinput_analyze_define_key
533 ( struct myChar *oneline,
534 struct myChar **rkeystring,
535 struct myChar **rkeyfunction,
536 int *rlength )
537 {
538 struct myChar *keyfunction, *ptr, *keystring ;
539 int result ;
540
541 keystring = keyfunction = NULL ;
542
543 /* �ǽ�ζ���ʸ�����åפ��ޤ���*/
544 oneline = skip_empty_symbols( oneline ) ;
545 /* ( "nn" "" "��" "��" ) */
546 if( !IS_ASCII_EQUAL( *oneline, '(' ) )
547 goto err_ret ;
548 oneline ++ ;
549 /* ����ʸ�������Ϥ��ޤ���*/
550 ptr = parseString( oneline, &keystring, &result ) ;
551 /* ���Ԥ������ġ�*/
552 if( keystring == NULL || result < 0 )
553 goto err_ret ;
554 *rlength = result ;
555 /* ���ΤޤǸ�ޤǹԤäƤ��ޤä��顢���ܤǤ��礦��*/
556 ptr = skip_empty_symbols( ptr ) ;
557 if( !IS_ASCII_EQUAL( *ptr, '.' ) )
558 goto err_ret ;
559 /* ����ʸ�������Ϥ��ޤ���*/
560 ptr = parseString( ptr + 1, &keyfunction, &result ) ;
561 /* ���Ԥ������ġ�*/
562 if( keyfunction == NULL || result < 0 )
563 goto err_ret ;
564 /* ����³������ʸ��������Ф��ޤ���*/
565 ptr = skip_empty_symbols( ptr ) ;
566 /* �Ǹ�� ")" ���Ĥ����Ƥ��ʤ���С����ܤǤ���*/
567 if( !IS_ASCII_EQUAL( *ptr, ')' ) )
568 goto err_ret ;
569 ptr ++ ;
570 /* ���θ�˥��ߤ����äƤϤ����ޤ���*/
571 if( !is_empty_line( ptr ) )
572 goto err_ret ;
573 /* ��̤��������ޤ���*/
574 *rkeystring = keystring ;
575 *rkeyfunction = keyfunction ;
576 return True ;
577 err_ret:
578 if( keystring != NULL )
579 free( keystring ) ;
580 if( keyfunction != NULL )
581 free( keyfunction ) ;
582 return False ;
583 }
584
585 /*
586 * �ؿ�̾��ؿ��ֹ���Ѵ����������Ԥ��ؿ���
587 */
skkinput_string2function_number(struct myChar * keyfunction)588 static int skkinput_string2function_number
589 ( struct myChar *keyfunction )
590 {
591 int func_no ;
592 static unsigned char *function_string_table[] = {
593 "self-insert-command",
594 "j-self-insert",
595 "j-self-zenkaku-insert",
596 "j-display-code-for-char-at-point",
597 "j-set-henkan-point",
598 "j-set-henkan-point-subr",
599 "j-insert-a",
600 "j-insert-e",
601 "j-insert-i",
602 "j-insert-o",
603 "j-insert-u",
604 "j-kana-input",
605 "j-start-henkan",
606 "j-insert-comma",
607 "j-insert-period",
608 "j-purge-from-jisyo",
609 "j-input-by-code-or-menu",
610 "j-mode-off",
611 "j-toggle-kana",
612 "j-previous-candidate",
613 "j-kakutei",
614 "j-abbrev-input",
615 "j-abbrev-period",
616 "j-abbrev-comma",
617 "j-zenkaku-eiji",
618 "j-zenkaku-henkan",
619 "j-today",
620 "save-skkinput-local-jisyo",
621 "vc-toggle-overthespot-like-input",
622 "j-mode-off-and-self-insert",
623
624 "j-kanainput-mode-on",
625 "newline",
626 "set-mark-command",
627 "forward-char",
628 "backward-char",
629 "delete-char",
630 "delete-backward-char",
631 "j-try-comletion",
632 "end-of-line",
633 "beginning-of-line",
634 "kill-line",
635 "yank",
636 "kill-region",
637 "kill-ring-save",
638 "exchange-point-and-mark",
639 "previous-line",
640 "next-line",
641 "transpose-chars",
642 "redraw",
643 "prefix-char",
644 "sendback-next-key",
645 "sendback-key",
646 "keyboard-quit",
647 "close-skkinput",
648 "vc-toggle-chatmode",
649 "not-modified",
650 "forward-word",
651 "backward-word",
652 "upcase-word",
653 "downcase-word",
654 "capitalize-word",
655 "vc-toggle-eggnl",
656 NULL,
657 } ;
658 /* �ɤ�ʸ����˰��פ���Τ���Ĵ�٤롣*/
659 func_no = 0 ;
660 while( function_string_table[ func_no ] != NULL ){
661 if( !myCharCharStrcmp
662 ( keyfunction, function_string_table[ func_no ] ) )
663 return func_no ;
664 func_no ++ ;
665 }
666 return ERR ;
667 }
668
669 /*
670 * define-key-skkmap ���᤹��ؿ���
671 */
skkinput_analyze_define_key_skkmap(struct myChar * oneline,int map)672 static int skkinput_analyze_define_key_skkmap
673 ( struct myChar *oneline, int map )
674 {
675 struct myChar *keyfunction ;
676 struct myChar *keystring ;
677 int func_no, ret = False, uselen ;
678
679 /* �ޤ���ʸ����Υڥ����᤹�롣*/
680 if( !skkinput_analyze_define_key
681 ( oneline, &keystring, &keyfunction, &uselen ) )
682 return False ;
683 /* �ɤδؿ��ʤΤ����ֹ��Ĵ�٤롣*/
684 if( ( func_no = skkinput_string2function_number( keyfunction ) ) < 0 )
685 goto err_ret ;
686
687 ret = skkinput_DefineKey( keystring, uselen, func_no, map ) ;
688 err_ret:
689 free( keystring ) ;
690 free( keyfunction ) ;
691 return ret ;
692 }
693
694 /*
695 * undefine-key-skkmap ���᤹��ؿ���
696 */
skkinput_analyze_undefine_key_skkmap(struct myChar * oneline,int map)697 static int skkinput_analyze_undefine_key_skkmap
698 ( struct myChar *oneline, int map )
699 {
700 struct myChar *keystring, *keybuf ;
701 int ret = False, uselen ;
702
703 keystring = keybuf = NULL ;
704
705 /* �ޤ�ʸ�������᤹�롣*/
706 if( !skkinput_analyze_string( oneline, &keystring, False, False ) )
707 goto err_ret ;
708 /* ���ξ��֤� keystring �ˤϡ���ȤΤޤޤ�ʸ�����ԡ�����Ƥ�
709 * �롣������ᤷ�ʤ���Фʤ�ʤ���*/
710 uselen = parseKeyString( keystring, NULL, 0 ) ;
711 /* ���˼��Ԥ������ˤϼΤƤ롣*/
712 if( uselen <= 0 )
713 goto err_ret ;
714 if( ( keybuf = malloc( sizeof( struct myChar ) * uselen ) ) == NULL )
715 goto err_ret ;
716 ( void )parseKeyString( keystring, keybuf, uselen ) ;
717 ret = skkinput_UndefineKey( keybuf, uselen, map ) ;
718 free( keybuf ) ;
719 err_ret:
720 if( keystring != NULL )
721 free( keystring ) ;
722 return ret ;
723 }
724
725 /*
726 * lisp �ǽ줿�Ԥ��᤹��ؿ���
727 */
skkinput_analyze_skkinputlisp(struct myChar * oneline)728 static int skkinput_analyze_skkinputlisp
729 ( struct myChar *oneline )
730 {
731 if( !skkinputlisp_weak_eval( oneline ) )
732 return False ;
733 return True ;
734 }
735
736 /*
737 * ��Ԥ���¹Ԥ���ؿ���
738 */
skkinput_analyze_line(struct myChar * oneline)739 static int skkinput_analyze_line( struct myChar *oneline )
740 {
741 int i, length ;
742 struct myChar *wptr ;
743
744 for( i = 0 ; skkinput_initdef[ i ].string != NULL ; i ++ ){
745 /* ʸ�����פ��뤫�ɤ�����Ƚ�Ǥ��롣*/
746 length = strlen( skkinput_initdef[ i ].string ) ;
747 if( myCharCharStrncmp
748 ( oneline, skkinput_initdef[ i ].string, length ) )
749 continue ;
750 wptr = oneline + length ;
751
752 /* ���פ���ʸ������б����륢��������¹Ԥ��롣*/
753 switch( skkinput_initdef[ i ].action ){
754 case PARAM_BOOLEAN :
755 return skkinput_analyze_boolean
756 ( wptr, skkinput_initdef[ i ].argument ) ;
757 case PARAM_INTEGER :
758 return skkinput_analyze_integer
759 ( wptr, skkinput_initdef[ i ].argument ) ;
760 case PARAM_STRING :
761 return skkinput_analyze_string
762 ( wptr, skkinput_initdef[ i ].argument, False, True ) ;
763 case PARAM_PATH :
764 return skkinput_analyze_string
765 ( wptr, skkinput_initdef[ i ].argument, True, True ) ;
766 case PARAM_INPUT_VECTOR :
767 return skkinput_analyze_input_vector
768 ( wptr, skkinput_initdef[ i ].argument ) ;
769 case PARAM_ROM_KANA_RULE_LIST :
770 return skkinput_analyze_rule_list
771 ( wptr, skkinput_initdef[ i ].argument ) ;
772 #ifdef THIS_IS_NECESSARY
773 case PARAM_DEFINE_KEY_SKKMAP :
774 return skkinput_analyze_define_key_skkmap( wptr, 0 ) ;
775 #endif
776 case PARAM_DEFINE_KEY_SKKJMAP :
777 return skkinput_analyze_define_key_skkmap( wptr, 1 ) ;
778 case PARAM_DEFINE_KEY_ABBREVMAP :
779 return skkinput_analyze_define_key_skkmap( wptr, 2 ) ;
780 #ifdef THIS_IS_NECESSARY
781 case PARAM_UNDEFINE_KEY_SKKMAP :
782 return skkinput_analyze_undefine_key_skkmap( wptr, 0 ) ;
783 #endif
784 case PARAM_UNDEFINE_KEY_SKKJMAP :
785 return skkinput_analyze_undefine_key_skkmap( wptr, 1 ) ;
786 case PARAM_UNDEFINE_KEY_ABBREVMAP :
787 return skkinput_analyze_undefine_key_skkmap( wptr, 2 ) ;
788 case PARAM_SKKINPUTLISP :
789 return skkinput_analyze_skkinputlisp( wptr ) ;
790 default :
791 return False ;
792 }
793 }
794 return False ;
795 }
796
797 /*
798 * skk-rom-kana-rule-list ���������� skkinput-rom-kana-rule-list ��
799 * skkinput ���������褦���Ѵ�����ؿ���
800 *---
801 */
makeSkkRomKanaRuleList(struct skk_rom_kana_rule_list * top)802 static struct skk_rom_kana_rule *makeSkkRomKanaRuleList
803 ( struct skk_rom_kana_rule_list *top )
804 {
805 int i ;
806 struct skk_rom_kana_rule_list *node = top, *nNode ;
807 struct skk_rom_kana_rule *rule_list = NULL ;
808
809 if( node == NULL ){
810 return skkinput_default_rom_kana_rule_list ;
811 } else {
812 for( i = 0 ; node != NULL ; i ++ )
813 node = node->next ;
814 /* 3 �Ĥϥǥե���ȤǤ���äƤ���Τ� +3 */
815 rule_list = malloc( sizeof( struct skk_rom_kana_rule ) * ( i + 3 ) ) ;
816 if( rule_list == NULL ){
817 return NULL ;
818 }
819 node = top ;
820 for( i = 0 ; node != NULL ; i ++ ){
821 rule_list[ i ] = node->element ;
822 #ifdef DEBUG
823 if( rule_list[ i ].state == NULL ){
824 fprintf( stderr, "( \"(null)\", " ) ;
825 } else {
826 fprintf( stderr, "( \"" ) ;
827 myCharFputstring( stderr, rule_list[ i ].state ) ;
828 fprintf( stderr, "\", " ) ;
829 fflush( stderr ) ;
830 }
831 if( rule_list[ i ].next == NULL ){
832 fprintf( stderr, "\"(null)\", " ) ;
833 } else {
834 fprintf( stderr, "\"" ) ;
835 myCharFputstring( stderr, rule_list[ i ].next ) ;
836 fprintf( stderr, "\", " ) ;
837 fflush( stderr ) ;
838 }
839 if( rule_list[ i ].houtput == NULL ){
840 fprintf( stderr, "\"(null)\", " ) ;
841 } else {
842 fprintf( stderr, "\"" ) ;
843 myCharFputstring( stderr, rule_list[ i ].houtput ) ;
844 fprintf( stderr, "\", " ) ;
845 fflush( stderr ) ;
846 }
847 if( rule_list[ i ].koutput == NULL ){
848 fprintf( stderr, "\"(null)\" )\n" ) ;
849 } else {
850 fprintf( stderr, "\"" ) ;
851 myCharFputstring( stderr, rule_list[ i ].koutput ) ;
852 fprintf( stderr, "\" )\n" ) ;
853 fflush( stderr ) ;
854 }
855 #endif
856 nNode = node->next ;
857 free( node ) ;
858 node = nNode ;
859 }
860 rule_list[ i++ ] = skkinput_default_rom_kana_rule_list[ 0 ] ;
861 rule_list[ i++ ] = skkinput_default_rom_kana_rule_list[ 1 ] ;
862 rule_list[ i++ ] = skkinput_default_rom_kana_rule_list[ 2 ] ;
863 }
864 return rule_list ;
865 }
866
867 /*
868 * ����ե�������ɤ߹���ؿ���
869 *------
870 * ���ֶ��ϤʤΤϡ�-option �Ǥ�������Ȼפ��������顢�ޤ� DEFAULT ����
871 * �ꡢ���ˤ�������ե������ɤߡ��Ǹ�� option �Ƿ��ꤷ�����Ĥ��ɡġ�
872 * ����ȡ� ����ե����뤬����ˤ���Τ��� option �ǻ���Ǥ��ʤ��ʤ��
873 * ������ ������ܰդ���ʤ����ġ�
874 */
skkinput_readConfigFile(char * config_file)875 int skkinput_readConfigFile( char *config_file )
876 {
877 int chck = False, coding_system ;
878 unsigned char *config_path ;
879 /* ��ƣ������ patch �ġֹ��ֹ椬��ľ������פȤ����Τ��Ф��� patch��*/
880 unsigned long line = 1 ;
881 FILE *fp ;
882 struct myChar *oneline ;
883
884 skkinput_rom_kana_rule_list_top = NULL ;
885 /* �ǥե���ȤΤ�Τ���Ѥ���褦�ؼ����줿���ν�����*/
886 config_path = expand_file_name( config_file ) ;
887 chck = True ;
888 coding_system = check_skkinput_jisyo_code( config_path ) ;
889 /* �ե�������Ƥߤ롣*/
890 if( ( fp = fopen( config_path, "rb" ) ) == NULL ){
891 if( chck )
892 free( config_path ) ;
893 return False ;
894 }
895 /* �ե����뤬³���¤��ɤ߽Ф���*/
896 while( !feof( fp ) ){
897 /* ����ɤ߽Ф���*/
898 if( ( oneline = mychar_readOneLine( fp, coding_system ) ) != NULL ){
899 /* �����ȹԤ��ä����ˤ�̵�뤹�롣*/
900 if( !is_empty_line( oneline ) ){
901 if( !skkinput_analyze_line( oneline ) ){
902 fprintf( stderr, "Warning: I ignore line %ld.\n", line ) ;
903 }
904 }
905 free( oneline ) ;
906 oneline = NULL ;
907 }
908 line ++ ;
909 }
910 fclose( fp ) ;
911 /* �����������ƽ�λ���롣*/
912 if( chck )
913 free( config_path ) ;
914 /* rom-kana rule list �����ꤹ�롣*/
915 skkinput_rom_kana_rule_list =
916 makeSkkRomKanaRuleList( skkinput_rom_kana_rule_list_top ) ;
917
918 /*
919 * if skkserv_portnum is defined use skkserv_portnum for
920 * backward compatibility.
921 */
922 if (skkserv_portnum != 0) {
923 if (skkserv_service) free(skkserv_service);
924 skkserv_service = malloc(8); /* 8 digit is enough */
925 sprintf(skkserv_service, "%u", skkserv_portnum);
926 }
927 if (skkserv_protocol_family != NULL) {
928 if (strcasecmp(skkserv_protocol_family, "inet4") == 0
929 || strcasecmp(skkserv_protocol_family, "ipv4") == 0) {
930 skkserv_pf = PF_INET;
931 } else if (strcasecmp(skkserv_protocol_family, "inet6") == 0
932 || strcasecmp(skkserv_protocol_family, "ipv6") == 0) {
933 #if defined(USE_INET6)
934 skkserv_pf = PF_INET6;
935 #else
936 fprintf( stderr, "Warning: IPv6 not supported.\n" ) ;
937 #endif
938 }
939 }
940 return True ;
941 }
942
initialize_skkinputDefaultVectorSub(struct myChar * myCharVector[],unsigned char * charVector[])943 static void initialize_skkinputDefaultVectorSub
944 ( struct myChar *myCharVector[], unsigned char *charVector[] )
945 {
946 unsigned char **cptr = charVector ;
947 struct myChar **wptr = myCharVector ;
948 int i ;
949
950 for( i = 0 ; i < 128 ; i ++, cptr ++ , wptr ++ ){
951 if( *cptr != NULL ){
952 *wptr = malloc( sizeof( struct myChar ) * 2 ) ;
953 ( *wptr )->charset = CHARSET_JISX0208_1983 ;
954 ( *wptr )->chara =
955 ( ( ( ( *cptr )[ 0 ] ) << 8 ) | ( ( *cptr )[ 1 ] ) ) & 0x7F7F ;
956 MYCHAR_SET_END_OF_STRING( ( ( *wptr )[ 1 ] ) ) ;
957 } else {
958 *wptr = NULL ;
959 }
960 }
961 return ;
962 }
963
initialize_skkinputDefaultVectors(void)964 static void initialize_skkinputDefaultVectors( void )
965 {
966 initialize_skkinputDefaultVectorSub
967 ( skkinput_input_vector, skkinput_default_input_vector ) ;
968 initialize_skkinputDefaultVectorSub
969 ( skkinput_zenkaku_vector, skkinput_default_zenkaku_vector ) ;
970 return ;
971 }
972
973 /*
974 * ����Υ�����̾�Ѵ��롼������ꤹ��ؿ���
975 *---
976 * ������ char �� string �ǻ��ꤷ�Ƥ����Τǡ��ѿ�����ξ�������Ǥ�
977 * �����ɡ����� charset ���ѹ����Ƥ��ޤä��Τǡ����줬�Ǥ��ʤ��ʤ�
978 * �Ƥ��ޤä�������ˤ����ʤ�ޤ�����
979 */
initialize_skkinputDefaultRomKanaRuleList(void)980 static void initialize_skkinputDefaultRomKanaRuleList( void )
981 {
982 struct myChar *ptr ;
983
984 ptr = malloc( sizeof( struct myChar ) * 3 ) ;
985 myCharCharStrcpy( ptr, "nn" ) ;
986 skkinput_default_rom_kana_rule_list[ 0 ].state = ptr ;
987 ptr = malloc( sizeof( struct myChar ) * 2 ) ;
988 ptr->charset = CHARSET_JISX0208_1983 ;
989 ptr->chara = 0x2473 ;
990 MYCHAR_SET_END_OF_STRING( *( ptr + 1 ) ) ;
991 skkinput_default_rom_kana_rule_list[ 0 ].houtput = ptr ;
992 ptr = malloc( sizeof( struct myChar ) * 2 ) ;
993 ptr->charset = CHARSET_JISX0208_1983 ;
994 ptr->chara = 0x2573 ;
995 MYCHAR_SET_END_OF_STRING( *( ptr + 1 ) ) ;
996 skkinput_default_rom_kana_rule_list[ 0 ].koutput = ptr ;
997
998 ptr = malloc( sizeof( struct myChar ) * 3 ) ;
999 myCharCharStrcpy( ptr, "n'" ) ;
1000 skkinput_default_rom_kana_rule_list[ 1 ].state = ptr ;
1001 ptr = malloc( sizeof( struct myChar ) * 2 ) ;
1002 ptr->charset = CHARSET_JISX0208_1983 ;
1003 ptr->chara = 0x2473 ;
1004 MYCHAR_SET_END_OF_STRING( *( ptr + 1 ) ) ;
1005 skkinput_default_rom_kana_rule_list[ 1 ].houtput = ptr ;
1006 ptr = malloc( sizeof( struct myChar ) * 2 ) ;
1007 ptr->charset = CHARSET_JISX0208_1983 ;
1008 ptr->chara = 0x2573 ;
1009 MYCHAR_SET_END_OF_STRING( *( ptr + 1 ) ) ;
1010 skkinput_default_rom_kana_rule_list[ 1 ].koutput = ptr ;
1011 return ;
1012 }
1013
1014 /*
1015 * skkinput ��ư��Ҥ��ѿ�����������ؿ���
1016 *------
1017 * �ǥե���Ȥ��ͤ�����Ƥ��ޤ��ؿ��Ǥ⤢�롣
1018 */
initSkkinputDousaketteiVariables(void)1019 void initSkkinputDousaketteiVariables( void )
1020 {
1021 struct servent *servent ;
1022
1023 /* �ɽ꼭��ν�ߤ��Τ�ʤ��Ȥ��Ƥ�����*/
1024 skkinput_local_jisyo_name = DEFAULT_SKKLJISYO ;
1025 skkinput_backup_jisyo_name = DEFAULT_SKKBJISYO ;
1026 skkinput_record_name = DEFAULT_SKKRECORD ;
1027 skk_local_jisyo_name = DEFAULT_SKKLOCALJISYO ;
1028 /* "/etc/services" ����ݡ����ֹ�����Ƥ�����*/
1029 servent = getservbyname( SKKSERV_SERVICE_NAME, SKKSERV_SERVICE_PROTO ) ;
1030 if( servent == NULL ){
1031 /* /etc/services ������Ϥʤ��ä��Τǡ�config.h ����Τ�Ȥ���*/
1032 skkserv_service = strdup(DEFAULT_SKKPORT);
1033 } else {
1034 /* /etc/services �����꤬���ä��ġ�*/
1035 skkserv_service = strdup( servent->s_name ) ;
1036 #if defined(DEBUG)
1037 fprintf
1038 ( stderr, "getservbyname: \"%s\", %d\n",
1039 servent->s_name, skkserv_portnum ) ;
1040 #endif
1041 }
1042 /* �Ķ��ѿ� SKKSERV �����ꤵ��Ƥ���С������ DEFAULT �� skkserv *
1043 * host �Ȥ��롣*/
1044 if( ( skkserv_host = getenv( "SKKSERVER" ) ) == NULL )
1045 skkserv_host = DEFAULT_SKKSERVER ;
1046
1047 /* �ǥե���ȤΥ����ޥåפ�������롣*/
1048 skkinput_CompileDefaultKeyBind() ;
1049 /* ���ϥ٥��ȥ�ν������Ԥ���*/
1050 initialize_skkinputDefaultVectors() ;
1051 /* egg �ߴ��� newline �ݡ��Ȥ��뤫�ݤ���*/
1052 skk_egg_like_newline = False ;
1053 /* dabbrev like �� completion ��Ԥ����ɤ�����*/
1054 skkinput_dabbrev_like_completion= False ;
1055 /* chat-adapter-mode �Ĥޤ� newline ���Ƭ�����Ǥʤ�����뤫��*/
1056 skkinput_chatadaptermode = False ;
1057 /* skk-local-jisyo �����뤫�ɤ�����*/
1058 skkinput_search_skk_jisyo = True ;
1059 /* skkinput-record ��������뤫�ɤ�����*/
1060 skkinput_keep_record = True ;
1061 /* ���դ�ɽ��������*/
1062 skkinput_date_ad = False ;
1063 skkinput_number_style = False ;
1064 /* ��������ϳ���ε�ǽ��ޤ�Ǥ���Τ��ݤ���*/
1065 skkinput_delete_implies_kakutei = True ;
1066 /* �����Ѵ���ǽ�����Ѥ��롣*/
1067 skkinput_use_numeric_conversion = True ;
1068 skkinput_rom_kana_rule_list_top = NULL ;
1069 initialize_skkinputDefaultRomKanaRuleList() ;
1070 skkinput_rom_kana_rule_list = skkinput_default_rom_kana_rule_list ;
1071 /* ��������*/
1072 skkinput_tab_width = 8 ;
1073 skkinput_rjj_like_input = False ;
1074 /* �����ȥ����֤δ��֤����ꤹ�롣�ǥե���Ȥ� 10 �äǤ��롣*/
1075 skkinput_autosave_interval = 10 * 1000 ;
1076 return ;
1077 }
1078
1079 /*
1080 * �Ѵ��ץ�ȥ���ʤ˴ط��ʤ� SkkInputWidget �����ˤ����ä�ɬ
1081 * �פ������ؿ���
1082 */
skkinput_setSkkInputValues(Widget gw)1083 int skkinput_setSkkInputValues( Widget gw )
1084 {
1085 Arg arg[ 5 ] ;
1086 Cardinal i ;
1087 i = 0 ;
1088 /* ����ξ���(Modified ���ɤ���)��*/
1089 XtSetArg( arg[ i ], XtNjisyoDirty, skkinput_jisyo_dirty ) ;
1090 i ++ ;
1091 /* egg-like-newline ���ɤ�����*/
1092 XtSetArg( arg[ i ], XtNeggLikeNewline, skk_egg_like_newline ) ;
1093 i ++ ;
1094 /* chat adapter �⡼�ɤ��ɤ�����*/
1095 XtSetArg( arg[ i ], XtNchatAdapter, skkinput_chatadaptermode ) ;
1096 i ++ ;
1097 XtSetValues( gw, arg, i ) ;
1098 return 0 ;
1099 }
1100