39 |
c = 0; |
c = 0; |
40 |
if (len > 5) |
if (len > 5) |
41 |
len = 5; |
len = 5; |
42 |
for(i=1;i<len;i++) { |
for (i = 1; i < len; i++) { |
43 |
h = to_hex(buf[i]); |
h = to_hex(buf[i]); |
44 |
if (h == -1) |
if (h == -1) |
45 |
return INPUTMETHOD_NOMATCH; |
return INPUTMETHOD_NOMATCH; |
89 |
prefix_len = 0; |
prefix_len = 0; |
90 |
if (nb_prefixes > 0) { |
if (nb_prefixes > 0) { |
91 |
p1 = p; |
p1 = p; |
92 |
for(i=0;i<nb_prefixes;i++) { |
for (i = 0; i < nb_prefixes; i++) { |
93 |
if (buf[0] == p1[0]) |
if (buf[0] == p1[0]) |
94 |
goto prefix_match; |
goto prefix_match; |
95 |
p1 += 4; |
p1 += 4; |
105 |
match_char = 0; |
match_char = 0; |
106 |
match_count = 0; |
match_count = 0; |
107 |
last_outputc = 0; |
last_outputc = 0; |
108 |
for(;;) { |
for (;;) { |
109 |
match = 1; |
match = 1; |
110 |
l1 = prefix_len; /* length of input pattern */ |
l1 = prefix_len; /* length of input pattern */ |
111 |
for(;;) { |
for (;;) { |
112 |
c = *p++; |
c = *p++; |
113 |
d = c & 0x80; |
d = c & 0x80; |
114 |
c = c & 0x7f; |
c = c & 0x7f; |
173 |
|
|
174 |
void load_input_methods(void) |
void load_input_methods(void) |
175 |
{ |
{ |
176 |
char buf[1024], *q; |
char buf[MAX_FILENAME_SIZE], *q; |
177 |
long file_size; |
long file_size; |
178 |
int fd, offset; |
int fd, offset; |
179 |
const unsigned char *file_ptr, *p; |
const unsigned char *file_ptr, *p; |
184 |
if (find_resource_file(buf, sizeof(buf), "kmaps") < 0) |
if (find_resource_file(buf, sizeof(buf), "kmaps") < 0) |
185 |
return; |
return; |
186 |
|
|
187 |
fd = open (buf, O_RDONLY); |
fd = open(buf, O_RDONLY); |
188 |
if (fd < 0) |
if (fd < 0) |
189 |
return; |
return; |
190 |
file_size = lseek(fd, 0, SEEK_END); |
file_size = lseek(fd, 0, SEEK_END); |
199 |
goto fail; |
goto fail; |
200 |
|
|
201 |
p = file_ptr + 4; |
p = file_ptr + 4; |
202 |
for(;;) { |
for (;;) { |
203 |
offset = (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]; |
offset = (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]; |
204 |
p+= 4; |
p += 4; |
205 |
if (offset == 0) |
if (offset == 0) |
206 |
break; |
break; |
207 |
m = malloc(sizeof(InputMethod)); |
m = malloc(sizeof(InputMethod)); |
210 |
m->input_match = kmap_input; |
m->input_match = kmap_input; |
211 |
q = buf; |
q = buf; |
212 |
while (*p != '\0') { |
while (*p != '\0') { |
213 |
if ((q - buf) < ((int)sizeof(buf) - 1)) |
if (q < buf + sizeof(buf) - 1) |
214 |
*q++ = *p; |
*q++ = *p; |
215 |
p++; |
p++; |
216 |
} |
} |
217 |
*q = '\0'; |
*q = '\0'; |
218 |
p++; |
p++; |
219 |
m->name =strdup(buf); |
m->name = strdup(buf); |
220 |
register_input_method(m); |
register_input_method(m); |
221 |
} |
} |
222 |
} |
} |
239 |
int len; |
int len; |
240 |
|
|
241 |
len = strlen(input); |
len = strlen(input); |
242 |
for(m = input_methods; m != NULL; m = m->next) { |
for (m = input_methods; m != NULL; m = m->next) { |
243 |
if (!strncmp(m->name, input, len)) |
if (!strncmp(m->name, input, len)) |
244 |
add_string(cs, m->name); |
add_string(cs, m->name); |
245 |
} |
} |
250 |
InputMethod *m; |
InputMethod *m; |
251 |
|
|
252 |
m = input_methods; |
m = input_methods; |
253 |
for(;;) { |
for (;;) { |
254 |
if (!m) { |
if (!m) { |
255 |
put_status(s, "'%s' not found", input_str); |
put_status(s, "'%s' not found", input_str); |
256 |
return; |
return; |