plugin_dump.c 1.7 KB

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