
/*
 * Copyright (c) 2001 BBNT Solutions LLC
 *
 * Permission to use, copy, modify, and distribute this software
 * and its documentation for any purpose is hereby granted without
 * fee, provided that the above copyright notice and this permission
 * appear in all copies and in supporting documentation, and that the
 * name of BBN Technologies not be used in advertising or publicity
 * pertaining to distribution of the software without specific,
 * written prior permission.  BBN makes no representations about the
 * suitability of this software for any purposes.  It is provided "AS
 * IS" without express or implied warranties.
 */

#define FALSE                  0
#define TRUE                   1
#define MEM_SIZE_INC           50000
#define MAX_LINE               80
#define DEFAULT_FT_GRAN        100
#define WIDTH                  40
#define BUFFER_SIZE            256

#define PROMPT                 "STATS> "

#define LOGE                   1
#define LOG10                  2
#define SCALE                  3
#define INCR                   4
#define POWER                  5
#define AVERAGE                6
#define EWMA                   7
#define SLIDING_WIN            8
#define RELATIVE               9
#define CEIL                   10
#define FLOOR                  11
#define MODULO                 12

#define FLAGS_INTER            0x0
#define FLAGS_BATCH            0x1
#define FLAGS_SCRIPT           0x2
#define FLAGS_ONE_CMD          0x4

/* a2.c */

double unif_A2_known_range ();
double exp_A2_known_mean ();

/* a2-hooks.c */

void cmd_a2 ();

/* base.c */

void cmd_base ();
long readbase ();
void clear_base_count ();

/* basic.c */

unsigned short basic_labels;
unsigned short basic_oneline;

void print_label ();
void basic_usage ();
void basic_n ();
void basic_sum ();
void basic_min ();
void basic_max ();
void basic_range ();
void basic_p1 ();
void basic_p5 ();
void basic_p25 ();
void basic_p75 ();
void basic_p95 ();
void basic_p99 ();
void basic_iqr ();
void basic_mean ();
void basic_median ();
void basic_meand ();
void basic_mad ();
void basic_variance ();
void basic_standd ();
void basic_gmean ();
void basic_fairness ();
void basic_cv ();
void basic_all ();
void cmd_basic ();

/* batch.c */

extern unsigned short batch_cdf;
extern unsigned short batch_ccdf;
extern unsigned short batch_basic;
extern unsigned short batch_freqtab;
extern double freqtab_gran;
extern unsigned short freqtab_hist;
extern unsigned short freqtab_zero;
extern char *batch_outfile;
char *batch_basic_args;

void batch ();

/* cdf.c */

void print_cdf ();
void cmd_cdf ();
void cmd_ccdf ();

/* clear.c */

void cmd_clear ();

/* cmd.c */

void cmd_exit ();
void do_cmd ();

/* dump.c */

void dump_data ();
void cmd_dump ();

/* freq.c */

void cmd_freqtab ();

/* help.c */

void cmd_help ();

/* input.c */

unsigned long readdata ();
void cmd_input ();
void clear_input_count ();

/* interactive.c */

void do_interactive ();
void print_info ();

/* ks-fit.c */

void ks_func_fit_usage ();
void cmd_ks_func_fit ();
void ks_dist_fit_usage ();
void cmd_ks_dist_fit ();

/* kstwo.c */

void kstwo ();

/* output.c */

void cmd_open ();
void cmd_close ();

/* percentile.c */

double find_perc ();
void cmd_perc ();

/* probks.c */

float probks ();

/* qsort.h */

void quick_sort ();
unsigned long partition ();

/* script.c */

extern char *script_file;

void script_open ();
void script_close ();
void script_proc ();

/* set.c */

extern unsigned short silent;

void cmd_set ();

/* silent.c */

void cmd_silent ();

/* stats.c */

extern unsigned long num_samples;
extern unsigned long num_base;
extern unsigned short verbose;
extern unsigned short interactive;
extern double *sample;
extern double *base;
extern unsigned long mem_size_inc;
extern unsigned long max_samples;
extern unsigned long max_base;
extern unsigned long data_changed;
extern FILE *out;

void usage ();
void parseargs ();
int main ();

/* total.c */

extern double sum, sum_sq;
extern double prod;

void total_add_sample ();
void total_clear ();

/* transform.c */

void cmd_transform ();

/* trim.c */

void cmd_trim ();
