CTABLES comments
[pspp] / src / language / stats / ctables.c
index ce49e591020f73fa9bd2e587b6f5439ae1855731..fe46f10c9254cb8e556ff045e24792503af5771c 100644 (file)
@@ -21,6 +21,7 @@
 
 #include "data/casereader.h"
 #include "data/casewriter.h"
+#include "data/data-out.h"
 #include "data/dataset.h"
 #include "data/dictionary.h"
 #include "data/mrset.h"
@@ -114,8 +115,8 @@ enum ctables_vlabel
     S(CTSF_LAYERPCT_SUM, "LAYERPCT.SUM", N_("Layer Sum %"), CTF_PERCENT, CTFA_SCALE) \
     S(CTSF_LAYERROWPCT_SUM, "LAYERROWPCT.SUM", N_("Layer Row Sum %"), CTF_PERCENT, CTFA_SCALE) \
     S(CTSF_LAYERCOLPCT_SUM, "LAYERCOLPCT.SUM", N_("Layer Column Sum %"), CTF_PERCENT, CTFA_SCALE) \
-                                                                        \
-    /* Multiple response sets. */                                       \
+
+#if 0         /* Multiple response sets not yet implemented. */
   S(CTSF_RESPONSES, "RESPONSES", N_("Responses"), CTF_COUNT, CTFA_MRSETS) \
     S(CTSF_ROWPCT_RESPONSES, "ROWPCT.RESPONSES", N_("Row Responses %"), CTF_PERCENT, CTFA_MRSETS) \
     S(CTSF_COLPCT_RESPONSES, "COLPCT.RESPONSES", N_("Column Responses %"), CTF_PERCENT, CTFA_MRSETS) \
@@ -138,6 +139,7 @@ enum ctables_vlabel
     S(CTSF_LAYERPCT_COUNT_RESPONSES, "LAYERPCT.COUNT.RESPONSES", N_("Layer Count % (Base: Responses)"), CTF_PERCENT, CTFA_MRSETS) \
     S(CTSF_LAYERROWPCT_COUNT_RESPONSES, "LAYERROWPCT.COUNT.RESPONSES", N_("Layer Row Count % (Base: Responses)"), CTF_PERCENT, CTFA_MRSETS) \
     S(CTSF_LAYERCOLPCT_COUNT_RESPONSES, "LAYERCOLPCT.RESPONSES.COUNT", N_("Layer Column Count % (Base: Responses)"), CTF_PERCENT, CTFA_MRSETS)
+#endif
 
 enum ctables_summary_function
   {
@@ -224,6 +226,14 @@ struct ctables
     const struct dictionary *dict;
     struct pivot_table_look *look;
 
+    /* CTABLES has a number of extra formats that we implement via custom
+       currency specifications on an alternate fmt_settings. */
+#define CTEF_NEGPAREN FMT_CCA
+#define CTEF_NEQUAL   FMT_CCB
+#define CTEF_PAREN    FMT_CCC
+#define CTEF_PCTPAREN FMT_CCD
+    struct fmt_settings ctables_formats;
+
     /* If this is NULL, zeros are displayed using the normal print format.
        Otherwise, this string is displayed. */
     char *zero;
@@ -686,7 +696,10 @@ struct ctables_summary_spec
     enum ctables_summary_function function;
     double percentile;          /* CTSF_PTILE only. */
     char *label;
-    struct fmt_spec format;     /* XXX extra CTABLES formats */
+
+    struct fmt_spec format;
+    bool is_ctables_format;       /* Is 'format' one of CTEF_*? */
+
     size_t axis_idx;
   };
 
