]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
use NGHolder::foo in favour of NFAGraph::foo
authorAlex Coyte <a.coyte@intel.com>
Thu, 7 Jul 2016 04:07:12 +0000 (14:07 +1000)
committerMatthew Barr <matthew.barr@intel.com>
Wed, 10 Aug 2016 04:52:56 +0000 (14:52 +1000)
29 files changed:
src/nfa/limex_compile.cpp
src/nfagraph/ng_anchored_dots.cpp
src/nfagraph/ng_builder.cpp
src/nfagraph/ng_execute.cpp
src/nfagraph/ng_extparam.cpp
src/nfagraph/ng_haig.cpp
src/nfagraph/ng_holder.cpp
src/nfagraph/ng_holder.h
src/nfagraph/ng_limex.cpp
src/nfagraph/ng_limex_accel.cpp
src/nfagraph/ng_mcclellan.cpp
src/nfagraph/ng_prefilter.cpp
src/nfagraph/ng_puff.cpp
src/nfagraph/ng_redundancy.cpp
src/nfagraph/ng_repeat.cpp
src/nfagraph/ng_rose.cpp
src/nfagraph/ng_som.cpp
src/nfagraph/ng_squash.cpp
src/nfagraph/ng_uncalc_components.cpp
src/nfagraph/ng_util.cpp
src/nfagraph/ng_util.h
src/rose/rose_build_anchored.cpp
src/rose/rose_build_misc.cpp
unit/internal/limex_nfa.cpp
unit/internal/nfagraph_equivalence.cpp
unit/internal/nfagraph_redundancy.cpp
unit/internal/nfagraph_util.cpp
util/ng_corpus_generator.cpp
util/ng_find_matches.cpp

