]> www.ginac.de Git - ginac.git/commitdiff
- added print_latex() and print_csrc()
authorChristian Bauer <Christian.Bauer@uni-mainz.de>
Thu, 17 Oct 2002 18:34:38 +0000 (18:34 +0000)
committerChristian Bauer <Christian.Bauer@uni-mainz.de>
Thu, 17 Oct 2002 18:34:38 +0000 (18:34 +0000)
- updated the man page

ginsh/ginsh.1.in
ginsh/ginsh_lexer.ll
ginsh/ginsh_parser.yy

index 46b6ac0b1209a81fe3663d910cd4625f3bc30aa1..9f797f5741163aff409fdbb482afb4794850f7b7 100644 (file)
@@ -144,9 +144,6 @@ unary minus
 .B *
 multiplication
 .TP
-.B %
-non-commutative multiplication
-.TP
 .B /
 division
 .TP
@@ -407,6 +404,22 @@ This is useful for debugging and for learning about GiNaC internals.
 .PP
 The command
 .RS
+.BI print_latex( expression );
+.RE
+prints a LaTeX representation of the given
+.IR expression .
+.PP
+The command
+.RS
+.BI print_csrc( expression );
+.RE
+prints the given
+.I expression
+in a way that can be used in a C or C++ program (complex numbers are not
+supported, though).
+.PP
+The command
+.RS
 .BI iprint( expression );
 .RE
 prints the given
index c4beae09011eb8e30cfd84285271c759f23f2f6d..0a0a7f484b38586bc388c435e0657537abc1a0ec 100644 (file)
@@ -72,6 +72,8 @@ quit|exit             return T_QUIT;
 warranty               return T_WARRANTY;
 print                  return T_PRINT;
 iprint                 return T_IPRINT;
+print_latex            return T_PRINTLATEX;
+print_csrc             return T_PRINTCSRC;
 time                   return T_TIME;
 xyzzy                  return T_XYZZY;
 inventory              return T_INVENTORY;
index 12aa103acd008366daec050b81844b2eb7e95e5e..7c7e548cc41d8a01a036a7c38616cec456c644c7 100644 (file)
@@ -92,14 +92,15 @@ static void print_help_topics(void);
 %token T_NUMBER T_SYMBOL T_LITERAL T_DIGITS T_QUOTE T_QUOTE2 T_QUOTE3
 %token T_EQUAL T_NOTEQ T_LESSEQ T_GREATEREQ
 
-%token T_QUIT T_WARRANTY T_PRINT T_IPRINT T_TIME T_XYZZY T_INVENTORY T_LOOK T_SCORE
+%token T_QUIT T_WARRANTY T_PRINT T_IPRINT T_PRINTLATEX T_PRINTCSRC T_TIME
+%token T_XYZZY T_INVENTORY T_LOOK T_SCORE
 
 /* Operator precedence and associativity */
 %right '='
 %left T_EQUAL T_NOTEQ
 %left '<' '>' T_LESSEQ T_GREATEREQ
 %left '+' '-'
-%left '*' '/' '%'
+%left '*' '/'
 %nonassoc NEG
 %right '^'
 %nonassoc '!'
@@ -156,6 +157,22 @@ line       : ';'
                        YYERROR;
                }
        }
+       | T_PRINTLATEX '(' exp ')' ';' {
+               try {
+                       $3.print(print_latex(std::cout)); cout << endl;
+               } catch (exception &e) {
+                       std::cerr << e.what() << endl;
+                       YYERROR;
+               }
+       }
+       | T_PRINTCSRC '(' exp ')' ';' {
+               try {
+                       $3.print(print_csrc_double(std::cout)); cout << endl;
+               } catch (exception &e) {
+                       std::cerr << e.what() << endl;
+                       YYERROR;
+               }
+       }
        | '?' T_SYMBOL          {print_help(ex_to<symbol>($2).get_name());}
        | '?' T_TIME            {print_help("time");}
        | '?' '?'               {print_help_topics();}