]> www.ginac.de Git - ginac.git/blobdiff - cint/ginaccint.bin.cpp
documentation update
[ginac.git] / cint / ginaccint.bin.cpp
index ae8fd3266cb6c89bef00178188a22251c1f206db..0c2c0d53deb287b66ff940923b793debdc8119e3 100644 (file)
@@ -16,9 +16,7 @@
 #include "config.h"
 #include <list>
 
-#ifndef NO_NAMESPACE_GINAC
 using namespace GiNaC;
-#endif // ndef NO_NAMESPACE_GINAC
 
 extern "C" G__value G__exec_tempfile G__P((char *file));
 extern "C" void G__store_undo_position(void);
@@ -47,6 +45,7 @@ long ex::last_created_or_assigned_exp = 0;
 G__value exec_tempfile(std::string const & command);
 char * process_permanentfile(std::string const & command);
 void process_tempfile(std::string const & command);
+void printversionmessage(std::ostream & os);
 void greeting(void);
 void helpmessage(void);
 std::string preprocess(char const * const line, bool & comment, bool & single_quote,
@@ -163,10 +162,19 @@ void process_tempfile(std::string const & command)
        return;
 }
 
+void printversionmessage(std::ostream & os)
+{
+       os << "GiNaC-cint (" << PACKAGE << " V" << VERSION
+          << ", Cint V" << G__CINTVERSION/1000000
+          << '.' << G__CINTVERSION/1000%1000
+          << '.' << G__CINTVERSION%1000 << ')' << endl;
+       return;
+}
+
 void greeting(void)
 {
-       std::cout << "Welcome to GiNaC-cint (" << PACKAGE << " V" << VERSION
-                 << ", Cint V" << G__CINTVERSION << ")\n";
+       std::cout << "Welcome to ";
+       printversionmessage(std::cout);
        std::cout << "  __,  _______  GiNaC: (C) 1999-2001 Johannes Gutenberg University Mainz,\n"
                  << " (__) *       | Germany.  Cint C/C++ interpreter: (C) 1995-2001 Masaharu\n"
                  << "  ._) i N a C | Goto and Agilent Technologies, Japan.  This is free software\n"
@@ -323,13 +331,14 @@ void cleanup(void)
 
 void sigterm_handler(int n)
 {
+       G__scratch_all();
        exit(1);
 }
 
 void initialize(void)
 {
        atexit(cleanup);
-       signal(SIGTERM,sigterm_handler);
+       signal(SIGTERM, sigterm_handler);
        initialize_cint();
 }    
 
@@ -337,12 +346,9 @@ void initialize_cint(void)
 {
        G__init_cint("cint");    /* initialize cint */
        
-#ifndef NO_NAMESPACE_GINAC
        exec_tempfile("using namespace GiNaC;");
-#endif // ndef NO_NAMESPACE_GINAC
-       
        exec_tempfile("ex LAST,LLAST,LLLAST;\n");
-       exec_tempfile("bool ginac_cint_internal_redirect_output=false;\n");
+       exec_tempfile("bool ginac_cint_internal_redirect_output = false;\n");
        exec_tempfile("ofstream ginac_cint_internal_fout;\n");
 }    
 
@@ -376,13 +382,11 @@ void redirect(std::string const & filename,
 bool evaloption(const std::string & option)
 {
        if (option=="--version") {
-               std::cout << "GiNaC-cint (" << PACKAGE << " V" << VERSION
-                         << ", Cint V" << G__CINTVERSION << ")\n";
+               printversionmessage(std::cout);
                exit(0);
        }
        if (option=="--help") {
-               std::cout << "GiNaC-cint (" << PACKAGE << " V" << VERSION
-                         << ", Cint V" << G__CINTVERSION << ")\n";
+               printversionmessage(std::cout);
                std::cout << "usage: ginaccint [option] [file ...]\n";
                std::cout << " --help           print this help message and exit\n"
                          << " --silent         invoke ginaccint in silent mode\n"