X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=perl-module%2FPSPP.xs;h=a66f4427299361e8aad47cc0e19df2342ccb9fdf;hb=f2aff95d14f40f128475cb39e47b7b3333ecc436;hp=143eb549e1a784c4df7b4c7b89fa644118f1056e;hpb=fd2104e10011b87d6558e8623d629da4cee82b25;p=pspp diff --git a/perl-module/PSPP.xs b/perl-module/PSPP.xs index 143eb549e1..a66f442729 100644 --- a/perl-module/PSPP.xs +++ b/perl-module/PSPP.xs @@ -1,5 +1,5 @@ /* PSPP - computes sample statistics. - Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. + Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 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 @@ -39,9 +39,12 @@ #include #include #include +#include #include #include #include +#include +#include #include #include #include @@ -180,7 +183,7 @@ CODE: i18n_init (); msg_set_handler (message_handler, NULL); - settings_init (0, 0); + settings_init (); fh_init (); SV * @@ -565,13 +568,12 @@ MODULE = PSPP PACKAGE = PSPP::Sysfile struct sysfile_info * -pxs_create_sysfile (name, dict_ref, opts_hr) +pxs_create_sysfile (name, dict, opts_hr) char *name - SV *dict_ref + struct dictionary *dict; SV *opts_hr INIT: - SV *dict_sv = SvRV (dict_ref); - struct dictionary *dict = (void *) SvIV (dict_sv); + SV *dict_sv = ST(1); struct sfm_write_options opts; if (!SvROK (opts_hr)) { @@ -706,7 +708,7 @@ CODE: fh_create_file (NULL, name, fh_default_properties () ); sri = xmalloc (sizeof (*sri)); - sri->reader = sfm_open_reader (fh, &sri->dict, &sri->opts); + sri->reader = sfm_open_reader (fh, NULL, &sri->dict, &sri->opts); if ( NULL == sri->reader) { @@ -727,6 +729,21 @@ CODE: OUTPUT: RETVAL +SV * +get_case_cnt (sfr) + struct sysreader_info *sfr; +CODE: + SV *ret; + casenumber n = casereader_get_case_cnt (sfr->reader); + if (n == CASENUMBER_MAX) + ret = &PL_sv_undef; + else + ret = newSViv (n); + RETVAL = ret; + OUTPUT: +RETVAL + + void get_next_case (sfr) @@ -734,7 +751,7 @@ get_next_case (sfr) PPCODE: struct ccase *c; - if (c = casereader_read (sfr->reader)) + if ((c = casereader_read (sfr->reader)) != NULL) { int v;