/* A pointer to the dictionary. Owned externally */
const struct dictionary *dict;
+
+ /* The scalar containing the dictionary */
+ SV *dict_sv;
};
OUTPUT:
RETVAL
+
+struct variable *
+pxs_get_var_by_name (dict, name)
+ struct dictionary *dict
+ const char *name
+INIT:
+ SV *errstr = get_sv("PSPP::errstr", TRUE);
+ sv_setpv (errstr, "");
+CODE:
+ struct variable *var = dict_lookup_var (dict, name);
+ if ( ! var )
+ sv_setpv (errstr, "No such variable.");
+ RETVAL = var;
+ OUTPUT:
+RETVAL
+
+
MODULE = PSPP PACKAGE = PSPP::Var
struct sysfile_info *
-pxs_create_sysfile (name, dict, opts_hr)
+pxs_create_sysfile (name, dict_ref, opts_hr)
char *name
- struct dictionary *dict
+ SV *dict_ref
SV *opts_hr
INIT:
+ SV *dict_sv = SvRV (dict_ref);
+ struct dictionary *dict = (void *) SvIV (dict_sv);
struct sfm_write_options opts;
if (!SvROK (opts_hr))
{
sfi->writer = sfm_open_writer (fh, dict, opts);
sfi->dict = dict;
sfi->opened = true;
+ sfi->dict_sv = dict_sv;
+ SvREFCNT_inc (sfi->dict_sv);
RETVAL = sfi;
OUTPUT:
struct sysfile_info *sfi
CODE:
sysfile_close (sfi);
+ SvREFCNT_dec (sfi->dict_sv);
free (sfi);
int
}
RETVAL = casewriter_write (sfi->writer, &c);
finish:
-// Case_destroy (&c);
+// case_destroy (&c);
free (vv);
OUTPUT:
RETVAL