5 #include <boost/algorithm/string/predicate.hpp>
38 "#define BUILD_LIBVCSN 1\n"
39 "#define VCSN_INSTANTIATION 1\n"
40 "#define MAYBE_EXTERN\n"
43 o <<
"#include <" << h <<
">\n";
46 o <<
"#include <" << h <<
">\n";
52 #define DEFINE(Type) \
53 void context_printer::visit(const Type& t)
61 {
"compose_automaton" ,
"vcsn/algos/compose.hh"},
62 {
"delay_automaton" ,
"vcsn/algos/is-synchronized.hh"},
63 {
"derived_term_automaton" ,
"vcsn/algos/derived-term.hh"},
64 {
"determinized_automaton" ,
"vcsn/algos/determinize.hh"},
65 {
"expression_automaton" ,
"vcsn/core/expression-automaton.hh"},
66 {
"filter_automaton" ,
"vcsn/algos/filter.hh"},
67 {
"focus_automaton" ,
"vcsn/algos/focus.hh"},
68 {
"insplit_automaton" ,
"vcsn/algos/insplit.hh"},
69 {
"lazy_proper_automaton" ,
"vcsn/algos/epsilon-remover-lazy.hh"},
70 {
"mutable_automaton" ,
"vcsn/core/mutable-automaton.hh"},
71 {
"name_automaton" ,
"vcsn/core/name-automaton.hh"},
72 {
"pair_automaton" ,
"vcsn/algos/synchronizing-word.hh"},
73 {
"partition_automaton" ,
"vcsn/core/partition-automaton.hh"},
74 {
"permutation_automaton" ,
"vcsn/core/permutation-automaton.hh"},
75 {
"product_automaton" ,
"vcsn/algos/conjunction.hh"},
76 {
"scc_automaton" ,
"vcsn/algos/scc.hh"},
77 {
"synchronized_automaton" ,
"vcsn/algos/synchronize.hh"},
78 {
"transpose_automaton" ,
"vcsn/algos/transpose.hh"},
79 {
"tuple_automaton" ,
"vcsn/core/tuple-automaton.hh"},
82 auto type = t.get_type();
84 os_ <<
"vcsn::" << type <<
'<' <<
incendl;
86 for (
auto c: t.get_content())
93 os_ << decendl << '>
';
98 header("vcsn/ctx/context.hh");
99 os_ << "vcsn::context<" << incendl;
100 t.get_labelset()->accept(*this);
102 t.get_weightset()->accept(*this);
103 os_ << decendl << '>
';
109 os_ << "std::tuple<" << incendl;
111 for (auto v: t.get_sets())
118 os_ << decendl << '>
';
123 headers_late_.insert("vcsn/labelset/tupleset.hh");
124 os_ << "vcsn::tupleset<" << incendl;
126 for (auto v: t.get_sets())
133 os_ << decendl << '>
';
138 header("vcsn/labelset/nullableset.hh");
139 os_ << "vcsn::nullableset<" << incendl;
140 t.get_labelset()->accept(*this);
141 os_ << decendl << ">";
147 header("vcsn/labelset/oneset.hh");
148 os_ << "vcsn::oneset";
153 header("vcsn/alphabets/setalpha.hh"); // set_alphabet
154 if (t.letter_type() == "char_letters")
155 header("vcsn/alphabets/char.hh");
156 else if (t.letter_type() == "string_letters")
157 header("vcsn/alphabets/string.hh");
158 os_ << "vcsn::set_alphabet<vcsn::" << t.letter_type() << '>
';
163 header("vcsn/labelset/letterset.hh");
164 os_ << "vcsn::letterset<";
165 t.genset()->accept(*this);
169 DEFINE(expressionset)
171 os_ << "vcsn::expressionset<" << incendl;
172 t.get_context()->accept(*this);
173 os_ << decendl << '>
';
174 header("vcsn/core/rat/expressionset.hh");
179 os_ << "vcsn::rat::expansionset<" << incendl;
180 t.get_expressionset()->accept(*this);
181 os_ << decendl << '>
';
182 header("vcsn/core/rat/expansionset.hh");
187 header("vcsn/weightset/" + t.get_type() + ".hh");
188 if (t.get_type() == "qmp")
189 linkflags("-lgmp -lgmpxx");
190 os_ << "vcsn::" << t.get_type();
195 header("vcsn/labelset/wordset.hh");
196 os_ << "vcsn::wordset<";
197 t.genset()->accept(*this);
203 if (boost::ends_with(t.get_type(), "_tag"))
208 DEFINE(polynomialset)
210 os_ << "vcsn::polynomialset<" << incendl;
211 t.get_content()->accept(*this);
212 os_ << decendl << '>
';
213 header("vcsn/weightset/polynomialset.hh");
std::ostream & incendl(std::ostream &o)
Increment the indentation, print an end of line, and set the indentation.
std::set< std::string > headers_late_
std::ostream & iendl(std::ostream &o)
Print an end of line, then set the indentation.
void header(const std::string &h)
Record that we need an include for this header.
std::ostream & print(std::ostream &o)
Generate the code to compile on o.
std::string linkflags_
Flags to pass to the linker.
Indentation relative functions.
const std::string & linkflags() const
Get the link flags.
A mapping from strings to Values.
std::set< std::string > headers_
Headers to include.