forked from external/yambar
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 "../decoration.h"
|
||||
#include "../plugin.h"
|
||||
|
||||
struct private {
|
||||
struct rgba color;
|
||||
|
@ -40,15 +41,15 @@ background_new(struct rgba color)
|
|||
return deco;
|
||||
}
|
||||
|
||||
struct deco *
|
||||
background_from_conf(const struct yml_node *node)
|
||||
static struct deco *
|
||||
from_conf(const struct yml_node *node)
|
||||
{
|
||||
const struct yml_node *color = yml_get_value(node, "color");
|
||||
return background_new(conf_to_color(color));
|
||||
}
|
||||
|
||||
bool
|
||||
background_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[] = {
|
||||
{"color", true, &conf_verify_color},
|
||||
|
@ -58,11 +59,11 @@ background_verify_conf(keychain_t *chain, const struct yml_node *node)
|
|||
return conf_verify_dict(chain, node, attrs);
|
||||
}
|
||||
|
||||
const struct deco_iface deco_background_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("background_verify_conf")));
|
||||
struct deco *from_conf(const struct yml_node *node)
|
||||
__attribute__((weak, alias("background_from_conf")));
|
||||
|
||||
extern const struct deco_iface iface __attribute__((weak, alias("deco_background_iface")));
|
||||
#endif
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "../config.h"
|
||||
#include "../config-verify.h"
|
||||
#include "../decoration.h"
|
||||
#include "../plugin.h"
|
||||
|
||||
struct private {
|
||||
struct deco **decos;
|
||||
|
@ -47,8 +48,9 @@ stack_new(struct deco *decos[], size_t count)
|
|||
|
||||
return deco;
|
||||
}
|
||||
struct deco *
|
||||
stack_from_conf(const struct yml_node *node)
|
||||
|
||||
static struct deco *
|
||||
from_conf(const struct yml_node *node)
|
||||
{
|
||||
size_t count = yml_list_length(node);
|
||||
|
||||
|
@ -65,8 +67,8 @@ stack_from_conf(const struct yml_node *node)
|
|||
return stack_new(decos, count);
|
||||
}
|
||||
|
||||
bool
|
||||
stack_verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
static bool
|
||||
verify_conf(keychain_t *chain, const struct yml_node *node)
|
||||
{
|
||||
if (!yml_is_list(node)) {
|
||||
LOG_ERR("%s: must be a list of decorations", conf_err_prefix(chain, node));
|
||||
|
@ -84,11 +86,11 @@ stack_verify_conf(keychain_t *chain, const struct yml_node *node)
|
|||
return true;
|
||||
}
|
||||
|
||||
const struct deco_iface deco_stack_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("stack_verify_conf")));
|
||||
struct deco *from_conf(const struct yml_node *node)
|
||||
__attribute__((weak, alias("stack_from_conf")));
|
||||
|
||||
extern const struct deco_iface iface __attribute__((weak, alias("deco_stack_iface")));
|
||||
#endif
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "../config.h"
|
||||
#include "../config-verify.h"
|
||||
#include "../decoration.h"
|
||||
#include "../plugin.h"
|
||||
|
||||
struct private {
|
||||
int size;
|
||||
|
@ -42,16 +43,16 @@ underline_new(int size, struct rgba color)
|
|||
return deco;
|
||||
}
|
||||
|
||||
struct deco *
|
||||
underline_from_conf(const struct yml_node *node)
|
||||
static struct deco *
|
||||
from_conf(const struct yml_node *node)
|
||||
{
|
||||
const struct yml_node *size = yml_get_value(node, "size");
|
||||
const struct yml_node *color = yml_get_value(node, "color");
|
||||
return underline_new(yml_value_as_int(size), conf_to_color(color));
|
||||
}
|
||||
|
||||
bool
|
||||
underline_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[] = {
|
||||
{"size", true, &conf_verify_int},
|
||||
|
@ -62,11 +63,11 @@ underline_verify_conf(keychain_t *chain, const struct yml_node *node)
|
|||
return conf_verify_dict(chain, node, attrs);
|
||||
}
|
||||
|
||||
const struct deco_iface deco_underline_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("underline_verify_conf")));
|
||||
struct deco *from_conf(const struct yml_node *node)
|
||||
__attribute__((weak, alias("underline_from_conf")));
|
||||
|
||||
extern const struct deco_iface iface __attribute__((weak, alias("deco_underline_iface")));
|
||||
#endif
|
||||
|
|
|
@ -7,8 +7,9 @@
|
|||
#define LOG_ENABLE_DBG 0
|
||||
#include "../log.h"
|
||||
#include "../bar.h"
|
||||
#include "../config.h"
|
||||
#include "../config-verify.h"
|
||||
#include "../config.h"
|
||||
#include "../plugin.h"
|
||||
#include "../tllist.h"
|
||||
|
||||
struct private {
|
||||
|
@ -284,8 +285,8 @@ alsa_new(const char *card, const char *mixer, struct particle *label)
|
|||
return mod;
|
||||
}
|
||||
|
||||
struct module *
|
||||
alsa_from_conf(const struct yml_node *node, struct conf_inherit inherited)
|
||||
static struct module *
|
||||
from_conf(const struct yml_node *node, struct conf_inherit inherited)
|
||||
{
|
||||
const struct yml_node *card = yml_get_value(node, "card");
|
||||
const struct yml_node *mixer = yml_get_value(node, "mixer");
|
||||
|
@ -297,8 +298,8 @@ alsa_from_conf(const struct yml_node *node, struct conf_inherit inherited)
|
|||
conf_to_particle(content, inherited));
|
||||
}
|
||||
|
||||
bool
|
||||
alsa_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[] = {
|
||||
{"card", true, &conf_verify_string},
|
||||
|
@ -311,11 +312,11 @@ alsa_verify_conf(keychain_t *chain, const struct yml_node *node)
|
|||
return conf_verify_dict(chain, node, attrs);
|
||||
}
|
||||
|
||||
const struct module_iface module_alsa_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("alsa_verify_conf")));
|
||||
struct deco *from_conf(const struct yml_node *node, struct conf_inherit inherited)
|
||||
__attribute__((weak, alias("alsa_from_conf")));
|
||||
|
||||
extern const struct module_iface iface __attribute__((weak, alias("module_alsa_iface")));
|
||||
#endif
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "../bar.h"
|
||||
#include "../config.h"
|
||||
#include "../config-verify.h"
|
||||
#include "../plugin.h"
|
||||
|
||||
struct private {
|
||||
struct particle *label;
|
||||
|
@ -219,8 +220,8 @@ backlight_new(const char *device, struct particle *label)
|
|||
return mod;
|
||||
}
|
||||
|
||||
struct module *
|
||||
backlight_from_conf(const struct yml_node *node, struct conf_inherit inherited)
|
||||
static struct module *
|
||||
from_conf(const struct yml_node *node, struct conf_inherit inherited)
|
||||
{
|
||||
const struct yml_node *name = yml_get_value(node, "name");
|
||||
const struct yml_node *c = yml_get_value(node, "content");
|
||||
|
@ -229,8 +230,8 @@ backlight_from_conf(const struct yml_node *node, struct conf_inherit inherited)
|
|||
yml_value_as_string(name), conf_to_particle(c, inherited));
|
||||
}
|
||||
|
||||
bool
|
||||
backlight_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[] = {
|
||||
{"name", true, &conf_verify_string},
|
||||
|
@ -242,11 +243,11 @@ backlight_verify_conf(keychain_t *chain, const struct yml_node *node)
|
|||
return conf_verify_dict(chain, node, attrs);
|
||||
}
|
||||
|
||||
const struct module_iface module_backlight_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("backlight_verify_conf")));
|
||||
struct deco *from_conf(const struct yml_node *node, struct conf_inherit inherited)
|
||||
__attribute__((weak, alias("backlight_from_conf")));
|
||||
|
||||
extern const struct module_iface iface __attribute__((weak, alias("module_backlight_iface")));
|
||||
#endif
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "../bar.h"
|
||||
#include "../config.h"
|
||||
#include "../config-verify.h"
|
||||
#include "../plugin.h"
|
||||
|
||||
enum state { STATE_FULL, STATE_CHARGING, STATE_DISCHARGING };
|
||||
|
||||
|
@ -349,8 +350,8 @@ battery_new(const char *battery, struct particle *label, int poll_interval_secs)
|
|||
return mod;
|
||||
}
|
||||
|
||||
struct module *
|
||||
battery_from_conf(const struct yml_node *node, struct conf_inherit inherited)
|
||||
static struct module *
|
||||
from_conf(const struct yml_node *node, struct conf_inherit inherited)
|
||||
{
|
||||
const struct yml_node *c = yml_get_value(node, "content");
|
||||
const struct yml_node *name = yml_get_value(node, "name");
|
||||
|
@ -362,8 +363,8 @@ battery_from_conf(const struct yml_node *node, struct conf_inherit inherited)
|
|||
poll_interval != NULL ? yml_value_as_int(poll_interval) : 60);
|
||||
}
|
||||
|
||||
bool
|
||||
battery_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[] = {
|
||||
{"name", true, &conf_verify_string},
|
||||
|
@ -376,11 +377,11 @@ battery_verify_conf(keychain_t *chain, const struct yml_node *node)
|
|||
return conf_verify_dict(chain, node, attrs);
|
||||
}
|
||||
|
||||
const struct module_iface module_battery_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("battery_verify_conf")));
|
||||
struct deco *from_conf(const struct yml_node *node, struct conf_inherit inherited)
|
||||
__attribute__((weak, alias("battery_from_conf")));
|
||||
|
||||
extern const struct module_iface iface __attribute__((weak, alias("module_battery_iface")));
|
||||
#endif
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "../bar.h"
|
||||
#include "../config.h"
|
||||
#include "../config-verify.h"
|
||||
#include "../plugin.h"
|
||||
|
||||
struct private {
|
||||
struct particle *label;
|
||||
|
@ -94,8 +95,8 @@ clock_new(struct particle *label, const char *date_format, const char *time_form
|
|||
return mod;
|
||||
}
|
||||
|
||||
struct module *
|
||||
clock_from_conf(const struct yml_node *node, struct conf_inherit inherited)
|
||||
static struct module *
|
||||
from_conf(const struct yml_node *node, struct conf_inherit inherited)
|
||||
{
|
||||
const struct yml_node *c = yml_get_value(node, "content");
|
||||
const struct yml_node *date_format = yml_get_value(node, "date-format");
|
||||
|
@ -107,8 +108,8 @@ clock_from_conf(const struct yml_node *node, struct conf_inherit inherited)
|
|||
time_format != NULL ? yml_value_as_string(time_format) : "%H:%M");
|
||||
}
|
||||
|
||||
bool
|
||||
clock_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[] = {
|
||||
{"date-format", false, &conf_verify_string},
|
||||
|
@ -121,11 +122,11 @@ clock_verify_conf(keychain_t *chain, const struct yml_node *node)
|
|||
return conf_verify_dict(chain, node, attrs);
|
||||
}
|
||||
|
||||
const struct module_iface module_clock_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("clock_verify_conf")));
|
||||
struct deco *from_conf(const struct yml_node *node, struct conf_inherit inherited)
|
||||
__attribute__((weak, alias("clock_from_conf")));
|
||||
|
||||
extern const struct module_iface iface __attribute__((weak, alias("module_clock_iface")));
|
||||
#endif
|
||||
|
|
21
modules/i3.c
21
modules/i3.c
|
@ -25,6 +25,7 @@
|
|||
#include "../config.h"
|
||||
#include "../config-verify.h"
|
||||
#include "../particles/dynlist.h"
|
||||
#include "../plugin.h"
|
||||
#include "../xcb.h"
|
||||
|
||||
struct ws_content {
|
||||
|
@ -676,8 +677,8 @@ i3_new(struct i3_workspaces workspaces[], size_t workspace_count,
|
|||
return mod;
|
||||
}
|
||||
|
||||
struct module *
|
||||
i3_from_conf(const struct yml_node *node, struct conf_inherit inherited)
|
||||
static struct module *
|
||||
from_conf(const struct yml_node *node, struct conf_inherit inherited)
|
||||
{
|
||||
const struct yml_node *c = yml_get_value(node, "content");
|
||||
const struct yml_node *spacing = yml_get_value(node, "spacing");
|
||||
|
@ -733,8 +734,8 @@ verify_content(keychain_t *chain, const struct yml_node *node)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
i3_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[] = {
|
||||
{"spacing", false, &conf_verify_int},
|
||||
|
@ -748,11 +749,11 @@ i3_verify_conf(keychain_t *chain, const struct yml_node *node)
|
|||
return conf_verify_dict(chain, node, attrs);
|
||||
}
|
||||
|
||||
const struct module_iface module_i3_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("i3_verify_conf")));
|
||||
struct deco *from_conf(const struct yml_node *node, struct conf_inherit inherited)
|
||||
__attribute__((weak, alias("i3_from_conf")));
|
||||
|
||||
extern const struct module_iface iface __attribute__((weak, alias("module_i3_iface"))) ;
|
||||
#endif
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "../config.h"
|
||||
#include "../config-verify.h"
|
||||
#include "../module.h"
|
||||
#include "../plugin.h"
|
||||
|
||||
struct private {
|
||||
struct particle *label;
|
||||
|
@ -47,15 +48,15 @@ label_new(struct particle *label)
|
|||
return mod;
|
||||
}
|
||||
|
||||
struct module *
|
||||
label_from_conf(const struct yml_node *node, struct conf_inherit inherited)
|
||||
static struct module *
|
||||
from_conf(const struct yml_node *node, struct conf_inherit inherited)
|
||||
{
|
||||
const struct yml_node *c = yml_get_value(node, "content");
|
||||
return label_new(conf_to_particle(c, inherited));
|
||||
}
|
||||
|
||||
bool
|
||||
label_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[] = {
|
||||
{"content", true, &conf_verify_particle},
|
||||
|
@ -66,11 +67,11 @@ label_verify_conf(keychain_t *chain, const struct yml_node *node)
|
|||
return conf_verify_dict(chain, node, attrs);
|
||||
}
|
||||
|
||||
const struct module_iface module_label_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("label_verify_conf")));
|
||||
struct deco *from_conf(const struct yml_node *node, struct conf_inherit inherited)
|
||||
__attribute__((weak, alias("label_from_conf")));
|
||||
|
||||
extern const struct module_iface iface __attribute__((weak, alias("module_label_iface")));
|
||||
#endif
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "../bar.h"
|
||||
#include "../config.h"
|
||||
#include "../config-verify.h"
|
||||
#include "../plugin.h"
|
||||
|
||||
enum state {
|
||||
STATE_OFFLINE = 1000,
|
||||
|
@ -583,8 +584,8 @@ mpd_new(const char *host, uint16_t port, struct particle *label)
|
|||
return mod;
|
||||
}
|
||||
|
||||
struct module *
|
||||
mpd_from_conf(const struct yml_node *node, struct conf_inherit inherited)
|
||||
static struct module *
|
||||
from_conf(const struct yml_node *node, struct conf_inherit inherited)
|
||||
{
|
||||
const struct yml_node *host = yml_get_value(node, "host");
|
||||
const struct yml_node *port = yml_get_value(node, "port");
|
||||
|
@ -596,8 +597,8 @@ mpd_from_conf(const struct yml_node *node, struct conf_inherit inherited)
|
|||
conf_to_particle(c, inherited));
|
||||
}
|
||||
|
||||
bool
|
||||
mpd_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[] = {
|
||||
{"host", true, &conf_verify_string},
|
||||
|
@ -610,11 +611,11 @@ mpd_verify_conf(keychain_t *chain, const struct yml_node *node)
|
|||
return conf_verify_dict(chain, node, attrs);
|
||||
}
|
||||
|
||||
const struct module_iface module_mpd_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("mpd_verify_conf")));
|
||||
struct deco *from_conf(const struct yml_node *node, struct conf_inherit inherited)
|
||||
__attribute__((weak, alias("mpd_from_conf")));
|
||||
|
||||
extern const struct module_iface iface __attribute__((weak, alias("module_mpd_iface")));
|
||||
#endif
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "../config.h"
|
||||
#include "../config-verify.h"
|
||||
#include "../module.h"
|
||||
#include "../plugin.h"
|
||||
#include "../tllist.h"
|
||||
|
||||
struct af_addr {
|
||||
|
@ -530,8 +531,8 @@ network_new(const char *iface, struct particle *label)
|
|||
return mod;
|
||||
}
|
||||
|
||||
struct module *
|
||||
network_from_conf(const struct yml_node *node, struct conf_inherit inherited)
|
||||
static struct module *
|
||||
from_conf(const struct yml_node *node, struct conf_inherit inherited)
|
||||
{
|
||||
const struct yml_node *name = yml_get_value(node, "name");
|
||||
const struct yml_node *content = yml_get_value(node, "content");
|
||||
|
@ -540,8 +541,8 @@ network_from_conf(const struct yml_node *node, struct conf_inherit inherited)
|
|||
yml_value_as_string(name), conf_to_particle(content, inherited));
|
||||
}
|
||||
|
||||
bool
|
||||
network_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[] = {
|
||||
{"name", true, &conf_verify_string},
|
||||
|
@ -553,11 +554,11 @@ network_verify_conf(keychain_t *chain, const struct yml_node *node)
|
|||
return conf_verify_dict(chain, node, attrs);
|
||||
}
|
||||
|
||||
const struct module_iface module_network_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("network_verify_conf")));
|
||||
struct deco *from_conf(const struct yml_node *node, struct conf_inherit inherited)
|
||||
__attribute__((weak, alias("network_from_conf")));
|
||||
|
||||
extern const struct module_iface iface __attribute__((weak, alias("module_network_iface")));
|
||||
#endif
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "../config.h"
|
||||
#include "../config-verify.h"
|
||||
#include "../particles/dynlist.h"
|
||||
#include "../plugin.h"
|
||||
#include "../tllist.h"
|
||||
|
||||
typedef tll(char *) mount_point_list_t;
|
||||
|
@ -558,8 +559,8 @@ removables_new(struct particle *label, int left_spacing, int right_spacing)
|
|||
return mod;
|
||||
}
|
||||
|
||||
struct module *
|
||||
removables_from_conf(const struct yml_node *node, struct conf_inherit inherited)
|
||||
static struct module *
|
||||
from_conf(const struct yml_node *node, struct conf_inherit inherited)
|
||||
{
|
||||
const struct yml_node *content = yml_get_value(node, "content");
|
||||
const struct yml_node *spacing = yml_get_value(node, "spacing");
|
||||
|
@ -574,8 +575,8 @@ removables_from_conf(const struct yml_node *node, struct conf_inherit inherited)
|
|||
return removables_new(conf_to_particle(content, inherited), left, right);
|
||||
}
|
||||
|
||||
bool
|
||||
removables_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[] = {
|
||||
{"spacing", false, &conf_verify_int},
|
||||
|
@ -589,11 +590,11 @@ removables_verify_conf(keychain_t *chain, const struct yml_node *node)
|
|||
return conf_verify_dict(chain, node, attrs);
|
||||
}
|
||||
|
||||
const struct module_iface module_removables_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("removables_verify_conf")));
|
||||
struct deco *from_conf(const struct yml_node *node, struct conf_inherit inherited)
|
||||
__attribute__((weak, alias("removables_from_conf")));
|
||||
|
||||
extern const struct module_iface iface __attribute__((weak, alias("module_removables_iface")));
|
||||
#endif
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "../bar.h"
|
||||
#include "../config.h"
|
||||
#include "../config-verify.h"
|
||||
#include "../plugin.h"
|
||||
#include "../xcb.h"
|
||||
|
||||
struct layout {
|
||||
|
@ -658,15 +659,15 @@ xkb_new(struct particle *label)
|
|||
return mod;
|
||||
}
|
||||
|
||||
struct module *
|
||||
xkb_from_conf(const struct yml_node *node, struct conf_inherit inherited)
|
||||
static struct module *
|
||||
from_conf(const struct yml_node *node, struct conf_inherit inherited)
|
||||
{
|
||||
const struct yml_node *c = yml_get_value(node, "content");
|
||||
return xkb_new(conf_to_particle(c, inherited));
|
||||
}
|
||||
|
||||
bool
|
||||
xkb_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[] = {
|
||||
{"content", true, &conf_verify_particle},
|
||||
|
@ -677,11 +678,11 @@ xkb_verify_conf(keychain_t *chain, const struct yml_node *node)
|
|||
return conf_verify_dict(chain, node, attrs);
|
||||
}
|
||||
|
||||
const struct module_iface module_xkb_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("xkb_verify_conf")));
|
||||
struct deco *from_conf(const struct yml_node *node, struct conf_inherit inherited)
|
||||
__attribute__((weak, alias("xkb_from_conf")));
|
||||
|
||||
extern const struct module_iface iface __attribute__((weak, alias("module_xkb_iface")));
|
||||
#endif
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "../bar.h"
|
||||
#include "../config.h"
|
||||
#include "../config-verify.h"
|
||||
#include "../plugin.h"
|
||||
#include "../xcb.h"
|
||||
|
||||
struct private {
|
||||
|
@ -334,15 +335,15 @@ xwindow_new(struct particle *label)
|
|||
return mod;
|
||||
}
|
||||
|
||||
struct module *
|
||||
xwindow_from_conf(const struct yml_node *node, struct conf_inherit inherited)
|
||||
static struct module *
|
||||
from_conf(const struct yml_node *node, struct conf_inherit inherited)
|
||||
{
|
||||
const struct yml_node *c = yml_get_value(node, "content");
|
||||
return xwindow_new(conf_to_particle(c, inherited));
|
||||
}
|
||||
|
||||
bool
|
||||
xwindow_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[] = {
|
||||
{"content", true, &conf_verify_particle},
|
||||
|
@ -353,11 +354,11 @@ xwindow_verify_conf(keychain_t *chain, const struct yml_node *node)
|
|||
return conf_verify_dict(chain, node, attrs);
|
||||
}
|
||||
|
||||
const struct module_iface module_xwindow_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("xwindow_verify_conf")));
|
||||
struct deco *from_conf(const struct yml_node *node, struct conf_inherit inherited)
|
||||
__attribute__((weak, alias("xwindow_from_conf")));
|
||||
|
||||
extern const struct module_iface iface __attribute__((weak, alias("module_xwindow_iface")));
|
||||
#endif
|
||||
|
|
|
@ -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
|
||||
|
|
55
plugin.c
55
plugin.c
|
@ -12,18 +12,21 @@
|
|||
#if !defined(CORE_PLUGINS_AS_SHARED_LIBRARIES)
|
||||
|
||||
#define EXTERN_MODULE(plug_name) \
|
||||
extern const struct module_iface module_##plug_name##_iface; \
|
||||
extern bool plug_name##_verify_conf( \
|
||||
keychain_t *chain, const struct yml_node *node); \
|
||||
extern struct module *plug_name##_from_conf( \
|
||||
const struct yml_node *node, struct conf_inherit inherited);
|
||||
|
||||
#define EXTERN_PARTICLE(plug_name) \
|
||||
extern bool plug_name##_verify_conf( \
|
||||
keychain_t *chain, const struct yml_node *node); \
|
||||
extern struct particle *plug_name##_from_conf( \
|
||||
#define EXTERN_PARTICLE(plug_name) \
|
||||
extern const struct particle_iface particle_##plug_name##_iface; \
|
||||
extern bool plug_name##_verify_conf( \
|
||||
keychain_t *chain, const struct yml_node *node); \
|
||||
extern struct particle *plug_name##_from_conf( \
|
||||
const struct yml_node *node, struct particle *common);
|
||||
|
||||
#define EXTERN_DECORATION(plug_name) \
|
||||
extern const struct deco_iface deco_##plug_name##_iface; \
|
||||
extern bool plug_name##_verify_conf( \
|
||||
keychain_t *chain, const struct yml_node *node); \
|
||||
extern struct deco *plug_name##_from_conf(const struct yml_node *node);
|
||||
|
@ -84,19 +87,21 @@ init(void)
|
|||
.name = strdup(#plug_name), \
|
||||
.type = (plug_type), \
|
||||
.lib = NULL, \
|
||||
.dummy = { \
|
||||
.sym1 = &func_prefix##_verify_conf, \
|
||||
.sym2 = &func_prefix##_from_conf, \
|
||||
} \
|
||||
})); \
|
||||
} while (0)
|
||||
|
||||
#define REGISTER_CORE_MODULE(plug_name, func_prefix) \
|
||||
REGISTER_CORE_PLUGIN(plug_name, func_prefix, PLUGIN_MODULE)
|
||||
#define REGISTER_CORE_PARTICLE(plug_name, func_prefix) \
|
||||
REGISTER_CORE_PLUGIN(plug_name, func_prefix, PLUGIN_PARTICLE)
|
||||
#define REGISTER_CORE_DECORATION(plug_name, func_prefix) \
|
||||
REGISTER_CORE_PLUGIN(plug_name, func_prefix, PLUGIN_DECORATION)
|
||||
#define REGISTER_CORE_MODULE(plug_name, func_prefix) do { \
|
||||
REGISTER_CORE_PLUGIN(plug_name, func_prefix, PLUGIN_MODULE); \
|
||||
tll_back(plugins).module = &module_##func_prefix##_iface; \
|
||||
} while (0)
|
||||
#define REGISTER_CORE_PARTICLE(plug_name, func_prefix) do { \
|
||||
REGISTER_CORE_PLUGIN(plug_name, func_prefix, PLUGIN_PARTICLE); \
|
||||
tll_back(plugins).particle = &particle_##func_prefix##_iface; \
|
||||
} while (0)
|
||||
#define REGISTER_CORE_DECORATION(plug_name, func_prefix) do { \
|
||||
REGISTER_CORE_PLUGIN(plug_name, func_prefix, PLUGIN_DECORATION); \
|
||||
tll_back(plugins).decoration = &deco_##func_prefix##_iface; \
|
||||
} while (0)
|
||||
|
||||
REGISTER_CORE_MODULE(alsa, alsa);
|
||||
REGISTER_CORE_MODULE(backlight, backlight);
|
||||
|
@ -155,8 +160,7 @@ plugin_load(const char *name, enum plugin_type type)
|
|||
tll_foreach(plugins, plug) {
|
||||
if (plug->item.type == type && strcmp(plug->item.name, name) == 0) {
|
||||
LOG_DBG("%s: %s already loaded: %p", type2str(type), name, plug->item.lib);
|
||||
assert(plug->item.dummy.sym1 != NULL);
|
||||
assert(plug->item.dummy.sym2 != NULL);
|
||||
assert(plug->item.dummy != NULL);
|
||||
return &plug->item;
|
||||
}
|
||||
}
|
||||
|
@ -174,20 +178,13 @@ plugin_load(const char *name, enum plugin_type type)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
tll_push_back(plugins, ((struct plugin){strdup(name), type, lib, {{NULL}}}));
|
||||
tll_push_back(plugins, ((struct plugin){strdup(name), type, lib, {NULL}}));
|
||||
struct plugin *plug = &tll_back(plugins);
|
||||
|
||||
dlerror(); /* Clear previous error */
|
||||
const char *dl_error = NULL;
|
||||
|
||||
plug->dummy.sym1 = dlsym(lib, "verify_conf");
|
||||
dl_error = dlerror();
|
||||
|
||||
if (dl_error == NULL) {
|
||||
plug->dummy.sym2 = dlsym(lib, "from_conf");
|
||||
dl_error = dlerror();
|
||||
}
|
||||
plug->dummy = dlsym(lib, "iface");
|
||||
|
||||
const char *dl_error = dlerror();
|
||||
if (dl_error != NULL) {
|
||||
LOG_ERR("%s: %s: dlsym: %s", type2str(type), name, dl_error);
|
||||
return NULL;
|
||||
|
@ -200,19 +197,19 @@ const struct module_iface *
|
|||
plugin_load_module(const char *name)
|
||||
{
|
||||
const struct plugin *plug = plugin_load(name, PLUGIN_MODULE);
|
||||
return plug != NULL ? &plug->module : NULL;
|
||||
return plug != NULL ? plug->module : NULL;
|
||||
}
|
||||
|
||||
const struct particle_iface *
|
||||
plugin_load_particle(const char *name)
|
||||
{
|
||||
const struct plugin *plug = plugin_load(name, PLUGIN_PARTICLE);
|
||||
return plug != NULL ? &plug->particle : NULL;
|
||||
return plug != NULL ? plug->particle : NULL;
|
||||
}
|
||||
|
||||
const struct deco_iface *
|
||||
plugin_load_deco(const char *name)
|
||||
{
|
||||
const struct plugin *plug = plugin_load(name, PLUGIN_DECORATION);
|
||||
return plug != NULL ? &plug->decoration : NULL;
|
||||
return plug != NULL ? plug->decoration : NULL;
|
||||
}
|
||||
|
|
7
plugin.h
7
plugin.h
|
@ -36,6 +36,12 @@ struct plugin {
|
|||
|
||||
void *lib;
|
||||
union {
|
||||
const struct module_iface *module;
|
||||
const struct particle_iface *particle;
|
||||
const struct deco_iface *decoration;
|
||||
const void *dummy;
|
||||
|
||||
#if 0
|
||||
struct {
|
||||
void *sym1;
|
||||
void *sym2;
|
||||
|
@ -44,6 +50,7 @@ struct plugin {
|
|||
struct module_iface module;
|
||||
struct particle_iface particle;
|
||||
struct deco_iface decoration;
|
||||
#endif
|
||||
};
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue