author | viric@llimona |
Sun, 02 Sep 2007 16:01:27 +0200 | |
changeset 27 | 153c479aa0bc |
parent 14 | a961bb8806b9 |
permissions | -rw-r--r-- |
11
68ea18fe402c
Adding code for the zprocess, for processing the Zaliznjak dictionary.
viric@llimona
parents:
diff
changeset
|
1 |
#include <stdio.h> |
68ea18fe402c
Adding code for the zprocess, for processing the Zaliznjak dictionary.
viric@llimona
parents:
diff
changeset
|
2 |
#include "dictre.h" |
68ea18fe402c
Adding code for the zprocess, for processing the Zaliznjak dictionary.
viric@llimona
parents:
diff
changeset
|
3 |
|
68ea18fe402c
Adding code for the zprocess, for processing the Zaliznjak dictionary.
viric@llimona
parents:
diff
changeset
|
4 |
static void new_word(const char *str) |
68ea18fe402c
Adding code for the zprocess, for processing the Zaliznjak dictionary.
viric@llimona
parents:
diff
changeset
|
5 |
{ |
68ea18fe402c
Adding code for the zprocess, for processing the Zaliznjak dictionary.
viric@llimona
parents:
diff
changeset
|
6 |
printf("%s\n", str); |
68ea18fe402c
Adding code for the zprocess, for processing the Zaliznjak dictionary.
viric@llimona
parents:
diff
changeset
|
7 |
} |
68ea18fe402c
Adding code for the zprocess, for processing the Zaliznjak dictionary.
viric@llimona
parents:
diff
changeset
|
8 |
|
68ea18fe402c
Adding code for the zprocess, for processing the Zaliznjak dictionary.
viric@llimona
parents:
diff
changeset
|
9 |
|
68ea18fe402c
Adding code for the zprocess, for processing the Zaliznjak dictionary.
viric@llimona
parents:
diff
changeset
|
10 |
void zprocess_def(const char *root, char *def) |
68ea18fe402c
Adding code for the zprocess, for processing the Zaliznjak dictionary.
viric@llimona
parents:
diff
changeset
|
11 |
{ |
68ea18fe402c
Adding code for the zprocess, for processing the Zaliznjak dictionary.
viric@llimona
parents:
diff
changeset
|
12 |
int index = 0; |
68ea18fe402c
Adding code for the zprocess, for processing the Zaliznjak dictionary.
viric@llimona
parents:
diff
changeset
|
13 |
int res; |
68ea18fe402c
Adding code for the zprocess, for processing the Zaliznjak dictionary.
viric@llimona
parents:
diff
changeset
|
14 |
/* Jump the first line (index word) Wait for \n */ |
68ea18fe402c
Adding code for the zprocess, for processing the Zaliznjak dictionary.
viric@llimona
parents:
diff
changeset
|
15 |
skip_newline(def, &index); |
68ea18fe402c
Adding code for the zprocess, for processing the Zaliznjak dictionary.
viric@llimona
parents:
diff
changeset
|
16 |
++index; |
68ea18fe402c
Adding code for the zprocess, for processing the Zaliznjak dictionary.
viric@llimona
parents:
diff
changeset
|
17 |
|
68ea18fe402c
Adding code for the zprocess, for processing the Zaliznjak dictionary.
viric@llimona
parents:
diff
changeset
|
18 |
res = until_newword(def, &index); |
68ea18fe402c
Adding code for the zprocess, for processing the Zaliznjak dictionary.
viric@llimona
parents:
diff
changeset
|
19 |
if (res == -1) |
68ea18fe402c
Adding code for the zprocess, for processing the Zaliznjak dictionary.
viric@llimona
parents:
diff
changeset
|
20 |
return; |
68ea18fe402c
Adding code for the zprocess, for processing the Zaliznjak dictionary.
viric@llimona
parents:
diff
changeset
|
21 |
|
68ea18fe402c
Adding code for the zprocess, for processing the Zaliznjak dictionary.
viric@llimona
parents:
diff
changeset
|
22 |
/* Mark words */ |
68ea18fe402c
Adding code for the zprocess, for processing the Zaliznjak dictionary.
viric@llimona
parents:
diff
changeset
|
23 |
do { |
68ea18fe402c
Adding code for the zprocess, for processing the Zaliznjak dictionary.
viric@llimona
parents:
diff
changeset
|
24 |
int end; |
68ea18fe402c
Adding code for the zprocess, for processing the Zaliznjak dictionary.
viric@llimona
parents:
diff
changeset
|
25 |
end = index; |
68ea18fe402c
Adding code for the zprocess, for processing the Zaliznjak dictionary.
viric@llimona
parents:
diff
changeset
|
26 |
res = until_noword(def, &end); |
68ea18fe402c
Adding code for the zprocess, for processing the Zaliznjak dictionary.
viric@llimona
parents:
diff
changeset
|
27 |
if (res == -1) |
68ea18fe402c
Adding code for the zprocess, for processing the Zaliznjak dictionary.
viric@llimona
parents:
diff
changeset
|
28 |
break; |
68ea18fe402c
Adding code for the zprocess, for processing the Zaliznjak dictionary.
viric@llimona
parents:
diff
changeset
|
29 |
def[end] = 0; |
68ea18fe402c
Adding code for the zprocess, for processing the Zaliznjak dictionary.
viric@llimona
parents:
diff
changeset
|
30 |
insert_word(&def[index], root); |
68ea18fe402c
Adding code for the zprocess, for processing the Zaliznjak dictionary.
viric@llimona
parents:
diff
changeset
|
31 |
index = end+1; |
68ea18fe402c
Adding code for the zprocess, for processing the Zaliznjak dictionary.
viric@llimona
parents:
diff
changeset
|
32 |
res = until_newword(def,&index); |
68ea18fe402c
Adding code for the zprocess, for processing the Zaliznjak dictionary.
viric@llimona
parents:
diff
changeset
|
33 |
if (res == -1) |
68ea18fe402c
Adding code for the zprocess, for processing the Zaliznjak dictionary.
viric@llimona
parents:
diff
changeset
|
34 |
break; |
68ea18fe402c
Adding code for the zprocess, for processing the Zaliznjak dictionary.
viric@llimona
parents:
diff
changeset
|
35 |
} while (1); |
68ea18fe402c
Adding code for the zprocess, for processing the Zaliznjak dictionary.
viric@llimona
parents:
diff
changeset
|
36 |
free(def); |
68ea18fe402c
Adding code for the zprocess, for processing the Zaliznjak dictionary.
viric@llimona
parents:
diff
changeset
|
37 |
free(root); |
68ea18fe402c
Adding code for the zprocess, for processing the Zaliznjak dictionary.
viric@llimona
parents:
diff
changeset
|
38 |
} |