kview.h 755 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /** @file view.h
  2. *
  3. * @brief Klish scheme's "view" entry
  4. */
  5. #ifndef _klish_kview_h
  6. #define _klish_kview_h
  7. #include <faux/faux.h>
  8. #include <klish/kcommand.h>
  9. typedef struct kview_s kview_t;
  10. typedef struct iview_s {
  11. char *name;
  12. icommand_t * (*commands)[];
  13. } iview_t;
  14. typedef enum {
  15. KVIEW_ERROR_OK,
  16. KVIEW_ERROR_MALLOC,
  17. KVIEW_ERROR_LIST
  18. } kview_error_e;
  19. C_DECL_BEGIN
  20. kview_t *kview_new(const iview_t *info, kview_error_e *error);
  21. void kview_free(kview_t *view);
  22. bool_t kview_parse(kview_t *view, const iview_t *info, kview_error_e *error);
  23. const char *kview_name(const kview_t *view);
  24. bool_t kview_set_name(kview_t *view, const char *name);
  25. bool_t kview_add_command(kview_t *view, kcommand_t *command);
  26. C_DECL_END
  27. #endif // _klish_kview_h