1 #ifndef SYMENGINE_CODEGEN_H
2 #define SYMENGINE_CODEGEN_H
3 
4 #include <symengine/visitor.h>
5 #include <symengine/printers/strprinter.h>
6 #include <symengine/symengine_exception.h>
7 
8 namespace SymEngine
9 {
10 
11 class CodePrinter : public BaseVisitor<CodePrinter, StrPrinter>
12 {
13 public:
14     using StrPrinter::apply;
15     using StrPrinter::bvisit;
16     using StrPrinter::str_;
17     void bvisit(const Basic &x);
18     void bvisit(const Complex &x);
19     void bvisit(const Interval &x);
20     void bvisit(const Contains &x);
21     void bvisit(const Piecewise &x);
22     void bvisit(const Rational &x);
23     void bvisit(const EmptySet &x);
24     void bvisit(const FiniteSet &x);
25     void bvisit(const Reals &x);
26     void bvisit(const Rationals &x);
27     void bvisit(const Integers &x);
28     void bvisit(const UniversalSet &x);
29     void bvisit(const Abs &x);
30     void bvisit(const Ceiling &x);
31     void bvisit(const Truncate &x);
32     void bvisit(const Max &x);
33     void bvisit(const Min &x);
34     void bvisit(const Constant &x);
35     void bvisit(const NaN &x);
36     void bvisit(const Equality &x);
37     void bvisit(const Unequality &x);
38     void bvisit(const LessThan &x);
39     void bvisit(const StrictLessThan &x);
40     void bvisit(const UnivariateSeries &x);
41     void bvisit(const Derivative &x);
42     void bvisit(const Subs &x);
43     void bvisit(const GaloisField &x);
44 };
45 
46 class C89CodePrinter : public BaseVisitor<C89CodePrinter, CodePrinter>
47 {
48 public:
49     using CodePrinter::apply;
50     using CodePrinter::bvisit;
51     using CodePrinter::str_;
52     void bvisit(const Infty &x);
53     void _print_pow(std::ostringstream &o, const RCP<const Basic> &a,
54                     const RCP<const Basic> &b);
55 };
56 
57 class C99CodePrinter : public BaseVisitor<C99CodePrinter, C89CodePrinter>
58 {
59 public:
60     using C89CodePrinter::apply;
61     using C89CodePrinter::bvisit;
62     using C89CodePrinter::str_;
63     void bvisit(const Infty &x);
64     void _print_pow(std::ostringstream &o, const RCP<const Basic> &a,
65                     const RCP<const Basic> &b);
66     void bvisit(const Gamma &x);
67     void bvisit(const LogGamma &x);
68 };
69 
70 class JSCodePrinter : public BaseVisitor<JSCodePrinter, CodePrinter>
71 {
72 public:
73     using CodePrinter::apply;
74     using CodePrinter::bvisit;
75     using CodePrinter::str_;
76     void bvisit(const Constant &x);
77     void _print_pow(std::ostringstream &o, const RCP<const Basic> &a,
78                     const RCP<const Basic> &b);
79     void bvisit(const Abs &x);
80     void bvisit(const Sin &x);
81     void bvisit(const Cos &x);
82     void bvisit(const Max &x);
83     void bvisit(const Min &x);
84 };
85 } // namespace SymEngine
86 
87 #endif // SYMENGINE_CODEGEN_H
88