Index: src/dgp/dgp0.cc
===================================================================
--- src/dgp/dgp0.cc	(revision 5f4d9c3b32eea7b6643a751aa75bdb05b7d41576)
+++ src/dgp/dgp0.cc	(revision e7de6cc88c605c4f810cbc852e843294b4b0e8ac)
@@ -6,6 +6,4 @@
 extern SGraph sgraph;
 
-SNode* snodes;
-
 extern bool debug;
 
@@ -16,6 +14,6 @@
 void set_initial_constraints(int node)
 {
-  snodes[node].prop.forbidden.reset();
-  snodes[node].prop.required=grammar.obl[snodes[node].mnode->cat];
+  sgraph[node].prop.forbidden.reset();
+  sgraph[node].prop.required=grammar.is_obl(mgraph[sgraph[node].mnode].cat);
 }
 
@@ -23,11 +21,11 @@
 bool changing_constraints(int head, Role role)
 {
-  return grammar.sgl[role] || snodes[head].prop.required[role];
+  return grammar.is_sgl(role) || sgraph[head].prop.required[role];
 }
 
 void apply_constraints(int head, Role role)
 {
-  if(grammar.sgl[role]) snodes[head].prop.forbidden.set(role);
-  snodes[head].prop.required.reset(role);
+  if(grammar.is_sgl(role)) sgraph[head].prop.forbidden.set(role);
+  sgraph[head].prop.required.reset(role);
 }
 
