/**---------------------------------------------------------------------------
 ** 
 ** stat.h -- 
 ** 
 ** Author          : Pierre Jaccard
 ** Created On      : 1999/07/15 13:43:32
 ** Last Modified By: Pierre Jaccard
 ** Last Modified On: 1999/07/30 12:13:12
 ** Update Count    : 9
 ** Directory       : /pcdata1/jaccard/codas3c/gfi/src/libs/math/
 ** Version         : 0.0
 ** Status          : Unknown
 ** ---------------------------------------------------------------------- ** 
 ** DESCRIPTION: 
 ** 
 **    See associated file stat.c
 ** 
 ** ---------------------------------------------------------------------- ** 
 ** REVISIONS: 
 ** ---------------------------------------------------------------------- ** 
 ** CHANGES: 
 **------------------------------------------------------------------------**/

#ifndef gfilib_math_stat_already_included
#define gfilib_math_stat_already_included

#include "geninc.h"
#include "vstat.h"
#include "gficnv.h"
#include "gfimisc.h"

/* ------------------------------------------------------------------
	 The next structure is used to store information for initializing arrays of
	 unistat cells.
	 ------------------------------------------------------------------ */
typedef struct
{
	char  *name;        /* Name of unistat variable           */
	char  *format;      /* Format for printing data values    */
	int   size;         /* Number of elements in unistat cell */
	int   options;      /* Unistat options for unistat cell   */
	int   code;         /* A value to identify the variable   */
	double *data;       /* Pointer to data array              */
	UNISTAT_TYPE *stat; /* Pointer to unistat variable        */
} UNISTAT_LIST_TYPE;

/* ------------------------------------------------------------------
	 The next structure is used to store information about flagg variables.
	 ------------------------------------------------------------------ */
typedef struct
{
	char *name;      /* name of flag variable             */
	int  size;       /* size of state array for this flag */ 
	BYTE *flag;      /* current flagg value               */
	int  code;       /* value to identify the variable    */  
} FLAG_LIST_TYPE;


#if PROTOTYPE_ALLOWED

int full_copy_unistat_list(UNISTAT_LIST_TYPE *u2, UNISTAT_LIST_TYPE *u1,
													 int code);
int free_unistat_list(UNISTAT_LIST_TYPE *list);
int fprintf_stat_header(FILE *fp, UNISTAT_LIST_TYPE *list, int n);
int zero_unistat_list(UNISTAT_LIST_TYPE *list, int code);
char *init_unistat_list(UNISTAT_LIST_TYPE *defs, char *option, int code);
int calculate_unistat_list(UNISTAT_LIST_TYPE *list, int code);
int update_unistat_list(UNISTAT_LIST_TYPE *list, int code);
char *get_unistat_element(UNISTAT_LIST_TYPE *list, int code);

int full_copy_flag_list(FLAG_LIST_TYPE *f2, FLAG_LIST_TYPE *f1, int code);
int zero_flag_list(FLAG_LIST_TYPE *list, int code);
char *init_flag_list(FLAG_LIST_TYPE *defs, char *option, int code);
int fprintf_flag_header(FILE *fp, FLAG_LIST_TYPE *list, int n);
int init_flag_array(FLAG_LIST_TYPE *list);
int free_flag_list(FLAG_LIST_TYPE *list);
int set_flag(FLAG_LIST_TYPE *list, int code, int index, BYTE value);
int get_flag(FLAG_LIST_TYPE *list, int code, int index);
char *get_flag_element(FLAG_LIST_TYPE *list, int code);
int set_bad_flags(FLAG_LIST_TYPE *list);

#else

int full_copy_unistat_list(u2, u1, code);
int free_unistat_list();
int fprintf_stat_header();
int zero_unistat_list();
char *init_unistat_list();
int calculate_unistat_list();
int update_unistat_list();
char *get_unistat_element();

int full_copy_flag_list();
int zero_flag_list();
char *init_flag_list();
int fprintf_flag_header();
int init_flag_array();
int free_flag_list();
int set_flag();
int get_flag();
char *get_flag_element();
int set_bad_flags();

#endif /* PROTOTYPE_ALLOWED */


#endif /* gfilib_math_stat_already_included */
