kaction.h 773 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /** @file action.h
  2. *
  3. * @brief Klish scheme's "action" entry
  4. */
  5. #ifndef _klish_kaction_h
  6. #define _klish_kaction_h
  7. #include <klish/kcommand.h>
  8. typedef struct kaction_s kaction_t;
  9. typedef struct iaction_s {
  10. char *sym;
  11. char *exec_on;
  12. char *update_retcode;
  13. } iaction_t;
  14. typedef enum {
  15. KACTION_ERROR_OK,
  16. KACTION_ERROR_MALLOC,
  17. KACTION_ERROR_LIST
  18. } kaction_error_e;
  19. typedef enum {
  20. KACTION_COND_FAIL,
  21. KACTION_COND_SUCCESS,
  22. KACTION_COND_ALWAYS
  23. } kaction_cond_e;
  24. C_DECL_BEGIN
  25. kaction_t *kaction_new(iaction_t info);
  26. kaction_t *kaction_new_static(iaction_t info);
  27. void kaction_free(kaction_t *action);
  28. const char *kaction_name(const kaction_t *action);
  29. bool_t kaction_add_command(kaction_t *action, kcommand_t *command);
  30. C_DECL_END
  31. #endif // _klish_kaction_h