void test_current_module_options() { analysis_config_type * ac = create_analysis_config( ); test_assert_NULL( analysis_config_get_active_module( ac )); analysis_config_load_internal_module(ac , "STD_ENKF" , "std_enkf_symbol_table"); test_assert_false( analysis_config_get_module_option( ac , ANALYSIS_SCALE_DATA)); test_assert_true(analysis_config_select_module(ac , "STD_ENKF")); test_assert_false( analysis_config_select_module(ac , "DOES_NOT_EXIST")); test_assert_true( analysis_module_is_instance( analysis_config_get_active_module( ac ))); test_assert_true( analysis_config_get_module_option( ac , ANALYSIS_SCALE_DATA)); test_assert_false( analysis_config_get_module_option( ac , ANALYSIS_ITERABLE)); analysis_config_free( ac ); }
static void enkf_tui_analysis_update_title( enkf_main_type * enkf_main , menu_type * menu ) { const analysis_config_type * analysis_config = enkf_main_get_analysis_config( enkf_main ); analysis_module_type * analysis_module = analysis_config_get_active_module( analysis_config ); char * title = util_alloc_sprintf("Analysis menu [Current module:%s]" , analysis_module_get_name( analysis_module )); menu_set_title( menu , title ); free( title ); }
void enkf_tui_analysis_update_module__(void * arg) { enkf_main_type * enkf_main = enkf_main_safe_cast( arg ); int prompt_len = 50; { const analysis_config_type * analysis_config = enkf_main_get_analysis_config( enkf_main ); analysis_module_type * analysis_module = analysis_config_get_active_module( analysis_config ); char var_name[256]; char value[256]; util_printf_prompt("Variable to modify" , prompt_len , '=' , "=> "); scanf("%s", var_name); { char * value_prompt = util_alloc_sprintf("New value for %s" , var_name); util_printf_prompt(value_prompt , prompt_len , '=' , "=> "); free( value_prompt ); } scanf("%s", value); if (analysis_module_set_var( analysis_module , var_name , value)) printf("\'%s\' successfully set to \'%s\' \n",var_name , value); else printf("** Variable/type combination: %s/%s not recognized \n", var_name , value); } }