Move PSPP shared libraries from $(libdir) to $(libdir)/pspp.
[pspp] / perl-module / PSPP.xs
index 143eb549e1a784c4df7b4c7b89fa644118f1056e..f6afa29b10098ee7614e8fa880cccaf1269b5097 100644 (file)
@@ -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
 #include <data/dictionary.h>
 #include <data/case.h>
 #include <data/casereader.h>
+#include <data/casewriter.h>
 #include <data/variable.h>
 #include <data/attributes.h>
 #include <data/file-handle-def.h>
+#include <data/identifier.h>
+#include <data/settings.h>
 #include <data/sys-file-writer.h>
 #include <data/sys-file-reader.h>
 #include <data/value.h>
@@ -180,7 +183,7 @@ CODE:
 
  i18n_init ();
  msg_set_handler (message_handler, NULL);
- settings_init (0, 0);
+ settings_init ();
  fh_init ();
 
 SV *
@@ -727,6 +730,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 +752,7 @@ get_next_case (sfr)
 PPCODE:
  struct ccase *c;
 
- if (c = casereader_read (sfr->reader))
+ if ((c = casereader_read (sfr->reader)) != NULL)
  {
   int v;