struct variable *var;
char *label
CODE:
- var_set_label (var, label, NULL, false);
+ var_set_label (var, label, false);
void
{
char label[256];
read_string (r, label);
- var_set_label (v, label, NULL, false); /* XXX */
+ var_set_label (v, label, false); /* XXX */
}
}
utf8_label = recode_string_pool ("UTF-8", dict_encoding,
rec->label, -1, r->pool);
- var_set_label (var, utf8_label, NULL, false);
+ var_set_label (var, utf8_label, false);
}
/* Set missing values. */
var_set_print_format (new_var, var_get_print_format (old_var));
var_set_write_format (new_var, var_get_write_format (old_var));
var_set_value_labels (new_var, var_get_value_labels (old_var));
- var_set_label (new_var, var_get_label (old_var), NULL, false);
+ var_set_label (new_var, var_get_label (old_var), false);
var_set_measure (new_var, var_get_measure (old_var));
var_set_display_width (new_var, var_get_display_width (old_var));
var_set_alignment (new_var, var_get_alignment (old_var));
empty string (after stripping white space), then V's variable label (if any)
is removed.
- Variable labels are limited to 255 bytes in the dictionary encoding, which
- should be specified as DICT_ENCODING. If LABEL fits within this limit, this
- function returns true. Otherwise, the variable label is set to a truncated
- value, this function returns false and, if ISSUE_WARNING is true, issues a
- warning. */
+ Variable labels are limited to 255 bytes in V's encoding (as returned by
+ var_get_encoding()). If LABEL fits within this limit, this function returns
+ true. Otherwise, the variable label is set to a truncated value, this
+ function returns false and, if ISSUE_WARNING is true, issues a warning. */
bool
-var_set_label (struct variable *v, const char *label,
- const char *dict_encoding, bool issue_warning)
+var_set_label (struct variable *v, const char *label, bool issue_warning)
{
bool truncated = false;
if (label != NULL)
{
+ const char *dict_encoding = var_get_encoding (v);
struct substring s = ss_cstr (label);
size_t trunc_len;
void
var_clear_label (struct variable *v)
{
- var_set_label (v, NULL, NULL, false);
+ var_set_label (v, NULL, false);
}
/* Returns true if V has a variable V,
/* Variable labels. */
const char *var_to_string (const struct variable *);
const char *var_get_label (const struct variable *);
-bool var_set_label (struct variable *, const char *label,
- const char *dict_encoding, bool issue_warning);
+bool var_set_label (struct variable *, const char *label, bool issue_warning);
void var_clear_label (struct variable *);
bool var_has_label (const struct variable *);
if (var_has_missing_values (dv) && !var_has_missing_values (mv))
var_set_missing_values (mv, var_get_missing_values (dv));
if (var_get_label (dv) && !var_get_label (mv))
- var_set_label (mv, var_get_label (dv), file_encoding, false);
+ var_set_label (mv, var_get_label (dv), false);
}
else
mv = dict_clone_var_assert (m, dv);
}
if (var_has_label (s))
- var_set_label (t, var_get_label (s),
- dict_get_encoding (dataset_dict (ds)), false);
+ var_set_label (t, var_get_label (s), false);
if (var_has_value_labels (s))
{
cmd_variable_labels (struct lexer *lexer, struct dataset *ds)
{
struct dictionary *dict = dataset_dict (ds);
- const char *dict_encoding = dict_get_encoding (dict);
do
{
}
for (i = 0; i < nv; i++)
- var_set_label (v[i], lex_tokcstr (lexer), dict_encoding, i == 0);
+ var_set_label (v[i], lex_tokcstr (lexer), i == 0);
lex_get (lexer);
while (lex_token (lexer) == T_SLASH)
free (dest[i]);
if (dest_label[i])
- var_set_label (destvar, dest_label[i],
- dict_get_encoding (agr->dict), true);
+ var_set_label (destvar, dest_label[i], true);
v->dest = destvar;
}
struct variable *dst_var;
dst_var = dict_create_var_assert (dataset_dict (ds), dv->z_name, 0);
- var_set_label (dst_var, xasprintf (_("Z-score of %s"),
- var_to_string (dv->v)),
- dict_get_encoding (dataset_dict (ds)), false);
+ var_set_label (dst_var,
+ xasprintf (_("Z-score of %s"),var_to_string (dv->v)),
+ false);
z = &t->z_scores[cnt++];
z->src_var = dv->v;
/* Create a label on DEST_VAR, describing its derivation from SRC_VAR and F */
static void
create_var_label (struct variable *dest_var,
- const struct variable *src_var, enum RANK_FUNC f,
- const char *dict_encoding)
+ const struct variable *src_var, enum RANK_FUNC f)
{
struct string label;
ds_init_empty (&label);
ds_put_format (&label, _("%s of %s"),
function_name[f], var_get_name (src_var));
- var_set_label (dest_var, ds_cstr (&label), dict_encoding, false);
+ var_set_label (dest_var, ds_cstr (&label), false);
ds_destroy (&label);
}
create_var_label ( rank_specs[i].destvars[v],
src_vars[v],
- rank_specs[i].rfunc,
- dict_get_encoding (dict));
+ rank_specs[i].rfunc);
}
}
break;
case PSPPIRE_VAR_STORE_COL_LABEL:
{
- var_set_label (pv, text,
- psppire_dict_encoding (var_store->dictionary), true);
+ var_set_label (pv, text, true);
return TRUE;
}
break;