plugin.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * plugin.h
  3. */
  4. #ifndef _clish_plugin_h
  5. #define _clish_plugin_h
  6. /* Symbol types */
  7. typedef struct clish_sym_s clish_sym_t;
  8. typedef struct clish_plugin_s clish_plugin_t;
  9. /* Plugin types */
  10. typedef int clish_plugin_fn_t(void *context, char **out);
  11. typedef int clish_plugin_init_t(clish_plugin_t *plugin);
  12. /* Name of init function within plugin */
  13. #define CLISH_PLUGIN_INIT "clish_plugin_init"
  14. /* Symbol */
  15. int clish_sym_compare(const void *first, const void *second);
  16. clish_sym_t *clish_sym_new(const char *name, clish_plugin_fn_t *func);
  17. void clish_sym_free(clish_sym_t *instance);
  18. void clish_sym__set_func(clish_sym_t *instance, clish_plugin_fn_t *func);
  19. clish_plugin_fn_t *clish_sym__get_func(clish_sym_t *instance);
  20. char *clish_sym__get_name(clish_sym_t *instance);
  21. /* Plugin */
  22. clish_plugin_t *clish_plugin_new(const char *name, const char *file);
  23. void clish_plugin_free(clish_plugin_t *instance);
  24. void *clish_plugin_load(clish_plugin_t *instance);
  25. clish_plugin_fn_t *clish_plugin_get_sym(clish_plugin_t *instance,
  26. const char *name);
  27. int clish_plugin_add_sym(clish_plugin_t *instance,
  28. clish_plugin_fn_t *func, const char *name);
  29. void clish_plugin_dump(const clish_plugin_t *instance);
  30. char *clish_plugin__get_name(const clish_plugin_t *instance);
  31. char *clish_plugin__get_file(const clish_plugin_t *instance);
  32. #endif /* _clish_plugin_h */
  33. /** @} clish_plugin */