36 "#define BUILD_LIBVCSN 1\n"
37 "#define VCSN_INSTANTIATION 1\n"
38 "#define MAYBE_EXTERN\n"
41 o <<
"#include <" << h <<
">\n";
44 o <<
"#include <" << h <<
">\n";
50 #define DEFINE(Type) \
51 void context_printer::visit(const Type& t)
55 static auto map = std::map<std::string, std::string>
57 {
"delay_automaton" ,
"vcsn/algos/is-synchronized.hh"},
58 {
"determinized_automaton" ,
"vcsn/algos/determinize.hh"},
59 {
"detweighted_automaton" ,
"vcsn/algos/determinize.hh"},
60 {
"expression_automaton" ,
"vcsn/core/expression-automaton.hh"},
61 {
"filter_automaton" ,
"vcsn/algos/filter.hh"},
62 {
"focus_automaton" ,
"vcsn/algos/focus.hh"},
63 {
"mutable_automaton" ,
"vcsn/core/mutable-automaton.hh"},
64 {
"name_automaton" ,
"vcsn/core/name-automaton.hh"},
65 {
"pair_automaton" ,
"vcsn/algos/synchronizing-word.hh"},
66 {
"partition_automaton" ,
"vcsn/core/partition-automaton.hh"},
67 {
"permutation_automaton" ,
"vcsn/core/permutation-automaton.hh"},
68 {
"product_automaton" ,
"vcsn/algos/conjunction.hh"},
69 {
"scc_automaton" ,
"vcsn/algos/scc.hh"},
70 {
"synchronized_automaton" ,
"vcsn/algos/synchronize.hh"},
71 {
"transpose_automaton" ,
"vcsn/algos/transpose.hh"},
72 {
"tuple_automaton" ,
"vcsn/core/tuple-automaton.hh"},
74 auto type = t.get_type();
78 for (
auto c: t.get_content())
85 os_ << decendl << '>
';
90 header("vcsn/ctx/context.hh");
91 os_ << "vcsn::context<" << incendl;
92 t.get_labelset()->accept(*this);
94 t.get_weightset()->accept(*this);
95 os_ << decendl << '>
';
101 os_ << "std::tuple<" << incendl;
103 for (auto v: t.get_sets())
110 os_ << decendl << '>
';
115 headers_late_.insert("vcsn/labelset/tupleset.hh");
116 os_ << "vcsn::tupleset<" << incendl;
118 for (auto v: t.get_sets())
125 os_ << decendl << '>
';
130 header("vcsn/labelset/nullableset.hh");
131 os_ << "vcsn::nullableset<" << incendl;
132 t.get_labelset()->accept(*this);
133 os_ << decendl << ">";
139 header("vcsn/labelset/oneset.hh");
140 os_ << "vcsn::oneset";
145 header("vcsn/alphabets/setalpha.hh"); // set_alphabet
146 if (t.letter_type() == "char_letters")
147 header("vcsn/alphabets/char.hh");
148 else if (t.letter_type() == "string_letters")
149 header("vcsn/alphabets/string.hh");
150 os_ << "vcsn::set_alphabet<vcsn::" << t.letter_type() << '>
';
155 header("vcsn/labelset/letterset.hh");
156 os_ << "vcsn::letterset<";
157 t.genset()->accept(*this);
161 DEFINE(expressionset)
163 os_ << "vcsn::expressionset<" << incendl;
164 t.get_context()->accept(*this);
165 os_ << decendl << '>
';
166 header("vcsn/core/rat/expressionset.hh");
171 os_ << "vcsn::rat::expansionset<" << incendl;
172 t.get_expressionset()->accept(*this);
173 os_ << decendl << '>
';
174 header("vcsn/core/rat/expansionset.hh");
179 header("vcsn/weightset/" + t.get_type() + ".hh");
180 if (t.get_type() == "qmp")
181 linkflags("-lgmp -lgmpxx");
182 os_ << "vcsn::" << t.get_type();
187 header("vcsn/labelset/wordset.hh");
188 os_ << "vcsn::wordset<";
189 t.genset()->accept(*this);
198 DEFINE(polynomialset)
200 os_ << "vcsn::polynomialset<" << incendl;
201 t.get_content()->accept(*this);
202 os_ << decendl << '>
';
203 header("vcsn/weightset/polynomialset.hh");
std::set< std::string > headers_
Headers to include.
void header(const std::string &h)
Record that we need an include for this header.
std::string type(const automaton &a)
The implementation type of a.
C::mapped_type getargs(const std::string &kind, const C &map, const std::string &key)
Find a correspondance in a map.
std::ostream & iendl(std::ostream &o)
Print an end of line, then set the indentation.
std::ostream & incendl(std::ostream &o)
Increment the indentation, print an end of line, and set the indentation.
const std::string & linkflags() const
Get the link flags.
std::ostream & print(std::ostream &o)
Generate the code to compile on o.
std::set< std::string > headers_late_
Indentation relative functions.
std::string linkflags_
Flags to pass to the linker.