diff --git a/pub/CHANGELOG b/pub/CHANGELOG index 5505bec6a4cc187ead68457a39675ddde4e0ff89..eb061f0e28b779f3278a664351bcde31476fb644 100644 --- a/pub/CHANGELOG +++ b/pub/CHANGELOG @@ -1,3 +1,9 @@ +Release 2.3.4d of 28jan17: + +- mpgi,mpgr now using NOlo::j2j for spectrum correspondence +- gnuplot-fifo now named gnuplot-<PID> which resolves failure of ctest -j<n> +- Exceptions in initialization of CFrida are catched, and line number is reported + Release 2.3.4c of 27jan17: - New function NOlo::j2j to prepare for better J:J matching in mpgi, mpgr, and elsewhere diff --git a/pub/lib/toplevel.cpp b/pub/lib/toplevel.cpp index 98ce612ee6d8eecfb1278cdc0ad35deb3d6558af..9b5d6ec27dbfe401ec601a4c6704ac6af24915da 100644 --- a/pub/lib/toplevel.cpp +++ b/pub/lib/toplevel.cpp @@ -125,24 +125,48 @@ void CFrida::execute_cmd(const string cmdline) CFrida::CFrida() { - // Initializations: - NReadln::initialize(); // command-line dialog (readline and history) - SPloWin::initialize(); // plot windows - gsl_set_error_handler(my_gsl_error_handler); - fbase_initialize(); - fassign_initialize(); - fstring_initialize(); - SGeniRegistry::initialize(); - SCvinRegistry::initialize(); - - if (std::atexit(atexit_handler)) { - cout << "BUG: atexit registration failed\n"; - exit(EXIT_FAILURE); + int line = 0; + try { + // Initializations: + NReadln::initialize(); // command-line dialog (readline and history) + line = 1; + SPloWin::initialize(); // plot windows + line = 2; + gsl_set_error_handler(my_gsl_error_handler); + line = 3; + fbase_initialize(); + line = 4; + fassign_initialize(); + line = 5; + fstring_initialize(); + line = 6; + SGeniRegistry::initialize(); + line = 7; + SCvinRegistry::initialize(); + line = 8; + if (std::atexit(atexit_handler)) { + cout << "BUG: atexit registration failed\n"; + exit(EXIT_FAILURE); + } + // time monitor: + line = 9; + clock_start = clock(); + clock_cmd_i = clock(); + time_cmd = 0; + } catch (string& ex) { + cout << "CFrida initialization failed in line " << line << "\n " << ex << "\n"; + exit(1); + } catch (const char* ex) { + cout << "CFrida initialization failed in line " << line << "\n " << ex << "\n"; + exit(1); + } catch (std::exception& ex) { + cout << "CFrida initialization failed in line " << line << "\n " << ex.what() << "\n"; + exit(1); + } catch (...) { + cout << "CFrida initialization failed in line " << line + << " with unforeseen exception type\n"; + exit(1); } - // time monitor: - clock_start = clock(); - clock_cmd_i = clock(); - time_cmd = 0; } @@ -197,6 +221,6 @@ void CFrida::execute_file(const string fnam) cout << "BUG: char* error in script " << fnam << ", line " << lineno << ":\n " << ex << "\n"; } catch (...) { - cout << "BUG: catched invalid exception\n"; + cout << "BUG: script " << fnam << " failed with unforeseen exception\n"; } } diff --git a/pub/plot/dualplot.cpp b/pub/plot/dualplot.cpp index a3fe542b9809422f082f680df3afb06c96daece4..7c1667947f870dc81e903cf85648859bf8d1fe2b 100644 --- a/pub/plot/dualplot.cpp +++ b/pub/plot/dualplot.cpp @@ -13,6 +13,8 @@ #include <fcntl.h> #include <iostream> #include <sys/stat.h> +#include <sys/types.h> +#include <unistd.h> #include "../trivia/file_ops.hpp" #include "../trivia/string_convs.hpp" @@ -43,7 +45,7 @@ CPlot::CPlot(int _iPlot, bool _logx, bool _logy) // == Initialization for Gnuplot == // Create a named pipe (FIFO) that will transmit our commands to Gnuplot. - string fn_fifo = string("/tmp/gnuplot-") + getenv("LOGNAME"); + string fn_fifo = "/tmp/gnuplot-" + S(getpid()); triv::system("rm -f " + fn_fifo); if (mkfifo(fn_fifo.c_str(), 0666)) throw "SYSTEM ERROR cannot make fifo " + fn_fifo + ": will not be able to print";