1
0

kscheme.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /** @file kscheme.h
  2. *
  3. * @brief Klish Scheme
  4. */
  5. #ifndef _klish_kscheme_h
  6. #define _klish_kscheme_h
  7. #include <faux/list.h>
  8. #include <klish/kplugin.h>
  9. #include <klish/kentry.h>
  10. #include <klish/kcontext_base.h>
  11. #include <klish/kudata.h>
  12. typedef struct kscheme_s kscheme_t;
  13. typedef faux_list_node_t kscheme_plugins_node_t;
  14. typedef faux_list_node_t kscheme_entrys_node_t;
  15. C_DECL_BEGIN
  16. kscheme_t *kscheme_new(void);
  17. void kscheme_free(kscheme_t *scheme);
  18. bool_t kscheme_prepare(kscheme_t *scheme, kcontext_t *context, faux_error_t *error);
  19. bool_t kscheme_fini(kscheme_t *scheme, kcontext_t *context, faux_error_t *error);
  20. // PLUGINs
  21. faux_list_t *kscheme_plugins(const kscheme_t *scheme);
  22. bool_t kscheme_add_plugins(kscheme_t *scheme, kplugin_t *plugin);
  23. kplugin_t *kscheme_find_plugin(const kscheme_t *scheme, const char *name);
  24. ssize_t kscheme_plugins_len(const kscheme_t *scheme);
  25. kscheme_plugins_node_t *kscheme_plugins_iter(const kscheme_t *scheme);
  26. kplugin_t *kscheme_plugins_each(kscheme_plugins_node_t **iter);
  27. // ENTRYs
  28. kentry_t *kscheme_find_entry_by_path(const kscheme_t *scheme, const char *name);
  29. faux_list_t *kscheme_entrys(const kscheme_t *scheme);
  30. bool_t kscheme_add_entrys(kscheme_t *scheme, kentry_t *entry);
  31. kentry_t *kscheme_find_entry(const kscheme_t *scheme, const char *name);
  32. ssize_t kscheme_entrys_len(const kscheme_t *scheme);
  33. kscheme_entrys_node_t *kscheme_entrys_iter(const kscheme_t *scheme);
  34. kentry_t *kscheme_entrys_each(kscheme_entrys_node_t **iter);
  35. // User data store
  36. bool_t kscheme_named_udata_new(kscheme_t *scheme,
  37. const char *name, void *data, kudata_data_free_fn free_fn);
  38. void *kscheme_named_udata(kscheme_t *scheme, const char *name);
  39. C_DECL_END
  40. #endif // _klish_kscheme_h