1 /** @file print.cpp
2 *
3 * Implementation of helper classes for expression output. */
4
5 /*
6 * GiNaC Copyright (C) 1999-2022 Johannes Gutenberg University Mainz, Germany
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23 #include "print.h"
24
25 #include <iostream>
26
27 namespace GiNaC {
28
29 /** Next free ID for print_context types. */
30 unsigned next_print_context_id = 0;
31
32
GINAC_IMPLEMENT_PRINT_CONTEXT(print_context,void)33 GINAC_IMPLEMENT_PRINT_CONTEXT(print_context, void)
34 GINAC_IMPLEMENT_PRINT_CONTEXT(print_dflt, print_context)
35 GINAC_IMPLEMENT_PRINT_CONTEXT(print_latex, print_context)
36 GINAC_IMPLEMENT_PRINT_CONTEXT(print_python, print_context)
37 GINAC_IMPLEMENT_PRINT_CONTEXT(print_python_repr, print_context)
38 GINAC_IMPLEMENT_PRINT_CONTEXT(print_tree, print_context)
39 GINAC_IMPLEMENT_PRINT_CONTEXT(print_csrc, print_context)
40 GINAC_IMPLEMENT_PRINT_CONTEXT(print_csrc_float, print_csrc)
41 GINAC_IMPLEMENT_PRINT_CONTEXT(print_csrc_double, print_csrc)
42 GINAC_IMPLEMENT_PRINT_CONTEXT(print_csrc_cl_N, print_csrc)
43
44 print_context::print_context()
45 : s(std::cout), options(0) {}
print_context(std::ostream & os,unsigned opt)46 print_context::print_context(std::ostream & os, unsigned opt)
47 : s(os), options(opt) {}
48
print_dflt()49 print_dflt::print_dflt()
50 : print_context(std::cout) {}
print_dflt(std::ostream & os,unsigned opt)51 print_dflt::print_dflt(std::ostream & os, unsigned opt)
52 : print_context(os, opt) {}
53
print_latex()54 print_latex::print_latex()
55 : print_context(std::cout) {}
print_latex(std::ostream & os,unsigned opt)56 print_latex::print_latex(std::ostream & os, unsigned opt)
57 : print_context(os, opt) {}
58
print_python()59 print_python::print_python()
60 : print_context(std::cout) {}
print_python(std::ostream & os,unsigned opt)61 print_python::print_python(std::ostream & os, unsigned opt)
62 : print_context(os, opt) {}
63
print_python_repr()64 print_python_repr::print_python_repr()
65 : print_context(std::cout) {}
print_python_repr(std::ostream & os,unsigned opt)66 print_python_repr::print_python_repr(std::ostream & os, unsigned opt)
67 : print_context(os, opt) {}
68
print_tree()69 print_tree::print_tree()
70 : print_context(std::cout), delta_indent(4) {}
print_tree(unsigned d)71 print_tree::print_tree(unsigned d)
72 : print_context(std::cout), delta_indent(d) {}
print_tree(std::ostream & os,unsigned opt,unsigned d)73 print_tree::print_tree(std::ostream & os, unsigned opt, unsigned d)
74 : print_context(os, opt), delta_indent(d) {}
75
print_csrc()76 print_csrc::print_csrc()
77 : print_context(std::cout) {}
print_csrc(std::ostream & os,unsigned opt)78 print_csrc::print_csrc(std::ostream & os, unsigned opt)
79 : print_context(os, opt) {}
80
print_csrc_float()81 print_csrc_float::print_csrc_float()
82 : print_csrc(std::cout) {}
print_csrc_float(std::ostream & os,unsigned opt)83 print_csrc_float::print_csrc_float(std::ostream & os, unsigned opt)
84 : print_csrc(os, opt) {}
85
print_csrc_double()86 print_csrc_double::print_csrc_double()
87 : print_csrc(std::cout) {}
print_csrc_double(std::ostream & os,unsigned opt)88 print_csrc_double::print_csrc_double(std::ostream & os, unsigned opt)
89 : print_csrc(os, opt) {}
90
print_csrc_cl_N()91 print_csrc_cl_N::print_csrc_cl_N()
92 : print_csrc(std::cout) {}
print_csrc_cl_N(std::ostream & os,unsigned opt)93 print_csrc_cl_N::print_csrc_cl_N(std::ostream & os, unsigned opt)
94 : print_csrc(os, opt) {}
95
96 } // namespace GiNaC
97