/* PSPP - a program for statistical analysis.
- Copyright (C) 2005, 2009, 2011, 2013 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2009, 2011-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include "data/variable.h"
#include "libpspp/assertion.h"
#include "libpspp/cast.h"
+#include "libpspp/pxd.h"
#include "libpspp/str.h"
/* Types of user-missing values.
assert (mv->width > 0);
return class & MV_USER && is_str_user_missing (mv, s);
}
+
+struct pxd_object *
+mv_save (const struct missing_values *mv, struct pxd *pxd)
+{
+ struct pxd_builder b;
+ int i;
+
+ pxd_builder_init (&b, pxd);
+
+ pxd_builder_put_u16 (&b, mv->width);
+ pxd_builder_put_u16 (&b, mv->type);
+ for (i = 0; i < 3; i++)
+ if (using_element (mv->type, i))
+ pxd_builder_put_value (&b, &mv->values[i], mv->width);
+
+ return pxd_builder_commit (&b);
+}
+
+void
+mv_load (struct missing_values *mv, struct pxd_object *object,
+ const struct pxd *pxd)
+{
+ struct pxd_parser p;
+ int i;
+
+ pxd_parser_init (&p, object, pxd);
+
+ mv->width = pxd_parser_get_u16 (&p);
+ mv->type = pxd_parser_get_u16 (&p);
+ for (i = 0; i < 3; i++)
+ if (using_element (mv->type, i))
+ pxd_parser_get_value (&p, &mv->values[i], mv->width);
+ else
+ value_init (&mv->values[i], mv->width);
+
+ pxd_parser_destroy (&p);
+}