Variable handlers now take 4 arguments instead of 7, using the readstat_variable_t to wrap the values that were previously passed separately. New callback signature:
typedef int (*readstat_variable_handler)(int index, readstat_variable_t *variable,
You can access the previous values with new accessor functions:
const char *readstat_variable_get_name(readstat_variable_t *variable);
In the future I'd like to stuff the value labels into the variable argument, and eliminate the value labels handler altogether, but this is not implemented.
The motivation here was adding support for missing value definitions. To access the definitions with SPSS files inside the variable handler, you can use:
int readstat_variable_get_missing_ranges_count(readstat_variable_t *variable);
"lo" and "hi" represent the lower and upper bounds of the missing range -- if lo == hi, then it's a single missing value rather than a contiguous range.
readstat_value_is_missing is now supplemented with two more functions to distinguish system-missing (e.g. NaN values) from values that are considered missing on account of the missing value definitions:
int readstat_value_is_system_missing(readstat_value_t value);
But you can continue to use readstat_value_is_missing, which is just an OR of those two functions.
The underlying representation of readstat_value_t is no longer a pointer to a primitive value; instead, it's a struct + union that includes missingness information as well as the value type. As an added convenience, readstat_double_value etc. will do appropriate casting from other numeric types. Your existing accessor code should continue to work, but you might be able to simplify it with the new automatic casting.
The text was updated successfully, but these errors were encountered: