t-test-parser: Untabify.
authorBen Pfaff <blp@cs.stanford.edu>
Sun, 21 Jul 2019 17:34:39 +0000 (10:34 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Sun, 21 Jul 2019 18:41:36 +0000 (11:41 -0700)
This file was inconsistent on tabs versus spaces.  Usually we use spaces
in PSPP.

src/language/stats/t-test-parser.c

index 2544da4c88c54ad63d44e245533ad7a1f5727866..5d6b2ae21c0c437ca6fc912b07daa8aa10147a09 100644 (file)
@@ -77,233 +77,232 @@ cmd_t_test (struct lexer *lexer, struct dataset *ds)
     {
       lex_match (lexer, T_SLASH);
       if (lex_match_id (lexer, "TESTVAL"))
-       {
-         mode_count++;
-         tt.mode = MODE_SINGLE;
-         lex_match (lexer, T_EQUALS);
-         if (!lex_force_num (lexer))
-           goto exit;
-         testval = lex_number (lexer);
-         lex_get (lexer);
-       }
+        {
+          mode_count++;
+          tt.mode = MODE_SINGLE;
+          lex_match (lexer, T_EQUALS);
+          if (!lex_force_num (lexer))
+            goto exit;
+          testval = lex_number (lexer);
+          lex_get (lexer);
+        }
       else if (lex_match_id (lexer, "GROUPS"))
-       {
-         mode_count++;
-         cut = false;
-         tt.mode = MODE_INDEP;
-         lex_match (lexer, T_EQUALS);
-
-         if (NULL == (gvar = parse_variable (lexer, dict)))
-           goto exit;
-
-          gval_width = var_get_width (gvar);
-         value_init (&gval0, gval_width);
-         value_init (&gval1, gval_width);
-
-         int n;
-         if (lex_match (lexer, T_LPAREN))
-           {
-             parse_value (lexer, &gval0, gvar);
-             if (lex_token (lexer) != T_RPAREN)
-               {
-                 lex_match (lexer, T_COMMA);
-                 parse_value (lexer, &gval1, gvar);
-                 cut = false;
-                 n = 2;
-               }
-             else
-               {
-                 cut = true;
-                 n = 1;
-               }
-
-             if (! lex_force_match (lexer, T_RPAREN))
-               goto exit;
-           }
-         else
-           {
-             gval0.f = 1.0;
-             gval1.f = 2.0;
-             cut = false;
-             n = 0;
-           }
-
-         if (n != 2 && var_is_alpha (gvar))
-           {
-             msg (SE, _("When applying %s to a string variable, two "
-                        "values must be specified."), "GROUPS");
-             goto exit;
-           }
-       }
+        {
+          mode_count++;
+          cut = false;
+          tt.mode = MODE_INDEP;
+          lex_match (lexer, T_EQUALS);
+
+          if (NULL == (gvar = parse_variable (lexer, dict)))
+            goto exit;
+
+          value_init (&gval0, var_get_width (gvar));
+          value_init (&gval1, var_get_width (gvar));
+
+          int n;
+          if (lex_match (lexer, T_LPAREN))
+            {
+              parse_value (lexer, &gval0, gvar);
+              if (lex_token (lexer) != T_RPAREN)
+                {
+                  lex_match (lexer, T_COMMA);
+                  parse_value (lexer, &gval1, gvar);
+                  cut = false;
+                  n = 2;
+                }
+              else
+                {
+                  cut = true;
+                  n = 1;
+                }
+
+              if (! lex_force_match (lexer, T_RPAREN))
+                goto exit;
+            }
+          else
+            {
+              gval0.f = 1.0;
+              gval1.f = 2.0;
+              cut = false;
+              n = 0;
+            }
+
+          if (n != 2 && var_is_alpha (gvar))
+            {
+              msg (SE, _("When applying %s to a string variable, two "
+                         "values must be specified."), "GROUPS");
+              goto exit;
+            }
+        }
       else if (lex_match_id (lexer, "PAIRS"))
-       {
-         bool with = false;
-         bool paired = false;
-
-         if (tt.n_vars > 0)
-           {
-             msg (SE, _("%s subcommand may not be used with %s."), "VARIABLES", "PAIRS");
-             goto exit;
-           }
-
-         mode_count++;
-         tt.mode = MODE_PAIRED;
-         lex_match (lexer, T_EQUALS);
-
-         if (!parse_variables_const (lexer, dict,
-                                     &v1, &n_v1,
-                                     PV_NO_DUPLICATE | PV_NUMERIC))
-           goto exit;
-
-         if ( lex_match (lexer, T_WITH))
-           {
-             with = true;
-             if (!parse_variables_const (lexer, dict,
-                                         &v2, &n_v2,
-                                         PV_NO_DUPLICATE | PV_NUMERIC))
-               goto exit;
-
-             if (lex_match (lexer, T_LPAREN)
-                 && lex_match_id (lexer, "PAIRED")
-                 && lex_match (lexer, T_RPAREN))
-               {
-                 paired = true;
-                 if (n_v1 != n_v2)
-                   {
-                     msg (SE, _("PAIRED was specified but the number of variables "
-                                "preceding WITH (%zu) did not match the number "
-                                "following (%zu)."),
-                          n_v1, n_v2);
-                     goto exit;
-                   }
-               }
-           }
-         {
-           int i;
-
-           if ( !with )
-             n_pairs = (n_v1 * (n_v1 - 1)) / 2.0;
-           else if ( paired )
-             n_pairs = n_v1;
-           else
-             n_pairs = n_v1 * n_v2;
-
-           pairs = xcalloc (n_pairs, sizeof *pairs);
-
-           if ( with)
-             {
-               int x = 0;
-               if (paired)
-                 {
-                   for (i = 0 ; i < n_v1; ++i)
-                     {
-                       vp *pair = &pairs[i];
-                       (*pair)[0] = v1[i];
-                       (*pair)[1] = v2[i];
-                     }
-                 }
-               else
-                 {
-                   for (i = 0 ; i < n_v1; ++i)
-                     {
-                       int j;
-                       for (j = 0 ; j < n_v2; ++j)
-                         {
-                           vp *pair = &pairs[x++];
-                           (*pair)[0] = v1[i];
-                           (*pair)[1] = v2[j];
-                         }
-                     }
-                 }
-             }
-           else
-             {
-               int x = 0;
-               for (i = 0 ; i < n_v1; ++i)
-                 {
-                   int j;
-
-                   for (j = i + 1 ; j < n_v1; ++j)
-                     {
-                       vp *pair = &pairs[x++];
-                       (*pair)[0] = v1[i];
-                       (*pair)[1] = v1[j];
-                     }
-                 }
-             }
-
-         }
-       }
+        {
+          bool with = false;
+          bool paired = false;
+
+          if (tt.n_vars > 0)
+            {
+              msg (SE, _("%s subcommand may not be used with %s."), "VARIABLES", "PAIRS");
+              goto exit;
+            }
+
+          mode_count++;
+          tt.mode = MODE_PAIRED;
+          lex_match (lexer, T_EQUALS);
+
+          if (!parse_variables_const (lexer, dict,
+                                      &v1, &n_v1,
+                                      PV_NO_DUPLICATE | PV_NUMERIC))
+            goto exit;
+
+          if ( lex_match (lexer, T_WITH))
+            {
+              with = true;
+              if (!parse_variables_const (lexer, dict,
+                                          &v2, &n_v2,
+                                          PV_NO_DUPLICATE | PV_NUMERIC))
+                goto exit;
+
+              if (lex_match (lexer, T_LPAREN)
+                  && lex_match_id (lexer, "PAIRED")
+                  && lex_match (lexer, T_RPAREN))
+                {
+                  paired = true;
+                  if (n_v1 != n_v2)
+                    {
+                      msg (SE, _("PAIRED was specified but the number of variables "
+                                 "preceding WITH (%zu) did not match the number "
+                                 "following (%zu)."),
+                           n_v1, n_v2);
+                      goto exit;
+                    }
+                }
+            }
+          {
+            int i;
+
+            if ( !with )
+              n_pairs = (n_v1 * (n_v1 - 1)) / 2.0;
+            else if ( paired )
+              n_pairs = n_v1;
+            else
+              n_pairs = n_v1 * n_v2;
+
+            pairs = xcalloc (n_pairs, sizeof *pairs);
+
+            if ( with)
+              {
+                int x = 0;
+                if (paired)
+                  {
+                    for (i = 0 ; i < n_v1; ++i)
+                      {
+                        vp *pair = &pairs[i];
+                        (*pair)[0] = v1[i];
+                        (*pair)[1] = v2[i];
+                      }
+                  }
+                else
+                  {
+                    for (i = 0 ; i < n_v1; ++i)
+                      {
+                        int j;
+                        for (j = 0 ; j < n_v2; ++j)
+                          {
+                            vp *pair = &pairs[x++];
+                            (*pair)[0] = v1[i];
+                            (*pair)[1] = v2[j];
+                          }
+                      }
+                  }
+              }
+            else
+              {
+                int x = 0;
+                for (i = 0 ; i < n_v1; ++i)
+                  {
+                    int j;
+
+                    for (j = i + 1 ; j < n_v1; ++j)
+                      {
+                        vp *pair = &pairs[x++];
+                        (*pair)[0] = v1[i];
+                        (*pair)[1] = v1[j];
+                      }
+                  }
+              }
+
+          }
+        }
       else if (lex_match_id (lexer, "VARIABLES"))
-       {
-         if ( tt.mode == MODE_PAIRED)
-           {
-             msg (SE, _("%s subcommand may not be used with %s."), "VARIABLES", "PAIRS");
-             goto exit;
-           }
-
-         lex_match (lexer, T_EQUALS);
-
-         if (!parse_variables_const (lexer, dict,
-                                     &tt.vars,
-                                     &tt.n_vars,
-                                     PV_NO_DUPLICATE | PV_NUMERIC))
-           goto exit;
-       }
+        {
+          if ( tt.mode == MODE_PAIRED)
+            {
+              msg (SE, _("%s subcommand may not be used with %s."), "VARIABLES", "PAIRS");
+              goto exit;
+            }
+
+          lex_match (lexer, T_EQUALS);
+
+          if (!parse_variables_const (lexer, dict,
+                                      &tt.vars,
+                                      &tt.n_vars,
+                                      PV_NO_DUPLICATE | PV_NUMERIC))
+            goto exit;
+        }
       else if ( lex_match_id (lexer, "MISSING"))
-       {
+        {
           lex_match (lexer, T_EQUALS);
           while (lex_token (lexer) != T_ENDCMD && lex_token (lexer) != T_SLASH)
             {
-             if (lex_match_id (lexer, "INCLUDE"))
-               {
-                 tt.exclude = MV_SYSTEM;
-               }
-             else if (lex_match_id (lexer, "EXCLUDE"))
-               {
-                 tt.exclude = MV_ANY;
-               }
-             else if (lex_match_id (lexer, "LISTWISE"))
-               {
-                 tt.missing_type = MISS_LISTWISE;
-               }
-             else if (lex_match_id (lexer, "ANALYSIS"))
-               {
-                 tt.missing_type = MISS_ANALYSIS;
-               }
-             else
-               {
+              if (lex_match_id (lexer, "INCLUDE"))
+                {
+                  tt.exclude = MV_SYSTEM;
+                }
+              else if (lex_match_id (lexer, "EXCLUDE"))
+                {
+                  tt.exclude = MV_ANY;
+                }
+              else if (lex_match_id (lexer, "LISTWISE"))
+                {
+                  tt.missing_type = MISS_LISTWISE;
+                }
+              else if (lex_match_id (lexer, "ANALYSIS"))
+                {
+                  tt.missing_type = MISS_ANALYSIS;
+                }
+              else
+                {
                   lex_error (lexer, NULL);
-                 goto exit;
-               }
-             lex_match (lexer, T_COMMA);
-           }
-       }
+                  goto exit;
+                }
+              lex_match (lexer, T_COMMA);
+            }
+        }
       else if (lex_match_id (lexer, "CRITERIA"))
-       {
+        {
           lex_match (lexer, T_EQUALS);
-         if ( lex_match_id (lexer, "CIN") || lex_force_match_id (lexer, "CI"))
-           if ( lex_force_match (lexer, T_LPAREN))
-             {
-               if (!lex_force_num (lexer))
-                 goto exit;
-               tt.confidence = lex_number (lexer);
-               lex_get (lexer);
-               if (! lex_force_match (lexer, T_RPAREN))
-                 goto exit;
-             }
-       }
+          if ( lex_match_id (lexer, "CIN") || lex_force_match_id (lexer, "CI"))
+            if ( lex_force_match (lexer, T_LPAREN))
+              {
+                if (!lex_force_num (lexer))
+                  goto exit;
+                tt.confidence = lex_number (lexer);
+                lex_get (lexer);
+                if (! lex_force_match (lexer, T_RPAREN))
+                  goto exit;
+              }
+        }
       else
-       {
-         lex_error (lexer, NULL);
-         goto exit;
-       }
+        {
+          lex_error (lexer, NULL);
+          goto exit;
+        }
     }
 
   if ( mode_count != 1)
     {
       msg (SE, _("Exactly one of TESTVAL, GROUPS and PAIRS subcommands "
-                "must be specified."));
+                 "must be specified."));
       goto exit;
     }
 
