plugin_dump.c 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #ifdef DEBUG
  2. /*
  3. * plugin_dump.c
  4. */
  5. #include "private.h"
  6. #include "lub/dump.h"
  7. #include "lub/list.h"
  8. #include "clish/plugin.h"
  9. /*--------------------------------------------------------- */
  10. void clish_sym_dump(const clish_sym_t *this)
  11. {
  12. char *type = NULL;
  13. lub_dump_printf("sym(%p)\n", this);
  14. lub_dump_indent();
  15. lub_dump_printf("name : %s\n", this->name);
  16. lub_dump_printf("func : %p\n", this->func);
  17. switch (this->type) {
  18. case CLISH_SYM_TYPE_NONE:
  19. type = "none";
  20. break;
  21. case CLISH_SYM_TYPE_ACTION:
  22. type = "action";
  23. break;
  24. case CLISH_SYM_TYPE_ACCESS:
  25. type = "access";
  26. break;
  27. case CLISH_SYM_TYPE_CONFIG:
  28. type = "config";
  29. break;
  30. case CLISH_SYM_TYPE_LOG:
  31. type = "log";
  32. break;
  33. default:
  34. type = "unknown";
  35. break;
  36. }
  37. lub_dump_printf("type : %s\n", type);
  38. lub_dump_printf("permanent : %s\n",
  39. this->permanent ? "true" : "false");
  40. lub_dump_printf("plugin : %p\n", this->plugin);
  41. lub_dump_undent();
  42. }
  43. /*--------------------------------------------------------- */
  44. void clish_plugin_dump(const clish_plugin_t *this)
  45. {
  46. lub_list_node_t *iter;
  47. clish_sym_t *sym;
  48. lub_dump_printf("plugin(%p)\n", this);
  49. lub_dump_indent();
  50. lub_dump_printf("name : %s\n", this->name);
  51. lub_dump_printf("alias : %s\n", this->alias);
  52. lub_dump_printf("conf : %s\n", this->conf);
  53. lub_dump_printf("dlhan : %p\n", this->dlhan);
  54. lub_dump_printf("init : %p\n", this->init);
  55. lub_dump_printf("fini : %p\n", this->fini);
  56. lub_dump_indent();
  57. /* Iterate child elements */
  58. for(iter = lub_list__get_head(this->syms);
  59. iter; iter = lub_list_node__get_next(iter)) {
  60. sym = (clish_sym_t *)lub_list_node__get_data(iter);
  61. clish_sym_dump(sym);
  62. }
  63. lub_dump_undent();
  64. lub_dump_undent();
  65. }
  66. /*--------------------------------------------------------- */
  67. #endif /* DEBUG */