Changeset e7de6cc for src/dgp/mgraph.cc
- Timestamp:
- 02/21/12 20:02:51 (13 years ago)
- Branches:
- master
- Children:
- b242df2
- Parents:
- 354ba3d
- git-author:
- Tomasz Obrebski <to@…> (02/21/12 20:02:51)
- git-committer:
- Tomasz Obrebski <to@…> (02/21/12 20:02:51)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/dgp/mgraph.cc
r5f4d9c3 re7de6cc 4 4 #include "const.hh" 5 5 6 #include < stdio.h>6 #include <cstdio> 7 7 8 8 int MGraph::add_node(char* seg) 9 9 { 10 nodes[n].clear(); 10 MNode newnode; 11 newnode.clear(); 11 12 12 char field1[80], field3[80], descr[256], gph[256];13 char field1[80], field3[80], field4[256], descr[256], gph[256]; 13 14 char* cat; 14 15 15 16 getfield(seg,"1",field1); 16 n odes[n].pos=atoi(field1);17 newnode.pos=atoi(field1); 17 18 18 19 getfield(seg,"3",field3); 20 21 getfield(seg,"4",field4); 22 strcpy(newnode.form,field4); 23 19 24 if(!getfield(seg,"lem",descr)) strcpy(descr,"?,?"); 20 25 … … 23 28 if(*cat) ++cat; 24 29 25 // Cat::add(cat);26 30 if(Cat::index(cat)>0) 27 n odes[n].cat=cat;31 newnode.cat=cat; 28 32 else 29 n odes[n].cat="NULL";33 newnode.cat="NULL"; 30 34 31 n odes[n].pred.clear();35 newnode.pred.clear(); 32 36 33 37 char* tok; … … 41 45 42 46 char* ids=strtok(gph,":"); 43 if( n!=atoi(ids)){fprintf(stderr,"Invalid node id in line ?. Program aborted.\n"); exit(1); }47 if(size() != atoi(ids)) {fprintf(stderr,"Invalid node id in line ?. Program aborted.\n"); exit(1); } 44 48 45 49 char *preds; … … 47 51 { 48 52 previd=atoi(preds); 49 n odes[n].pred.push_back(&nodes[previd]);53 newnode.pred.push_back(previd); 50 54 } 51 55 52 return n++; 56 nodes.push_back(newnode); 57 return nodes.size()-1; 53 58 } 54 59
Note: See TracChangeset
for help on using the changeset viewer.