m_option_type_double

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@11948 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
michael 2004-02-10 14:32:06 +00:00
parent fccc9cf57d
commit 2c82d5a1d8
2 changed files with 32 additions and 3 deletions

View File

@ -179,10 +179,10 @@ m_option_type_t m_option_type_int = {
// Float
#undef VAL
#define VAL(x) (*(float*)(x))
#define VAL(x) (*(double*)(x))
static int parse_float(m_option_t* opt,char *name, char *param, void* dst, int src) {
float tmp_float;
static int parse_double(m_option_t* opt,char *name, char *param, void* dst, int src) {
double tmp_float;
char* endptr;
src = 0;
@ -230,6 +230,33 @@ static int parse_float(m_option_t* opt,char *name, char *param, void* dst, int s
return 1;
}
static char* print_double(m_option_t* opt, void* val) {
opt = NULL;
return dup_printf("%f",VAL(val));
}
m_option_type_t m_option_type_double = {
"Double",
"double precission floating point number or ratio (numerator[:/]denominator)",
sizeof(double),
0,
parse_double,
print_double,
copy_opt,
copy_opt,
NULL,
NULL
};
#undef VAL
#define VAL(x) (*(float*)(x))
static int parse_float(m_option_t* opt,char *name, char *param, void* dst, int src) {
double tmp;
int r= parse_double(opt, name, param, &tmp, src);
if(r==1 && dst) VAL(dst) = tmp;
}
static char* print_float(m_option_t* opt, void* val) {
opt = NULL;
return dup_printf("%f",VAL(val));

View File

@ -11,6 +11,7 @@ struct m_struct_st;
extern m_option_type_t m_option_type_flag;
extern m_option_type_t m_option_type_int;
extern m_option_type_t m_option_type_float;
extern m_option_type_t m_option_type_double;
extern m_option_type_t m_option_type_string;
extern m_option_type_t m_option_type_string_list;
extern m_option_type_t m_option_type_position;
@ -78,6 +79,7 @@ extern m_obj_params_t m_span_params_def;
#define CONF_TYPE_FLAG (&m_option_type_flag)
#define CONF_TYPE_INT (&m_option_type_int)
#define CONF_TYPE_FLOAT (&m_option_type_float)
#define CONF_TYPE_DOUBLE (&m_option_type_double)
#define CONF_TYPE_STRING (&m_option_type_string)
#define CONF_TYPE_FUNC (&m_option_type_func)
#define CONF_TYPE_FUNC_PARAM (&m_option_type_func_param)