Last change
on this file since e0cd003 was
e7de6cc,
checked in by Tomasz Obrebski <to@…>, 13 years ago
|
new version of dgp
added dgc, tre and compdic components
compiledic renamed to compdic_utf8
./configure updated
|
-
Property mode set to
100644
|
File size:
961 bytes
|
Line | |
---|
1 | |
---|
2 | #include "mgraph.hh" |
---|
3 | #include "thesymbols.hh" |
---|
4 | #include "const.hh" |
---|
5 | |
---|
6 | #include <stdio.h> |
---|
7 | |
---|
8 | int MGraph::add_node(char* seg) |
---|
9 | { |
---|
10 | nodes[n].clear(); |
---|
11 | |
---|
12 | char field1[80], field3[80], descr[256], gph[256]; |
---|
13 | char* cat; |
---|
14 | |
---|
15 | getfield(seg,"1",field1); |
---|
16 | nodes[n].pos=atoi(field1); |
---|
17 | |
---|
18 | getfield(seg,"3",field3); |
---|
19 | if(!getfield(seg,"lem",descr)) strcpy(descr,"?,?"); |
---|
20 | |
---|
21 | cat=descr; |
---|
22 | while(*cat!=',' && *cat ) ++cat; |
---|
23 | if(*cat) ++cat; |
---|
24 | |
---|
25 | // Cat::add(cat); |
---|
26 | if(Cat::index(cat)>0) |
---|
27 | nodes[n].cat=cat; |
---|
28 | else |
---|
29 | nodes[n].cat="NULL"; |
---|
30 | |
---|
31 | nodes[n].pred.clear(); |
---|
32 | |
---|
33 | char* tok; |
---|
34 | int previd; |
---|
35 | |
---|
36 | if(!getfield(seg,"gph",gph)) |
---|
37 | { |
---|
38 | fprintf(stderr,"No gph field. Aborting (sorry).\n"); |
---|
39 | exit(1); |
---|
40 | } |
---|
41 | |
---|
42 | char* ids=strtok(gph,":"); |
---|
43 | if(n!=atoi(ids)){fprintf(stderr,"Invalid node id in line ?. Program aborted.\n"); exit(1); } |
---|
44 | |
---|
45 | char *preds; |
---|
46 | while(preds=strtok(NULL,",")) |
---|
47 | { |
---|
48 | previd=atoi(preds); |
---|
49 | nodes[n].pred.push_back(&nodes[previd]); |
---|
50 | } |
---|
51 | |
---|
52 | return n++; |
---|
53 | } |
---|
54 | |
---|
Note: See
TracBrowser
for help on using the repository browser.