[Mistat-cvs] mistat/src menu.c,1.23,1.24 output.c,1.26,1.27 statistics.c,1.30,1.31
Status: Pre-Alpha
Brought to you by:
bikepunk005
|
From: Mike H. B. <bik...@us...> - 2004-05-22 06:33:12
|
Update of /cvsroot/mistat/mistat/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16549/src Modified Files: menu.c output.c statistics.c Log Message: Cleanup of do_stats_choice in menu.c. Asset calls added to statistics.c. Support for different types of descriptive calls added to output.c. Index: statistics.c =================================================================== RCS file: /cvsroot/mistat/mistat/src/statistics.c,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** statistics.c 9 May 2004 15:06:33 -0000 1.30 --- statistics.c 22 May 2004 06:33:02 -0000 1.31 *************** *** 28,32 **** #include <stdlib.h> #include <math.h> /*For pow and sqrt. */ ! #include <libmistat/matrix.h> /*Vector and matrix functions. */ #include <libmistat/descriptives.h> /*Mean. */ --- 28,32 ---- #include <stdlib.h> #include <math.h> /*For pow and sqrt. */ ! #include <assert.h> /* The error checks. */ #include <libmistat/matrix.h> /*Vector and matrix functions. */ #include <libmistat/descriptives.h> /*Mean. */ *************** *** 224,228 **** free_data (int what_to_free) { ! printf ("Freeing the data!\n"); if (what_to_free == 0) --- 224,228 ---- free_data (int what_to_free) { ! assert (what_to_free >= 0 && what_to_free <= 3); if (what_to_free == 0) *************** *** 235,241 **** matrix_ld_free (mldta); else - { printf ("NOT a valid what_to_free!\n"); - } } --- 235,239 ---- Index: output.c =================================================================== RCS file: /cvsroot/mistat/mistat/src/output.c,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** output.c 20 May 2004 16:52:22 -0000 1.26 --- output.c 22 May 2004 06:33:02 -0000 1.27 *************** *** 1,17 **** /* Output formatter and printer for mistat. ! Copyright (C) 2003, 2004 Mike H. Benton Mike H. Benton <bik...@us...>, 2003. ! 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 2 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, write to the Free Software --- 1,17 ---- /* Output formatter and printer for mistat. ! Copyright (C) 2003, 2004 Mike H. Benton Mike H. Benton <bik...@us...>, 2003. ! 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 2 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, write to the Free Software *************** *** 130,134 **** char results_col[11][MROW]; char *p_output; ! int i, im, output_size; long double results[11]; size_t j, k; --- 130,134 ---- char results_col[11][MROW]; char *p_output; ! int i, im, output_size, stop_me; long double results[11]; size_t j, k; *************** *** 152,155 **** --- 152,156 ---- char table_header[] = "\nDescriptive Statistis for"; char table_subheader[] = "Statistics\tValue\n"; + stop_me = 4; /* That is, only do until Sum. */ j = 6; /* Minimum length of results, or can fit "value". */ *************** *** 168,174 **** break; ! stat_test = get_sorted_stats (is_vector, im, results); ! if (stat_test == false) ! break; /* Lets get the title in. Determing how big the variable name is! */ --- 169,179 ---- break; ! if (all_stats == true) ! { ! stat_test = get_sorted_stats (is_vector, im, results); ! if (stat_test == false) ! break; ! stop_me = 10; ! } /* Lets get the title in. Determing how big the variable name is! */ *************** *** 180,184 **** * rasie the value of output_size to match results_col. */ ! for (i = 0; i <= 10; i++) { format_output (results_col[i], results[i]); --- 185,189 ---- * rasie the value of output_size to match results_col. */ ! for (i = 0; i <= stop_me; i++) { format_output (results_col[i], results[i]); *************** *** 202,206 **** sprintf (p_output, "%s %d\n", table_header, v[im] + 1); strcat (p_output, table_subheader); ! for (i = 0; i <= 10; i++) { strcat (p_output, stats_label[i]); --- 207,211 ---- sprintf (p_output, "%s %d\n", table_header, v[im] + 1); strcat (p_output, table_subheader); ! for (i = 0; i <= stop_me; i++) { strcat (p_output, stats_label[i]); *************** *** 271,279 **** /*Main output structure ! Sequence: get table input: regression, descriptive, and so on get length of results ! generate table (all to the sprintf thing) 1. title --- 276,284 ---- /*Main output structure ! Sequence: get table input: regression, descriptive, and so on get length of results ! generate table (all to the sprintf thing) 1. title Index: menu.c =================================================================== RCS file: /cvsroot/mistat/mistat/src/menu.c,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** menu.c 20 May 2004 16:52:22 -0000 1.23 --- menu.c 22 May 2004 06:33:02 -0000 1.24 *************** *** 1,17 **** /* Entry point and handler for the menu system in mistat. ! Copyright (C) 2003, 2004 Mike H. Benton Mike H. Benton <bik...@us...>, 2003. ! 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 2 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, write to the Free Software --- 1,17 ---- /* Entry point and handler for the menu system in mistat. ! Copyright (C) 2003, 2004 Mike H. Benton Mike H. Benton <bik...@us...>, 2003. ! 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 2 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, write to the Free Software *************** *** 25,29 **** #include <stdio.h> /* Various printf and some file stuff (for the moment). */ #include <ctype.h> ! #include <stdlib.h> /* EXIT_FAILURE and malloc stuff. */ #include <string.h> /* Some string minipulations. */ --- 25,29 ---- #include <stdio.h> /* Various printf and some file stuff (for the moment). */ #include <ctype.h> ! #include <stdlib.h> /* EXIT_FAILURE and malloc stuff. */ #include <string.h> /* Some string minipulations. */ *************** *** 33,40 **** #include "menu.h" ! #include "file_ops.h" /* For opening and closing files. */ ! #include "output.h" /* Calls for printing and getting stats. */ ! #include "main.h" /* gl, and flag variables (print_digit,). */ ! #include "system.h" /* Bool use. */ void do_menu_choice (int choice); --- 33,40 ---- #include "menu.h" ! #include "file_ops.h" /* For opening and closing files. */ ! #include "output.h" /* Calls for printing and getting stats. */ ! #include "main.h" /* gl, and flag variables (print_digit,). */ ! #include "system.h" /* Bool use. */ void do_menu_choice (int choice); *************** *** 115,129 **** break; ! case options_menu: ! printf("The OPTIONS menu\n\n"); ! choice = get_choice (options_menu, 0, 8); ! /*Only 1 choice right now!*/ ! print_digit = choice; ! sprintf (temp, "\n\nNumber of sig. digits is now %d\n\n", print_digit); ! strncat (msg, temp, strlen (temp)); ! printf ("%s", msg); ! update_logfile (msg); ! break; case log_menu: --- 115,129 ---- break; ! case options_menu: ! printf ("The OPTIONS menu\n\n"); ! choice = get_choice (options_menu, 0, 8); ! /*Only 1 choice right now! */ ! print_digit = choice; ! sprintf (temp, "\n\nNumber of sig. digits is now %d\n\n", print_digit); ! strncat (msg, temp, strlen (temp)); ! printf ("%s", msg); ! update_logfile (msg); ! break; case log_menu: *************** *** 156,199 **** int i; ! switch (choice) ! { ! ! case descriptives: ! i = 0; ! v[i] = -2; ! while (v[i] <= -2) ! { ! printf ("first get choice\n"); ! v[i] = get_choice (descriptives, 1, columns); ! } ! if (v[i] >= 0) { ! i++; ! ! while (v[i - 1] >= 0) ! { ! v[i] = get_choice (descriptives, 1, columns); ! ! if (v[i] >= -1) ! i++; ! } ! ! verify = output_main (v, descriptives, 0); ! if (verify == false) ! { ! printf ("ERROR: Call to output_main failed!\n\n"); ! break; ! } } ! break; ! case more_descriptives: break; --- 156,192 ---- int i; ! /* Get the variables for input. */ ! i = 0; ! v[i] = -2; ! while (v[i] <= -2) ! { ! v[i] = get_choice (choice, 1, columns); ! } ! if (v[i] >= 0) ! { ! i++; ! while (v[i - 1] >= 0) { ! v[i] = get_choice (choice, 1, columns); ! if (v[i] >= -1) ! i++; } ! } ! else ! return; + /* We have the variables, now onto analysis/output. */ + switch (choice) + { + case descriptives: + case more_descriptives: + verify = output_main (v, choice, 0); break; *************** *** 213,218 **** printf ("ERROR: Invalid stats menu choice in do_stats_choice->%d<-\n", choice); ! exit (EXIT_FAILURE); } } --- 206,217 ---- printf ("ERROR: Invalid stats menu choice in do_stats_choice->%d<-\n", choice); ! break; } + + if (verify == false) + { + printf ("ERROR: Call to output_main failed!\n\n"); + } + } *************** *** 307,310 **** --- 306,310 ---- case descriptives: + case more_descriptives: printf ("\n\nInput variable number (1 to %d)\n", max_choices); break; *************** *** 369,376 **** */ ! /* ! * At this point, only options_menu will allow 0. ! * FIXME: what to really do! ! */ if (digits == 0 && menu_number != options_menu) return digits; /* Return to exit. */ --- 369,376 ---- */ ! /* ! * At this point, only options_menu will allow 0. ! * FIXME: what to really do! ! */ if (digits == 0 && menu_number != options_menu) return digits; /* Return to exit. */ *************** *** 398,401 **** --- 398,402 ---- case descriptives: + case more_descriptives: case simple_regression: digits = digits - 1; |