projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add aux data parameter to q2c parse_<command>() and custom parser
[pspp]
/
src
/
language
/
stats
/
crosstabs.q
diff --git
a/src/language/stats/crosstabs.q
b/src/language/stats/crosstabs.q
index d6de30528a246881a75f02356d1fdaf1697154eb..23b12a9d8af184a3f18091725e33c2959fc9d250 100644
(file)
--- a/
src/language/stats/crosstabs.q
+++ b/
src/language/stats/crosstabs.q
@@
-30,29
+30,33
@@
*/
#include <config.h>
*/
#include <config.h>
-#include <libpspp/message.h>
+
#include <ctype.h>
#include <ctype.h>
+#include <gsl/gsl_cdf.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdio.h>
-#include <gsl/gsl_cdf.h>
-#include <libpspp/array.h>
-#include <libpspp/alloc.h>
+
#include <data/case.h>
#include <data/dictionary.h>
#include <data/case.h>
#include <data/dictionary.h>
-#include <libpspp/hash.h>
-#include <libpspp/pool.h>
+#include <data/procedure.h>
+#include <data/value-labels.h>
+#include <data/variable.h>
#include <language/command.h>
#include <language/command.h>
-#include <l
ibpspp/compiler
.h>
+#include <l
anguage/dictionary/split-file
.h>
#include <language/lexer/lexer.h>
#include <language/lexer/lexer.h>
-#include <libpspp/message.h>
+#include <language/lexer/variable-parser.h>
+#include <libpspp/alloc.h>
+#include <libpspp/array.h>
+#include <libpspp/compiler.h>
+#include <libpspp/hash.h>
#include <libpspp/magic.h>
#include <libpspp/magic.h>
+#include <libpspp/message.h>
+#include <libpspp/message.h>
#include <libpspp/misc.h>
#include <libpspp/misc.h>
-#include <
output/output
.h>
+#include <
libpspp/pool
.h>
#include <libpspp/str.h>
#include <libpspp/str.h>
+#include <output/output.h>
#include <output/table.h>
#include <output/table.h>
-#include <data/value-labels.h>
-#include <data/variable.h>
-#include <procedure.h>
#include "gettext.h"
#define _(msgid) gettext (msgid)
#include "gettext.h"
#define _(msgid) gettext (msgid)
@@
-60,8
+64,6
@@
/* (headers) */
/* (headers) */
-#include <libpspp/debug-print.h>
-
/* (specification)
crosstabs (crs_):
*^tables=custom;
/* (specification)
crosstabs (crs_):
*^tables=custom;
@@
-173,9
+175,9
@@
static struct pool *pl_tc; /* For table cells. */
static struct pool *pl_col; /* For column data. */
static int internal_cmd_crosstabs (void);
static struct pool *pl_col; /* For column data. */
static int internal_cmd_crosstabs (void);
-static void precalc (void *);
-static bool calc_general (struct ccase *, void *);
-static bool calc_integer (struct ccase *, void *);
+static void precalc (
const struct ccase *,
void *);
+static bool calc_general (
const
struct ccase *, void *);
+static bool calc_integer (
const
struct ccase *, void *);
static void postcalc (void *);
static void submit (struct tab_table *);
static void postcalc (void *);
static void submit (struct tab_table *);
@@
-209,7
+211,7
@@
internal_cmd_crosstabs (void)
pl_tc = pool_create ();
pl_col = pool_create ();
pl_tc = pool_create ();
pl_col = pool_create ();
- if (!parse_crosstabs (&cmd))
+ if (!parse_crosstabs (&cmd
, NULL
))
return CMD_FAILURE;
mode = variables ? INTEGER : GENERAL;
return CMD_FAILURE;
mode = variables ? INTEGER : GENERAL;
@@
-299,7
+301,7
@@
internal_cmd_crosstabs (void)
/* Parses the TABLES subcommand. */
static int
/* Parses the TABLES subcommand. */
static int
-crs_custom_tables (struct cmd_crosstabs *cmd UNUSED)
+crs_custom_tables (struct cmd_crosstabs *cmd UNUSED
, void *aux UNUSED
)
{
struct var_set *var_set;
int n_by;
{
struct var_set *var_set;
int n_by;
@@
-403,7
+405,7
@@
crs_custom_tables (struct cmd_crosstabs *cmd UNUSED)
/* Parses the VARIABLES subcommand. */
static int
/* Parses the VARIABLES subcommand. */
static int
-crs_custom_variables (struct cmd_crosstabs *cmd UNUSED)
+crs_custom_variables (struct cmd_crosstabs *cmd UNUSED
, void *aux UNUSED
)
{
if (nxtab)
{
{
if (nxtab)
{
@@
-485,8
+487,9
@@
static unsigned hash_table_entry (const void *, void *);
/* Set up the crosstabulation tables for processing. */
static void
/* Set up the crosstabulation tables for processing. */
static void
-precalc (void *aux UNUSED)
+precalc (
const struct ccase *first,
void *aux UNUSED)
{
{
+ output_split_file_values (first);
if (mode == GENERAL)
{
gen_tab = hsh_create (512, compare_table_entry, hash_table_entry,
if (mode == GENERAL)
{
gen_tab = hsh_create (512, compare_table_entry, hash_table_entry,
@@
-558,7
+561,7
@@
precalc (void *aux UNUSED)
/* Form crosstabulations for general mode. */
static bool
/* Form crosstabulations for general mode. */
static bool
-calc_general (struct ccase *c, void *aux UNUSED)
+calc_general (
const
struct ccase *c, void *aux UNUSED)
{
int bad_warn = 1;
{
int bad_warn = 1;
@@
-632,7
+635,7
@@
calc_general (struct ccase *c, void *aux UNUSED)
}
static bool
}
static bool
-calc_integer (struct ccase *c, void *aux UNUSED)
+calc_integer (
const
struct ccase *c, void *aux UNUSED)
{
int bad_warn = 1;
{
int bad_warn = 1;
@@
-1659,7
+1662,7
@@
static void
table_value_missing (struct tab_table *table, int c, int r, unsigned char opt,
const union value *v, const struct variable *var)
{
table_value_missing (struct tab_table *table, int c, int r, unsigned char opt,
const union value *v, const struct variable *var)
{
- struct
fixed_
string s;
+ struct
sub
string s;
const char *label = val_labs_find (var->val_labs, *v);
if (label)
const char *label = val_labs_find (var->val_labs, *v);
if (label)
@@
-1706,7
+1709,7
@@
format_cell_entry (struct tab_table *table, int c, int r, double value,
{
const struct fmt_spec f = {FMT_F, 10, 1};
union value v;
{
const struct fmt_spec f = {FMT_F, 10, 1};
union value v;
- struct
fixed_
string s;
+ struct
sub
string s;
s.length = 10;
s.string = tab_alloc (table, 16);
s.length = 10;
s.string = tab_alloc (table, 16);