X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=tools%2Fctsimtext.cpp;h=af29a13f01ff1575b0070e214cbe2b8a619b1761;hb=cb88bca6d3cd7c1bf25c84c4f66e17f978c50f70;hp=6983cb0fe6e1614017cffa53c66412509fc56671;hpb=c70eb596eeeeda21f872065d9e11a67996394626;p=ctsim.git diff --git a/tools/ctsimtext.cpp b/tools/ctsimtext.cpp index 6983cb0..af29a13 100644 --- a/tools/ctsimtext.cpp +++ b/tools/ctsimtext.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: ctsimtext.cpp,v 1.9 2001/01/13 03:51:35 kevin Exp $ +** $Id: ctsimtext.cpp,v 1.16 2001/01/16 23:48:45 kevin Exp $ ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License (version 2) as @@ -45,8 +45,9 @@ extern "C" { // If linked to ctsimtext, but executed as another name, eg pjrec, then program will use that // linked name as name of function. -static const char* const g_szIdStr = "$Id: ctsimtext.cpp,v 1.9 2001/01/13 03:51:35 kevin Exp $"; +static const char* const g_szIdStr = "$Id: ctsimtext.cpp,v 1.16 2001/01/16 23:48:45 kevin Exp $"; static const char* const s_szProgramName = "ctsimtext"; +static const char* const s_szProgramName2 = "ctsimtext.exe"; extern int if1_main (int argc, char* const argv[]); extern int if2_main (int argc, char* const argv[]); @@ -103,8 +104,8 @@ ctsimtext_main (int argc, char * argv[]) { int iReturn = 0; - if (argc > 1 && strcmp(argv[0], fileBasename (s_szProgramName)) == 0) { - argv = &argv[1]; + if (argc > 1 && (strcmp(s_szProgramName, fileBasename (argv[0])) == 0 || strcmp(s_szProgramName2, fileBasename (argv[0])) == 0)) { + argv++; argc--; iReturn = processCommand (argc, argv); } else if (argc > 1){ @@ -128,7 +129,7 @@ ctsimtext_main (int argc, char * argv[]) char* pszInputLine = new char [s_MaxLineLength+1]; std::cout << szPrompt; std::cin.getline (pszInputLine, s_MaxLineLength); - + #ifdef DEBUG std::cout << "#" << pszInputLine << "#\n"; #endif @@ -146,12 +147,11 @@ ctsimtext_main (int argc, char * argv[]) std::cout << "Token " << i << ": " << argv[i] << "\n"; #endif iReturn = processCommand (argc, argv); - + delete pszInputLine; } } - return iReturn; } @@ -225,35 +225,43 @@ processCommand (int argc, char* const argv[]) { if (argc < 1) return 1; - + const char* const pszFunction = fileBasename (argv[0]); - if (strcasecmp (pszFunction, "if1") == 0) - return if1_main (argc, argv); - else if (strcasecmp (pszFunction, "if2") == 0) - return if2_main (argc, argv); - else if (strcasecmp (pszFunction, "ifexport") == 0) - return ifexport_main (argc, argv); - else if (strcasecmp (pszFunction, "ifinfo") == 0) - return ifinfo_main (argc, argv); - else if (strcasecmp (pszFunction, "phm2if") == 0) - return phm2if_main (argc, argv); - else if (strcasecmp (pszFunction, "phm2pj") == 0) - return phm2pj_main (argc, argv); - else if (strcasecmp (pszFunction, "pj2if") == 0) - return pj2if_main (argc, argv); - else if (strcasecmp (pszFunction, "pjinfo") == 0) - return pjinfo_main (argc, argv); - else if (strcasecmp (pszFunction, "pjrec") == 0) - return pjrec_main (argc, argv); - else { - std::cout << "Unknown function name: " << pszFunction << "\n"; - if (s_bInteractive) - interactive_usage(); - else - ctsimtext_usage (s_szProgramName); - return 1; - } + try { + if (strcasecmp (pszFunction, "if1") == 0) + return if1_main (argc, argv); + else if (strcasecmp (pszFunction, "if2") == 0) + return if2_main (argc, argv); + else if (strcasecmp (pszFunction, "ifexport") == 0) + return ifexport_main (argc, argv); + else if (strcasecmp (pszFunction, "ifinfo") == 0) + return ifinfo_main (argc, argv); + else if (strcasecmp (pszFunction, "phm2if") == 0) + return phm2if_main (argc, argv); + else if (strcasecmp (pszFunction, "phm2pj") == 0) + return phm2pj_main (argc, argv); + else if (strcasecmp (pszFunction, "pj2if") == 0) + return pj2if_main (argc, argv); + else if (strcasecmp (pszFunction, "pjinfo") == 0) + return pjinfo_main (argc, argv); + else if (strcasecmp (pszFunction, "pjrec") == 0) + return pjrec_main (argc, argv); + else { + std::cout << "Unknown function name: " << pszFunction << "\n"; + if (s_bInteractive) + interactive_usage(); + else + ctsimtext_usage (s_szProgramName); + return 1; + } + } catch (exception e) { + std::cerr << "Exception: " << e.what() << std::endl; + } catch (...) { + std::cerr << "Unknown exception caught\n"; + } + + return 1; } int @@ -261,31 +269,8 @@ main (int argc, char* argv[]) { int retval = 1; - try { - retval = ctsimtext_main(argc, argv); - } catch (exception e) { - std::cerr << "Exception: " << e.what() << std::endl; - } catch (...) { - std::cerr << "Unknown exception\n"; - } + retval = ctsimtext_main(argc, argv); - return (retval); + return retval; } - -// Hack to fix linking problems when not linking with wxWindows and CTSim GUI routines - -#ifdef HAVE_WXWINDOWS -#include "../src/dlgezplot.h" - -EZPlotDialog::EZPlotDialog (wxWindow* parent) -{} - -EZPlotDialog::~EZPlotDialog() -{} - -unsigned long -wxDialog::OnCtlColor(unsigned long a,unsigned long b,unsigned int c,unsigned int d,unsigned int e,long f) -{return 0;} - -#endif \ No newline at end of file