Add support for parsing compiler output for LaTeX with latex's --file-line-error-style command line argument.

Removed unneeded function utils_free_ptr_array().


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@495 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Enrico Tröger 2006-06-27 15:31:32 +00:00
parent 99bb4a9977
commit f6752778f4
4 changed files with 27 additions and 23 deletions

View File

@ -2,6 +2,10 @@
* data/filetypes.php, data/filetypes.pascal, src/callbacks.c,
src/build.c: Parse stdout of compiler output too.
* src/utils.c, data/filetypes.latex:
Add support for parsing compiler output for LaTeX with latex's
--file-line-error-style command line argument.
Removed unneeded function utils_free_ptr_array().
2006-06-27 Nick Treleaven <nick.treleaven@btinternet.com>

View File

@ -32,8 +32,8 @@ comment_use_indent=true
# %f will be replaced by the complete filename
# %e will be replaced by the filename without extension
# (use only one of it at one time)
compiler=latex "%f"
compiler=latex --file-line-error-style "%f"
# it is called linker, but here it is an alternative compiler command
linker=pdflatex "%f"
linker=pdflatex --file-line-error-style "%f"
run_cmd=xdvi "%f"
run_cmd2=xpdf "%f"

View File

@ -385,7 +385,8 @@ const GList *utils_get_tag_list(gint idx, guint tag_types)
{
static GList *tag_names = NULL;
if (doc_list[idx].is_valid && doc_list[idx].tm_file && doc_list[idx].tm_file->tags_array)
if (idx >= 0 && doc_list[idx].is_valid && doc_list[idx].tm_file &&
doc_list[idx].tm_file->tags_array)
{
TMTag *tag;
guint i;
@ -769,9 +770,7 @@ void utils_update_tag_list(gint idx, gboolean update)
gtk_widget_set_sensitive(app->tagbar, FALSE);
gtk_container_add(GTK_CONTAINER(app->tagbar), app->default_tag_tree);
}
}
}
@ -1881,17 +1880,6 @@ gchar *utils_get_initials(gchar *name)
}
void utils_free_ptr_array(gchar *array[], gint len)
{
gint i;
for (i = 0; i < len; i++)
{
g_free(array[i]);
}
}
void utils_update_fold_items(void)
{
gtk_widget_set_sensitive(lookup_widget(app->window, "menu_fold_all1"), app->pref_editor_folding);
@ -2327,10 +2315,11 @@ void utils_parse_compiler_error_line(const gchar *string, gchar **filename, gint
gchar *end = NULL;
gchar *path;
gchar **fields;
gchar *pattern; // pattern to split the error message into some fields
guint field_min_len; // used to detect errors after parsing
guint field_idx_line; // idx of the field where the line is
guint field_idx_file; // idx of the field where the filename is
gchar *pattern; // pattern to split the error message into some fields
guint field_min_len; // used to detect errors after parsing
guint field_idx_line; // idx of the field where the line is
guint field_idx_file; // idx of the field where the filename is
guint skip_dot_slash = 0; // number of characters to skip at the beginning of the filename
*filename = NULL;
*line = -1;
@ -2355,6 +2344,15 @@ void utils_parse_compiler_error_line(const gchar *string, gchar **filename, gint
field_idx_file = 0;
break;
}
case GEANY_FILETYPES_LATEX:
{
// ./kommtechnik_2b.tex:18: Emergency stop.
pattern = ":";
field_min_len = 3;
field_idx_line = 1;
field_idx_file = 0;
break;
}
case GEANY_FILETYPES_PHP:
{
// Parse error: parse error, unexpected T_CASE in brace_bug.php on line 3
@ -2416,9 +2414,13 @@ void utils_parse_compiler_error_line(const gchar *string, gchar **filename, gint
return;
}
// skip some characters at the beginning of the filename, at the moment only "./"
// can be extended if other "trash" is known
if (strncmp(fields[field_idx_file], "./", 2) == 0) skip_dot_slash = 2;
// get the basename of the built file to get the path to look for other files
path = g_path_get_dirname(doc_list[app->cur_idx].file_name);
*filename = g_strconcat(path, G_DIR_SEPARATOR_S, fields[field_idx_file], NULL);
*filename = g_strconcat(path, G_DIR_SEPARATOR_S, fields[field_idx_file] + skip_dot_slash, NULL);
g_free(path);
g_strfreev(fields);

View File

@ -171,8 +171,6 @@ gchar *utils_get_initials(gchar *name);
void utils_update_toolbar_icons(GtkIconSize size);
void utils_free_ptr_array(gchar *array[], gint len);
void utils_update_recent_menu(void);
gboolean utils_get_setting_boolean(GKeyFile *config, const gchar *section, const gchar *key, const gboolean default_value);