@@ -776,32 +789,59 @@ ctables_function_availability (enum ctables_summary_function f)
 static bool
 ctables_summary_function_is_count (enum ctables_summary_function f)
 {
-  static const bool is_count[N_CTSF_FUNCTIONS] = {
-    [CTSF_COUNT] = true,
-    [CTSF_ECOUNT] = true,
-    [CTSF_ROWPCT_COUNT] = true,
-    [CTSF_COLPCT_COUNT] = true,
-    [CTSF_TABLEPCT_COUNT] = true,
-    [CTSF_SUBTABLEPCT_COUNT] = true,
-    [CTSF_LAYERPCT_COUNT] = true,
-    [CTSF_LAYERROWPCT_COUNT] = true,
-    [CTSF_LAYERCOLPCT_COUNT] = true,
-    [CTSF_ROWPCT_RESPONSES_COUNT] = true,
-    [CTSF_COLPCT_RESPONSES_COUNT] = true,
-    [CTSF_TABLEPCT_RESPONSES_COUNT] = true,
-    [CTSF_SUBTABLEPCT_RESPONSES_COUNT] = true,
-    [CTSF_LAYERPCT_RESPONSES_COUNT] = true,
-    [CTSF_LAYERROWPCT_RESPONSES_COUNT] = true,
-    [CTSF_LAYERCOLPCT_RESPONSES_COUNT] = true,
-    [CTSF_ROWPCT_COUNT_RESPONSES] = true,
-    [CTSF_COLPCT_COUNT_RESPONSES] = true,
-    [CTSF_TABLEPCT_COUNT_RESPONSES] = true,
-    [CTSF_SUBTABLEPCT_COUNT_RESPONSES] = true,
-    [CTSF_LAYERPCT_COUNT_RESPONSES] = true,
-    [CTSF_LAYERROWPCT_COUNT_RESPONSES] = true,
-    [CTSF_LAYERCOLPCT_COUNT_RESPONSES] = true,
-  };
-  return is_count[f];
+  switch (f)
+    {
+    case CTSF_COUNT:
+    case CTSF_ECOUNT:
+    case CTSF_ROWPCT_COUNT:
+    case CTSF_COLPCT_COUNT:
+    case CTSF_TABLEPCT_COUNT:
+    case CTSF_SUBTABLEPCT_COUNT:
+    case CTSF_LAYERPCT_COUNT:
+    case CTSF_LAYERROWPCT_COUNT:
+    case CTSF_LAYERCOLPCT_COUNT:
+      return true;
+
+    case CTSF_ROWPCT_VALIDN:
+    case CTSF_COLPCT_VALIDN:
+    case CTSF_TABLEPCT_VALIDN:
+    case CTSF_SUBTABLEPCT_VALIDN:
+    case CTSF_LAYERPCT_VALIDN:
+    case CTSF_LAYERROWPCT_VALIDN:
+    case CTSF_LAYERCOLPCT_VALIDN:
+    case CTSF_ROWPCT_TOTALN:
+    case CTSF_COLPCT_TOTALN:
+    case CTSF_TABLEPCT_TOTALN:
+    case CTSF_SUBTABLEPCT_TOTALN:
+    case CTSF_LAYERPCT_TOTALN:
+    case CTSF_LAYERROWPCT_TOTALN:
+    case CTSF_LAYERCOLPCT_TOTALN:
+    case CTSF_MAXIMUM:
+    case CTSF_MEAN:
+    case CTSF_MEDIAN:
+    case CTSF_MINIMUM:
+    case CTSF_MISSING:
+    case CTSF_MODE:
+    case CTSF_PTILE:
+    case CTSF_RANGE:
+    case CTSF_SEMEAN:
+    case CTSF_STDDEV:
+    case CTSF_SUM:
+    case CSTF_TOTALN:
+    case CTSF_ETOTALN:
+    case CTSF_VALIDN:
+    case CTSF_EVALIDN:
+    case CTSF_VARIANCE:
+    case CTSF_ROWPCT_SUM:
+    case CTSF_COLPCT_SUM:
+    case CTSF_TABLEPCT_SUM:
+    case CTSF_SUBTABLEPCT_SUM:
+    case CTSF_LAYERPCT_SUM:
+    case CTSF_LAYERROWPCT_SUM:
+    case CTSF_LAYERCOLPCT_SUM:
+      return false;
+  }
+  NOT_REACHED ();
 }
 
 
@@ -946,7 +986,8 @@ static bool
 add_summary_spec (struct ctables_axis *axis,
                   enum ctables_summary_function function, double percentile,
                   const char *label, const struct fmt_spec *format,
-                  const struct msg_location *loc, enum ctables_summary_variant sv)
+                  bool is_ctables_format, const struct msg_location *loc,
+                  enum ctables_summary_variant sv)
 {
   if (axis->op == CTAO_VAR)
     {
@@ -993,6 +1034,7 @@ add_summary_spec (struct ctables_axis *axis,
         .label = xstrdup (label),
         .format = (format ? *format
                    : ctables_summary_default_format (function, &axis->var)),
+        .is_ctables_format = is_ctables_format,
       };
       return true;
     }
@@ -1000,7 +1042,7 @@ add_summary_spec (struct ctables_axis *axis,
     {
       for (size_t i = 0; i < 2; i++)
         if (!add_summary_spec (axis->subs[i], function, percentile, label,
-                               format, loc, sv))
+                               format, is_ctables_format, loc, sv))
           return false;
       return true;
     }
