DEF_CMD (S_DATA, 0, "BEGIN DATA", cmd_begin_data)
DEF_CMD (S_DATA, 0, "COUNT", cmd_count)
DEF_CMD (S_DATA, 0, "CROSSTABS", cmd_crosstabs)
+DEF_CMD (S_DATA, 0, "CTABLES", cmd_ctables)
DEF_CMD (S_DATA, 0, "CORRELATIONS", cmd_correlation)
DEF_CMD (S_DATA, 0, "DELETE VARIABLES", cmd_delete_variables)
DEF_CMD (S_DATA, 0, "DESCRIPTIVES", cmd_descriptives)
UNIMPL_CMD ("CSPLAN", "Complex samples design")
UNIMPL_CMD ("CSSELECT", "Select complex samples")
UNIMPL_CMD ("CSTABULATE", "Tabulate complex samples")
-UNIMPL_CMD ("CTABLES", "Display complex samples")
UNIMPL_CMD ("CURVEFIT", "Fit curve to line plot")
UNIMPL_CMD ("DATE", "Create time series data")
UNIMPL_CMD ("DETECTANOMALY", "Find unusual cases")
--- /dev/null
+/* PSPP - a program for statistical analysis.
+ Copyright (C) 2021 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
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <config.h>
+
+#include "language/command.h"
+#include "language/lexer/lexer.h"
+#include "libpspp/message.h"
+
+#include "gl/xalloc.h"
+
+#include "gettext.h"
+#define _(msgid) gettext (msgid)
+
+struct ctables
+ {
+ struct pivot_table_look *look;
+
+ /* If this is NULL, zeros are displayed using the normal print format.
+ Otherwise, this string is displayed. */
+ char *zero;
+
+ /* If this is NULL, missing values are displayed using the normal print
+ format. Otherwise, this string is displayed. */
+ char *missing;
+
+ /* Contains "struct ctables_vlabel" structs. */
+ struct hmap vlabels;
+
+ bool mrsets_count_duplicates; /* MRSETS. */
+ bool smissing_listwise; /* SMISSING. */
+ struct variable *base_weight; /* WEIGHT. */
+ double hide_threshold; /* HIDESMALLCOUNTS. */
+
+ struct ctables_table *tables;
+ size_t n_tables;
+ };
+
+struct ctables_vlabel
+ {
+ struct hmap_node hmap_node; /* In struct ctables's 'vlabels' hmap. */
+ const char *name; /* Variable name. */
+
+ /* SETTINGS_VALUE_SHOW_DEFAULT is interpreted as "none". */
+ enum settings_value_show show;
+ };
+
+struct ctables_postcompute
+ {
+ struct hmap_node hmap_node; /* In struct ctables's 'pcompute' hmap. */
+ const char *name; /* Name, without leading &. */
+
+ struct ctables_postcompute_expr *expr;
+ char *label;
+ /* XXX FORMAT */
+ bool hide_source_cats;
+ };
+
+struct ctables_postcompute_expr
+ {
+ enum ctables_postcompute_op
+ {
+ /* Terminals. */
+ CTPET_CAT_NUMBER,
+ CTPET_CAT_STRING,
+ CTPET_CAT_RANGE,
+ CTPET_CAT_MISSING,
+ /* XXX OTHERNM */
+ /* XXX SUBTOTAL and HSUBTOTAL */
+
+ /* Nonterminals. */
+ CTPET_ADD,
+ CTPET_SUB,
+ CTPET_MUL,
+ CTPET_DIV,
+ CTPET_POW,
+ }
+ op;
+
+ union
+ {
+ /* CTPET_CAT_NUMBER, CTPET_NUMBER. */
+ double number;
+
+ /* CTPET_CAT_RANGE.
+
+ XXX what about string ranges? */
+ struct
+ {
+ double low; /* -DBL_MAX for LO. */
+ double high; /* DBL_MAX for HIGH. */
+ }
+ range;
+
+ /* CTPET_ADD, CTPET_SUB, CTPET_MUL, CTPET_DIV, CTPET_POW. */
+ struct ctables_postcompute_expr *subs[2];
+ };
+ };
+
+
+int
+cmd_ctables (struct lexer *lexer, struct dataset *ds)
+{
+
+
+}
+