From 767a4e133dc7fc0f6e6b9cd8d115a4f5284f1a1b Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Tue, 31 Mar 2009 22:00:44 -0700 Subject: [PATCH] Delete CORRELATIONS skeletal parser. This code didn't do anything useful, it just parsed syntax. We can resurrect it when someone wants to implement CORRELATIONS later. --- src/language/stats/automake.mk | 1 - src/language/stats/correlations.q | 179 ------------------------------ 2 files changed, 180 deletions(-) delete mode 100644 src/language/stats/correlations.q diff --git a/src/language/stats/automake.mk b/src/language/stats/automake.mk index cb65e087..5aee445c 100644 --- a/src/language/stats/automake.mk +++ b/src/language/stats/automake.mk @@ -3,7 +3,6 @@ AM_CPPFLAGS += -I$(top_srcdir)/src/language/stats src_language_stats_built_sources = \ - src/language/stats/correlations.c \ src/language/stats/crosstabs.c \ src/language/stats/examine.c \ src/language/stats/frequencies.c \ diff --git a/src/language/stats/correlations.q b/src/language/stats/correlations.q deleted file mode 100644 index 5d543098..00000000 --- a/src/language/stats/correlations.q +++ /dev/null @@ -1,179 +0,0 @@ -/* PSPP - a program for statistical analysis. - Copyright (C) 1997-9, 2000 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "xalloc.h" - -/* (headers) */ - -struct cor_set - { - struct cor_set *next; - const struct variable **v1, **v2; - size_t nv1, nv2; - }; - -static struct cor_set *cor_list, *cor_last; - -static struct file_handle *matrix_file; - -static void free_correlations_state (void); -static int internal_cmd_correlations (struct lexer *lexer, struct dataset *ds); - -int -cmd_correlations (struct lexer *lexer, struct dataset *ds) -{ - int result = internal_cmd_correlations (lexer, ds); - free_correlations_state (); - return result; -} - -/* (specification) - "CORRELATIONS" (cor_): - *variables=custom; - missing=miss:!pairwise/listwise, - inc:include/exclude; - +print=tail:!twotail/onetail, - sig:!sig/nosig; - +format=fmt:!matrix/serial; - +matrix=custom; - +statistics[st_]=descriptives,xprod,all. -*/ -/* (declarations) */ -/* (functions) */ - -int -internal_cmd_correlations (struct lexer *lexer, struct dataset *ds) -{ - struct cmd_correlations cmd; - - cor_list = cor_last = NULL; - matrix_file = NULL; - - if (!parse_correlations (lexer, ds, &cmd, NULL)) - { - fh_unref (matrix_file); - return CMD_FAILURE; - } - - free_correlations (&cmd); - fh_unref (matrix_file); - - return CMD_SUCCESS; -} - -static int -cor_custom_variables (struct lexer *lexer, struct dataset *ds, struct cmd_correlations *cmd UNUSED, void *aux UNUSED) -{ - const struct variable **v1, **v2; - size_t nv1, nv2; - struct cor_set *cor; - - /* Ensure that this is a VARIABLES subcommand. */ - if (!lex_match_id (lexer, "VARIABLES") - && (lex_token (lexer) != T_ID || dict_lookup_var (dataset_dict (ds), lex_tokid (lexer)) != NULL) - && lex_token (lexer) != T_ALL) - return 2; - lex_match (lexer, '='); - - if (!parse_variables_const (lexer, dataset_dict (ds), &v1, &nv1, - PV_NO_DUPLICATE | PV_NUMERIC)) - return 0; - - if (lex_match (lexer, T_WITH)) - { - if (!parse_variables_const (lexer, dataset_dict (ds), &v2, &nv2, - PV_NO_DUPLICATE | PV_NUMERIC)) - { - free (v1); - return 0; - } - } - else - { - nv2 = nv1; - v2 = v1; - } - - cor = xmalloc (sizeof *cor); - cor->next = NULL; - cor->v1 = v1; - cor->v2 = v2; - cor->nv1 = nv1; - cor->nv2 = nv2; - if (cor_list) - cor_last = cor_last->next = cor; - else - cor_list = cor_last = cor; - - return 1; -} - -static int -cor_custom_matrix (struct lexer *lexer, struct dataset *ds UNUSED, struct cmd_correlations *cmd UNUSED, void *aux UNUSED) -{ - if (!lex_force_match (lexer, '(')) - return 0; - - if (lex_match (lexer, '*')) - matrix_file = NULL; - else - { - fh_unref (matrix_file); - matrix_file = fh_parse (lexer, FH_REF_FILE); - if (matrix_file == NULL) - return 0; - } - - if (!lex_force_match (lexer, ')')) - return 0; - - return 1; -} - -static void -free_correlations_state (void) -{ - struct cor_set *cor, *next; - - for (cor = cor_list; cor != NULL; cor = next) - { - next = cor->next; - if (cor->v1 != cor->v2) - free (cor->v2); - free (cor->v1); - free (cor); - } -} - -/* - Local Variables: - mode: c - End: -*/ -- 2.30.2