@@ -1080,6 +1122,48 @@ has_digit (const char *s)
   return s[strcspn (s, "0123456789")] != '\0';
 }
 
+static bool
+parse_ctables_format_specifier (struct lexer *lexer, struct fmt_spec *format,
+                                bool *is_ctables_format)
+{
+  char type[FMT_TYPE_LEN_MAX + 1];
+  if (!parse_abstract_format_specifier__ (lexer, type, &format->w, &format->d))
+    return false;
+
+  if (!strcasecmp (type, "NEGPAREN"))
+    format->type = CTEF_NEGPAREN;
+  else if (!strcasecmp (type, "NEQUAL"))
+    format->type = CTEF_NEQUAL;
+  else if (!strcasecmp (type, "PAREN"))
+    format->type = CTEF_PAREN;
+  else if (!strcasecmp (type, "PCTPAREN"))
+    format->type = CTEF_PCTPAREN;
+  else
+    {
+      *is_ctables_format = false;
+      return (parse_format_specifier (lexer, format)
+              && fmt_check_output (format)
+              && fmt_check_type_compat (format, VAL_NUMERIC));
+    }
+
+  if (format->w < 2)
+    {
+      msg (SE, _("Output format %s requires width 2 or greater."), type);
+      return false;
+    }
+  else if (format->d > format->w - 1)
+    {
+      msg (SE, _("Output format %s requires width greater than decimals."),
+           type);
+      return false;
+    }
+  else
+    {
+      *is_ctables_format = true;
+      return true;
+    }
+}
+
 static struct ctables_axis *
 ctables_axis_parse_postfix (struct ctables_axis_parse_ctx *ctx)
 {
@@ -1120,12 +1204,12 @@ ctables_axis_parse_postfix (struct ctables_axis_parse_ctx *ctx)
       /* Parse format. */
       struct fmt_spec format;
       const struct fmt_spec *formatp;
+      bool is_ctables_format = false;
       if (lex_token (ctx->lexer) == T_ID
           && has_digit (lex_tokcstr (ctx->lexer)))
         {
-          if (!parse_format_specifier (ctx->lexer, &format)
-              || !fmt_check_output (&format)
-              || !fmt_check_type_compat (&format, VAL_NUMERIC))
+          if (!parse_ctables_format_specifier (ctx->lexer, &format,
+                                               &is_ctables_format))
             {
               free (label);
               goto error;
@@ -1137,7 +1221,8 @@ ctables_axis_parse_postfix (struct ctables_axis_parse_ctx *ctx)
 
       struct msg_location *loc = lex_ofs_location (ctx->lexer, start_ofs,
                                                    lex_ofs (ctx->lexer) - 1);
-      add_summary_spec (sub, function, percentile, label, formatp, loc, sv);
+      add_summary_spec (sub, function, percentile, label, formatp,
+                        is_ctables_format, loc, sv);
       free (label);
       msg_location_destroy (loc);
 
@@ -2073,30 +2158,6 @@ ctables_summary_init (union ctables_summary *s,
         s->ovalue = SYSMIS;
       }
       break;
-
-    case CTSF_RESPONSES:
-    case CTSF_ROWPCT_RESPONSES:
-    case CTSF_COLPCT_RESPONSES:
-    case CTSF_TABLEPCT_RESPONSES:
-    case CTSF_SUBTABLEPCT_RESPONSES:
-    case CTSF_LAYERPCT_RESPONSES:
-    case CTSF_LAYERROWPCT_RESPONSES:
-    case CTSF_LAYERCOLPCT_RESPONSES:
-    case CTSF_ROWPCT_RESPONSES_COUNT:
-    case CTSF_COLPCT_RESPONSES_COUNT:
-    case CTSF_TABLEPCT_RESPONSES_COUNT:
-    case CTSF_SUBTABLEPCT_RESPONSES_COUNT:
-    case CTSF_LAYERPCT_RESPONSES_COUNT:
-    case CTSF_LAYERROWPCT_RESPONSES_COUNT:
-    case CTSF_LAYERCOLPCT_RESPONSES_COUNT:
-    case CTSF_ROWPCT_COUNT_RESPONSES:
-    case CTSF_COLPCT_COUNT_RESPONSES:
-    case CTSF_TABLEPCT_COUNT_RESPONSES:
-    case CTSF_SUBTABLEPCT_COUNT_RESPONSES:
-    case CTSF_LAYERPCT_COUNT_RESPONSES:
-    case CTSF_LAYERROWPCT_COUNT_RESPONSES:
-    case CTSF_LAYERCOLPCT_COUNT_RESPONSES:
-      NOT_REACHED ();
     }
 }
 
@@ -2161,30 +2222,6 @@ ctables_summary_uninit (union ctables_summary *s,
     case CTSF_PTILE:
       casewriter_destroy (s->writer);
       break;
-
-    case CTSF_RESPONSES:
-    case CTSF_ROWPCT_RESPONSES:
-    case CTSF_COLPCT_RESPONSES:
-    case CTSF_TABLEPCT_RESPONSES:
-    case CTSF_SUBTABLEPCT_RESPONSES:
-    case CTSF_LAYERPCT_RESPONSES:
-    case CTSF_LAYERROWPCT_RESPONSES:
-    case CTSF_LAYERCOLPCT_RESPONSES:
-    case CTSF_ROWPCT_RESPONSES_COUNT:
-    case CTSF_COLPCT_RESPONSES_COUNT:
-    case CTSF_TABLEPCT_RESPONSES_COUNT:
-    case CTSF_SUBTABLEPCT_RESPONSES_COUNT:
-    case CTSF_LAYERPCT_RESPONSES_COUNT:
-    case CTSF_LAYERROWPCT_RESPONSES_COUNT:
-    case CTSF_LAYERCOLPCT_RESPONSES_COUNT:
-    case CTSF_ROWPCT_COUNT_RESPONSES:
-    case CTSF_COLPCT_COUNT_RESPONSES:
-    case CTSF_TABLEPCT_COUNT_RESPONSES:
-    case CTSF_SUBTABLEPCT_COUNT_RESPONSES:
-    case CTSF_LAYERPCT_COUNT_RESPONSES:
-    case CTSF_LAYERROWPCT_COUNT_RESPONSES:
-    case CTSF_LAYERCOLPCT_COUNT_RESPONSES:
-      NOT_REACHED ();
     }
 }
 
