Browse Source

Implement plugin_dump

Serj Kalichev 11 years ago
parent
commit
0777d44842
4 changed files with 23 additions and 11 deletions
  1. 2 0
      clish/module.am
  2. 3 1
      clish/plugin/module.am
  3. 17 10
      clish/plugin/plugin_dump.c
  4. 1 0
      clish/plugin/private.h

+ 2 - 0
clish/module.am

@@ -47,6 +47,7 @@ EXTRA_DIST += \
 	clish/action/module.am \
 	clish/config/module.am \
 	clish/hotkey/module.am \
+	clish/plugin/module.am \
 	clish/README
 
 include $(top_srcdir)/clish/command/module.am
@@ -60,3 +61,4 @@ include $(top_srcdir)/clish/var/module.am
 include $(top_srcdir)/clish/action/module.am
 include $(top_srcdir)/clish/config/module.am
 include $(top_srcdir)/clish/hotkey/module.am
+include $(top_srcdir)/clish/plugin/module.am

+ 3 - 1
clish/plugin/module.am

@@ -1,4 +1,6 @@
 libclish_la_SOURCES += \
-	clish/plugin/plugin.c \
 	clish/plugin/plugin_dump.c \
 	clish/plugin/private.h
+
+#	clish/plugin/plugin.c \
+#

+ 17 - 10
clish/plugin/plugin_dump.c

@@ -1,29 +1,36 @@
 /*
- * hotkey_dump.c
+ * plugin_dump.c
  */
 #include "private.h"
 #include "lub/dump.h"
+#include "lub/list.h"
+#include "clish/plugin.h"
 
 /*--------------------------------------------------------- */
-void clish_hotkey_dump(const clish_hotkey_t *this)
+void clish_sym_dump(const clish_sym_t *this)
 {
-	lub_dump_printf("hotkey(%p)\n", this);
+	lub_dump_printf("plugin(%p)\n", this);
 
 	lub_dump_indent();
-	lub_dump_printf("key : %d\n", this->code);
-	lub_dump_printf("cmd : %s\n", this->cmd);
+	lub_dump_printf("name : %s\n", this->name);
+	lub_dump_printf("func : %p\n", this->func);
 	lub_dump_undent();
 }
 
 /*--------------------------------------------------------- */
-void clish_hotkeyv_dump(const clish_hotkeyv_t *this)
+void clish_plugin_dump(const clish_plugin_t *this)
 {
-	unsigned int i;
+	lub_list_node_t *iter;
+	clish_sym_t *sym;
 
-	lub_dump_printf("hotkeyv(%p)\n", this);
+	lub_dump_printf("plugin(%p)\n", this);
 	lub_dump_indent();
-	for (i = 0; i < this->num; i++)
-		clish_hotkey_dump(this->hotkeyv[i]);
+	/* Iterate child elements */
+	for(iter = lub_list__get_head(this->syms);
+		iter; iter = lub_list_node__get_next(iter)) {
+		sym = (clish_sym_t *)lub_list_node__get_data(iter);
+		clish_sym_dump(sym);
+	}
 	lub_dump_undent();
 }
 

+ 1 - 0
clish/plugin/private.h

@@ -2,6 +2,7 @@
  * plugin private.h
  */
 
+#include "lub/list.h"
 #include "clish/plugin.h"
 
 /*---------------------------------------------------------