Skip to content
Snippets Groups Projects
Commit fadec6d1 authored by dmitriy.gerasimov's avatar dmitriy.gerasimov
Browse files

[+] Global config variable

[+] int128_t and uint128_t
parent ecb057b2
No related branches found
No related tags found
No related merge requests found
......@@ -9,6 +9,8 @@
#define LOG_TAG "dap_config"
dap_config_t * g_config = NULL;
/**
* @brief The dap_config_item struct
*/
......@@ -336,6 +338,18 @@ int32_t dap_config_get_item_int32(dap_config_t * a_config, const char * a_sectio
return atoi(dap_config_get_item_str(a_config,a_section_path,a_item_name));
}
/**
* @brief dap_config_get_item_int64
* @param a_config
* @param a_section_path
* @param a_item_name
* @return
*/
int64_t dap_config_get_item_int64(dap_config_t * a_config, const char * a_section_path, const char * a_item_name)
{
return atoll(dap_config_get_item_str(a_config,a_section_path,a_item_name));
}
/**
* @brief dap_config_get_item_uint16
* @param a_config
......@@ -377,6 +391,20 @@ uint16_t dap_config_get_item_uint16_default(dap_config_t * a_config, const char
return l_str_ret? (uint16_t) atoi(l_str_ret):a_default;
}
/**
* @brief dap_config_get_item_int64_default
* @param a_config
* @param a_section_path
* @param a_item_name
* @param a_default
* @return
*/
int64_t dap_config_get_item_int64_default(dap_config_t * a_config, const char * a_section_path, const char * a_item_name, int64_t a_default)
{
const char * l_str_ret = dap_config_get_item_str(a_config,a_section_path,a_item_name);
return l_str_ret? (int64_t) atoll(l_str_ret):a_default;
}
/**
* @brief dap_config_get_item Get the configuration as a item
......
......@@ -50,6 +50,10 @@ uint16_t dap_config_get_item_uint16_default(dap_config_t * a_config, const char
int32_t dap_config_get_item_int32(dap_config_t * a_config, const char * a_section_path, const char * a_item_name);
int32_t dap_config_get_item_int32_default(dap_config_t * a_config, const char * a_section_path, const char * a_item_name, int32_t a_default);
int64_t dap_config_get_item_int64(dap_config_t * a_config, const char * a_section_path, const char * a_item_name);
int64_t dap_config_get_item_int64_default(dap_config_t * a_config, const char * a_section_path, const char * a_item_name, int64_t a_default);
const char * dap_config_get_item_str(dap_config_t * a_config, const char * a_section_path, const char * a_item_name);
const char * dap_config_get_item_str_default(dap_config_t * a_config, const char * a_section_path, const char * a_item_name, const char * a_value_default);
char** dap_config_get_array_str(dap_config_t * a_config, const char * a_section_path,
......@@ -61,6 +65,9 @@ bool dap_config_get_item_bool_default(dap_config_t * a_config, const char * a_se
double dap_config_get_item_double(dap_config_t * a_config, const char * a_section_path, const char * a_item_name);
double dap_config_get_item_double_default(dap_config_t * a_config, const char * a_section_path, const char * a_item_name, double a_default);
extern dap_config_t * g_config;
#ifdef __cplusplus
}
#endif
......
......@@ -9,6 +9,12 @@
#define DAP_GLOBAL_IS_INT128
typedef __int128 _dap_int128_t;
#if !defined (int128_t)
typedef __int128 int128_t;
#endif
#if !defined (uint128_t)
typedef unsigned __int128 uint128_t;
#endif
#endif
#endif
......
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