@@ -2194,6 +2231,24 @@ ctables_summary_add (union ctables_summary *s,
                      const struct variable *var, const union value *value,
                      double d_weight, double e_weight)
 {
+  /* To determine whether a case is included in a given table for a particular
+     kind of summary, consider the following charts for each variable in the
+     table.  Only if "yes" appears for every variable for the summary is the
+     case counted.
+
+     Categorical variables:                    VALIDN   COUNT   TOTALN
+       Valid values in included categories       yes     yes      yes
+       Missing values in included categories     ---     yes      yes
+       Missing values in excluded categories     ---     ---      yes
+       Valid values in excluded categories       ---     ---      ---
+
+     Scale variables:                          VALIDN   COUNT   TOTALN
+       Valid value                               yes     yes      yes
+       Missing value                             ---     yes      yes
+
+     Missing values include both user- and system-missing.  (The system-missing
+     value is always in an excluded category.)
+  */
   switch (ss->function)
     {
     case CTSF_COUNT:
@@ -2278,30 +2333,6 @@ ctables_summary_add (union ctables_summary *s,
           casewriter_write (s->writer, c);
         }
       break;
-
-    case CTSF_RESPONSES:
-    case CTSF_ROWPCT_RESPONSES:
-    case CTSF_COLPCT_RESPONSES:
-    case CTSF_TABLEPCT_RESPONSES:
-    case CTSF_SUBTABLEPCT_RESPONSES:
-    case CTSF_LAYERPCT_RESPONSES:
-    case CTSF_LAYERROWPCT_RESPONSES:
-    case CTSF_LAYERCOLPCT_RESPONSES:
-    case CTSF_ROWPCT_RESPONSES_COUNT:
-    case CTSF_COLPCT_RESPONSES_COUNT:
-    case CTSF_TABLEPCT_RESPONSES_COUNT:
-    case CTSF_SUBTABLEPCT_RESPONSES_COUNT:
-    case CTSF_LAYERPCT_RESPONSES_COUNT:
-    case CTSF_LAYERROWPCT_RESPONSES_COUNT:
-    case CTSF_LAYERCOLPCT_RESPONSES_COUNT:
-    case CTSF_ROWPCT_COUNT_RESPONSES:
-    case CTSF_COLPCT_COUNT_RESPONSES:
-    case CTSF_TABLEPCT_COUNT_RESPONSES:
-    case CTSF_SUBTABLEPCT_COUNT_RESPONSES:
-    case CTSF_LAYERPCT_COUNT_RESPONSES:
-    case CTSF_LAYERROWPCT_COUNT_RESPONSES:
-    case CTSF_LAYERCOLPCT_COUNT_RESPONSES:
-      NOT_REACHED ();
     }
 }
 
