1
0

command.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /*
  2. * command.h
  3. */
  4. #ifndef _clish_command_h
  5. #define _clish_command_h
  6. typedef struct clish_command_s clish_command_t;
  7. #include "lub/bintree.h"
  8. #include "lub/argv.h"
  9. #include "clish/pargv.h"
  10. #include "clish/view.h"
  11. #include "clish/param.h"
  12. typedef enum {
  13. CLISH_CONFIG_NONE,
  14. CLISH_CONFIG_SET,
  15. CLISH_CONFIG_UNSET,
  16. CLISH_CONFIG_DUMP
  17. } clish_config_operation_t;
  18. /*=====================================
  19. * COMMAND INTERFACE
  20. *===================================== */
  21. /*-----------------
  22. * meta functions
  23. *----------------- */
  24. clish_command_t *clish_command_new(const char *name, const char *text);
  25. clish_command_t *clish_command_new_link(const char *name,
  26. const clish_command_t * ref);
  27. int clish_command_bt_compare(const void *clientnode, const void *clientkey);
  28. void clish_command_bt_getkey(const void *clientnode, lub_bintree_key_t * key);
  29. size_t clish_command_bt_offset(void);
  30. clish_command_t *clish_command_choose_longest(clish_command_t * cmd1,
  31. clish_command_t * cmd2);
  32. int
  33. clish_command_diff(const clish_command_t * cmd1, const clish_command_t * cmd2);
  34. /*-----------------
  35. * methods
  36. *----------------- */
  37. void clish_command_delete(clish_command_t * instance);
  38. void
  39. clish_command_insert_param(clish_command_t * instance, clish_param_t * param);
  40. void clish_command_help(const clish_command_t * instance, const char *viewid,
  41. const char *line);
  42. void clish_command_dump(const clish_command_t * instance);
  43. /*-----------------
  44. * attributes
  45. *----------------- */
  46. const char *clish_command__get_name(const clish_command_t * instance);
  47. const char *clish_command__get_suffix(const clish_command_t * instance);
  48. const char *clish_command__get_text(const clish_command_t * instance);
  49. const char *clish_command__get_detail(const clish_command_t * instance);
  50. const char *clish_command__get_builtin(const clish_command_t * instance);
  51. const char *clish_command__get_escape_chars(const clish_command_t * instance);
  52. const clish_param_t *clish_command__get_args(const clish_command_t * instance);
  53. char *clish_command__get_action(const clish_command_t * instance,
  54. const char *viewid, clish_pargv_t * pargv);
  55. clish_view_t *clish_command__get_view(const clish_command_t * instance);
  56. char *clish_command__get_viewid(const clish_command_t * instance,
  57. const char *viewid, clish_pargv_t * pargv);
  58. const unsigned clish_command__get_param_count(const clish_command_t * instance);
  59. const clish_param_t *clish_command__get_param(const clish_command_t * instance,
  60. unsigned index);
  61. clish_paramv_t *clish_command__get_paramv(const clish_command_t * instance);
  62. void clish_command__set_action(clish_command_t * instance, const char *action);
  63. void
  64. clish_command__set_builtin(clish_command_t * instance, const char *builtin);
  65. void
  66. clish_command__set_escape_chars(clish_command_t * instance,
  67. const char *escape_chars);
  68. void clish_command__set_args(clish_command_t * instance, clish_param_t * args);
  69. void clish_command__set_detail(clish_command_t * instance, const char *detail);
  70. void clish_command__set_view(clish_command_t * instance, clish_view_t * view);
  71. void clish_command__force_view(clish_command_t * instance, clish_view_t * view);
  72. void clish_command__set_viewid(clish_command_t * instance, const char *viewid);
  73. void clish_command__force_viewid(clish_command_t * instance, const char *viewid);
  74. void clish_command__set_pview(clish_command_t * instance, clish_view_t * view);
  75. clish_view_t *clish_command__get_pview(const clish_command_t * instance);
  76. unsigned clish_command__get_depth(const clish_command_t * instance);
  77. void
  78. clish_command__set_cfg_op(clish_command_t * instance,
  79. clish_config_operation_t operation);
  80. clish_config_operation_t
  81. clish_command__get_cfg_op(const clish_command_t * instance);
  82. void clish_command__set_priority(clish_command_t * instance, unsigned short priority);
  83. unsigned short clish_command__get_priority(const clish_command_t * instance);
  84. void
  85. clish_command__set_pattern(clish_command_t * instance, const char *pattern);
  86. char *clish_command__get_pattern(const clish_command_t * instance,
  87. const char * viewid, clish_pargv_t * pargv);
  88. void clish_command__set_file(clish_command_t * instance, const char *file);
  89. char *clish_command__get_file(const clish_command_t * instance,
  90. const char * viewid, clish_pargv_t * pargv);
  91. void clish_command__set_splitter(clish_command_t * instance, bool_t splitter);
  92. bool_t clish_command__get_splitter(const clish_command_t * instance);
  93. const char * clish_command__is_seq(const clish_command_t * instance);
  94. void clish_command__set_seq(clish_command_t * instance, const char * seq_num);
  95. unsigned short clish_command__get_seq(const clish_command_t * instance,
  96. const char *viewid, clish_pargv_t * pargv);
  97. clish_view_restore_t clish_command__get_restore(const clish_command_t * instance);
  98. bool_t clish_command__get_unique(const clish_command_t * instance);
  99. void clish_command__set_unique(clish_command_t * instance, bool_t unique);
  100. const clish_command_t * clish_command__get_orig(const clish_command_t * instance);
  101. void clish_command__set_cfg_depth(clish_command_t * instance, const char * cfg_depth);
  102. unsigned clish_command__get_cfg_depth(const clish_command_t * instance,
  103. const char *viewid, clish_pargv_t * pargv);
  104. bool_t clish_command__get_lock(const clish_command_t * instance);
  105. void clish_command__set_lock(clish_command_t * instance, bool_t lock);
  106. #endif /* _clish_command_h */