@@ -322,49 +321,49 @@ cmd_t_test (struct lexer *lexer, struct dataset *ds)
 
     while (casegrouper_get_next_group (grouper, &group))
       {
-       if ( tt.mode == MODE_SINGLE)
-         {
-           if ( tt.missing_type == MISS_LISTWISE )
-             group  = casereader_create_filter_missing (group,
-                                                        tt.vars, tt.n_vars,
-                                                        tt.exclude,
-                                                        NULL,  NULL);
-           one_sample_run (&tt, testval, group);
-         }
-       else if ( tt.mode == MODE_PAIRED)
-         {
-           if ( tt.missing_type == MISS_LISTWISE )
-             {
-               group  = casereader_create_filter_missing (group,
-                                                          v1, n_v1,
-                                                          tt.exclude,
-                                                          NULL,  NULL);
-               group  = casereader_create_filter_missing (group,
-                                                          v2, n_v2,
-                                                          tt.exclude,
-                                                          NULL,  NULL);
-             }
-
-           paired_run (&tt, n_pairs, pairs, group);
-         }
-       else /* tt.mode == MODE_INDEP */
-         {
-           if ( tt.missing_type == MISS_LISTWISE )
-             {
-               group  = casereader_create_filter_missing (group,
-                                                          tt.vars, tt.n_vars,
-                                                          tt.exclude,
-                                                          NULL,  NULL);
-
-               group  = casereader_create_filter_missing (group,
-                                                          &gvar, 1,
-                                                          tt.exclude,
-                                                          NULL,  NULL);
-
-             }
-
-           indep_run (&tt, gvar, cut, &gval0, &gval1, group);
-         }
+        if ( tt.mode == MODE_SINGLE)
+          {
+            if ( tt.missing_type == MISS_LISTWISE )
+              group  = casereader_create_filter_missing (group,
+                                                         tt.vars, tt.n_vars,
+                                                         tt.exclude,
+                                                         NULL,  NULL);
+            one_sample_run (&tt, testval, group);
+          }
+        else if ( tt.mode == MODE_PAIRED)
+          {
+            if ( tt.missing_type == MISS_LISTWISE )
+              {
+                group  = casereader_create_filter_missing (group,
+                                                           v1, n_v1,
+                                                           tt.exclude,
+                                                           NULL,  NULL);
+                group  = casereader_create_filter_missing (group,
+                                                           v2, n_v2,
+                                                           tt.exclude,
+                                                           NULL,  NULL);
+              }
+
+            paired_run (&tt, n_pairs, pairs, group);
+          }
+        else /* tt.mode == MODE_INDEP */
+          {
+            if ( tt.missing_type == MISS_LISTWISE )
+              {
+                group  = casereader_create_filter_missing (group,
+                                                           tt.vars, tt.n_vars,
+                                                           tt.exclude,
+                                                           NULL,  NULL);
+
+                group  = casereader_create_filter_missing (group,
+                                                           &gvar, 1,
+                                                           tt.exclude,
+                                                           NULL,  NULL);
+
+              }
+
+            indep_run (&tt, gvar, cut, &gval0, &gval1, group);
+          }
       }
 
     ok = casegrouper_destroy (grouper);