]> www.ginac.de Git - ginac.git/blobdiff - ginsh/ginsh_parser.yy
* Macro deobfuscation.
[ginac.git] / ginsh / ginsh_parser.yy
index 646cb020b2094283823319764d591830557c50bc..a83bbc32a444ecbd7ee0cede115558c16876b95f 100644 (file)
@@ -4,7 +4,7 @@
  *  This file must be processed with yacc/bison. */
 
 /*
- *  GiNaC Copyright (C) 1999-2000 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2001 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
@@ -176,6 +176,13 @@ line       : ';'
                cout << (syms.size() > 350 ? 350 : syms.size());
                cout << " out of a possible 350.\n";
        }
+       | 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) +
+                       (end_time.ru_stime.tv_sec - start_time.ru_stime.tv_sec) +
+                        double(end_time.ru_utime.tv_usec - start_time.ru_utime.tv_usec) / 1e6 +
+                        double(end_time.ru_stime.tv_usec - start_time.ru_stime.tv_usec) / 1e6 << 's' << endl;
+       }
        | error ';'             {yyclearin; yyerrok;}
        | error ':'             {yyclearin; yyerrok;}
        ;
@@ -188,13 +195,6 @@ exp        : T_NUMBER              {$$ = $1;}
        | T_QUOTE               {$$ = exstack[0];}
        | T_QUOTE2              {$$ = exstack[1];}
        | T_QUOTE3              {$$ = exstack[2];}
-       | T_TIME {getrusage(RUSAGE_SELF, &start_time);} '(' exp ')' {
-               getrusage(RUSAGE_SELF, &end_time);
-               $$ = (end_time.ru_utime.tv_sec - start_time.ru_utime.tv_sec) +
-                    (end_time.ru_stime.tv_sec - start_time.ru_stime.tv_sec) +
-                    double(end_time.ru_utime.tv_usec - start_time.ru_utime.tv_usec) / 1e6 +
-                    double(end_time.ru_stime.tv_usec - start_time.ru_stime.tv_usec) / 1e6;
-       }
        | T_SYMBOL '(' exprseq ')' {
                fcn_tab::const_iterator i = find_function($1, $3.nops());
                if (i->second.is_ginac) {
@@ -566,11 +566,7 @@ static ex f_ginac_function(const exprseq &es, int serial)
 }
 
 // All registered GiNaC functions
-#ifndef NO_NAMESPACE_GINAC
 void GiNaC::ginsh_get_ginac_functions(void)
-#else // ndef NO_NAMESPACE_GINAC
-void ginsh_get_ginac_functions(void)
-#endif // ndef NO_NAMESPACE_GINAC
 {
        vector<function_options>::const_iterator i = function::registered_functions().begin(), end = function::registered_functions().end();
        unsigned serial = 0;
@@ -700,11 +696,13 @@ static char **fcn_completion(char *text, int start, int end)
                // For shell commands, revert back to filename completion
                rl_completion_append_character = orig_completion_append_character;
                rl_basic_word_break_characters = orig_basic_word_break_characters;
+               rl_completer_word_break_characters = rl_basic_word_break_characters;
                return completion_matches(text, (CPFunction *)filename_completion_function);
        } else {
                // Otherwise, complete function names
                rl_completion_append_character = '(';
                rl_basic_word_break_characters = " \t\n\"#$%&'()*+,-./:;<=>?@[\\]^`{|}~";
+               rl_completer_word_break_characters = rl_basic_word_break_characters;
                return completion_matches(text, (CPFunction *)fcn_generator);
        }
 }
@@ -712,7 +710,7 @@ static char **fcn_completion(char *text, int start, int end)
 void greeting(void)
 {
     cout << "ginsh - GiNaC Interactive Shell (" << PACKAGE << " V" << VERSION << ")" << endl;
-    cout << "  __,  _______  Copyright (C) 1999-2000 Johannes Gutenberg University Mainz,\n"
+    cout << "  __,  _______  Copyright (C) 1999-2001 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;