Mercurial > freewnn
comparison Wnn/etc/gethinsi.c @ 22:c966456648ad
- fixed argument style in function definition
- created header files for prototype check. (in progress)
- suppress warnings
author | Yoshiki Yazawa <yaz@cc.rim.or.jp> |
---|---|
date | Thu, 17 Apr 2008 01:17:45 +0900 |
parents | bbc77ca4def5 |
children | 6bfa7ea3b75b |
comparison
equal
deleted
inserted
replaced
21:22b754fbd8fe | 22:c966456648ad |
---|---|
120 int mhinsi = 0; | 120 int mhinsi = 0; |
121 int mfukugou = 0; | 121 int mfukugou = 0; |
122 int mnode = 0; | 122 int mnode = 0; |
123 | 123 |
124 static void | 124 static void |
125 error_long () | 125 error_long (void) |
126 { | 126 { |
127 wnnerror_hinsi = WNN_TOO_LONG_HINSI_FILE_LINE; | 127 wnnerror_hinsi = WNN_TOO_LONG_HINSI_FILE_LINE; |
128 } | 128 } |
129 | 129 |
130 static void | 130 static void |
131 error_no_heap () | 131 error_no_heap (void) |
132 { | 132 { |
133 wnnerror_hinsi = WNN_TOO_BIG_HINSI_FILE; | 133 wnnerror_hinsi = WNN_TOO_BIG_HINSI_FILE; |
134 } | 134 } |
135 | 135 |
136 static int | 136 static int |
137 get_char0 (fp) | 137 get_char0 (FILE *fp) |
138 FILE *fp; | |
139 { | 138 { |
140 int c, d; | 139 int c, d; |
141 | 140 |
142 for (; (c = getc (fp)) == COMMENT_CHAR || c == CONTINUE_CHAR || c == IGNORE_CHAR1 || c == IGNORE_CHAR2;) | 141 for (; (c = getc (fp)) == COMMENT_CHAR || c == CONTINUE_CHAR || c == IGNORE_CHAR1 || c == IGNORE_CHAR2;) |
143 { | 142 { |
179 line_no += 1; | 178 line_no += 1; |
180 return (c); | 179 return (c); |
181 } | 180 } |
182 | 181 |
183 static int | 182 static int |
184 get_char (fp) /* remove null lines */ | 183 get_char (FILE *fp) /* remove null lines */ |
185 FILE *fp; | |
186 { | 184 { |
187 static int c = -1; | 185 static int c = -1; |
188 int d; | 186 int d; |
189 static int fufufu = 0; | 187 static int fufufu = 0; |
190 | 188 |
213 } | 211 } |
214 } | 212 } |
215 | 213 |
216 /* get one phrase and return the separater */ | 214 /* get one phrase and return the separater */ |
217 static int | 215 static int |
218 get_phrase (s0, size, fp) | 216 get_phrase (UCHAR *s0, int size, FILE *fp) |
219 UCHAR *s0; | |
220 int size; | |
221 FILE *fp; | |
222 { | 217 { |
223 UCHAR *s = s0; | 218 UCHAR *s = s0; |
224 int c; | 219 int c; |
225 static int eof = 0; | 220 static int eof = 0; |
226 | 221 |
248 *s++ = '\0'; | 243 *s++ = '\0'; |
249 return (c); | 244 return (c); |
250 } | 245 } |
251 | 246 |
252 static int | 247 static int |
253 stradd (cp, str) | 248 stradd (w_char **cp, char *str) |
254 w_char **cp; | |
255 char *str; | |
256 { | 249 { |
257 int len = strlen (str); | 250 int len = strlen (str); |
258 | 251 |
259 if (hp + len + 1 >= heap + HEAP_LEN) | 252 if (hp + len + 1 >= heap + HEAP_LEN) |
260 { | 253 { |
266 hp += wnn_Strlen (hp) + 1; | 259 hp += wnn_Strlen (hp) + 1; |
267 return (0); | 260 return (0); |
268 } | 261 } |
269 | 262 |
270 static int | 263 static int |
271 w_stradd (cp, str) | 264 w_stradd (unsigned short **cp, unsigned short *str) |
272 unsigned short **cp; | |
273 unsigned short *str; | |
274 { | 265 { |
275 | 266 |
276 *cp = whp; | 267 *cp = whp; |
277 for (; *str != TERMINATE; str++, whp++) | 268 for (; *str != TERMINATE; str++, whp++) |
278 { | 269 { |
286 *whp++ = TERMINATE; | 277 *whp++ = TERMINATE; |
287 return (0); | 278 return (0); |
288 } | 279 } |
289 | 280 |
290 int | 281 int |
291 wnn_loadhinsi (fname) | 282 wnn_loadhinsi (unsigned char *fname) |
292 unsigned char *fname; | |
293 { | 283 { |
294 FILE *fp; | 284 FILE *fp; |
295 UCHAR buf[SIZE]; | 285 UCHAR buf[SIZE]; |
296 unsigned short fukugou_str[MAXHINSI]; | 286 unsigned short fukugou_str[MAXHINSI]; |
297 int sep; | 287 int sep; |
418 #endif /* JSERVER */ | 408 #endif /* JSERVER */ |
419 return (HINSI_ERR); | 409 return (HINSI_ERR); |
420 } | 410 } |
421 | 411 |
422 static int | 412 static int |
423 find_hinsi_by_name (c) | 413 find_hinsi_by_name (register w_char *c) |
424 register w_char *c; | |
425 { | 414 { |
426 register int k; | 415 register int k; |
427 if (!hinsi_loaded) | 416 if (!hinsi_loaded) |
428 { | 417 { |
429 if (wnn_loadhinsi (NULL) != 0) | 418 if (wnn_loadhinsi (NULL) != 0) |
448 return (-1); | 437 return (-1); |
449 } | 438 } |
450 | 439 |
451 | 440 |
452 int | 441 int |
453 wnn_find_hinsi_by_name (c) | 442 wnn_find_hinsi_by_name (register char *c) |
454 register char *c; | |
455 { | 443 { |
456 w_char hin[WNN_HINSI_NAME_LEN]; | 444 w_char hin[WNN_HINSI_NAME_LEN]; |
457 | 445 |
458 wnn_Sstrcpy (hin, c); | 446 wnn_Sstrcpy (hin, c); |
459 return (find_hinsi_by_name (hin)); | 447 return (find_hinsi_by_name (hin)); |
460 } | 448 } |
461 | 449 |
462 | 450 |
463 static w_char * | 451 static w_char * |
464 get_hinsi_name (k) | 452 get_hinsi_name (int k) |
465 int k; | |
466 { | 453 { |
467 if (!hinsi_loaded) | 454 if (!hinsi_loaded) |
468 { | 455 { |
469 if (wnn_loadhinsi (NULL) != 0) | 456 if (wnn_loadhinsi (NULL) != 0) |
470 { | 457 { |
481 } | 468 } |
482 return (NULL); | 469 return (NULL); |
483 } | 470 } |
484 | 471 |
485 char * | 472 char * |
486 wnn_get_hinsi_name (k) | 473 wnn_get_hinsi_name (int k) |
487 int k; | |
488 { | 474 { |
489 w_char *s; | 475 w_char *s; |
490 static char hin[WNN_HINSI_NAME_LEN * 2]; | 476 static char hin[WNN_HINSI_NAME_LEN * 2]; |
491 | 477 |
492 if ((s = get_hinsi_name (k)) == NULL) | 478 if ((s = get_hinsi_name (k)) == NULL) |
497 | 483 |
498 #ifndef JSERVER | 484 #ifndef JSERVER |
499 static | 485 static |
500 #endif /* JSERVER */ | 486 #endif /* JSERVER */ |
501 int | 487 int |
502 wnn_get_fukugou_component_body (k, shp) | 488 wnn_get_fukugou_component_body (register int k, register unsigned short **shp) |
503 register int k; | |
504 register unsigned short **shp; | |
505 { | 489 { |
506 static unsigned short tmp; | 490 static unsigned short tmp; |
507 register unsigned short *s; | 491 register unsigned short *s; |
508 int index; /* need for NEWS-OS 6.0 */ | 492 int index; /* need for NEWS-OS 6.0 */ |
509 if (k < mhinsi && k >= 0) | 493 if (k < mhinsi && k >= 0) |
524 } | 508 } |
525 return (-1); | 509 return (-1); |
526 } | 510 } |
527 | 511 |
528 int | 512 int |
529 wnn_get_fukugou_component (k, shp) | 513 wnn_get_fukugou_component (register int k, register unsigned short **shp) |
530 register int k; | |
531 register unsigned short **shp; | |
532 { | 514 { |
533 if (!hinsi_loaded) | 515 if (!hinsi_loaded) |
534 { | 516 { |
535 if (wnn_loadhinsi (NULL) != 0) | 517 if (wnn_loadhinsi (NULL) != 0) |
536 { | 518 { |
542 | 524 |
543 | 525 |
544 #ifdef JSERVER | 526 #ifdef JSERVER |
545 | 527 |
546 w_char * | 528 w_char * |
547 wnn_hinsi_name (no) | 529 wnn_hinsi_name (int no) |
548 int no; | |
549 { | 530 { |
550 w_char *c; | 531 w_char *c; |
551 if ((c = get_hinsi_name (no)) == NULL) | 532 if ((c = get_hinsi_name (no)) == NULL) |
552 { | 533 { |
553 wnn_errorno = WNN_BAD_HINSI_NO; | 534 wnn_errorno = WNN_BAD_HINSI_NO; |
554 } | 535 } |
555 return (c); | 536 return (c); |
556 } | 537 } |
557 | 538 |
558 int | 539 int |
559 wnn_hinsi_number (name) | 540 wnn_hinsi_number (w_char *name) |
560 w_char *name; | |
561 { | 541 { |
562 int n; | 542 int n; |
563 if ((n = find_hinsi_by_name (name)) == -1) | 543 if ((n = find_hinsi_by_name (name)) == -1) |
564 { | 544 { |
565 wnn_errorno = WNN_BAD_HINSI_NAME; | 545 wnn_errorno = WNN_BAD_HINSI_NAME; |
566 } | 546 } |
567 return (n); | 547 return (n); |
568 } | 548 } |
569 | 549 |
570 int | 550 int |
571 wnn_hinsi_list (name, c, mynode, mmynode) | 551 wnn_hinsi_list (w_char *name, w_char **c, struct wnn_hinsi_node *mynode, int mmynode) |
572 w_char *name; | |
573 w_char **c; | |
574 struct wnn_hinsi_node *mynode; | |
575 int mmynode; | |
576 { | 552 { |
577 int k; | 553 int k; |
578 | 554 |
579 if (mynode == NULL) | 555 if (mynode == NULL) |
580 { | 556 { |
598 } | 574 } |
599 return (0); | 575 return (0); |
600 } | 576 } |
601 | 577 |
602 int | 578 int |
603 wnn_has_hinsi (mynode, mmynode, name) | 579 wnn_has_hinsi (struct wnn_hinsi_node *mynode, int mmynode, w_char *name) |
604 struct wnn_hinsi_node *mynode; | |
605 int mmynode; | |
606 w_char *name; | |
607 { | 580 { |
608 w_char *c; | 581 w_char *c; |
609 int k, j; | 582 int k, j; |
610 if (mynode == NULL) | 583 if (mynode == NULL) |
611 { | 584 { |