For compatibility.
Reported by Charles Johnson.
PSPP NEWS -- history of user-visible changes.
-Copyright (C) 1996-2000, 2008-2015 Free Software Foundation, Inc.
+Copyright (C) 1996-2000, 2008-2016 Free Software Foundation, Inc.
See the end for copying conditions.
Please send PSPP bug reports to bug-gnu-pspp@gnu.org.
- Rendering of the variable and data sheets in right-to-left locales
now works properly.
+ * The IMPORTCASES subcommand on GET DATA is now ignored, for
+ compatibility.
+
Changes from 0.8.4 to 0.8.5:
* The FREQUENCIES and CROSSTABS commands can now generate barcharts.
[ENCODING='@var{encoding}']
[/ARRANGEMENT=@{DELIMITED,FIXED@}]
[/FIRSTCASE=@{@var{first_case}@}]
- [/IMPORTCASE=@{ALL,FIRST @var{max_cases},PERCENT @var{percent}@}]
+ [/IMPORTCASES=...]
@dots{}additional subcommands depending on ARRANGEMENT@dots{}
@end display
to the number of the first line to read: 2 to skip the first line, 3
to skip the first two lines, and so on.
-@subcmd{IMPORTCASE} can be used to limit the number of cases read from the
-input file. With the default setting, ALL, all cases in the file are
-read. Specify FIRST @var{max_cases} to read at most @var{max_cases} cases
-from the file. Use @subcmd{PERCENT @var{percent}} to read only @var{percent}
-percent, approximately, of the cases contained in the file. (The
-percentage is approximate, because there is no way to accurately count
-the number of cases in the file without reading the entire file. The
-number of cases in some kinds of unusual files cannot be estimated;
-@pspp{} will read all cases in such files.)
-
-@subcmd{FIRSTCASE} and @subcmd{IMPORTCASE} may be used with delimited and fixed-format
-data. The remaining subcommands, which apply only to one of the two file
-arrangements, are described below.
+@subcmd{IMPORTCASES} is ignored, for compatibility. Use @cmd{N OF
+CASES} to limit the number of cases read from a file (@pxref{N OF
+CASES}), or @cmd{SAMPLE} to obtain a random sample of cases
+(@pxref{SAMPLE}).
+
+The remaining subcommands apply only to one of the two file
+arrangements, described below.
@menu
* GET DATA /TYPE=TXT /ARRANGEMENT=DELIMITED::
/* PSPP - a program for statistical analysis.
- Copyright (C) 2007, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009, 2010, 2011, 2012, 2013, 2016 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
const struct dictionary *dict; /*Dictionary of destination */
enum data_parser_type type; /* Type of data to parse. */
int skip_records; /* Records to skip before first real data. */
- casenumber max_cases; /* Max number of cases to read. */
- int percent_cases; /* Approximate percent of cases to read. */
struct field *fields; /* Fields to parse. */
size_t field_cnt; /* Number of fields. */
parser->type = DP_FIXED;
parser->skip_records = 0;
- parser->max_cases = -1;
- parser->percent_cases = 100;
parser->fields = NULL;
parser->field_cnt = 0;
parser->skip_records = initial_records_to_skip;
}
-/* Sets the maximum number of cases parsed by PARSER to
- MAX_CASES. The default is -1, meaning no limit. */
-void
-data_parser_set_case_limit (struct data_parser *parser, casenumber max_cases)
-{
- parser->max_cases = max_cases;
-}
-
-/* Sets the percentage of cases that PARSER should read from the
- input file to PERCENT_CASES. By default, all cases are
- read. */
-void
-data_parser_set_case_percent (struct data_parser *parser, int percent_cases)
-{
- assert (percent_cases >= 0 && percent_cases <= 100);
- parser->percent_cases = percent_cases;
-}
-
/* Returns true if PARSER is configured to allow cases to span
multiple records. */
bool
}
/* Limit cases. */
- if (parser->max_cases != -1 && parser->max_cases-- == 0)
- return false;
- if (parser->percent_cases < 100
- && dfm_get_percent_read (reader) >= parser->percent_cases)
- return false;
-
if (parser->type == DP_DELIMITED)
{
if (parser->span)
/* PSPP - a program for statistical analysis.
- Copyright (C) 2007, 2011 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2011, 2016 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
void data_parser_set_type (struct data_parser *, enum data_parser_type);
void data_parser_set_skip (struct data_parser *, int initial_records_to_skip);
-void data_parser_set_case_limit (struct data_parser *, casenumber max_cases);
-void data_parser_set_case_percent (struct data_parser *, int case_percent);
/* For configuring delimited parsers only. */
bool data_parser_get_span (const struct data_parser *);
/* PSPP - a program for statistical analysis.
- Copyright (C) 1997-2004, 2006, 2010, 2011, 2012 Free Software Foundation, Inc.
+ Copyright (C) 1997-2004, 2006, 2010, 2011, 2012, 2016 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 <stdint.h>
#include <stdio.h>
#include <stdlib.h>
-#include <sys/stat.h>
#include "data/casereader.h"
#include "data/dataset.h"
struct string scratch; /* Extra line buffer. */
enum dfm_reader_flags flags; /* Zero or more of DFM_*. */
FILE *file; /* Associated file. */
- off_t file_size; /* File size, or -1 if unavailable. */
size_t pos; /* Offset in line of current character. */
unsigned eof_cnt; /* # of attempts to advance past EOF. */
struct lexer *lexer; /* The lexer reading the file */
r->block_left = 0;
if (fh_get_referent (fh) != FH_REF_INLINE)
{
- struct stat s;
r->line_number = 0;
r->file = fn_open (fh, "rb");
if (r->file == NULL)
fh_get_file_name (r->fh), strerror (errno));
goto error;
}
- r->file_size = fstat (fileno (r->file), &s) == 0 ? s.st_size : -1;
}
- else
- r->file_size = -1;
fh_lock_set_aux (lock, r);
if (encoding == NULL)
return reader->encoding;
}
-/* Returns a number between 0 and 100 that approximates the
- percentage of the data in READER that has already been read,
- or -1 if this value cannot be estimated.
-
- ftello is slow in glibc (it flushes the read buffer), so don't
- call this function unless you need to. */
-int
-dfm_get_percent_read (const struct dfm_reader *reader)
-{
- if (reader->file_size >= 0)
- {
- off_t position;
-
- position = (reader->line_reader != NULL
- ? line_reader_tell (reader->line_reader)
- : ftello (reader->file));
- if (position >= 0)
- {
- double p = 100.0 * position / reader->file_size;
- return p < 0 ? 0 : p > 100 ? 100 : p;
- }
- }
- return -1;
-}
-
/* Causes dfm_get_record() or dfm_get_whole_record() to read in
the next record the next time it is executed on file
HANDLE. */
/* PSPP - a program for statistical analysis.
- Copyright (C) 1997-9, 2000, 2010, 2011, 2012 Free Software Foundation, Inc.
+ Copyright (C) 1997-9, 2000, 2010, 2011, 2012, 2016 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
struct substring dfm_get_record (struct dfm_reader *);
void dfm_expand_tabs (struct dfm_reader *);
const char *dfm_reader_get_encoding (const struct dfm_reader *);
-int dfm_get_percent_read (const struct dfm_reader *);
/* Line control. */
void dfm_forward_record (struct dfm_reader *);
/* PSPP - a program for statistical analysis.
Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012,
- 2013, 2015 Free Software Foundation, Inc.
+ 2013, 2015, 2016 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
lex_match (lexer, T_EQUALS);
if (lex_match (lexer, T_ALL))
{
- data_parser_set_case_limit (parser, -1);
- data_parser_set_case_percent (parser, 100);
+ /* Nothing to do. */
}
else if (lex_match_id (lexer, "FIRST"))
{
if (!lex_force_int (lexer))
goto error;
- if (lex_integer (lexer) < 1)
- {
- msg (SE, _("Value of %s must be 1 or greater."), "FIRST");
- goto error;
- }
- data_parser_set_case_limit (parser, lex_integer (lexer));
lex_get (lexer);
}
else if (lex_match_id (lexer, "PERCENT"))
{
if (!lex_force_int (lexer))
goto error;
- if (lex_integer (lexer) < 1 || lex_integer (lexer) > 100)
- {
- msg (SE, _("Value of %s must be between 1 and 100."), "PERCENT");
- goto error;
- }
- data_parser_set_case_percent (parser, lex_integer (lexer));
lex_get (lexer);
}
+ msg (SW, _("Ignoring obsolete IMPORTCASES subcommand. (N OF CASES "
+ "or SAMPLE may be used to substitute.)"));
}
else if (lex_match_id_n (lexer, "DELIMITERS", 4))
{
/* PSPPIRE - a graphical user interface for PSPP.
- Copyright (C) 2015 Free Software Foundation
+ Copyright (C) 2015, 2016 Free Software Foundation
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
intro_append_syntax (const PsppireImportAssistant *ia, struct string *s)
{
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ia->n_cases_button)))
- ds_put_format (s, " /IMPORTCASE=FIRST %d\n",
+ ds_put_format (s, "N OF CASES %d.\n",
gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (ia->n_cases_spin)));
else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ia->percent_button)))
- ds_put_format (s, " /IMPORTCASE=PERCENT %d\n",
- gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (ia->percent_spin)));
- else
- ds_put_cstr (s, " /IMPORTCASE=ALL\n");
+ ds_put_format (s, "SAMPLE %.4g.\n",
+ gtk_spin_button_get_value (GTK_SPIN_BUTTON (ia->percent_spin)) / 100.0);
}
if (ia->encoding && strcmp (ia->encoding, "Auto"))
syntax_gen_pspp (&s, " /ENCODING=%sq\n", ia->encoding);
- intro_append_syntax (ia, &s);
-
-
ds_put_cstr (&s,
" /ARRANGEMENT=DELIMITED\n"
" /DELCASE=LINE\n");
formats_append_syntax (ia, &s);
apply_dict (ia->dict, &s);
+ intro_append_syntax (ia, &s);
}
else
{
])
AT_DATA([get-data.sps], [dnl
get data /type=txt /file='test.data' /importcase=first 10 /variables x f8.0.
-list.
-
get data /type=txt /file='test.data' /importcase=percent 1 /variables x f8.0.
-list.
-
get data /type=txt /file='test.data' /importcase=percent 35 /variables x f8.0.
-list.
-
get data /type=txt /file='test.data' /importcase=percent 95 /variables x f8.0.
-list.
-
get data /type=txt /file='test.data' /importcase=percent 100 /variables x f8.0.
-list.
])
-AT_CHECK([pspp -o pspp.csv get-data.sps])
-AT_CHECK([cat pspp.csv], [0], [dnl
-Table: Data List
-x
-1
-2
-3
-4
-5
-6
-7
-8
-9
-10
+AT_CHECK([pspp -O format=csv get-data.sps], [0], [dnl
+get-data.sps:1: warning: GET DATA: Ignoring obsolete IMPORTCASES subcommand. (N OF CASES or SAMPLE may be used to substitute.)
-Table: Data List
-x
-1
-2
+get-data.sps:2: warning: GET DATA: Ignoring obsolete IMPORTCASES subcommand. (N OF CASES or SAMPLE may be used to substitute.)
-Table: Data List
-x
-1
-2
-3
-4
-5
-6
-7
-8
-9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
-23
-24
-25
-26
-27
-28
-29
-30
-31
-32
-33
-34
-35
-36
+get-data.sps:3: warning: GET DATA: Ignoring obsolete IMPORTCASES subcommand. (N OF CASES or SAMPLE may be used to substitute.)
-Table: Data List
-x
-1
-2
-3
-4
-5
-6
-7
-8
-9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
-23
-24
-25
-26
-27
-28
-29
-30
-31
-32
-33
-34
-35
-36
-37
-38
-39
-40
-41
-42
-43
-44
-45
-46
-47
-48
-49
-50
-51
-52
-53
-54
-55
-56
-57
-58
-59
-60
-61
-62
-63
-64
-65
-66
-67
-68
-69
-70
-71
-72
-73
-74
-75
-76
-77
-78
-79
-80
-81
-82
-83
-84
-85
-86
-87
-88
-89
-90
-91
-92
-93
-94
-95
-96
+get-data.sps:4: warning: GET DATA: Ignoring obsolete IMPORTCASES subcommand. (N OF CASES or SAMPLE may be used to substitute.)
-Table: Data List
-x
-1
-2
-3
-4
-5
-6
-7
-8
-9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
-23
-24
-25
-26
-27
-28
-29
-30
-31
-32
-33
-34
-35
-36
-37
-38
-39
-40
-41
-42
-43
-44
-45
-46
-47
-48
-49
-50
-51
-52
-53
-54
-55
-56
-57
-58
-59
-60
-61
-62
-63
-64
-65
-66
-67
-68
-69
-70
-71
-72
-73
-74
-75
-76
-77
-78
-79
-80
-81
-82
-83
-84
-85
-86
-87
-88
-89
-90
-91
-92
-93
-94
-95
-96
-97
-98
-99
-100
+get-data.sps:5: warning: GET DATA: Ignoring obsolete IMPORTCASES subcommand. (N OF CASES or SAMPLE may be used to substitute.)
])
AT_CLEANUP