diff --git a/src/dgp/Makefile b/src/dgp/Makefile index 3ed9a02..1f910fb 100644 --- a/src/dgp/Makefile +++ b/src/dgp/Makefile @@ -10,7 +10,7 @@ CMDLINE_FILE='"../dgp/cmdline.h"' #vpath %.o . -CXXFLAGS = -g -static +CXXFLAGS = -g -Wno-deprecated -static sources = main.cc grammar.cc symbol.cc mgraph.cc sgraph.cc dgp1.cc cmdline.cc \ $(COMMON_PATH)/common.cc global.cc @@ -46,6 +46,7 @@ cmdline.ggo: cmdline_dgp.ggo ../common/cmdline_common.ggo clean: rm -f ${bin} ${objs} cmdline.* rm -f *.d + rm -f *~ .PHONY: prof prof: dgp diff --git a/src/dgp/dgp1.cc b/src/dgp/dgp1.cc index 5f1a402..82fe25a 100644 --- a/src/dgp/dgp1.cc +++ b/src/dgp/dgp1.cc @@ -81,11 +81,11 @@ int find_existing_node(int mnodeind, NodeProp p, bitset& newheadLH, bi if(sgraph[*ps].LH==newheadLH && sgraph[*ps].LV==newheadLV) { ret = *ps; - fprintf(stderr,"#\tsucceeded because of LH/LV equality ()\n"); + if(debug) fprintf(stderr,"#\tsucceeded because of LH/LV equality ()\n"); } else { - fprintf(stderr,"#\tfailed beacause of LH/LV inequality\n"); + if(debug) fprintf(stderr,"#\tfailed beacause of LH/LV inequality\n"); } } @@ -516,6 +516,7 @@ void try_connect_dependents(int j) { if(debug) fprintf(stderr," ...SUCCESS!\n"); connect_left( j, i, **ri, new_head_boubbles, new_dep_boubbles); + lvi.update_edge(sgraph,i); } else { if(debug) fprintf(stderr," ...boubbles failed\n"); } diff --git a/src/dgp/grammar.cc b/src/dgp/grammar.cc index ff2cefe..15ce814 100644 --- a/src/dgp/grammar.cc +++ b/src/dgp/grammar.cc @@ -30,12 +30,12 @@ void Grammar::add_category(const char* s) { Cat::add(s); - if(connect.size() <= Cat::count()) - { - connect.resize(Cat::count()+RESIZE_DELTA); - for(int i=0; i flags1=%s cat2=<%s> flags2=%s type=<%s> props=%s\n",line,cat1,flags1,cat2,flags2,type,props); if( chk_cat(cat1) && chk_cat(cat2) && chk_type(type) ) - set_connect(cat1,parse_flags(flags1,"+"),parse_flags(flags1,"-"),cat2,parse_flags(flags2,"+"),parse_flags(flags2,"-"),type,parse_props(props)); + set_connect(cat1,parse_flags(flags1,"+"),parse_flags(flags1,"-"),cat2,parse_flags(flags2,"+"),parse_flags(flags2,"-"),type,parse_props(props),lineno); else if( chk_cat(cat1) && chk_cat(cat2) && chk_long(type) ) { set_longrel(cat1,cat2,type); @@ -503,11 +503,11 @@ void Grammar::write(FILE* f) for(Role r=1; r connectable2(Cat h, Cat d, FlagSet hfs, FlagSet dfs); bool check_constr(NodeProp& hprop, NodeProp& dprop, int dir, Role role); @@ -108,7 +106,7 @@ private: // vector< FlagSet > rset; //[Role] vector< FlagSet > pass; //[Role] - vector< vector< Roles > > connect; //[Cat][Cat] + // vector< vector< Roles > > connect; //[Cat][Cat] vector< vector< Links > > connect1; //[Cat][Cat] @@ -142,7 +140,7 @@ private: // void set_connect(Cat c, Cat d, Role r) { connect[c][d].insert(r); } // void set_connect(Cat c, Cat d, Flag f, Role r) { connect1[c][d].insert(Link(r,f)); } - void set_connect(Cat h, Flag hfp, Flag hfm, Cat d, Flag dfp, Flag dfm, Role r, PropSet ps ) { connect1[h][d].insert(Link(r,ps,hfp,hfm,dfp,dfm)); } + void set_connect(Cat h, Flag hfp, Flag hfm, Cat d, Flag dfp, Flag dfm, Role r, PropSet ps, int lineno ) { connect1[h][d].insert(Link(r,ps,hfp,hfm,dfp,dfm,lineno)); } void set_include(Role r, Role s) { include[r].set(s); } void set_exclude(Role r, Role s) { exclude[r].set(s); } @@ -158,27 +156,6 @@ private: //---------------------------------------------------------------------------------------------------- -inline -Roles& Grammar::connectable(Cat h, Cat d) -{ - return connect[h][d]; -} - -//---------------------------------------------------------------------------------------------------- - -inline -Roles Grammar::connectable(Cat h, Cat d, FlagSet hfs, FlagSet dfs) // ZBYT WOLNE!!!!!!!!!!!!!!!!!!!!!!!!!! (-> Roles&) -{ - Roles ret; - for(Links::const_iterator l = connect1[h][d].begin(); l != connect1[h][d].end(); l++) - if( (l->hflagplus==0 || hfs[l->hflagplus]) && (l->hflagminus==0 || !hfs[l->hflagminus]) ) - if( (l->dflagplus==0 || dfs[l->dflagplus]) && (l->dflagminus==0 || !dfs[l->dflagminus]) ) - ret.insert(l->role); - return ret; -} - -//---------------------------------------------------------------------------------------------------- - inline list Grammar::connectable2(Cat h, Cat d, FlagSet hfs, FlagSet dfs) // ZBYT WOLNE!!!!!!!!!!!!!!!!!!!!!!!!!! (-> Roles&) { @@ -192,20 +169,6 @@ list Grammar::connectable2(Cat h, Cat d, FlagSet hfs, FlagSet dfs) //---------------------------------------------------------------------------------------------------- -// inline -// bool Grammar::check_constr(NodeProp& hprop, NodeProp& dprop, int dir, Role role) // dir: 0-left 1-right -// { -// return -// !hprop.forbidden[role] && -// ( dir==1 || !right[role] ) && -// ( dir==0 || !left[role] ) && -// ( dir==1 || (hprop.attached&init).none() ) && -// ( dir==0 || (hprop.attached&fin).none() ) -// ; -// } - -//---------------------------------------------------------------------------------------------------- - inline bool Grammar::check_constr2(NodeProp& hprop, NodeProp& dprop, int dir, const Link& link) // dir: 0-left 1-right { diff --git a/src/dgp/sgraph.cc b/src/dgp/sgraph.cc index d9ad294..bfaba3e 100644 --- a/src/dgp/sgraph.cc +++ b/src/dgp/sgraph.cc @@ -178,9 +178,9 @@ int SGraph::sprint_node_debug(char* buf, const char* pref, int n, int anc) while(buf-buf0<40) buf+=sprintf(buf," "); buf+=sprint_node(buf,n,anc,HEADS|DEPS|SETS|CONSTRAINTS); - // buf+=sprintf(buf,"/"); - // for(vector::iterator e = nodes[n].edge.begin(); e != nodes[n].edge.end(); e++ ) - // buf += sprintf(buf,"%d ", *e); + buf+=sprintf(buf,"/"); + for(vector::iterator e = nodes[n].edge.begin(); e != nodes[n].edge.end(); e++ ) + buf += sprintf(buf,"%d ", *e); buf+=sprintf(buf,"\n"); return buf-buf0; diff --git a/src/dgp/sgraph.hh b/src/dgp/sgraph.hh index 5eb1a8d..953ef2c 100644 --- a/src/dgp/sgraph.hh +++ b/src/dgp/sgraph.hh @@ -295,6 +295,7 @@ class LViterator : public XXiterator public: LViterator(SGraph& sg, int n, bool s); int next(); + void update_edge(SGraph& sg, int e); private: @@ -307,6 +308,7 @@ private: void push_ld(int i); void push_lh(int i); void push_ln(int i); + }; inline LViterator::LViterator(SGraph& sg, int n, bool s=true) : sgraph(sg), mgraph(sg.mgraph), strict(s) @@ -328,6 +330,15 @@ inline LViterator::LViterator(SGraph& sg, int n, bool s=true) : sgraph(sg), mgra } } +inline void LViterator::update_edge(SGraph& sg, int n) +{ + for(vector::iterator i=sg[n].edge.begin(); i!=sg[n].edge.end(); ++i) + { + push_ld(*i); + push_ln(*i); + } +} + inline int LViterator::next() { if(wayup.empty()) diff --git a/src/dgp/thesymbols.hh b/src/dgp/thesymbols.hh index 4c85b04..0a5eacb 100644 --- a/src/dgp/thesymbols.hh +++ b/src/dgp/thesymbols.hh @@ -17,8 +17,8 @@ typedef Symbol<2> Role; typedef list RoleList; typedef list::iterator RoleListIter; typedef bitset RoleSet; -typedef set Roles; -typedef Roles::iterator RolesIter; +// typedef set Roles; +// typedef Roles::iterator RolesIter; typedef Symbol<3> Constr; typedef list ConstrList;