summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2019-11-10 18:54:34 -0800
committerVito Caputo <vcaputo@pengaru.com>2019-11-10 18:54:34 -0800
commita48084c57aa44d0833e455f75c67703a91718d1f (patch)
tree3ed2fe68cf0e52fe637df629e81a17caf1fcac8d /src
parent44ec797349713f28314bd329bee940cd55fad411 (diff)
rototiller: add rototiller_module_t.setup()
Wire up support for module settings, yes it's that small a change. I've forward-declared the settings related types in rototiller.h, if a module wants to actually wire up the .setup() method they'll need to include settings.h.
Diffstat (limited to 'src')
-rw-r--r--src/rototiller.c3
-rw-r--r--src/rototiller.h4
2 files changed, 6 insertions, 1 deletions
diff --git a/src/rototiller.c b/src/rototiller.c
index 7203ca2..de580cd 100644
--- a/src/rototiller.c
+++ b/src/rototiller.c
@@ -233,7 +233,8 @@ static int setup_module(settings_t *settings, setting_desc_t **next_setting)
if (!module)
return -EINVAL;
- /* TODO: here's where the module-specific settings would get hooked */
+ if (module->setup)
+ return module->setup(settings, next_setting);
return 0;
}
diff --git a/src/rototiller.h b/src/rototiller.h
index 84b3842..c578bd5 100644
--- a/src/rototiller.h
+++ b/src/rototiller.h
@@ -7,6 +7,9 @@
* return value of 1 means a fragment has been produced, 0 means num is beyond the end of fragments. */
typedef int (*rototiller_fragmenter_t)(void *context, const fb_fragment_t *fragment, unsigned num, fb_fragment_t *res_fragment);
+typedef struct settings_t settings;
+typedef struct setting_desc_t setting_desc_t;
+
typedef struct rototiller_module_t {
void * (*create_context)(void);
void (*destroy_context)(void *context);
@@ -17,6 +20,7 @@ typedef struct rototiller_module_t {
char *description;
char *author;
char *license;
+ int (*setup)(const settings_t *settings, setting_desc_t **next_setting);
} rototiller_module_t;
#endif
© All Rights Reserved