#include "data/file-handle-def.h"
#include "data/file-name.h"
#include "data/format.h"
+#include "data/identifier.h"
#include "data/missing-values.h"
#include "data/mrset.h"
#include "data/short-names.h"
First, figure out the correct character encoding, because this determines
how the rest of the header data is to be interpreted. */
- dict = dict_create ();
- r->encoding = choose_encoding (r, extensions[EXT_INTEGER],
- extensions[EXT_ENCODING]);
- dict_set_encoding (dict, r->encoding);
+ dict = dict_create (choose_encoding (r, extensions[EXT_INTEGER],
+ extensions[EXT_ENCODING]));
+ r->encoding = dict_get_encoding (dict);
/* These records don't use variables at all. */
if (document != NULL)
rec->name, 8, r->pool);
name[strcspn (name, " ")] = '\0';
- if (!var_is_valid_name (name, false) || name[0] == '$' || name[0] == '#')
+ if (!dict_id_is_valid (dict, name, false)
+ || name[0] == '$' || name[0] == '#')
sys_error (r, rec->pos, _("Invalid variable name `%s'."), name);
if (rec->width < 0 || rec->width > 255)
utf8_label = recode_string_pool ("UTF-8", dict_encoding,
rec->label, -1, r->pool);
- var_set_label (var, utf8_label);
+ var_set_label (var, utf8_label, false);
}
/* Set missing values. */
ss_rtrim (&line, ss_cstr (" "));
line.string[line.length] = '\0';
- dict_add_document_line (dict, line.string);
+ dict_add_document_line (dict, line.string, false);
ss_dealloc (&line);
}
while (read_variable_to_value_pair (r, dict, text, &var, &long_name))
{
/* Validate long name. */
- if (!var_is_valid_name (long_name, false))
+ /* XXX need to reencode name to UTF-8 */
+ if (!dict_id_is_valid (dict, long_name, false))
{
sys_warn (r, record->pos,
_("Long variable mapping from %s to invalid "
m.category = msg_class_to_category (class);
m.severity = msg_class_to_severity (class);
- m.where.file_name = NULL;
- m.where.line_number = 0;
- m.where.first_column = 0;
- m.where.last_column = 0;
+ m.file_name = NULL;
+ m.first_line = 0;
+ m.last_line = 0;
+ m.first_column = 0;
+ m.last_column = 0;
m.text = ds_cstr (&text);
msg_emit (&m);