2 * Copyright (c) 2003 Nara Institute of Science and Technology
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. The name Nara Institute of Science and Technology may not be used to
15 * endorse or promote products derived from this software without
16 * specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY Nara Institute of Science and Technology
19 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
21 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE Nara Institute
22 * of Science and Technology BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
24 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 * $Id: getid.c,v 1.1.1.1 2007/03/13 07:40:10 masayu-a Exp $
40 cha_get_nhinsi_str_id(char **hinsi)
45 cha_exit_file(1, "an empty string for POS");
47 for (id = 0; *hinsi; hinsi++) {
49 cha_exit_file(1, "an empty string for POS");
50 for (i = 0; (d = Cha_hinsi[id].daughter[i]) != 0; i++) {
51 if (!strcmp(Cha_hinsi[d].name, *hinsi))
55 cha_exit_file(1, "POS `%s' is undefined", *hinsi);
67 cha_get_nhinsi_id(chasen_cell_t * cell)
70 char **hinsi = hinsi_str;
72 for (; !nullp(cell); cell = cha_cdr(cell))
73 *hinsi++ = cha_s_atom(cha_car(cell));
77 return cha_get_nhinsi_str_id(hinsi_str);
84 cha_get_type_id(char *x)
89 cha_exit_file(1, "null string for type");
93 if (x[0] == '*' && x[1] == '\0')
96 for (i = 1; strcmp(Cha_type[i].name, x);) {
97 if (!Cha_type[++i].name) {
98 cha_exit_file(1, "type `%s' is undefined", x);
109 cha_get_form_id(char *x, int type)
114 cha_exit_file(1, "null string for form");
118 if (x[0] == '*' && x[1] == '\0')
122 cha_exit_file(1, "Invalid type number for type `%s'", x);
126 for (i = 1; strcmp(Cha_form[type][i].name, x);) {
127 if (!Cha_form[type][++i].name) {
128 cha_exit_file(1, "type `%s' has no conjugation `%s'",
129 Cha_type[type].name, x);