@@ -35,5 +33,5 @@
 {
   NodeProp ret=headprop;
-  if(grammar.sgl[role]) ret.forbidden.set(role);
+  if(grammar.is_sgl(role)) ret.forbidden.set(role);
   ret.required.reset(role);
   return ret;
@@ -44,5 +42,5 @@
   NodeProp ret=headprop;
 
-  if(grammar.sgl[role]) ret.forbidden.set(role);
+  if(grammar.is_sgl(role)) ret.forbidden.set(role);
   ret.required.reset(role);
   return ret;
@@ -52,5 +50,5 @@
 {
   for(vector<int>::iterator ps=mnode.snodes.begin(); ps!=mnode.snodes.end(); ++ps)
-    if(snodes[*ps].prop==p && snodes[*ps].LH==newheadLH && snodes[*ps].LV==newheadLV)
+    if(sgraph[*ps].prop==p && sgraph[*ps].LH==newheadLH && sgraph[*ps].LV==newheadLV)
       return *ps;
   return -1;
@@ -59,11 +57,6 @@
 void connect_left(list<int>::iterator h, list<int>::iterator d, Role r)
 {
-  NodeProp &oldheadprop = snodes[*h].prop;
-  NodeProp newheadprop;
-  bitset<MAXNODES> newheadLV;
-  bitset<MAXNODES> newheadLH;
-  bitset<MAXNODES> newheadLD;
-  
-  newheadprop=compute_prop_left(oldheadprop,r);
+  NodeProp &oldheadprop = sgraph[*h].prop;
+  NodeProp newheadprop  = compute_prop_left(oldheadprop,r);
   
   int newheadind;
@@ -72,9 +65,9 @@
   else
   {
-    newheadLH = snodes[*h].LH;
-    newheadLV = snodes[*d].LV;
-    newheadLD = snodes[*h].LD;
-
-    newheadind = get_node(*(snodes[*h].mnode), newheadprop, newheadLH, newheadLV);
+    bitset<MAXNODES> newheadLH = sgraph[*h].LH;
+    bitset<MAXNODES> newheadLV = sgraph[*d].LV;
+    bitset<MAXNODES> newheadLD = sgraph[*h].LD;
+
+    newheadind = get_node(mgraph[sgraph[*h].mnode], newheadprop, newheadLH, newheadLV);
     if( newheadind < 0 )
     {
@@ -82,69 +75,63 @@
       list<int>::iterator nextit=h; ++nextit;
       nodelist.insert(nextit,newheadind);
-      snodes[newheadind].LH=newheadLH;
-      snodes[newheadind].in_LH=true;
-      snodes[newheadind].LV.reset();
-      snodes[newheadind].LD = newheadLD;
+      sgraph[newheadind].LH=newheadLH;
+      sgraph[newheadind].LD = newheadLD;
+      sgraph[newheadind].in_LH=true;
+      sgraph[newheadind].LV.reset();
       
       if(debug) sgraph.print_node_debug(stderr," C ",newheadind);
     }
     else
-      snodes[newheadind].LD |= newheadLD; // TYLKO DLA LD
+      sgraph[newheadind].LD |= newheadLD; // TYLKO DLA LD
   }
 
-  snodes[newheadind].deps.push_back(Arc(*d,r,*h));
-  
-  if(snodes[*d].saturated()) snodes[newheadind].LV |= snodes[*d].LV;
-  snodes[newheadind].LD.set(*d);
-  if(snodes[*d].saturated()) snodes[newheadind].LD |= snodes[*d].LD;
-  
-  if(debug)
-    sgraph.print_arc(stderr,*d,newheadind,r,0), sgraph.print_node_debug(stderr," U ",newheadind);
-}
-
+  sgraph[newheadind].deps.push_back(Arc(*d,r,*h));
+  
+  if(sgraph[*d].saturated()) sgraph[newheadind].LV |= sgraph[*d].LV;
+
+  sgraph[newheadind].LD.set(*d);
+  if(sgraph[*d].saturated()) sgraph[newheadind].LD |= sgraph[*d].LD;
+  
+  if(debug) sgraph.print_arc(stderr,*d,newheadind,r,0), sgraph.print_node_debug(stderr," U ",newheadind);
+}
 
 void connect_right(list<int>::iterator h, list<int>::iterator d, Role r)
 {
-  NodeProp &oldheadprop = snodes[*h].prop;
-  NodeProp newheadprop;
-  bitset<MAXNODES> newheadLV;
-  bitset<MAXNODES> newheadLH;
-  bitset<MAXNODES> newheadLD;
+  NodeProp &oldheadprop = sgraph[*h].prop;
+  NodeProp newheadprop = compute_prop_right(oldheadprop,r);
   int newheadind;
   
-  newheadprop = compute_prop_right(oldheadprop,r);
   if(oldheadprop==newheadprop)
     newheadind = *h;
   else
   {
-    newheadLH = snodes[*h].LH;
-    newheadLV = snodes[*h].LV;
-    newheadLD = snodes[*h].LD;
-
-    newheadind = get_node(*(snodes[*h].mnode), newheadprop, newheadLH, newheadLV);
+    bitset<MAXNODES> newheadLH = sgraph[*h].LH;
+    bitset<MAXNODES> newheadLV = sgraph[*h].LV;
+    bitset<MAXNODES> newheadLD = sgraph[*h].LD;
+
+    newheadind = get_node(mgraph[sgraph[*h].mnode], newheadprop, newheadLH, newheadLV);
     if( newheadind < 0 )
     {
       newheadind = sgraph.clone(*h,newheadprop);
-      snodes[newheadind].LH=newheadLH;
-      snodes[newheadind].in_LH=false;
-      snodes[newheadind].LV=newheadLV;
-      snodes[newheadind].LD=newheadLD;
       list<int>::iterator nextit=h; ++nextit;
       nodelist.insert(nextit,newheadind);
+      sgraph[newheadind].LH=newheadLH;
+      sgraph[newheadind].LD=newheadLD;
+      sgraph[newheadind].in_LH=false;
+      sgraph[newheadind].LV=newheadLV;
       
       if(debug) sgraph.print_node_debug(stderr," C ",newheadind);
     }
     else
-      snodes[newheadind].LD |= newheadLD; // TYLKO DLA LD
+      sgraph[newheadind].LD |= newheadLD; // TYLKO DLA LD
   }
   
-  snodes[*d].heads.push_back(Arc(newheadind,r,*h));
-
-  snodes[*d].LH.set(newheadind);
-
-  if(snodes[newheadind].saturated()) snodes[*d].LH |= snodes[newheadind].LH;
-
-  if(debug)
-    sgraph.print_arc(stderr,newheadind,*d,r,1), sgraph.print_node_debug(stderr," U ",*d);
+  sgraph[*d].heads.push_back(Arc(newheadind,r,*h));
+
+  sgraph[*d].LH.set(newheadind);
+
+  if(sgraph[newheadind].saturated()) sgraph[*d].LH |= sgraph[newheadind].LH;
+
+  if(debug) sgraph.print_arc(stderr,newheadind,*d,r,1), sgraph.print_node_debug(stderr," U ",*d);
   
 }
@@ -156,7 +143,7 @@
     if(sgraph.visible(*i,*j) && sgraph.saturated(*i))
     {
-      Roles& ji_roles = grammar.connect[snodes[*j].mnode->cat][snodes[*i].mnode->cat];
+      Roles& ji_roles = grammar.connectable( mgraph[sgraph[*j].mnode].cat, mgraph[sgraph[*i].mnode].cat );
       for(RolesIter r=ji_roles.begin(); r!=ji_roles.end();++r)
-        if(grammar.check_constr(snodes[*j].prop,snodes[*i].prop,0,*r))
+        if(grammar.check_constr(sgraph[*j].prop,sgraph[*i].prop,0,*r))
           connect_left(j,i,*r);
     }
@@ -169,7 +156,7 @@
     if(sgraph.visible(*i,*j))
     {
-      Roles& ij_roles = grammar.connect[snodes[*i].mnode->cat][snodes[*j].mnode->cat];
+      Roles& ij_roles = grammar.connectable( mgraph[sgraph[*i].mnode].cat, mgraph[sgraph[*j].mnode].cat );
       for(RolesIter r=ij_roles.begin(); r!=ij_roles.end();++r)
-        if(grammar.check_constr(snodes[*i].prop,snodes[*j].prop,1,*r))
+        if(grammar.check_constr(sgraph[*i].prop,sgraph[*j].prop,1,*r))
           connect_right(i,j,*r);
     }
@@ -182,8 +169,8 @@
   for(++i; i!=nodelist.end(); ++i)
     {
-      for(vector<Arc>::iterator da=sgraph.nodes[*i].deps.begin()--; da!=sgraph.nodes[*i].deps.end(); ++da)
-        sgraph.nodes[da->dst].heads.push_back(Arc(*i,da->role,da->anc));
-      for(vector<Arc>::iterator ha=sgraph.nodes[*i].heads.begin(); ha!=sgraph.nodes[*i].heads.end(); ++ha)
-        sgraph.nodes[ha->dst].deps.push_back(Arc(*i,ha->role,ha->anc));
+      for(vector<Arc>::iterator da=sgraph[*i].deps.begin()--; da!=sgraph[*i].deps.end(); ++da)
+        sgraph[da->dst].heads.push_back(Arc(*i,da->role,da->anc));
+      for(vector<Arc>::iterator ha=sgraph[*i].heads.begin(); ha!=sgraph[*i].heads.end(); ++ha)
+        sgraph[ha->dst].deps.push_back(Arc(*i,ha->role,ha->anc));
     }
 }
@@ -192,5 +179,4 @@
 void dgp0()
 {
-  snodes=sgraph.nodes;
 
   nodelist.clear();
@@ -198,7 +184,8 @@
   processed=nodelist.begin();
 
-  for(int m=0; m<mgraph.n ; ++m)
+  for(int m=0; m<mgraph.size() ; ++m)
   {
-    int basenode = sgraph.add_base_snode(mgraph.nodes+m); // ma zwracaæ SNode*
+    int basenode = sgraph.add_base_snode(m); // ma zwracaæ SNode*
+
     set_initial_constraints(basenode);
     nodelist.push_back(basenode);
@@ -213,4 +200,5 @@
       processed=cursor;
     }
+
   }
   reverse_links();
