[anjuta] mk-project: Remove useless code and debugging messages
- From: Sebastien Granjoux <sgranjoux src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] mk-project: Remove useless code and debugging messages
- Date: Sat, 5 Feb 2011 21:19:44 +0000 (UTC)
commit b8f9d612c0f3d3a40455e117e7e8fa38ed686ed3
Author: Sébastien Granjoux <seb sfo free fr>
Date: Fri Feb 4 22:59:01 2011 +0100
mk-project: Remove useless code and debugging messages
plugins/mk-project/mk-project-private.h | 3 -
plugins/mk-project/mk-project.c | 317 ++-----------------------------
plugins/mk-project/mk-project.h | 77 +-------
plugins/mk-project/mk-rule.c | 18 +-
plugins/mk-project/mk-scanner.l | 6 +-
5 files changed, 30 insertions(+), 391 deletions(-)
---
diff --git a/plugins/mk-project/mk-project-private.h b/plugins/mk-project/mk-project-private.h
index bd3d46c..4e11011 100644
--- a/plugins/mk-project/mk-project-private.h
+++ b/plugins/mk-project/mk-project-private.h
@@ -42,9 +42,6 @@ struct _MkpProject {
* can only work with native local files */
GFile *root_file;
- /* project data */
- MkpProperty *property;
-
/* shortcut hash tables, mapping id -> GNode from the tree above */
GHashTable *groups;
GHashTable *files;
diff --git a/plugins/mk-project/mk-project.c b/plugins/mk-project/mk-project.c
index 09ddeb8..c80b2fc 100644
--- a/plugins/mk-project/mk-project.c
+++ b/plugins/mk-project/mk-project.c
@@ -64,31 +64,19 @@ static const gchar *valid_makefiles[] = {"GNUmakefile", "makefile", "Makefile",
static MkpNodeInfo MkpNodeInformation[] = {
{{ANJUTA_PROJECT_GROUP,
N_("Group"),
- ""},
- ANJUTA_TOKEN_NONE,
- NULL,
- NULL},
+ ""}},
{{ANJUTA_PROJECT_SOURCE,
N_("Source"),
- ""},
- ANJUTA_TOKEN_NONE,
- NULL,
- NULL},
+ ""}},
{{ANJUTA_PROJECT_TARGET,
N_("Unknown"),
- "text/plain"},
- ANJUTA_TOKEN_NONE,
- NULL,
- NULL},
+ "text/plain"}},
{{ANJUTA_PROJECT_UNKNOWN,
NULL,
- NULL},
- ANJUTA_TOKEN_NONE,
- NULL,
- NULL}
+ NULL}}
};
@@ -211,39 +199,6 @@ file_type (GFile *file, const gchar *filename)
/* Group objects
*---------------------------------------------------------------------------*/
-#if 0
-static void
-mkp_group_add_token (MkpGroup *group, AnjutaToken *token, MkpGroupTokenCategory category)
-{
- group->tokens[category] = g_list_prepend (group->tokens[category], token);
-}
-
-static GList *
-mkp_group_get_token (MkpGroup *group, MkpGroupTokenCategory category)
-{
- return group->tokens[category];
-}
-#endif
-
-static AnjutaTokenFile*
-mkp_group_set_makefile (MkpGroup *group, GFile *makefile)
-{
- if (group->makefile != NULL) g_object_unref (group->makefile);
- if (group->tfile != NULL) anjuta_token_file_free (group->tfile);
- if (makefile != NULL)
- {
- group->makefile = g_object_ref (makefile);
- group->tfile = anjuta_token_file_new (makefile);
- }
- else
- {
- group->makefile = NULL;
- group->tfile = NULL;
- }
-
- return group->tfile;
-}
-
static AnjutaProjectNode*
mkp_group_new (GFile *file)
{
@@ -260,14 +215,6 @@ mkp_group_new (GFile *file)
return ANJUTA_PROJECT_NODE(group);
}
-#if 0
-static void
-mkp_group_free (MkpGroup *group)
-{
- g_object_unref (G_OBJECT (group));
-}
-#endif
-
static void
mkp_group_class_init (MkpGroupClass *klass)
{
@@ -291,13 +238,12 @@ mkp_target_add_token (MkpTarget *target, AnjutaToken *token)
target->tokens = g_list_prepend (target->tokens, token);
}
-#if 0
+
static GList *
mkp_target_get_token (MkpTarget *target)
{
return target->tokens;
}
-#endif
AnjutaProjectNode*
mkp_target_new (const gchar *name, AnjutaProjectNodeType type)
@@ -312,12 +258,6 @@ mkp_target_new (const gchar *name, AnjutaProjectNodeType type)
return ANJUTA_PROJECT_NODE(target);
}
-void
-mkp_target_free (MkpTarget *node)
-{
- g_object_unref (node);
-}
-
static void
mkp_target_class_init (MkpTargetClass *klass)
{
@@ -351,14 +291,6 @@ mkp_source_new (GFile *file)
return ANJUTA_PROJECT_NODE (source);
}
-#if 0
-static void
-mkp_source_free (MkpSource *node)
-{
- g_object_unref (node);
-}
-#endif
-
static void
mkp_source_class_init (MkpSourceClass *klass)
{
@@ -480,33 +412,6 @@ monitors_setup (MkpProject *project)
* ---------------- Data structures managment
*/
-#if 0
-static void
-mkp_dump_node (AnjutaProjectNode *g_node)
-{
- gchar *name = NULL;
-
- switch (g_node->type) {
- case ANJUTA_PROJECT_GROUP:
- name = g_file_get_uri (g_node->file);
- DEBUG_PRINT ("GROUP: %s", name);
- break;
- case ANJUTA_PROJECT_TARGET:
- name = g_strdup (g_node->name);
- DEBUG_PRINT ("TARGET: %s", name);
- break;
- case ANJUTA_PROJECT_SOURCE:
- name = g_file_get_uri (g_node->file);
- DEBUG_PRINT ("SOURCE: %s", name);
- break;
- default:
- g_assert_not_reached ();
- break;
- }
- g_free (name);
-}
-#endif
-
static AnjutaProjectNode *
project_node_new (MkpProject *project, AnjutaProjectNode *parent, AnjutaProjectNodeType type, GFile *file, const gchar *name, GError **error)
{
@@ -532,33 +437,6 @@ project_node_new (MkpProject *project, AnjutaProjectNode *parent, AnjutaProjectN
return node;
}
-#if 0
-static void
-find_target (AnjutaProjectNode *node, gpointer data)
-{
- if (node->type == ANJUTA_PROJECT_TARGET)
- {
- if (strcmp (node->name, *(gchar **)data) == 0)
- {
- /* Find target, return node value in pointer */
- *(AnjutaProjectNode **)data = node;
-
- return;
- }
- }
-}
-
-static void
-remove_make_file (gpointer data, GObject *object, gboolean is_last_ref)
-{
- if (is_last_ref)
- {
- MkpProject *project = (MkpProject *)data;
- g_hash_table_remove (project->files, anjuta_token_file_get_file (ANJUTA_TOKEN_FILE (object)));
- }
-}
-#endif
-
static AnjutaProjectNode*
project_load_makefile (MkpProject *project, GFile *file, MkpGroup *parent, GError **error)
{
@@ -571,9 +449,8 @@ project_load_makefile (MkpProject *project, GFile *file, MkpGroup *parent, GErro
/* Parse makefile */
DEBUG_PRINT ("Parse: %s", g_file_get_uri (file));
- tfile = mkp_group_set_makefile (parent, file);
+ tfile = anjuta_token_file_new (file);
g_hash_table_insert (project->files, g_object_ref (file), g_object_ref (tfile));
-// g_object_add_toggle_ref (G_OBJECT (project->make_file), remove_make_file, project);
arg = anjuta_token_file_load (tfile, NULL);
scanner = mkp_scanner_new (project);
parse = mkp_scanner_parse_token (scanner, arg, &err);
@@ -604,122 +481,7 @@ mkp_project_get_root (MkpProject *project)
return MKP_PROJECT(project);
}
-GList *
-mkp_project_list_variable (MkpProject *project)
-{
- return g_hash_table_get_values (project->variables);
-}
-
-MkpVariable*
-mkp_project_get_variable (MkpProject *project, const gchar *name)
-{
- MkpVariable *var;
-
- var = (MkpVariable *)g_hash_table_lookup (project->groups, name);
-
- return var;
-}
-
-MkpGroup *
-mkp_project_get_group (MkpProject *project, const gchar *id)
-{
- return (MkpGroup *)g_hash_table_lookup (project->groups, id);
-}
-
-MkpTarget *
-mkp_project_get_target (MkpProject *project, const gchar *id)
-{
- MkpTarget **buffer;
- MkpTarget *target;
- gsize dummy;
-
- buffer = (MkpTarget **)g_base64_decode (id, &dummy);
- target = *buffer;
- g_free (buffer);
-
- return target;
-}
-
-MkpSource *
-mkp_project_get_source (MkpProject *project, const gchar *id)
-{
- MkpSource **buffer;
- MkpSource *source;
- gsize dummy;
-
- buffer = (MkpSource **)g_base64_decode (id, &dummy);
- source = *buffer;
- g_free (buffer);
-
- return source;
-}
-
-gchar *
-mkp_project_get_node_id (MkpProject *project, const gchar *path)
-{
- AnjutaProjectNode *node = NULL;
-
- if (path != NULL)
- {
- for (; *path != '\0';)
- {
- gchar *end;
- guint child = g_ascii_strtoull (path, &end, 10);
-
- if (end == path)
- {
- /* error */
- return NULL;
- }
-
- if (node == NULL)
- {
- if (child == 0) node = ANJUTA_PROJECT_NODE (project);
- }
- else
- {
- node = anjuta_project_node_nth_child (node, child);
- }
- if (node == NULL)
- {
- /* no node */
- return NULL;
- }
-
- if (*end == '\0') break;
- path = end + 1;
- }
- }
-
- switch (node->type)
- {
- case ANJUTA_PROJECT_GROUP:
- return g_file_get_uri (node->file);
- case ANJUTA_PROJECT_TARGET:
- case ANJUTA_PROJECT_SOURCE:
- return g_base64_encode ((guchar *)&node, sizeof (node));
- default:
- return NULL;
- }
-}
-
-gchar *
-mkp_project_get_uri (MkpProject *project)
-{
- g_return_val_if_fail (project != NULL, NULL);
-
- return project->root_file != NULL ? g_file_get_uri (project->root_file) : NULL;
-}
-
-GFile*
-mkp_project_get_file (MkpProject *project)
-{
- g_return_val_if_fail (project != NULL, NULL);
-
- return project->root_file;
-}
-
-const GList *
+static const GList *
mkp_project_get_node_info (MkpProject *project, GError **error)
{
static GList *info_list = NULL;
@@ -758,57 +520,6 @@ mkp_project_get_token_location (MkpProject *project, AnjutaTokenFileLocation *lo
return FALSE;
}
-/* Group access functions
- *---------------------------------------------------------------------------*/
-
-GFile*
-mkp_group_get_directory (MkpGroup *group)
-{
- return group->base.file;
-}
-
-GFile*
-mkp_group_get_makefile (MkpGroup *group)
-{
- return group->makefile;
-}
-
-gchar *
-mkp_group_get_id (MkpGroup *group)
-{
- return g_file_get_uri (group->base.file);
-}
-
-/* Target access functions
- *---------------------------------------------------------------------------*/
-
-const gchar *
-mkp_target_get_name (MkpTarget *target)
-{
- return target->base.name;
-}
-
-gchar *
-mkp_target_get_id (MkpTarget *target)
-{
- return g_base64_encode ((guchar *)&target, sizeof (target));
-}
-
-/* Source access functions
- *---------------------------------------------------------------------------*/
-
-gchar *
-mkp_source_get_id (MkpSource *source)
-{
- return g_base64_encode ((guchar *)&source, sizeof (source));
-}
-
-GFile*
-mkp_source_get_file (MkpSource *source)
-{
- return source->base.file;
-}
-
/* Variable access functions
*---------------------------------------------------------------------------*/
@@ -858,14 +569,14 @@ mkp_project_update_variable (MkpProject *project, AnjutaToken *variable)
MakeTokenType assign = 0;
AnjutaToken *value = NULL;
- fprintf(stdout, "update variable");
- anjuta_token_dump (variable);
+ //fprintf(stdout, "update variable");
+ //anjuta_token_dump (variable);
arg = anjuta_token_first_item (variable);
name = g_strstrip (anjuta_token_evaluate (arg));
arg = anjuta_token_next_item (arg);
- g_message ("new variable %s", name);
+ //g_message ("new variable %s", name);
switch (anjuta_token_get_type (arg))
{
case MK_TOKEN_EQUAL:
@@ -884,7 +595,7 @@ mkp_project_update_variable (MkpProject *project, AnjutaToken *variable)
{
MkpVariable *var;
- g_message ("assign %d name %s value %s\n", assign, name, anjuta_token_evaluate (value));
+ //g_message ("assign %d name %s value %s\n", assign, name, anjuta_token_evaluate (value));
var = (MkpVariable *)g_hash_table_lookup (project->variables, name);
if (var != NULL)
{
@@ -899,7 +610,7 @@ mkp_project_update_variable (MkpProject *project, AnjutaToken *variable)
}
- g_message ("update variable %s", name);
+ //g_message ("update variable %s", name);
if (name) g_free (name);
}
@@ -1147,7 +858,6 @@ mkp_project_save (MkpProject *project, GError **error)
{
GError *error = NULL;
AnjutaTokenFile *tfile = (AnjutaTokenFile *)value;
- ;
anjuta_token_file_save (tfile, &error);
}
@@ -1222,7 +932,7 @@ mkp_project_new (GFile *file, GError **error)
return project;
}
-gboolean
+static gboolean
mkp_project_is_loaded (MkpProject *project)
{
return project->loading == 0;
@@ -1369,7 +1079,6 @@ mkp_project_instance_init (MkpProject *project)
/* project data */
project->root_file = NULL;
- project->property = NULL;
project->suffix = NULL;
project->rules = NULL;
diff --git a/plugins/mk-project/mk-project.h b/plugins/mk-project/mk-project.h
index 4365a37..dcd193a 100644
--- a/plugins/mk-project/mk-project.h
+++ b/plugins/mk-project/mk-project.h
@@ -62,9 +62,9 @@ typedef struct _MkpProperty MkpProperty;
typedef struct _MkpVariable MkpVariable;
typedef struct _MkpRule MkpRule;
-typedef struct _MkpClass MkpSourceClass;
-typedef struct _MkpClass MkpTargetClass;
-typedef struct _MkpClass MkpGroupClass;
+typedef struct _MkpNodeClass MkpSourceClass;
+typedef struct _MkpNodeClass MkpTargetClass;
+typedef struct _MkpNodeClass MkpGroupClass;
struct _MkpVariable {
gchar *name;
@@ -72,38 +72,12 @@ struct _MkpVariable {
AnjutaToken *value;
};
-typedef enum {
- AM_GROUP_TOKEN_CONFIGURE,
- AM_GROUP_TOKEN_SUBDIRS,
- AM_GROUP_TOKEN_DIST_SUBDIRS,
- AM_GROUP_TARGET,
- AM_GROUP_TOKEN_LAST
-} MkpGroupTokenCategory;
-
struct _MkpGroup {
- AnjutaProjectNode base; /* Common node data */
- gboolean dist_only; /* TRUE if the group is distributed but not built */
- GFile *makefile; /* GFile corresponding to group makefile */
- AnjutaTokenFile *tfile; /* Corresponding Makefile */
- GList *tokens[AM_GROUP_TOKEN_LAST]; /* List of token used by this group */
+ AnjutaProjectNode base;
};
-typedef enum _MkpTargetFlag
-{
- AM_TARGET_CHECK = 1 << 0,
- AM_TARGET_NOINST = 1 << 1,
- AM_TARGET_DIST = 1 << 2,
- AM_TARGET_NODIST = 1 << 3,
- AM_TARGET_NOBASE = 1 << 4,
- AM_TARGET_NOTRANS = 1 << 5,
- AM_TARGET_MAN = 1 << 6,
- AM_TARGET_MAN_SECTION = 31 << 7
-} MkpTargetFlag;
-
struct _MkpTarget {
AnjutaProjectNode base;
- gchar *install;
- gint flags;
GList* tokens;
};
@@ -116,12 +90,9 @@ typedef struct _MkpNodeInfo MkpNodeInfo;
struct _MkpNodeInfo {
AnjutaProjectNodeInfo base;
- AnjutaTokenType token;
- const gchar *prefix;
- const gchar *install;
};
-struct _MkpClass {
+struct _MkpNodeClass {
AnjutaProjectNodeClass parent_class;
};
@@ -130,15 +101,6 @@ struct _MkpProjectClass {
};
-typedef enum {
- MKP_PROPERTY_NAME = 0,
- MKP_PROPERTY_VERSION,
- MKP_PROPERTY_BUG_REPORT,
- MKP_PROPERTY_TARNAME,
- MKP_PROPERTY_URL
-} MkpPropertyType;
-
-
GType mkp_project_get_type (void);
MkpProject *mkp_project_new (GFile *file, GError **error);
@@ -150,45 +112,16 @@ gboolean mkp_project_reload (MkpProject *project, GError **error);
void mkp_project_unload (MkpProject *project);
MkpProject *mkp_project_get_root (MkpProject *project);
-MkpVariable *mkp_project_get_variable (MkpProject *project, const gchar *name);
-GList *mkp_project_list_variable (MkpProject *project);
AnjutaToken* mkp_project_get_variable_token (MkpProject *project, AnjutaToken *variable);
void mkp_project_update_variable (MkpProject *project, AnjutaToken *variable);
void mkp_project_add_rule (MkpProject *project, AnjutaToken *rule);
-MkpGroup *mkp_project_get_group (MkpProject *project, const gchar *id);
-MkpTarget *mkp_project_get_target (MkpProject *project, const gchar *id);
-MkpSource *mkp_project_get_source (MkpProject *project, const gchar *id);
-
gboolean mkp_project_move (MkpProject *project, const gchar *path);
gboolean mkp_project_save (MkpProject *project, GError **error);
-gchar * mkp_project_get_uri (MkpProject *project);
-GFile* mkp_project_get_file (MkpProject *project);
gboolean mkp_project_get_token_location (MkpProject *project, AnjutaTokenFileLocation *location, AnjutaToken *token);
-MkpGroup* mkp_project_add_group (MkpProject *project, MkpGroup *parent, const gchar *name, GError **error);
-void mkp_project_remove_group (MkpProject *project, MkpGroup *group, GError **error);
-
-MkpTarget* mkp_project_add_target (MkpProject *project, MkpGroup *parent, const gchar *name, const gchar *type, GError **error);
-void mkp_project_remove_target (MkpProject *project, MkpTarget *target, GError **error);
-
-MkpSource* mkp_project_add_source (MkpProject *project, MkpTarget *target, const gchar *uri, GError **error);
-void mkp_project_remove_source (MkpProject *project, MkpSource *source, GError **error);
-
-gchar * mkp_project_get_node_id (MkpProject *project, const gchar *path);
-
-GFile *mkp_group_get_directory (MkpGroup *group);
-GFile *mkp_group_get_makefile (MkpGroup *group);
-gchar *mkp_group_get_id (MkpGroup *group);
-
-const gchar *mkp_target_get_name (MkpTarget *target);
-gchar *mkp_target_get_id (MkpTarget *target);
-
-gchar *mkp_source_get_id (MkpSource *source);
-GFile *mkp_source_get_file (MkpSource *source);
-
gchar *mkp_variable_evaluate (MkpVariable *variable, MkpProject *project);
const gchar* mkp_variable_get_name (MkpVariable *variable);
diff --git a/plugins/mk-project/mk-rule.c b/plugins/mk-project/mk-rule.c
index bcf21fa..7fbd205 100644
--- a/plugins/mk-project/mk-rule.c
+++ b/plugins/mk-project/mk-rule.c
@@ -71,7 +71,7 @@ mkp_rule_free (MkpRule *rule)
/* Find a source for target checking pattern rule. If no source is found,
* return target, else free target and return a newly allocated source name */
-gchar *
+static gchar *
mkp_project_find_source (MkpProject *project, gchar *target, AnjutaProjectNode *parent, guint backtrack)
{
GFile *child;
@@ -127,7 +127,7 @@ mkp_project_find_source (MkpProject *project, gchar *target, AnjutaProjectNode *
child = g_file_get_child (anjuta_project_node_get_file (parent), target);
exist = g_file_query_exists (child, NULL);
- g_message ("target =%s= filename =%s=", target, g_file_get_parse_name (child));
+ //g_message ("target =%s= filename =%s=", target, g_file_get_parse_name (child));
g_object_unref (child);
if (!exist)
@@ -153,8 +153,8 @@ mkp_project_add_rule (MkpProject *project, AnjutaToken *group)
AnjutaToken *arg;
gboolean double_colon = FALSE;
- fprintf(stdout, "add rule\n");
- anjuta_token_dump (group);
+ //fprintf(stdout, "add rule\n");
+ //anjuta_token_dump (group);
targ = anjuta_token_first_item (group);
arg = anjuta_token_next_word (targ);
@@ -185,7 +185,7 @@ mkp_project_add_rule (MkpProject *project, AnjutaToken *group)
}
rule->phony = TRUE;
- g_message (" with target %s", target);
+ //g_message (" with target %s", target);
if (target != NULL) g_free (target);
}
}
@@ -201,7 +201,7 @@ mkp_project_add_rule (MkpProject *project, AnjutaToken *group)
/* The pointer value must only be not NULL, it does not matter if it is
* invalid */
g_hash_table_replace (project->suffix, suffix, suffix);
- g_message (" with suffix %s", suffix);
+ //g_message (" with suffix %s", suffix);
no_token = FALSE;
}
}
@@ -227,7 +227,7 @@ mkp_project_add_rule (MkpProject *project, AnjutaToken *group)
default:
target = g_strstrip (anjuta_token_evaluate (arg));
if (*target == '\0') break;
- g_message ("add rule =%s=", target);
+ //g_message ("add rule =%s=", target);
rule = g_hash_table_lookup (project->rules, target);
if (rule == NULL)
@@ -246,7 +246,7 @@ mkp_project_add_rule (MkpProject *project, AnjutaToken *group)
if (src_name != NULL)
{
- g_message (" with source %s", src_name);
+ //g_message (" with source %s", src_name);
if (anjuta_token_get_type (src) == MK_TOKEN_ORDER)
{
order = TRUE;
@@ -321,7 +321,7 @@ mkp_project_enumerate_targets (MkpProject *project, AnjutaProjectNode *parent)
AnjutaToken *prerequisite;
AnjutaToken *arg;
- g_message ("rule =%s=", rule->name);
+ //g_message ("rule =%s=", rule->name);
if (rule->phony || rule->pattern) continue;
/* Create target */
diff --git a/plugins/mk-project/mk-scanner.l b/plugins/mk-project/mk-scanner.l
index 092aa38..873dbde 100644
--- a/plugins/mk-project/mk-scanner.l
+++ b/plugins/mk-project/mk-scanner.l
@@ -208,7 +208,7 @@ mkp_scanner_parse_variable (MkpScanner *scanner, AnjutaToken *variable)
anjuta_token_stream_append_token (scanner->stream, content);
group = mkp_project_get_variable_token (scanner->project, variable);
- fprintf(stdout, "get variable %s is %p\n", anjuta_token_evaluate (variable), group);
+ //fprintf(stdout, "get variable %s is %p\n", anjuta_token_evaluate (variable), group);
if (group != NULL)
{
//AnjutaToken *token;
@@ -217,8 +217,8 @@ mkp_scanner_parse_variable (MkpScanner *scanner, AnjutaToken *variable)
//token = anjuta_token_group_into_token (group);
//anjuta_token_set_type (token, ANJUTA_TOKEN_CONTENT);
//anjuta_token_dump (token);
- fprintf (stdout,"variable %s\n", anjuta_token_get_string (variable));
- anjuta_token_dump (group);
+ //fprintf (stdout,"variable %s\n", anjuta_token_get_string (variable));
+ //anjuta_token_dump (group);
mkp_scanner_parse_token (scanner, group, NULL);
//anjuta_token_free (token);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]