diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-11-23 14:13:41 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-11-23 15:53:51 +0200 |
commit | 8a7cf4b45431bbead62b2ae390f49caedf702fe5 (patch) | |
tree | 8fa64b9d0d390bc7828d309b8661c1ce14e9b366 /src/pies.c | |
parent | ea7d455926a675ad5d605450fc2ae61da14b79f3 (diff) | |
download | pies-8a7cf4b45431bbead62b2ae390f49caedf702fe5.tar.gz pies-8a7cf4b45431bbead62b2ae390f49caedf702fe5.tar.bz2 |
Minor change.
* src/pies.h (CF_DISABLED)
(CF_PRECIOUS): New defines.
(struct component): Replace precious and
disabled by a bitmask member `flags'. All uses updated.
* src/progman.c: Reflect the above change.
* src/pies.c (_cb_bitmask): New function.
(_cb_precious, _cb_disabled): New callbacks.
(component_keywords): Change handling of precious and disabled.
* bootstrap.conf: Add Emacs mode marker
Diffstat (limited to 'src/pies.c')
-rw-r--r-- | src/pies.c | 51 |
1 files changed, 43 insertions, 8 deletions
@@ -756,6 +756,41 @@ _cb_limits (enum grecs_callback_command cmd, return 0; } +static int +_cb_bitmask (enum grecs_callback_command cmd, + grecs_locus_t *locus, + int *fptr, grecs_value_t *value, int mask) +{ + int arg; + + if (assert_scalar_stmt (locus, cmd) + || assert_grecs_value_type (locus, value, GRECS_TYPE_STRING) + || grecs_string_convert (&arg, grecs_type_bool, value->v.string, + locus)) + return 1; + if (arg) + *fptr |= mask; + else + *fptr &= ~mask; + return 0; +} + +static int +_cb_precious (enum grecs_callback_command cmd, + grecs_locus_t *locus, + void *varptr, grecs_value_t *value, void *cb_data) +{ + return _cb_bitmask (cmd, locus, varptr, value, CF_PRECIOUS); +} + +static int +_cb_disabled (enum grecs_callback_command cmd, + grecs_locus_t *locus, + void *varptr, grecs_value_t *value, void *cb_data) +{ + return _cb_bitmask (cmd, locus, varptr, value, CF_DISABLED); +} + struct grecs_keyword component_keywords[] = { {"mode", /* TRANSLATORS: The words between '{' and '}' are keywords, do not @@ -791,12 +826,6 @@ struct grecs_keyword component_keywords[] = { grecs_type_string | GRECS_LIST, NULL, offsetof (struct component, depend), NULL, }, - {"disable", - NULL, - N_("Disable this entry."), - grecs_type_bool, NULL, offsetof (struct component, disabled), - NULL, - }, {"pass-fd-timeout", NULL, N_("Time to wait for pass-fd socket to become available."), @@ -804,12 +833,18 @@ struct grecs_keyword component_keywords[] = { offsetof (struct component, pass_fd_timeout), NULL, }, + {"disable", + NULL, + N_("Disable this entry."), + grecs_type_bool, NULL, offsetof (struct component, flags), + _cb_disabled, + }, {"precious", NULL, N_("Mark this entry as precious."), grecs_type_bool, NULL, - offsetof (struct component, precious), - NULL, + offsetof (struct component, flags), + _cb_precious, }, {"socket", N_("url: string"), |