From 177bea75a11bc62915095213c351c8385ea12226 Mon Sep 17 00:00:00 2001 From: "Douglas B. Rumbaugh" Date: Mon, 6 Jan 2025 12:23:42 -0500 Subject: Initial commit of cdf program and basic build system --- include/cdf.h | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 include/cdf.h (limited to 'include/cdf.h') diff --git a/include/cdf.h b/include/cdf.h new file mode 100644 index 0000000..418ffeb --- /dev/null +++ b/include/cdf.h @@ -0,0 +1,40 @@ +/* + */ + +#ifndef H_CDF +#define H_CDF + +#include +#include +#include +#include +#include +#include +#include +#include + +typedef union { + int64_t i; + uint64_t u; + double d; +} Number; + +typedef struct { + Number data; + uint64_t count; +} DistRecord; + +static int parse_options(int argc, char*const* argv); +static void help(); +static int process_data(FILE *file); +static DistRecord *expand_array(DistRecord *records, size_t *capacity); +static int read_data_int(DistRecord **records, size_t capacity, FILE *file); +static int read_data_uint(DistRecord **records, size_t capacity, FILE *file); +static int read_data_fp(DistRecord **records, size_t capacity, FILE *file); +static int print_data_fp(DistRecord *records, long double *freqs, size_t cnt); +static int print_data_int(DistRecord *records, long double *freqs, size_t cnt); +static int print_data_uint(DistRecord *records, long double *freqs, size_t cnt); + +#endif + + -- cgit v1.2.3