kptype.h 923 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /** @file kptype.h
  2. *
  3. * @brief Klish scheme's "ptype" entry
  4. */
  5. #ifndef _klish_kptype_h
  6. #define _klish_kptype_h
  7. #include <klish/kaction.h>
  8. typedef struct kptype_s kptype_t;
  9. typedef struct iptype_s {
  10. char *name;
  11. char *help;
  12. iaction_t * (*actions)[];
  13. } iptype_t;
  14. typedef enum {
  15. KPTYPE_ERROR_OK,
  16. KPTYPE_ERROR_INTERNAL,
  17. KPTYPE_ERROR_ALLOC,
  18. KPTYPE_ERROR_ATTR_NAME,
  19. KPTYPE_ERROR_ATTR_HELP,
  20. } kptype_error_e;
  21. C_DECL_BEGIN
  22. void kptype_free(kptype_t *ptype);
  23. bool_t kptype_parse(kptype_t *ptype, const iptype_t *info, kptype_error_e *error);
  24. kptype_t *kptype_new(const iptype_t *info, kptype_error_e *error);
  25. const char *kptype_strerror(kptype_error_e error);
  26. const char *kptype_name(const kptype_t *ptype);
  27. bool_t kptype_set_name(kptype_t *ptype, const char *name);
  28. const char *kptype_help(const kptype_t *ptype);
  29. bool_t kptype_set_help(kptype_t *ptype, const char *help);
  30. C_DECL_END
  31. #endif // _klish_kptype_h