/[pspp]/pspp/src/sort.c
ViewVC logotype

Diff of /pspp/src/sort.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.24 by blp, Tue Mar 1 08:16:16 2005 UTC revision 1.25 by blp, Sun Mar 13 07:31:53 2005 UTC
# Line 25  Line 25 
25  #include <errno.h>  #include <errno.h>
26  #include "algorithm.h"  #include "algorithm.h"
27  #include "alloc.h"  #include "alloc.h"
28    #include "bool.h"
29  #include "case.h"  #include "case.h"
30  #include "casefile.h"  #include "casefile.h"
31  #include "command.h"  #include "command.h"
# Line 91  cmd_sort_cases (void) Line 92  cmd_sort_cases (void)
92    
93    lex_match (T_BY);    lex_match (T_BY);
94    
95    criteria = sort_parse_criteria (default_dict, NULL, NULL);    criteria = sort_parse_criteria (default_dict, NULL, NULL, NULL);
96    if (criteria == NULL)    if (criteria == NULL)
97      return CMD_FAILURE;      return CMD_FAILURE;
98    
# Line 151  sort_active_file_to_casefile (const stru Line 152  sort_active_file_to_casefile (const stru
152    return sort_execute (casefile_get_reader (src), criteria);    return sort_execute (casefile_get_reader (src), criteria);
153  }  }
154    
155  /* Parses a list of sort keys and returns a struct sort_cases_pgm  /* Parses a list of sort keys and returns a struct sort_criteria
156     based on it.  Returns a null pointer on error. */     based on it.  Returns a null pointer on error.
157       If SAW_DIRECTION is nonnull, sets *SAW_DIRECTION to true if at
158       least one parenthesized sort direction was specified, false
159       otherwise. */
160  struct sort_criteria *  struct sort_criteria *
161  sort_parse_criteria (const struct dictionary *dict,  sort_parse_criteria (const struct dictionary *dict,
162                       struct variable ***vars, int *var_cnt)                       struct variable ***vars, int *var_cnt,
163                         bool *saw_direction)
164  {  {
165    struct sort_criteria *criteria;    struct sort_criteria *criteria;
166    struct variable **local_vars = NULL;    struct variable **local_vars = NULL;
# Line 174  sort_parse_criteria (const struct dictio Line 179  sort_parse_criteria (const struct dictio
179    
180    *vars = NULL;    *vars = NULL;
181    *var_cnt = 0;    *var_cnt = 0;
182      if (saw_direction != NULL)
183        *saw_direction = false;
184    
185    do    do
186      {      {
# Line 202  sort_parse_criteria (const struct dictio Line 209  sort_parse_criteria (const struct dictio
209                msg (SE, _("`)' expected."));                msg (SE, _("`)' expected."));
210                goto error;                goto error;
211              }              }
212              *saw_direction = true;
213          }          }
214        else        else
215          direction = SRT_ASCEND;          direction = SRT_ASCEND;

Legend:
Removed from v.1.24  
changed lines
  Added in v.1.25

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26