diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2009-09-03 19:38:20 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2015-06-26 00:30:14 -0600 |
commit | 67d3b5846d84d4a2e5a31d4e268bc9d51495d7e0 (patch) | |
tree | 92db2e7852b7ee09e55a68276101566c562a4283 /c/plugin-debug.c | |
parent | 1eacc442394d1f70bbe05dea699c80ca41f26d4c (diff) |
the C implementation properly loads the plugins, then creates a dependancy tree
Diffstat (limited to 'c/plugin-debug.c')
-rw-r--r-- | c/plugin-debug.c | 69 |
1 files changed, 58 insertions, 11 deletions
diff --git a/c/plugin-debug.c b/c/plugin-debug.c index 50e5497..553237d 100644 --- a/c/plugin-debug.c +++ b/c/plugin-debug.c @@ -18,23 +18,70 @@ 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -void print_commands(struct plugin_command *command) +size_t xstrlen (const char *s) { - printf(" - %s\n",command->name); - if (command->depends != NULL) { - printf(" depend: %s\n",command->depends); + printf("xstrlen(%p)\n",s); + size_t size=0; + while (s[size] != '\0') { + printf("%i = %p `%c'\n",size,&s[size],s[size]); + size++; } - if (command->p_next != NULL) { - print_commands(command->p_next); + return size; +} + +void _plugin_print_plugin_command(struct plugin_command *command) +{ + if (command != NULL) { + printf(" - %s\n",command->name); + if (command->depends != NULL) + printf(" depend string: %s\n",command->depends); + if (command->depend->plugin == NULL) { + puts (" depend: <none>"); + } else { + printf(" depend: %s / %s\n", + command->depend->plugin->name, + command->depend->name); + } + _plugin_print_plugin_command(command->p_next); + } +} + +void _plugin_print_plugin(struct plugin *plugin) +{ + if (plugin != NULL) { + printf(" %s\n",plugin->name); + _plugin_print_plugin_command(plugin->child); + _plugin_print_plugin(plugin->next); } } -void print_plugins(struct plugin *plugin) +void _plugin_print_depend(struct plugin_command *command,size_t indent) { - printf("%s\n",plugin->name); - print_commands(plugin->child); - if (plugin->next != NULL) { - print_plugins(plugin->next); + int i=0; + while (i < indent) { + printf(" "); + i++; } + if (command->name == NULL) { + puts("<none>"); + } else { + printf("%s / %s\n", + command->plugin->name, + command->name); + } + if (command->child != NULL) { + _plugin_print_depend(command->child,indent+1); + } + if (command->d_next != NULL) { + _plugin_print_depend(command->d_next,indent); + } +} + +void _plugin_print(struct plugin_tree *tree) +{ + puts("Plugins:"); + _plugin_print_plugin(tree->plugins); + puts("\nDepends:"); + _plugin_print_depend(tree->depends,0); } |