index 79e6db1c79ad6c0148710085516fa138554ee680..e0c459aa12ba1d874d42e7f7e60f1bd9469a169b 100644 (file)
@@ -345,7 +345,7 @@ void buildReachMapping(const build_info &args, vector<NFAStateSet> &reach,
 }
 
 struct AccelBuild {
-    AccelBuild() : v(NFAGraph::null_vertex()), state(0), offset(0), ma_len1(0),
+    AccelBuild() : v(NGHolder::null_vertex()), state(0), offset(0), ma_len1(0),
             ma_len2(0), ma_type(MultibyteAccelInfo::MAT_NONE) {}
     NFAVertex v;
     u32 state;
index 1b6d8826dad19df35259c26d753183fa76eb459d..ba352e60559b8bfd1801f09120a210ec082fc1ea 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Intel Corporation
+ * Copyright (c) 2015-2016, Intel Corporation
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -119,7 +119,7 @@ NFAVertex findReformable(const NGHolder &g, const set<NFAVertex> &starts,
     }
 
     if (dotq.empty()) {
-        return NFAGraph::null_vertex();
+        return NGHolder::null_vertex();
     }
 
     const DotInfo &dot = dotq.top();
@@ -165,10 +165,10 @@ void reformAnchoredRepeatsComponent(NGHolder &g,
         return;
     }
 
-    NFAVertex dotV = NFAGraph::null_vertex();
+    NFAVertex dotV = NGHolder::null_vertex();
     set<NFAVertex> otherV;
     dotV = findReformable(g, compAnchoredStarts, otherV);
-    if (dotV == NFAGraph::null_vertex()) {
+    if (dotV == NGHolder::null_vertex()) {
         DEBUG_PRINTF("no candidate reformable dot found.\n");
         return;
     }
@@ -268,10 +268,10 @@ void reformUnanchoredRepeatsComponent(NGHolder &g,
     }
 
     while (true) {
-        NFAVertex dotV = NFAGraph::null_vertex();
+        NFAVertex dotV = NGHolder::null_vertex();
         set<NFAVertex> otherV;
         dotV = findReformable(g, compUnanchoredStarts, otherV);
-        if (dotV == NFAGraph::null_vertex()) {
+        if (dotV == NGHolder::null_vertex()) {
             DEBUG_PRINTF("no candidate reformable dot found.\n");
             return;
         }
@@ -464,7 +464,7 @@ void collapseVariableDotRepeat(NGHolder &g, NFAVertex start,
     // The first of our optional dots must be connected to start. The jump edge
     // past it will be verified in gatherParticipants(). If start is
     // graph.start, it should not be connected to startDs.
-    NFAVertex initialDot = NFAGraph::null_vertex();
+    NFAVertex initialDot = NGHolder::null_vertex();
     for (auto v : adjacent_vertices_range(start, g)) {
         if (is_special(v, g)) {
             continue;
index 36ce80b03e3f2dcc42f8c4dc8068196ccd92ff90..8a92b7eebf86e193ec8dcad060c8057e62f1fede 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Intel Corporation
+ * Copyright (c) 2015-2016, Intel Corporation
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -131,7 +131,7 @@ NFABuilderImpl::~NFABuilderImpl() {
 NFAVertex NFABuilderImpl::getVertex(Position pos) const {
     assert(id2vertex.size() >= pos);
     const NFAVertex v = id2vertex[pos];
-    assert(v != NFAGraph::null_vertex());
+    assert(v != NGHolder::null_vertex());
     assert(graph->g[v].index == pos);
     return v;
 }
index 46307cd571ef705a325a1b81fc8db7522847b26b..4ffd89c06e07bdd16f68d3a904d6e7931245408a 100644 (file)
@@ -58,7 +58,7 @@ namespace ue2 {
 
 struct StateInfo {
     StateInfo(NFAVertex v, const CharReach &cr) : vertex(v), reach(cr) {}
-    StateInfo() : vertex(NFAGraph::null_vertex()) {}
+    StateInfo() : vertex(NGHolder::null_vertex()) {}
     NFAVertex vertex;
     CharReach reach;
 };
index 17d2a513e2628f71e3ebe3aebf7523a7c250b4ac..bc101df276a9172bbf369666197b9bb2b9df41f7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Intel Corporation
+ * Copyright (c) 2015-2016, Intel Corporation
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -294,21 +294,21 @@ bool anchorPatternWithBoundedRepeat(NGWrapper &g, const depth &minWidth,
 
 static
 NFAVertex findSingleCyclic(const NGHolder &g) {
-    NFAVertex v = NFAGraph::null_vertex();
+    NFAVertex v = NGHolder::null_vertex();
     for (const auto &e : edges_range(g)) {
         if (source(e, g) == target(e, g)) {
             if (source(e, g) == g.startDs) {
                 continue;
             }
-            if (v != NFAGraph::null_vertex()) {
+            if (v != NGHolder::null_vertex()) {
                 // More than one cyclic vertex.
-                return NFAGraph::null_vertex();
+                return NGHolder::null_vertex();
             }
             v = source(e, g);
         }
     }
 
-    if (v != NFAGraph::null_vertex()) {
+    if (v != NGHolder::null_vertex()) {
         DEBUG_PRINTF("cyclic is %u\n", g[v].index);
         assert(!is_special(v, g));
     }
@@ -359,11 +359,11 @@ bool transformMinLengthToRepeat(const ReportManager &rm, NGWrapper &g) {
     // The graph must contain a single cyclic vertex (other than startDs), and
     // that vertex can have one pred and one successor.
     NFAVertex cyclic = findSingleCyclic(g);
-    if (cyclic == NFAGraph::null_vertex()) {
+    if (cyclic == NGHolder::null_vertex()) {
         return false;
     }
 
-    NFAGraph::adjacency_iterator ai, ae;
+    NGHolder::adjacency_iterator ai, ae;
     tie(ai, ae) = adjacent_vertices(g.start, g);
     if (*ai == g.startDs) {
         ++ai;
@@ -411,7 +411,7 @@ bool transformMinLengthToRepeat(const ReportManager &rm, NGWrapper &g) {
 
     // Check the cyclic state is A-OK.
     v = getSoleDestVertex(g, cyclic);
-    if (v == NFAGraph::null_vertex()) {
+    if (v == NGHolder::null_vertex()) {
         DEBUG_PRINTF("cyclic has more than one successor\n");
         return false;
     }
index 8fe4889d2bbc95c288b6db33b12eb1940c94cf0e..e70b77085f7b6129e86b5f0664073a8c1f90234b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Intel Corporation
+ * Copyright (c) 2015-2016, Intel Corporation
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -89,11 +89,11 @@ void populateInit(const NGHolder &g, const flat_set<NFAVertex> &unused,
     }
 
     v_by_index->clear();
-    v_by_index->resize(num_vertices(g), NFAGraph::null_vertex());
+    v_by_index->resize(num_vertices(g), NGHolder::null_vertex());
 
     for (auto v : vertices_range(g)) {
         u32 v_index = g[v].index;
-        assert((*v_by_index)[v_index] == NFAGraph::null_vertex());
+        assert((*v_by_index)[v_index] == NGHolder::null_vertex());
         (*v_by_index)[v_index] = v;
     }
 }
index fd4033788810d74768ced0f49daf7dbde990584a..5356689165cd51fdf119b1f146820e89db53561e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Intel Corporation
+ * Copyright (c) 2015-2016, Intel Corporation
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -154,7 +154,7 @@ void clear_out_edges(NFAVertex v, NGHolder &h) {
 }
 
 void clear_graph(NGHolder &h) {
-    NFAGraph::vertex_iterator vi, ve;
+    NGHolder::vertex_iterator vi, ve;
     for (tie(vi, ve) = vertices(h); vi != ve;) {
         NFAVertex v = *vi;
         ++vi;
index 07f21d0fab01e0d4004eaf7378d0214843d0ca8b..5b6a3de878e95457b3231a50105678c2f3cb297d 100644 (file)
@@ -171,7 +171,7 @@ bool is_special(const NFAVertex v, const GraphT &g) {
 }
 
 static really_inline
-std::pair<NFAGraph::adjacency_iterator, NFAGraph::adjacency_iterator>
+std::pair<NGHolder::adjacency_iterator, NGHolder::adjacency_iterator>
 adjacent_vertices(NFAVertex v, const NGHolder &h) {
     return adjacent_vertices(v, h.g);
 }
@@ -182,7 +182,7 @@ std::pair<NFAEdge, bool> edge(NFAVertex u, NFAVertex v, const NGHolder &h) {
 }
 
 static really_inline
-std::pair<NFAGraph::edge_iterator, NFAGraph::edge_iterator>
+std::pair<NGHolder::edge_iterator, NGHolder::edge_iterator>
 edges(const NGHolder &h) {
     return edges(h.g);
 }
@@ -193,13 +193,13 @@ size_t in_degree(NFAVertex v, const NGHolder &h) {
 }
 
 static really_inline
-std::pair<NFAGraph::in_edge_iterator, NFAGraph::in_edge_iterator>
+std::pair<NGHolder::in_edge_iterator, NGHolder::in_edge_iterator>
 in_edges(NFAVertex v, const NGHolder &h) {
     return in_edges(v, h.g);
 }
 
 static really_inline
-std::pair<NFAGraph::inv_adjacency_iterator, NFAGraph::inv_adjacency_iterator>
+std::pair<NGHolder::inv_adjacency_iterator, NGHolder::inv_adjacency_iterator>
 inv_adjacent_vertices(NFAVertex v, const NGHolder &h) {
     return inv_adjacent_vertices(v, h.g);
 }
@@ -210,7 +210,7 @@ size_t out_degree(NFAVertex v, const NGHolder &h) {
 }
 
 static really_inline
-std::pair<NFAGraph::out_edge_iterator, NFAGraph::out_edge_iterator>
+std::pair<NGHolder::out_edge_iterator, NGHolder::out_edge_iterator>
 out_edges(NFAVertex v, const NGHolder &h) {
     return out_edges(v, h.g);
 }
@@ -226,7 +226,7 @@ NFAVertex target(const NFAEdge &e, const NGHolder &h) {
 }
 
 static really_inline
-std::pair<NFAGraph::vertex_iterator, NFAGraph::vertex_iterator>
+std::pair<NGHolder::vertex_iterator, NGHolder::vertex_iterator>
 vertices(const NGHolder &h) {
     return vertices(h.g);
 }
index af7779ba6224b26a8cdbf4cfe78f9ec0ae8fbadc..a82d18b6e90661672d6e7b2fb743c9e19111c47e 100644 (file)
@@ -164,7 +164,7 @@ void makeTopStates(NGHolder &g, map<u32, NFAVertex> &tops,
 
         assert(!contains(tops, t));
 
-        NFAVertex s = NFAGraph::null_vertex();
+        NFAVertex s = NGHolder::null_vertex();
         flat_set<NFAVertex> succs;
         insert(&succs, top.second);
 
index 1f991f1984d85c78092735f9e25cc343b2c7c18a..deaf2ffd67d40c0df26c9f7df96b87efad00a610 100644 (file)
@@ -658,7 +658,7 @@ NFAVertex get_sds_or_proxy(const NGHolder &g) {
         return g.startDs;
     }
 
-    NFAVertex v = NFAGraph::null_vertex();
+    NFAVertex v = NGHolder::null_vertex();
     for (auto w : adjacent_vertices_range(g.start, g)) {
         if (w != g.startDs) {
             if (!v) {
@@ -693,8 +693,8 @@ NFAVertex get_sds_or_proxy(const NGHolder &g) {
 
 static
 NFAVertex find_next(const NFAVertex v, const NGHolder &g) {
-    NFAVertex res = NFAGraph::null_vertex();
-    for (NFAVertex u :  adjacent_vertices_range(v, g)) {
+    NFAVertex res = NGHolder::null_vertex();
+    for (NFAVertex u : adjacent_vertices_range(v, g)) {
         if (u != v) {
             res = u;
             break;
@@ -736,7 +736,7 @@ MultibyteAccelInfo nfaCheckMultiAccel(const NGHolder &g,
 
     // find our start vertex
     NFAVertex cur = find_next(v, g);
-    if (cur == NFAGraph::null_vertex()) {
+    if (cur == NGHolder::null_vertex()) {
         DEBUG_PRINTF("invalid start vertex\n");
         return MultibyteAccelInfo();
     }
index 024cf2c182751191e26948ccd462de58ec8c7902..39788570d39ac0385b6011ae460b28d11a74495d 100644 (file)
@@ -173,11 +173,11 @@ void populateInit(const NGHolder &g, const flat_set<NFAVertex> &unused,
     }
 
     v_by_index->clear();
-    v_by_index->resize(num_vertices(g), NFAGraph::null_vertex());
+    v_by_index->resize(num_vertices(g), NGHolder::null_vertex());
 
     for (auto v : vertices_range(g)) {
         u32 vert_id = g[v].index;
-        assert((*v_by_index)[vert_id] == NFAGraph::null_vertex());
+        assert((*v_by_index)[vert_id] == NGHolder::null_vertex());
         (*v_by_index)[vert_id] = v;
     }
 
index c2b9eea9b710806ce14896ebdfdad424f7c1559a..8abc45b3a59716e0100c66f09cb180c700f62008 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Intel Corporation
+ * Copyright (c) 2015-2016, Intel Corporation
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -135,7 +135,7 @@ void findWidths(const NGHolder &g,
     // Wire our entries to start and our exits to accept.
     for (auto v : ri.vertices) {
         NFAVertex v_new = mapping[v];
-        assert(v_new != NFAGraph::null_vertex());
+        assert(v_new != NGHolder::null_vertex());
 
         if (isRegionEntry(g, v, region_map) &&
             !edge(rg.start, v_new, rg).second) {
index 540f48592eb92d6f06b2ee625b0a024e52c9588f..00b2e8acabb392c3b1ff9632f1ab10df6e3733d1 100644 (file)
@@ -472,7 +472,7 @@ bool doComponent(RoseBuild &rose, ReportManager &rm, NGHolder &g, NFAVertex a,
     }
 
     NFAVertex puffv = nodes.back();
-    assert(puffv != NFAGraph::null_vertex());
+    assert(puffv != NGHolder::null_vertex());
     u32 width = countChain(g, nodes.back());
 
     flat_set<ReportID> chain_reports;
index b9b80c5b771c8980e49e352cc65fd5d417f79ac8..26599251cafc33d89986e411280704ca279e4c19 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Intel Corporation
+ * Copyright (c) 2015-2016, Intel Corporation
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -158,7 +158,7 @@ void populateContainers(const NGHolder &g, VertexInfoMap &infoMap) {
 static
 void inplaceIntersection(vector<NFAVertex> &vset1,
                          const flat_set<NFAVertex> &vset2) {
-    const NFAVertex GONE = NFAGraph::null_vertex();
+    const NFAVertex GONE = NGHolder::null_vertex();
 
     vector<NFAVertex>::iterator it = vset1.begin(), ite = vset1.end();
     flat_set<NFAVertex>::const_iterator jt = vset2.begin(), jte = vset2.end();
index 80434a0a95885d3f8fd0a7e83bac72d91d9d6b0d..bc7e73d3adc7659eec7b2a41bcca26d77e2710b9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Intel Corporation
+ * Copyright (c) 2015-2016, Intel Corporation
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -1202,7 +1202,7 @@ CharReach predReach(const NGHolder &g, NFAVertex v) {
 static
 void filterMap(const NGHolder &subg,
                ue2::unordered_map<NFAVertex, NFAVertex> &vmap) {
-    NFAGraph::vertex_iterator vi, ve;
+    NGHolder::vertex_iterator vi, ve;
     tie(vi, ve) = vertices(subg);
     const ue2::unordered_set<NFAVertex> remaining_verts(vi, ve);
 
index 997191d218b981c0c6f38df78b7097fb25d50718..9b8f0e9a04d02c02a8ba1dc652633ed7a52ef62b 100644 (file)
@@ -780,7 +780,7 @@ bool literalIsWholeGraph(const NGHolder &g, const ue2_literal &lit) {
     NFAVertex v = g.accept;
 
     for (auto it = lit.rbegin(), ite = lit.rend(); it != ite; ++it) {
-        NFAGraph::inv_adjacency_iterator ai, ae;
+        NGHolder::inv_adjacency_iterator ai, ae;
         tie(ai, ae) = inv_adjacent_vertices(v, g);
         if (ai == ae) {
             assert(0); // no predecessors?
index 03a612a049623aaf787eaab5634dca290dcaeeab..4af0e20c18f9acac3decbfeaf9ee3f3cae050095 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Intel Corporation
+ * Copyright (c) 2015-2016, Intel Corporation
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -384,7 +384,7 @@ makePrefix(const NGHolder &g, const ue2::unordered_map<NFAVertex, u32> &regions,
     add_edge(prefix.accept, prefix.acceptEod, prefix);
 
     assert(!next_enters.empty());
-    assert(next_enters.front() != NFAGraph::null_vertex());
+    assert(next_enters.front() != NGHolder::null_vertex());
     u32 dead_region = regions.at(next_enters.front());
     DEBUG_PRINTF("curr_region %u, dead_region %u\n",
                  regions.at(curr_exits.front()), dead_region);
@@ -2537,7 +2537,7 @@ bool doHaigLitHaigSom(NG &ng, NGHolder &g,
     RoseInVertex v = add_vertex(RoseInVertexProps::makeLiteral(lit), ig);
 
     bool lhs_all_vac = true;
-    NFAGraph::adjacency_iterator ai, ae;
+    NGHolder::adjacency_iterator ai, ae;
     for (tie(ai, ae) = adjacent_vertices(lhs->startDs, *lhs);
          ai != ae && lhs_all_vac; ++ai) {
         if (!is_special(*ai, *lhs)) {
index dd3693e5964c826cdfced6f5174c9a6c25034a71..6577673f5ca078695e54419f4220f59199cb0d59 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Intel Corporation
+ * Copyright (c) 2015-2016, Intel Corporation
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -369,7 +369,7 @@ map<NFAVertex, NFAStateSet> findSquashers(const NGHolder &g, som_type som) {
     buildPDomTree(g, pdom_tree);
 
     // Build list of vertices by state ID and a set of init states.
-    vector<NFAVertex> vByIndex(numStates, NFAGraph::null_vertex());
+    vector<NFAVertex> vByIndex(numStates, NGHolder::null_vertex());
     NFAStateSet initStates(numStates);
     smgb_cache cache(g);
 
@@ -394,7 +394,7 @@ map<NFAVertex, NFAStateSet> findSquashers(const NGHolder &g, som_type som) {
 
     for (u32 i = 0; i < numStates; i++) {
         NFAVertex v = vByIndex[i];
-        assert(v != NFAGraph::null_vertex());
+        assert(v != NGHolder::null_vertex());
         const CharReach &cr = g[v].char_reach;
 
         /* only non-init cyclics can be squashers */
index abba09f935a6ce23ed19b9730725048c5dca637d..217183de0af64fc401d81795148ce0ff82338138 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Intel Corporation
+ * Copyright (c) 2015-2016, Intel Corporation
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -184,7 +184,7 @@ u32 commonPrefixLength(const NGHolder &ga,
             size_t a_count = 0;
             size_t b_count = 0;
 
-            NFAGraph::out_edge_iterator ei, ee;
+            NGHolder::out_edge_iterator ei, ee;
             for (tie(ei, ee) = out_edges(a[i], ga); ok && ei != ee; ++ei) {
                 u32 sid = a_state_ids.at(target(*ei, ga));
                 if (sid == NO_STATE || sid >= max) {
@@ -213,7 +213,7 @@ u32 commonPrefixLength(const NGHolder &ga,
                 }
             }
 
-            NFAGraph::adjacency_iterator ai, ae;
+            NGHolder::adjacency_iterator ai, ae;
             for (tie(ai, ae) = adjacent_vertices(b[i], gb); ok && ai != ae;
                  ++ai) {
                 u32 sid = b_state_ids.at(*ai);
index bcf0ce291b0f5c32713c63f27add4ad6e0123c1c..935a223e1c4d96ba4691004297560fd4170caba6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Intel Corporation
+ * Copyright (c) 2015-2016, Intel Corporation
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -78,26 +78,26 @@ depth maxDistFromStartOfData(const NFAVertexDepth &vd) {
 }
 
 NFAVertex getSoleDestVertex(const NGHolder &g, NFAVertex a) {
-    assert(a != NFAGraph::null_vertex());
+    assert(a != NGHolder::null_vertex());
 
-    NFAGraph::out_edge_iterator ii, iie;
+    NGHolder::out_edge_iterator ii, iie;
     tie(ii, iie) = out_edges(a, g);
     if (ii == iie) {
-        return NFAGraph::null_vertex();
+        return NGHolder::null_vertex();
     }
     NFAVertex b = target(*ii, g);
     if (a == b) {
         ++ii;
         if (ii == iie) {
-            return NFAGraph::null_vertex();
+            return NGHolder::null_vertex();
         }
 
         b = target(*ii, g);
         if (++ii != iie) {
-            return NFAGraph::null_vertex();
+            return NGHolder::null_vertex();
         }
     } else if (++ii != iie && (target(*ii, g) != a || ++ii != iie)) {
-        return NFAGraph::null_vertex();
+        return NGHolder::null_vertex();
     }
 
     assert(a != b);
@@ -105,23 +105,23 @@ NFAVertex getSoleDestVertex(const NGHolder &g, NFAVertex a) {
 }
 
 NFAVertex getSoleSourceVertex(const NGHolder &g, NFAVertex a) {
-    assert(a != NFAGraph::null_vertex());
+    assert(a != NGHolder::null_vertex());
 
     u32 idegree = in_degree(a, g);
     if (idegree != 1 && !(idegree == 2 && hasSelfLoop(a, g))) {
-        return NFAGraph::null_vertex();
+        return NGHolder::null_vertex();
     }
 
-    NFAGraph::in_edge_iterator ii, iie;
+    NGHolder::in_edge_iterator ii, iie;
     tie(ii, iie) = in_edges(a, g);
     if (ii == iie) {
-        return NFAGraph::null_vertex();
+        return NGHolder::null_vertex();
     }
     NFAVertex b = source(*ii, g);
     if (a == b) {
         ++ii;
         if (ii == iie) {
-            return NFAGraph::null_vertex();
+            return NGHolder::null_vertex();
         }
 
         b = source(*ii, g);
@@ -321,7 +321,7 @@ bool can_match_at_eod(const NGHolder &h) {
 }
 
 bool can_only_match_at_eod(const NGHolder &g) {
-    NFAGraph::in_edge_iterator ie, ee;
+    NGHolder::in_edge_iterator ie, ee;
     tie(ie, ee) = in_edges(g.accept, g);
 
     return ie == ee;
index 9eb621e8a1c9c30d9c012a75b59243069aa6005e..955c9b7bea8d1b4a569bee1b0c83834cf7010fe4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Intel Corporation
+ * Copyright (c) 2015-2016, Intel Corporation
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -65,7 +65,7 @@ bool is_dot(NFAVertex v, const GraphT &g) {
 template<class U>
 static really_inline
 void succ(const NGHolder &g, NFAVertex v, U *s) {
-    NFAGraph::adjacency_iterator ai, ae;
+    NGHolder::adjacency_iterator ai, ae;
     tie(ai, ae) = adjacent_vertices(v, g);
     s->insert(ai, ae);
 }
@@ -74,14 +74,14 @@ void succ(const NGHolder &g, NFAVertex v, U *s) {
 template<class U>
 static really_inline
 void pred(const NGHolder &g, NFAVertex v, U *p) {
-    NFAGraph::inv_adjacency_iterator it, ite;
+    NGHolder::inv_adjacency_iterator it, ite;
     tie(it, ite) = inv_adjacent_vertices(v, g);
     p->insert(it, ite);
 }
 
 /** returns a vertex with an out edge from v and is not v.
  * v must have exactly one out-edge excluding self-loops.
- * will return NFAGraph::null_vertex() if the preconditions don't hold.
+ * will return NGHolder::null_vertex() if the preconditions don't hold.
  */
 NFAVertex getSoleDestVertex(const NGHolder &g, NFAVertex v);
 
index 35ff7138bde4a8873846437714c7c9eb068fe663..286cc7ae7968efb24d3ae7a0ae180e071ed23e3e 100644 (file)
@@ -476,7 +476,7 @@ NFAVertex extractLiteral(const NGHolder &h, ue2_literal *lit) {
     }
 
     if (lit_verts.empty()) {
-        return NFAGraph::null_vertex();
+        return NGHolder::null_vertex();
     }
 
     bool nocase = false;
@@ -488,7 +488,7 @@ NFAVertex extractLiteral(const NGHolder &h, ue2_literal *lit) {
         if (cr.isAlpha()) {
             bool cr_nocase = cr.count() != 1;
             if (case_set && cr_nocase != nocase) {
-                return NFAGraph::null_vertex();
+                return NGHolder::null_vertex();
             }
 
             case_set = true;
@@ -511,7 +511,7 @@ bool isSimple(const NGHolder &h, u32 *min_bound, u32 *max_bound,
     DEBUG_PRINTF("looking for simple case\n");
     NFAVertex lit_head = extractLiteral(h, lit);
 
-    if (lit_head == NFAGraph::null_vertex()) {
+    if (lit_head == NGHolder::null_vertex()) {
         DEBUG_PRINTF("no literal found\n");
         return false;
     }
index f99c391ff658699061ad68af13a90f160a1670e2..38586bcd056f533d4cd90d7a2b31383068e99538 100644 (file)
@@ -538,11 +538,11 @@ static
 bool requiresDedupe(const NGHolder &h, const ue2::flat_set<ReportID> &reports,
                     const Grey &grey) {
     /* TODO: tighten */
-    NFAVertex seen_vert = NFAGraph::null_vertex();
+    NFAVertex seen_vert = NGHolder::null_vertex();
 
     for (auto v : inv_adjacent_vertices_range(h.accept, h)) {
         if (has_intersection(h[v].reports, reports)) {
-            if (seen_vert != NFAGraph::null_vertex()) {
+            if (seen_vert != NGHolder::null_vertex()) {
                 return true;
             }
             seen_vert = v;
@@ -551,7 +551,7 @@ bool requiresDedupe(const NGHolder &h, const ue2::flat_set<ReportID> &reports,
 
     for (auto v : inv_adjacent_vertices_range(h.acceptEod, h)) {
         if (has_intersection(h[v].reports, reports)) {
-            if (seen_vert != NFAGraph::null_vertex()) {
+            if (seen_vert != NGHolder::null_vertex()) {
                 return true;
             }
             seen_vert = v;
index c3cfb3dd3bd52dc4d422e4b8392025a2de4b671e..926bf6eb2cb4f268dde8418cc597bdd3eb2beae0 100644 (file)
@@ -314,10 +314,8 @@ protected:
         // Reverse the graph and add some reports on the accept vertices.
         NGHolder g_rev(NFA_REV_PREFIX);
         reverseHolder(*g, g_rev);
-        NFAGraph::inv_adjacency_iterator ai, ae;
-        for (tie(ai, ae) = inv_adjacent_vertices(g_rev.accept, g_rev); ai != ae;
-             ++ai) {
-            g_rev[*ai].reports.insert(0);
+        for (NFAVertex v : inv_adjacent_vertices_range(g_rev.accept, g_rev)) {
+            g_rev[v].reports.insert(0);
         }
 
         nfa = constructReversedNFA(g_rev, type, cc);
index 3677e1d2a2881d74a6d1d8f59d958dca41561979..3ca1923fd7b7441cb6ff4b03bd506e52c5a28801 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Intel Corporation
+ * Copyright (c) 2015-2016, Intel Corporation
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -27,7 +27,8 @@
  */
 
 /**
- * Unit tests for checking the removeGraphEquivalences code in nfagraph/ng_equivalence.cpp.
+ * Unit tests for checking the removeGraphEquivalences code in
+ * nfagraph/ng_equivalence.cpp.
  */
 
 #include "config.h"
@@ -71,10 +72,9 @@ TEST(NFAGraph, RemoveEquivalence1) {
     ASSERT_EQ(2U, in_degree(g.accept, g));
 
     // Find a vertex that goes right after startDs
-    NFAVertex a = NFAGraph::null_vertex();
-    NFAGraph::adjacency_iterator ai, ae;
-    for (tie(ai, ae) = adjacent_vertices(g.startDs, g); ai != ae; ++ai) {
-        a = *ai;
+    NFAVertex a = NGHolder::null_vertex();
+    for (NFAVertex v : adjacent_vertices_range(g.startDs, g)) {
+        a = v;
         if (a == g.startDs) {
             continue;
         }
@@ -87,8 +87,8 @@ TEST(NFAGraph, RemoveEquivalence1) {
     ASSERT_TRUE(a != nullptr);
 
     // There should be two edges from v to nodes with reachability 'b' and 'c'
-    NFAVertex b = NFAGraph::null_vertex();
-    NFAVertex c = NFAGraph::null_vertex();
+    NFAVertex b = NGHolder::null_vertex();
+    NFAVertex c = NGHolder::null_vertex();
     for (NFAVertex tmp : adjacent_vertices_range(a, g)) {
         const CharReach &tmpcr = g[tmp].char_reach;
         ASSERT_EQ(1U, tmpcr.count());
@@ -133,11 +133,9 @@ TEST(NFAGraph, RemoveEquivalence2) {
     ASSERT_EQ(1U, in_degree(g.accept, g));
 
     // Find a vertex leading to accept
-    NFAVertex a = NFAGraph::null_vertex();
-    NFAGraph::inv_adjacency_iterator ai, ae;
-    for (tie(ai, ae) = inv_adjacent_vertices(g.accept, g); ai != ae;
-         ++ai) {
-        a = *ai;
+    NFAVertex a = NGHolder::null_vertex();
+    for (NFAVertex v : inv_adjacent_vertices_range(g.accept, g)) {
+        a = v;
         if (a == g.accept) {
             continue;
         }
@@ -150,8 +148,8 @@ TEST(NFAGraph, RemoveEquivalence2) {
     ASSERT_TRUE(a != nullptr);
 
     // There should be two edges from v to nodes with reachability 'b' and 'c'
-    NFAVertex b = NFAGraph::null_vertex();
-    NFAVertex c = NFAGraph::null_vertex();
+    NFAVertex b = NGHolder::null_vertex();
+    NFAVertex c = NGHolder::null_vertex();
     for (NFAVertex tmp : inv_adjacent_vertices_range(a, g)) {
         const CharReach &tmpcr = g[tmp].char_reach;
         ASSERT_EQ(1U, tmpcr.count());
@@ -197,10 +195,9 @@ TEST(NFAGraph, RemoveEquivalence3) {
     ASSERT_EQ(2U, in_degree(g.accept, g));
 
     // Find a vertex 'a' that goes right after startDs
-    NFAVertex a = NFAGraph::null_vertex();
-    NFAGraph::adjacency_iterator ai, ae;
-    for (tie(ai, ae) = adjacent_vertices(g.startDs, g); ai != ae; ++ai) {
-        a = *ai;
+    NFAVertex a = NGHolder::null_vertex();
+    for (NFAVertex v : adjacent_vertices_range(g.startDs, g)) {
+        a = v;
         if (a == g.startDs) {
             continue;
         }
@@ -234,10 +231,9 @@ TEST(NFAGraph, RemoveEquivalence3) {
     ASSERT_TRUE(edge(dot2, dot1, g).second);
 
     // now, let's find X and Y nodes
-    NFAVertex X = NFAGraph::null_vertex();
-    NFAVertex Y = NFAGraph::null_vertex();
-    for (tie(ai, ae) = adjacent_vertices(dot2, g); ai != ae; ++ai) {
-        NFAVertex tmp = *ai;
+    NFAVertex X = NGHolder::null_vertex();
+    NFAVertex Y = NGHolder::null_vertex();
+    for (NFAVertex tmp : adjacent_vertices_range(dot2, g)) {
 
         // we already know about dot1, so skip it
         if (tmp == dot1) {
@@ -290,12 +286,9 @@ TEST(NFAGraph, RemoveEquivalence4) {
     ASSERT_EQ(1U, in_degree(g.accept, g));
 
     // Find X and Y nodes that are connected to startDs
-    NFAVertex X = NFAGraph::null_vertex();
-    NFAVertex Y = NFAGraph::null_vertex();
-    NFAGraph::adjacency_iterator ai, ae;
-    for (tie(ai, ae) = adjacent_vertices(g.startDs, g); ai != ae; ++ai) {
-        NFAVertex tmp = *ai;
-
+    NFAVertex X = NGHolder::null_vertex();
+    NFAVertex Y = NGHolder::null_vertex();
+    for (NFAVertex tmp : adjacent_vertices_range(g.startDs, g)) {
         // skip startDs
         if (tmp == g.startDs) {
             continue;
@@ -341,10 +334,8 @@ TEST(NFAGraph, RemoveEquivalence4) {
     ASSERT_TRUE(edge(dot2, dot1, g).second);
 
     // now find 'a'
-    NFAVertex a = NFAGraph::null_vertex();
-    for (tie(ai, ae) = adjacent_vertices(dot2, g); ai != ae; ++ai) {
-        NFAVertex tmp = *ai;
-
+    NFAVertex a = NGHolder::null_vertex();
+    for (NFAVertex tmp : adjacent_vertices_range(dot2, g)) {
         // skip dot1
         if (tmp == dot1) {
             continue;
@@ -392,10 +383,9 @@ TEST(NFAGraph, RemoveEquivalence5) {
     ASSERT_EQ(1U, in_degree(g.accept, g));
 
     // find first vertex and ensure it has a self loop
-    NFAVertex v = NFAGraph::null_vertex();
-    NFAGraph::adjacency_iterator ai, ae;
-    for (tie(ai, ae) = adjacent_vertices(g.startDs, g); ai != ae; ++ai) {
-        v = *ai;
+    NFAVertex v = NGHolder::null_vertex();
+    for (NFAVertex t : adjacent_vertices_range(g.startDs, g)) {
+        v = t;
         if (v == g.startDs) {
             continue;
         }
@@ -409,15 +399,13 @@ TEST(NFAGraph, RemoveEquivalence5) {
     ASSERT_TRUE(v != nullptr);
 
     // now, find the vertex leading to accept
-    NFAVertex v2 = NFAGraph::null_vertex();
-    for (tie(ai, ae) = adjacent_vertices(v, g); ai != ae; ++ai) {
-        NFAVertex tmp = *ai;
-
+    NFAVertex v2 = NGHolder::null_vertex();
+    for (NFAVertex tmp : adjacent_vertices_range(v, g)) {
         // skip self-loop
         if (tmp == v) {
             continue;
         }
-        v2 = *ai;
+        v2 = tmp;
         // get char reach
         const CharReach tmpcr = g[tmp].char_reach;
 
@@ -450,10 +438,9 @@ TEST(NFAGraph, RemoveEquivalence6) {
     ASSERT_EQ(1U, in_degree(g.accept, g));
 
     // find that vertex and ensure it has no self loops and an edge to accept
-    NFAVertex v = NFAGraph::null_vertex();
-    NFAGraph::adjacency_iterator ai, ae;
-    for (tie(ai, ae) = adjacent_vertices(g.startDs, g); ai != ae; ++ai) {
-        v = *ai;
+    NFAVertex v = NGHolder::null_vertex();
+    for (NFAVertex t : adjacent_vertices_range(g.startDs, g)) {
+        v = t;
         if (v == g.startDs) {
             continue;
         }
@@ -492,13 +479,12 @@ TEST(NFAGraph, RemoveEquivalence7) {
     ASSERT_EQ(1U, in_degree(g.accept, g));
 
     // find that vertex and ensure it's a dot self loop and has one outgoing edge
-    NFAVertex v = NFAGraph::null_vertex();
-    NFAGraph::adjacency_iterator ai, ae;
-    for (tie(ai, ae) = adjacent_vertices(g.start, g); ai != ae; ++ai) {
-        if (*ai == g.startDs) {
+    NFAVertex v = NGHolder::null_vertex();
+    for (NFAVertex t : adjacent_vertices_range(g.start, g)) {
+        if (t == g.startDs) {
             continue;
         }
-        v = *ai;
+        v = t;
         // check if it has the right char reach
         const CharReach &tmpcr = g[v].char_reach;
         ASSERT_TRUE(tmpcr.all());
@@ -509,13 +495,13 @@ TEST(NFAGraph, RemoveEquivalence7) {
     ASSERT_TRUE(v != nullptr);
 
     // find the next vertex and ensure it has an edge to accept
-    NFAVertex v2 = NFAGraph::null_vertex();
-    for (tie(ai, ae) = adjacent_vertices(v, g); ai != ae; ++ai) {
+    NFAVertex v2 = NGHolder::null_vertex();
+    for (NFAVertex t : adjacent_vertices_range(v, g)) {
         // skip self loop
-        if (*ai == v) {
+        if (t == v) {
             continue;
         }
-        v2 = *ai;
+        v2 = t;
         // check if it has the right char reach
         const CharReach &tmpcr = g[v2].char_reach;
         ASSERT_EQ(1U, tmpcr.count());
index 16266453fe54e621a337a0ae865f2f916533bd55..acb3cc7b12ce481f16a4990ea42fc26c88eb559e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Intel Corporation
+ * Copyright (c) 2015-2016, Intel Corporation
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -27,7 +27,8 @@
  */
 
 /**
- * Unit tests for checking the removeRedundancy code in nfagraph/ng_redundancy.cpp.
+ * Unit tests for checking the removeRedundancy code in
+ * nfagraph/ng_redundancy.cpp.
  */
 
 #include "config.h"
@@ -62,15 +63,17 @@ TEST(NFAGraph, RemoveRedundancy1) {
     // Our graph should only have two non-special nodes
     ASSERT_EQ((size_t)N_SPECIALS + 2, num_vertices(*graph));
 
-    // Dot-star start state should be connected to itself and a single other vertex
+    // Dot-star start state should be connected to itself and a single other
+    // vertex
     ASSERT_EQ(2U, out_degree(graph->startDs, g));
 
     // That single vertex should have reachability [ab]
-    NFAVertex v = NFAGraph::null_vertex();
-    NFAGraph::adjacency_iterator ai, ae;
-    for (tie(ai, ae) = adjacent_vertices(graph->startDs, g); ai != ae; ++ai) {
-        v = *ai;
-        if (v != graph->startDs) break;
+    NFAVertex v = NGHolder::null_vertex();
+    for (NFAVertex t : adjacent_vertices_range(graph->startDs, g)) {
+        v = t;
+        if (v != graph->startDs) {
+            break;
+        }
     }
     const CharReach &cr = g[v].char_reach;
     ASSERT_EQ(2U, cr.count());
@@ -103,35 +106,39 @@ TEST(NFAGraph, RemoveRedundancy2) {
     // Our graph should now have only 3 non-special vertices
     ASSERT_EQ((size_t)N_SPECIALS + 3, num_vertices(*graph));
 
-    // Dot-star start state should be connected to itself and a single other vertex
+    // Dot-star start state should be connected to itself and a single other
+    // vertex
     ASSERT_EQ(2U, out_degree(graph->startDs, g));
 
     // That single vertex should have reachability [a]
-    NFAVertex v = NFAGraph::null_vertex();
-    NFAGraph::adjacency_iterator ai, ae;
-    for (tie(ai, ae) = adjacent_vertices(graph->startDs, g); ai != ae; ++ai) {
-        v = *ai;
-        if (v != graph->startDs) break;
+    NFAVertex v = NGHolder::null_vertex();
+    for (NFAVertex t : adjacent_vertices_range(graph->startDs, g)) {
+        v = t;
+        if (v != graph->startDs) {
+            break;
+        }
     }
     const CharReach &cr = g[v].char_reach;
     ASSERT_EQ(1U, cr.count());
     ASSERT_TRUE(cr.test('a'));
 
-    // 'a' should have two out edges: one to a dot with a cycle (.*) and one to 'c'
+    // 'a' should have two out edges: one to a dot with a cycle (.*) and one to
+    // 'c'
     ASSERT_EQ(2U, out_degree(v, g));
-    NFAVertex dotstar = NFAGraph::null_vertex(), vc = NFAGraph::null_vertex();
-    for (tie(ai, ae) = adjacent_vertices(v, g); ai != ae; ++ai) {
-        const CharReach &cr2 = g[*ai].char_reach;
+    NFAVertex dotstar = NGHolder::null_vertex();
+    NFAVertex vc = NGHolder::null_vertex();
+    for (NFAVertex t : adjacent_vertices_range(v, g)) {
+        const CharReach &cr2 = g[t].char_reach;
         if (cr2.count() == 1 && cr2.test('c')) {
-            vc = *ai;
+            vc = t;
         } else if (cr2.all()) {
-            dotstar = *ai;
+            dotstar = t;
         } else {
             FAIL();
         }
     }
-    ASSERT_TRUE(vc != NFAGraph::null_vertex());
-    ASSERT_TRUE(dotstar != NFAGraph::null_vertex());
+    ASSERT_TRUE(vc != NGHolder::null_vertex());
+    ASSERT_TRUE(dotstar != NGHolder::null_vertex());
 
     // Dot-star node should have a self-loop and an edge to vertex 'c'
     ASSERT_EQ(2U, out_degree(dotstar, g));
index 81dfd6827403cb167b9dbb994b10249effb69564..135276dd9341044cbcd54c610cef04a7d4fe829b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Intel Corporation
+ * Copyright (c) 2015-2016, Intel Corporation
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -85,24 +85,23 @@ TEST(NFAGraph, split1) {
     splitGraph(src, pivot, &lhs, &lhs_map, &rhs, &rhs_map);
 
     ASSERT_EQ(3U + N_SPECIALS, num_vertices(lhs));
-    NFAGraph::vertex_iterator vi, ve;
-    for (tie(vi, ve) = vertices(lhs); vi != ve; ++vi) {
-        if (is_special(*vi, lhs)) {
+    for (NFAVertex v : vertices_range(lhs)) {
+        if (is_special(v, lhs)) {
             continue;
         }
 
-        u32 cr = lhs[*vi].char_reach.find_first();
+        u32 cr = lhs[v].char_reach.find_first();
         SCOPED_TRACE(cr);
         ASSERT_TRUE((cr >= 'a' && cr <= 'c'));
     }
 
     ASSERT_EQ(8U + N_SPECIALS, num_vertices(rhs) );
-    for (tie(vi, ve) = vertices(rhs); vi != ve; ++vi) {
-        if (is_special(*vi, rhs)) {
+    for (NFAVertex v : vertices_range(rhs)) {
+        if (is_special(v, rhs)) {
             continue;
         }
 
-        u32 cr = rhs[*vi].char_reach.find_first();
+        u32 cr = rhs[v].char_reach.find_first();
         SCOPED_TRACE(cr);
         ASSERT_TRUE(cr >= 'b' && cr <= 'i');
     }
@@ -137,24 +136,23 @@ TEST(NFAGraph, split2) {
     splitGraph(src, pivot, &lhs, &lhs_map, &rhs, &rhs_map);
 
     ASSERT_EQ(3U + N_SPECIALS, num_vertices(lhs));
-    NFAGraph::vertex_iterator vi, ve;
-    for (tie(vi, ve) = vertices(lhs); vi != ve; ++vi) {
-        if (is_special(*vi, lhs)) {
+    for (NFAVertex v : vertices_range(lhs)) {
+        if (is_special(v, lhs)) {
             continue;
         }
 
-        u32 cr = lhs[*vi].char_reach.find_first();
+        u32 cr = lhs[v].char_reach.find_first();
         SCOPED_TRACE(cr);
         ASSERT_TRUE(cr >= 'a' && cr <= 'c');
     }
 
     ASSERT_EQ(3U + N_SPECIALS, num_vertices(rhs) );
-    for (tie(vi, ve) = vertices(rhs); vi != ve; ++vi) {
-        if (is_special(*vi, rhs)) {
+    for (NFAVertex v : vertices_range(rhs)) {
+        if (is_special(v, rhs)) {
             continue;
         }
 
-        u32 cr = rhs[*vi].char_reach.find_first();
+        u32 cr = rhs[v].char_reach.find_first();
         SCOPED_TRACE(cr);
         ASSERT_TRUE(cr >= 'b' && cr <= 'd');
     }
@@ -211,24 +209,23 @@ TEST(NFAGraph, split3) {
     splitGraph(src, pivots, &lhs, &lhs_map, &rhs, &rhs_map);
 
     ASSERT_EQ(7U + N_SPECIALS, num_vertices(lhs));
-    NFAGraph::vertex_iterator vi, ve;
-    for (tie(vi, ve) = vertices(lhs); vi != ve; ++vi) {
-        if (is_special(*vi, lhs)) {
+    for (NFAVertex v : vertices_range(lhs)) {
+        if (is_special(v, lhs)) {
             continue;
         }
 
-        u32 cr = lhs[*vi].char_reach.find_first();
+        u32 cr = lhs[v].char_reach.find_first();
         SCOPED_TRACE(cr);
         ASSERT_TRUE((cr >= 'a' && cr <= 'g'));
     }
 
     ASSERT_EQ(2U + N_SPECIALS, num_vertices(rhs) );
-    for (tie(vi, ve) = vertices(rhs); vi != ve; ++vi) {
-        if (is_special(*vi, rhs)) {
+    for (NFAVertex v : vertices_range(rhs)) {
+        if (is_special(v, rhs)) {
             continue;
         }
 
-        u32 cr = rhs[*vi].char_reach.find_first();
+        u32 cr = rhs[v].char_reach.find_first();
         SCOPED_TRACE(cr);
         ASSERT_TRUE(cr >= 'h' && cr <= 'i');
     }
@@ -289,13 +286,12 @@ TEST(NFAGraph, split4) {
     splitGraph(src, pivots, &lhs, &lhs_map, &rhs, &rhs_map);
 
     ASSERT_EQ(7U + N_SPECIALS, num_vertices(lhs));
-    NFAGraph::vertex_iterator vi, ve;
-    for (tie(vi, ve) = vertices(lhs); vi != ve; ++vi) {
-        if (is_special(*vi, lhs)) {
+    for (NFAVertex v : vertices_range(lhs)) {
+        if (is_special(v, lhs)) {
             continue;
         }
 
-        u32 cr = lhs[*vi].char_reach.find_first();
+        u32 cr = lhs[v].char_reach.find_first();
         SCOPED_TRACE(cr);
         ASSERT_TRUE((cr >= 'a' && cr <= 'g'));
     }
@@ -304,12 +300,12 @@ TEST(NFAGraph, split4) {
     ASSERT_TRUE(edge(lhs_map[d], lhs_map[d], lhs).second);
 
     ASSERT_EQ(2U + N_SPECIALS, num_vertices(rhs) );
-    for (tie(vi, ve) = vertices(rhs); vi != ve; ++vi) {
-        if (is_special(*vi, rhs)) {
+    for (NFAVertex v : vertices_range(rhs)) {
+        if (is_special(v, rhs)) {
             continue;
         }
 
-        u32 cr = rhs[*vi].char_reach.find_first();
+        u32 cr = rhs[v].char_reach.find_first();
         SCOPED_TRACE(cr);
         ASSERT_TRUE(cr >= 'h' && cr <= 'i');
     }
index 30629f71a4df8c61e25ab9b8f79aefc3de04883f..9fa6743e1eff3990bcd751805f7c9122434a5e6f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Intel Corporation
+ * Copyright (c) 2015-2016, Intel Corporation
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -158,7 +158,7 @@ void findPaths(const NGHolder &g, CorpusProperties &cProps,
         DEBUG_PRINTF("dequeuing path %s, back %u\n",
                      pathToString(g, *p).c_str(), g[u].index);
 
-        NFAGraph::adjacency_iterator ai, ae;
+        NGHolder::adjacency_iterator ai, ae;
         for (tie(ai, ae) = adjacent_vertices(u, g); ai != ae; ++ai) {
             NFAVertex v = *ai;
 
index 4d188d787e03b40776e2c4c8fa5cec586ee15be9..60ff0a17dca4d3980aa095843ad93863aa97cb55 100644 (file)
@@ -76,7 +76,7 @@ struct fmstate {
     fmstate(const NGHolder &g, bool som_in, bool utf8_in, bool aSD_in,
             const ReportManager &rm_in)
         : num_states(num_vertices(g)), states(num_states), next(num_states),
-          vertices(num_vertices(g), NFAGraph::null_vertex()), som(som_in),
+          vertices(num_vertices(g), NGHolder::null_vertex()), som(som_in),
           utf8(utf8_in), allowStartDs(aSD_in), rm(rm_in), accept(num_states),
           accept_with_eod(num_states) {
         // init states