[Mistat-cvs] mistat/src error.c,1.9,1.10 file_ops.c,1.11,1.12 file_ops.h,1.10,1.11 main.c,1.14,1.15
Status: Pre-Alpha
Brought to you by:
bikepunk005
|
From: Mike H. B. <bik...@us...> - 2004-05-29 19:59:36
|
Update of /cvsroot/mistat/mistat/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30640/src Modified Files: error.c file_ops.c file_ops.h main.c main.h menu.c output.c output.h statistics.c system.h Log Message: Variable name cleanup. Added multiple vars for sorted stats in statistics.c. Index: statistics.c =================================================================== RCS file: /cvsroot/mistat/mistat/src/statistics.c,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** statistics.c 29 May 2004 18:22:23 -0000 1.32 --- statistics.c 29 May 2004 19:59:23 -0000 1.33 *************** *** 38,42 **** #include "main.h" /*Use of data file name from main. */ - #include "output.h" /*Use of NUM_VARS. */ /* Set up the matrix and vector variables.*/ --- 38,41 ---- *************** *** 95,104 **** if (Data_Type[for_type] == INT_DATA) { ! results[0] = mean_int_vector (vta, index, nrows, &sum); ! results[1] = var_int_vector (vta, &results[0], index, nrows); results[2] = ! skewness_int_vector (vta, &results[1], &results[0], nrows); results[3] = ! kurtosis_int_vector (vta, &results[1], &results[0], nrows); results[4] = sum; results[1] = sqrt (results[1]); --- 94,103 ---- if (Data_Type[for_type] == INT_DATA) { ! results[0] = mean_int_vector (vta, index, Nrows, &sum); ! results[1] = var_int_vector (vta, &results[0], index, Nrows); results[2] = ! skewness_int_vector (vta, &results[1], &results[0], Nrows); results[3] = ! kurtosis_int_vector (vta, &results[1], &results[0], Nrows); results[4] = sum; results[1] = sqrt (results[1]); *************** *** 107,116 **** else if (Data_Type[for_type] == FLOAT_DATA) { ! results[0] = mean_ld_vector (vldta, index, nrows, &ld_sum); ! results[1] = var_ld_vector (vldta, &results[0], index, nrows); results[2] = ! skewness_ld_vector (vldta, &results[1], &results[0], nrows); results[3] = ! kurtosis_ld_vector (vldta, &results[1], &results[0], nrows); results[4] = ld_sum; results[1] = sqrt (results[1]); --- 106,115 ---- else if (Data_Type[for_type] == FLOAT_DATA) { ! results[0] = mean_ld_vector (vldta, index, Nrows, &ld_sum); ! results[1] = var_ld_vector (vldta, &results[0], index, Nrows); results[2] = ! skewness_ld_vector (vldta, &results[1], &results[0], Nrows); results[3] = ! kurtosis_ld_vector (vldta, &results[1], &results[0], Nrows); results[4] = ld_sum; results[1] = sqrt (results[1]); *************** *** 129,138 **** if (Data_Type[for_type] == INT_DATA) { ! results[0] = mean_int_matrix (mta, index, nrows, &sum); ! results[1] = var_int_matrix (mta, &results[0], index, nrows); results[2] = ! skewness_int_matrix (mta, index, &results[1], &results[0], nrows); results[3] = ! kurtosis_int_matrix (mta, index, &results[1], &results[0], nrows); results[4] = sum; results[1] = sqrt (results[1]); --- 128,137 ---- if (Data_Type[for_type] == INT_DATA) { ! results[0] = mean_int_matrix (mta, index, Nrows, &sum); ! results[1] = var_int_matrix (mta, &results[0], index, Nrows); results[2] = ! skewness_int_matrix (mta, index, &results[1], &results[0], Nrows); results[3] = ! kurtosis_int_matrix (mta, index, &results[1], &results[0], Nrows); results[4] = sum; results[1] = sqrt (results[1]); *************** *** 141,152 **** else if (Data_Type[for_type] == FLOAT_DATA) { ! results[0] = mean_ld_matrix (mldta, index, nrows, &ld_sum); ! results[1] = var_ld_matrix (mldta, &results[0], index, nrows); results[2] = skewness_ld_matrix (mldta, index, &results[1], &results[0], ! nrows); results[3] = kurtosis_ld_matrix (mldta, index, &results[1], &results[0], ! nrows); results[4] = ld_sum; results[1] = sqrt (results[1]); --- 140,151 ---- else if (Data_Type[for_type] == FLOAT_DATA) { ! results[0] = mean_ld_matrix (mldta, index, Nrows, &ld_sum); ! results[1] = var_ld_matrix (mldta, &results[0], index, Nrows); results[2] = skewness_ld_matrix (mldta, index, &results[1], &results[0], ! Nrows); results[3] = kurtosis_ld_matrix (mldta, index, &results[1], &results[0], ! Nrows); results[4] = ld_sum; results[1] = sqrt (results[1]); *************** *** 173,191 **** if (is_vector) /*Process vector data. */ { ! results[5] = vector_int_min (vta); ! results[6] = vector_int_max (vta); ! q_sort_int_vector (vta, 1, nrows); ! results[7] = median_int_vector (vta, nrows); ! quartiles_int_vector (vta, nrows, &results[8], &results[9]); } else /*We have a matrix. */ { ! results[5] = matrix_int_min (mta, index); ! results[6] = matrix_int_max (mta, index); ! q_sort_int_matrix (mta, index, 1, nrows); ! results[7] = median_int_matrix (mta, index, nrows); ! quartiles_int_matrix (mta, index, nrows, &results[8], &results[9]); } --- 172,226 ---- if (is_vector) /*Process vector data. */ { ! if (Data_Type[for_type] == INT_DATA) ! { ! ! results[5] = vector_int_min (vta); ! results[6] = vector_int_max (vta); ! q_sort_int_vector (vta, 1, Nrows); ! results[7] = median_int_vector (vta, Nrows); ! quartiles_int_vector (vta, Nrows, &results[8], &results[9]); ! } ! ! else if (Data_Type[for_type] == FLOAT_DATA) ! { ! results[5] = vector_ld_min (vldta); ! results[6] = vector_ld_max (vldta); ! q_sort_ld_vector (vldta, 1, Nrows); ! results[7] = median_ld_vector (vldta, Nrows); ! quartiles_ld_vector (vldta, Nrows, &results[8], &results[9]); ! } ! ! else ! { ! printf ("ERROR: wrong data type for vector in get_mean.\n"); ! return false; ! } } else /*We have a matrix. */ { + if (Data_Type[for_type] == INT_DATA) + { + results[5] = matrix_int_min (mta, index); + results[6] = matrix_int_max (mta, index); + q_sort_int_matrix (mta, index, 1, Nrows); + results[7] = median_int_matrix (mta, index, Nrows); + quartiles_int_matrix (mta, index, Nrows, &results[8], &results[9]); + } ! else if (Data_Type[for_type] == FLOAT_DATA) ! { ! results[5] = matrix_ld_min (mldta, index); ! results[6] = matrix_ld_max (mldta, index); ! q_sort_ld_matrix (mldta, index, 1, Nrows); ! results[7] = median_ld_matrix (mldta, index, Nrows); ! quartiles_ld_matrix (mldta, index, Nrows, &results[8], &results[9]); ! } ! ! else ! { ! printf ("ERROR: wrong data type for matrix in get_mean.\n"); ! return false; ! } } *************** *** 211,215 **** if (Data_Type[var_column] == INT_DATA) { ! vta = vector_int_calloc (nrows); if (vta == NULL) --- 246,250 ---- if (Data_Type[var_column] == INT_DATA) { ! vta = vector_int_calloc (Nrows); if (vta == NULL) *************** *** 223,227 **** else if (Data_Type[var_column] == FLOAT_DATA) { ! vldta = vector_ld_calloc (nrows); if (vldta == NULL) --- 258,262 ---- else if (Data_Type[var_column] == FLOAT_DATA) { ! vldta = vector_ld_calloc (Nrows); if (vldta == NULL) *************** *** 240,248 **** /*Fill t with data. */ ! getit (data_file, var_column, t); /*Put t into a vector. */ ! while (i < nrows) { if (Data_Type[var_column] == INT_DATA) --- 275,283 ---- /*Fill t with data. */ ! getit (Data_File, var_column, t); /*Put t into a vector. */ ! while (i < Nrows) { if (Data_Type[var_column] == INT_DATA) *************** *** 274,278 **** if (type == true) { ! mta = matrix_int_calloc (nrows, how_much); if (mta == NULL) --- 309,313 ---- if (type == true) { ! mta = matrix_int_calloc (Nrows, how_much); if (mta == NULL) *************** *** 286,290 **** else { ! mldta = matrix_ld_calloc (nrows, how_much); if (mldta == NULL) --- 321,325 ---- else { ! mldta = matrix_ld_calloc (Nrows, how_much); if (mldta == NULL) *************** *** 301,308 **** temp = x[i]; ! getit (data_file, temp, t); c = 0; ! while (c < nrows) { if (type == true) --- 336,343 ---- temp = x[i]; ! getit (Data_File, temp, t); c = 0; ! while (c < Nrows) { if (type == true) Index: output.c =================================================================== RCS file: /cvsroot/mistat/mistat/src/output.c,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** output.c 29 May 2004 18:22:23 -0000 1.28 --- output.c 29 May 2004 19:59:23 -0000 1.29 *************** *** 34,44 **** - - #include "output.h" #include "statistics.h" /* Calls to statistical routines. */ #include "main.h" /* Flag variables (print_digits). */ #include "menu.h" /* Enumeration values, and MAX_VAR_INPUT. */ ! #include "file_ops.h" /* Sending data to the logfile. */ #include "system.h" /* Bool and config.h calls. */ --- 34,42 ---- #include "output.h" #include "statistics.h" /* Calls to statistical routines. */ #include "main.h" /* Flag variables (print_digits). */ #include "menu.h" /* Enumeration values, and MAX_VAR_INPUT. */ ! #include "file_ops.h" /* Sending data to the Log_File. */ #include "system.h" /* Bool and config.h calls. */ *************** *** 53,58 **** * Variables */ ! bool FLAG_VECTOR; /* Vector or matrix (number of variables = 1). */ ! int NUM_VARS; /* Number of variables for analysis. */ extern GetLine *gl; /* The getline variable for libtecla. */ int count_int, count_ld; /* Counts of respective types for making a matrix. */ --- 51,57 ---- * Variables */ ! bool Flag_Vector; /* Vector or matrix (number of variables = 1). */ ! /* FIXME: Consider makeing local and passing. */ ! int Num_Vars; /* Number of variables for analysis. */ extern GetLine *gl; /* The getline variable for libtecla. */ int count_int, count_ld; /* Counts of respective types for making a matrix. */ *************** *** 61,64 **** --- 60,64 ---- * Functions */ + bool setup_data (int vect_var[], int int_vars[], int ld_vars[]); /* Determine what to make (matrix/vector) and ask to make. */ bool desc (bool all_stats, int v[], int matrix_int_vars[], int matrix_ld_vars[]); /* Print descriptive tables. */ void format_output (char *input, double value); /* Adjust for number of sig digits. */ *************** *** 74,82 **** assert (routine >= 100 && routine <= 103); ! FLAG_VECTOR = true; /* Default is just true because most people will just look at one variable:D */ ! NUM_VARS = count_int = count_ld = 0; ! ! /* FIXME: do something with stats_to_do! */ ! i = stats_to_do; /* Double check to make sure we have something. */ --- 74,79 ---- assert (routine >= 100 && routine <= 103); ! Flag_Vector = true; /* Default is just true because most people will just look at one variable:D */ ! Num_Vars = count_int = count_ld = 0; /* Double check to make sure we have something. */ *************** *** 85,94 **** return true; ! /* ! * See if we have one, or more than one variable. ! * Also, setups number of variable types. ! * An alternate to v is made for printing variable names. This is to accomdated for different types. ! * Basically, and index for cross-reference will be made for makeing output. ! */ while (v[i] >= 0) { --- 82,91 ---- return true; ! /* ! * See if we have one, or more than one variable. ! * Also, setups number of variable types. ! * An alternate to v is made for printing variable names. This is to accommodate for different types. ! * Basically, and index for cross-reference will be made for making output. ! */ while (v[i] >= 0) { *************** *** 105,109 **** i++; ! NUM_VARS++; } --- 102,106 ---- i++; ! Num_Vars++; } *************** *** 111,117 **** /* Lets make a vector or matrix. */ ! if (NUM_VARS == 1) /* Vector is simple! Just up and go. */ { ! verify = stats_main (v, true, true, count_int); if (verify == false) --- 108,145 ---- /* Lets make a vector or matrix. */ ! verify = setup_data (v, ct_int, ct_ld); ! if (verify == false) ! return verify; ! ! /*Now we can go on to the analysis. */ ! switch (routine) { ! case descriptives: ! verify = desc (false, v, ct_int, ct_ld); ! break; ! ! case more_descriptives: ! verify = desc (true, v, ct_int, ct_ld); ! break; ! ! default: ! printf ("ERROR: Invalid routine in output_main\n"); ! return false; ! } ! ! /* All finished so free up the matrix/vector. */ ! free_which_data (v); ! return true; ! ! } ! ! bool ! setup_data (int vect_var[], int int_vars[], int ld_vars[]) ! { ! bool verify; ! ! if (Num_Vars == 1) /* Vector is simple! Just up and go. */ ! { ! verify = stats_main (vect_var, true, true, count_int); if (verify == false) *************** *** 124,132 **** else /* A bit complicated (too complicated?). But, make relevant matrix/vectors. */ { ! FLAG_VECTOR = false; if (count_int >= 1) { ! verify = stats_main (ct_int, false, true, count_int); if (verify == false) { --- 152,160 ---- else /* A bit complicated (too complicated?). But, make relevant matrix/vectors. */ { ! Flag_Vector = false; if (count_int >= 1) { ! verify = stats_main (int_vars, false, true, count_int); if (verify == false) { *************** *** 138,142 **** if (count_ld >= 1) { ! verify = stats_main (ct_ld, false, false, count_ld); if (verify == false) { --- 166,170 ---- if (count_ld >= 1) { ! verify = stats_main (ld_vars, false, false, count_ld); if (verify == false) { *************** *** 147,169 **** } - - /*Now we can go on to the analysis. */ - switch (routine) - { - case descriptives: - verify = desc (false, v, ct_int, ct_ld); - break; - - case more_descriptives: - verify = desc (true, v, ct_int, ct_ld); - break; - - default: - printf ("ERROR: Invalid routine in output_main\n"); - return false; - } - - /* All finished so free up the matrix/vector. */ - free_which_data (v); return true; --- 175,178 ---- *************** *** 209,218 **** * Loop through the variables, and print output. */ ! for (im = 0; im <= NUM_VARS - 1; im++) { /* Get the stats. */ ! if (FLAG_VECTOR) /* Vector for analysis. */ { ! stat_test = get_mean (FLAG_VECTOR, im, im, results); if (stat_test == false) return false; --- 218,227 ---- * Loop through the variables, and print output. */ ! for (im = 0; im <= Num_Vars - 1; im++) { /* Get the stats. */ ! if (Flag_Vector) /* Vector for analysis. */ { ! stat_test = get_mean (Flag_Vector, im, im, results); if (stat_test == false) return false; *************** *** 220,224 **** if (all_stats == true) { ! stat_test = get_sorted_stats (FLAG_VECTOR, im, im, results); if (stat_test == false) return false; --- 229,233 ---- if (all_stats == true) { ! stat_test = get_sorted_stats (Flag_Vector, im, im, results); if (stat_test == false) return false; *************** *** 233,237 **** if (num_ld < count_ld) { ! stat_test = get_mean (FLAG_VECTOR, matrix_ld_vars[num_ld], num_ld, results); if (stat_test == false) return false; --- 242,248 ---- if (num_ld < count_ld) { ! stat_test = ! get_mean (Flag_Vector, matrix_ld_vars[num_ld], num_ld, ! results); if (stat_test == false) return false; *************** *** 239,271 **** { stat_test = ! get_sorted_stats (FLAG_VECTOR, matrix_ld_vars[num_ld], num_ld, results); ! if (stat_test == false) return false; ! stop_me = 10; } ! offset = matrix_ld_vars[num_ld]; num_ld++; } ! else if (num_int < count_int) { ! stat_test = get_mean (FLAG_VECTOR, matrix_int_vars[num_int], num_int, results); if (stat_test == false) return false; ! if (all_stats == true) { stat_test = ! get_sorted_stats (FLAG_VECTOR, matrix_int_vars[num_int], num_int, results); ! if (stat_test == false) return false; ! stop_me = 10; } ! offset = matrix_int_vars[num_int]; num_int++; --- 250,286 ---- { stat_test = ! get_sorted_stats (Flag_Vector, matrix_ld_vars[num_ld], ! num_ld, results); ! if (stat_test == false) return false; ! stop_me = 10; } ! offset = matrix_ld_vars[num_ld]; num_ld++; } ! else if (num_int < count_int) { ! stat_test = ! get_mean (Flag_Vector, matrix_int_vars[num_int], num_int, ! results); if (stat_test == false) return false; ! if (all_stats == true) { stat_test = ! get_sorted_stats (Flag_Vector, matrix_int_vars[num_int], ! num_int, results); ! if (stat_test == false) return false; ! stop_me = 10; } ! offset = matrix_int_vars[num_int]; num_int++; *************** *** 273,277 **** } ! /* Lets get the title in. Determing how big the variable name is! */ /* Pad for log, space, and \n. */ output_size += sizeof (table_subheader) + log (offset + 1) + 3; --- 288,292 ---- } ! /* Lets get the title in. Determine how big the variable name is! */ /* Pad for log, space, and \n. */ output_size += sizeof (table_subheader) + log (offset + 1) + 3; *************** *** 279,283 **** /* * Populate the results_col for sig digits. Also, ! * rasie the value of output_size to match results_col. */ for (i = 0; i <= stop_me; i++) --- 294,298 ---- /* * Populate the results_col for sig digits. Also, ! * raise the value of output_size to match results_col. */ for (i = 0; i <= stop_me; i++) *************** *** 325,331 **** format_output (char *input, double value) { ! assert (print_digit >= 0 && print_digit <= 8); ! switch (print_digit) { --- 340,346 ---- format_output (char *input, double value) { ! assert (Print_Digit >= 0 && Print_Digit <= 8); ! switch (Print_Digit) { *************** *** 367,371 **** default: ! printf ("ERROR: not a valid print_digit in format_output!\n\n"); break; } --- 382,386 ---- default: ! printf ("ERROR: not a valid Print_Digit in format_output!\n\n"); break; } *************** *** 377,381 **** { int i; ! if (FLAG_VECTOR) { i = v[0]; --- 392,396 ---- { int i; ! if (Flag_Vector) { i = v[0]; Index: file_ops.h =================================================================== RCS file: /cvsroot/mistat/mistat/src/file_ops.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** file_ops.h 29 May 2004 18:22:23 -0000 1.10 --- file_ops.h 29 May 2004 19:59:23 -0000 1.11 *************** *** 19,23 **** */ /*file_ops.h*/ ! /*USAGE: Doing anything with a file, also when using nrows or columns.*/ #ifndef FILE_OPS_H #define FILE_OPS_H --- 19,23 ---- */ /*file_ops.h*/ ! /*USAGE: Doing anything with a file, also when using Nrows or Columns.*/ #ifndef FILE_OPS_H #define FILE_OPS_H *************** *** 52,57 **** * Extern data */ ! extern int nrows; /*number of rows in data file */ ! extern int columns; /*number of columns in a data file */ /* * Data_Type is an array containing the type of data for each respective variable. --- 52,57 ---- * Extern data */ ! extern int Nrows; /*number of rows in data file */ ! extern int Columns; /*number of columns in a data file */ /* * Data_Type is an array containing the type of data for each respective variable. Index: main.h =================================================================== RCS file: /cvsroot/mistat/mistat/src/main.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** main.h 29 May 2004 18:22:23 -0000 1.11 --- main.h 29 May 2004 19:59:23 -0000 1.12 *************** *** 38,46 **** * Extern data */ ! FILE *data_file; ! FILE *logfile; ! extern int print_digit; ! extern char *ptr_data_file_name; ! extern char data_file_name[]; #endif --- 38,45 ---- * Extern data */ ! FILE *Data_File; ! FILE *Log_File; ! extern int Print_Digit; ! extern char Data_File_Name[]; #endif Index: file_ops.c =================================================================== RCS file: /cvsroot/mistat/mistat/src/file_ops.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** file_ops.c 29 May 2004 18:22:23 -0000 1.11 --- file_ops.c 29 May 2004 19:59:23 -0000 1.12 *************** *** 32,37 **** ! int nrows; /*The number of rows in the data file */ ! int columns; /*The number of columns in the data file */ int Data_Type[MAXCOLS]; /* The type of data for each variable. */ --- 32,37 ---- ! int Nrows; /*The number of rows in the data file */ ! int Columns; /*The number of Columns in the data file */ int Data_Type[MAXCOLS]; /* The type of data for each variable. */ *************** *** 107,112 **** temp_fp = file_name; ! nrows = 0; ! columns = 0; if (file_name == NULL) --- 107,112 ---- temp_fp = file_name; ! Nrows = 0; ! Columns = 0; if (file_name == NULL) *************** *** 115,119 **** "\n\nDatafile is not open for some reason?\n\nFatal ERROR: %s\n\n", strerror (errno)); ! nrows = columns = -1; /* Set to -1 for error checks elsewhere. */ } --- 115,119 ---- "\n\nDatafile is not open for some reason?\n\nFatal ERROR: %s\n\n", strerror (errno)); ! Nrows = Columns = -1; /* Set to -1 for error checks elsewhere. */ } *************** *** 123,127 **** { ! if (nrows >= MAXROWS) { fprintf (stderr, --- 123,127 ---- { ! if (Nrows >= MAXROWS) { fprintf (stderr, *************** *** 133,146 **** n = getwords (line, words, MAXCOLS); ! if (columns < n) ! columns = n; ! nrows++; } } printf ! ("\nThere are %d rows (cases)\n\tand %d columns (variables) in the data set\n", ! nrows, columns); } --- 133,146 ---- n = getwords (line, words, MAXCOLS); ! if (Columns < n) ! Columns = n; ! Nrows++; } } printf ! ("\nThere are %d rows (cases)\n\tand %d Columns (variables) in the data set\n", ! Nrows, Columns); } *************** *** 292,298 **** { ! rewind (logfile); printf ("LOGFILE\n\n"); ! printline (logfile); } --- 292,298 ---- { ! rewind (Log_File); printf ("LOGFILE\n\n"); ! printline (Log_File); } *************** *** 319,326 **** update_logfile (char *message) { ! if (log_file_flag) { ! if ((fprintf (logfile, "\n\n")) < 0) { fprintf (stderr, --- 319,326 ---- update_logfile (char *message) { ! if (Log_File_Flag) { ! if ((fprintf (Log_File, "\n\n")) < 0) { fprintf (stderr, *************** *** 330,338 **** } ! fprintf (logfile, "%s", message); /*Only need for Cygwin */ /*Seems to do no harm in Linux */ ! if ((fflush (logfile)) == EOF) { printf ("Unable to flush the logfile!\n"); --- 330,338 ---- } ! fprintf (Log_File, "%s", message); /*Only need for Cygwin */ /*Seems to do no harm in Linux */ ! if ((fflush (Log_File)) == EOF) { printf ("Unable to flush the logfile!\n"); *************** *** 343,347 **** /* ! * Use to read only certain columns. * Fills t[]. Element is column of data set. * Returns to be worked out --- 343,347 ---- /* ! * Use to read only certain Columns. * Fills t[]. Element is column of data set. * Returns to be worked out *************** *** 360,366 **** i = 0; - /*Need to work this up! */ - double_data = false; - if (file_name == NULL) { --- 360,363 ---- *************** *** 374,378 **** { ! rewind (data_file); while (fgetline (temp_fp, line, MAXLINE) != EOF) --- 371,375 ---- { ! rewind (Data_File); while (fgetline (temp_fp, line, MAXLINE) != EOF) Index: output.h =================================================================== RCS file: /cvsroot/mistat/mistat/src/output.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** output.h 20 May 2004 16:52:22 -0000 1.13 --- output.h 29 May 2004 19:59:23 -0000 1.14 *************** *** 44,48 **** * Extern Data */ ! extern int NUM_VARS; /*Number of variables to analyze. */ #endif --- 44,48 ---- * Extern Data */ ! extern int Num_Vars; /*Number of variables to analyze. */ #endif Index: error.c =================================================================== RCS file: /cvsroot/mistat/mistat/src/error.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** error.c 29 May 2004 18:22:23 -0000 1.9 --- error.c 29 May 2004 19:59:23 -0000 1.10 *************** *** 50,54 **** { printf ("\n\n"); ! if (bell) printf ("\a"); printf ("SIGABRT: From abort!%d\n", sig_value); --- 50,54 ---- { printf ("\n\n"); ! if (Bell) printf ("\a"); printf ("SIGABRT: From abort!%d\n", sig_value); *************** *** 60,64 **** { printf ("\n\n"); ! if (bell) printf ("\a"); printf ("SIGFPE: Math error: divide by 0 or overflow! Value: ->%d<-.\n", --- 60,64 ---- { printf ("\n\n"); ! if (Bell) printf ("\a"); printf ("SIGFPE: Math error: divide by 0 or overflow! Value: ->%d<-.\n", *************** *** 71,75 **** { printf ("\n\n"); ! if (bell) printf ("\a"); printf ("SIGILL: Illegal instruction! %d\n", sig_value); --- 71,75 ---- { printf ("\n\n"); ! if (Bell) printf ("\a"); printf ("SIGILL: Illegal instruction! %d\n", sig_value); *************** *** 81,85 **** { printf ("\n\n"); ! if (bell) printf ("\a"); printf ("SIGINT: Interrupt! A ctrl-c!%d\n", sig_value); --- 81,85 ---- { printf ("\n\n"); ! if (Bell) printf ("\a"); printf ("SIGINT: Interrupt! A ctrl-c!%d\n", sig_value); *************** *** 91,95 **** { printf ("\n\n"); ! if (bell) printf ("\a"); printf ("SIGSEGV: invalid access to storage! Value: ->%d<-.\n", sig_value); --- 91,95 ---- { printf ("\n\n"); ! if (Bell) printf ("\a"); printf ("SIGSEGV: invalid access to storage! Value: ->%d<-.\n", sig_value); *************** *** 101,105 **** { printf ("\n\n"); ! if (bell) printf ("\a"); printf ("SIGTERM: Termination request sent!%d\n", sig_value); --- 101,105 ---- { printf ("\n\n"); ! if (Bell) printf ("\a"); printf ("SIGTERM: Termination request sent!%d\n", sig_value); Index: main.c =================================================================== RCS file: /cvsroot/mistat/mistat/src/main.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** main.c 29 May 2004 18:22:23 -0000 1.14 --- main.c 29 May 2004 19:59:23 -0000 1.15 *************** *** 62,70 **** * variables */ ! char logfile_name[] = "mistat.log"; /*Hard code of log file */ static struct gengetopt_args_info args_info; /*command line structure */ ! bool data_file_exist; /*flag to indicate data file can be opened */ ! char data_file_name[MAXFILENAME]; /* Name of data file. */ ! int print_digit; /*Number of digits to print. */ GetLine *gl; /*For libtecla GetLine functions. */ --- 62,70 ---- * variables */ ! char Logfile_Name[] = "mistat.log"; /*Hard code of log file */ static struct gengetopt_args_info args_info; /*command line structure */ ! bool Data_File_Exist; /*flag to indicate data file can be opened */ ! char Data_File_Name[MAXFILENAME]; /* Name of data file. */ ! int Print_Digit; /*Number of digits to print. */ GetLine *gl; /*For libtecla GetLine functions. */ *************** *** 123,140 **** /*Set bell */ ! bell = false; if (!args_info.nobell_flag) { ! bell = true; printf ("\aBell Active\a\n"); } /*Set precision digits */ ! print_digit = 2; if (args_info.digits_arg != 2) { if (args_info.digits_arg >= 0 && args_info.digits_arg <= 8) ! print_digit = args_info.digits_arg; else --- 123,140 ---- /*Set bell */ ! Bell = false; if (!args_info.nobell_flag) { ! Bell = true; printf ("\aBell Active\a\n"); } /*Set precision digits */ ! Print_Digit = 2; if (args_info.digits_arg != 2) { if (args_info.digits_arg >= 0 && args_info.digits_arg <= 8) ! Print_Digit = args_info.digits_arg; else *************** *** 144,160 **** } } ! printf ("Print digit is ->%d<-\n\n", print_digit); /*determine if log_file should be opened */ /*if so, open it! */ ! log_file_flag = false; if (args_info.log_flag) { ! logfile = open_file (logfile_name, 3); ! log_file_flag = true; ! if (logfile == NULL) { printf --- 144,160 ---- } } ! printf ("Print digit is ->%d<-\n\n", Print_Digit); /*determine if log_file should be opened */ /*if so, open it! */ ! Log_File_Flag = false; if (args_info.log_flag) { ! Log_File = open_file (Logfile_Name, 3); ! Log_File_Flag = true; ! if (Log_File == NULL) { printf *************** *** 169,173 **** printf ("\t\tChoose data file from menu or syntax.\n"); args_info.inputs = NULL; ! data_file_exist = false; } --- 169,173 ---- printf ("\t\tChoose data file from menu or syntax.\n"); args_info.inputs = NULL; ! Data_File_Exist = false; } *************** *** 177,181 **** ! return (0); /*This has not meaning at the moment */ } --- 177,181 ---- ! return (0); /*This has no meaning at the moment */ } *************** *** 188,200 **** { /*Handle the input file */ ! /*data_file_exist gets set */ ! data_file_exist = get_data_file (); /*read data file and close */ ! if (data_file_exist) { ! read_data_file (data_file); ! /*file_close (data_file, data_file_name); */ } } --- 188,200 ---- { /*Handle the input file */ ! /*Data_File_Exist gets set */ ! Data_File_Exist = get_data_file (); /*read data file and close */ ! if (Data_File_Exist) { ! read_data_file (Data_File); ! /*file_close (Data_File, Data_File_Name); */ } } *************** *** 217,227 **** { ! strcpy (data_file_name, *args_info.inputs); ! data_file = open_file (data_file_name, 1); ! if (data_file == NULL) { ! data_file_exist = false; printf ("\t\tInput file not found.\n\t\t\tChoose data file from menu or syntax.\n\n"); --- 217,227 ---- { ! strcpy (Data_File_Name, *args_info.inputs); ! Data_File = open_file (Data_File_Name, 1); ! if (Data_File == NULL) { ! Data_File_Exist = false; printf ("\t\tInput file not found.\n\t\t\tChoose data file from menu or syntax.\n\n"); *************** *** 229,236 **** else ! data_file_exist = true; } ! return data_file_exist; } --- 229,236 ---- else ! Data_File_Exist = true; } ! return Data_File_Exist; } *************** *** 248,252 **** /*Close log file before exit */ if (args_info.log_flag) ! file_close (logfile, logfile_name); gl = del_GetLine (gl); --- 248,252 ---- /*Close log file before exit */ if (args_info.log_flag) ! file_close (Log_File, Logfile_Name); gl = del_GetLine (gl); Index: system.h =================================================================== RCS file: /cvsroot/mistat/mistat/src/system.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** system.h 18 Apr 2004 14:02:25 -0000 1.5 --- system.h 29 May 2004 19:59:23 -0000 1.6 *************** *** 49,56 **** * Variables */ ! bool bell; /*Determine to see if sound system bell */ ! bool double_data; ! bool log_file_flag; ! extern bool data_file_exist; #endif --- 49,55 ---- * Variables */ ! bool Bell; /*Determine to see if sound system bell */ ! bool Log_File_Flag; ! extern bool Data_File_Exist; #endif Index: menu.c =================================================================== RCS file: /cvsroot/mistat/mistat/src/menu.c,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** menu.c 29 May 2004 18:22:23 -0000 1.25 --- menu.c 29 May 2004 19:59:23 -0000 1.26 *************** *** 35,40 **** #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); --- 35,40 ---- #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, Data_File_Exist. */ void do_menu_choice (int choice); *************** *** 120,125 **** /*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); --- 120,125 ---- /*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); *************** *** 128,132 **** case log_menu: ! if (log_file_flag) view_log_file (); --- 128,132 ---- case log_menu: ! if (Log_File_Flag) view_log_file (); *************** *** 159,163 **** verify = false; ! if (nrows <= 0 || columns <= 0) /* We need data and variables. */ { printf --- 159,163 ---- verify = false; ! if (Nrows <= 0 || Columns <= 0) /* We need data and variables. */ { printf *************** *** 172,176 **** while (v[i] <= -2) { ! v[i] = get_choice (choice, 1, columns); } --- 172,176 ---- while (v[i] <= -2) { ! v[i] = get_choice (choice, 1, Columns); } *************** *** 181,185 **** while (v[i - 1] >= 0) { ! v[i] = get_choice (choice, 1, columns); if (v[i] >= -1) --- 181,185 ---- while (v[i - 1] >= 0) { ! v[i] = get_choice (choice, 1, Columns); if (v[i] >= -1) *************** *** 238,245 **** /*Close open data file if necessary. */ ! if (data_file_exist) { ! file_close (data_file, data_file_name); ! data_file_exist = false; } --- 238,245 ---- /*Close open data file if necessary. */ ! if (Data_File_Exist) { ! file_close (Data_File, Data_File_Name); ! Data_File_Exist = false; } *************** *** 249,257 **** -1); ! strcpy (data_file_name, temp); /*Determine if user just hit Enter. */ ! if (strlen (data_file_name) <= 1) ! data_file_exist = 0; /*we have a file name, now see if it is there. */ --- 249,257 ---- -1); ! strcpy (Data_File_Name, temp); /*Determine if user just hit Enter. */ ! if (strlen (Data_File_Name) <= 1) ! Data_File_Exist = 0; /*we have a file name, now see if it is there. */ *************** *** 259,275 **** { ! data_file_name[strlen (data_file_name) - 1] = '\0'; ! data_file = open_file (data_file_name, 1); /*Check to see if opened file. */ ! if (data_file == NULL) { ! data_file_exist = false; ! printf ("%s not found!\n", data_file_name); } /*We have a valid file and it is opened! */ else ! data_file_exist = true; } --- 259,275 ---- { ! Data_File_Name[strlen (Data_File_Name) - 1] = '\0'; ! Data_File = open_file (Data_File_Name, 1); /*Check to see if opened file. */ ! if (Data_File == NULL) { ! Data_File_Exist = false; ! printf ("%s not found!\n", Data_File_Name); } /*We have a valid file and it is opened! */ else ! Data_File_Exist = true; } *************** *** 279,283 **** { printf ("Reading the data file\n\n"); ! read_data_file (data_file); } --- 279,283 ---- { printf ("Reading the data file\n\n"); ! read_data_file (Data_File); } |