Encapsulated the static data of procedure.[ch] into a single object, to be
[pspp-builds.git] / src / language / stats / examine.q
index e2bd897a5200f20838959727368e74c691cda686..6b748335fa46d40b723a8236e964f706343a67ea 100644 (file)
@@ -64,9 +64,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    *^variables=custom;
    +total=custom;
    +nototal=custom;
-   +missing=miss:pairwise/!listwise,
-   rep:report/!noreport,
-   incl:include/!exclude;
+   missing=miss:pairwise/!listwise,
+           rep:report/!noreport,
+           incl:include/!exclude;
    +compare=cmp:variables/!groups;
    +percentiles=custom;
    +id=var;
@@ -198,7 +198,7 @@ cmd_examine(void)
   subc_list_double_create(&percentile_list);
   percentile_algorithm = PC_HAVERAGE;
 
-  if ( !parse_examine(&cmd) )
+  if ( !parse_examine(&cmd, NULL) )
     return CMD_FAILURE;
 
   /* If /MISSING=INCLUDE is set, then user missing values are ignored */
@@ -222,7 +222,7 @@ cmd_examine(void)
       subc_list_double_push(&percentile_list, 75);
     }
 
-  ok = multipass_procedure_with_splits (run_examine, &cmd);
+  ok = multipass_procedure_with_splits (current_dataset, run_examine, &cmd);
 
   if ( totals ) 
     {
@@ -423,7 +423,7 @@ list_to_ptile_hash(const subc_list_double *l)
 
 /* Parse the PERCENTILES subcommand */
 static int
-xmn_custom_percentiles(struct cmd_examine *p UNUSED)
+xmn_custom_percentiles(struct cmd_examine *p UNUSED, void *aux UNUSED)
 {
   sbc_percentile = 1;
 
@@ -478,7 +478,7 @@ xmn_custom_percentiles(struct cmd_examine *p UNUSED)
 
 /* TOTAL and NOTOTAL are simple, mutually exclusive flags */
 static int
-xmn_custom_total(struct cmd_examine *p)
+xmn_custom_total(struct cmd_examine *p, void *aux UNUSED)
 {
   if ( p->sbc_nototal ) 
     {
@@ -490,7 +490,7 @@ xmn_custom_total(struct cmd_examine *p)
 }
 
 static int
-xmn_custom_nototal(struct cmd_examine *p)
+xmn_custom_nototal(struct cmd_examine *p, void *aux UNUSED)
 {
   if ( p->sbc_total ) 
     {
@@ -506,17 +506,17 @@ xmn_custom_nototal(struct cmd_examine *p)
 /* Parser for the variables sub command  
    Returns 1 on success */
 static int
-xmn_custom_variables(struct cmd_examine *cmd )
+xmn_custom_variables(struct cmd_examine *cmd, void *aux UNUSED)
 {
   lex_match('=');
 
-  if ((token != T_ID || dict_lookup_var (default_dict, tokid) == NULL)
+  if ((token != T_ID || dict_lookup_var (dataset_dict (current_dataset), tokid) == NULL)
       && token != T_ALL)
     {
       return 2;
     }
   
-  if (!parse_variables (default_dict, &dependent_vars, &n_dependent_vars,
+  if (!parse_variables (dataset_dict (current_dataset), &dependent_vars, &n_dependent_vars,
                        PV_NO_DUPLICATE | PV_NUMERIC | PV_NO_SCRATCH) )
     {
       free (dependent_vars);
@@ -550,7 +550,7 @@ examine_parse_independent_vars(struct cmd_examine *cmd)
   int success;
   struct factor *sf = xmalloc (sizeof *sf);
 
-  if ((token != T_ID || dict_lookup_var (default_dict, tokid) == NULL)
+  if ((token != T_ID || dict_lookup_var (dataset_dict (current_dataset), tokid) == NULL)
       && token != T_ALL)
     {
       free ( sf ) ;
@@ -566,7 +566,7 @@ examine_parse_independent_vars(struct cmd_examine *cmd)
 
       lex_match(T_BY);
 
-      if ((token != T_ID || dict_lookup_var (default_dict, tokid) == NULL)
+      if ((token != T_ID || dict_lookup_var (dataset_dict (current_dataset), tokid) == NULL)
          && token != T_ALL)
        {
          free ( sf ) ;
@@ -618,7 +618,7 @@ void populate_summary(struct tab_table *t, int col, int row,
 
 
 
-static int bad_weight_warn = 1;
+static bool bad_weight_warn = true;
 
 
 /* Perform calculations for the sub factors */
@@ -717,7 +717,7 @@ run_examine(const struct ccase *first, const struct casefile *cf, void *cmd_ )
       const int case_no = casereader_cnum(r);
 
       const double weight = 
-       dict_get_case_weight(default_dict, &c, &bad_weight_warn);
+       dict_get_case_weight(dataset_dict (current_dataset), &c, &bad_weight_warn);
 
       if ( cmd->miss == XMN_LISTWISE ) 
        {