summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2009-09-06 13:03:37 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2015-06-26 00:30:14 -0600
commite1c9e116260d56fce4d1722c62434f9ddb2b229d (patch)
tree5a6cdce0612bfed13766dc7efd911dcefdf59e9c
parentb1e41f328ea871696dae7024a7a1aa6e173f3b26 (diff)
rework the structure of the depend functions
-rw-r--r--wrapper/plugin-depend.c43
1 files changed, 28 insertions, 15 deletions
diff --git a/wrapper/plugin-depend.c b/wrapper/plugin-depend.c
index f0e62d7..11a87eb 100644
--- a/wrapper/plugin-depend.c
+++ b/wrapper/plugin-depend.c
@@ -24,7 +24,7 @@
DON'T plan on using the string again, it will be mutilated!
(so we go ahead and free() it) */
struct plugin_command *
-_plugin_depend_parse(struct plugin *root, char *string)
+_plugin_depend_parse (char *string, struct plugin_command *root)
{
char *c=strchr(string,'/');
c[0]='\0';
@@ -36,7 +36,8 @@ _plugin_depend_parse(struct plugin *root, char *string)
/* used by _plugin_depend_add */
void
-_plugin_depend_add2(struct plugin_command *prev, struct plugin_command *next)
+_plugin_depend_add2 (struct plugin_command *prev,
+ struct plugin_command *next)
{
if (prev->d_next==NULL) {
prev->d_next=next;
@@ -47,7 +48,8 @@ _plugin_depend_add2(struct plugin_command *prev, struct plugin_command *next)
/* _plugin_depend_add(depend,depender) */
void
-_plugin_depend_add(struct plugin_command *depend, struct plugin_command *depender)
+_plugin_depend_add (struct plugin_command *depend,
+ struct plugin_command *depender)
{
if (depend->child==NULL) {
depend->child=depender;
@@ -58,37 +60,48 @@ _plugin_depend_add(struct plugin_command *depend, struct plugin_command *depende
/* take care of depends for `command', and those after it (linked list) */
void
-_plugin_depend_command(struct plugin_command *command, struct plugin_tree *tree)
+_plugin_depend_command (struct plugin_command *command,
+ struct plugin_command *root)
{
if (command->depends == NULL) {
- command->depend=tree->depends;
+ command->depend=root;
} else {
- command->depend=_plugin_depend_parse(tree->plugins,command->depends);
+ command->depend=_plugin_depend_parse(root,command->depends);
command->depends=NULL;
}
_plugin_depend_add(command->depend,command);
if (command->p_next != NULL)
- _plugin_depend_command(command->p_next,tree);
+ _plugin_depend_command(command->p_next,root);
}
/* take care of commands for a `plugin', and those after it (linked list) */
void
-_plugin_depend_plugin(struct plugin *plugin, struct plugin_tree *tree)
+_plugin_depend_plugin_all (struct plugin *plugin, struct plugin_command *root)
{
- _plugin_depend_command(plugin->child,tree);
+ _plugin_depend_command(plugin->child,root);
if (plugin->next != NULL) {
- _plugin_depend_plugin(plugin->next,tree);
+ _plugin_depend_plugin_all(plugin->next,root);
}
}
/* take care of all depends */
-void
-_plugin_depend(struct plugin_tree *tree)
+struct plugin_command *
+_plugin_depend_all (struct plugin_command *plugins)
+{
+ struct plugin_command *root=mkcommand();
+
+ _plugin_depend_plugin_all(*plugins,root);
+ return root;
+}
+
+/* take care of all depends for a particular command */
+struct plugin_command *
+_plugin_depend_name (char *name, struct plugin_command *plugins)
{
- struct plugin_command *command=mkcommand();
- tree->depends=command;
+ struct plugin_command *root=mkcommand();
- _plugin_depend_plugin(tree->plugins,tree);
+ /* code goes here */
+ return root;
}
#endif