diff options
| author | Douglas B. Rumbaugh <doug@douglasrumbaugh.com> | 2025-01-06 12:23:42 -0500 |
|---|---|---|
| committer | Douglas B. Rumbaugh <doug@douglasrumbaugh.com> | 2025-01-06 12:23:42 -0500 |
| commit | 177bea75a11bc62915095213c351c8385ea12226 (patch) | |
| tree | 3e5c5c7103e082d152c23bcaead60740bd1d8550 /include | |
| download | math-utils-177bea75a11bc62915095213c351c8385ea12226.tar.gz | |
Initial commit of cdf program and basic build system
Diffstat (limited to 'include')
| -rw-r--r-- | include/cdf.h | 40 |
1 files changed, 40 insertions, 0 deletions
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 <stdlib.h> +#include <unistd.h> +#include <stdio.h> +#include <ctype.h> +#include <getopt.h> +#include <string.h> +#include <stdint.h> +#include <assert.h> + +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 + + |