#ifndef _EUREDIT_SYS_H
#define _EUREDIT_SYS_H

#ifdef __cplusplus
extern "C"
{
#endif

#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
#include <string.h>
#include <conio.h>


void __stdcall 
free_list(long *ptr, long n);

void __stdcall 
list_names (long *ptr, long n, long i, char *i_name);

void __stdcall 
get_names (long *ptr, long i, char i_name[250]);

void __stdcall 
alloc_names (long *ptr, long n, long i, long m);

void __stdcall 
data_conv (char *dname, char *ifname, char *xmlfname,char *xlsfname, char *xdrfname, 
           long n, long m, long del_type, double v_bound,
           long head, char **v_name, long v_type[], long n_cat[], 
           long cat_val[], long max_cat, long info[2]);
    
void __stdcall 
summ_stats (long n, long m, double miss_val, double *data, long * n_cat, 
            long *cat_vals, long max_cat, double *mean, double *sd, 
            double *vmin, double *vmax, long *n_valid, double *mid_pts, long *counts, 
            long info[2]);
    
void __stdcall 
bar_chart (char *gname, long m, char **v_name, long *n_cat, long *cat_val, long *counts, 
           long max_cat, double *scale, long *height, long info[2]);
    
void __stdcall 
read_rep (char *report_name, long mode, long *nrecs, long *nerrors, long *irow, 
          long *icol, long info[2]);

void __stdcall 
xml_read (char *xmlfname,char *xdrfname,double miss_val,long n, long m, 
          double *data, char **v_name, long *n_cat, long *cat_val, long maxcat, 
          long mset, long *nmiss, long info[2]);
    
void __stdcall 
xml_data_size (char *xdrfname, long *n_obs, long *n_var, long *max_name,
               long info[2]);

void __stdcall 
gen_imp (long srtype[3], long rand_select, long n_match, long match_all, long reuse, 
         double min_wt, double *wts, double *R, long *dist_type, double *user_dist, 
         long num_obs, long m, double *data, long *n_cat, long *cat_val, long maxcat, 
         double miss_val, long *num_imp, long *obs_num, long *var_num, 
         double *rep_val, long info[5]);

void __stdcall 
simp_imp (long n, long m, double *data, long *n_cat, long *cat_val, long maxcat, 
          double miss_val, long *nimp, long *irow, long *icol, double *rval, long info[2]);

void __stdcall 
bacon (long n, long m, long *sx, double *data, double miss_val, long c, double alpha, 
       long method, double *indwt, double *swts, long info[2]);

void __stdcall 
xml_update (char *xmlfname,char *xdrfname, char *xslfname, double miss_val,long n, 
            long m, long u_date, long nrepl, long *irow, long *icol, double *rval, long info[2]);


void __stdcall 
em (long num, long m, long *sx, double *x, double miss_val, double tol, long max_cycle, 
    double *swts, long *nrepl, long *missing_row, long *missing_col, 
    double *repl_val, long info[2]);

void __stdcall 
anova_tree (long rec1, long nvar, long nrec, long dblk, double data[], 
            void (*df) (long , long , double [] , int *), long ninde, 
            long inde[], long dep, long iwt, long ncat[], long mns, 
            long mnc, double rsd, long opt, int *root, int *info);

void __stdcall 
gini_tree (long rec1, long nvar, long nrec, long dblk, double data[], 
           void (*df) (long , long , double [] , int *), long ninde, 
           long inde[], long dep, long ncat[], double prior[], long mns, 
           long mnc, double rsd, long opt, int *root, int *info);

void __stdcall 
tree_score (long rec1, long nvar, long nrec, long dblk, double *data, 
            void (*df) (long , long , double [] , int *), int root,
            long opt_rand, long opt_impute, long seed[], double res[],
            double acc[], int *info);

void __stdcall 
tree_save (int root, const char file[], int *info);

void __stdcall 
tree_free (int root);

void __stdcall 
tree_load (int *root, const char file[], int *info);

void __stdcall
set_rand_seed (long iseed, long seed[]);

void __stdcall 
waid_tree (long rec1, long nvar, long nrec, long dblk, double data[], 
           void (*df) (long , long , double [] , int *), long ninde,
           long inde[], long dep, long ws, double w[], long ncat[],
           double tol, long maxit, double c, long mns, long mnc,
           long opt, int *root, int *info);


#ifdef __cplusplus
}
#endif

#endif
