plugin_dump.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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_FN:
  22. type = "fn";
  23. break;
  24. case CLISH_SYM_TYPE_INIT:
  25. type = "init";
  26. break;
  27. case CLISH_SYM_TYPE_FINI:
  28. type = "fini";
  29. break;
  30. case CLISH_SYM_TYPE_ACCESS:
  31. type = "access";
  32. break;
  33. case CLISH_SYM_TYPE_CONFIG:
  34. type = "config";
  35. break;
  36. case CLISH_SYM_TYPE_LOG:
  37. type = "log";
  38. break;
  39. default:
  40. type = "unknown";
  41. break;
  42. }
  43. lub_dump_printf("type : %s\n", type);
  44. lub_dump_printf("permanent : %s\n",
  45. this->permanent ? "true" : "false");
  46. lub_dump_printf("plugin : %p\n", this->plugin);
  47. lub_dump_undent();
  48. }
  49. /*--------------------------------------------------------- */
  50. void clish_plugin_dump(const clish_plugin_t *this)
  51. {
  52. lub_list_node_t *iter;
  53. clish_sym_t *sym;
  54. lub_dump_printf("plugin(%p)\n", this);
  55. lub_dump_indent();
  56. lub_dump_printf("name : %s\n", this->name);
  57. lub_dump_printf("file : %s\n", this->file);
  58. lub_dump_printf("dlhan : %p\n", this->dlhan);
  59. lub_dump_indent();
  60. /* Iterate child elements */
  61. for(iter = lub_list__get_head(this->syms);
  62. iter; iter = lub_list_node__get_next(iter)) {
  63. sym = (clish_sym_t *)lub_list_node__get_data(iter);
  64. clish_sym_dump(sym);
  65. }
  66. lub_dump_undent();
  67. lub_dump_undent();
  68. }
  69. /*--------------------------------------------------------- */
  70. #endif /* DEBUG */