2024-06-14 15:22:20 +00:00
|
|
|
|
|
|
|
#ifndef _H_PLUG
|
|
|
|
#define _H_PLUG
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
typedef struct plug_info_t {
|
|
|
|
char* name;
|
|
|
|
char* version;
|
|
|
|
char* license;
|
|
|
|
} plug_info_t;
|
|
|
|
|
2024-06-20 20:43:16 +00:00
|
|
|
typedef struct plug_ctx_t {
|
|
|
|
char* config_dir;
|
|
|
|
} plug_ctx_t;
|
|
|
|
|
2024-06-14 15:22:20 +00:00
|
|
|
#define PLUG_INFO(_name, _version, _license) \
|
|
|
|
static plug_info_t PLUG_INFO_VAR = { .name=(_name), .version=(_version), .license=(_license)}; \
|
|
|
|
void* plug_get_info() { \
|
|
|
|
return &PLUG_INFO_VAR; \
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#define PLUG_NAME(s) volatile char* PLUG_NAME = (s);
|
|
|
|
#define PLUG_VERSION(s) volatile char* PLUG_VERSION = (s);
|
|
|
|
#define PLUG_LICENSE(s) volatile char* PLUG_LICENSE = (s);
|
|
|
|
|
|
|
|
|
2024-06-20 20:43:16 +00:00
|
|
|
void plug_init(plug_ctx_t*); // Loads when DIM initialises
|
2024-06-14 15:22:20 +00:00
|
|
|
void* plug_pre_reload(); // Return a pointer to save state
|
|
|
|
void plug_post_reload(void*); // returns the same pointer after reload
|
|
|
|
void plug_poll(char*, size_t); // Write the message to `buf` with max `size` characters
|
|
|
|
void plug_free(); // Free everything before being killed
|
|
|
|
|
|
|
|
#endif
|