Rust rewrite
This commit is contained in:
31
include/plug.h
Normal file
31
include/plug.h
Normal file
@@ -0,0 +1,31 @@
|
||||
|
||||
#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
|
||||
Reference in New Issue
Block a user