Changes in src/builder.cpp [99fcaf:0fb9f6]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/builder.cpp
r99fcaf r0fb9f6 53 53 54 54 #include <cstring> 55 #include <cstdlib> 55 56 56 57 #include "analysis_bonds.hpp" … … 1494 1495 */ 1495 1496 static int ParseCommandLineOptions(int argc, char **argv, MoleculeListClass *&molecules, periodentafel *&periode, 1496 config& configuration, char *&ConfigFileName, list<int> &ArgcList)1497 config& configuration, char *&ConfigFileName, set<int> &ArgcList) 1497 1498 { 1498 1499 Vector x,y,z,n; // coordinates for absolute point in cell volume … … 1525 1526 case 'H': 1526 1527 case '?': 1527 ArgcList. push_back(argptr-1);1528 ArgcList.insert(argptr-1); 1528 1529 return(1); 1529 1530 break; 1530 1531 case 'v': 1531 ArgcList.push_back(argptr-1); 1532 return(1); 1532 setVerbosity(atoi(argv[argptr])); 1533 ArgcList.insert(argptr-1); 1534 ArgcList.insert(argptr); 1535 argptr++; 1533 1536 break; 1534 1537 case 'V': 1535 ArgcList.push_back(argptr-1); 1536 ArgcList.push_back(argptr); 1537 argptr++; 1538 ArgcList.insert(argptr-1); 1539 return(1); 1538 1540 break; 1539 1541 case 'B': … … 2488 2490 ActionRegistry::purgeInstance(); 2489 2491 ActionHistory::purgeInstance(); 2492 Memory::getState(); 2490 2493 } 2491 2494 … … 2499 2502 char **Arguments = NULL; 2500 2503 int ArgcSize = 0; 2501 int ExitFlag = 0;2502 2504 bool ArgumentsCopied = false; 2503 2505 2506 // print version check whether arguments are present at all 2504 2507 cout << ESPACKVersion << endl; 2508 if (argc < 2) { 2509 cout << "Obtain help with " << argv[0] << " -h." << endl; 2510 cleanUp(); 2511 Memory::getState(); 2512 return(1); 2513 } 2514 2505 2515 2506 2516 setVerbosity(0); … … 2508 2518 ActionHistory::init(); 2509 2519 2520 // from this moment on, we need to be sure to deeinitialize in the correct order 2521 // this is handled by the cleanup function 2522 atexit(cleanUp); 2523 2510 2524 // Parse command line options and if present create respective UI 2511 2525 { 2512 list<int> ArgcList;2513 ArgcList. push_back(0); // push back program!2514 ArgcList. push_back(1); // push back config file name2526 set<int> ArgcList; 2527 ArgcList.insert(0); // push back program! 2528 ArgcList.insert(1); // push back config file name 2515 2529 char ConfigFileName[MAXSTRINGSIZE]; 2516 2530 // handle arguments by ParseCommandLineOptions() 2517 ExitFlag =ParseCommandLineOptions(argc,argv,World::getInstance().getMolecules(),World::getInstance().getPeriode(),*World::getInstance().getConfig(), (char *&)ConfigFileName, ArgcList);2531 ParseCommandLineOptions(argc,argv,World::getInstance().getMolecules(),World::getInstance().getPeriode(),*World::getInstance().getConfig(), (char *&)ConfigFileName, ArgcList); 2518 2532 // copy all remaining arguments to a new argv 2519 2533 Arguments = Malloc<char *>(ArgcList.size(), "main - **Arguments"); 2520 2534 cout << "The following arguments are handled by CommandLineParser: "; 2521 for ( list<int>::iterator ArgcRunner = ArgcList.begin(); ArgcRunner != ArgcList.end(); ++ArgcRunner) {2535 for (set<int>::iterator ArgcRunner = ArgcList.begin(); ArgcRunner != ArgcList.end(); ++ArgcRunner) { 2522 2536 Arguments[ArgcSize] = Malloc<char>(strlen(argv[*ArgcRunner])+2, "main - *Arguments[]"); 2523 2537 strcpy(Arguments[ArgcSize], argv[*ArgcRunner]); … … 2558 2572 } 2559 2573 2560 cleanUp(); 2561 Memory::getState(); 2562 return (ExitFlag == 1 ? 0 : ExitFlag); 2574 return (0); 2563 2575 } 2564 2576
Note:
See TracChangeset
for help on using the changeset viewer.