pspp-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pspp-cvs] Changes to pspp/src/sort.c


From: Ben Pfaff
Subject: [Pspp-cvs] Changes to pspp/src/sort.c
Date: Sun, 13 Mar 2005 02:31:56 -0500

Index: pspp/src/sort.c
diff -u pspp/src/sort.c:1.24 pspp/src/sort.c:1.25
--- pspp/src/sort.c:1.24        Tue Mar  1 08:16:16 2005
+++ pspp/src/sort.c     Sun Mar 13 07:31:53 2005
@@ -25,6 +25,7 @@
 #include <errno.h>
 #include "algorithm.h"
 #include "alloc.h"
+#include "bool.h"
 #include "case.h"
 #include "casefile.h"
 #include "command.h"
@@ -91,7 +92,7 @@
 
   lex_match (T_BY);
 
-  criteria = sort_parse_criteria (default_dict, NULL, NULL);
+  criteria = sort_parse_criteria (default_dict, NULL, NULL, NULL);
   if (criteria == NULL)
     return CMD_FAILURE;
 
@@ -151,11 +152,15 @@
   return sort_execute (casefile_get_reader (src), criteria);
 }
 
-/* Parses a list of sort keys and returns a struct sort_cases_pgm
-   based on it.  Returns a null pointer on error. */
+/* Parses a list of sort keys and returns a struct sort_criteria
+   based on it.  Returns a null pointer on error.
+   If SAW_DIRECTION is nonnull, sets *SAW_DIRECTION to true if at
+   least one parenthesized sort direction was specified, false
+   otherwise. */
 struct sort_criteria *
 sort_parse_criteria (const struct dictionary *dict,
-                     struct variable ***vars, int *var_cnt)
+                     struct variable ***vars, int *var_cnt,
+                     bool *saw_direction)
 {
   struct sort_criteria *criteria;
   struct variable **local_vars = NULL;
@@ -174,6 +179,8 @@
 
   *vars = NULL;
   *var_cnt = 0;
+  if (saw_direction != NULL)
+    *saw_direction = false;
 
   do
     {
@@ -202,6 +209,7 @@
              msg (SE, _("`)' expected."));
               goto error;
            }
+          *saw_direction = true;
        }
       else
         direction = SRT_ASCEND;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]