1 /* # skkinput (Simple Kana-Kanji Input)
2 * skkldic.c --- search/create/update local dictionary.
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 <time.h>
26 #include <sys/stat.h>
27 #include <sys/types.h>
28 #include <X11/Intrinsic.h>
29
30 #include "commondef.h"
31 #include "buffers.h"
32 #include "config.h"
33
34 /*
35 * �ޥ���������
36 */
37 #define SafeFree(ptr) do{ if( (ptr) != NULL ) free((ptr)) ; } while(0)
38
39 /*
40 * �����ؿ��Υץ�ȥ����������
41 */
42 int check_skkinput_jisyo_code( unsigned char *path ) ;
43 static int skkinput_copyFile( unsigned char *from, unsigned char *to ) ;
44
45 /*
46 * �����ؿ��Υץ�ȥ����������
47 */
48 extern SkkinpSearchVector *add_SkkinpSearchVector
49 ( SkkinpSearchVector *topp, struct myChar *str,
50 SkkinpSearchVector **rnode, int *rpos ) ;
51 extern SkkinpSearchVector *searchSudeniHenkanKakuteiShitamono
52 ( struct myChar *henkankey, SkkinpSearchVector *top, int okuri ) ;
53 extern VectorIndex *makeSearchVectorIndex
54 ( SkkinpSearchVector *top, int *totalnum, int flag ) ;
55 extern void free_SkkinpSearchVector( SkkinpSearchVector **top ) ;
56 extern void free_VectorIndex( VectorIndex **top ) ;
57 /* skkldrec.c */
58 extern unsigned long recentlyHenkanKakuteiKouhoWoFileNiKaku
59 ( FILE *fp, FILE *motoJisyoFp, int okuri ) ;
60 extern void clearHenkanKakuteiHash( void ) ;
61 extern SkkinpSearchVector *searchSudeniPurgeSaretamono
62 ( struct myChar *henkankey, SkkinpSearchVector *top, int okuri ) ;
63 extern void skkinputNoNaibuNoKouhoWoFileNiKaku
64 ( FILE *fp, int okuri, int purge ) ;
65 extern void skkinputAutoSaveFileWoYondeFukugenSuru( FILE *fp ) ;
66 /* parseStr.c */
67 unsigned char *expand_file_name( unsigned char *path ) ;
68
69 /*
70 * �����Х��ѿ������
71 */
72 /* skkinput �����Ѥ���ɽ꼭��Υѥ���*/
73 static unsigned char *skkinput_local_jisyo_path ;
74 static unsigned char *skkinput_autosave_path ;
75 /* local-jisyo �θ��Υѡ��ߥå����*/
76 static mode_t skkinput_local_jisyo_mode ;
77 /* skkinput �����Ѥ���ɽ꼭��ΥХå����åפΥѥ���*/
78 static unsigned char *skkinput_jisyo_backup_path ;
79 /* skk �����Ѥ���ɽ꼭��Υѥ���*/
80 static unsigned char *skk_local_jisyo_path ;
81 /* skkinput record �Υѥ���*/
82 static unsigned char *skkinput_record_path ;
83 static unsigned char *skkinput_record_path_tmp ;
84 /* skkinput �����Ѥ���ɽ꼭��δ��������ɡ�*/
85 static int skkinput_local_jisyo_coding_system ;
86 /* skkinput �����Ѥ���ɽ꼭��� backup �δ��������ɡ�*/
87 static int skkinput_jisyo_backup_coding_system ;
88 /* ~/.skk-jisyo �����Ѥ���ɽ꼭��δ��������ɡ�*/
89 static int skk_local_jisyo_coding_system ;
90 /* ������Ƥ��뤫�ɤ����ġ�*/
91 extern Boolean skkinput_jisyo_dirty ;
92 extern Boolean skkinput_autosave_jisyo_dirty ;
93
94 /* skk-local-jisyo ��õ�����뤫�ɤ�����*/
95 extern int skkinput_search_skk_jisyo ;
96 /* skkinput-record ��������뤫�ɤ�����*/
97 extern int skkinput_keep_record ;
98
99 extern unsigned long skkinput_j_count_kakutei ;
100 extern unsigned long skkinput_j_count_touroku ;
101
102 /*
103 * �ɽ꼭��˴ؤ��������Ԥ��ؿ���
104 */
set_localjisyo(unsigned char * jisyo_path,unsigned char * jisyobak_path,unsigned char * record_path,unsigned char * master_localjisyo)105 int set_localjisyo
106 ( unsigned char *jisyo_path, unsigned char *jisyobak_path,
107 unsigned char *record_path, unsigned char *master_localjisyo )
108 {
109 struct stat local_jisyo_buf ;
110
111 /* ��������Τʥѥ���Ĵ�٤롣*/
112 skkinput_local_jisyo_path = expand_file_name( jisyo_path ) ;
113 skkinput_jisyo_backup_path = expand_file_name( jisyobak_path ) ;
114 skkinput_record_path = expand_file_name( record_path ) ;
115 skk_local_jisyo_path = expand_file_name( master_localjisyo ) ;
116 /* record ���¤Ӥ��դ�������֥ե����뤬ɬ�פˤʤ롣*/
117 skkinput_record_path_tmp =
118 malloc( strlen( skkinput_record_path ) + 2 ) ;
119 if( skkinput_record_path_tmp != NULL ){
120 strcpy( skkinput_record_path_tmp, skkinput_record_path ) ;
121 strcat( skkinput_record_path_tmp, "~" ) ;
122 }
123 if( ( skkinput_autosave_path = malloc
124 ( strlen( skkinput_local_jisyo_path ) + 10 ) ) != NULL ){
125 strcpy( skkinput_autosave_path, skkinput_local_jisyo_path ) ;
126 strcat( skkinput_autosave_path, "-autosave" ) ;
127 }
128 /* coding system ������å����롣*/
129 skkinput_local_jisyo_coding_system =
130 check_skkinput_jisyo_code( skkinput_local_jisyo_path ) ;
131 skkinput_jisyo_backup_coding_system =
132 check_skkinput_jisyo_code( skkinput_jisyo_backup_path ) ;
133 skk_local_jisyo_coding_system =
134 check_skkinput_jisyo_code( skk_local_jisyo_path ) ;
135
136 /* skkinput-local-jisyo �Υѡ��ߥå�����Ĵ�٤롣*/
137 if( stat( skkinput_local_jisyo_path, &local_jisyo_buf ) ){
138 /* �ޤ���umask �����롣���� umask �� 000 �Ǥ��롣*/
139 skkinput_local_jisyo_mode = umask( 0 ) ;
140 /* ���� umask ���᤹��*/
141 umask( skkinput_local_jisyo_mode ) ;
142 /* umask �����Ĥ�Υ⡼�ɤ���롣*/
143 skkinput_local_jisyo_mode =
144 ( S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH ) &
145 ( ~( skkinput_local_jisyo_mode ) ) ;
146 } else {
147 /* ��Ȥ��ä��ѡ��ߥå�����Ѿ����롣*/
148 skkinput_local_jisyo_mode = local_jisyo_buf.st_mode ;
149 }
150 skkinput_j_count_touroku = 0 ;
151 skkinput_j_count_kakutei = 0 ;
152 return 0 ;
153 }
154
155 /*
156 * �ɽ꼭��Τ���˳��ݤ��Ƥ���������������ؿ���
157 */
close_localjisyo(void)158 int close_localjisyo( void )
159 {
160 SafeFree( skkinput_local_jisyo_path ) ;
161 SafeFree( skkinput_jisyo_backup_path ) ;
162 SafeFree( skkinput_record_path ) ;
163 SafeFree( skkinput_record_path_tmp ) ;
164 SafeFree( skkinput_autosave_path ) ;
165 SafeFree( skk_local_jisyo_path ) ;
166 return 0 ;
167 }
168
169 /*
170 * "[" �� "\0" �ȸ���ؿ���
171 */
replace_kakkoToNul(struct myChar * string)172 static int replace_kakkoToNul( struct myChar *string )
173 {
174 while( !IS_END_OF_STRING( *string ) ){
175 if( IS_ASCII_EQUAL( *string, '[' ) ){
176 MYCHAR_SET_END_OF_STRING( *string ) ;
177 return True ;
178 }
179 string ++ ;
180 }
181 return False ;
182 }
183
184 /*
185 * ����ʸ�����о줹��ޤǡ��ե�������ɤ����Ф��ؿ���
186 */
skip_file_until(FILE * fp,unsigned char * string,int coding_system)187 int skip_file_until( FILE *fp, unsigned char *string, int coding_system )
188 {
189 struct myChar *oneline = NULL ;
190
191 while( !feof( fp ) ){
192 oneline = mychar_readOneLine( fp, coding_system ) ;
193 if( oneline == NULL )
194 return False ;
195 if( !myCharCharStrcmp( oneline, string ) ){
196 free( oneline ) ;
197 return True ;
198 }
199 free( oneline ) ;
200 }
201 return False ;
202 }
203
j_okurinasi_search_skkinput_jisyo(FILE * jisyoFp,struct myChar * key,SkkinpSearchVector * top,int coding_system)204 static SkkinpSearchVector *j_okurinasi_search_skkinput_jisyo
205 ( FILE *jisyoFp, struct myChar *key,
206 SkkinpSearchVector *top, int coding_system )
207 {
208 int status = 0, kflag, klen, found ;
209 struct myChar *oneline = NULL ;
210
211 /* ����������Ƭ�ޤ��᤹���ȤȤ��롣*/
212 rewind( jisyoFp ) ;
213 /* ���겾̾�γ��ϰ��֤ޤ����֡�*/
214 skip_file_until( jisyoFp, ";; okuri-nasi entries.", coding_system ) ;
215
216 /* ����������Ĺ������Ƥ���������� strncmp �Τ����ɬ�ס�*/
217 klen = myCharStrlen( key ) ;
218 found = False ;
219
220 /* �ե��������Ƭ�����˸������Ƥ�����*/
221 while( !feof( jisyoFp ) ){
222 /* ʸ�������ɤơ������ EUC �ؤ��Ѵ����롣*/
223 if( ( oneline = mychar_readOneLine( jisyoFp, coding_system ) ) == NULL )
224 break ; /* ������������ continue �ǤϤʤ��Τ��� */
225 /* �����ȤιԤ��ä����ˤϡ����Ԥޤ��ɤ����Ф���*/
226 if( IS_ASCII_EQUAL( *oneline, ';' ) ||
227 myCharStrncmp( oneline, key, klen ) ||
228 !IS_ASCII_EQUAL( oneline[ klen ], ' ' ) ){
229 /* ���겾̾����ˤʤäƤ��ޤä��齪λ���롣*/
230 if( !myCharCharStrcmp( oneline, ";; okuri-ari entries." ) ){
231 /* �ޤ� malloc ����ʸ�����������롣*/
232 free( oneline ) ;
233 oneline = NULL ;
234 /* �ޤ����뤫�⤷��ʤ�����ȥ��õ���ġ�*/
235 if( !skip_file_until
236 ( jisyoFp, ";; okuri-nasi entries.", coding_system ) )
237 break ;
238 } else {
239 /* �ޤ� malloc ����ʸ�����������롣*/
240 free( oneline ) ;
241 oneline = NULL ;
242 }
243 status = 0 ;
244 kflag = False ;
245 } else {
246 /* �������Ƥ���ʸ�����դ��ä����ν�����*/
247 found = True ;
248 break ;
249 }
250 }
251 /* ���դ���ʤ��ä����ˤϡ�NULL ���֤���*/
252 if( !found || oneline == NULL ){
253 return top ;
254 }
255 /* ���դ��ä����ν������ɤ߹����ʸ�����ˤ�äƤϰ�Ԥ������ɤ� *
256 * ����Ƥʤ���ǽ���⤢�롣�������ա�*/
257 top = add_SkkinpSearchVector
258 ( top, oneline + klen + 1, NULL, NULL ) ;
259 free( oneline ) ;
260 return top ;
261 }
262
263
264 /*
265 * ���겾̾��̵�����ζɽ꼭��θ�����Ԥ��ؿ���
266 */
j_okurinasi_search_skkinput_jisyo_with_path(unsigned char * jisyo_path,struct myChar * key,SkkinpSearchVector * top,int coding_system)267 static SkkinpSearchVector *j_okurinasi_search_skkinput_jisyo_with_path
268 ( unsigned char *jisyo_path, struct myChar *key,
269 SkkinpSearchVector *top, int coding_system )
270 {
271 FILE *fp ;
272 /* �ޤ��������ʤ���С����äˤʤ�ʤ���*/
273 if( ( fp = fopen( jisyo_path, "rb" ) ) == NULL )
274 return top ;
275 top = j_okurinasi_search_skkinput_jisyo
276 ( fp, key, top, coding_system ) ;
277 fclose( fp ) ;
278 return top ;
279 }
280
281 /*
282 * ���겾̾��������ζɽ꼭��θ�����Ԥ��ؿ���
283 */
j_okuriari_search_skkinput_jisyo(FILE * jisyoFp,struct myChar * key,SkkinpSearchVector * top,int coding_system)284 static SkkinpSearchVector *j_okuriari_search_skkinput_jisyo
285 ( FILE *jisyoFp, struct myChar *key,
286 SkkinpSearchVector *top, int coding_system )
287 {
288 int status = 0, kflag, klen, found ;
289 struct myChar *oneline = NULL ;
290
291 /* ����������Ĺ������Ƥ���������� strncmp �Τ����ɬ�ס�*/
292 klen = myCharStrlen( key ) ;
293 found = False ;
294
295 rewind( jisyoFp ) ;
296 /* ���겾̾�γ��ϰ��֤ޤ����֡�*/
297 skip_file_until( jisyoFp, ";; okuri-ari entries.", coding_system ) ;
298
299 /* �ե��������Ƭ�����˸������Ƥ�����*/
300 while( !feof( jisyoFp ) ){
301 /* ʸ�������ɤơ������ EUC �ؤ��Ѵ����롣*/
302 if( ( oneline = mychar_readOneLine
303 ( jisyoFp, coding_system ) ) == NULL )
304 break ; /* ������������ continue �ǤϤʤ��Τ��� */
305
306 /* �����ȤιԤ��ä����ˤϡ����Ԥޤ��ɤ����Ф���*/
307 if( IS_ASCII_EQUAL( *oneline, ';' ) ||
308 myCharStrncmp( oneline, key, klen ) ||
309 !IS_ASCII_EQUAL( oneline[ klen ], ' ' ) ){
310 /* ���겾̵̾���ˤʤäƤ��ޤä��齪λ���롣*/
311 if( !myCharCharStrcmp( oneline, ";; okuri-nasi entries." ) ){
312 free( oneline ) ;
313 oneline = NULL ;
314 /* �ޤ����뤫�⤷��ʤ�����ȥ��õ���ġ�*/
315 if( !skip_file_until
316 ( jisyoFp, ";; okuri-ari entries.", coding_system ) )
317 break ;
318 } else {
319 free( oneline ) ;
320 oneline = NULL ;
321 }
322 status = 0 ;
323 kflag = False ;
324 } else {
325 /* �������Ƥ���ʸ�����դ��ä����ν�����*/
326 found = True ;
327 break ;
328 }
329 }
330 /* ���դ���ʤ��ä����ˤϡ�NULL ���֤���*/
331 if( !found || oneline == NULL ){
332 return top ;
333 }
334
335 /* ľ���Ѵ��ˤϴط���̵�� "/[��/��]/" ������������ʬ��õ�롣*/
336 replace_kakkoToNul( oneline ) ;
337 top = add_SkkinpSearchVector( top, oneline + klen + 1, NULL, NULL ) ;
338 free( oneline ) ;
339 return top ;
340 }
341
342 /*
343 * ���겾̾��������ζɽ꼭��θ�����Ԥ��ؿ���
344 */
j_okuriari_search_skkinput_jisyo_with_path(unsigned char * jisyo_path,struct myChar * key,SkkinpSearchVector * top,int coding_system)345 static SkkinpSearchVector *j_okuriari_search_skkinput_jisyo_with_path
346 ( unsigned char *jisyo_path, struct myChar *key,
347 SkkinpSearchVector *top, int coding_system )
348 {
349 FILE *fp ;
350
351 /* �ޤ��������ʤ���С����äˤʤ�ʤ���*/
352 if( ( fp = fopen( jisyo_path, "rb" ) ) == NULL )
353 return top ;
354 top = j_okuriari_search_skkinput_jisyo
355 ( fp, key, top, coding_system ) ;
356 fclose( fp ) ;
357 return top ;
358 }
359
360 /*
361 * �ɽ꼭��θ�����Ԥ��ؿ���
362 */
j_search_skkinput_local_jisyo(struct myChar * key,SkkinpSearchVector * top,int okuri)363 SkkinpSearchVector *j_search_skkinput_local_jisyo
364 ( struct myChar *key, SkkinpSearchVector *top, int okuri )
365 {
366 if( okuri ){
367 /* �ɽ꼭��õ���ޤ��礦�ġ�*/
368 top = j_okuriari_search_skkinput_jisyo_with_path
369 ( skkinput_local_jisyo_path, key, top,
370 skkinput_local_jisyo_coding_system ) ;
371 /* .skk-jisyo ��Τߤʤ��Ρ� */
372 if( skkinput_search_skk_jisyo )
373 top = j_okuriari_search_skkinput_jisyo_with_path
374 ( skk_local_jisyo_path, key, top,
375 skk_local_jisyo_coding_system ) ;
376 } else {
377 /* �ɽ꼭��õ���ޤ��礦�ġ�*/
378 top = j_okurinasi_search_skkinput_jisyo_with_path
379 ( skkinput_local_jisyo_path, key, top,
380 skkinput_local_jisyo_coding_system ) ;
381 /* .skk-jisyo ��Τߤʤ��Ρ� */
382 if( skkinput_search_skk_jisyo )
383 top = j_okurinasi_search_skkinput_jisyo_with_path
384 ( skk_local_jisyo_path, key, top,
385 skk_local_jisyo_coding_system ) ;
386 }
387 return top ;
388 }
389
390 /*
391 * �ɽ꼭���backup���鸡����Ԥ��ؿ���
392 */
j_search_skkinput_jisyo_with_fileptr(struct myChar * key,SkkinpSearchVector * top,int okuri,FILE * fp)393 SkkinpSearchVector *j_search_skkinput_jisyo_with_fileptr
394 ( struct myChar *key, SkkinpSearchVector *top, int okuri, FILE *fp )
395 {
396 if( okuri ){
397 /* �ɽ꼭��õ���ޤ��礦�ġ�*/
398 return j_okuriari_search_skkinput_jisyo
399 ( fp, key, top, skkinput_local_jisyo_coding_system ) ;
400 } else {
401 /* �ɽ꼭��õ���ޤ��礦�ġ�*/
402 return j_okurinasi_search_skkinput_jisyo
403 ( fp, key, top, skkinput_local_jisyo_coding_system ) ;
404 }
405 }
406
407 /*
408 * �ɽ꼭��� completion ������Ԥ��ؿ���
409 */
j_completion_skkinput_local_jisyo_sub(unsigned char * jisyo_path,struct myChar * key,SkkinpSearchVector * top,int coding_system)410 static SkkinpSearchVector *j_completion_skkinput_local_jisyo_sub
411 ( unsigned char *jisyo_path, struct myChar *key,
412 SkkinpSearchVector *top, int coding_system )
413 {
414 FILE *fp ;
415 int status = 0, kflag, klen, found ;
416 struct myChar *oneline, *ptr ;
417 static struct myChar kouhoNoSeparator[] = {
418 { CHARSET_ASCII, '/' }, { CHARSET_ASCII, '\0' },
419 } ;
420
421 /* �ޤ��������ʤ���С����äˤʤ�ʤ���*/
422 if( ( fp = fopen( jisyo_path, "rb" ) ) == NULL )
423 return top ;
424
425 /* ���겾̾�γ��ϰ��֤ޤ����֡�*/
426 skip_file_until( fp, ";; okuri-nasi entries.", coding_system ) ;
427
428 /* ����������Ĺ������Ƥ���������� strncmp �Τ����ɬ�ס�*/
429 klen = myCharStrlen( key ) ;
430 found = False ;
431
432 /* �ե��������Ƭ�����˸������Ƥ�����*/
433 while( !feof( fp ) ){
434 if( ( oneline = mychar_readOneLine( fp, coding_system ) ) == NULL )
435 break ;
436 /* �����ȤιԤ��ä����ˤϡ����Ԥޤ��ɤ����Ф���*/
437 if( IS_ASCII_EQUAL( *oneline, ';' ) ||
438 myCharStrncmp( oneline, key, klen ) ){
439 /* ���겾̾����ˤʤäƤ��ޤä��齪λ���롣*/
440 if( !myCharCharStrcmp( oneline, ";; okuri-ari entries." ) ){
441 free( oneline ) ;
442 oneline = NULL ;
443 /* �ޤ����뤫�⤷��ʤ�����ȥ��õ���ġ�*/
444 if( !skip_file_until
445 ( fp, ";; okuri-nasi entries.", coding_system ) )
446 break ;
447 } else {
448 free( oneline ) ;
449 oneline = NULL ;
450 }
451 status = 0 ;
452 kflag = False ;
453 } else {
454 /* �������Ƥ���ʸ�����դ��ä����ν�����*/
455 if( !found ){
456 /* ��Ƭ�� '/' ������Ƥ�����*/
457 top = add_SkkinpSearchVector
458 ( top, kouhoNoSeparator, NULL, NULL ) ;
459 found = True ;
460 }
461 /* ���ڡ��������äƤ��Ƥ���̣���Τǡ���������ޤ���*/
462 ptr = oneline ;
463 while( !IS_ASCII_EQUAL( *ptr, ' ' ) && !IS_END_OF_STRING( *ptr ) )
464 ptr ++ ;
465 MYCHAR_SET_END_OF_STRING( *ptr ) ;
466 /* ��Ͽ���ޤ���*/
467 top = add_SkkinpSearchVector
468 ( top, oneline, NULL, NULL ) ;
469 top = add_SkkinpSearchVector
470 ( top, kouhoNoSeparator, NULL, NULL ) ;
471 free( oneline ) ;
472 oneline = NULL ;
473 }
474 }
475 fclose( fp ) ;
476 return top ;
477 }
478
479 /*
480 * completion search ��ɽ꼭����Ф��Ƥ�����ؿ���
481 */
j_completion_skkinput_local_jisyo(SkkinpSearchVector * top,struct myChar * completion_key)482 SkkinpSearchVector *j_completion_skkinput_local_jisyo
483 ( SkkinpSearchVector *top, struct myChar *completion_key )
484 {
485 top = j_completion_skkinput_local_jisyo_sub
486 ( skkinput_local_jisyo_path, completion_key, top,
487 skkinput_local_jisyo_coding_system ) ;
488 /* .skk-jisyo ��Τߤʤ��Ρ� */
489 if( skkinput_search_skk_jisyo )
490 top = j_completion_skkinput_local_jisyo_sub
491 ( skk_local_jisyo_path, completion_key, top,
492 skk_local_jisyo_coding_system ) ;
493 return top ;
494 }
495
496 /*
497 * �ե������į��ơ�ESC �����äƤ���� JIS��8bit �ܤ�Ω�äƤ��륳����
498 * �����äƤ����� EUC �Ȥ������Ƚ�Ǥ��뤫�ʤ�Ŭ���ʴؿ���
499 *----
500 * skkinput-jisyo ���Ѥʴ��������ɤ�����ʤ��褦�ˡġ�
501 */
check_skkinput_jisyo_code(unsigned char * path)502 int check_skkinput_jisyo_code( unsigned char *path )
503 {
504 FILE *fp ;
505 int ret = KANJI_CODE_UNKNOWN, flag8bit = False ;
506 unsigned char buffer[ TEXTBUFSIZE ] ;
507
508 /* ����ե����뤬¸�ߤ��ʤ����ˤϡ�������Ǿ����coding system�� *
509 * ���롣*/
510 if( ( fp = fopen( path, "rb" ) ) == NULL ){
511 return CODING_SYSTEM_IS_EUC ;
512 }
513 while( !feof( fp ) ){
514 fgets( buffer, TEXTMAXLEN, fp ) ;
515 buffer[ TEXTMAXLEN ] = '\0' ;
516 ret = check_kanjiCode( buffer, strlen( buffer ) ) ;
517 /* �⤷ 8bit �ܤ�Ω�äƤ�������Ƚ���Բ�ǽ�Ǥ��ä���硣*/
518 if( ret == KANJI_CODE_EUC_SJIS_UNKNOWN ){
519 flag8bit = True ;
520 continue ;
521 }
522 /* ���Υ����ɤ�Ƚ�̲�ǽ���ä���硣*/
523 if( ret != KANJI_CODE_UNKNOWN )
524 break ;
525 }
526 if( ret == KANJI_CODE_EUC_SJIS_UNKNOWN ){
527 ret = KANJI_CODE_EUC ;
528 } else if( ret == KANJI_CODE_UNKNOWN ){
529 ret = ( flag8bit )? KANJI_CODE_EUC : KANJI_CODE_JIS ;
530 }
531 fclose( fp ) ;
532 return ret ;
533 }
534
535 /*
536 * VectorIndexList �ˤ��������Ҥ�ü����ե�����ؤ�ž������ؿ���
537 */
writeVectorIndexToFile(FILE * fp,VectorIndex * vNode)538 void writeVectorIndexToFile( FILE *fp, VectorIndex *vNode )
539 {
540 int len ;
541 SkkinpSearchVector *sNode ;
542 struct myChar *ptr ;
543
544 /* �ޤ��ǽ�� "/" ��ɽ�����롣*/
545 fputc( '/', fp ) ;
546 #ifdef DEBUG
547 printf( "%c", 0x2f ) ;
548 #endif
549
550 /* �ʲ�������ɤ롣*/
551 while( vNode != NULL ){
552 sNode = vNode->node ;
553 ptr = sNode->text + vNode->position ;
554 len = vNode->length ;
555 while( len > 0 ){
556 if( IS_END_OF_STRING( *ptr ) ){
557 sNode = sNode->next ;
558 /* �ޤ�������̵���Ȥϡ��ԳФ���ä������㤢�ʤ����롼�פ�ȴ *
559 * ���褫��*/
560 if( sNode == NULL ){
561 #ifdef DEBUG
562 fprintf( stderr, "I lost next skkinput-search-vector!\n" ) ;
563 #endif
564 fputc( '\n', fp ) ;
565 return ;
566 }
567 ptr = sNode->text ;
568 }
569 #ifdef DEBUG
570 myCharFputEUCc( *ptr, stdout ) ;
571 #endif
572 myCharFputEUCc( *ptr ++, fp ) ;
573 len -- ;
574 }
575 #ifdef DEBUG
576 printf( "%c", 0x2f ) ;
577 #endif
578 fputc( 0x2f, fp ) ;
579 vNode = vNode->next ;
580 }
581 #ifdef DEBUG
582 printf( "\n" ) ;
583 #endif
584 fputc( '\n', fp ) ;
585 return ;
586 }
587
588 /*
589 * �Ѵ��η�̤�Ф��ؿ�
590 *-----
591 * int okuri �� char *daimoku �ˤ�ä����ꤢ��Ȥʤ��ζ��̤�Ĥ��Ƥޤ���
592 */
skkinput_updateHenkanResult(FILE * fpSrc,FILE * fpDest,int okuri,unsigned char * daimoku,int coding_system)593 static unsigned long skkinput_updateHenkanResult
594 ( FILE *fpSrc, FILE *fpDest, int okuri,
595 unsigned char *daimoku, int coding_system )
596 {
597 SkkinpSearchVector *top, *purgeTop ;
598 VectorIndex *vTop, *vTopPurge ;
599 int len ;
600 unsigned long count = 0 ;
601 struct myChar *search_key = NULL, *ptr ;
602
603 /* �ޤ��������ܤ��롣����������ޥ��������參��*/
604 fprintf( fpDest, "%s\n", daimoku ) ;
605 fflush( fpDest ) ;
606 count ++ ;
607
608 /* �����˴�����������Ͽ����Ƥ����Ѵ����������¤٤�����롣*/
609 count += recentlyHenkanKakuteiKouhoWoFileNiKaku
610 ( fpDest, fpSrc, okuri ) ;
611
612 /* ���ͤˤ���ե����뤬̵������ä��顢�ʲ��ν�����̵�롪 ����ɬ�� *
613 * �Ϥʤ��� */
614 if( fpSrc == NULL )
615 return count ;
616
617 /* ������ե��������Ƭ�ޤ��ᤷ�Ƥ�����*/
618 rewind( fpSrc ) ;
619
620 /* ���겾̾�γ��ϰ��֤ޤ����֡�*/
621 skip_file_until( fpSrc, daimoku, coding_system ) ;
622
623 /* �ե�����ν�λ�ޤǥ�����롣*/
624 while( !feof( fpSrc ) ){
625 /* ʸ�������ɤơ������ EUC �ؤ��Ѵ����롣*/
626 if( ( search_key = mychar_readOneLine( fpSrc, coding_system ) ) == NULL )
627 break ;
628
629 /* �����ȤιԤ��ä����ˤϡ����Ԥޤ��ɤ����Ф���*/
630 /* �ޤ���Ĺ����Ѵ������⤹�äȤФ�������ʤλȤ��ʤ���� */
631 if( IS_ASCII_EQUAL( search_key[ 0 ], ';' ) ||
632 IS_END_OF_STRING( search_key[ 0 ] ) ||
633 IS_ASCII_EQUAL( search_key[ 0 ], '\n' ) ||
634 IS_ASCII_EQUAL( search_key[ 0 ], '\r' ) ||
635 IS_ASCII_EQUAL( search_key[ 0 ], ' ' ) ){
636 free( search_key ) ;
637 search_key = NULL ;
638 /* �ޤ����뤫�⤷��ʤ�����ȥ��õ���ġ�*/
639 if( !skip_file_until( fpSrc, daimoku, coding_system ) )
640 break ;
641 /* ���餫�Υ���ȥ꤬���դ��ä����ˤϡļ���������ġ����ʤ� *
642 * �Ȥ⺣��� ";" �ʤ�ƥܥ��ܥ���ɽ�����ƤϤ����ʤ���*/
643 continue ;
644 }
645 for( ptr = search_key ; !IS_END_OF_STRING( *ptr ) ; ptr ++ ){
646 if( IS_ASCII_EQUAL( *ptr, ' ' ) ){
647 MYCHAR_SET_END_OF_STRING( *ptr ) ;
648 ptr ++ ;
649 break ;
650 }
651 }
652 if( IS_END_OF_STRING( *ptr ) ){
653 free( search_key ) ;
654 search_key = ptr = NULL ;
655 continue ;
656 }
657 top = NULL ;
658 /* �����Ѵ����ꤷ����Τ��������¸�ߤ��뤫�ɤ��������å����롣*/
659 top = searchSudeniHenkanKakuteiShitamono
660 ( search_key, top, okuri ) ;
661 if( top == NULL ){
662 purgeTop = NULL ;
663 /* �ѡ��������٤���ΤǤ��뤫�ɤ�����Ƚ�Ǥ�ɬ�פǤ��롣*/
664 purgeTop = searchSudeniPurgeSaretamono
665 ( search_key, purgeTop, okuri ) ;
666 if( purgeTop != NULL ){
667 /* �ɤ���顢purge ���줿��Τ�����餷����*/
668 top = add_SkkinpSearchVector( top, ptr, NULL, NULL ) ;
669 /* ��ö���ѡ���¦��ϥå���ơ��֥��á�����ࡣ*/
670 vTopPurge = makeSearchVectorIndex( purgeTop, &len, False ) ;
671 /* ���줫�顢�ϥå���ơ��֥�ʤ���ñ����ڤ�Ф���*/
672 /* �ڤ�Ф�����˥ϥå��夬���ꥢ����ƤϺ���Τǡ�False �Ǥ� */
673 /* �롣�ɤ줫��ĤǤ�ҥåȤ��ʤ���С��ѡ����ꥹ�Ȥ����� */
674 /* ��̣������̵����*/
675 vTop = makeSearchVectorIndex( top, &len, True ) ;
676 /* ��ĤǤ��Ѵ���̤�¸�ߤ���Τʤ�ġ� */
677 if( vTop != NULL && len > 0 ){
678 /* �����դ��ä��Ѵ�������Ф���*/
679 myCharFputstring( fpDest, search_key ) ;
680 fputc( ' ', fpDest ) ;
681 /* VectorIndex ��ե�������ݤ��Ф��Ĥ��οͤϺǸ��'\n' ���� *
682 * ��Ƥ���롣*/
683 writeVectorIndexToFile( fpDest, vTop ) ;
684 count ++ ;
685 }
686 /* ���ݤ�������β�����*/
687 free_VectorIndex( &vTop ) ;
688 free_VectorIndex( &vTopPurge ) ;
689 free_SkkinpSearchVector( &top ) ;
690 free_SkkinpSearchVector( &purgeTop ) ;
691 } else {
692 /* �����դ��ä��Ѵ�������Ф���*/
693 myCharFputstring( fpDest, search_key ) ;
694 fputc( ' ', fpDest ) ;
695 /* �����Ѵ����ꤷ����Τ�������äƤ��ʤ��Ȥ������Ȥϡ����Τ� *
696 * �Ф��Ƥ�����סĤ���ǤȤ�������ǤȤ���*/
697 myCharFputstring( fpDest, ptr ) ;
698 fputc( '\n', fpDest ) ;
699 fflush( fpDest ) ;
700 count ++ ;
701 }
702 } else {
703 /* �����Ѵ����ꤷ�Ƥ�����Τ��Ǥ��Ф���Ƥ��롣������ΤƤ롣*/
704 free_SkkinpSearchVector( &top ) ;
705 }
706 free( search_key ) ;
707 search_key = ptr = NULL ;
708 }
709 return count ;
710 }
711
712 /*
713 * �ե������¸�ߤ�̵ͭ��Ĵ�٤�ؿ���
714 */
isFileExist(unsigned char * path)715 static int isFileExist( unsigned char *path )
716 {
717 FILE *fp ;
718 /* �ե�������ɤ߹��ߥ⡼�ɤdz����Ƥߤ롣*/
719 if( ( fp = fopen( path, "rb" ) ) == NULL )
720 return False ;
721 /* �������Τʤ�¸�ߤ��롣�ե�������Ĥ��� return True! */
722 fclose( fp ) ;
723 return True ;
724 }
725
skkinput_updateRecord(unsigned long lines)726 static void skkinput_updateRecord( unsigned long lines )
727 {
728 FILE *fpd, *fps ;
729 time_t tval ;
730 struct tm *lt ;
731 char buffer[ TRANSBUFSIZE ] ;
732 int exist_record_p ;
733 static char *skk_week_alist[] = {
734 "Sun", "Mon", "Tue", "Wed", "Thr", "Fri", "Sat",
735 } ;
736 static char *skk_month_alist[] = {
737 "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep",
738 "Oct", "Nov", "Dec",
739 } ;
740
741 /* 1970/1/1����ηв��������롣*/
742 if( time( &tval ) == -1 )
743 return ;
744
745 /* ������ꤷ�����Ȥ��ʤ��ä���ΤƤ롣*/
746 if( skkinput_j_count_kakutei <= 0 )
747 return ;
748 /* ���顼��ȯ�����������ܤǤ��礦��*/
749 exist_record_p = isFileExist( skkinput_record_path ) ;
750 if( exist_record_p ){
751 /* �ե�����ԡ����롣link �Ǥ��ɤ����ɤͤ��ġ�*/
752 if( !skkinput_copyFile
753 ( skkinput_record_path, skkinput_record_path_tmp ) ){
754 return ;
755 }
756 }
757 /* �ե����뤬�����ʤ��ä��顢���롣*/
758 if( ( fpd = fopen( skkinput_record_path, "w" ) ) == NULL )
759 return ;
760 /* ����ǯ�β�����������Ǥ��뤫�����롣*/
761 #if 0
762 (void)strftime
763 ( buffer, TEXTBUFSIZE, "%a %b %d %T %Y", localtime( &tval ) ) ;
764 fprintf
765 ( fpd, "%s ��Ͽ: %3ld ����: %4ld ����Ψ: %3ld%% ���: %6ld\n",
766 buffer, skkinput_j_count_touroku, skkinput_j_count_kakutei,
767 ( skkinput_j_count_kakutei - skkinput_j_count_touroku ) * 100 /
768 skkinput_j_count_kakutei, lines ) ;
769 #else
770 lt = localtime( &tval ) ;
771 fprintf( fpd, "%s %s %2d %02d:%02d:%02d %d",
772 skk_week_alist [ lt->tm_wday ],
773 skk_month_alist[ lt->tm_mon ],
774 lt->tm_mday, lt->tm_hour, lt->tm_min, lt->tm_sec,
775 lt->tm_year + 1900 ) ;
776 fprintf
777 ( fpd, " ��Ͽ: %3ld ����: %4ld ����Ψ: %3ld%% ���: %6ld\n",
778 skkinput_j_count_touroku, skkinput_j_count_kakutei,
779 ( skkinput_j_count_kakutei - skkinput_j_count_touroku ) * 100 /
780 skkinput_j_count_kakutei, lines ) ;
781 #endif
782
783 if( exist_record_p ){
784 size_t num ;
785
786 if( ( fps = fopen( skkinput_record_path_tmp, "r" ) ) == NULL ){
787 fclose( fpd ) ;
788 return ;
789 }
790 /* �Ĥ�ϥ��ԡ����롣*/
791 while( !feof( fps ) ){
792 num = fread( buffer, sizeof( char ), TEXTBUFSIZE, fps ) ;
793 /* �����ǥե����륷���ƥ�ե�Υ����å��äƤ��ä��ɤ��Ȼפ��Τ� */
794 /* ���ɡ� */
795 if( fwrite( buffer, sizeof( char ), num, fpd ) < num ){
796 /* ���ȥ��顼ȯ��������ϴ��Ǥ���*/
797 fclose( fps ) ;
798 fclose( fpd ) ;
799 /* ������Ȥ����ե�����ϻߤᡣ�����*/
800 unlink( skkinput_record_path ) ;
801 /* ��Ȥ��᤹�������Ǥϥ��顼�����å����ʤ������äƤ��������� */
802 /* ���ä���ɤ�����Ρ� */
803 /* ���ա֤��줸�㡢�����ꤵ�ɤ����ޤ��礦������*/
804 /* 1. ���դ����̼�ˤ��롣*/
805 /* 2. ���οͤ˻���Ƥ�餦��*/
806 /* 3. �������*/
807 link( skkinput_record_path_tmp, skkinput_record_path ) ;
808 return ;
809 }
810 }
811 fclose( fps ) ;
812 /* ����ե������õ�롣*/
813 unlink( skkinput_record_path_tmp ) ;
814 }
815 fclose( fpd ) ;
816 skkinput_j_count_kakutei = 0 ;
817 skkinput_j_count_touroku = 0 ;
818 return ;
819 }
820
821 /*
822 * �ե�����ԡ�����ؿ��ġ�
823 */
skkinput_copyFile(unsigned char * from,unsigned char * to)824 static int skkinput_copyFile( unsigned char *from, unsigned char *to )
825 {
826 FILE *fpTo, *fpFrom ;
827 int rnum ;
828 unsigned char buffer[ TRANSBUFSIZE ] ;
829
830 /* ���ԡ��褬�����ʤ��ä������Ф���̣����*/
831 if( ( fpTo = fopen( to, "wb" ) ) == NULL )
832 return False ;
833 /* ���ԡ����������ʤ��äƤ⼺�ԡ�*/
834 if( ( fpFrom = fopen( from, "rb" ) ) == NULL ){
835 fclose( fpTo ) ;
836 return False ;
837 }
838 rnum = 0 ;
839 while( !feof( fpFrom ) ){
840 rnum =
841 fread( buffer, sizeof( unsigned char ), TRANSBUFSIZE, fpFrom ) ;
842 /* �ɤ߹���̤�������ġ�*/
843 if( fwrite( buffer, sizeof( unsigned char ), rnum, fpTo ) < rnum ){
844 /* �����̤����Τ������ʤ��ʤäƤ���Ĥ���ϰ۾����ȯ���� */
845 /* ���̤ϥե����륷���ƥ�ե��������ɤ͡�*/
846 fclose( fpFrom ) ;
847 fclose( fpTo ) ;
848 /* �Ȥ����櫓�ǡ����ԡ�����ߤ��ƺ�꤫���Υե������õ�롣*/
849 unlink( to ) ;
850 /* ���ԡ��ȡ�*/
851 return False ;
852 }
853 }
854 fclose( fpTo ) ;
855 fclose( fpFrom ) ;
856 return True ;
857 }
858
859 /*
860 * ����˺������Ѵ����ꤷ�Ƥ�����������ؿ���
861 */
skkinput_updateLocalJisyo(void)862 void skkinput_updateLocalJisyo( void )
863 {
864 FILE *fpSrc, *fpDest ;
865 unsigned long lines ;
866 char tempfilename[64] ; /* "/tmp" + 16 + 1? */
867 int tmpfd;
868
869 #ifdef DEBUG_LDIC
870 fprintf( stderr, "Now saving ....\"%s\"\n", skkinput_local_jisyo_path ) ;
871 #endif
872 /*
873 * �֤����ࡣ�ɤ���äƼ������褦��������ġ���
874 * �֤����Ͱ�ͤλ��Ƥ뿿�¤ʤɤ������٤Τ�ΤǤ����ʤ��Τ���
875 * �֤����餳����������������르�ꥺ�������
876 * �֤����ɡ��ߤ�ʤϥܥ��Υ��르�ꥺ����������ʤ��Τ��ʡ���
877 * �֤����Х�������
878 */
879 /*
880 * ����ʤ��ơġ�
881 * ������椫����ꤷ����Τ������äƤ���Τʤ����뤳�Ȥϰ�Ĥ�����
882 * ����� A->B �ؤ� COPY ���ʤ��顢��������դ��ä���٤���Τ����ä���
883 * ���������������롣
884 * A �� backup �ˤ��ơ�backup ���� B �������ե�����ˤ��롣
885 * ����� OK �ΤϤ��ǤϤ��뤱�ɡ�
886 * �֡ķ��� purge �Ȥ������դ�˺��Ƥ���ʡ��߷��
887 */
888 /* �Хå����å����õ�롣��������äȲİ��������ʡ� */
889
890 /* ��Ȥ��� BACKUP JISYO ��¸�ߤ��ʤ���硢�����ơ�LOCAL-JISYO �� *
891 * ¸�ߤ��ʤ����Ϥɤ�����Τ��� */
892
893 /* ����ι�����Ԥ��ݤ����Ѥ����ƥ�ݥ��ե����롣*/
894 strcpy(tempfilename, "/tmp/skkinputXXXXXX");
895 tmpfd = mkstemp(tempfilename);
896 if (tmpfd < 0) {
897 perror("skkinput: cannot create temp file");
898 return;
899 }
900
901 /* �ɽ꼭��ΥХå����åפ������롣���Ԥ������ʤ��Τ�ʤ���*/
902 unlink( skkinput_jisyo_backup_path ) ;
903
904 /* ��ö�ƥ�ݥ��ե�����ؤȥ��ԡ����롣
905 * ���ԡ����������褦�����Ԥ��褦����ɬ�� tempfile �Ϻ���뤳�Ȥ�
906 * ��դ��뤳�ȡ������顢���θ�� fopen �����Ԥ��뤳�ȤϤʤ���*/
907 skkinput_copyFile
908 ( skkinput_local_jisyo_path, tempfilename ) ;
909 /* �ɽ꼭��Υ��ԡ���¸�ߤ��ʤ����������̣�����֤Ǥ��롣*/
910 if( ( fpSrc = fdopen( tmpfd, "rb" ) ) == NULL ){
911 close(tmpfd);
912 #ifdef DEBUG_LDIC
913 fprintf( stderr, "cannot create backup jisyo...error!\n" ) ;
914 #endif
915 return ;
916 }
917 /* ����ʤ��Ĥ����̵�����ġ�*/
918 if( ( fpDest = fopen( skkinput_local_jisyo_path, "wb" ) ) == NULL ){
919 #ifdef DEBUG_LDIC
920 fprintf( stderr, "cannot create local jisyo...error!\n" ) ;
921 #endif
922 fclose( fpSrc ) ;
923 /* backup ��̾���˥�͡��ह�롣���Ԥ��뤫�⤷��ʤ����ɡĤ� *
924 * �ξ��ˤ�̵�뤹�뤷���ʤ����ʡ� */
925 skkinput_copyFile
926 ( tempfilename, skkinput_local_jisyo_path ) ;
927 /* permission ���᤹��*/
928 chmod( skkinput_local_jisyo_path, skkinput_local_jisyo_mode ) ;
929 /* file coding system ��Ĵ��ľ����*/
930 skkinput_local_jisyo_coding_system =
931 check_skkinput_jisyo_code( skkinput_local_jisyo_path ) ;
932 unlink( tempfilename ) ;
933 return ;
934 }
935 lines = 0 ;
936 /* ���겾̾�Ѵ��η�̤���ࡣ*/
937 lines += skkinput_updateHenkanResult
938 ( fpSrc, fpDest, True, ";; okuri-ari entries.",
939 skkinput_jisyo_backup_coding_system ) ;
940 /* ���겾̵̾���Ѵ��η�̤���ࡣ*/
941 lines += skkinput_updateHenkanResult
942 ( fpSrc, fpDest, False, ";; okuri-nasi entries.",
943 skkinput_jisyo_backup_coding_system ) ;
944 /* �ե�����ݥ����Ĥ��롣*/
945 fclose( fpSrc ) ;
946 fclose( fpDest ) ;
947 /* permission �����ꡣ*/
948 chmod( skkinput_local_jisyo_path, skkinput_local_jisyo_mode ) ;
949 /* backup ����˥��ԡ����롣*/
950 skkinput_copyFile
951 ( tempfilename, skkinput_jisyo_backup_path ) ;
952 /* ����ǥХå����åפ� coding system �� skkinput-local-jisyo �� *
953 * coding system ��Ʊ���ˤʤä���*/
954 skkinput_jisyo_backup_coding_system =
955 skkinput_local_jisyo_coding_system ;
956 /* permission �����ꡣ*/
957 chmod( skkinput_jisyo_backup_path, skkinput_local_jisyo_mode ) ;
958 /* ����ե������õ�롣*/
959 unlink( tempfilename ) ;
960 /* �ϥå���ꥢ�������������å���ľ����*/
961 clearHenkanKakuteiHash() ;
962 skkinput_local_jisyo_coding_system =
963 check_skkinput_jisyo_code( skkinput_local_jisyo_path ) ;
964 /* skkinput-keep-record �ʤ�Сġ�*/
965 if( skkinput_keep_record ){
966 /* record file �����롣*/
967 skkinput_updateRecord( lines ) ;
968 }
969 /* �����֤��줿�Τ����顢�ե������ skkinput �������μ����Ʊ��Τ�
970 * �ΤȤʤä��Τ����顢����ι���(�ѹ�)�ե饰�� False �ˤʤ롣*/
971 skkinput_jisyo_dirty = False ;
972 skkinput_autosave_jisyo_dirty = False ;
973 /* �����ȥ����֥ե����뤬���ä����ˤϺ�����롣�����˥����֤��줿
974 * �Τ����顢��֥ե�����Ϥ⤦���פǤ���*/
975 if( skkinput_autosave_path != NULL ){
976 unlink( skkinput_autosave_path ) ;
977 }
978 #ifdef DEBUG_LDIC
979 fprintf( stderr, ".......Done\n" ) ;
980 #endif
981 return ;
982 }
983
984 /*
985 * ����˺������Ѵ����ꤷ�Ƥ�����������ؿ���
986 */
skkinput_autosaveLocalJisyo(void)987 void skkinput_autosaveLocalJisyo( void )
988 {
989 FILE *fp ;
990 if( skkinput_autosave_path == NULL )
991 return ;
992 /* �ʤ��ä�����ʤ��ä����Τ�ʤ���*/
993 if( ( fp = fopen( skkinput_autosave_path, "wb" ) ) == NULL )
994 return ;
995 /* �����äȽ��ࡣ*/
996 skkinputNoNaibuNoKouhoWoFileNiKaku( fp, False, False ) ;
997 skkinputNoNaibuNoKouhoWoFileNiKaku( fp, True, False ) ;
998 /* ���ä����ѡ����ξ���*/
999 skkinputNoNaibuNoKouhoWoFileNiKaku( fp, False, True ) ;
1000 /* �ե�������Ĥ��ƽ�λ��*/
1001 fclose( fp ) ;
1002 return ;
1003 }
1004
1005 /*
1006 * ��ư���˰��������Ȥ����ؿ��ġ������ȥ����֤η�̤��ɤ��������
1007 * �뵡ǽ����ġ��Х��äƤʤ���ǽ����̵�����Ĥɤ�������Τ�顣
1008 */
skkinput_readAutoSavedLocalJisyo(void)1009 void skkinput_readAutoSavedLocalJisyo( void )
1010 {
1011 FILE *fp ;
1012 if( skkinput_autosave_path == NULL )
1013 return ;
1014 /*
1015 * �����ʤ��ä����Τ�ʤ���
1016 * �ƥ��ʡ֤����ꤵ���ܶ��Ǥ��� ���Υե������̾��ʬ���äƤ��
1017 * �ˡġ�
1018 * ������֤��䡢���Ρ�̾����ʬ���äƤƤ���Τ��ʤ����Ȥ⤢�뤷�ġ�
1019 */
1020 if( ( fp = fopen( skkinput_autosave_path, "rb" ) ) == NULL )
1021 return ;
1022 skkinputAutoSaveFileWoYondeFukugenSuru( fp ) ;
1023 fclose( fp ) ;
1024 /* �����ȥ����֤���Ƥ����ե�������ɤ���Ф���ʤΤ����顢���ä���
1025 * ����Ȧ�Ǥ��롣*/
1026 skkinput_autosave_jisyo_dirty = False ;
1027 return ;
1028 }
1029