summaryrefslogtreecommitdiffstats
path: root/include/cdf.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/cdf.h')
-rw-r--r--include/cdf.h40
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
+
+