create_user_data_type_c
status.i4.v = create_user_data_type_c(user_data_id.i4.r,
data_length.i4.v,
min_field_width.i4.v,
to_ascii_func.f.v,
to_ascii_data.g.v,
to_numeric_func.f.v,
to_numeric_data.g.v,
input_func.f.v,
input_func_data.g.v
[,values_func.f.v]
[,values_data.g.v])
This routine registers a user defined data type which can be
accessed by future calls to data conversion or input routines.
user_data_id returned user defined data type ID
data_length length of data type in bytes
min_field_width minimum number of characters necessary to display
the ASCII representation of a value of this type
to_ascii_func function which will convert internal data of this
type into its ASCII representation when called
as follows:
status.i4.v = to_ascii_func(value.g.v, num_chars.i4.v,
ascii_buffer.i1a.r,
to_ascii_data.g.v,
fill_char.i1.v)
(function typedef is to_ascii_function)
to_ascii_data data to be passed to ASCII conversion function
(A value of NULL can be passed for this argument
if it's not needed.)
to_numeric_func function which will convert ASCII data of this
type into its internal numeric representation when
called as follows:
status.i4.v = to_numeric_func(ascii_buffer.i1a.r,
num_chars.i4.v, value.g.v,
to_numeric_data.g.v)
(function typedef is to_numeric_function)
to_numeric_data data to be passed to numeric conversion function
(A value of NULL can be passed for this argument
if it's not needed.)
input_func function which will provide a user input dialog
for this data type when called as follows:
status.i4.v = input_func(window_id.i2.v, row.i4.v,
left_column.i4.v,
num_chars.i4.v, value.g.v,
input_func_data.g.v,
limit_type.i4.v,
minimum.g.v, maximum.g.v)
(function typedef is numeric_input_function)
(A value of NULL can be passed for this argument
if it's not needed. In this case, the ASCII
conversion function will be used by user input
routines.)
input_func_data data to be passed to user input dialog function
(A value of NULL can be passed for this argument
if it's not needed.)
[values_func] function which will return default, minimum,
and maximum values when called as follows:
values_func(default_value.g.v, minimum_value.g.v,
maximum_value.g.v, basic_type.i4.r,
options.u4.v, values_data.g.v)
(function typedef is numeric_values_function)
(A value of NULL can be passed for this argument
if it's not needed.) (default is NULL)
[values_data] data to be passed to the intrinsic values function
(A value of NULL can be passed for this argument
if it's not needed.) (default is NULL)
This function returns ACNET status values as follows:
CBS_OK success
CBS_MEMFAIL dynamic memory allocation failure
CBS_INVARG invalid argument
This function requires the following include files:
cnsparam_h, cns_data_structs_h, cbslib_h, acnet_errors_h
Related functions:
numeric_to_ascii(_c), ascii_to_numeric(_c), clib_sprintf,
clib_sprintfx, numeric_default_length_c, numeric_data_length_c,
numeric_fundamental_type_c, numeric_values_c, numeric_to_float_c,
window_display_value(_c), window_input_value(_c), winput(_c),
window_printf_c, window_printf_at_c, window_printf_noscroll_c,
set_enumerated_strings_c, set_enumerated_string_array_c,
set_logical_strings, enum_type_menu_info_c,
numeric_convert_type_id_c, numeric_convert_tuner_c
C/C++ usage:
int status;
int user_data_id;
int data_length = (int) sizeof(int);
int min_field_width = MY_FIELD_LENGTH;
void *to_ascii_data = (void *) NULL;
void *to_numeric_data = (void *) NULL;
void *input_func_data = (void *) NULL;
void *values_data = (void *) NULL;
int to_ascii_func(void *value, int num_chars, char *ascii_buffer,
void *to_ascii_data, char fill_char);
int to_numeric_func(char *ascii_buffer, int num_chars, void *value,
void *to_numeric_data);
int input_func(short window_id, int row, int left_column,
int num_chars, void *value, void *input_func_data,
int limit_type, void *minimum, void *maximum);
int values_func(void *default_value, void *minimum_value,
void *maximum_value, int *basic_type,
unsigned int options, void *values_data);
status = create_user_data_type_c(&user_data_id,data_length,
min_field_width,to_ascii_func,
to_ascii_data,to_numeric_func,
to_numeric_data,input_func,
input_func_data,values_func,
values_data);