Commit 5cdadc2356f23af2cbff4a3e49ab18f5bd6685f6

Authored by Arnaud Blanchard
1 parent e36ceac0

Use keyboard to select part of a file. Not yet working.

... ... @@ -18,7 +18,7 @@ find_package(blc_program REQUIRED)
add_definitions(${BL_DEFINITIONS})
include_directories(${BL_INCLUDE_DIRS})
add_executable(i_keyboard src/main.cpp)
add_executable(i_keyboard src/i_keyboard.cpp)
target_link_libraries(i_keyboard ${BL_LIBRARIES})
... ...
... ... @@ -222,11 +222,12 @@ static void loop_float(){
int main(int argc, char** argv){
char *default_output=NULL;
char const *extension;
char const *channel_name, *type_str, *str_quitting_key, *str_neutral_key, *max_str, *min_str, *str_neutral_value, *toggle_mode, *step_size_str, *filename;
char const *channel_name, *type_str, *str_quitting_key, *str_neutral_key, *max_str, *min_str, *str_neutral_value, *toggle_mode, *step_size_str, *filename, *file_select_name;
char const *key_nb_str;
int i;
char *pos;
uchar answer;
blc_array array_select;
asprintf(&default_output, "/%s%d", basename(argv[0]), getpid()); //This will not be free but it is only allocate once
blc_program_set_description("Get keyboard inputs");
... ... @@ -239,6 +240,7 @@ int main(int argc, char** argv){
blc_program_add_option(&str_quitting_key, 'q', "quitting_key", "string", "Define the key used to quit", "q");
blc_program_add_option(&key_nb_str, 's', "size", "integer", "Size of key vector", NULL);
blc_program_add_option(&type_str, 't', "type", "UIN8|FL32", "Define the type of the result", "UIN8");
blc_program_add_option(&file_select_name, 'F', "select", "filename", "File among which vlues will be selected", NULL);
blc_program_add_option(&max_str, 'M', "max", "real", "Define the normed max value", "1.0");
blc_program_add_option(&str_neutral_value, 'N', "neutral_value", "real", "Define the normed neutral value", "0.5");
blc_program_add_option(&step_size_str, 'S', "step", "real", "Set the normed step size", NULL);
... ... @@ -293,11 +295,20 @@ int main(int argc, char** argv){
case 'FL32':
FOR(i, keys_nb) channel.floats[i]=neutral_value;
break;
default:EXIT_ON_ARRAY_ERROR(&channel, "Type not mnaged");
default:EXIT_ON_ARRAY_ERROR(&channel, "Type not managed");
break;
}
}
if (file_select_name){
extension = blc_get_filename_extension(file_select_name);
if (strcmp(extension, "tsv")!=0) EXIT_ON_ERROR("Only .tsv files are managed, however your extension is '%s' in '%s'.", extension, file_select_name);
// array_select.updatewith_tsv_file
// SYSTEM_ERROR_CHECK(file_select=fopen(file_select_name, "r"), NULL, "Impossible to open '%s'", file_select_name);
}
if (display){
if ((channel.type!='UIN8') && (channel.type!='FL32')) EXIT_ON_ARRAY_ERROR(&channel, "This type can not be displayed. Only 'UIN8' or 'FL32' can.");
}
... ...