Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 531dc99b authored by David Parsons's avatar David Parsons
Browse files

get rid of global cmd-line option variables

# Conflicts:
#	src/aevol_create.cpp
parent 470640be
No related branches found
No related tags found
No related merge requests found
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <list> #include <list>
#include <sstream> #include <sstream>
#include <string> #include <string>
#include <tuple>
#include "legacy/ExpManager.h" #include "legacy/ExpManager.h"
#include "aevol_version.h" #include "aevol_version.h"
...@@ -47,15 +48,11 @@ using namespace aevol; ...@@ -47,15 +48,11 @@ using namespace aevol;
// Helper functions // Helper functions
void print_help(char* prog_path); void print_help(char* prog_path);
void interpret_cmd_line_options(int argc, char* argv[]); std::tuple<std::string, std::string> interpret_cmd_line_options(int argc, char* argv[]);
std::list<std::string> read_sequence_file(const std::string& chromosome_file_name); std::list<std::string> read_sequence_file(const std::string& chromosome_file_name);
// Command-line option variables
static std::string param_file_name;
static std::string chromosome_file_name;
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
interpret_cmd_line_options(argc, argv); const auto [param_file_name, chromosome_file_name] = interpret_cmd_line_options(argc, argv);
// Print the hash and date of the commit used to compile this executable // Print the hash and date of the commit used to compile this executable
printf("Running aevol version %s\n", version_string); printf("Running aevol version %s\n", version_string);
...@@ -124,7 +121,11 @@ void print_help(char* prog_path) { ...@@ -124,7 +121,11 @@ void print_help(char* prog_path) {
printf("\tload chromosome from given text file instead of generating it\n"); printf("\tload chromosome from given text file instead of generating it\n");
} }
void interpret_cmd_line_options(int argc, char* argv[]) { std::tuple<std::string, std::string> interpret_cmd_line_options(int argc, char* argv[]) {
// Command-line option variables
std::string param_file_name;
std::string chromosome_file_name;
// Define allowed options // Define allowed options
const char* options_list = "hVf:C:r:"; const char* options_list = "hVf:C:r:";
static struct option long_options_list[] = { static struct option long_options_list[] = {
...@@ -168,6 +169,8 @@ void interpret_cmd_line_options(int argc, char* argv[]) { ...@@ -168,6 +169,8 @@ void interpret_cmd_line_options(int argc, char* argv[]) {
if (param_file_name.length() == 0) { if (param_file_name.length() == 0) {
param_file_name = DEFAULT_PARAM_FILE_NAME; param_file_name = DEFAULT_PARAM_FILE_NAME;
} }
return std::make_tuple(param_file_name, chromosome_file_name);
} }
auto read_sequence(std::ifstream& chromosome_file, const std::string& chromosome_file_name) { auto read_sequence(std::ifstream& chromosome_file, const std::string& chromosome_file_name) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment