mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-06-16 08:15:40 +02:00
plugins: export a const function pointer interface struct
This commit is contained in:
parent
37266ae419
commit
452c4b6015
22 changed files with 255 additions and 230 deletions
|
@ -3,6 +3,7 @@
|
|||
#include "../config.h"
|
||||
#include "../config-verify.h"
|
||||
#include "../particle.h"
|
||||
#include "../plugin.h"
|
||||
|
||||
static int
|
||||
begin_expose(struct exposable *exposable)
|
||||
|
@ -39,14 +40,14 @@ empty_new(struct particle *common)
|
|||
return common;
|
||||
}
|
||||
|
||||
struct particle *
|
||||
empty_from_conf(const struct yml_node *node, struct particle *common)
|
||||
static struct particle *
|
||||
from_conf(const struct yml_node *node, struct particle *common)
|
||||
{
|
||||
return empty_new(common);
|
||||
}
|
||||
|
||||
bool
|
||||
empty_verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
static bool
|
||||
verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
{
|
||||
static const struct attr_info attrs[] = {
|
||||
PARTICLE_COMMON_ATTRS,
|
||||
|
@ -55,11 +56,11 @@ empty_verify_conf(keychain_t *chain, const struct yml_node *node)
|
|||
return conf_verify_dict(chain, node, attrs);
|
||||
}
|
||||
|
||||
const struct particle_iface particle_empty_iface = {
|
||||
.verify_conf = &verify_conf,
|
||||
.from_conf = &from_conf,
|
||||
};
|
||||
|
||||
#if defined(CORE_PLUGINS_AS_SHARED_LIBRARIES)
|
||||
|
||||
bool verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
__attribute__((weak, alias("empty_verify_conf")));
|
||||
struct deco *from_conf(const struct yml_node *node, struct particle *common)
|
||||
__attribute__((weak, alias("empty_from_conf")));
|
||||
|
||||
extern const struct particle_iface iface __attribute__((weak, alias("particle_empty_iface")));
|
||||
#endif
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "../config.h"
|
||||
#include "../config-verify.h"
|
||||
#include "../particle.h"
|
||||
#include "../plugin.h"
|
||||
|
||||
struct private {
|
||||
struct particle **particles;
|
||||
|
@ -163,8 +164,8 @@ particle_list_new(struct particle *common,
|
|||
return common;
|
||||
}
|
||||
|
||||
struct particle *
|
||||
list_from_conf(const struct yml_node *node, struct particle *common)
|
||||
static struct particle *
|
||||
from_conf(const struct yml_node *node, struct particle *common)
|
||||
{
|
||||
const struct yml_node *items = yml_get_value(node, "items");
|
||||
const struct yml_node *spacing = yml_get_value(node, "spacing");
|
||||
|
@ -191,8 +192,8 @@ list_from_conf(const struct yml_node *node, struct particle *common)
|
|||
return particle_list_new(common, parts, count, left_spacing, right_spacing);
|
||||
}
|
||||
|
||||
bool
|
||||
list_verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
static bool
|
||||
verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
{
|
||||
static const struct attr_info attrs[] = {
|
||||
{"items", true, &conf_verify_particle_list_items},
|
||||
|
@ -205,11 +206,11 @@ list_verify_conf(keychain_t *chain, const struct yml_node *node)
|
|||
return conf_verify_dict(chain, node, attrs);
|
||||
}
|
||||
|
||||
const struct particle_iface particle_list_iface = {
|
||||
.verify_conf = &verify_conf,
|
||||
.from_conf = &from_conf,
|
||||
};
|
||||
|
||||
#if defined(CORE_PLUGINS_AS_SHARED_LIBRARIES)
|
||||
|
||||
bool verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
__attribute__((weak, alias("list_verify_conf")));
|
||||
struct deco *from_conf(const struct yml_node *node, struct particle *common)
|
||||
__attribute__((weak, alias("list_from_conf")));
|
||||
|
||||
extern const struct particle_iface iface __attribute__((weak, alias("particle_list_iface")));
|
||||
#endif
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "../config.h"
|
||||
#include "../config-verify.h"
|
||||
#include "../particle.h"
|
||||
#include "../plugin.h"
|
||||
|
||||
struct particle_map {
|
||||
const char *tag_value;
|
||||
|
@ -196,8 +197,8 @@ verify_map_values(keychain_t *chain, const struct yml_node *node)
|
|||
return true;
|
||||
}
|
||||
|
||||
struct particle *
|
||||
map_from_conf(const struct yml_node *node, struct particle *common)
|
||||
static struct particle *
|
||||
from_conf(const struct yml_node *node, struct particle *common)
|
||||
{
|
||||
const struct yml_node *tag = yml_get_value(node, "tag");
|
||||
const struct yml_node *values = yml_get_value(node, "values");
|
||||
|
@ -227,8 +228,8 @@ map_from_conf(const struct yml_node *node, struct particle *common)
|
|||
default_particle);
|
||||
}
|
||||
|
||||
bool
|
||||
map_verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
static bool
|
||||
verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
{
|
||||
static const struct attr_info attrs[] = {
|
||||
{"tag", true, &conf_verify_string},
|
||||
|
@ -240,11 +241,11 @@ map_verify_conf(keychain_t *chain, const struct yml_node *node)
|
|||
return conf_verify_dict(chain, node, attrs);
|
||||
}
|
||||
|
||||
const struct particle_iface particle_map_iface = {
|
||||
.verify_conf = &verify_conf,
|
||||
.from_conf = &from_conf,
|
||||
};
|
||||
|
||||
#if defined(CORE_PLUGINS_AS_SHARED_LIBRARIES)
|
||||
|
||||
bool verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
__attribute__((weak, alias("map_verify_conf")));
|
||||
struct deco *from_conf(const struct yml_node *node, struct particle *common)
|
||||
__attribute__((weak, alias("map_from_conf")));
|
||||
|
||||
extern const struct particle_iface iface __attribute__((weak, alias("particle_map_iface")));
|
||||
#endif
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "../config.h"
|
||||
#include "../config-verify.h"
|
||||
#include "../particle.h"
|
||||
#include "../plugin.h"
|
||||
|
||||
struct private {
|
||||
char *tag;
|
||||
|
@ -228,8 +229,8 @@ progress_bar_new(struct particle *common, const char *tag, int width,
|
|||
return common;
|
||||
}
|
||||
|
||||
struct particle *
|
||||
progress_bar_from_conf(const struct yml_node *node, struct particle *common)
|
||||
static struct particle *
|
||||
from_conf(const struct yml_node *node, struct particle *common)
|
||||
{
|
||||
const struct yml_node *tag = yml_get_value(node, "tag");
|
||||
const struct yml_node *length = yml_get_value(node, "length");
|
||||
|
@ -255,8 +256,8 @@ progress_bar_from_conf(const struct yml_node *node, struct particle *common)
|
|||
conf_to_particle(indicator, inherited));
|
||||
}
|
||||
|
||||
bool
|
||||
progress_bar_verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
static bool
|
||||
verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
{
|
||||
static const struct attr_info attrs[] = {
|
||||
{"tag", true, &conf_verify_string},
|
||||
|
@ -273,11 +274,11 @@ progress_bar_verify_conf(keychain_t *chain, const struct yml_node *node)
|
|||
return conf_verify_dict(chain, node, attrs);
|
||||
}
|
||||
|
||||
const struct particle_iface particle_progress_bar_iface = {
|
||||
.verify_conf = &verify_conf,
|
||||
.from_conf = &from_conf,
|
||||
};
|
||||
|
||||
#if defined(CORE_PLUGINS_AS_SHARED_LIBRARIES)
|
||||
|
||||
bool verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
__attribute__((weak, alias("progress_bar_verify_conf")));
|
||||
struct deco *from_conf(const struct yml_node *node, struct particle *common)
|
||||
__attribute__((weak, alias("progress_bar_from_conf")));
|
||||
|
||||
extern const struct particle_iface iface __attribute__((weak, alias("particle_progress_bar_iface")));
|
||||
#endif
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "../config.h"
|
||||
#include "../config-verify.h"
|
||||
#include "../particle.h"
|
||||
#include "../plugin.h"
|
||||
|
||||
struct private {
|
||||
char *tag;
|
||||
|
@ -153,8 +154,8 @@ ramp_new(struct particle *common, const char *tag,
|
|||
return common;
|
||||
}
|
||||
|
||||
struct particle *
|
||||
ramp_from_conf(const struct yml_node *node, struct particle *common)
|
||||
static struct particle *
|
||||
from_conf(const struct yml_node *node, struct particle *common)
|
||||
{
|
||||
const struct yml_node *tag = yml_get_value(node, "tag");
|
||||
const struct yml_node *items = yml_get_value(node, "items");
|
||||
|
@ -174,8 +175,8 @@ ramp_from_conf(const struct yml_node *node, struct particle *common)
|
|||
return ramp_new(common, yml_value_as_string(tag), parts, count);
|
||||
}
|
||||
|
||||
bool
|
||||
ramp_verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
static bool
|
||||
verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
{
|
||||
static const struct attr_info attrs[] = {
|
||||
{"tag", true, &conf_verify_string},
|
||||
|
@ -186,11 +187,11 @@ ramp_verify_conf(keychain_t *chain, const struct yml_node *node)
|
|||
return conf_verify_dict(chain, node, attrs);
|
||||
}
|
||||
|
||||
const struct particle_iface particle_ramp_iface = {
|
||||
.verify_conf = &verify_conf,
|
||||
.from_conf = &from_conf,
|
||||
};
|
||||
|
||||
#if defined(CORE_PLUGINS_AS_SHARED_LIBRARIES)
|
||||
|
||||
bool verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
__attribute__((weak, alias("ramp_verify_conf")));
|
||||
struct deco *from_conf(const struct yml_node *node, struct particle *common)
|
||||
__attribute__((weak, alias("ramp_from_conf")));
|
||||
|
||||
extern const struct particle_iface iface __attribute__((weak, alias("particle_ramp_iface")));
|
||||
#endif
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "../config.h"
|
||||
#include "../config-verify.h"
|
||||
#include "../particle.h"
|
||||
#include "../plugin.h"
|
||||
|
||||
struct private {
|
||||
char *text;
|
||||
|
@ -173,8 +174,8 @@ string_new(struct particle *common, const char *text, size_t max_len)
|
|||
return common;
|
||||
}
|
||||
|
||||
struct particle *
|
||||
string_from_conf(const struct yml_node *node, struct particle *common)
|
||||
static struct particle *
|
||||
from_conf(const struct yml_node *node, struct particle *common)
|
||||
{
|
||||
const struct yml_node *text = yml_get_value(node, "text");
|
||||
const struct yml_node *max = yml_get_value(node, "max");
|
||||
|
@ -185,8 +186,8 @@ string_from_conf(const struct yml_node *node, struct particle *common)
|
|||
max != NULL ? yml_value_as_int(max) : 0);
|
||||
}
|
||||
|
||||
bool
|
||||
string_verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
static bool
|
||||
verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
{
|
||||
static const struct attr_info attrs[] = {
|
||||
{"text", true, &conf_verify_string},
|
||||
|
@ -197,11 +198,11 @@ string_verify_conf(keychain_t *chain, const struct yml_node *node)
|
|||
return conf_verify_dict(chain, node, attrs);
|
||||
}
|
||||
|
||||
const struct particle_iface particle_string_iface = {
|
||||
.verify_conf = &verify_conf,
|
||||
.from_conf = &from_conf,
|
||||
};
|
||||
|
||||
#if defined(CORE_PLUGINS_AS_SHARED_LIBRARIES)
|
||||
|
||||
bool verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
__attribute__((weak, alias("string_verify_conf")));
|
||||
struct deco *from_conf(const struct yml_node *node, struct particle *common)
|
||||
__attribute__((weak, alias("string_from_conf")));
|
||||
|
||||
extern const struct particle_iface iface __attribute__((weak, alias("particle_string_iface")));
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue