[anjuta/newproject] Fix uncommon case when adding target
- From: Sebastien Granjoux <sgranjoux src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta/newproject] Fix uncommon case when adding target
- Date: Wed, 6 Oct 2010 19:00:20 +0000 (UTC)
commit 11f96df5c50d2b551721f361eed6687518cd3ac8
Author: Sébastien Granjoux <seb sfo free fr>
Date: Sat Oct 2 14:29:17 2010 +0200
Fix uncommon case when adding target
libanjuta/anjuta-token-file.c | 7 +-
libanjuta/anjuta-token-list.c | 24 ++-
libanjuta/anjuta-token.c | 121 ++++++++++---
libanjuta/anjuta-token.h | 4 +
plugins/am-project/am-node.c | 61 +++----
plugins/am-project/am-node.h | 20 ++-
plugins/am-project/am-parser.y | 17 ++-
plugins/am-project/am-project-private.h | 21 +--
plugins/am-project/am-project.c | 301 ++++++-------------------------
plugins/am-project/am-project.h | 1 -
plugins/am-project/am-writer.c | 208 ++++++++++++++++++++-
plugins/am-project/am-writer.h | 5 +-
plugins/am-project/projectparser.c | 5 +
plugins/am-project/tests/target.at | 47 +++++-
14 files changed, 492 insertions(+), 350 deletions(-)
---
diff --git a/libanjuta/anjuta-token-file.c b/libanjuta/anjuta-token-file.c
index 0ab70d1..3ac2b83 100644
--- a/libanjuta/anjuta-token-file.c
+++ b/libanjuta/anjuta-token-file.c
@@ -301,7 +301,6 @@ anjuta_token_file_update (AnjutaTokenFile *file, AnjutaToken *token)
if (flags & ANJUTA_TOKEN_REMOVED)
{
- anjuta_token_dump (anjuta_token_list (next));
next = anjuta_token_file_remove_token (file, next);
continue;
}
@@ -320,7 +319,7 @@ anjuta_token_file_update (AnjutaTokenFile *file, AnjutaToken *token)
AnjutaToken *start = NULL;
value = g_new (gchar, added);
- anjuta_token_prepend_child (file->save, anjuta_token_new_with_string (ANJUTA_TOKEN_NAME, value, added));
+ add = anjuta_token_prepend_child (file->save, anjuta_token_new_with_string (ANJUTA_TOKEN_NAME, value, added));
/* Find token position */
if (prev != NULL)
@@ -355,13 +354,11 @@ anjuta_token_file_update (AnjutaTokenFile *file, AnjutaToken *token)
anjuta_token_set_string (next, value, len);
value += len;
}
+ anjuta_token_clear_flags (next, ANJUTA_TOKEN_ADDED);
}
}
}
- //fprintf (stdout, "Dump config list from file:\n");
- //anjuta_token_dump (file->content);
-
return TRUE;
}
diff --git a/libanjuta/anjuta-token-list.c b/libanjuta/anjuta-token-list.c
index 19687ed..ccd534d 100644
--- a/libanjuta/anjuta-token-list.c
+++ b/libanjuta/anjuta-token-list.c
@@ -175,12 +175,17 @@ anjuta_token_style_update (AnjutaTokenStyle *style, AnjutaToken *list)
/* Initialize first line width */
for (token = list; token != NULL; token = anjuta_token_previous (token))
{
- gchar *value = anjuta_token_evaluate (token);
- const gchar *eol = strrchr (value, '\n');
- gsize len = strlen (value);
-
- g_free (value);
-
+ gchar *value;
+ gchar *eol = NULL;
+ gsize len = 0;
+
+ value = anjuta_token_evaluate (token);
+ if (value != NULL)
+ {
+ eol = strrchr (value, '\n');
+ len = strlen (value);
+ g_free (value);
+ }
if (eol != NULL)
{
@@ -562,7 +567,8 @@ anjuta_token_insert_word_after (AnjutaToken *list, AnjutaToken *sibling, AnjutaT
for (token = anjuta_token_first_item (list); token != NULL;)
{
AnjutaToken *next;
-
+
+ fprintf(stderr, "anjuta_token_first_item list %p sibling %p item %p token %p\n", list, sibling, item, token);
switch (anjuta_token_get_type (token))
{
case ANJUTA_TOKEN_LAST:
@@ -598,13 +604,15 @@ anjuta_token_insert_word_after (AnjutaToken *list, AnjutaToken *sibling, AnjutaT
next = anjuta_token_next_item (token);
if (next == NULL)
{
+ fprintf(stderr, "anjuta_token_word_after list %p sibling %p item %p token %p\n", list, sibling, item, token);
token = anjuta_token_insert_after (token, anjuta_token_new_static (ANJUTA_TOKEN_NEXT | ANJUTA_TOKEN_ADDED, NULL));
anjuta_token_insert_after (token, item);
return item;
}
token = next;
}
-
+
+ fprintf(stderr, "anjuta_token_word_after list %p sibling %p item %p\n", list, sibling, item);
anjuta_token_prepend_items (list, item);
return item;
diff --git a/libanjuta/anjuta-token.c b/libanjuta/anjuta-token.c
index 8d54def..8ec1b5f 100644
--- a/libanjuta/anjuta-token.c
+++ b/libanjuta/anjuta-token.c
@@ -535,23 +535,15 @@ AnjutaToken *
anjuta_token_next_item (AnjutaToken *item)
{
AnjutaToken *last;
- AnjutaToken *next = item;
+ AnjutaToken *next;
- while (next != NULL)
- {
- for (last = next; last->last != NULL; last = last->last);
- next = last->next;
- if (next == NULL)
- {
- next = last->parent;
- }
- else
- {
- for (; next->children != NULL; next = next->children);
- break;
- }
- }
+ if (item == NULL) return NULL;
+
+ if ((item->group != NULL) && (item->group->last == item)) return NULL;
+ for (last = item; last->last != NULL; last = last->last);
+ next = last->next;
+
return next;
}
@@ -1106,28 +1098,105 @@ AnjutaToken *anjuta_token_cut (AnjutaToken *token, guint pos, guint size)
return copy;
}
-/* Token evaluation
+/* Token foreach
*---------------------------------------------------------------------------*/
-gchar *
-anjuta_token_evaluate (AnjutaToken *token)
+void
+anjuta_token_foreach (AnjutaToken *token, AnjutaTokenForeachFunc func, gpointer user_data)
{
- GString *value = g_string_new (NULL);
-
if (token != NULL)
{
- AnjutaToken *next;
-
- next = anjuta_token_next_item (token);
- for (; token != next; token = anjuta_token_next2 (token))
+ AnjutaToken *last_parent;
+ AnjutaToken *last_token;
+ gboolean expand = TRUE;
+
+ last_parent = NULL;
+ last_token = token->last == NULL ? token : token->last;
+ while (token != NULL)
{
- if (token->children == NULL)
+ if (expand && (token->children != NULL))
{
- anjuta_token_evaluate_token (token, value, TRUE);
+ /* Enumerate children */
+ token = token->children;
+ }
+ else
+ {
+ if (token->children == NULL)
+ {
+ /* Take into account only the content of token having no children */
+ if (last_parent == NULL)
+ {
+ /* Take into account only the content of group having no children */
+ func (token, user_data);
+ }
+ }
+
+ /* Check if we have found the last token */
+ if (token == last_token)
+ {
+ /* Find last token */
+ if (token->last == NULL)
+ {
+ break;
+ }
+ /* Last token still include additional tokens */
+ last_token = token->last;
+ }
+
+ if (token == last_parent)
+ {
+ /* Find last parent */
+ if (token->last == NULL)
+ {
+ /* Found complete group having children */
+ last_parent = NULL;
+ }
+ else
+ {
+ /* Parent group has additional token */
+ last_parent = token->last;
+ }
+ }
+
+ if (token->next != NULL)
+ {
+ /* Get next sibling */
+ token = token->next;
+ expand = TRUE;
+ }
+ else
+ {
+ /* Get parent */
+ token = token->parent;
+ last_parent = token->last;
+ expand = FALSE;
+ }
}
}
}
+ return;
+}
+
+/* Token evaluation
+ *---------------------------------------------------------------------------*/
+
+static void
+evaluate_raw_token (AnjutaToken *token, gpointer user_data)
+{
+ GString *value = (GString *)user_data;
+
+ anjuta_token_evaluate_token (token, value, TRUE);
+}
+
+
+gchar *
+anjuta_token_evaluate (AnjutaToken *token)
+{
+ GString *value = g_string_new (NULL);
+
+ anjuta_token_foreach (token, evaluate_raw_token, value);
+
/* Return NULL and free data for an empty string */
return g_string_free (value, *(value->str) == '\0');
}
diff --git a/libanjuta/anjuta-token.h b/libanjuta/anjuta-token.h
index 08909d0..bf2bc9f 100644
--- a/libanjuta/anjuta-token.h
+++ b/libanjuta/anjuta-token.h
@@ -86,6 +86,8 @@ typedef enum
typedef struct _AnjutaToken AnjutaToken;
+typedef void (*AnjutaTokenForeachFunc) (AnjutaToken *token, gpointer data);
+
AnjutaToken *anjuta_token_new_string (AnjutaTokenType type, const gchar *value);
AnjutaToken *anjuta_token_new_with_string (AnjutaTokenType type, gchar *value, gsize length);
AnjutaToken *anjuta_token_new_static (AnjutaTokenType type, const gchar *value);
@@ -109,6 +111,8 @@ AnjutaToken *anjuta_token_last (AnjutaToken *token);
AnjutaToken *anjuta_token_parent (AnjutaToken *token);
AnjutaToken *anjuta_token_list (AnjutaToken *token);
AnjutaToken *anjuta_token_next_after_children (AnjutaToken *token);
+void anjuta_token_foreach (AnjutaToken *token, AnjutaTokenForeachFunc func, gpointer user_data);
+
AnjutaToken *anjuta_token_first_item (AnjutaToken *list);
AnjutaToken *anjuta_token_next_item (AnjutaToken *item);
diff --git a/plugins/am-project/am-node.c b/plugins/am-project/am-node.c
index b9cfd92..39f9a14 100644
--- a/plugins/am-project/am-node.c
+++ b/plugins/am-project/am-node.c
@@ -341,36 +341,32 @@ anjuta_am_package_node_class_init (AnjutaAmPackageNodeClass *klass)
void
-amp_group_add_token (AnjutaProjectNode *node, AnjutaToken *token, AmpGroupTokenCategory category)
+amp_group_add_token (AnjutaAmGroupNode *group, AnjutaToken *token, AmpGroupTokenCategory category)
{
- AnjutaAmGroupNode *group = ANJUTA_AM_GROUP_NODE (node);
-
group->tokens[category] = g_list_prepend (group->tokens[category], token);
}
GList *
-amp_group_get_token (AnjutaProjectNode *node, AmpGroupTokenCategory category)
+amp_group_get_token (AnjutaAmGroupNode *group, AmpGroupTokenCategory category)
{
- AnjutaAmGroupNode *group = ANJUTA_AM_GROUP_NODE (node);
-
return group->tokens[category];
}
AnjutaToken*
-amp_group_get_first_token (AnjutaProjectNode *node, AmpGroupTokenCategory category)
+amp_group_get_first_token (AnjutaAmGroupNode *group, AmpGroupTokenCategory category)
{
GList *list;
- list = amp_group_get_token (node, category);
+ list = amp_group_get_token (group, category);
if (list == NULL) return NULL;
return (AnjutaToken *)list->data;
}
void
-amp_group_set_dist_only (AnjutaProjectNode *node, gboolean dist_only)
+amp_group_set_dist_only (AnjutaAmGroupNode *group, gboolean dist_only)
{
- ANJUTA_AM_GROUP_NODE (node)->dist_only = dist_only;
+ group->dist_only = dist_only;
}
static void
@@ -405,11 +401,8 @@ on_group_monitor_changed (GFileMonitor *monitor,
}
AnjutaTokenFile*
-amp_group_set_makefile (AnjutaProjectNode *node, GFile *makefile, GObject* project)
+amp_group_set_makefile (AnjutaAmGroupNode *group, GFile *makefile, GObject* project)
{
- AnjutaAmGroupNode *group;
-
- group = ANJUTA_AM_GROUP_NODE (node);
if (group->makefile != NULL) g_object_unref (group->makefile);
if (group->tfile != NULL) anjuta_token_file_free (group->tfile);
if (makefile != NULL)
@@ -422,9 +415,10 @@ amp_group_set_makefile (AnjutaProjectNode *node, GFile *makefile, GObject* proje
token = anjuta_token_file_load (group->tfile, NULL);
- scanner = amp_am_scanner_new (project, ANJUTA_AM_GROUP_NODE (node));
+ scanner = amp_am_scanner_new (project, group);
group->make_token = amp_am_scanner_parse_token (scanner, anjuta_token_new_static (ANJUTA_TOKEN_FILE, NULL), token, makefile, NULL);
amp_am_scanner_free (scanner);
+ fprintf (stderr, "group->make_token %p\n", group->make_token);
group->monitor = g_file_monitor_file (makefile,
G_FILE_MONITOR_NONE,
@@ -432,12 +426,12 @@ amp_group_set_makefile (AnjutaProjectNode *node, GFile *makefile, GObject* proje
NULL);
if (group->monitor != NULL)
{
- g_message ("add monitor %s node %p data %p project %p monitor %p", g_file_get_path (makefile), node, group, project, group->monitor);
+ g_message ("add monitor %s node %p data %p project %p monitor %p", g_file_get_path (makefile), group, group, project, group->monitor);
group->project = project;
g_signal_connect (G_OBJECT (group->monitor),
"changed",
G_CALLBACK (on_group_monitor_changed),
- node);
+ group);
}
}
else
@@ -452,7 +446,19 @@ amp_group_set_makefile (AnjutaProjectNode *node, GFile *makefile, GObject* proje
return group->tfile;
}
-AnjutaProjectNode*
+AnjutaToken*
+amp_group_get_makefile_token (AnjutaAmGroupNode *group)
+{
+ return group->make_token;
+}
+
+gboolean
+amp_group_update_makefile (AnjutaAmGroupNode *group, AnjutaToken *token)
+{
+ return anjuta_token_file_update (group->tfile, token);
+}
+
+AnjutaAmGroupNode*
amp_group_new (GFile *file, gboolean dist_only, GError **error)
{
AnjutaAmGroupNode *node = NULL;
@@ -499,7 +505,7 @@ amp_group_new (GFile *file, gboolean dist_only, GError **error)
node->dist_only = dist_only;
node->variables = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, (GDestroyNotify)amp_variable_free);
- return ANJUTA_PROJECT_NODE (node);
+ return node;
}
void
@@ -582,25 +588,18 @@ anjuta_am_group_node_class_init (AnjutaAmGroupNodeClass *klass)
void
-amp_target_add_token (AnjutaProjectNode *node, AnjutaToken *token)
+amp_target_add_token (AnjutaAmTargetNode *target, AnjutaToken *token)
{
- AnjutaAmTargetNode *target;
-
- target = ANJUTA_AM_TARGET_NODE (node);
target->tokens = g_list_prepend (target->tokens, token);
}
GList *
-amp_target_get_token (AnjutaProjectNode *node)
+amp_target_get_token (AnjutaAmTargetNode *node)
{
- AnjutaAmTargetNode *target;
-
- target = ANJUTA_AM_TARGET_NODE (node);
-
- return target->tokens;
+ return node->tokens;
}
-AnjutaProjectNode*
+AnjutaAmTargetNode*
amp_target_new (const gchar *name, AnjutaProjectNodeType type, const gchar *install, gint flags, GError **error)
{
AnjutaAmTargetNode *node = NULL;
@@ -659,7 +658,7 @@ amp_target_new (const gchar *name, AnjutaProjectNodeType type, const gchar *inst
node->flags = flags;
node->tokens = NULL;
- return ANJUTA_PROJECT_NODE (node);
+ return node;
}
void
diff --git a/plugins/am-project/am-node.h b/plugins/am-project/am-node.h
index 94cf77d..a2dca7c 100644
--- a/plugins/am-project/am-node.h
+++ b/plugins/am-project/am-node.h
@@ -55,12 +55,14 @@ AnjutaProjectNode* am_package_node_new (const gchar *name, GError **error);
void amp_package_free (AnjutaAmPackageNode *node);
void amp_package_set_version (AnjutaAmPackageNode *node, const gchar *compare, const gchar *version);
-void amp_group_add_token (AnjutaProjectNode *node, AnjutaToken *token, AmpGroupTokenCategory category);
-GList * amp_group_get_token (AnjutaProjectNode *node, AmpGroupTokenCategory category);
-AnjutaToken* amp_group_get_first_token (AnjutaProjectNode *node, AmpGroupTokenCategory category);
-void amp_group_set_dist_only (AnjutaProjectNode *node, gboolean dist_only);
-AnjutaTokenFile* amp_group_set_makefile (AnjutaProjectNode *node, GFile *makefile, GObject* project);
-AnjutaProjectNode* amp_group_new (GFile *file, gboolean dist_only, GError **error);
+void amp_group_add_token (AnjutaAmGroupNode *group, AnjutaToken *token, AmpGroupTokenCategory category);
+GList * amp_group_get_token (AnjutaAmGroupNode *group, AmpGroupTokenCategory category);
+AnjutaToken* amp_group_get_first_token (AnjutaAmGroupNode *group, AmpGroupTokenCategory category);
+void amp_group_set_dist_only (AnjutaAmGroupNode *group, gboolean dist_only);
+AnjutaTokenFile* amp_group_set_makefile (AnjutaAmGroupNode *group, GFile *makefile, GObject* project);
+AnjutaToken* amp_group_get_makefile_token (AnjutaAmGroupNode *group);
+gboolean amp_group_update_makefile (AnjutaAmGroupNode *group, AnjutaToken *token);
+AnjutaAmGroupNode* amp_group_new (GFile *file, gboolean dist_only, GError **error);
void amp_group_free (AnjutaAmGroupNode *node);
typedef enum _AmpTargetFlag
@@ -75,9 +77,9 @@ typedef enum _AmpTargetFlag
AM_TARGET_MAN_SECTION = 31 << 7
} AmpTargetFlag;
-void amp_target_add_token (AnjutaProjectNode *node, AnjutaToken *token);
-GList * amp_target_get_token (AnjutaProjectNode *node);
-AnjutaProjectNode* amp_target_new (const gchar *name, AnjutaProjectNodeType type, const gchar *install, gint flags, GError **error);
+void amp_target_add_token (AnjutaAmTargetNode *node, AnjutaToken *token);
+GList * amp_target_get_token (AnjutaAmTargetNode *node);
+AnjutaAmTargetNode* amp_target_new (const gchar *name, AnjutaProjectNodeType type, const gchar *install, gint flags, GError **error);
void amp_target_free (AnjutaAmTargetNode *node);
AnjutaProjectNode* amp_source_new (GFile *file, GError **error);
diff --git a/plugins/am-project/am-parser.y b/plugins/am-project/am-parser.y
index ee18f97..5dc6a61 100644
--- a/plugins/am-project/am-parser.y
+++ b/plugins/am-project/am-parser.y
@@ -161,8 +161,13 @@ amp_am_automake_variable (AnjutaToken *token)
%%
file:
+ /* empty */
+ | statement_list
+ ;
+
+statement_list:
statement
- | file statement
+ | statement_list statement
;
statement:
@@ -187,8 +192,13 @@ am_variable:
}
| optional_space automake_token optional_space equal_token
{
+ AnjutaToken *list;
+ list = anjuta_token_new_static (ANJUTA_TOKEN_LIST, NULL);
+ anjuta_token_insert_after ($4, list);
$$ = anjuta_token_new_static (ANJUTA_TOKEN_LIST, NULL);
anjuta_token_merge ($$, $2);
+ anjuta_token_merge ($$, list);
+ amp_am_scanner_set_am_variable (scanner, amp_am_automake_variable ($2), $2, anjuta_token_last_item ($$));
}
;
@@ -292,7 +302,10 @@ head_list_body:
;
value_list:
- space
+ space {
+ $$ = anjuta_token_new_static (ANJUTA_TOKEN_LIST, NULL);
+ anjuta_token_merge ($$, $1);
+ }
| optional_space value_list_body optional_space {
if ($1 != NULL) anjuta_token_set_type ($1, ANJUTA_TOKEN_START);
if ($3 != NULL) anjuta_token_set_type ($3, ANJUTA_TOKEN_LAST);
diff --git a/plugins/am-project/am-project-private.h b/plugins/am-project/am-project-private.h
index 59def9d..f520f46 100644
--- a/plugins/am-project/am-project-private.h
+++ b/plugins/am-project/am-project-private.h
@@ -26,18 +26,6 @@
G_BEGIN_DECLS
-#if 0
-struct _AmpProperty {
- AnjutaToken *ac_init; /* AC_INIT macro */
- AnjutaToken *args;
- gchar *name;
- gchar *version;
- gchar *bug_report;
- gchar *tarname;
- gchar *url;
-};
-#endif
-
struct _AmpProperty {
AnjutaProjectProperty base;
gint token_type;
@@ -82,6 +70,15 @@ struct _AmpProject {
AnjutaTokenStyle *arg_list;
};
+typedef struct _AmpNodeInfo AmpNodeInfo;
+
+struct _AmpNodeInfo {
+ AnjutaProjectNodeInfo base;
+ AnjutaTokenType token;
+ const gchar *prefix;
+ const gchar *install;
+};
+
#define ANJUTA_TYPE_AM_ROOT_NODE (anjuta_am_root_node_get_type ())
#define ANJUTA_AM_ROOT_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ANJUTA_TYPE_AM_ROOT_NODE, AnjutaAmRootNode))
diff --git a/plugins/am-project/am-project.c b/plugins/am-project/am-project.c
index c2e699e..20cc0f7 100644
--- a/plugins/am-project/am-project.c
+++ b/plugins/am-project/am-project.c
@@ -82,15 +82,6 @@ struct _AmpConfigFile {
AnjutaToken *token;
};
-typedef struct _AmpNodeInfo AmpNodeInfo;
-
-struct _AmpNodeInfo {
- AnjutaProjectNodeInfo base;
- AnjutaTokenType token;
- const gchar *prefix;
- const gchar *install;
-};
-
struct _AmpTargetPropertyBuffer {
GList *sources;
GList *properties;
@@ -785,184 +776,6 @@ find_canonical_target (AnjutaProjectNode *node, gpointer data)
return FALSE;
}
-static gboolean
-amp_target_fill_token (AmpProject *project, AnjutaAmTargetNode *target, GError **error)
-{
- AnjutaToken* token;
- AnjutaToken *args;
- AnjutaToken *var;
- AnjutaToken *prev;
- AmpNodeInfo *info;
- gchar *targetname;
- gchar *find;
- gchar *name;
- GList *last;
- AnjutaAmTargetNode *sibling;
- AnjutaAmGroupNode *parent;
- gboolean after;
-
- /* Get parent target */
- parent = ANJUTA_AM_GROUP_NODE (anjuta_project_node_parent (ANJUTA_PROJECT_NODE (target)));
-
- info = (AmpNodeInfo *)amp_project_get_type_info (project, anjuta_project_node_get_full_type (target));
- name = anjuta_project_node_get_name (ANJUTA_PROJECT_NODE (target));
-
- /* Check that the new target doesn't already exist */
- /*find = name;
- anjuta_project_node_children_foreach (parent, find_target, &find);
- if ((gchar *)find != name)
- {
- g_free (name);
- error_set (error, IANJUTA_PROJECT_ERROR_DOESNT_EXIST,
- _("Target already exists"));
-
- return FALSE;
- }*/
-
- /* Find a sibling if possible */
- if (target->base.prev != NULL)
- {
- sibling = target->base.prev;
- after = TRUE;
- }
- else if (target->base.next != NULL)
- {
- sibling = target->base.next;
- after = FALSE;
- }
- else
- {
- sibling = NULL;
- after = TRUE;
- }
-
- /* Add in Makefile.am */
- targetname = g_strconcat (info->install, info->prefix, NULL);
-
- // Get token corresponding to sibling and check if the target are compatible
- args = NULL;
- var = NULL;
- prev = NULL;
- if (sibling != NULL)
- {
- last = amp_target_get_token (sibling);
-
- if (last != NULL)
- {
- AnjutaToken *token = (AnjutaToken *)last->data;
-
- /* Check that the sibling is of the same kind */
- token = anjuta_token_list (token);
- if (token != NULL)
- {
- token = anjuta_token_list (token);
- var = token;
- if (token != NULL)
- {
- token = anjuta_token_first_item (token);
- if (token != NULL)
- {
- gchar *value;
-
- value = anjuta_token_evaluate (token);
-
- if ((value != NULL) && (strcmp (targetname, value) == 0))
- {
- g_free (value);
- prev = (AnjutaToken *)last->data;
- args = anjuta_token_list (prev);
- }
- }
- }
- }
- }
- }
-
- if (args == NULL)
- {
- for (last = amp_group_get_token (parent, AM_GROUP_TARGET); last != NULL; last = g_list_next (last))
- {
- gchar *value = anjuta_token_evaluate ((AnjutaToken *)last->data);
-
- if ((value != NULL) && (strcmp (targetname, value) == 0))
- {
- g_free (value);
- args = anjuta_token_last_item (anjuta_token_list ((AnjutaToken *)last->data));
- break;
- }
- g_free (value);
- }
- }
-
-
- if (args == NULL)
- {
- args = amp_project_write_target (AMP_GROUP_DATA (parent)->make_token, info->token, targetname, after, var);
- }
- g_free (targetname);
-
- if (args != NULL)
- {
- AnjutaTokenStyle *style;
-
- anjuta_token_dump (anjuta_token_list (args));
-
- token = anjuta_token_new_string (ANJUTA_TOKEN_ARGUMENT | ANJUTA_TOKEN_ADDED, name);
- if (after)
- {
- anjuta_token_insert_word_after (args, prev, token);
- }
- else
- {
- anjuta_token_insert_word_before (args, prev, token);
- }
-
- /* Try to use the same style than the current target list */
- style = anjuta_token_style_new_from_base (project->am_space_list);
- anjuta_token_style_update (style, args);
- anjuta_token_style_format (style, args);
- anjuta_token_style_free (style);
- anjuta_token_file_update (AMP_GROUP_DATA (parent)->tfile, token);
-
- amp_target_add_token (target, token);
- }
- g_free (name);
-
- return TRUE;
-}
-
-static gboolean
-amp_target_remove_token (AmpProject *project, AnjutaAmTargetNode *target, GError **error)
-{
- GList *item;
- AnjutaAmGroupNode *parent;
-
- /* Get parent target */
- parent = ANJUTA_AM_GROUP_NODE (anjuta_project_node_parent (ANJUTA_PROJECT_NODE (target)));
-
- for (item = amp_target_get_token (target); item != NULL; item = g_list_next (item))
- {
- AnjutaToken *token = (AnjutaToken *)item->data;
- AnjutaToken *args;
- AnjutaTokenStyle *style;
-
- args = anjuta_token_list (token);
-
- /* Try to use the same style than the current target list */
- style = anjuta_token_style_new_from_base (project->am_space_list);
- anjuta_token_style_update (style, args);
-
- anjuta_token_remove_word (token);
-
- anjuta_token_style_format (style, args);
- anjuta_token_style_free (style);
-
- anjuta_token_file_update (AMP_GROUP_DATA (parent)->tfile, args);
- }
-
- return TRUE;
-}
-
/* Source objects
*---------------------------------------------------------------------------*/
@@ -1175,7 +988,7 @@ project_node_new (AmpProject *project, AnjutaProjectNodeType type, GFile *file,
node = amp_group_new (file, FALSE, error);
break;
case ANJUTA_PROJECT_TARGET:
- node = amp_target_new (name, 0, NULL, 0, error);
+ node = ANJUTA_PROJECT_NODE (amp_target_new (name, 0, NULL, 0, error));
break;
case ANJUTA_PROJECT_SOURCE:
if (file == NULL)
@@ -1429,6 +1242,7 @@ project_load_target (AmpProject *project, AnjutaToken *name, AnjutaTokenType tok
amp_group_add_token (parent, name, AM_GROUP_TARGET);
+ //fprintf (stderr, "load_target list %p word %p\n", list, anjuta_token_first_word (list));
for (arg = anjuta_token_first_word (list); arg != NULL; arg = anjuta_token_next_word (arg))
{
gchar *value;
@@ -1439,7 +1253,8 @@ project_load_target (AmpProject *project, AnjutaToken *name, AnjutaTokenType tok
gpointer find;
value = anjuta_token_evaluate (arg);
-
+
+ //fprintf (stderr, "target value =%s=\n", value);
/* This happens for variable token which are considered as value */
if (value == NULL) continue;
canon_id = canonicalize_automake_variable (value);
@@ -1457,58 +1272,62 @@ project_load_target (AmpProject *project, AnjutaToken *name, AnjutaTokenType tok
/* Create target */
target = amp_target_new (value, info->base.type, install, flags, NULL);
- amp_target_add_token (target, arg);
- anjuta_project_node_append (parent, target);
- DEBUG_PRINT ("create target %p name %s", target, value);
-
- /* Check if there are sources or properties availables */
- if (g_hash_table_lookup_extended (orphan_properties, canon_id, (gpointer *)&orig_key, (gpointer *)&buffer))
+ //fprintf(stderr, "create target %p\n", target);
+ if (target != NULL)
{
- GList *sources;
- GList *src;
+ amp_target_add_token (target, arg);
+ anjuta_project_node_append (parent, target);
+ DEBUG_PRINT ("create target %p name %s", target, value);
- g_hash_table_steal (orphan_properties, canon_id);
- sources = amp_target_property_buffer_steal_sources (buffer);
- for (src = sources; src != NULL; src = g_list_next (src))
+ /* Check if there are sources or properties availables */
+ if (g_hash_table_lookup_extended (orphan_properties, canon_id, (gpointer *)&orig_key, (gpointer *)&buffer))
{
- AnjutaAmSourceNode *source = src->data;
+ GList *sources;
+ GList *src;
- anjuta_project_node_prepend (target, source);
- }
- g_free (orig_key);
- g_list_free (sources);
+ g_hash_table_steal (orphan_properties, canon_id);
+ sources = amp_target_property_buffer_steal_sources (buffer);
+ for (src = sources; src != NULL; src = g_list_next (src))
+ {
+ AnjutaAmSourceNode *source = src->data;
- amp_target_property_buffer_free (buffer);
- }
+ anjuta_project_node_prepend (target, source);
+ }
+ g_free (orig_key);
+ g_list_free (sources);
- /* Set target properties */
- if (flags & AM_TARGET_NOBASE)
- amp_node_property_load (target, AM_TOKEN__PROGRAMS, 0, "1", arg);
- if (flags & AM_TARGET_NOTRANS)
- amp_node_property_load (target, AM_TOKEN__PROGRAMS, 1, "1", arg);
- if (flags & AM_TARGET_DIST)
- amp_node_property_load (target, AM_TOKEN__PROGRAMS, 2, "1", arg);
- if (flags & AM_TARGET_NODIST)
- amp_node_property_load (target, AM_TOKEN__PROGRAMS, 2, "0", arg);
- if (flags & AM_TARGET_NOINST)
- {
- amp_node_property_load (target, AM_TOKEN__PROGRAMS, 3, "1", arg);
- }
- else
- {
- gchar *instdir = g_strconcat ("$(", install, "dir)", NULL);
- amp_node_property_load (target, AM_TOKEN__PROGRAMS, 6, instdir, arg);
- g_free (instdir);
- }
+ amp_target_property_buffer_free (buffer);
+ }
+
+ /* Set target properties */
+ if (flags & AM_TARGET_NOBASE)
+ amp_node_property_load (target, AM_TOKEN__PROGRAMS, 0, "1", arg);
+ if (flags & AM_TARGET_NOTRANS)
+ amp_node_property_load (target, AM_TOKEN__PROGRAMS, 1, "1", arg);
+ if (flags & AM_TARGET_DIST)
+ amp_node_property_load (target, AM_TOKEN__PROGRAMS, 2, "1", arg);
+ if (flags & AM_TARGET_NODIST)
+ amp_node_property_load (target, AM_TOKEN__PROGRAMS, 2, "0", arg);
+ if (flags & AM_TARGET_NOINST)
+ {
+ amp_node_property_load (target, AM_TOKEN__PROGRAMS, 3, "1", arg);
+ }
+ else
+ {
+ gchar *instdir = g_strconcat ("$(", install, "dir)", NULL);
+ amp_node_property_load (target, AM_TOKEN__PROGRAMS, 6, instdir, arg);
+ g_free (instdir);
+ }
- if (flags & AM_TARGET_CHECK)
- amp_node_property_load (target, AM_TOKEN__PROGRAMS, 4, "1", arg);
- if (flags & AM_TARGET_MAN)
- {
- gchar section[] = "0";
+ if (flags & AM_TARGET_CHECK)
+ amp_node_property_load (target, AM_TOKEN__PROGRAMS, 4, "1", arg);
+ if (flags & AM_TARGET_MAN)
+ {
+ gchar section[] = "0";
- section[0] += (flags >> 7) & 0x1F;
- amp_node_property_load (target, AM_TOKEN__PROGRAMS, 4, section, arg);
+ section[0] += (flags >> 7) & 0x1F;
+ amp_node_property_load (target, AM_TOKEN__PROGRAMS, 4, section, arg);
+ }
}
g_free (canon_id);
@@ -1608,7 +1427,7 @@ static AnjutaToken*
project_load_data (AmpProject *project, AnjutaToken *name, AnjutaToken *list, AnjutaProjectNode *parent, GHashTable *orphan_properties)
{
gchar *install;
- AnjutaProjectNode *target;
+ AnjutaAmTargetNode *target;
gchar *target_id;
gpointer find;
gint flags;
@@ -1979,7 +1798,7 @@ amp_project_load_root (AmpProject *project, GError **error)
/* Initialize list styles */
project->ac_space_list = anjuta_token_style_new (NULL, " ", "\n", NULL, 0);
- project->am_space_list = anjuta_token_style_new (NULL, " ", " \\\n", NULL, 0);
+ project->am_space_list = anjuta_token_style_new (NULL, " ", " \\\n\t", NULL, 0);
project->arg_list = anjuta_token_style_new (NULL, ", ", ", ", ")", 0);
/* Find configure file */
@@ -2728,7 +2547,7 @@ iproject_add_node_before (IAnjutaProject *obj, AnjutaProjectNode *parent, Anjuta
case ANJUTA_PROJECT_TARGET:
node = project_node_new (AMP_PROJECT (obj), type, file, name, err);
anjuta_project_node_insert_before (parent, sibling, node);
- amp_target_fill_token (AMP_PROJECT (obj), node, NULL);
+ amp_target_create_token (AMP_PROJECT (obj), node, NULL);
break;
case ANJUTA_PROJECT_SOURCE:
node = project_node_new (AMP_PROJECT (obj), type, file, name, err);
@@ -2766,7 +2585,7 @@ iproject_add_node_after (IAnjutaProject *obj, AnjutaProjectNode *parent, AnjutaP
case ANJUTA_PROJECT_TARGET:
node = project_node_new (AMP_PROJECT (obj), type, file, name, err);
anjuta_project_node_insert_after (parent, sibling, node);
- amp_target_fill_token (AMP_PROJECT (obj), node, NULL);
+ amp_target_create_token (AMP_PROJECT (obj), node, NULL);
break;
case ANJUTA_PROJECT_SOURCE:
node = project_node_new (AMP_PROJECT (obj), type, file, name, err);
@@ -2794,7 +2613,7 @@ iproject_remove_node (IAnjutaProject *obj, AnjutaProjectNode *node, GError **err
case ANJUTA_PROJECT_GROUP:
break;
case ANJUTA_PROJECT_TARGET:
- amp_target_remove_token (AMP_PROJECT (obj), node, NULL);
+ amp_target_delete_token (AMP_PROJECT (obj), node, NULL);
break;
case ANJUTA_PROJECT_SOURCE:
break;
@@ -2862,12 +2681,6 @@ amp_group_get_directory (AnjutaAmGroupNode *group)
return AMP_GROUP_DATA (group)->base.file;
}
-GFile*
-amp_group_get_makefile (AnjutaAmGroupNode *group)
-{
- return AMP_GROUP_DATA (group)->makefile;
-}
-
gchar *
amp_group_get_id (AnjutaAmGroupNode *group)
{
diff --git a/plugins/am-project/am-project.h b/plugins/am-project/am-project.h
index 5a61d33..046e664 100644
--- a/plugins/am-project/am-project.h
+++ b/plugins/am-project/am-project.h
@@ -135,7 +135,6 @@ AnjutaProjectNodeType amp_node_get_type (AnjutaProjectNode *node);
//void amp_node_all_foreach (AnjutaProjectNode *node, AnjutaProjectNodeFunc func, gpointer data);
GFile *amp_group_get_directory (AnjutaAmGroupNode *group);
-GFile *amp_group_get_makefile (AnjutaAmGroupNode *group);
gchar *amp_group_get_id (AnjutaAmGroupNode *group);
void amp_group_update_variable (AnjutaAmGroupNode *group, AnjutaToken *variable);
AnjutaToken* amp_group_get_variable_token (AnjutaAmGroupNode *group, AnjutaToken *variable);
diff --git a/plugins/am-project/am-writer.c b/plugins/am-project/am-writer.c
index 21fbf7d..368ce9d 100644
--- a/plugins/am-project/am-writer.c
+++ b/plugins/am-project/am-writer.c
@@ -29,10 +29,13 @@
#include "ac-parser.h"
#include "am-project-private.h"
+#include "am-node.h"
#include <libanjuta/anjuta-debug.h>
#include <libanjuta/anjuta-utils.h>
+#include <string.h>
+
/* Types
*---------------------------------------------------------------------------*/
@@ -88,10 +91,10 @@ amp_project_write_config_list (AmpProject *project)
return token;
}
-AnjutaToken *
+static AnjutaToken *
amp_project_write_subdirs_list (AnjutaAmGroupNode *project)
{
- AnjutaToken *pos;
+ AnjutaToken *pos = NULL;
AnjutaToken *token;
static gint eol_type[] = {ANJUTA_TOKEN_EOL, ANJUTA_TOKEN_SPACE, ANJUTA_TOKEN_COMMENT, 0};
@@ -136,20 +139,34 @@ amp_project_write_config_file (AmpProject *project, AnjutaToken *list, gboolean
return token;
}
-AnjutaToken *
-amp_project_write_target (AnjutaToken *makefile, gint type, const gchar *name, gboolean after, AnjutaToken* sibling)
+static AnjutaToken *
+amp_project_write_target (AnjutaAmGroupNode *group, gint type, const gchar *name, gboolean after, AnjutaToken* sibling)
{
AnjutaToken *pos;
AnjutaToken *token;
+ AnjutaToken *makefile;
+
+
if (sibling == NULL)
{
+ makefile = amp_group_get_makefile_token (group);
pos = anjuta_token_first_item (makefile);
-
- /* Add at the end of the file */
- while (anjuta_token_next_item (pos) != NULL)
+ if (pos == NULL)
{
- pos = anjuta_token_next_item (pos);
+ /* Empty file */
+ token = anjuta_token_new_string (ANJUTA_TOKEN_COMMENT | ANJUTA_TOKEN_ADDED, "## Process this file with automake to produce Makefile.in\n");
+ anjuta_token_append_child (makefile, token);
+ amp_group_update_makefile (group, token);
+ pos = token;
+ }
+ else
+ {
+ /* Add at the end of the file */
+ while (anjuta_token_next_item (pos) != NULL)
+ {
+ pos = anjuta_token_next_item (pos);
+ }
}
}
else
@@ -157,6 +174,11 @@ amp_project_write_target (AnjutaToken *makefile, gint type, const gchar *name, g
pos = sibling;
}
+ token = anjuta_token_new_string (ANJUTA_TOKEN_EOL | ANJUTA_TOKEN_ADDED, "\n");
+ anjuta_token_insert_after (pos, token);
+ amp_group_update_makefile (group, token);
+ pos = token;
+
token = anjuta_token_insert_token_list (after, pos,
ANJUTA_TOKEN_LIST, NULL,
type, name,
@@ -165,8 +187,176 @@ amp_project_write_target (AnjutaToken *makefile, gint type, const gchar *name, g
ANJUTA_TOKEN_LIST, NULL,
ANJUTA_TOKEN_SPACE, " ",
NULL);
+ token = anjuta_token_last_item (token);
- return anjuta_token_last_item (token);
+ return token;
+}
+
+gboolean
+amp_target_create_token (AmpProject *project, AnjutaAmTargetNode *target, GError **error)
+{
+ AnjutaToken* token;
+ AnjutaToken *args;
+ AnjutaToken *var;
+ AnjutaToken *prev;
+ AmpNodeInfo *info;
+ gchar *targetname;
+ gchar *name;
+ GList *last;
+ AnjutaAmTargetNode *sibling;
+ AnjutaAmGroupNode *parent;
+ gboolean after;
+
+ /* Get parent target */
+ parent = ANJUTA_AM_GROUP_NODE (anjuta_project_node_parent (ANJUTA_PROJECT_NODE (target)));
+
+ info = (AmpNodeInfo *)amp_project_get_type_info (project, anjuta_project_node_get_full_type (ANJUTA_PROJECT_NODE (target)));
+ name = anjuta_project_node_get_name (ANJUTA_PROJECT_NODE (target));
+
+ /* Find a sibling if possible */
+ if (target->base.prev != NULL)
+ {
+ sibling = ANJUTA_AM_TARGET_NODE (target->base.prev);
+ after = TRUE;
+ }
+ else if (target->base.next != NULL)
+ {
+ sibling = ANJUTA_AM_TARGET_NODE (target->base.next);
+ after = FALSE;
+ }
+ else
+ {
+ sibling = NULL;
+ after = TRUE;
+ }
+
+ /* Add in Makefile.am */
+ targetname = g_strconcat (info->install, info->prefix, NULL);
+
+ // Get token corresponding to sibling and check if the target are compatible
+ args = NULL;
+ var = NULL;
+ prev = NULL;
+ if (sibling != NULL)
+ {
+ last = amp_target_get_token (sibling);
+
+ if (last != NULL)
+ {
+ AnjutaToken *token = (AnjutaToken *)last->data;
+
+ /* Check that the sibling is of the same kind */
+ token = anjuta_token_list (token);
+ if (token != NULL)
+ {
+ token = anjuta_token_list (token);
+ var = token;
+ if (token != NULL)
+ {
+ token = anjuta_token_first_item (token);
+ if (token != NULL)
+ {
+ gchar *value;
+
+ value = anjuta_token_evaluate (token);
+
+ if ((value != NULL) && (strcmp (targetname, value) == 0))
+ {
+ g_free (value);
+ prev = (AnjutaToken *)last->data;
+ args = anjuta_token_list (prev);
+ }
+ }
+ }
+ }
+ }
+ }
+
+
+ /* Check if a valid target variable is already defined */
+ if (args == NULL)
+ {
+ for (last = amp_group_get_token (parent, AM_GROUP_TARGET); last != NULL; last = g_list_next (last))
+ {
+ gchar *value = anjuta_token_evaluate ((AnjutaToken *)last->data);
+
+ if ((value != NULL) && (strcmp (targetname, value) == 0))
+ {
+ g_free (value);
+ args = anjuta_token_last_item (anjuta_token_list ((AnjutaToken *)last->data));
+ break;
+ }
+ g_free (value);
+ }
+ }
+
+
+ if (args == NULL)
+ {
+ args = amp_project_write_target (parent, info->token, targetname, after, var);
+ }
+ g_free (targetname);
+
+ if (args != NULL)
+ {
+ AnjutaTokenStyle *style;
+
+ style = anjuta_token_style_new_from_base (project->am_space_list);
+ anjuta_token_style_update (style, args);
+
+ token = anjuta_token_new_string (ANJUTA_TOKEN_ARGUMENT | ANJUTA_TOKEN_ADDED, name);
+ if (after)
+ {
+ anjuta_token_insert_word_after (args, prev, token);
+ }
+ else
+ {
+ anjuta_token_insert_word_before (args, prev, token);
+ }
+
+ /* Try to use the same style than the current target list */
+ anjuta_token_style_format (style, args);
+ anjuta_token_style_free (style);
+
+ amp_group_update_makefile (parent, token);
+
+ amp_target_add_token (target, token);
+ }
+ g_free (name);
+
+ return TRUE;
+}
+
+gboolean
+amp_target_delete_token (AmpProject *project, AnjutaAmTargetNode *target, GError **error)
+{
+ GList *item;
+ AnjutaAmGroupNode *parent;
+
+ /* Get parent target */
+ parent = ANJUTA_AM_GROUP_NODE (anjuta_project_node_parent (ANJUTA_PROJECT_NODE (target)));
+
+ for (item = amp_target_get_token (target); item != NULL; item = g_list_next (item))
+ {
+ AnjutaToken *token = (AnjutaToken *)item->data;
+ AnjutaToken *args;
+ AnjutaTokenStyle *style;
+
+ args = anjuta_token_list (token);
+
+ /* Try to use the same style than the current target list */
+ style = anjuta_token_style_new_from_base (project->am_space_list);
+ anjuta_token_style_update (style, args);
+
+ anjuta_token_remove_word (token);
+
+ anjuta_token_style_format (style, args);
+ anjuta_token_style_free (style);
+
+ amp_group_update_makefile (parent, args);
+ }
+
+ return TRUE;
}
AnjutaToken *
diff --git a/plugins/am-project/am-writer.h b/plugins/am-project/am-writer.h
index 290f4df..2fb7e1e 100644
--- a/plugins/am-project/am-writer.h
+++ b/plugins/am-project/am-writer.h
@@ -31,9 +31,12 @@ G_BEGIN_DECLS
AnjutaToken *amp_project_write_config_list (AmpProject *project);
AnjutaToken *amp_project_write_config_file (AmpProject *project, AnjutaToken *list, gboolean after, AnjutaToken *sibling, const gchar *filename);
-AnjutaToken *amp_project_write_target (AnjutaToken *makefile, gint type, const gchar *name, gboolean after, AnjutaToken* sibling);
AnjutaToken *amp_project_write_source_list (AnjutaToken *makefile, const gchar *name, gboolean after, AnjutaToken* sibling);
+gboolean amp_target_create_token (AmpProject *project, AnjutaAmTargetNode *target, GError **error);
+gboolean amp_target_delete_token (AmpProject *project, AnjutaAmTargetNode *target, GError **error);
+
+
G_END_DECLS
#endif /* _AM_WRITER_H_ */
diff --git a/plugins/am-project/projectparser.c b/plugins/am-project/projectparser.c
index 0c9b1cb..73e5d7b 100644
--- a/plugins/am-project/projectparser.c
+++ b/plugins/am-project/projectparser.c
@@ -180,6 +180,7 @@ list_children (IAnjutaProject *project, AnjutaProjectNode *root, AnjutaProjectNo
count = 0;
for (node = anjuta_project_node_first_child (parent); node != NULL; node = anjuta_project_node_next_sibling (node))
{
+ if (anjuta_project_node_get_state (node) & ANJUTA_PROJECT_REMOVED) continue;
if (anjuta_project_node_get_node_type (node) == ANJUTA_PROJECT_MODULE)
{
gchar *child_path = g_strdup_printf ("%s%s%d", path != NULL ? path : "", path != NULL ? ":" : "", count);
@@ -192,6 +193,7 @@ list_children (IAnjutaProject *project, AnjutaProjectNode *root, AnjutaProjectNo
count = 0;
for (node = anjuta_project_node_first_child (parent); node != NULL; node = anjuta_project_node_next_sibling (node))
{
+ if (anjuta_project_node_get_state (node) & ANJUTA_PROJECT_REMOVED) continue;
if (anjuta_project_node_get_node_type (node) == ANJUTA_PROJECT_PACKAGE)
{
gchar *child_path = g_strdup_printf ("%s%s%d", path != NULL ? path : "", path != NULL ? ":" : "", count);
@@ -204,6 +206,7 @@ list_children (IAnjutaProject *project, AnjutaProjectNode *root, AnjutaProjectNo
count = 0;
for (node = anjuta_project_node_first_child (parent); node != NULL; node = anjuta_project_node_next_sibling (node))
{
+ if (anjuta_project_node_get_state (node) & ANJUTA_PROJECT_REMOVED) continue;
if (anjuta_project_node_get_node_type (node) == ANJUTA_PROJECT_GROUP)
{
gchar *child_path = g_strdup_printf ("%s%s%d", path != NULL ? path : "", path != NULL ? ":" : "", count);
@@ -216,6 +219,7 @@ list_children (IAnjutaProject *project, AnjutaProjectNode *root, AnjutaProjectNo
count = 0;
for (node = anjuta_project_node_first_child (parent); node != NULL; node = anjuta_project_node_next_sibling (node))
{
+ if (anjuta_project_node_get_state (node) & ANJUTA_PROJECT_REMOVED) continue;
if (anjuta_project_node_get_node_type (node) == ANJUTA_PROJECT_TARGET)
{
gchar *child_path = g_strdup_printf ("%s%s%d", path != NULL ? path : "", path != NULL ? ":" : "", count);
@@ -228,6 +232,7 @@ list_children (IAnjutaProject *project, AnjutaProjectNode *root, AnjutaProjectNo
count = 0;
for (node = anjuta_project_node_first_child (parent); node != NULL; node = anjuta_project_node_next_sibling (node))
{
+ if (anjuta_project_node_get_state (node) & ANJUTA_PROJECT_REMOVED) continue;
if (anjuta_project_node_get_node_type (node) == ANJUTA_PROJECT_SOURCE)
{
gchar *child_path = g_strdup_printf ("%s%s%d", path != NULL ? path : "", path != NULL ? ":" : "", count);
diff --git a/plugins/am-project/tests/target.at b/plugins/am-project/tests/target.at
index 99b1c7c..7e8d393 100644
--- a/plugins/am-project/tests/target.at
+++ b/plugins/am-project/tests/target.at
@@ -4,8 +4,8 @@ AT_DATA([empty/configure.ac],
[[AC_CONFIG_FILES(Makefile)
]])
AT_DATA([empty/Makefile.am],
-[[
-]])
+[[]])
+
AT_DATA([expect],
[[ GROUP (0): empty1
TARGET (0:0): target1
@@ -19,6 +19,7 @@ AT_CHECK([diff output expect])
AT_PARSER_CHECK([load empty1 \
list])
AT_CHECK([diff output expect])
+
AT_DATA([expect],
[[ GROUP (0): empty2
TARGET (0:0): target1
@@ -33,4 +34,46 @@ AT_CHECK([diff -b output expect])
AT_PARSER_CHECK([load empty2 \
list])
AT_CHECK([diff -b output expect])
+
+AT_DATA([expect],
+[[ GROUP (0): empty3
+ TARGET (0:0): target2
+]])
+AT_PARSER_CHECK([load empty2 \
+ move empty3 \
+ remove 0:0 \
+ list \
+ save])
+AT_CHECK([diff -b output expect])
+AT_PARSER_CHECK([load empty3 \
+ list])
+AT_CHECK([diff -b output expect])
+
+AT_DATA([expect],
+[[ GROUP (0): empty4
+]])
+AT_PARSER_CHECK([load empty3 \
+ move empty4 \
+ remove 0:0 \
+ list \
+ save])
+AT_CHECK([diff -b output expect])
+AT_PARSER_CHECK([load empty4 \
+ list])
+AT_CHECK([diff -b output expect])
+
+AT_DATA([expect],
+[[ GROUP (0): empty5
+ TARGET (0:0): target1
+]])
+AT_PARSER_CHECK([load empty4 \
+ move empty5 \
+ add target 0 target1 3 \
+ list \
+ save])
+AT_CHECK([diff -b output expect])
+AT_PARSER_CHECK([load empty5 \
+ list])
+AT_CHECK([diff -b output expect])
+
AT_CLEANUP
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]