X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Flanguage%2Fstats%2Fflip.c;h=283a2266a4568a5c57a8fe2354620cf51d51bf31;hb=9f93ff4fb4b1836b6ead55d84476fbd39530764c;hp=487417bab149c682fb16c2047d3d416da50e9ffd;hpb=11210e8190261d1ab630b1a56f6c0a44a5e82419;p=pspp
diff --git a/src/language/stats/flip.c b/src/language/stats/flip.c
index 487417bab1..283a2266a4 100644
--- a/src/language/stats/flip.c
+++ b/src/language/stats/flip.c
@@ -14,7 +14,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
-#include "config.h"
+#include
#include
#include
@@ -22,29 +22,30 @@
#include
#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include "intprops.h"
-#include "minmax.h"
-#include "xalloc.h"
+#include "data/case.h"
+#include "data/casereader.h"
+#include "data/casereader-provider.h"
+#include "data/dataset.h"
+#include "data/dictionary.h"
+#include "data/settings.h"
+#include "data/short-names.h"
+#include "data/value.h"
+#include "data/variable.h"
+#include "language/command.h"
+#include "language/lexer/lexer.h"
+#include "language/lexer/variable-parser.h"
+#include "libpspp/array.h"
+#include "libpspp/assertion.h"
+#include "libpspp/message.h"
+#include "libpspp/misc.h"
+#include "libpspp/pool.h"
+#include "libpspp/str.h"
+#include "data/data-in.h"
+#include "data/data-out.h"
+
+#include "gl/intprops.h"
+#include "gl/minmax.h"
+#include "gl/xalloc.h"
#include "gettext.h"
#define _(msgid) gettext (msgid)
@@ -157,7 +158,7 @@ cmd_flip (struct lexer *lexer, struct dataset *ds)
var_names_add (flip->pool, &flip->old_names,
pool_strdup (flip->pool, var_get_name (vars[i])));
- /* Read the active file into a flip_sink. */
+ /* Read the active dataset into a flip_sink. */
proc_discard_output (ds);
input = proc_open (ds);
@@ -197,7 +198,7 @@ cmd_flip (struct lexer *lexer, struct dataset *ds)
/* Flip the data we read. */
if (!ok || !flip_file (flip))
{
- proc_discard_active_file (ds);
+ dataset_clear (ds);
goto error;
}
@@ -218,8 +219,8 @@ cmd_flip (struct lexer *lexer, struct dataset *ds)
reader = casereader_create_sequential (NULL, dict_get_proto (dict),
flip->n_vars,
&flip_casereader_class, flip);
- proc_set_active_file_data (ds, reader);
- return lex_end_of_command (lexer);
+ dataset_set_source (ds, reader);
+ return CMD_SUCCESS;
error:
destroy_flip_pgm (flip);
@@ -248,7 +249,7 @@ make_new_var (struct dictionary *dict, const char *name_)
*--cp = '\0';
/* Fix invalid characters. */
- for (cp = name; *cp && cp < name + VAR_NAME_LEN; cp++)
+ for (cp = name; *cp && cp < name + ID_MAX_LEN; cp++)
if (cp == name)
{
if (!lex_is_id1 (*cp) || *cp == '$')
@@ -269,8 +270,8 @@ make_new_var (struct dictionary *dict, const char *name_)
int i;
for (i = 1; ; i++)
{
- char n[VAR_NAME_LEN + 1];
- int ofs = MIN (VAR_NAME_LEN - 1 - intlog10 (i), len);
+ char n[ID_MAX_LEN + 1];
+ int ofs = MIN (ID_MAX_LEN - 1 - intlog10 (i), len);
strncpy (n, name, ofs);
sprintf (&n[ofs], "%d", i);