From: Ben Pfaff Date: Sat, 6 May 2006 20:27:23 +0000 (+0000) Subject: Continue reforming procedure execution. In this phase, remove PROCESS X-Git-Tag: v0.6.0~893 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=38006c9843177b65a2ce9bee47c1a8eeb6243973;p=pspp-builds.git Continue reforming procedure execution. In this phase, remove PROCESS IF, which was deprecated anyway and can be easily simulated with TEMPORARY followed by SELECT IF. --- diff --git a/NEWS b/NEWS index 12f7a23a..1d63e6e8 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,5 @@ PSPP NEWS -- history of user-visible changes. -Time-stamp: <2006-04-03 10:56:18 blp> +Time-stamp: <2006-05-06 13:24:08 blp> Copyright (C) 1996-9, 2000 Free Software Foundation, Inc. See the end for copying conditions. @@ -7,6 +7,9 @@ Please send PSPP bug reports to bug-gnu-pspp@gnu.org. Changes since 0.4.2: + The PROCESS IF command, which was deprecated, has been removed. You + may replace any usage of it by SELECT IF following TEMPORARY, which + has the same effect. Changes since 0.4.0 to 0.4.1: diff --git a/TODO b/TODO index 089bbdde..2b234028 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,4 @@ -Time-stamp: <2006-05-06 11:03:32 blp> +Time-stamp: <2006-05-06 11:38:03 blp> Procedure processing: @@ -6,7 +6,7 @@ Procedure processing: * LAG need not be as much of a special case. -* Push PROCESS IF, FILTER, N OF CASES out of procedure.c. +* Push FILTER, N OF CASES out of procedure.c. * Change sources into state machines? @@ -86,7 +86,7 @@ For each case we read from the input program: 3. Write case to replacement active file. 4. Execute temporary transformations. If these drop the case, stop. 5. Post-TEMPORARY N OF CASES. If we have already analyzed N cases, stop. -6. FILTER, PROCESS IF. If these drop the case, stop. +6. FILTER. If this drops the case, stop. 7. Pass case to procedure. Ugly cases: @@ -98,7 +98,7 @@ procedure. When output goes to the active file, step 3 should be skipped, because AGGREGATE creates its own case sink and writes to it in step 7. Also, TEMPORARY has no effect and we just cancel it. Regardless of direction of output, we should not implement AGGREGATE through a transformation because that -will fail to honor FILTER, PROCESS IF, N OF CASES. +will fail to honor FILTER, N OF CASES. ADD FILES: Essentially an input program. It silently cancels unclosed LOOPs and DO IFs. If the active file is used for input, then runs EXECUTE (if there @@ -147,14 +147,6 @@ FILTER * Before TEMPORARY, selection is permanent. After TEMPORARY, selection stops after a procedure. -PROCESS IF - - * Always selects cases sent to the procedure. - - * No effect on cases sent to sink. - - * Always stops after a procedure. - SPLIT FILE * Ignored by AGGREGATE. Used when procedures write matrices. @@ -180,7 +172,7 @@ TEMPORARY * RENAME VARIABLES is invalid after TEMPORARY. - * WEIGHT, SPLIT FILE, N OF CASES, FILTER, PROCESS IF apply only to + * WEIGHT, SPLIT FILE, N OF CASES, FILTER apply only to the next procedure when used after TEMPORARY. WEIGHT diff --git a/doc/data-selection.texi b/doc/data-selection.texi index 4b6a748d..d7f4c79f 100644 --- a/doc/data-selection.texi +++ b/doc/data-selection.texi @@ -7,7 +7,6 @@ select data records from the active file for analysis. @menu * FILTER:: Exclude cases based on a variable. * N OF CASES:: Limit the size of the active file. -* PROCESS IF:: Temporarily excluding cases. * SAMPLE:: Select a specified proportion of cases. * SELECT IF:: Permanently delete selected cases. * SPLIT FILE:: Do multiple analyses with one command. @@ -44,7 +43,7 @@ case filtering continues until it is explicitly turned off with @code{FILTER OFF}. However, if @cmd{FILTER} is placed after TEMPORARY, it filters only the next procedure or procedure-like command. -@node N OF CASES, PROCESS IF, FILTER, Data Selection +@node N OF CASES @section N OF CASES @vindex N OF CASES @@ -70,7 +69,7 @@ specify a very high number: 100000 or whatever you think is large enough.) Transformation procedures performed after @cmd{N} is executed @emph{do} cause cases to be discarded. -@cmd{SAMPLE}, @cmd{PROCESS IF}, and @cmd{SELECT IF} have +@cmd{SAMPLE} and @cmd{SELECT IF} have precedence over @cmd{N}---the same results are obtained by both of the following fragments, given the same random number seeds: @@ -98,41 +97,7 @@ case count estimates. When @cmd{N} is specified after @cmd{TEMPORARY}, it affects only the next procedure (@pxref{TEMPORARY}). -@node PROCESS IF, SAMPLE, N OF CASES, Data Selection -@section PROCESS IF -@vindex PROCESS IF - -@example -PROCESS IF expression. -@end example - -@cmd{PROCESS IF} temporarily eliminates cases from the -data stream. Its effects are active only through the execution of the -next procedure or procedure-like command. - -Specify a boolean expression (@pxref{Expressions}). If the value of the -expression is true for a particular case, the case will be analyzed. If -the expression has a false or missing value, then the case will be -deleted from the data stream for this procedure only. - -Regardless of its placement relative to other commands, @cmd{PROCESS IF} -always takes effect immediately before data passes to the procedure. -Only one @cmd{PROCESS IF} command may be in effect at any given time. - -The effects of @cmd{PROCESS IF} are similar, but not identical, to the -effects of executing @cmd{TEMPORARY}, then @cmd{SELECT IF} -(@pxref{SELECT IF}). - -The filtering performed by @cmd{PROCESS IF} takes place immediately -before cases pass to a procedure for analysis. Because @cmd{PROCESS -IF} affects only a single procedure, its placement relative to -@cmd{TEMPORARY} is unimportant. - -@cmd{PROCESS IF} is deprecated. It is included for compatibility with -old command files. New syntax files should use @cmd{SELECT IF} or -@cmd{FILTER} instead. - -@node SAMPLE, SELECT IF, PROCESS IF, Data Selection +@node SAMPLE @section SAMPLE @vindex SAMPLE diff --git a/pspp-mode.el b/pspp-mode.el index e28ce3ce..2fd5d3fc 100644 --- a/pspp-mode.el +++ b/pspp-mode.el @@ -389,7 +389,6 @@ "PRINT FORMATS" "PRINT SPACE" "PROCEDURE OUTPUT" - "PROCESS IF" "PROXIMITIES" "Q" "QUICK CLUSTER" diff --git a/src/data/ChangeLog b/src/data/ChangeLog index a27bf63b..8c99a54c 100644 --- a/src/data/ChangeLog +++ b/src/data/ChangeLog @@ -1,3 +1,17 @@ +Sat May 6 12:38:55 2006 Ben Pfaff + + Continue reforming procedure execution. In this phase, remove + PROCESS IF, which was deprecated anyway and can be easily + simulated with TEMPORARY followed by SELECT IF. + + * procedure.c: (open_active_file) Don't call + add_process_if_trns(). + (discard_variables) Get rid of redundant call to + proc_cancel_all_transformations(). + (add_process_if_trns) Removed. + (process_if_trns_proc) Removed. + (process_if_trns_free) Removed. + Sat May 6 10:58:05 2006 Ben Pfaff Continue reforming procedure execution. In this phase, add diff --git a/src/data/procedure.c b/src/data/procedure.c index dde7fcee..4cbb5520 100644 --- a/src/data/procedure.c +++ b/src/data/procedure.c @@ -34,7 +34,6 @@ #include #include #include -#include #include #include #include @@ -94,7 +93,6 @@ static struct ccase *lag_queue; /* Array of n_lag ccase * elements. */ static void add_case_limit_trns (void); static void add_filter_trns (void); -static void add_process_if_trns (void); static bool internal_procedure (bool (*case_func) (const struct ccase *, void *), @@ -220,8 +218,6 @@ internal_procedure (bool (*case_func) (const struct ccase *, void *), && trns_chain_is_empty (permanent_trns_chain)) { n_lag = 0; - expr_free (process_if_expr); - process_if_expr = NULL; dict_set_case_limit (default_dict, 0); dict_clear_vectors (default_dict); return true; @@ -285,7 +281,6 @@ open_active_file (void) { add_case_limit_trns (); add_filter_trns (); - add_process_if_trns (); /* Finalize transformations. */ trns_chain_finalize (cur_trns_chain); @@ -443,8 +438,6 @@ close_active_file (void) free_case_sink (vfm_sink); vfm_sink = NULL; - /* Cancel TEMPORARY, PROCESS IF, FILTER, N OF CASES, vectors, - and get rid of all the transformations. */ dict_clear_vectors (default_dict); permanent_dict = NULL; return proc_cancel_all_transformations (); @@ -677,11 +670,6 @@ discard_variables (void) vfm_source = NULL; proc_cancel_all_transformations (); - - expr_free (process_if_expr); - process_if_expr = NULL; - - proc_cancel_temporary_transformations (); } /* Returns the current set of permanent transformations, @@ -943,40 +931,4 @@ filter_trns_proc (void *filter_var_, return (f != 0.0 && !mv_is_num_missing (&filter_var->miss, f) ? TRNS_CONTINUE : TRNS_DROP_CASE); } - -static trns_proc_func process_if_trns_proc; -static trns_free_func process_if_trns_free; - -/* Adds a temporary transformation to filter data according to - the expression specified on PROCESS IF, if any. */ -static void -add_process_if_trns (void) -{ - if (process_if_expr != NULL) - { - proc_start_temporary_transformations (); - add_transformation (process_if_trns_proc, process_if_trns_free, - process_if_expr); - process_if_expr = NULL; - } -} -/* PROCESS IF transformation. */ -static int -process_if_trns_proc (void *expression_, - struct ccase *c UNUSED, int case_nr UNUSED) - -{ - struct expression *expression = expression_; - return (expr_evaluate_num (expression, c, case_nr) == 1.0 - ? TRNS_CONTINUE : TRNS_DROP_CASE); -} - -/* Frees a PROCESS IF transformation. */ -static bool -process_if_trns_free (void *expression_) -{ - struct expression *expression = expression_; - expr_free (expression); - return true; -} diff --git a/src/data/variable.h b/src/data/variable.h index 0f5bb26d..aad4fe63 100644 --- a/src/data/variable.h +++ b/src/data/variable.h @@ -126,9 +126,6 @@ struct vector int cnt; /* Number of variables. */ }; -/* PROCESS IF expression. */ -extern struct expression *process_if_expr; - struct ccase; void dump_split_vars (const struct ccase *); diff --git a/src/language/ChangeLog b/src/language/ChangeLog index 81997af6..a3d3b20b 100644 --- a/src/language/ChangeLog +++ b/src/language/ChangeLog @@ -1,3 +1,11 @@ +Sat May 6 13:25:25 2006 Ben Pfaff + + Continue reforming procedure execution. In this phase, remove + PROCESS IF, which was deprecated anyway and can be easily + simulated with TEMPORARY followed by SELECT IF. + + * command.def: Removed PROCESS IF. + Mon May 1 18:17:52 2006 Ben Pfaff Further clean up the CMD_* command result codes. diff --git a/src/language/command.def b/src/language/command.def index ab19f220..588b8d78 100644 --- a/src/language/command.def +++ b/src/language/command.def @@ -109,7 +109,6 @@ DEF_CMD (S_DATA, 0, "MEANS", cmd_means) DEF_CMD (S_DATA, 0, "MODIFY VARS", cmd_modify_vars) DEF_CMD (S_DATA, 0, "ONEWAY", cmd_oneway) DEF_CMD (S_DATA, 0, "PEARSON CORRELATIONS", cmd_correlations) -DEF_CMD (S_DATA, 0, "PROCESS IF", cmd_process_if) DEF_CMD (S_DATA, 0, "REGRESSION", cmd_regression) DEF_CMD (S_DATA, 0, "RENAME VARIABLES", cmd_rename_variables) DEF_CMD (S_DATA, 0, "SAMPLE", cmd_sample) diff --git a/src/language/expressions/helpers.h b/src/language/expressions/helpers.h index f5cfb67b..b6157f70 100644 --- a/src/language/expressions/helpers.h +++ b/src/language/expressions/helpers.h @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include diff --git a/src/language/xforms/ChangeLog b/src/language/xforms/ChangeLog index f8dee811..894e2990 100644 --- a/src/language/xforms/ChangeLog +++ b/src/language/xforms/ChangeLog @@ -1,3 +1,13 @@ +Sat May 6 13:25:57 2006 Ben Pfaff + + Continue reforming procedure execution. In this phase, remove + PROCESS IF, which was deprecated anyway and can be easily + simulated with TEMPORARY followed by SELECT IF. + + * select-if.c (cmd_process_if): Removed. + (global var process_if_expr) Removed, along with all references + globally. + Tue Apr 25 13:23:25 2006 Ben Pfaff * select-if.c (cmd_process_if): Use SW instead of MW for warning diff --git a/src/language/xforms/select-if.c b/src/language/xforms/select-if.c index 4666f52d..f5b55ff9 100644 --- a/src/language/xforms/select-if.c +++ b/src/language/xforms/select-if.c @@ -121,33 +121,3 @@ cmd_filter (void) return CMD_SUCCESS; } - -/* Expression on PROCESS IF. */ -struct expression *process_if_expr; - -/* Parses the PROCESS IF command. */ -int -cmd_process_if (void) -{ - struct expression *e; - - e = expr_parse (default_dict, EXPR_BOOLEAN); - if (!e) - return CMD_FAILURE; - - if (token != '.') - { - expr_free (e); - lex_error (_("expecting end of command")); - return CMD_FAILURE; - } - - if (process_if_expr) - { - msg (SW, _("Only last instance of this command is in effect.")); - expr_free (process_if_expr); - } - process_if_expr = e; - - return CMD_SUCCESS; -} diff --git a/src/math/sort.c b/src/math/sort.c index 1d2257b2..310fae9c 100644 --- a/src/math/sort.c +++ b/src/math/sort.c @@ -62,8 +62,6 @@ static void prepare_to_sort_active_file (void) { proc_cancel_temporary_transformations (); - expr_free (process_if_expr); - process_if_expr = NULL; } /* Sorts the active file in-place according to CRITERIA.