summaryrefslogtreecommitdiff
path: root/src/choices.h
diff options
context:
space:
mode:
authorJohn Hawthorn <john.hawthorn@gmail.com>2016-05-21 14:56:03 -0700
committerJohn Hawthorn <john.hawthorn@gmail.com>2016-05-21 14:56:25 -0700
commit2b3c3a85ec8aa8b4b94c0e594c32449dd70b4d26 (patch)
treeb72c2815f22fbae416cf10284c5acd273c75af7f /src/choices.h
parent45499644d85a9ba93dd9f1504d1ca7df15b60148 (diff)
Move sources into src directory
Diffstat (limited to 'src/choices.h')
-rw-r--r--src/choices.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/choices.h b/src/choices.h
new file mode 100644
index 0000000..d8d547c
--- /dev/null
+++ b/src/choices.h
@@ -0,0 +1,36 @@
+#ifndef CHOICES_H
+#define CHOICES_H CHOICES_H
+
+#include <stdio.h>
+
+struct scored_result {
+ double score;
+ const char *str;
+};
+
+typedef struct {
+ char *buffer;
+ size_t buffer_size;
+
+ size_t capacity;
+ size_t size;
+
+ const char **strings;
+ struct scored_result *results;
+
+ size_t available;
+ size_t selection;
+} choices_t;
+
+void choices_init(choices_t *c);
+void choices_fread(choices_t *c, FILE *file);
+void choices_destroy(choices_t *c);
+void choices_add(choices_t *c, const char *choice);
+size_t choices_available(choices_t *c);
+void choices_search(choices_t *c, const char *search);
+const char *choices_get(choices_t *c, size_t n);
+double choices_getscore(choices_t *c, size_t n);
+void choices_prev(choices_t *c);
+void choices_next(choices_t *c);
+
+#endif