17 |
/* along with this program; if not, write to the Free Software */ |
/* along with this program; if not, write to the Free Software */ |
18 |
/* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ |
/* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ |
19 |
|
|
|
/* |
|
|
* $Id$ |
|
|
*/ |
|
|
|
|
20 |
#include <string.h> |
#include <string.h> |
21 |
#include <stdlib.h> |
#include <stdlib.h> |
22 |
#include <stdio.h> |
#include <stdio.h> |
30 |
if (i.term) /* edge points at a complete word */ |
if (i.term) /* edge points at a complete word */ |
31 |
{ |
{ |
32 |
*s = '\0'; |
*s = '\0'; |
33 |
fprintf (out,"%s\n", buf); |
fprintf (out,"%s\n", buf); |
34 |
} |
} |
35 |
if (i.ptr) |
if (i.ptr) |
36 |
{ /* Compute index: is it non-zero ? */ |
{ /* Compute index: is it non-zero ? */ |
37 |
Dawg_edge *p = dic->dawg + i.ptr; |
Dawg_edge *p = dic->dawg + i.ptr; |
38 |
do { /* for each edge out of this node */ |
do { /* for each edge out of this node */ |
39 |
*s = p->chr + 'a' - 1; |
*s = p->chr + 'a' - 1; |
40 |
print_dic_rec (out,dic,buf,s + 1, *p); |
print_dic_rec (out,dic,buf,s + 1, *p); |
41 |
} |
} |
42 |
while (!(*p++).last); |
while (!(*p++).last); |
43 |
} |
} |
44 |
} |
} |
45 |
|
|
46 |
void |
void |
47 |
dic_load(Dictionary* dic, char* filename) |
dic_load(Dictionary* dic, char* filename) |
48 |
{ |
{ |
49 |
int res; |
int res; |
50 |
if ((res = Dic_load(dic, filename)) != 0) |
if ((res = Dic_load(dic, filename)) != 0) |
51 |
{ |
{ |
52 |
switch (res) { |
switch (res) { |
53 |
case 1: printf("chargement: problème d'ouverture de %s\n",filename); break; |
case 1: printf("chargement: problème d'ouverture de %s\n",filename); break; |
67 |
FILE* fout; |
FILE* fout; |
68 |
Dictionary dic; |
Dictionary dic; |
69 |
static char buf[80]; |
static char buf[80]; |
70 |
|
|
71 |
dic_load(&dic,filename); |
dic_load(&dic,filename); |
72 |
|
|
73 |
if (strcmp(out,"stdout") == 0) |
if (strcmp(out,"stdout") == 0) |
169 |
int i; |
int i; |
170 |
Dictionary dic; |
Dictionary dic; |
171 |
dic_load(&dic,filename); |
dic_load(&dic,filename); |
172 |
|
|
173 |
printf("offs binary structure \n"); |
printf("offs binary structure \n"); |
174 |
printf("---- -------- | ------------------\n"); |
printf("---- -------- | ------------------\n"); |
175 |
for(i=0; i < (dic->nedges + 1); i++) |
for(i=0; i < (dic->nedges + 1); i++) |
188 |
} |
} |
189 |
|
|
190 |
|
|
191 |
int |
int |
192 |
main(int argc, char *argv[]) |
main(int argc, char *argv[]) |
193 |
{ |
{ |
194 |
int arg_count; |
int arg_count; |
197 |
int option_print_dic_hex = 0; |
int option_print_dic_hex = 0; |
198 |
int option_print_dic_list = 0; |
int option_print_dic_list = 0; |
199 |
|
|
200 |
if (argc < 2) |
if (argc < 2) |
201 |
{ |
{ |
202 |
usage(argv[0]); |
usage(argv[0]); |
203 |
exit(1); |
exit(1); |
204 |
} |
} |
205 |
|
|
206 |
arg_count = 1; |
arg_count = 1; |
207 |
while(argv[arg_count][0] == '-') |
while(argv[arg_count][0] == '-') |
208 |
{ |
{ |
217 |
} |
} |
218 |
arg_count++; |
arg_count++; |
219 |
} |
} |
220 |
|
|
221 |
if (option_print_header || option_print_all) |
if (option_print_header || option_print_all) |
222 |
{ |
{ |
223 |
print_header(argv[arg_count]); |
print_header(argv[arg_count]); |