SF.net SVN: geany: [1149] trunk
ntrel at users.sourceforge.net
ntrel at xxxxx
Sat Dec 30 16:16:59 UTC 2006
Revision: 1149
http://svn.sourceforge.net/geany/?rev=1149&view=rev
Author: ntrel
Date: 2006-12-30 08:16:59 -0800 (Sat, 30 Dec 2006)
Log Message:
-----------
Applied patch from Josef Whiter to parse 'Entering directory' build
messages so that subsequent error messages are handled correctly
(thanks).
Assume gcc-style error messages when filetype is not set.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/build.c
trunk/src/build.h
trunk/src/msgwindow.c
trunk/src/msgwindow.h
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2006-12-30 11:49:47 UTC (rev 1148)
+++ trunk/ChangeLog 2006-12-30 16:16:59 UTC (rev 1149)
@@ -3,6 +3,11 @@
* src/ui_utils.c:
Don't use gtk_rc_get_style() in ui_update_tab_status() because it
can cause an invalid memory read on some systems.
+ * src/build.c, src/build.h, src/msgwindow.c, src/msgwindow.h:
+ Applied patch from Josef Whiter to parse 'Entering directory' build
+ messages so that subsequent error messages are handled correctly
+ (thanks).
+ Assume gcc-style error messages when filetype is not set.
2006-12-26 Nick Treleaven <nick.treleaven at btinternet.com>
Modified: trunk/src/build.c
===================================================================
--- trunk/src/build.c 2006-12-30 11:49:47 UTC (rev 1148)
+++ trunk/src/build.c 2006-12-30 16:16:59 UTC (rev 1149)
@@ -685,7 +685,7 @@
if (cond & (G_IO_IN | G_IO_PRI))
{
//GIOStatus s;
- gchar *msg;
+ gchar *msg, *dir = NULL;
while (g_io_channel_read_line(ioc, &msg, NULL, NULL, NULL) && msg)
{
@@ -694,11 +694,18 @@
color = (GPOINTER_TO_INT(data)) ? COLOR_DARK_RED : COLOR_BLACK;
g_strstrip(msg);
+ if (strstr(msg, "Entering directory") != NULL) {
+ if (dir != NULL)
+ g_free(dir);
+ build_parse_make_dir(msg, &dir);
+ }
+
if (app->pref_editor_use_indicators)
{
gchar *filename;
gint line;
- msgwin_parse_compiler_error_line(msg, &filename, &line);
+
+ msgwin_parse_compiler_error_line(msg, dir, &filename, &line);
if (line != -1 && filename != NULL)
{
gint idx = document_find_by_filename(filename, FALSE);
@@ -711,6 +718,9 @@
g_free(msg);
}
+
+ if (dir != NULL)
+ g_free(dir);
}
if (cond & (G_IO_ERR | G_IO_HUP | G_IO_NVAL))
return FALSE;
@@ -719,6 +729,43 @@
}
+gboolean build_parse_make_dir(gchar *string, gchar **prefix)
+{
+ gchar *pos, *input;
+
+ *prefix = NULL;
+
+ input = g_strdup(string);
+ if (input == NULL)
+ return FALSE;
+
+ if ((pos = strstr(input, "Entering directory")) != NULL)
+ {
+ gsize len = strlen(input);
+
+ //get the start of the path
+ pos = strstr(input, "/");
+
+ if (pos == NULL) {
+ g_free(input);
+ return FALSE;
+ }
+
+ //kill the ' at the end of the path
+ input[len-1] = '\0';
+
+ //duplicate
+ *prefix = g_strdup(pos);
+
+ g_free(input);
+ return TRUE;
+ }
+
+ g_free(input);
+ return FALSE;
+}
+
+
#ifndef G_OS_WIN32
static void show_build_result_message(gboolean failure)
{
Modified: trunk/src/build.h
===================================================================
--- trunk/src/build.h 2006-12-30 11:49:47 UTC (rev 1148)
+++ trunk/src/build.h 2006-12-30 16:16:59 UTC (rev 1149)
@@ -74,6 +74,8 @@
GPid build_run_cmd(gint idx);
+gboolean build_parse_make_dir(gchar *string, gchar **prefix);
+
void build_menu_update(gint idx);
BuildMenuItems *build_get_menu_items(gint filetype_id);
@@ -106,4 +108,5 @@
void
on_build_next_error (GtkMenuItem *menuitem,
gpointer user_data);
+
#endif
Modified: trunk/src/msgwindow.c
===================================================================
--- trunk/src/msgwindow.c 2006-12-30 11:49:47 UTC (rev 1148)
+++ trunk/src/msgwindow.c 2006-12-30 16:16:59 UTC (rev 1149)
@@ -416,6 +416,32 @@
}
+/* look back up from the current path and find the directory we came from */
+static gboolean
+find_prev_build_dir(GtkTreePath *cur, GtkTreeModel *model, gchar **prefix)
+{
+ GtkTreeIter iter;
+ *prefix = NULL;
+
+ while (gtk_tree_path_prev(cur))
+ {
+ if (gtk_tree_model_get_iter(model, &iter, cur))
+ {
+ gchar *string;
+ gtk_tree_model_get(model, &iter, 1, &string, -1);
+ if (string != NULL && build_parse_make_dir(string, prefix))
+ {
+ g_free(string);
+ return TRUE;
+ }
+ g_free(string);
+ }
+ }
+
+ return FALSE;
+}
+
+
gboolean msgwin_goto_compiler_file_line()
{
GtkTreeIter iter;
@@ -442,8 +468,17 @@
{
gint line;
gint idx;
- gchar *filename;
- msgwin_parse_compiler_error_line(string, &filename, &line);
+ gchar *filename, *dir;
+ GtkTreePath *path;
+
+ path = gtk_tree_model_get_path(model, &iter);
+ find_prev_build_dir(path, model, &dir);
+ gtk_tree_path_free(path);
+ msgwin_parse_compiler_error_line(string, dir, &filename, &line);
+
+ if (dir != NULL)
+ g_free(dir);
+
if (filename != NULL && line > -1)
{
gchar *utf8_filename = utils_get_utf8_from_locale(filename);
@@ -533,22 +568,21 @@
* relevant file with the error in *filename.
* *line will be -1 if no error was found in string.
* *filename must be freed unless it is NULL. */
-void msgwin_parse_compiler_error_line(const gchar *string, gchar **filename, gint *line)
+void msgwin_parse_compiler_error_line(const gchar *string, const gchar *dir, gchar **filename, gint *line)
{
ParseData data = {string, build_info.dir, NULL, 0, 0, 0};
*filename = NULL;
*line = -1;
- g_return_if_fail(build_info.dir != NULL);
+ if (dir != NULL)
+ data.dir = dir;
+
+ g_return_if_fail(build_info.dir != NULL || dir != NULL);
if (string == NULL) return;
switch (build_info.file_type_id)
{
- case GEANY_FILETYPES_ALL:
- {
- return;
- }
case GEANY_FILETYPES_PHP:
{
// Parse error: parse error, unexpected T_CASE in brace_bug.php on line 3
@@ -668,6 +702,7 @@
case GEANY_FILETYPES_LATEX:
// ./kommtechnik_2b.tex:18: Emergency stop.
case GEANY_FILETYPES_MAKE: // Assume makefile is building with gcc
+ case GEANY_FILETYPES_ALL:
default: // The default is a GNU gcc type error
{
// don't accidently find libtool versions x:y:x and think it is a file name
Modified: trunk/src/msgwindow.h
===================================================================
--- trunk/src/msgwindow.h 2006-12-30 11:49:47 UTC (rev 1148)
+++ trunk/src/msgwindow.h 2006-12-30 16:16:59 UTC (rev 1149)
@@ -79,7 +79,7 @@
gboolean msgwin_goto_compiler_file_line();
-void msgwin_parse_compiler_error_line(const gchar *string, gchar **filename, gint *line);
+void msgwin_parse_compiler_error_line(const gchar *string, const gchar *dir, gchar **filename, gint *line);
gboolean msgwin_goto_messages_file_line();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Commits
mailing list