diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2023-05-09 11:43:22 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2023-05-11 15:18:34 -0700 |
commit | 31a0147a720f2f0ef30df41512f41f43734662dd (patch) | |
tree | c381b2905eaf5cde93b83b2ee93adc148400b488 /src/modules/drizzle | |
parent | 1a8abe80dabd6b723897fc507808db30b126b3a4 (diff) |
til_settings: introduce til_setting_spec_t concept vs. desc
For recursive settings the individual setting being described
needs to get added to a potentially different settings instance
than the one being operated on at the top of the current
setup_func phase.
The settings instance being passed around for a setup_func to
operate on is constified, mainly to try ensure modules don't
start directly mucking with the settings. They're supposed to
just describe what they want next and iterate back and forth,
with the front-end creating the settings from the returned descs
however is appropriate, eventually building up the settings to
completion.
But since it's the setup_func that decides which settings
instance is appropriate for containing the setting.. at some
point it must associate a settings instance with the desc it's
producing, one that is going to be necessarily written to.
So here I'm just turning the existing til_setting_desc_t to a
"spec", unchanged. And introducing a new til_setting_desc_t
embedding the spec, accompanied by a non-const til_settings_t*
"container".
Now what setup_funcs use to express settings are a spec,
otherwise identically to before. Instead of cloning a desc to
allocate it for returning to the front-end, the desc is created
from a spec with the target settings instance passed in.
This turns the desc step where we take a constified settings
instance and cast it into a non-const a more formal act of going
from spec->desc, binding the spec to a specific settings
instance. It will also serve to isolate that hacky cast to a
til_settings function, and all the accessors of
til_setting_desc_t needing to operate on the containing settings
instance can just do so.
As of this commit, the container pointer is just sitting in the
desc_t but isn't being made use of or even assigned yet. This is
just to minimize the amount of churn happening in this otherwise
mostly mechanical and sprawling commit.
There's also been some small changes surrounding the desc
generators and plumbing of the settings instance where there
previously wasn't any. It's unclear to me if desc generators
will stay desc generators or turn into spec generators. For now
those are mostly just used by the drm_fb stuff anyways, modules
haven't made use of them, so they can stay a little crufty
harmlessly for now.
Diffstat (limited to 'src/modules/drizzle')
-rw-r--r-- | src/modules/drizzle/drizzle.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/modules/drizzle/drizzle.c b/src/modules/drizzle/drizzle.c index 9445da6..8a5607f 100644 --- a/src/modules/drizzle/drizzle.c +++ b/src/modules/drizzle/drizzle.c @@ -377,7 +377,7 @@ static int drizzle_setup(const til_settings_t *settings, til_setting_t **res_set int r; r = til_settings_get_and_describe_value(settings, - &(til_setting_desc_t){ + &(til_setting_spec_t){ .name = "Puddle viscosity", .key = "viscosity", .regex = "\\.[0-9]+", @@ -392,7 +392,7 @@ static int drizzle_setup(const til_settings_t *settings, til_setting_t **res_set return r; r = til_settings_get_and_describe_value(settings, - &(til_setting_desc_t){ + &(til_setting_spec_t){ .name = "Overlay style", .key = "style", .regex = "[a-z]+", |