// -*- coding: utf-8 -*- // Copyright (C) 2015, 2016, 2017 Laboratoire de Recherche et // Développement de l'Epita. // // This file is part of Spot, a model checking library. // // Spot is free software; you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 3 of the License, or // (at your option) any later version. // // Spot is distributed in the hope that it will be useful, but WITHOUT // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public // License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see . #include #include #include #include #include #include #include #include "spot/priv/bddalloc.hh" #include #include namespace spot { std::ostream& operator<<(std::ostream& os, spot::acc_cond::mark_t m) { auto a = m.id; os << '{'; unsigned level = 0; const char* comma = ""; while (a) { if (a & 1) { os << comma << level; comma = ","; } a >>= 1; ++level; } os << '}'; return os; } std::ostream& operator<<(std::ostream& os, const acc_cond& acc) { return os << '(' << acc.num_sets() << ", " << acc.get_acceptance() << ')'; } namespace { void default_set_printer(std::ostream& os, int v) { os << v; } enum code_output {HTML, TEXT, LATEX}; template static void print_code(std::ostream& os, const acc_cond::acc_code& code, unsigned pos, std::function set_printer) { const char* op_ = style == LATEX ? " \\lor " : " | "; auto& w = code[pos]; const char* negated_pre = ""; const char* negated_post = ""; auto set_neg = [&]() { if (style == LATEX) { negated_pre = "\\overline{"; negated_post = "}"; } else { negated_pre = "!"; } }; bool top = pos == code.size() - 1; switch (w.sub.op) { case acc_cond::acc_op::And: switch (style) { case HTML: op_ = " & "; break; case TEXT: op_ = " & "; break; case LATEX: op_ = " \\land "; break; } SPOT_FALLTHROUGH; case acc_cond::acc_op::Or: { unsigned sub = pos - w.sub.size; if (!top) os << '('; bool first = true; while (sub < pos) { --pos; if (first) first = false; else os << op_; print_code