private.h 804 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * ptype.h
  3. */
  4. #include "clish/pargv.h"
  5. #include "lub/argv.h"
  6. #include <sys/types.h>
  7. #include <regex.h>
  8. typedef struct clish_ptype_integer_s clish_ptype_integer_t;
  9. struct clish_ptype_integer_s {
  10. int min;
  11. int max;
  12. };
  13. typedef struct clish_ptype_select_s clish_ptype_select_t;
  14. struct clish_ptype_select_s {
  15. lub_argv_t *items;
  16. };
  17. typedef struct clish_ptype_regex_s clish_ptype_regex_t;
  18. struct clish_ptype_regex_s {
  19. bool_t is_compiled;
  20. regex_t re;
  21. };
  22. struct clish_ptype_s {
  23. char *name;
  24. char *text;
  25. char *pattern;
  26. char *range;
  27. clish_ptype_method_e method;
  28. clish_ptype_preprocess_e preprocess;
  29. unsigned int last_name; /* Index used for auto-completion */
  30. union {
  31. clish_ptype_regex_t regex;
  32. clish_ptype_integer_t integer;
  33. clish_ptype_select_t select;
  34. } u;
  35. clish_action_t *action;
  36. };