@@ -2328,67 +2359,45 @@ ctables_function_domain (enum ctables_summary_function function)
     case CTSF_MEDIAN:
     case CTSF_PTILE:
     case CTSF_MODE:
-    case CTSF_RESPONSES:
       NOT_REACHED ();
 
     case CTSF_COLPCT_COUNT:
-    case CTSF_COLPCT_COUNT_RESPONSES:
-    case CTSF_COLPCT_RESPONSES:
-    case CTSF_COLPCT_RESPONSES_COUNT:
     case CTSF_COLPCT_SUM:
     case CTSF_COLPCT_TOTALN:
     case CTSF_COLPCT_VALIDN:
       return CTDT_COL;
 
     case CTSF_LAYERCOLPCT_COUNT:
-    case CTSF_LAYERCOLPCT_COUNT_RESPONSES:
-    case CTSF_LAYERCOLPCT_RESPONSES:
-    case CTSF_LAYERCOLPCT_RESPONSES_COUNT:
     case CTSF_LAYERCOLPCT_SUM:
     case CTSF_LAYERCOLPCT_TOTALN:
     case CTSF_LAYERCOLPCT_VALIDN:
       return CTDT_LAYERCOL;
 
     case CTSF_LAYERPCT_COUNT:
-    case CTSF_LAYERPCT_COUNT_RESPONSES:
-    case CTSF_LAYERPCT_RESPONSES:
-    case CTSF_LAYERPCT_RESPONSES_COUNT:
     case CTSF_LAYERPCT_SUM:
     case CTSF_LAYERPCT_TOTALN:
     case CTSF_LAYERPCT_VALIDN:
       return CTDT_LAYER;
 
     case CTSF_LAYERROWPCT_COUNT:
-    case CTSF_LAYERROWPCT_COUNT_RESPONSES:
-    case CTSF_LAYERROWPCT_RESPONSES:
-    case CTSF_LAYERROWPCT_RESPONSES_COUNT:
     case CTSF_LAYERROWPCT_SUM:
     case CTSF_LAYERROWPCT_TOTALN:
     case CTSF_LAYERROWPCT_VALIDN:
       return CTDT_LAYERROW;
 
     case CTSF_ROWPCT_COUNT:
-    case CTSF_ROWPCT_COUNT_RESPONSES:
-    case CTSF_ROWPCT_RESPONSES:
-    case CTSF_ROWPCT_RESPONSES_COUNT:
     case CTSF_ROWPCT_SUM:
     case CTSF_ROWPCT_TOTALN:
     case CTSF_ROWPCT_VALIDN:
       return CTDT_ROW;
 
     case CTSF_SUBTABLEPCT_COUNT:
-    case CTSF_SUBTABLEPCT_COUNT_RESPONSES:
-    case CTSF_SUBTABLEPCT_RESPONSES:
-    case CTSF_SUBTABLEPCT_RESPONSES_COUNT:
     case CTSF_SUBTABLEPCT_SUM:
     case CTSF_SUBTABLEPCT_TOTALN:
     case CTSF_SUBTABLEPCT_VALIDN:
       return CTDT_SUBTABLE;
 
     case CTSF_TABLEPCT_COUNT:
-    case CTSF_TABLEPCT_COUNT_RESPONSES:
-    case CTSF_TABLEPCT_RESPONSES:
-    case CTSF_TABLEPCT_RESPONSES_COUNT:
     case CTSF_TABLEPCT_SUM:
     case CTSF_TABLEPCT_TOTALN:
     case CTSF_TABLEPCT_VALIDN:
