*
* Global definitions for ginsh.
*
- * GiNaC Copyright (C) 1999-2003 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2004 Johannes Gutenberg University Mainz, Germany
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
typedef map<string, symbol> sym_tab;
extern sym_tab syms;
+// Type of symbols to generate (real or complex)
+extern unsigned symboltype;
+
#endif
* This file must be processed with flex. */
/*
- * GiNaC Copyright (C) 1999-2003 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2004 Johannes Gutenberg University Mainz, Germany
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
// Table of all used symbols
sym_tab syms;
+// Type of symbols to generate (real or complex)
+unsigned symboltype = symbol_options::complex;
+
// lex input function
static int ginsh_input(char *buf, int max_size);
%}
inventory return T_INVENTORY;
look return T_LOOK;
score return T_SCORE;
+complex_symbols return T_COMPLEX_SYMBOLS;
+real_symbols return T_REAL_SYMBOLS;
/* comparison */
"==" return T_EQUAL;
{A}{AN}* {
sym_tab::const_iterator i = syms.find(yytext);
if (i == syms.end()) {
- yylval = syms[yytext] = *(new symbol(yytext));
+ if (symboltype == symbol_options::complex) {
+ yylval = syms[yytext] = *(new symbol(yytext));
+ } else {
+ yylval = syms[yytext] = *(new symbol(yytext, symbol_options::real));
+ }
} else
yylval = i->second;
return T_SYMBOL;
* This file must be processed with yacc/bison. */
/*
- * GiNaC Copyright (C) 1999-2003 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2004 Johannes Gutenberg University Mainz, Germany
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
%token T_EQUAL T_NOTEQ T_LESSEQ T_GREATEREQ
%token T_QUIT T_WARRANTY T_PRINT T_IPRINT T_PRINTLATEX T_PRINTCSRC T_TIME
-%token T_XYZZY T_INVENTORY T_LOOK T_SCORE
+%token T_XYZZY T_INVENTORY T_LOOK T_SCORE T_COMPLEX_SYMBOLS T_REAL_SYMBOLS
/* Operator precedence and associativity */
%right '='
cout << (syms.size() > 350 ? 350 : syms.size());
cout << " out of a possible 350.\n";
}
+ | T_REAL_SYMBOLS { symboltype = symbol_options::real; }
+ | T_COMPLEX_SYMBOLS { symboltype = symbol_options::complex; }
| T_TIME {getrusage(RUSAGE_SELF, &start_time);} '(' exp ')' {
getrusage(RUSAGE_SELF, &end_time);
cout << (end_time.ru_utime.tv_sec - start_time.ru_utime.tv_sec) +
void greeting(void)
{
cout << "ginsh - GiNaC Interactive Shell (" << PACKAGE << " V" << VERSION << ")" << endl;
- cout << " __, _______ Copyright (C) 1999-2003 Johannes Gutenberg University Mainz,\n"
+ cout << " __, _______ Copyright (C) 1999-2004 Johannes Gutenberg University Mainz,\n"
<< " (__) * | Germany. This is free software with ABSOLUTELY NO WARRANTY.\n"
<< " ._) i N a C | You are welcome to redistribute it under certain conditions.\n"
<< "<-------------' For details type `warranty;'.\n" << endl;