kcontext.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /** @file kcontext.h
  2. *
  3. * @brief Klish context to pass to plugin's functions
  4. */
  5. #ifndef _klish_kcontext_h
  6. #define _klish_kcontext_h
  7. #include <faux/error.h>
  8. #include <klish/kscheme.h>
  9. typedef struct kcontext_s kcontext_t;
  10. typedef enum {
  11. KCONTEXT_NONE,
  12. KCONTEXT_PLUGIN_INIT,
  13. KCONTEXT_PLUGIN_FINI,
  14. KCONTEXT_PLUGIN_ACTION
  15. } kcontext_type_e;
  16. C_DECL_BEGIN
  17. kcontext_t *kcontext_new(kcontext_type_e type);
  18. void kcontext_free(kcontext_t *context);
  19. kcontext_type_e kcontext_type(const kcontext_t *context);
  20. bool_t kcontext_set_type(kcontext_t *context, kcontext_type_e type);
  21. int kcontext_retcode(const kcontext_t *context);
  22. bool_t kcontext_set_retcode(kcontext_t *context, int retcode);
  23. const kplugin_t *kcontext_plugin(const kcontext_t *context);
  24. bool_t kcontext_set_plugin(kcontext_t *context, const kplugin_t *plugin);
  25. const ksym_t *kcontext_sym(const kcontext_t *context);
  26. bool_t kcontext_set_sym(kcontext_t *context, const ksym_t *sym);
  27. const kaction_t *kcontext_action(const kcontext_t *context);
  28. bool_t kcontext_set_action(kcontext_t *context, const kaction_t *action);
  29. const kcommand_t *kcontext_command(const kcontext_t *context);
  30. bool_t kcontext_set_command(kcontext_t *context, const kcommand_t *command);
  31. C_DECL_END
  32. #endif // _klish_kcontext_h