static void setReportId(ReportManager &rm, NGWrapper &g, NFAVertex v, s32 adj) { // Don't try and set the report ID of a special vertex. assert(!is_special(v, g)); // There should be no reports set already. assert(g[v].reports.empty()); Report r = rm.getBasicInternalReport(g, adj); g[v].reports.insert(rm.getInternalId(r)); DEBUG_PRINTF("set report id for vertex %u, adj %d\n", g[v].index, adj); }
/** \brief Replace the graph's reports with new reports that specify bounds. */ static void updateReportBounds(ReportManager &rm, NGWrapper &g, NFAVertex accept, set<NFAVertex> &done) { for (auto v : inv_adjacent_vertices_range(accept, g)) { // Don't operate on g.accept itself. if (v == g.accept) { assert(accept == g.acceptEod); continue; } // Don't operate on a vertex we've already done. if (contains(done, v)) { continue; } done.insert(v); flat_set<ReportID> new_reports; auto &reports = g[v].reports; for (auto id : reports) { Report ir = rm.getReport(id); // make a copy assert(!ir.hasBounds()); // Note that we need to cope with offset adjustment here. ir.minOffset = g.min_offset - ir.offsetAdjust; if (g.max_offset == MAX_OFFSET) { ir.maxOffset = MAX_OFFSET; } else { ir.maxOffset = g.max_offset - ir.offsetAdjust; } assert(ir.maxOffset >= ir.minOffset); ir.minLength = g.min_length; if (g.min_length && !g.som) { ir.quashSom = true; } DEBUG_PRINTF("id %u -> min_offset=%llu, max_offset=%llu, " "min_length=%llu\n", id, ir.minOffset, ir.maxOffset, ir.minLength); new_reports.insert(rm.getInternalId(ir)); } DEBUG_PRINTF("swapping reports on vertex %u\n", g[v].index); reports.swap(new_reports); } }