@@ -2532,30 +2541,6 @@ ctables_summary_value (const struct ctables_cell *cell,
           statistic_destroy (&mode->parent.parent);
         }
       return s->ovalue;
-
-    case CTSF_RESPONSES:
-    case CTSF_ROWPCT_RESPONSES:
-    case CTSF_COLPCT_RESPONSES:
-    case CTSF_TABLEPCT_RESPONSES:
-    case CTSF_SUBTABLEPCT_RESPONSES:
-    case CTSF_LAYERPCT_RESPONSES:
-    case CTSF_LAYERROWPCT_RESPONSES:
-    case CTSF_LAYERCOLPCT_RESPONSES:
-    case CTSF_ROWPCT_RESPONSES_COUNT:
-    case CTSF_COLPCT_RESPONSES_COUNT:
-    case CTSF_TABLEPCT_RESPONSES_COUNT:
-    case CTSF_SUBTABLEPCT_RESPONSES_COUNT:
-    case CTSF_LAYERPCT_RESPONSES_COUNT:
-    case CTSF_LAYERROWPCT_RESPONSES_COUNT:
-    case CTSF_LAYERCOLPCT_RESPONSES_COUNT:
-    case CTSF_ROWPCT_COUNT_RESPONSES:
-    case CTSF_COLPCT_COUNT_RESPONSES:
-    case CTSF_TABLEPCT_COUNT_RESPONSES:
-    case CTSF_SUBTABLEPCT_COUNT_RESPONSES:
-    case CTSF_LAYERPCT_COUNT_RESPONSES:
-    case CTSF_LAYERROWPCT_COUNT_RESPONSES:
-    case CTSF_LAYERCOLPCT_COUNT_RESPONSES:
-      NOT_REACHED ();
     }
 
   NOT_REACHED ();
@@ -3633,6 +3618,14 @@ ctables_table_output (struct ctables *ct, struct ctables_table *t)
                 value = pivot_value_new_user_text (ct->zero, SIZE_MAX);
               else if (d == SYSMIS && ct->missing)
                 value = pivot_value_new_user_text (ct->missing, SIZE_MAX);
+              else if (specs->specs[j].is_ctables_format)
+                {
+                  char *s = data_out_stretchy (&(union value) { .f = d },
+                                               "UTF-8",
+                                               &specs->specs[j].format,
+                                               &ct->ctables_formats, NULL);
+                  value = pivot_value_new_user_text_nocopy (s);
+                }
               else
                 {
                   value = pivot_value_new_number (d);
@@ -4674,15 +4667,38 @@ cmd_ctables (struct lexer *lexer, struct dataset *ds)
   for (size_t i = 0; i < n_vars; i++)
     vlabels[i] = (enum ctables_vlabel) tvars;
 
+  struct pivot_table_look *look = pivot_table_look_unshare (
+    pivot_table_look_ref (pivot_table_look_get_default ()));
+  look->omit_empty = false;
+
   struct ctables *ct = xmalloc (sizeof *ct);
   *ct = (struct ctables) {
     .dict = dataset_dict (ds),
-    .look = pivot_table_look_unshare (pivot_table_look_ref (
-                                        pivot_table_look_get_default ())),
+    .look = look,
+    .ctables_formats = FMT_SETTINGS_INIT,
     .vlabels = vlabels,
     .postcomputes = HMAP_INITIALIZER (ct->postcomputes),
   };
-  ct->look->omit_empty = false;
+
+  struct ctf
+    {
+      enum fmt_type type;
+      const char *dot_string;
+      const char *comma_string;
+    };
+  static const struct ctf ctfs[4] = {
+    { CTEF_NEGPAREN, "(,,,)",   "(...)" },
+    { CTEF_NEQUAL,   "-,N=,,",  "-.N=.." },
+    { CTEF_PAREN,    "-,(,),",  "-.(.)." },
+    { CTEF_PCTPAREN, "-,(,%),", "-.(.%)." },
+  };
+  bool is_dot = settings_get_fmt_settings ()->decimal == '.';
+  for (size_t i = 0; i < 4; i++)
+    {
+      const char *s = is_dot ? ctfs[i].dot_string : ctfs[i].comma_string;
+      fmt_settings_set_cc (&ct->ctables_formats, ctfs[i].type,
+                           fmt_number_style_from_string (s));
+    }
 
   if (!lex_force_match (lexer, T_SLASH))
     goto error;