#include <unistd.h>
#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-extern "C" {
-#include <readline/readline.h>
-#include <readline/history.h>
-}
-
#include <map>
#include <string>
#include <stdexcept>
-#include <ginac/ginac.h>
#include "ginsh.h"
// Original readline settings
YYERROR;
}
}
+ | exp ':'
+ {
+ try {
+ push($1);
+ } catch (exception &e) {
+ cerr << e.what() << endl;
+ YYERROR;
+ }
+ }
| T_PRINT '(' exp ')' ';'
{
try {
cout << " out of a possible 350.\n";
}
| error ';' {yyclearin; yyerrok;}
+ | error ':' {yyclearin; yyerrok;}
;
exp : T_NUMBER {$$ = $1;}
return function(serial, es).eval(1);
}
-void ginsh_get_ginac_functions(void)
+void GiNaC::ginsh_get_ginac_functions(void)
{
vector<registered_function_info>::const_iterator i = function::registered_functions().begin(), end = function::registered_functions().end();
unsigned serial = 0;
orig_completion_append_character = rl_completion_append_character;
orig_basic_word_break_characters = rl_basic_word_break_characters;
+ // Init input file list, open first file
+ num_files = argc - 1;
+ file_list = argv + 1;
+ if (num_files) {
+ yyin = fopen(*file_list, "r");
+ if (yyin == NULL) {
+ cerr << "Can't open " << *file_list << endl;
+ exit(1);
+ }
+ num_files--;
+ file_list++;
+ }
+
// Parse input, catch all remaining exceptions
int result;
again: try {