dim/include/plug.h
2024-06-14 18:22:20 +03:00

32 lines
979 B
C

#ifndef _H_PLUG
#define _H_PLUG
#include <stdio.h>
typedef struct plug_info_t {
char* name;
char* version;
char* license;
} plug_info_t;
#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);
void plug_init(); // Loads when DIM initialises
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