- Timestamp:
- 12/11/08 22:20:14 (16 years ago)
- Branches:
- master, help
- Children:
- 2d89d4b
- Parents:
- 91ed676
- git-author:
- obrebski <obrebski@…> (12/11/08 22:20:14)
- git-committer:
- obrebski <obrebski@…> (12/11/08 22:20:14)
- Location:
- app/src/dgp
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
app/src/dgp/const.hh
r0214596 r9ace5d2 3 3 4 4 #define MAXTYPES 32 5 #define MAXFLAGS 64 5 6 #define MAXNODES 1024 6 7 #define MAXCONSTRS 32 -
app/src/dgp/dgc
r3748bd1 r9ace5d2 98 98 my $nreq=0; 99 99 my $nlink=0; 100 my $nflag=0; 100 101 101 102 my %cats; … … 113 114 open(OUTPUT, ">$outputfile") or die("Can't open output file: $outputfile!"); 114 115 } 115 116 116 117 117 … … 192 192 } 193 193 } 194 } 195 elsif(/^FLAG\s+\S+$/) 196 { 197 ++$nflag; 198 print OUTPUT "$_\n" 194 199 } 195 200 elsif(/^$/) { … … 249 254 printf STDERR "%6d RIGHT statements\n", $nright; 250 255 printf STDERR "%6d LINK statements\n", $nlink; 256 printf STDERR "%6d FLAG statements\n", $nflag; 251 257 252 258 -
app/src/dgp/grammar.cc
r0214596 r9ace5d2 44 44 lt.resize(types_sz); 45 45 gt.resize(types_sz); 46 } 47 } 48 49 void Grammar::add_flag(const char* s) 50 { 51 Flag::add(s); 52 if(Flag::count()>flags_sz) 53 { 54 flags_sz += 16; 55 pass.resize(flags_sz); 46 56 } 47 57 } … … 124 134 set_connect(arg1,arg2,arg3); 125 135 } 136 // FLAG DECLARATION 137 else if(strcmp(key,"FLAG")==0 && fields>=2) 138 { 139 add_flag(arg1); 140 } 126 141 127 142 else fprintf(stderr,"Invalid line %d. Ignored.\n", lineno); … … 160 175 if(connect[c][d].count(t)) 161 176 fprintf(f,"LINK\t%s\t%s\t%s\n",c.str(),d.str(),t.str()); 177 178 for(Flag i=1; i<Flag::count(); ++i) 179 fprintf(f,"FLAG\t%s\n",i.str()); 162 180 } 163 181 -
app/src/dgp/grammar.hh
r3748bd1 r9ace5d2 11 11 #include "sgraph.hh" 12 12 13 14 class Link 15 { 16 Role role; 17 FlagSet hflags; 18 FlagSet dflags; 19 } 20 21 13 22 class Grammar 14 23 { … … 18 27 // enum CONSTR { SGL, OBL, LEFT, RIGHT, INIT, NONINIT, FIN, NONFIN }; 19 28 20 Grammar() : types_sz(0), cats_sz(0) {} ;29 Grammar() : types_sz(0), cats_sz(0), flags_sz(0) {} ; 21 30 22 31 int types_sz; 23 32 int cats_sz; 33 int flags_sz; 24 34 25 35 vector< vector< Roles > > connect; … … 31 41 vector< RoleSet > gt; 32 42 43 44 // vector< vector< vector< 45 vector< FlagSet > set; 46 vector< FlagSet > pass; 47 33 48 bool read(FILE* f); 34 49 void write(FILE* f); … … 36 51 void add_category(const char* s); 37 52 void add_type(const char* s); 53 void add_flag(const char* s); 38 54 39 55 void set_sgl(Role r) { sgl.set(r); } -
app/src/dgp/sgraph.cc
r0214596 r9ace5d2 128 128 { 129 129 buf+=sprintf(buf,";"); 130 int cont=0; 130 131 for(Role i=1; i<=Role::count(); ++i) 131 if(node.prop.forbidden[i]) buf+=sprintf(buf," !%s",i.str());132 if(node.prop.forbidden[i]) buf+=sprintf(buf,"%s!%s",(cont++)?",":"",i.str()); 132 133 for(Role i=1; i<=Role::count(); ++i) 133 if(node.prop.required[i]) buf+=sprintf(buf," &%s",i.str());134 if(node.prop.required[i]) buf+=sprintf(buf,"%s&%s",(cont++)?",":"",i.str()); 134 135 } 135 136 … … 140 141 141 142 142 int SGraph::sprint_node_debug(char* buf, c har* pref, int n)143 int SGraph::sprint_node_debug(char* buf, const char* pref, int n) 143 144 { 144 145 char *buf0 = buf; … … 149 150 } 150 151 151 int SGraph::print_node_debug(FILE* f, c har* pref, int n)152 int SGraph::print_node_debug(FILE* f, const char* pref, int n) 152 153 { 153 154 char buf[1000]; -
app/src/dgp/sgraph.hh
r0214596 r9ace5d2 88 88 int sprint_node(char* buf, int n, unsigned int info); 89 89 int print_node(FILE* f, int n, unsigned int info); 90 int sprint_node_debug(char* buf, c har* pref, int n);91 int print_node_debug(FILE* f, c har* pref, int n);90 int sprint_node_debug(char* buf, const char* pref, int n); 91 int print_node_debug(FILE* f, const char* pref, int n); 92 92 93 93 void print_arc(FILE* f, int left, int right, Role role, int dir); // 0 - left, 1 - right -
app/src/dgp/thesymbols.hh
r0214596 r9ace5d2 23 23 24 24 typedef Symbol<4> Rel; 25 25 26 typedef Symbol<5> Flag; 27 typedef bitset<MAXFLAGS> FlagSet; 26 28 27 29 #endif
Note: See TracChangeset
for help on using the changeset viewer.