Prefixed private functions with underscore
parent
fec9d33ecd
commit
24cdeb9c35
|
@ -544,12 +544,12 @@ strbreakup (const char *string,
|
|||
* Return value: whether a match was found.
|
||||
**/
|
||||
gboolean
|
||||
gtk_source_iter_forward_search (const GtkTextIter *iter,
|
||||
const gchar *str,
|
||||
GtkSourceSearchFlags flags,
|
||||
GtkTextIter *match_start,
|
||||
GtkTextIter *match_end,
|
||||
const GtkTextIter *limit)
|
||||
_gtk_source_iter_forward_search (const GtkTextIter *iter,
|
||||
const gchar *str,
|
||||
GtkSourceSearchFlags flags,
|
||||
GtkTextIter *match_start,
|
||||
GtkTextIter *match_end,
|
||||
const GtkTextIter *limit)
|
||||
{
|
||||
gchar **lines = NULL;
|
||||
GtkTextIter match;
|
||||
|
@ -647,12 +647,12 @@ gtk_source_iter_forward_search (const GtkTextIter *iter,
|
|||
* Return value: whether a match was found.
|
||||
**/
|
||||
gboolean
|
||||
gtk_source_iter_backward_search (const GtkTextIter *iter,
|
||||
const gchar *str,
|
||||
GtkSourceSearchFlags flags,
|
||||
GtkTextIter *match_start,
|
||||
GtkTextIter *match_end,
|
||||
const GtkTextIter *limit)
|
||||
_gtk_source_iter_backward_search (const GtkTextIter *iter,
|
||||
const gchar *str,
|
||||
GtkSourceSearchFlags flags,
|
||||
GtkTextIter *match_start,
|
||||
GtkTextIter *match_end,
|
||||
const GtkTextIter *limit)
|
||||
{
|
||||
gchar **lines = NULL;
|
||||
GtkTextIter match;
|
||||
|
|
|
@ -34,21 +34,21 @@ typedef enum
|
|||
/* Possible future plans: SEARCH_REGEXP */
|
||||
} GtkSourceSearchFlags;
|
||||
|
||||
gboolean gtk_source_iter_forward_search (const GtkTextIter *iter,
|
||||
gboolean _gtk_source_iter_forward_search (const GtkTextIter *iter,
|
||||
const gchar *str,
|
||||
GtkSourceSearchFlags flags,
|
||||
GtkTextIter *match_start,
|
||||
GtkTextIter *match_end,
|
||||
const GtkTextIter *limit);
|
||||
|
||||
gboolean gtk_source_iter_backward_search (const GtkTextIter *iter,
|
||||
gboolean _gtk_source_iter_backward_search (const GtkTextIter *iter,
|
||||
const gchar *str,
|
||||
GtkSourceSearchFlags flags,
|
||||
GtkTextIter *match_start,
|
||||
GtkTextIter *match_end,
|
||||
const GtkTextIter *limit);
|
||||
|
||||
gboolean gtk_source_iter_find_matching_bracket (GtkTextIter *iter);
|
||||
gboolean _gtk_source_iter_find_matching_bracket (GtkTextIter *iter);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ static void add_status (MooEdit *edit,
|
|||
|
||||
|
||||
MooEditLoader*
|
||||
moo_edit_loader_get_default (void)
|
||||
_moo_edit_loader_get_default (void)
|
||||
{
|
||||
if (!default_loader)
|
||||
{
|
||||
|
@ -84,7 +84,7 @@ moo_edit_loader_get_default (void)
|
|||
|
||||
|
||||
MooEditSaver*
|
||||
moo_edit_saver_get_default (void)
|
||||
_moo_edit_saver_get_default (void)
|
||||
{
|
||||
if (!default_saver)
|
||||
{
|
||||
|
@ -99,7 +99,7 @@ moo_edit_saver_get_default (void)
|
|||
|
||||
|
||||
MooEditLoader*
|
||||
moo_edit_loader_ref (MooEditLoader *loader)
|
||||
_moo_edit_loader_ref (MooEditLoader *loader)
|
||||
{
|
||||
g_return_val_if_fail (loader != NULL, NULL);
|
||||
loader->ref_count++;
|
||||
|
@ -108,7 +108,7 @@ moo_edit_loader_ref (MooEditLoader *loader)
|
|||
|
||||
|
||||
MooEditSaver*
|
||||
moo_edit_saver_ref (MooEditSaver *saver)
|
||||
_moo_edit_saver_ref (MooEditSaver *saver)
|
||||
{
|
||||
g_return_val_if_fail (saver != NULL, NULL);
|
||||
saver->ref_count++;
|
||||
|
@ -117,7 +117,7 @@ moo_edit_saver_ref (MooEditSaver *saver)
|
|||
|
||||
|
||||
void
|
||||
moo_edit_loader_unref (MooEditLoader *loader)
|
||||
_moo_edit_loader_unref (MooEditLoader *loader)
|
||||
{
|
||||
if (!loader || --loader->ref_count)
|
||||
return;
|
||||
|
@ -130,7 +130,7 @@ moo_edit_loader_unref (MooEditLoader *loader)
|
|||
|
||||
|
||||
void
|
||||
moo_edit_saver_unref (MooEditSaver *saver)
|
||||
_moo_edit_saver_unref (MooEditSaver *saver)
|
||||
{
|
||||
if (!saver || --saver->ref_count)
|
||||
return;
|
||||
|
@ -143,11 +143,11 @@ moo_edit_saver_unref (MooEditSaver *saver)
|
|||
|
||||
|
||||
gboolean
|
||||
moo_edit_loader_load (MooEditLoader *loader,
|
||||
MooEdit *edit,
|
||||
const char *filename,
|
||||
const char *encoding,
|
||||
GError **error)
|
||||
_moo_edit_loader_load (MooEditLoader *loader,
|
||||
MooEdit *edit,
|
||||
const char *filename,
|
||||
const char *encoding,
|
||||
GError **error)
|
||||
{
|
||||
char *filename_copy, *encoding_copy;
|
||||
gboolean result;
|
||||
|
@ -168,9 +168,9 @@ moo_edit_loader_load (MooEditLoader *loader,
|
|||
|
||||
|
||||
gboolean
|
||||
moo_edit_loader_reload (MooEditLoader *loader,
|
||||
MooEdit *edit,
|
||||
GError **error)
|
||||
_moo_edit_loader_reload (MooEditLoader *loader,
|
||||
MooEdit *edit,
|
||||
GError **error)
|
||||
{
|
||||
g_return_val_if_fail (loader != NULL, FALSE);
|
||||
g_return_val_if_fail (MOO_IS_EDIT (edit), FALSE);
|
||||
|
@ -180,12 +180,12 @@ moo_edit_loader_reload (MooEditLoader *loader,
|
|||
|
||||
|
||||
gboolean
|
||||
moo_edit_saver_save (MooEditSaver *saver,
|
||||
MooEdit *edit,
|
||||
const char *filename,
|
||||
const char *encoding,
|
||||
MooEditSaveFlags flags,
|
||||
GError **error)
|
||||
_moo_edit_saver_save (MooEditSaver *saver,
|
||||
MooEdit *edit,
|
||||
const char *filename,
|
||||
const char *encoding,
|
||||
MooEditSaveFlags flags,
|
||||
GError **error)
|
||||
{
|
||||
char *filename_copy, *encoding_copy;
|
||||
gboolean result;
|
||||
|
@ -206,11 +206,11 @@ moo_edit_saver_save (MooEditSaver *saver,
|
|||
|
||||
|
||||
gboolean
|
||||
moo_edit_saver_save_copy (MooEditSaver *saver,
|
||||
MooEdit *edit,
|
||||
const char *filename,
|
||||
const char *encoding,
|
||||
GError **error)
|
||||
_moo_edit_saver_save_copy (MooEditSaver *saver,
|
||||
MooEdit *edit,
|
||||
const char *filename,
|
||||
const char *encoding,
|
||||
GError **error)
|
||||
{
|
||||
char *filename_copy, *encoding_copy;
|
||||
gboolean result;
|
||||
|
@ -519,8 +519,8 @@ moo_edit_reload_default (MooEditLoader *loader,
|
|||
g_object_get (edit, "enable-highlight", &enable_highlight, NULL);
|
||||
g_object_set (edit, "enable-highlight", FALSE, NULL);
|
||||
|
||||
result = moo_edit_loader_load (loader, edit, edit->priv->filename,
|
||||
edit->priv->encoding, error);
|
||||
result = _moo_edit_loader_load (loader, edit, edit->priv->filename,
|
||||
edit->priv->encoding, error);
|
||||
|
||||
g_object_set (edit, "enable-highlight", enable_highlight, NULL);
|
||||
gtk_text_buffer_end_user_action (buffer);
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4; coding: utf-8 -*-
|
||||
*
|
||||
/*
|
||||
* mooeditfileops.h
|
||||
*
|
||||
* Copyright (C) 2004-2006 by Yevgen Muntyan <muntyan@math.tamu.edu>
|
||||
|
@ -12,6 +11,10 @@
|
|||
* See COPYING file that comes with this distribution.
|
||||
*/
|
||||
|
||||
#ifndef MOOEDIT_COMPILATION
|
||||
#error "This file may not be included"
|
||||
#endif
|
||||
|
||||
#ifndef __MOO_EDIT_FILE_OPS_H__
|
||||
#define __MOO_EDIT_FILE_OPS_H__
|
||||
|
||||
|
@ -59,29 +62,29 @@ struct _MooEditSaver
|
|||
};
|
||||
|
||||
|
||||
MooEditLoader *moo_edit_loader_get_default(void);
|
||||
MooEditSaver *moo_edit_saver_get_default (void);
|
||||
MooEditLoader *_moo_edit_loader_get_default(void);
|
||||
MooEditSaver *_moo_edit_saver_get_default (void);
|
||||
|
||||
MooEditLoader *moo_edit_loader_ref (MooEditLoader *loader);
|
||||
void moo_edit_loader_unref (MooEditLoader *loader);
|
||||
MooEditSaver *moo_edit_saver_ref (MooEditSaver *saver);
|
||||
void moo_edit_saver_unref (MooEditSaver *saver);
|
||||
MooEditLoader *_moo_edit_loader_ref (MooEditLoader *loader);
|
||||
void _moo_edit_loader_unref (MooEditLoader *loader);
|
||||
MooEditSaver *_moo_edit_saver_ref (MooEditSaver *saver);
|
||||
void _moo_edit_saver_unref (MooEditSaver *saver);
|
||||
|
||||
gboolean moo_edit_loader_load (MooEditLoader *loader,
|
||||
gboolean _moo_edit_loader_load (MooEditLoader *loader,
|
||||
MooEdit *edit,
|
||||
const char *file,
|
||||
const char *encoding,
|
||||
GError **error);
|
||||
gboolean moo_edit_loader_reload (MooEditLoader *loader,
|
||||
gboolean _moo_edit_loader_reload (MooEditLoader *loader,
|
||||
MooEdit *edit,
|
||||
GError **error);
|
||||
gboolean moo_edit_saver_save (MooEditSaver *saver,
|
||||
gboolean _moo_edit_saver_save (MooEditSaver *saver,
|
||||
MooEdit *edit,
|
||||
const char *file,
|
||||
const char *encoding,
|
||||
MooEditSaveFlags flags,
|
||||
GError **error);
|
||||
gboolean moo_edit_saver_save_copy (MooEditSaver *saver,
|
||||
gboolean _moo_edit_saver_save_copy (MooEditSaver *saver,
|
||||
MooEdit *edit,
|
||||
const char *file,
|
||||
const char *encoding,
|
||||
|
|
|
@ -277,10 +277,10 @@ moo_editor_init (MooEditor *editor)
|
|||
|
||||
editor->priv->loaders =
|
||||
g_hash_table_new_full (g_direct_hash, g_direct_equal,
|
||||
NULL, (GDestroyNotify) moo_edit_loader_unref);
|
||||
NULL, (GDestroyNotify) _moo_edit_loader_unref);
|
||||
editor->priv->savers =
|
||||
g_hash_table_new_full (g_direct_hash, g_direct_equal,
|
||||
NULL, (GDestroyNotify) moo_edit_saver_unref);
|
||||
NULL, (GDestroyNotify) _moo_edit_saver_unref);
|
||||
|
||||
moo_prefs_new_key_string (moo_edit_setting (MOO_EDIT_PREFS_DEFAULT_LANG), NULL);
|
||||
_moo_edit_config_load ();
|
||||
|
@ -856,8 +856,8 @@ moo_editor_add_doc (MooEditor *editor,
|
|||
|
||||
window_info_add (info, doc);
|
||||
|
||||
g_hash_table_insert (editor->priv->loaders, doc, moo_edit_loader_ref (loader));
|
||||
g_hash_table_insert (editor->priv->savers, doc, moo_edit_saver_ref (saver));
|
||||
g_hash_table_insert (editor->priv->loaders, doc, _moo_edit_loader_ref (loader));
|
||||
g_hash_table_insert (editor->priv->savers, doc, _moo_edit_saver_ref (saver));
|
||||
|
||||
if (!moo_edit_get_filename (doc) &&
|
||||
!moo_edit_config_get_string (doc->config, "lang") &&
|
||||
|
@ -887,8 +887,8 @@ moo_editor_new_window (MooEditor *editor)
|
|||
doc = g_object_new (get_doc_type (editor), "editor", editor, NULL);
|
||||
_moo_edit_window_insert_doc (window, doc, -1);
|
||||
moo_editor_add_doc (editor, window, doc,
|
||||
moo_edit_loader_get_default (),
|
||||
moo_edit_saver_get_default ());
|
||||
_moo_edit_loader_get_default (),
|
||||
_moo_edit_saver_get_default ());
|
||||
}
|
||||
|
||||
return window;
|
||||
|
@ -909,10 +909,10 @@ moo_editor_create_doc (MooEditor *editor,
|
|||
g_return_val_if_fail (MOO_IS_EDITOR (editor), NULL);
|
||||
|
||||
doc = g_object_new (get_doc_type (editor), "editor", editor, NULL);
|
||||
loader = moo_edit_loader_get_default ();
|
||||
saver = moo_edit_saver_get_default ();
|
||||
loader = _moo_edit_loader_get_default ();
|
||||
saver = _moo_edit_saver_get_default ();
|
||||
|
||||
if (filename && !moo_edit_loader_load (loader, doc, filename, encoding, error))
|
||||
if (filename && !_moo_edit_loader_load (loader, doc, filename, encoding, error))
|
||||
{
|
||||
gtk_object_sink (g_object_ref (doc));
|
||||
g_object_unref (doc);
|
||||
|
@ -947,8 +947,8 @@ moo_editor_new_doc (MooEditor *editor,
|
|||
doc = g_object_new (get_doc_type (editor), "editor", editor, NULL);
|
||||
_moo_edit_window_insert_doc (window, doc, -1);
|
||||
moo_editor_add_doc (editor, window, doc,
|
||||
moo_edit_loader_get_default (),
|
||||
moo_edit_saver_get_default ());
|
||||
_moo_edit_loader_get_default (),
|
||||
_moo_edit_saver_get_default ());
|
||||
|
||||
return doc;
|
||||
}
|
||||
|
@ -987,8 +987,8 @@ moo_editor_open (MooEditor *editor,
|
|||
return result;
|
||||
}
|
||||
|
||||
loader = moo_edit_loader_get_default ();
|
||||
saver = moo_edit_saver_get_default ();
|
||||
loader = _moo_edit_loader_get_default ();
|
||||
saver = _moo_edit_saver_get_default ();
|
||||
|
||||
for (l = files; l != NULL; l = l->next)
|
||||
{
|
||||
|
@ -1024,7 +1024,7 @@ moo_editor_open (MooEditor *editor,
|
|||
}
|
||||
|
||||
/* XXX open_single */
|
||||
if (!moo_edit_loader_load (loader, doc, info->filename, info->encoding, &error))
|
||||
if (!_moo_edit_loader_load (loader, doc, info->filename, info->encoding, &error))
|
||||
{
|
||||
moo_edit_open_error_dialog (parent, info->filename,
|
||||
error ? error->message : NULL);
|
||||
|
@ -1311,8 +1311,8 @@ moo_editor_close_docs (MooEditor *editor,
|
|||
"editor", editor, NULL);
|
||||
_moo_edit_window_insert_doc (info->window, doc, -1);
|
||||
moo_editor_add_doc (editor, info->window, doc,
|
||||
moo_edit_loader_get_default (),
|
||||
moo_edit_saver_get_default ());
|
||||
_moo_edit_loader_get_default (),
|
||||
_moo_edit_saver_get_default ());
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -1571,7 +1571,7 @@ _moo_editor_reload (MooEditor *editor,
|
|||
cursor_line = gtk_text_iter_get_line (&iter);
|
||||
cursor_offset = moo_text_iter_get_visual_line_offset (&iter, 8);
|
||||
|
||||
if (!moo_edit_loader_reload (loader, doc, &error_here))
|
||||
if (!_moo_edit_loader_reload (loader, doc, &error_here))
|
||||
{
|
||||
if (!editor->priv->silent)
|
||||
moo_edit_reload_error_dialog (GTK_WIDGET (doc), error_here->message);
|
||||
|
@ -1616,8 +1616,8 @@ do_save (MooEditor *editor,
|
|||
moo_text_view_strip_whitespace (MOO_TEXT_VIEW (doc));
|
||||
|
||||
g_signal_emit_by_name (doc, "save-before");
|
||||
result = moo_edit_saver_save (saver, doc, filename, encoding,
|
||||
moo_editor_get_save_flags (editor), error);
|
||||
result = _moo_edit_saver_save (saver, doc, filename, encoding,
|
||||
moo_editor_get_save_flags (editor), error);
|
||||
g_signal_emit_by_name (doc, "save-after");
|
||||
|
||||
return result;
|
||||
|
@ -1762,7 +1762,7 @@ moo_editor_save_copy (MooEditor *editor,
|
|||
saver = get_saver (editor, doc);
|
||||
g_return_val_if_fail (saver != NULL, FALSE);
|
||||
|
||||
return moo_edit_saver_save_copy (saver, doc, filename, encoding, error);
|
||||
return _moo_edit_saver_save_copy (saver, doc, filename, encoding, error);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ static gboolean hl_compute_range (MooHighlighter *hl,
|
|||
|
||||
|
||||
/* MOO_TYPE_SYNTAX_TAG */
|
||||
G_DEFINE_TYPE (MooSyntaxTag, moo_syntax_tag, GTK_TYPE_TEXT_TAG)
|
||||
G_DEFINE_TYPE (MooSyntaxTag, _moo_syntax_tag, GTK_TYPE_TEXT_TAG)
|
||||
|
||||
|
||||
// static void
|
||||
|
@ -72,14 +72,14 @@ G_DEFINE_TYPE (MooSyntaxTag, moo_syntax_tag, GTK_TYPE_TEXT_TAG)
|
|||
|
||||
|
||||
static void
|
||||
moo_syntax_tag_class_init (G_GNUC_UNUSED MooSyntaxTagClass *klass)
|
||||
_moo_syntax_tag_class_init (G_GNUC_UNUSED MooSyntaxTagClass *klass)
|
||||
{
|
||||
// G_OBJECT_CLASS(klass)->finalize = moo_syntax_tag_finalize;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
moo_syntax_tag_init (MooSyntaxTag *tag)
|
||||
_moo_syntax_tag_init (MooSyntaxTag *tag)
|
||||
{
|
||||
tag->ctx_node = NULL;
|
||||
tag->match_node = NULL;
|
||||
|
@ -114,8 +114,8 @@ ctx_node_free (CtxNode *node,
|
|||
|
||||
|
||||
void
|
||||
moo_highlighter_destroy (MooHighlighter *hl,
|
||||
gboolean delete_tags)
|
||||
_moo_highlighter_destroy (MooHighlighter *hl,
|
||||
gboolean delete_tags)
|
||||
{
|
||||
GtkTextTagTable *table = NULL;
|
||||
|
||||
|
@ -199,7 +199,7 @@ apply_tag (MooHighlighter *hl,
|
|||
{
|
||||
#if 0
|
||||
static int last_line_no = -1;
|
||||
int line_no = moo_line_buffer_get_line_index (hl->line_buf, line);
|
||||
int line_no = _moo_line_buffer_get_line_index (hl->line_buf, line);
|
||||
if (line_no != last_line_no)
|
||||
{
|
||||
last_line_no = line_no;
|
||||
|
@ -233,9 +233,9 @@ check_last_tag (MooHighlighter *hl)
|
|||
|
||||
|
||||
MooHighlighter*
|
||||
moo_highlighter_new (GtkTextBuffer *buffer,
|
||||
LineBuffer *line_buf,
|
||||
MooLang *lang)
|
||||
_moo_highlighter_new (GtkTextBuffer *buffer,
|
||||
LineBuffer *line_buf,
|
||||
MooLang *lang)
|
||||
{
|
||||
MooHighlighter *hl;
|
||||
|
||||
|
@ -468,7 +468,7 @@ hl_compute_line (MooHighlighter *hl,
|
|||
|
||||
while (!gtk_text_iter_ends_line (&data->start_iter))
|
||||
{
|
||||
if ((matched_rule = moo_rule_array_match (node->ctx->rules, data, &result)))
|
||||
if ((matched_rule = _moo_rule_array_match (node->ctx->rules, data, &result)))
|
||||
{
|
||||
CtxNode *match_node, *next_node;
|
||||
|
||||
|
@ -479,7 +479,7 @@ hl_compute_line (MooHighlighter *hl,
|
|||
result.match_len = g_utf8_pointer_to_offset (result.match_start, result.match_end);
|
||||
|
||||
if (result.match_offset)
|
||||
moo_line_add_segment (line, result.match_offset, node, NULL, NULL);
|
||||
_moo_line_add_segment (line, result.match_offset, node, NULL, NULL);
|
||||
|
||||
next_node = get_next_node (hl, node, matched_rule);
|
||||
|
||||
|
@ -488,16 +488,16 @@ hl_compute_line (MooHighlighter *hl,
|
|||
else
|
||||
match_node = node;
|
||||
|
||||
moo_line_add_segment (line, result.match_len, match_node, node, matched_rule);
|
||||
_moo_line_add_segment (line, result.match_len, match_node, node, matched_rule);
|
||||
|
||||
moo_match_data_set_start (data, NULL, result.match_end,
|
||||
data->start_offset + result.match_offset + result.match_len);
|
||||
_moo_match_data_set_start (data, NULL, result.match_end,
|
||||
data->start_offset + result.match_offset + result.match_len);
|
||||
|
||||
node = next_node;
|
||||
}
|
||||
else
|
||||
{
|
||||
moo_line_add_segment (line, -1, node, NULL, NULL);
|
||||
_moo_line_add_segment (line, -1, node, NULL, NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -534,7 +534,7 @@ hl_compute_range (MooHighlighter *hl,
|
|||
}
|
||||
else
|
||||
{
|
||||
Line *prev = moo_line_buffer_get_line (hl->line_buf, lines->first - 1);
|
||||
Line *prev = _moo_line_buffer_get_line (hl->line_buf, lines->first - 1);
|
||||
node = get_next_line_node (hl, prev);
|
||||
}
|
||||
|
||||
|
@ -550,7 +550,7 @@ hl_compute_range (MooHighlighter *hl,
|
|||
|
||||
for (line_no = lines->first; line_no <= lines->last; ++line_no)
|
||||
{
|
||||
Line *line = moo_line_buffer_get_line (hl->line_buf, line_no);
|
||||
Line *line = _moo_line_buffer_get_line (hl->line_buf, line_no);
|
||||
MatchData match_data;
|
||||
|
||||
// g_assert (line->hl_info->tags || !line->hl_info->tags_applied || !line->hl_info->n_segments);
|
||||
|
@ -558,13 +558,13 @@ hl_compute_range (MooHighlighter *hl,
|
|||
|
||||
line->hl_info->start_node = node;
|
||||
line->hl_info->tags_applied = FALSE;
|
||||
moo_line_erase_segments (line);
|
||||
_moo_line_erase_segments (line);
|
||||
|
||||
/* TODO: there is no need to recompute line if its start context matches
|
||||
context implied by the previous line */
|
||||
moo_match_data_init (&match_data, line_no, &iter, NULL);
|
||||
_moo_match_data_init (&match_data, line_no, &iter, NULL);
|
||||
node = hl_compute_line (hl, line, &match_data, node);
|
||||
moo_match_data_destroy (&match_data);
|
||||
_moo_match_data_destroy (&match_data);
|
||||
|
||||
#if 0
|
||||
{
|
||||
|
@ -595,7 +595,7 @@ hl_compute_range (MooHighlighter *hl,
|
|||
|
||||
if (line_no == hl->line_buf->invalid.last)
|
||||
{
|
||||
Line *next = moo_line_buffer_get_line (hl->line_buf, line_no + 1);
|
||||
Line *next = _moo_line_buffer_get_line (hl->line_buf, line_no + 1);
|
||||
|
||||
if (node == next->hl_info->start_node)
|
||||
{
|
||||
|
@ -617,7 +617,7 @@ hl_compute_range (MooHighlighter *hl,
|
|||
hl->line_buf->invalid.first = line_no;
|
||||
if (line_no <= lines->last)
|
||||
hl->line_buf->invalid.first++;
|
||||
moo_line_buffer_clamp_invalid (hl->line_buf);
|
||||
_moo_line_buffer_clamp_invalid (hl->line_buf);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -650,7 +650,7 @@ moo_highlighter_compute_timed (MooHighlighter *hl,
|
|||
return TRUE;
|
||||
|
||||
if (last_line < 0)
|
||||
last_line = moo_text_btree_size (hl->line_buf->tree) - 1;
|
||||
last_line = _moo_text_btree_size (hl->line_buf->tree) - 1;
|
||||
|
||||
g_assert (first_line >= 0);
|
||||
g_assert (last_line >= first_line);
|
||||
|
@ -686,7 +686,7 @@ compute_in_idle (MooHighlighter *hl)
|
|||
|
||||
|
||||
void
|
||||
moo_highlighter_queue_compute (MooHighlighter *hl)
|
||||
_moo_highlighter_queue_compute (MooHighlighter *hl)
|
||||
{
|
||||
if (!hl->lang || !hl->buffer || BUF_CLEAN (hl->line_buf))
|
||||
return;
|
||||
|
@ -699,9 +699,9 @@ moo_highlighter_queue_compute (MooHighlighter *hl)
|
|||
|
||||
|
||||
void
|
||||
moo_highlighter_apply_tags (MooHighlighter *hl,
|
||||
int first_line,
|
||||
int last_line)
|
||||
_moo_highlighter_apply_tags (MooHighlighter *hl,
|
||||
int first_line,
|
||||
int last_line)
|
||||
{
|
||||
int line_no;
|
||||
int total;
|
||||
|
@ -710,7 +710,7 @@ moo_highlighter_apply_tags (MooHighlighter *hl,
|
|||
if (!hl->lang || !hl->buffer)
|
||||
return;
|
||||
|
||||
total = moo_text_btree_size (hl->line_buf->tree);
|
||||
total = _moo_text_btree_size (hl->line_buf->tree);
|
||||
|
||||
if (last_line < 0)
|
||||
last_line = total - 1;
|
||||
|
@ -723,14 +723,14 @@ moo_highlighter_apply_tags (MooHighlighter *hl,
|
|||
|
||||
if (!moo_highlighter_compute_timed (hl, first_line, last_line,
|
||||
COMPUTE_NOW_TIME))
|
||||
moo_highlighter_queue_compute (hl);
|
||||
_moo_highlighter_queue_compute (hl);
|
||||
|
||||
first_changed = last_changed = -1;
|
||||
hl->last_tag = NULL;
|
||||
|
||||
for (line_no = first_line; line_no <= last_line; ++line_no)
|
||||
{
|
||||
Line *line = moo_line_buffer_get_line (hl->line_buf, line_no);
|
||||
Line *line = _moo_line_buffer_get_line (hl->line_buf, line_no);
|
||||
HLInfo *info = line->hl_info;
|
||||
guint i;
|
||||
GtkTextIter t_start, t_end;
|
||||
|
@ -819,8 +819,8 @@ ctx_node_set_scheme (CtxNode *node,
|
|||
}
|
||||
|
||||
void
|
||||
moo_highlighter_apply_scheme (MooHighlighter *hl,
|
||||
MooTextStyleScheme *scheme)
|
||||
_moo_highlighter_apply_scheme (MooHighlighter *hl,
|
||||
MooTextStyleScheme *scheme)
|
||||
{
|
||||
g_return_if_fail (hl != NULL && scheme != NULL);
|
||||
g_slist_foreach (hl->nodes, (GFunc) ctx_node_set_scheme, scheme);
|
||||
|
|
|
@ -14,13 +14,17 @@
|
|||
#ifndef __MOO_HIGHLIGHTER_H__
|
||||
#define __MOO_HIGHLIGHTER_H__
|
||||
|
||||
#ifndef MOOEDIT_COMPILATION
|
||||
#error "This file may not be included"
|
||||
#endif
|
||||
|
||||
#include "mooedit/moolang.h"
|
||||
#include "mooedit/moolinebuffer.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
#define MOO_TYPE_SYNTAX_TAG (moo_syntax_tag_get_type ())
|
||||
#define MOO_TYPE_SYNTAX_TAG (_moo_syntax_tag_get_type ())
|
||||
#define MOO_SYNTAX_TAG(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), MOO_TYPE_SYNTAX_TAG, MooSyntaxTag))
|
||||
#define MOO_SYNTAX_TAG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOO_TYPE_SYNTAX_TAG, MooSyntaxTagClass))
|
||||
#define MOO_IS_SYNTAX_TAG(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), MOO_TYPE_SYNTAX_TAG))
|
||||
|
@ -70,21 +74,21 @@ struct _MooSyntaxTagClass {
|
|||
};
|
||||
|
||||
|
||||
GType moo_syntax_tag_get_type (void) G_GNUC_CONST;
|
||||
GType _moo_syntax_tag_get_type (void) G_GNUC_CONST;
|
||||
|
||||
|
||||
MooHighlighter *moo_highlighter_new (GtkTextBuffer *buffer,
|
||||
MooHighlighter *_moo_highlighter_new (GtkTextBuffer *buffer,
|
||||
LineBuffer *line_buf,
|
||||
MooLang *lang);
|
||||
void moo_highlighter_destroy (MooHighlighter *highlight,
|
||||
void _moo_highlighter_destroy (MooHighlighter *highlight,
|
||||
gboolean destroy_tags);
|
||||
|
||||
void moo_highlighter_queue_compute (MooHighlighter *highlight);
|
||||
void moo_highlighter_apply_tags (MooHighlighter *highlight,
|
||||
void _moo_highlighter_queue_compute (MooHighlighter *highlight);
|
||||
void _moo_highlighter_apply_tags (MooHighlighter *highlight,
|
||||
int first_line,
|
||||
int last_line);
|
||||
|
||||
void moo_highlighter_apply_scheme (MooHighlighter *highlight,
|
||||
void _moo_highlighter_apply_scheme (MooHighlighter *highlight,
|
||||
MooTextStyleScheme *scheme);
|
||||
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ static gboolean lang_xml_check_internal_refs (LangXML *xml);
|
|||
|
||||
|
||||
LangXML*
|
||||
moo_lang_parse_file (const char *file)
|
||||
_moo_lang_parse_file (const char *file)
|
||||
{
|
||||
#ifdef MOO_USE_XML
|
||||
xmlDoc *doc;
|
||||
|
@ -97,8 +97,8 @@ moo_lang_parse_file (const char *file)
|
|||
|
||||
|
||||
LangXML*
|
||||
moo_lang_parse_memory (const char *buffer,
|
||||
int size)
|
||||
_moo_lang_parse_memory (const char *buffer,
|
||||
int size)
|
||||
{
|
||||
#ifdef MOO_USE_XML
|
||||
xmlDoc *doc;
|
||||
|
@ -133,15 +133,15 @@ moo_lang_parse_memory (const char *buffer,
|
|||
|
||||
/* Stubs for functions used elsewhere */
|
||||
void
|
||||
moo_lang_xml_free (G_GNUC_UNUSED LangXML *xml)
|
||||
_moo_lang_xml_free (G_GNUC_UNUSED LangXML *xml)
|
||||
{
|
||||
g_return_if_reached ();
|
||||
}
|
||||
|
||||
MooRule*
|
||||
moo_rule_new_from_xml (G_GNUC_UNUSED RuleXML *xml,
|
||||
G_GNUC_UNUSED LangXML *lang_xml,
|
||||
G_GNUC_UNUSED MooLang *lang)
|
||||
_moo_rule_new_from_xml (G_GNUC_UNUSED RuleXML *xml,
|
||||
G_GNUC_UNUSED LangXML *lang_xml,
|
||||
G_GNUC_UNUSED MooLang *lang)
|
||||
{
|
||||
g_return_val_if_reached (NULL);
|
||||
}
|
||||
|
@ -549,13 +549,13 @@ error:
|
|||
STRING_FREE (extensions);
|
||||
STRING_FREE (author);
|
||||
STRING_FREE (hidden);
|
||||
moo_lang_xml_free (xml);
|
||||
_moo_lang_xml_free (xml);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
moo_lang_xml_free (LangXML *xml)
|
||||
_moo_lang_xml_free (LangXML *xml)
|
||||
{
|
||||
if (xml)
|
||||
{
|
||||
|
@ -1595,9 +1595,9 @@ rule_xml_get_style (gpointer xmlptr)
|
|||
|
||||
|
||||
MooRule*
|
||||
moo_rule_new_from_xml (RuleXML *xml,
|
||||
LangXML *lang_xml,
|
||||
MooLang *lang)
|
||||
_moo_rule_new_from_xml (RuleXML *xml,
|
||||
LangXML *lang_xml,
|
||||
MooLang *lang)
|
||||
{
|
||||
MooRule *rule = NULL;
|
||||
MooContext *switch_to;
|
||||
|
@ -1647,10 +1647,10 @@ moo_rule_new_from_xml (RuleXML *xml,
|
|||
switch (xml->end_switch_info.type)
|
||||
{
|
||||
case MOO_CONTEXT_STAY:
|
||||
moo_rule_set_end_stay (rule);
|
||||
_moo_rule_set_end_stay (rule);
|
||||
break;
|
||||
case MOO_CONTEXT_POP:
|
||||
moo_rule_set_end_pop (rule, xml->end_switch_info.num);
|
||||
_moo_rule_set_end_pop (rule, xml->end_switch_info.num);
|
||||
break;
|
||||
case MOO_CONTEXT_SWITCH:
|
||||
#if 0
|
||||
|
@ -1666,7 +1666,7 @@ moo_rule_new_from_xml (RuleXML *xml,
|
|||
if (!switch_to)
|
||||
{
|
||||
g_critical ("%s: oops", G_STRLOC);
|
||||
moo_rule_free (rule);
|
||||
_moo_rule_free (rule);
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
|
@ -1674,10 +1674,10 @@ moo_rule_new_from_xml (RuleXML *xml,
|
|||
#if 0
|
||||
if (xml->end_switch_info.type == MOO_CONTEXT_SWITCH)
|
||||
#endif
|
||||
moo_rule_set_end_switch (rule, switch_to);
|
||||
_moo_rule_set_end_switch (rule, switch_to);
|
||||
#if 0
|
||||
else
|
||||
moo_rule_set_end_jump (rule, switch_to);
|
||||
_moo_rule_set_end_jump (rule, switch_to);
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
|
@ -1689,15 +1689,15 @@ moo_rule_new_from_xml (RuleXML *xml,
|
|||
for (l = xml->child_rules; l != NULL; l = l->next)
|
||||
{
|
||||
RuleXML *child_xml = l->data;
|
||||
MooRule *child_rule = moo_rule_new_from_xml (child_xml, lang_xml, lang);
|
||||
MooRule *child_rule = _moo_rule_new_from_xml (child_xml, lang_xml, lang);
|
||||
|
||||
if (!child_rule)
|
||||
{
|
||||
moo_rule_free (rule);
|
||||
_moo_rule_free (rule);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
moo_rule_add_child_rule (rule, child_rule);
|
||||
_moo_rule_add_child_rule (rule, child_rule);
|
||||
}
|
||||
|
||||
return rule;
|
||||
|
@ -1784,9 +1784,9 @@ rule_string_xml_parse (xmlNode *node)
|
|||
static MooRule*
|
||||
rule_string_xml_create_rule (RuleStringXML *xml)
|
||||
{
|
||||
return moo_rule_string_new (xml->string,
|
||||
rule_xml_get_flags (xml),
|
||||
rule_xml_get_style (xml));
|
||||
return _moo_rule_string_new (xml->string,
|
||||
rule_xml_get_flags (xml),
|
||||
rule_xml_get_style (xml));
|
||||
}
|
||||
|
||||
|
||||
|
@ -1830,10 +1830,10 @@ rule_regex_xml_parse (xmlNode *node)
|
|||
static MooRule*
|
||||
rule_regex_xml_create_rule (RuleRegexXML *xml)
|
||||
{
|
||||
return moo_rule_regex_new (xml->pattern, xml->non_empty,
|
||||
0, 0,
|
||||
rule_xml_get_flags (xml),
|
||||
rule_xml_get_style (xml));
|
||||
return _moo_rule_regex_new (xml->pattern, xml->non_empty,
|
||||
0, 0,
|
||||
rule_xml_get_flags (xml),
|
||||
rule_xml_get_style (xml));
|
||||
}
|
||||
|
||||
|
||||
|
@ -1884,9 +1884,9 @@ error:
|
|||
static MooRule*
|
||||
rule_char_xml_create_rule (RuleCharXML *xml)
|
||||
{
|
||||
return moo_rule_char_new (xml->ch,
|
||||
rule_xml_get_flags (xml),
|
||||
rule_xml_get_style (xml));
|
||||
return _moo_rule_char_new (xml->ch,
|
||||
rule_xml_get_flags (xml),
|
||||
rule_xml_get_style (xml));
|
||||
}
|
||||
|
||||
|
||||
|
@ -1906,23 +1906,23 @@ rule_special_xml_create_rule (RuleXML *xml)
|
|||
switch (xml->type)
|
||||
{
|
||||
case RULE_INT:
|
||||
return moo_rule_int_new (flags, style);
|
||||
return _moo_rule_int_new (flags, style);
|
||||
case RULE_WHITESPACE:
|
||||
return moo_rule_whitespace_new (flags, style);
|
||||
return _moo_rule_whitespace_new (flags, style);
|
||||
case RULE_IDENTIFIER:
|
||||
return moo_rule_identifier_new (flags, style);
|
||||
return _moo_rule_identifier_new (flags, style);
|
||||
case RULE_FLOAT:
|
||||
return moo_rule_float_new (flags, style);
|
||||
return _moo_rule_float_new (flags, style);
|
||||
case RULE_HEX:
|
||||
return moo_rule_hex_new (flags, style);
|
||||
return _moo_rule_hex_new (flags, style);
|
||||
case RULE_OCTAL:
|
||||
return moo_rule_octal_new (flags, style);
|
||||
return _moo_rule_octal_new (flags, style);
|
||||
case RULE_ESCAPED_CHAR:
|
||||
return moo_rule_escaped_char_new (flags, style);
|
||||
return _moo_rule_escaped_char_new (flags, style);
|
||||
case RULE_C_CHAR:
|
||||
return moo_rule_c_char_new (flags, style);
|
||||
return _moo_rule_c_char_new (flags, style);
|
||||
case RULE_LINE_CONTINUE:
|
||||
return moo_rule_line_continue_new (flags, style);
|
||||
return _moo_rule_line_continue_new (flags, style);
|
||||
default:
|
||||
g_return_val_if_reached (NULL);
|
||||
}
|
||||
|
@ -1986,9 +1986,9 @@ error:
|
|||
static MooRule*
|
||||
rule_2char_xml_create_rule (Rule2CharXML *xml)
|
||||
{
|
||||
return moo_rule_2char_new (xml->chars[0], xml->chars[1],
|
||||
rule_xml_get_flags (xml),
|
||||
rule_xml_get_style (xml));
|
||||
return _moo_rule_2char_new (xml->chars[0], xml->chars[1],
|
||||
rule_xml_get_flags (xml),
|
||||
rule_xml_get_style (xml));
|
||||
}
|
||||
|
||||
|
||||
|
@ -2020,9 +2020,9 @@ rule_any_char_xml_parse (xmlNode *node)
|
|||
static MooRule*
|
||||
rule_any_char_xml_create_rule (RuleAnyCharXML *xml)
|
||||
{
|
||||
return moo_rule_any_char_new (xml->range,
|
||||
rule_xml_get_flags (xml),
|
||||
rule_xml_get_style (xml));
|
||||
return _moo_rule_any_char_new (xml->range,
|
||||
rule_xml_get_flags (xml),
|
||||
rule_xml_get_style (xml));
|
||||
}
|
||||
|
||||
|
||||
|
@ -2071,10 +2071,10 @@ rule_keywords_xml_create_rule (RuleKeywordsXML *xml,
|
|||
kw_xml = g_hash_table_lookup (lang_xml->keyword_names, xml->keywords);
|
||||
g_return_val_if_fail (kw_xml != NULL, NULL);
|
||||
|
||||
return moo_rule_keywords_new (kw_xml->words,
|
||||
rule_xml_get_flags (xml),
|
||||
kw_xml->prefix, kw_xml->suffix,
|
||||
rule_xml_get_style (xml));
|
||||
return _moo_rule_keywords_new (kw_xml->words,
|
||||
rule_xml_get_flags (xml),
|
||||
kw_xml->prefix, kw_xml->suffix,
|
||||
rule_xml_get_style (xml));
|
||||
}
|
||||
|
||||
|
||||
|
@ -2142,7 +2142,7 @@ rule_include_xml_create_rule (RuleIncludeXML *xml,
|
|||
|
||||
g_return_val_if_fail (ctx != NULL, NULL);
|
||||
|
||||
return moo_rule_include_new (ctx);
|
||||
return _moo_rule_include_new (ctx);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2420,8 +2420,8 @@ error:
|
|||
|
||||
|
||||
MooTextStyleScheme*
|
||||
moo_text_style_scheme_parse_file (const char *file,
|
||||
char **base_scheme)
|
||||
_moo_text_style_scheme_parse_file (const char *file,
|
||||
char **base_scheme)
|
||||
{
|
||||
MooMarkupDoc *doc;
|
||||
MooMarkupNode *root;
|
||||
|
@ -2452,9 +2452,9 @@ moo_text_style_scheme_parse_file (const char *file,
|
|||
|
||||
|
||||
MooTextStyleScheme*
|
||||
moo_text_style_scheme_parse_memory (const char *buffer,
|
||||
int size,
|
||||
char **base_scheme)
|
||||
_moo_text_style_scheme_parse_memory (const char *buffer,
|
||||
int size,
|
||||
char **base_scheme)
|
||||
{
|
||||
MooMarkupDoc *doc;
|
||||
MooMarkupNode *root;
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4; coding: utf-8 -*-
|
||||
*
|
||||
/*
|
||||
* moolang-parser.h
|
||||
*
|
||||
* Copyright (C) 2004-2006 by Yevgen Muntyan <muntyan@math.tamu.edu>
|
||||
|
@ -12,13 +11,13 @@
|
|||
* See COPYING file that comes with this distribution.
|
||||
*/
|
||||
|
||||
#ifndef __MOO_LANG_PARSER_H__
|
||||
#define __MOO_LANG_PARSER_H__
|
||||
|
||||
#ifndef MOOEDIT_COMPILATION
|
||||
#error "This file may not be included"
|
||||
#endif
|
||||
|
||||
#ifndef __MOO_LANG_PARSER_H__
|
||||
#define __MOO_LANG_PARSER_H__
|
||||
|
||||
#include "mooedit/moolang-rules.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
@ -204,18 +203,18 @@ struct _RuleIncludeXML {
|
|||
};
|
||||
|
||||
|
||||
LangXML *moo_lang_parse_file (const char *file);
|
||||
LangXML *moo_lang_parse_memory (const char *buffer,
|
||||
LangXML *_moo_lang_parse_file (const char *file);
|
||||
LangXML *_moo_lang_parse_memory (const char *buffer,
|
||||
int size);
|
||||
void moo_lang_xml_free (LangXML *xml);
|
||||
void _moo_lang_xml_free (LangXML *xml);
|
||||
|
||||
MooTextStyleScheme *moo_text_style_scheme_parse_file (const char *file,
|
||||
MooTextStyleScheme *_moo_text_style_scheme_parse_file (const char *file,
|
||||
char **base_scheme);
|
||||
MooTextStyleScheme *moo_text_style_scheme_parse_memory (const char *buffer,
|
||||
MooTextStyleScheme *_moo_text_style_scheme_parse_memory(const char *buffer,
|
||||
int size,
|
||||
char **base_scheme);
|
||||
|
||||
MooRule *moo_rule_new_from_xml (RuleXML *xml,
|
||||
MooRule *_moo_rule_new_from_xml (RuleXML *xml,
|
||||
LangXML *lang_xml,
|
||||
MooLang *lang);
|
||||
|
||||
|
|
|
@ -126,10 +126,10 @@ static MooRule *rules_match_real (MooRuleArray *array,
|
|||
|
||||
|
||||
void
|
||||
moo_match_data_init (MatchData *data,
|
||||
int line_number,
|
||||
const GtkTextIter *line_start,
|
||||
const GtkTextIter *line_end)
|
||||
_moo_match_data_init (MatchData *data,
|
||||
int line_number,
|
||||
const GtkTextIter *line_start,
|
||||
const GtkTextIter *line_end)
|
||||
{
|
||||
GtkTextBuffer *buffer;
|
||||
|
||||
|
@ -163,10 +163,10 @@ moo_match_data_init (MatchData *data,
|
|||
|
||||
|
||||
void
|
||||
moo_match_data_set_start (MatchData *data,
|
||||
const GtkTextIter *start_iter,
|
||||
char *start,
|
||||
int start_offset)
|
||||
_moo_match_data_set_start (MatchData *data,
|
||||
const GtkTextIter *start_iter,
|
||||
char *start,
|
||||
int start_offset)
|
||||
{
|
||||
g_assert (data != NULL);
|
||||
g_assert (start != NULL);
|
||||
|
@ -188,7 +188,7 @@ moo_match_data_set_start (MatchData *data,
|
|||
|
||||
|
||||
void
|
||||
moo_match_data_destroy (MatchData *data)
|
||||
_moo_match_data_destroy (MatchData *data)
|
||||
{
|
||||
if (data->line_string)
|
||||
g_free (data->line_string);
|
||||
|
@ -374,9 +374,9 @@ child_rules_match (MooRuleArray *array,
|
|||
|
||||
|
||||
MooRule*
|
||||
moo_rule_array_match (MooRuleArray *array,
|
||||
MatchData *data,
|
||||
MatchResult *result)
|
||||
_moo_rule_array_match (MooRuleArray *array,
|
||||
MatchData *data,
|
||||
MatchResult *result)
|
||||
{
|
||||
return rules_match_real (array, data, result, 0);
|
||||
}
|
||||
|
@ -403,7 +403,7 @@ rule_new (MooRuleFlags flags,
|
|||
|
||||
|
||||
void
|
||||
moo_rule_free (MooRule *rule)
|
||||
_moo_rule_free (MooRule *rule)
|
||||
{
|
||||
guint i;
|
||||
|
||||
|
@ -416,7 +416,7 @@ moo_rule_free (MooRule *rule)
|
|||
if (rule->child_rules)
|
||||
{
|
||||
for (i = 0; i < rule->child_rules->len; ++i)
|
||||
moo_rule_free (rule->child_rules->data[i]);
|
||||
_moo_rule_free (rule->child_rules->data[i]);
|
||||
g_ptr_array_free ((GPtrArray*) rule->child_rules, TRUE);
|
||||
}
|
||||
|
||||
|
@ -427,8 +427,8 @@ moo_rule_free (MooRule *rule)
|
|||
|
||||
|
||||
void
|
||||
moo_rule_add_child_rule (MooRule *rule,
|
||||
MooRule *child_rule)
|
||||
_moo_rule_add_child_rule (MooRule *rule,
|
||||
MooRule *child_rule)
|
||||
{
|
||||
g_return_if_fail (rule != NULL && child_rule != NULL);
|
||||
|
||||
|
@ -440,7 +440,7 @@ moo_rule_add_child_rule (MooRule *rule,
|
|||
|
||||
|
||||
void
|
||||
moo_rule_set_end_stay (MooRule *rule)
|
||||
_moo_rule_set_end_stay (MooRule *rule)
|
||||
{
|
||||
g_return_if_fail (rule != NULL);
|
||||
rule->exit.type = MOO_CONTEXT_STAY;
|
||||
|
@ -449,8 +449,8 @@ moo_rule_set_end_stay (MooRule *rule)
|
|||
|
||||
|
||||
void
|
||||
moo_rule_set_end_pop (MooRule *rule,
|
||||
guint num)
|
||||
_moo_rule_set_end_pop (MooRule *rule,
|
||||
guint num)
|
||||
{
|
||||
g_return_if_fail (rule != NULL && num != 0);
|
||||
rule->exit.type = MOO_CONTEXT_POP;
|
||||
|
@ -459,8 +459,8 @@ moo_rule_set_end_pop (MooRule *rule,
|
|||
|
||||
|
||||
void
|
||||
moo_rule_set_end_switch (MooRule *rule,
|
||||
MooContext *target)
|
||||
_moo_rule_set_end_switch (MooRule *rule,
|
||||
MooContext *target)
|
||||
{
|
||||
g_return_if_fail (rule != NULL && target != 0);
|
||||
rule->exit.type = MOO_CONTEXT_SWITCH;
|
||||
|
@ -525,9 +525,9 @@ rule_string_destroy (MooRule *rule)
|
|||
|
||||
|
||||
MooRule*
|
||||
moo_rule_string_new (const char *string,
|
||||
MooRuleFlags flags,
|
||||
const char *style)
|
||||
_moo_rule_string_new (const char *string,
|
||||
MooRuleFlags flags,
|
||||
const char *style)
|
||||
{
|
||||
MooRule *rule;
|
||||
guint length;
|
||||
|
@ -611,12 +611,12 @@ rule_regex_destroy (MooRule *rule)
|
|||
|
||||
|
||||
MooRule*
|
||||
moo_rule_regex_new (const char *pattern,
|
||||
gboolean non_empty,
|
||||
EggRegexCompileFlags regex_compile_options,
|
||||
EggRegexMatchFlags regex_match_options,
|
||||
MooRuleFlags flags,
|
||||
const char *style)
|
||||
_moo_rule_regex_new (const char *pattern,
|
||||
gboolean non_empty,
|
||||
EggRegexCompileFlags regex_compile_options,
|
||||
EggRegexMatchFlags regex_match_options,
|
||||
MooRuleFlags flags,
|
||||
const char *style)
|
||||
{
|
||||
MooRule *rule;
|
||||
EggRegex *regex;
|
||||
|
@ -741,9 +741,9 @@ rule_2char_match (MooRule *rule,
|
|||
|
||||
|
||||
MooRule*
|
||||
moo_rule_char_new (char ch,
|
||||
MooRuleFlags flags,
|
||||
const char *style)
|
||||
_moo_rule_char_new (char ch,
|
||||
MooRuleFlags flags,
|
||||
const char *style)
|
||||
{
|
||||
MooRule *rule;
|
||||
|
||||
|
@ -769,10 +769,10 @@ moo_rule_char_new (char ch,
|
|||
|
||||
|
||||
MooRule*
|
||||
moo_rule_2char_new (char ch1,
|
||||
char ch2,
|
||||
MooRuleFlags flags,
|
||||
const char *style)
|
||||
_moo_rule_2char_new (char ch1,
|
||||
char ch2,
|
||||
MooRuleFlags flags,
|
||||
const char *style)
|
||||
{
|
||||
MooRule *rule;
|
||||
|
||||
|
@ -869,9 +869,9 @@ rule_any_char_destroy (MooRule *rule)
|
|||
|
||||
|
||||
MooRule*
|
||||
moo_rule_any_char_new (const char *string,
|
||||
MooRuleFlags flags,
|
||||
const char *style)
|
||||
_moo_rule_any_char_new (const char *string,
|
||||
MooRuleFlags flags,
|
||||
const char *style)
|
||||
{
|
||||
MooRule *rule;
|
||||
guint i, len;
|
||||
|
@ -900,11 +900,11 @@ moo_rule_any_char_new (const char *string,
|
|||
*/
|
||||
|
||||
MooRule*
|
||||
moo_rule_keywords_new (GSList *words,
|
||||
MooRuleFlags flags,
|
||||
const char *prefix,
|
||||
const char *suffix,
|
||||
const char *style)
|
||||
_moo_rule_keywords_new (GSList *words,
|
||||
MooRuleFlags flags,
|
||||
const char *prefix,
|
||||
const char *suffix,
|
||||
const char *style)
|
||||
{
|
||||
GSList *l;
|
||||
GString *pattern;
|
||||
|
@ -935,7 +935,7 @@ moo_rule_keywords_new (GSList *words,
|
|||
g_string_append_printf (pattern, ")%s",
|
||||
suffix ? suffix : "");
|
||||
|
||||
rule = moo_rule_regex_new (pattern->str, TRUE, 0, 0, flags, style);
|
||||
rule = _moo_rule_regex_new (pattern->str, TRUE, 0, 0, flags, style);
|
||||
|
||||
out:
|
||||
g_string_free (pattern, TRUE);
|
||||
|
@ -958,7 +958,7 @@ rule_include_match (MooRule *rule,
|
|||
|
||||
|
||||
MooRule*
|
||||
moo_rule_include_new (MooContext *ctx)
|
||||
_moo_rule_include_new (MooContext *ctx)
|
||||
{
|
||||
MooRule *rule;
|
||||
|
||||
|
@ -1014,8 +1014,8 @@ rule_int_match (MooRule *rule,
|
|||
|
||||
|
||||
MooRule*
|
||||
moo_rule_int_new (MooRuleFlags flags,
|
||||
const char *style)
|
||||
_moo_rule_int_new (MooRuleFlags flags,
|
||||
const char *style)
|
||||
{
|
||||
MooRule *rule = rule_new (flags, style, rule_int_match, NULL);
|
||||
g_return_val_if_fail (rule != NULL, NULL);
|
||||
|
@ -1103,8 +1103,8 @@ rule_float_match (MooRule *rule,
|
|||
|
||||
|
||||
MooRule*
|
||||
moo_rule_float_new (MooRuleFlags flags,
|
||||
const char *style)
|
||||
_moo_rule_float_new (MooRuleFlags flags,
|
||||
const char *style)
|
||||
{
|
||||
MooRule *rule = rule_new (flags, style, rule_float_match, NULL);
|
||||
g_return_val_if_fail (rule != NULL, NULL);
|
||||
|
@ -1156,8 +1156,8 @@ rule_octal_match (MooRule *rule,
|
|||
|
||||
|
||||
MooRule*
|
||||
moo_rule_octal_new (MooRuleFlags flags,
|
||||
const char *style)
|
||||
_moo_rule_octal_new (MooRuleFlags flags,
|
||||
const char *style)
|
||||
{
|
||||
MooRule *rule = rule_new (flags, style, rule_octal_match, NULL);
|
||||
g_return_val_if_fail (rule != NULL, NULL);
|
||||
|
@ -1209,8 +1209,8 @@ rule_hex_match (MooRule *rule,
|
|||
|
||||
|
||||
MooRule*
|
||||
moo_rule_hex_new (MooRuleFlags flags,
|
||||
const char *style)
|
||||
_moo_rule_hex_new (MooRuleFlags flags,
|
||||
const char *style)
|
||||
{
|
||||
MooRule *rule = rule_new (flags, style, rule_hex_match, NULL);
|
||||
g_return_val_if_fail (rule != NULL, NULL);
|
||||
|
@ -1290,8 +1290,8 @@ rule_escaped_char_match (MooRule *rule,
|
|||
|
||||
|
||||
MooRule*
|
||||
moo_rule_escaped_char_new (MooRuleFlags flags,
|
||||
const char *style)
|
||||
_moo_rule_escaped_char_new (MooRuleFlags flags,
|
||||
const char *style)
|
||||
{
|
||||
MooRule *rule = rule_new (flags, style, rule_escaped_char_match, NULL);
|
||||
g_return_val_if_fail (rule != NULL, NULL);
|
||||
|
@ -1402,8 +1402,8 @@ rule_c_char_match (MooRule *rule,
|
|||
|
||||
|
||||
MooRule*
|
||||
moo_rule_c_char_new (MooRuleFlags flags,
|
||||
const char *style)
|
||||
_moo_rule_c_char_new (MooRuleFlags flags,
|
||||
const char *style)
|
||||
{
|
||||
MooRule *rule = rule_new (flags, style, rule_c_char_match, NULL);
|
||||
g_return_val_if_fail (rule != NULL, NULL);
|
||||
|
@ -1435,8 +1435,8 @@ rule_whitespace_match (MooRule *rule,
|
|||
|
||||
|
||||
MooRule*
|
||||
moo_rule_whitespace_new (MooRuleFlags flags,
|
||||
const char *style)
|
||||
_moo_rule_whitespace_new (MooRuleFlags flags,
|
||||
const char *style)
|
||||
{
|
||||
MooRule *rule = rule_new (flags, style, rule_whitespace_match, NULL);
|
||||
g_return_val_if_fail (rule != NULL, NULL);
|
||||
|
@ -1480,8 +1480,8 @@ rule_identifier_match (MooRule *rule,
|
|||
|
||||
|
||||
MooRule*
|
||||
moo_rule_identifier_new (MooRuleFlags flags,
|
||||
const char *style)
|
||||
_moo_rule_identifier_new (MooRuleFlags flags,
|
||||
const char *style)
|
||||
{
|
||||
MooRule *rule = rule_new (flags, style, rule_identifier_match, NULL);
|
||||
g_return_val_if_fail (rule != NULL, NULL);
|
||||
|
@ -1523,8 +1523,8 @@ rule_line_continue_match (MooRule *rule,
|
|||
|
||||
|
||||
MooRule*
|
||||
moo_rule_line_continue_new (MooRuleFlags flags,
|
||||
const char *style)
|
||||
_moo_rule_line_continue_new (MooRuleFlags flags,
|
||||
const char *style)
|
||||
{
|
||||
MooRule *rule = rule_new (flags, style, rule_line_continue_match, NULL);
|
||||
g_return_val_if_fail (rule != NULL, NULL);
|
||||
|
|
|
@ -11,13 +11,13 @@
|
|||
* See COPYING file that comes with this distribution.
|
||||
*/
|
||||
|
||||
#ifndef __MOO_LANG_RULES_H__
|
||||
#define __MOO_LANG_RULES_H__
|
||||
|
||||
#ifndef MOOEDIT_COMPILATION
|
||||
#error "This file may not be included"
|
||||
#endif
|
||||
|
||||
#ifndef __MOO_LANG_RULES_H__
|
||||
#define __MOO_LANG_RULES_H__
|
||||
|
||||
#include "mooedit/moolang.h"
|
||||
#include "mooutils/eggregex.h"
|
||||
#include <gtk/gtk.h>
|
||||
|
@ -52,82 +52,82 @@ struct _MooRuleMatchResult {
|
|||
typedef MooRuleMatchData MatchData;
|
||||
typedef MooRuleMatchResult MatchResult;
|
||||
|
||||
MooRule *moo_rule_string_new (const char *string,
|
||||
MooRule *_moo_rule_string_new (const char *string,
|
||||
MooRuleFlags flags,
|
||||
const char *style);
|
||||
MooRule *moo_rule_regex_new (const char *pattern,
|
||||
MooRule *_moo_rule_regex_new (const char *pattern,
|
||||
gboolean non_empty,
|
||||
EggRegexCompileFlags regex_compile_options,
|
||||
EggRegexMatchFlags regex_match_options,
|
||||
MooRuleFlags flags,
|
||||
const char *style);
|
||||
MooRule *moo_rule_char_new (char ch,
|
||||
MooRule *_moo_rule_char_new (char ch,
|
||||
MooRuleFlags flags,
|
||||
const char *style);
|
||||
MooRule *moo_rule_2char_new (char ch1,
|
||||
MooRule *_moo_rule_2char_new (char ch1,
|
||||
char ch2,
|
||||
MooRuleFlags flags,
|
||||
const char *style);
|
||||
MooRule *moo_rule_any_char_new (const char *string,
|
||||
MooRule *_moo_rule_any_char_new (const char *string,
|
||||
MooRuleFlags flags,
|
||||
const char *style);
|
||||
MooRule *moo_rule_keywords_new (GSList *words,
|
||||
MooRule *_moo_rule_keywords_new (GSList *words,
|
||||
MooRuleFlags flags,
|
||||
const char *prefix,
|
||||
const char *suffix,
|
||||
const char *style);
|
||||
MooRule *moo_rule_zero_new (MooRuleFlags flags);
|
||||
MooRule *moo_rule_include_new (MooContext *context);
|
||||
MooRule *_moo_rule_zero_new (MooRuleFlags flags);
|
||||
MooRule *_moo_rule_include_new (MooContext *context);
|
||||
|
||||
MooRule *moo_rule_int_new (MooRuleFlags flags,
|
||||
MooRule *_moo_rule_int_new (MooRuleFlags flags,
|
||||
const char *style);
|
||||
MooRule *moo_rule_float_new (MooRuleFlags flags,
|
||||
MooRule *_moo_rule_float_new (MooRuleFlags flags,
|
||||
const char *style);
|
||||
MooRule *moo_rule_octal_new (MooRuleFlags flags,
|
||||
MooRule *_moo_rule_octal_new (MooRuleFlags flags,
|
||||
const char *style);
|
||||
MooRule *moo_rule_hex_new (MooRuleFlags flags,
|
||||
MooRule *_moo_rule_hex_new (MooRuleFlags flags,
|
||||
const char *style);
|
||||
MooRule *moo_rule_escaped_char_new (MooRuleFlags flags,
|
||||
MooRule *_moo_rule_escaped_char_new (MooRuleFlags flags,
|
||||
const char *style);
|
||||
MooRule *moo_rule_c_char_new (MooRuleFlags flags,
|
||||
MooRule *_moo_rule_c_char_new (MooRuleFlags flags,
|
||||
const char *style);
|
||||
MooRule *moo_rule_whitespace_new (MooRuleFlags flags,
|
||||
MooRule *_moo_rule_whitespace_new (MooRuleFlags flags,
|
||||
const char *style);
|
||||
MooRule *moo_rule_identifier_new (MooRuleFlags flags,
|
||||
MooRule *_moo_rule_identifier_new (MooRuleFlags flags,
|
||||
const char *style);
|
||||
MooRule *moo_rule_line_continue_new (MooRuleFlags flags,
|
||||
MooRule *_moo_rule_line_continue_new (MooRuleFlags flags,
|
||||
const char *style);
|
||||
|
||||
void moo_rule_add_child_rule (MooRule *rule,
|
||||
void _moo_rule_add_child_rule (MooRule *rule,
|
||||
MooRule *child_rule);
|
||||
void moo_rule_set_end_stay (MooRule *rule);
|
||||
void moo_rule_set_end_pop (MooRule *rule,
|
||||
void _moo_rule_set_end_stay (MooRule *rule);
|
||||
void _moo_rule_set_end_pop (MooRule *rule,
|
||||
guint num);
|
||||
void moo_rule_set_end_switch (MooRule *rule,
|
||||
void _moo_rule_set_end_switch (MooRule *rule,
|
||||
MooContext *target);
|
||||
#if 0
|
||||
void moo_rule_set_end_jump (MooRule *rule,
|
||||
void _moo_rule_set_end_jump (MooRule *rule,
|
||||
MooContext *target);
|
||||
#endif
|
||||
|
||||
|
||||
void moo_rule_free (MooRule *rule);
|
||||
void _moo_rule_free (MooRule *rule);
|
||||
|
||||
|
||||
MooRule *moo_rule_array_match (MooRuleArray *array,
|
||||
MooRule *_moo_rule_array_match (MooRuleArray *array,
|
||||
MatchData *data,
|
||||
MatchResult *result);
|
||||
|
||||
void moo_match_data_init (MatchData *data,
|
||||
void _moo_match_data_init (MatchData *data,
|
||||
int line_number,
|
||||
const GtkTextIter *line_start,
|
||||
const GtkTextIter *line_end); /* line_end may be NULL */
|
||||
void moo_match_data_set_start (MatchData *data,
|
||||
void _moo_match_data_set_start (MatchData *data,
|
||||
const GtkTextIter *start_iter,
|
||||
char *start,
|
||||
int start_offset); /* chars offset */
|
||||
gboolean moo_match_data_line_start (MatchData *data);
|
||||
void moo_match_data_destroy (MatchData *data);
|
||||
gboolean _moo_match_data_line_start (MatchData *data);
|
||||
void _moo_match_data_destroy (MatchData *data);
|
||||
|
||||
|
||||
#endif /* __MOO_LANG_RULES_H__ */
|
||||
|
|
|
@ -67,7 +67,7 @@ moo_context_free (MooContext *ctx)
|
|||
g_free (ctx->style);
|
||||
|
||||
for (i = 0; i < ctx->rules->len; ++i)
|
||||
moo_rule_free (ctx->rules->data[i]);
|
||||
_moo_rule_free (ctx->rules->data[i]);
|
||||
g_ptr_array_free ((GPtrArray*) ctx->rules, TRUE);
|
||||
|
||||
g_free (ctx);
|
||||
|
|
|
@ -411,7 +411,7 @@ read_files (MooLangMgr *mgr,
|
|||
LangXML *lang, *old_lang;
|
||||
|
||||
filename = g_build_filename (dirname, entry, NULL);
|
||||
lang = moo_lang_parse_file (filename);
|
||||
lang = _moo_lang_parse_file (filename);
|
||||
g_free (filename);
|
||||
|
||||
if (!lang)
|
||||
|
@ -424,7 +424,7 @@ read_files (MooLangMgr *mgr,
|
|||
g_message ("%s: loading another instance of lang '%s'",
|
||||
G_STRLOC, lang->name);
|
||||
lang_xml_list = g_slist_remove (lang_xml_list, old_lang);
|
||||
moo_lang_xml_free (old_lang);
|
||||
_moo_lang_xml_free (old_lang);
|
||||
}
|
||||
|
||||
lang_xml_list = g_slist_append (lang_xml_list, lang);
|
||||
|
@ -437,7 +437,7 @@ read_files (MooLangMgr *mgr,
|
|||
MooTextStyleScheme *scheme;
|
||||
|
||||
filename = g_build_filename (dirname, entry, NULL);
|
||||
scheme = moo_text_style_scheme_parse_file (filename, NULL); /* XXX */
|
||||
scheme = _moo_text_style_scheme_parse_file (filename, NULL); /* XXX */
|
||||
g_free (filename);
|
||||
|
||||
if (!scheme)
|
||||
|
@ -497,7 +497,7 @@ check_external_refs (GSList *lang_xml_list,
|
|||
G_STRLOC, ref->lang, xml->name);
|
||||
g_hash_table_remove (lang_xml_names, xml->name);
|
||||
lang_xml_list = g_slist_remove (lang_xml_list, xml);
|
||||
moo_lang_xml_free (xml);
|
||||
_moo_lang_xml_free (xml);
|
||||
valid = FALSE;
|
||||
break;
|
||||
}
|
||||
|
@ -508,7 +508,7 @@ check_external_refs (GSList *lang_xml_list,
|
|||
G_STRLOC, ref->lang, ref->name, xml->name);
|
||||
g_hash_table_remove (lang_xml_names, xml->name);
|
||||
lang_xml_list = g_slist_remove (lang_xml_list, xml);
|
||||
moo_lang_xml_free (xml);
|
||||
_moo_lang_xml_free (xml);
|
||||
valid = FALSE;
|
||||
break;
|
||||
}
|
||||
|
@ -661,7 +661,7 @@ moo_lang_finish_build (MooLang *lang,
|
|||
for (rule_link = ctx_xml->rules; rule_link != NULL; rule_link = rule_link->next)
|
||||
{
|
||||
RuleXML *rule_xml = rule_link->data;
|
||||
MooRule *rule = moo_rule_new_from_xml (rule_xml, xml, lang);
|
||||
MooRule *rule = _moo_rule_new_from_xml (rule_xml, xml, lang);
|
||||
if (rule)
|
||||
moo_context_add_rule (ctx, rule);
|
||||
}
|
||||
|
@ -749,7 +749,7 @@ moo_lang_mgr_read_dirs (MooLangMgr *mgr)
|
|||
|
||||
out:
|
||||
g_hash_table_destroy (lang_xml_names);
|
||||
g_slist_foreach (lang_xml_list, (GFunc) moo_lang_xml_free, NULL);
|
||||
g_slist_foreach (lang_xml_list, (GFunc) _moo_lang_xml_free, NULL);
|
||||
g_slist_free (lang_xml_list);
|
||||
|
||||
moo_lang_mgr_load_styles (mgr);
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4; coding: utf-8 -*-
|
||||
*
|
||||
/*
|
||||
* moolinebuffer.c
|
||||
*
|
||||
* Copyright (C) 2004-2006 by Yevgen Muntyan <muntyan@math.tamu.edu>
|
||||
|
@ -27,65 +26,65 @@ static void invalidate_line (LineBuffer *line_buf,
|
|||
|
||||
|
||||
LineBuffer*
|
||||
moo_line_buffer_new (void)
|
||||
_moo_line_buffer_new (void)
|
||||
{
|
||||
LineBuffer *buf = g_new0 (LineBuffer, 1);
|
||||
buf->tree = moo_text_btree_new ();
|
||||
buf->tree = _moo_text_btree_new ();
|
||||
BUF_SET_CLEAN (buf);
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
||||
Line*
|
||||
moo_line_buffer_insert (LineBuffer *line_buf,
|
||||
int index)
|
||||
_moo_line_buffer_insert (LineBuffer *line_buf,
|
||||
int index)
|
||||
{
|
||||
Line *line = moo_text_btree_insert (line_buf->tree, index, NULL);
|
||||
Line *line = _moo_text_btree_insert (line_buf->tree, index, NULL);
|
||||
invalidate_line (line_buf, line, index);
|
||||
return line;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
moo_line_buffer_clamp_invalid (LineBuffer *line_buf)
|
||||
_moo_line_buffer_clamp_invalid (LineBuffer *line_buf)
|
||||
{
|
||||
if (!BUF_CLEAN (line_buf))
|
||||
{
|
||||
int size = moo_text_btree_size (line_buf->tree);
|
||||
int size = _moo_text_btree_size (line_buf->tree);
|
||||
AREA_CLAMP (&line_buf->invalid, size);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
moo_line_buffer_split_line (LineBuffer *line_buf,
|
||||
int line,
|
||||
int num_new_lines,
|
||||
GtkTextTag *tag)
|
||||
_moo_line_buffer_split_line (LineBuffer *line_buf,
|
||||
int line,
|
||||
int num_new_lines,
|
||||
GtkTextTag *tag)
|
||||
{
|
||||
Line *l;
|
||||
GSList *tags;
|
||||
|
||||
moo_text_btree_insert_range (line_buf->tree, line + 1, num_new_lines, tag);
|
||||
_moo_text_btree_insert_range (line_buf->tree, line + 1, num_new_lines, tag);
|
||||
|
||||
l = moo_line_buffer_get_line (line_buf, line);
|
||||
l = _moo_line_buffer_get_line (line_buf, line);
|
||||
invalidate_line (line_buf, l, line);
|
||||
tags = g_slist_copy (l->hl_info->tags);
|
||||
g_slist_foreach (tags, (GFunc) g_object_ref, NULL);
|
||||
|
||||
l = moo_line_buffer_get_line (line_buf, line + num_new_lines);
|
||||
l = _moo_line_buffer_get_line (line_buf, line + num_new_lines);
|
||||
invalidate_line (line_buf, l, line + num_new_lines);
|
||||
l->hl_info->tags = g_slist_concat (l->hl_info->tags, tags);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
moo_line_buffer_delete (LineBuffer *line_buf,
|
||||
int first,
|
||||
int num,
|
||||
int move_to,
|
||||
GSList **moved_marks,
|
||||
GSList **deleted_marks)
|
||||
_moo_line_buffer_delete (LineBuffer *line_buf,
|
||||
int first,
|
||||
int num,
|
||||
int move_to,
|
||||
GSList **moved_marks,
|
||||
GSList **deleted_marks)
|
||||
{
|
||||
Line *line;
|
||||
GSList *old_tags = NULL;
|
||||
|
@ -94,7 +93,7 @@ moo_line_buffer_delete (LineBuffer *line_buf,
|
|||
|
||||
if (move_to >= 0)
|
||||
{
|
||||
line = moo_line_buffer_get_line (line_buf, first + num - 1);
|
||||
line = _moo_line_buffer_get_line (line_buf, first + num - 1);
|
||||
old_tags = line->hl_info->tags;
|
||||
line->hl_info->tags = NULL;
|
||||
|
||||
|
@ -103,16 +102,16 @@ moo_line_buffer_delete (LineBuffer *line_buf,
|
|||
line->marks = NULL;
|
||||
|
||||
if (n_old_marks)
|
||||
moo_text_btree_update_n_marks (line_buf->tree, line, -n_old_marks);
|
||||
_moo_text_btree_update_n_marks (line_buf->tree, line, -n_old_marks);
|
||||
|
||||
g_assert (line->n_marks == 0);
|
||||
}
|
||||
|
||||
moo_text_btree_delete_range (line_buf->tree, first, num, deleted_marks);
|
||||
_moo_text_btree_delete_range (line_buf->tree, first, num, deleted_marks);
|
||||
|
||||
if (move_to >= 0)
|
||||
{
|
||||
line = moo_line_buffer_get_line (line_buf, move_to);
|
||||
line = _moo_line_buffer_get_line (line_buf, move_to);
|
||||
|
||||
line->hl_info->tags = g_slist_concat (line->hl_info->tags, old_tags);
|
||||
|
||||
|
@ -137,27 +136,27 @@ moo_line_buffer_delete (LineBuffer *line_buf,
|
|||
|
||||
g_free (old_marks);
|
||||
|
||||
moo_text_btree_update_n_marks (line_buf->tree, line, n_old_marks);
|
||||
_moo_text_btree_update_n_marks (line_buf->tree, line, n_old_marks);
|
||||
}
|
||||
}
|
||||
|
||||
moo_line_buffer_invalidate (line_buf, move_to >= 0 ? move_to : first);
|
||||
_moo_line_buffer_invalidate (line_buf, move_to >= 0 ? move_to : first);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
invalidate_line_one (Line *line)
|
||||
{
|
||||
moo_line_erase_segments (line);
|
||||
_moo_line_erase_segments (line);
|
||||
line->hl_info->start_node = NULL;
|
||||
line->hl_info->tags_applied = FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
moo_line_buffer_invalidate (LineBuffer *line_buf,
|
||||
int index)
|
||||
_moo_line_buffer_invalidate (LineBuffer *line_buf,
|
||||
int index)
|
||||
{
|
||||
invalidate_line (line_buf, moo_text_btree_get_data (line_buf->tree, index), index);
|
||||
invalidate_line (line_buf, _moo_text_btree_get_data (line_buf->tree, index), index);
|
||||
}
|
||||
|
||||
|
||||
|
@ -178,21 +177,21 @@ invalidate_line (LineBuffer *line_buf,
|
|||
{
|
||||
line_buf->invalid.first = MIN (line_buf->invalid.first, index);
|
||||
line_buf->invalid.last = MAX (line_buf->invalid.last, index);
|
||||
moo_line_buffer_clamp_invalid (line_buf);
|
||||
_moo_line_buffer_clamp_invalid (line_buf);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
moo_line_buffer_invalidate_all (LineBuffer *line_buf)
|
||||
_moo_line_buffer_invalidate_all (LineBuffer *line_buf)
|
||||
{
|
||||
moo_line_buffer_invalidate (line_buf, 0);
|
||||
AREA_SET (&line_buf->invalid, moo_text_btree_size (line_buf->tree));
|
||||
_moo_line_buffer_invalidate (line_buf, 0);
|
||||
AREA_SET (&line_buf->invalid, _moo_text_btree_size (line_buf->tree));
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
moo_line_erase_segments (Line *line)
|
||||
_moo_line_erase_segments (Line *line)
|
||||
{
|
||||
g_assert (line != NULL);
|
||||
line->hl_info->n_segments = 0;
|
||||
|
@ -200,11 +199,11 @@ moo_line_erase_segments (Line *line)
|
|||
|
||||
|
||||
void
|
||||
moo_line_add_segment (Line *line,
|
||||
int len,
|
||||
CtxNode *ctx_node,
|
||||
CtxNode *match_node,
|
||||
MooRule *rule)
|
||||
_moo_line_add_segment (Line *line,
|
||||
int len,
|
||||
CtxNode *ctx_node,
|
||||
CtxNode *match_node,
|
||||
MooRule *rule)
|
||||
{
|
||||
HLInfo *info = line->hl_info;
|
||||
|
||||
|
@ -224,19 +223,19 @@ moo_line_add_segment (Line *line,
|
|||
|
||||
|
||||
Line*
|
||||
moo_line_buffer_get_line (LineBuffer *line_buf,
|
||||
int index)
|
||||
_moo_line_buffer_get_line (LineBuffer *line_buf,
|
||||
int index)
|
||||
{
|
||||
return moo_text_btree_get_data (line_buf->tree, index);
|
||||
return _moo_text_btree_get_data (line_buf->tree, index);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
moo_line_buffer_free (LineBuffer *line_buf)
|
||||
_moo_line_buffer_free (LineBuffer *line_buf)
|
||||
{
|
||||
if (line_buf)
|
||||
{
|
||||
moo_text_btree_free (line_buf->tree);
|
||||
_moo_text_btree_free (line_buf->tree);
|
||||
g_free (line_buf);
|
||||
}
|
||||
}
|
||||
|
@ -261,21 +260,21 @@ line_add_mark (LineBuffer *line_buf,
|
|||
}
|
||||
|
||||
line->marks[line->n_marks] = mark;
|
||||
moo_text_btree_update_n_marks (line_buf->tree, line, 1);
|
||||
_moo_text_btree_update_n_marks (line_buf->tree, line, 1);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
moo_line_buffer_add_mark (LineBuffer *line_buf,
|
||||
MooLineMark *mark,
|
||||
int index)
|
||||
_moo_line_buffer_add_mark (LineBuffer *line_buf,
|
||||
MooLineMark *mark,
|
||||
int index)
|
||||
{
|
||||
Line *line;
|
||||
|
||||
g_return_if_fail (index < (int) moo_text_btree_size (line_buf->tree));
|
||||
g_return_if_fail (index < (int) _moo_text_btree_size (line_buf->tree));
|
||||
g_assert (_moo_line_mark_get_line (mark) == NULL);
|
||||
|
||||
line = moo_line_buffer_get_line (line_buf, index);
|
||||
line = _moo_line_buffer_get_line (line_buf, index);
|
||||
line_add_mark (line_buf, mark, line);
|
||||
_moo_line_mark_set_line (mark, line, index, line_buf->tree->stamp);
|
||||
}
|
||||
|
@ -312,13 +311,13 @@ line_remove_mark (LineBuffer *line_buf,
|
|||
line->marks[line->n_marks - 1] = NULL;
|
||||
}
|
||||
|
||||
moo_text_btree_update_n_marks (line_buf->tree, line, -1);
|
||||
_moo_text_btree_update_n_marks (line_buf->tree, line, -1);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
moo_line_buffer_remove_mark (LineBuffer *line_buf,
|
||||
MooLineMark *mark)
|
||||
_moo_line_buffer_remove_mark (LineBuffer *line_buf,
|
||||
MooLineMark *mark)
|
||||
{
|
||||
Line *line;
|
||||
G_GNUC_UNUSED int index;
|
||||
|
@ -326,7 +325,7 @@ moo_line_buffer_remove_mark (LineBuffer *line_buf,
|
|||
line = _moo_line_mark_get_line (mark);
|
||||
|
||||
g_assert (line != NULL);
|
||||
g_assert (line == moo_line_buffer_get_line (line_buf, moo_line_mark_get_line (mark)));
|
||||
g_assert (line == _moo_line_buffer_get_line (line_buf, moo_line_mark_get_line (mark)));
|
||||
|
||||
_moo_line_mark_set_line (mark, NULL, -1, 0);
|
||||
line_remove_mark (line_buf, mark, line);
|
||||
|
@ -335,13 +334,13 @@ moo_line_buffer_remove_mark (LineBuffer *line_buf,
|
|||
|
||||
/* XXX */
|
||||
void
|
||||
moo_line_buffer_move_mark (LineBuffer *line_buf,
|
||||
MooLineMark *mark,
|
||||
int line)
|
||||
_moo_line_buffer_move_mark (LineBuffer *line_buf,
|
||||
MooLineMark *mark,
|
||||
int line)
|
||||
{
|
||||
g_return_if_fail (line < (int) moo_text_btree_size (line_buf->tree));
|
||||
moo_line_buffer_remove_mark (line_buf, mark);
|
||||
moo_line_buffer_add_mark (line_buf, mark, line);
|
||||
g_return_if_fail (line < (int) _moo_text_btree_size (line_buf->tree));
|
||||
_moo_line_buffer_remove_mark (line_buf, mark);
|
||||
_moo_line_buffer_add_mark (line_buf, mark, line);
|
||||
}
|
||||
|
||||
|
||||
|
@ -407,11 +406,11 @@ node_get_marks (BTree *tree,
|
|||
|
||||
|
||||
GSList *
|
||||
moo_line_buffer_get_marks_in_range (LineBuffer *line_buf,
|
||||
int first_line,
|
||||
int last_line)
|
||||
_moo_line_buffer_get_marks_in_range (LineBuffer *line_buf,
|
||||
int first_line,
|
||||
int last_line)
|
||||
{
|
||||
int size = moo_text_btree_size (line_buf->tree);
|
||||
int size = _moo_text_btree_size (line_buf->tree);
|
||||
|
||||
g_assert (first_line >= 0);
|
||||
g_return_val_if_fail (first_line < size, NULL);
|
||||
|
@ -428,7 +427,7 @@ moo_line_buffer_get_marks_in_range (LineBuffer *line_buf,
|
|||
|
||||
|
||||
guint
|
||||
moo_line_buffer_get_stamp (LineBuffer *line_buf)
|
||||
_moo_line_buffer_get_stamp (LineBuffer *line_buf)
|
||||
{
|
||||
return line_buf->tree->stamp;
|
||||
}
|
||||
|
@ -470,29 +469,29 @@ line_get_index (BTData *line)
|
|||
|
||||
|
||||
int
|
||||
moo_line_buffer_get_line_index (G_GNUC_UNUSED LineBuffer *line_buf,
|
||||
Line *line)
|
||||
_moo_line_buffer_get_line_index (G_GNUC_UNUSED LineBuffer *line_buf,
|
||||
Line *line)
|
||||
{
|
||||
guint index;
|
||||
index = line_get_index (line);
|
||||
g_assert (line == moo_line_buffer_get_line (line_buf, index));
|
||||
g_assert (line == _moo_line_buffer_get_line (line_buf, index));
|
||||
return index;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
moo_line_buffer_cleanup (LineBuffer *line_buf)
|
||||
_moo_line_buffer_cleanup (LineBuffer *line_buf)
|
||||
{
|
||||
guint i, size;
|
||||
|
||||
g_return_if_fail (line_buf != NULL);
|
||||
|
||||
size = moo_text_btree_size (line_buf->tree);
|
||||
size = _moo_text_btree_size (line_buf->tree);
|
||||
|
||||
for (i = 0; i < size; ++i)
|
||||
{
|
||||
Line *line = moo_line_buffer_get_line (line_buf, i);
|
||||
moo_line_erase_segments (line);
|
||||
Line *line = _moo_line_buffer_get_line (line_buf, i);
|
||||
_moo_line_erase_segments (line);
|
||||
g_slist_free (line->hl_info->tags);
|
||||
line->hl_info->tags = NULL;
|
||||
line->hl_info->tags_applied = FALSE;
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4; coding: utf-8 -*-
|
||||
*
|
||||
/*
|
||||
* moolinebuffer.h
|
||||
*
|
||||
* Copyright (C) 2004-2006 by Yevgen Muntyan <muntyan@math.tamu.edu>
|
||||
|
@ -12,13 +11,13 @@
|
|||
* See COPYING file that comes with this distribution.
|
||||
*/
|
||||
|
||||
#ifndef __MOO_LINE_BUFFER_H__
|
||||
#define __MOO_LINE_BUFFER_H__
|
||||
|
||||
#ifndef MOOEDIT_COMPILATION
|
||||
#error "This file may not be included"
|
||||
#endif
|
||||
|
||||
#ifndef __MOO_LINE_BUFFER_H__
|
||||
#define __MOO_LINE_BUFFER_H__
|
||||
|
||||
#include <gtk/gtktextbuffer.h>
|
||||
#include "mooedit/mootextbtree.h"
|
||||
#include "mooedit/mootextbuffer.h"
|
||||
|
@ -64,50 +63,50 @@ struct _HLInfo {
|
|||
};
|
||||
|
||||
|
||||
LineBuffer *moo_line_buffer_new (void);
|
||||
void moo_line_buffer_free (LineBuffer *line_buf);
|
||||
LineBuffer *_moo_line_buffer_new (void);
|
||||
void _moo_line_buffer_free (LineBuffer *line_buf);
|
||||
|
||||
void moo_line_buffer_cleanup (LineBuffer *line_buf);
|
||||
void _moo_line_buffer_cleanup (LineBuffer *line_buf);
|
||||
|
||||
Line *moo_line_buffer_get_line (LineBuffer *line_buf,
|
||||
Line *_moo_line_buffer_get_line (LineBuffer *line_buf,
|
||||
int index);
|
||||
|
||||
Line *moo_line_buffer_insert (LineBuffer *line_buf,
|
||||
Line *_moo_line_buffer_insert (LineBuffer *line_buf,
|
||||
int index);
|
||||
void moo_line_buffer_invalidate (LineBuffer *line_buf,
|
||||
void _moo_line_buffer_invalidate (LineBuffer *line_buf,
|
||||
int line);
|
||||
void moo_line_buffer_invalidate_all (LineBuffer *line_buf);
|
||||
void moo_line_buffer_clamp_invalid (LineBuffer *line_buf);
|
||||
void _moo_line_buffer_invalidate_all (LineBuffer *line_buf);
|
||||
void _moo_line_buffer_clamp_invalid (LineBuffer *line_buf);
|
||||
|
||||
guint moo_line_buffer_get_stamp (LineBuffer *line_buf);
|
||||
int moo_line_buffer_get_line_index (LineBuffer *line_buf,
|
||||
guint _moo_line_buffer_get_stamp (LineBuffer *line_buf);
|
||||
int _moo_line_buffer_get_line_index (LineBuffer *line_buf,
|
||||
Line *line);
|
||||
|
||||
void moo_line_buffer_add_mark (LineBuffer *line_buf,
|
||||
void _moo_line_buffer_add_mark (LineBuffer *line_buf,
|
||||
MooLineMark *mark,
|
||||
int line);
|
||||
void moo_line_buffer_remove_mark (LineBuffer *line_buf,
|
||||
void _moo_line_buffer_remove_mark (LineBuffer *line_buf,
|
||||
MooLineMark *mark);
|
||||
void moo_line_buffer_move_mark (LineBuffer *line_buf,
|
||||
void _moo_line_buffer_move_mark (LineBuffer *line_buf,
|
||||
MooLineMark *mark,
|
||||
int line);
|
||||
GSList *moo_line_buffer_get_marks_in_range (LineBuffer *line_buf,
|
||||
GSList *_moo_line_buffer_get_marks_in_range (LineBuffer *line_buf,
|
||||
int first_line,
|
||||
int last_line);
|
||||
|
||||
void moo_line_buffer_split_line (LineBuffer *line_buf,
|
||||
void _moo_line_buffer_split_line (LineBuffer *line_buf,
|
||||
int line,
|
||||
int num_new_lines,
|
||||
GtkTextTag *tag);
|
||||
void moo_line_buffer_delete (LineBuffer *line_buf,
|
||||
void _moo_line_buffer_delete (LineBuffer *line_buf,
|
||||
int first,
|
||||
int num,
|
||||
int move_to,
|
||||
GSList **moved_marks,
|
||||
GSList **deleted_marks);
|
||||
|
||||
void moo_line_erase_segments (Line *line);
|
||||
void moo_line_add_segment (Line *line,
|
||||
void _moo_line_erase_segments (Line *line);
|
||||
void _moo_line_add_segment (Line *line,
|
||||
int len,
|
||||
CtxNode *ctx_node,
|
||||
CtxNode *match_node,
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4; coding: utf-8 -*-
|
||||
*
|
||||
/*
|
||||
* moolinemark.c
|
||||
*
|
||||
* Copyright (C) 2004-2006 by Yevgen Muntyan <muntyan@math.tamu.edu>
|
||||
|
@ -394,11 +393,11 @@ moo_line_mark_get_line (MooLineMark *mark)
|
|||
g_return_val_if_fail (MOO_IS_LINE_MARK (mark), -1);
|
||||
g_return_val_if_fail (mark->priv->line != NULL, -1);
|
||||
|
||||
if (moo_line_buffer_get_stamp (mark->priv->line_buf) != mark->priv->stamp)
|
||||
if (_moo_line_buffer_get_stamp (mark->priv->line_buf) != mark->priv->stamp)
|
||||
{
|
||||
mark->priv->line_no =
|
||||
moo_line_buffer_get_line_index (mark->priv->line_buf, mark->priv->line);
|
||||
mark->priv->stamp = moo_line_buffer_get_stamp (mark->priv->line_buf);
|
||||
_moo_line_buffer_get_line_index (mark->priv->line_buf, mark->priv->line);
|
||||
mark->priv->stamp = _moo_line_buffer_get_stamp (mark->priv->line_buf);
|
||||
}
|
||||
|
||||
return mark->priv->line_no;
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4; coding: utf-8 -*-
|
||||
*
|
||||
/*
|
||||
* moolinemark.h
|
||||
*
|
||||
* Copyright (C) 2004-2006 by Yevgen Muntyan <muntyan@math.tamu.edu>
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4; coding: utf-8 -*-
|
||||
*
|
||||
/*
|
||||
* mootextbtree.c
|
||||
*
|
||||
* Copyright (C) 2004-2006 by Yevgen Muntyan <muntyan@math.tamu.edu>
|
||||
|
@ -76,7 +75,7 @@ hl_info_new__ (void)
|
|||
|
||||
|
||||
BTree*
|
||||
moo_text_btree_new (void)
|
||||
_moo_text_btree_new (void)
|
||||
{
|
||||
BTree *tree = g_new0 (BTree, 1);
|
||||
|
||||
|
@ -93,7 +92,7 @@ moo_text_btree_new (void)
|
|||
|
||||
|
||||
guint
|
||||
moo_text_btree_size (BTree *tree)
|
||||
_moo_text_btree_size (BTree *tree)
|
||||
{
|
||||
g_return_val_if_fail (tree != 0, 0);
|
||||
return tree->root->count;
|
||||
|
@ -101,7 +100,7 @@ moo_text_btree_size (BTree *tree)
|
|||
|
||||
|
||||
void
|
||||
moo_text_btree_free (BTree *tree)
|
||||
_moo_text_btree_free (BTree *tree)
|
||||
{
|
||||
if (tree)
|
||||
{
|
||||
|
@ -112,8 +111,8 @@ moo_text_btree_free (BTree *tree)
|
|||
|
||||
|
||||
BTData*
|
||||
moo_text_btree_get_data (BTree *tree,
|
||||
guint index_)
|
||||
_moo_text_btree_get_data (BTree *tree,
|
||||
guint index_)
|
||||
{
|
||||
BTNode *node;
|
||||
|
||||
|
@ -300,9 +299,9 @@ node_remove__ (BTNode *node, gpointer data)
|
|||
|
||||
|
||||
BTData*
|
||||
moo_text_btree_insert (BTree *tree,
|
||||
guint index_,
|
||||
gpointer tag)
|
||||
_moo_text_btree_insert (BTree *tree,
|
||||
guint index_,
|
||||
gpointer tag)
|
||||
{
|
||||
BTNode *node, *tmp;
|
||||
BTData *data;
|
||||
|
@ -384,7 +383,7 @@ moo_text_btree_insert (BTree *tree,
|
|||
}
|
||||
|
||||
CHECK_INTEGRITY (tree, TRUE);
|
||||
g_assert (data == moo_text_btree_get_data (tree, index_orig));
|
||||
g_assert (data == _moo_text_btree_get_data (tree, index_orig));
|
||||
|
||||
return data;
|
||||
}
|
||||
|
@ -419,9 +418,9 @@ merge_nodes (BTNode *parent, guint first)
|
|||
|
||||
|
||||
void
|
||||
moo_text_btree_delete (BTree *tree,
|
||||
guint index_,
|
||||
GSList **deleted_marks)
|
||||
_moo_text_btree_delete (BTree *tree,
|
||||
guint index_,
|
||||
GSList **deleted_marks)
|
||||
{
|
||||
BTNode *node, *tmp;
|
||||
BTData *data;
|
||||
|
@ -432,7 +431,7 @@ moo_text_btree_delete (BTree *tree,
|
|||
|
||||
tree->stamp++;
|
||||
|
||||
data = moo_text_btree_get_data (tree, index_);
|
||||
data = _moo_text_btree_get_data (tree, index_);
|
||||
g_assert (data != NULL);
|
||||
|
||||
node = data->parent;
|
||||
|
@ -549,10 +548,10 @@ moo_text_btree_delete (BTree *tree,
|
|||
|
||||
/* XXX */
|
||||
void
|
||||
moo_text_btree_insert_range (BTree *tree,
|
||||
int first,
|
||||
int num,
|
||||
gpointer tag)
|
||||
_moo_text_btree_insert_range (BTree *tree,
|
||||
int first,
|
||||
int num,
|
||||
gpointer tag)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -561,16 +560,16 @@ moo_text_btree_insert_range (BTree *tree,
|
|||
g_assert (num > 0);
|
||||
|
||||
for (i = 0; i < num; ++i)
|
||||
moo_text_btree_insert (tree, first, tag);
|
||||
_moo_text_btree_insert (tree, first, tag);
|
||||
}
|
||||
|
||||
|
||||
/* XXX */
|
||||
void
|
||||
moo_text_btree_delete_range (BTree *tree,
|
||||
int first,
|
||||
int num,
|
||||
GSList **deleted_marks)
|
||||
_moo_text_btree_delete_range (BTree *tree,
|
||||
int first,
|
||||
int num,
|
||||
GSList **deleted_marks)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -579,14 +578,14 @@ moo_text_btree_delete_range (BTree *tree,
|
|||
g_assert (num > 0 && first + num <= (int) tree->root->count);
|
||||
|
||||
for (i = 0; i < num; ++i)
|
||||
moo_text_btree_delete (tree, first, deleted_marks);
|
||||
_moo_text_btree_delete (tree, first, deleted_marks);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
moo_text_btree_update_n_marks (G_GNUC_UNUSED BTree *tree,
|
||||
BTData *data,
|
||||
int add)
|
||||
_moo_text_btree_update_n_marks (G_GNUC_UNUSED BTree *tree,
|
||||
BTData *data,
|
||||
int add)
|
||||
{
|
||||
BTNode *node;
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4; coding: utf-8 -*-
|
||||
*
|
||||
/*
|
||||
* mootextbtree.h
|
||||
*
|
||||
* Copyright (C) 2004-2006 by Yevgen Muntyan <muntyan@math.tamu.edu>
|
||||
|
@ -68,31 +67,31 @@ struct _BTree {
|
|||
};
|
||||
|
||||
|
||||
BTree *moo_text_btree_new (void);
|
||||
void moo_text_btree_free (BTree *tree);
|
||||
BTree *_moo_text_btree_new (void);
|
||||
void _moo_text_btree_free (BTree *tree);
|
||||
|
||||
guint moo_text_btree_size (BTree *tree);
|
||||
guint _moo_text_btree_size (BTree *tree);
|
||||
|
||||
BTData *moo_text_btree_get_data (BTree *tree,
|
||||
BTData *_moo_text_btree_get_data (BTree *tree,
|
||||
guint index_);
|
||||
|
||||
BTData *moo_text_btree_insert (BTree *tree,
|
||||
BTData *_moo_text_btree_insert (BTree *tree,
|
||||
guint index_,
|
||||
gpointer tag);
|
||||
void moo_text_btree_delete (BTree *tree,
|
||||
void _moo_text_btree_delete (BTree *tree,
|
||||
guint index_,
|
||||
GSList **removed_marks);
|
||||
|
||||
void moo_text_btree_insert_range (BTree *tree,
|
||||
void _moo_text_btree_insert_range (BTree *tree,
|
||||
int first,
|
||||
int num,
|
||||
gpointer tag);
|
||||
void moo_text_btree_delete_range (BTree *tree,
|
||||
void _moo_text_btree_delete_range (BTree *tree,
|
||||
int first,
|
||||
int num,
|
||||
GSList **removed_marks);
|
||||
|
||||
void moo_text_btree_update_n_marks (BTree *tree,
|
||||
void _moo_text_btree_update_n_marks (BTree *tree,
|
||||
BTData *data,
|
||||
int add);
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4; coding: utf-8 -*-
|
||||
*
|
||||
/*
|
||||
* mootextbuffer.c
|
||||
*
|
||||
* Copyright (C) 2004-2006 by Yevgen Muntyan <muntyan@math.tamu.edu>
|
||||
|
@ -325,10 +324,10 @@ static void
|
|||
moo_text_buffer_init (MooTextBuffer *buffer)
|
||||
{
|
||||
buffer->priv = g_new0 (MooTextBufferPrivate, 1);
|
||||
buffer->priv->line_buf = moo_line_buffer_new ();
|
||||
buffer->priv->line_buf = _moo_line_buffer_new ();
|
||||
buffer->priv->do_highlight = TRUE;
|
||||
buffer->priv->hl = moo_highlighter_new (GTK_TEXT_BUFFER (buffer),
|
||||
buffer->priv->line_buf, NULL);
|
||||
buffer->priv->hl = _moo_highlighter_new (GTK_TEXT_BUFFER (buffer),
|
||||
buffer->priv->line_buf, NULL);
|
||||
buffer->priv->bracket_found = MOO_BRACKET_MATCH_NONE;
|
||||
|
||||
buffer->priv->fold_tree = moo_fold_tree_new (buffer);
|
||||
|
@ -363,8 +362,8 @@ moo_text_buffer_finalize (GObject *object)
|
|||
|
||||
/* XXX leak if folds are not deleted */
|
||||
moo_fold_tree_free (buffer->priv->fold_tree);
|
||||
moo_highlighter_destroy (buffer->priv->hl, FALSE);
|
||||
moo_line_buffer_free (buffer->priv->line_buf);
|
||||
_moo_highlighter_destroy (buffer->priv->hl, FALSE);
|
||||
_moo_line_buffer_free (buffer->priv->line_buf);
|
||||
|
||||
g_free (buffer->priv->left_brackets);
|
||||
g_free (buffer->priv->right_brackets);
|
||||
|
@ -529,11 +528,11 @@ moo_text_buffer_insert_text (GtkTextBuffer *text_buffer,
|
|||
last_line = gtk_text_iter_get_line (pos);
|
||||
|
||||
if (last_line == first_line)
|
||||
moo_line_buffer_invalidate (buffer->priv->line_buf, first_line);
|
||||
_moo_line_buffer_invalidate (buffer->priv->line_buf, first_line);
|
||||
else
|
||||
moo_line_buffer_split_line (buffer->priv->line_buf,
|
||||
first_line, last_line - first_line,
|
||||
tag);
|
||||
_moo_line_buffer_split_line (buffer->priv->line_buf,
|
||||
first_line, last_line - first_line,
|
||||
tag);
|
||||
|
||||
/* XXX btree can do it better ? i guess it can't */
|
||||
if (starts_line && ins_line)
|
||||
|
@ -646,21 +645,21 @@ moo_text_buffer_delete_range (GtkTextBuffer *text_buffer,
|
|||
if (first_line < last_line)
|
||||
{
|
||||
if (starts_line)
|
||||
moo_line_buffer_delete (buffer->priv->line_buf,
|
||||
first_line,
|
||||
last_line - first_line,
|
||||
-1, &moved_marks, &deleted_marks);
|
||||
_moo_line_buffer_delete (buffer->priv->line_buf,
|
||||
first_line,
|
||||
last_line - first_line,
|
||||
-1, &moved_marks, &deleted_marks);
|
||||
else
|
||||
moo_line_buffer_delete (buffer->priv->line_buf,
|
||||
first_line + 1,
|
||||
last_line - first_line,
|
||||
first_line,
|
||||
&moved_marks, &deleted_marks);
|
||||
_moo_line_buffer_delete (buffer->priv->line_buf,
|
||||
first_line + 1,
|
||||
last_line - first_line,
|
||||
first_line,
|
||||
&moved_marks, &deleted_marks);
|
||||
}
|
||||
else
|
||||
{
|
||||
moo_line_buffer_invalidate (buffer->priv->line_buf,
|
||||
first_line);
|
||||
_moo_line_buffer_invalidate (buffer->priv->line_buf,
|
||||
first_line);
|
||||
}
|
||||
|
||||
/* It would be better if marks were moved/deleted before deleting text, but it
|
||||
|
@ -741,10 +740,10 @@ moo_text_buffer_set_lang (MooTextBuffer *buffer,
|
|||
if (old_lang)
|
||||
moo_lang_unref (old_lang);
|
||||
|
||||
moo_highlighter_destroy (buffer->priv->hl,
|
||||
buffer->priv->do_highlight && old_lang);
|
||||
_moo_highlighter_destroy (buffer->priv->hl,
|
||||
buffer->priv->do_highlight && old_lang);
|
||||
|
||||
moo_line_buffer_cleanup (buffer->priv->line_buf);
|
||||
_moo_line_buffer_cleanup (buffer->priv->line_buf);
|
||||
buffer->priv->lang = lang;
|
||||
|
||||
if (lang)
|
||||
|
@ -752,18 +751,18 @@ moo_text_buffer_set_lang (MooTextBuffer *buffer,
|
|||
|
||||
if (lang && buffer->priv->do_highlight)
|
||||
{
|
||||
buffer->priv->hl = moo_highlighter_new (GTK_TEXT_BUFFER (buffer),
|
||||
buffer->priv->line_buf, lang);
|
||||
buffer->priv->hl = _moo_highlighter_new (GTK_TEXT_BUFFER (buffer),
|
||||
buffer->priv->line_buf, lang);
|
||||
|
||||
if (old_lang)
|
||||
moo_line_buffer_invalidate_all (buffer->priv->line_buf);
|
||||
_moo_line_buffer_invalidate_all (buffer->priv->line_buf);
|
||||
|
||||
moo_text_buffer_queue_highlight (buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer->priv->hl = moo_highlighter_new (GTK_TEXT_BUFFER (buffer),
|
||||
buffer->priv->line_buf, NULL);
|
||||
buffer->priv->hl = _moo_highlighter_new (GTK_TEXT_BUFFER (buffer),
|
||||
buffer->priv->line_buf, NULL);
|
||||
}
|
||||
|
||||
moo_text_buffer_set_brackets (buffer, lang ? lang->brackets : NULL);
|
||||
|
@ -782,7 +781,7 @@ static void
|
|||
moo_text_buffer_queue_highlight (MooTextBuffer *buffer)
|
||||
{
|
||||
if (buffer->priv->lang && buffer->priv->do_highlight)
|
||||
moo_highlighter_queue_compute (buffer->priv->hl);
|
||||
_moo_highlighter_queue_compute (buffer->priv->hl);
|
||||
}
|
||||
|
||||
|
||||
|
@ -799,27 +798,27 @@ moo_text_buffer_set_highlight (MooTextBuffer *buffer,
|
|||
|
||||
if (buffer->priv->do_highlight && buffer->priv->lang)
|
||||
{
|
||||
moo_highlighter_destroy (buffer->priv->hl, TRUE);
|
||||
moo_line_buffer_cleanup (buffer->priv->line_buf);
|
||||
_moo_highlighter_destroy (buffer->priv->hl, TRUE);
|
||||
_moo_line_buffer_cleanup (buffer->priv->line_buf);
|
||||
}
|
||||
else
|
||||
{
|
||||
moo_highlighter_destroy (buffer->priv->hl, FALSE);
|
||||
_moo_highlighter_destroy (buffer->priv->hl, FALSE);
|
||||
}
|
||||
|
||||
buffer->priv->do_highlight = highlight;
|
||||
|
||||
if (!highlight || !buffer->priv->lang)
|
||||
{
|
||||
buffer->priv->hl = moo_highlighter_new (GTK_TEXT_BUFFER (buffer),
|
||||
buffer->priv->line_buf, NULL);
|
||||
buffer->priv->hl = _moo_highlighter_new (GTK_TEXT_BUFFER (buffer),
|
||||
buffer->priv->line_buf, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer->priv->hl = moo_highlighter_new (GTK_TEXT_BUFFER (buffer),
|
||||
buffer->priv->line_buf,
|
||||
buffer->priv->lang);
|
||||
moo_line_buffer_invalidate_all (buffer->priv->line_buf);
|
||||
buffer->priv->hl = _moo_highlighter_new (GTK_TEXT_BUFFER (buffer),
|
||||
buffer->priv->line_buf,
|
||||
buffer->priv->lang);
|
||||
_moo_line_buffer_invalidate_all (buffer->priv->line_buf);
|
||||
moo_text_buffer_queue_highlight (buffer);
|
||||
}
|
||||
}
|
||||
|
@ -935,8 +934,8 @@ _moo_text_buffer_ensure_highlight (MooTextBuffer *buffer,
|
|||
int last_line)
|
||||
{
|
||||
g_return_if_fail (MOO_IS_TEXT_BUFFER (buffer));
|
||||
moo_highlighter_apply_tags (buffer->priv->hl,
|
||||
first_line, last_line);
|
||||
_moo_highlighter_apply_tags (buffer->priv->hl,
|
||||
first_line, last_line);
|
||||
}
|
||||
|
||||
|
||||
|
@ -996,7 +995,7 @@ moo_text_buffer_apply_scheme (MooTextBuffer *buffer,
|
|||
|
||||
moo_text_buffer_set_bracket_match_style (buffer, scheme->bracket_match);
|
||||
moo_text_buffer_set_bracket_mismatch_style (buffer, scheme->bracket_mismatch);
|
||||
moo_highlighter_apply_scheme (buffer->priv->hl, scheme);
|
||||
_moo_highlighter_apply_scheme (buffer->priv->hl, scheme);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1950,11 +1949,11 @@ moo_text_buffer_add_line_mark (MooTextBuffer *buffer,
|
|||
line_no = 0;
|
||||
|
||||
/* XXX ??? */
|
||||
line = moo_line_buffer_get_line (buffer->priv->line_buf, line_no);
|
||||
line = _moo_line_buffer_get_line (buffer->priv->line_buf, line_no);
|
||||
g_return_if_fail (line != NULL);
|
||||
|
||||
_moo_line_mark_set_buffer (mark, buffer, buffer->priv->line_buf);
|
||||
moo_line_buffer_add_mark (buffer->priv->line_buf, mark, line_no);
|
||||
_moo_line_buffer_add_mark (buffer->priv->line_buf, mark, line_no);
|
||||
|
||||
g_signal_emit (buffer, signals[LINE_MARK_ADDED], 0, mark);
|
||||
g_object_thaw_notify (G_OBJECT (mark));
|
||||
|
@ -1972,7 +1971,7 @@ moo_text_buffer_delete_line_mark (MooTextBuffer *buffer,
|
|||
g_return_if_fail (moo_line_mark_get_buffer (mark) == buffer);
|
||||
|
||||
line = moo_line_mark_get_line (mark);
|
||||
moo_line_buffer_remove_mark (buffer->priv->line_buf, mark);
|
||||
_moo_line_buffer_remove_mark (buffer->priv->line_buf, mark);
|
||||
|
||||
line_mark_deleted (buffer, mark);
|
||||
g_object_unref (mark);
|
||||
|
@ -2013,7 +2012,7 @@ moo_text_buffer_move_line_mark (MooTextBuffer *buffer,
|
|||
if (old_line == line)
|
||||
return;
|
||||
|
||||
moo_line_buffer_move_mark (buffer->priv->line_buf, mark, line);
|
||||
_moo_line_buffer_move_mark (buffer->priv->line_buf, mark, line);
|
||||
line_mark_moved (buffer, mark);
|
||||
}
|
||||
|
||||
|
@ -2025,7 +2024,7 @@ moo_text_buffer_get_line_marks_in_range (MooTextBuffer *buffer,
|
|||
{
|
||||
g_return_val_if_fail (MOO_IS_TEXT_BUFFER (buffer), NULL);
|
||||
g_return_val_if_fail (first_line >= 0, NULL);
|
||||
return moo_line_buffer_get_marks_in_range (buffer->priv->line_buf, first_line, last_line);
|
||||
return _moo_line_buffer_get_marks_in_range (buffer->priv->line_buf, first_line, last_line);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2035,7 +2034,7 @@ moo_text_buffer_get_line_marks_at_line (MooTextBuffer *buffer,
|
|||
{
|
||||
g_return_val_if_fail (MOO_IS_TEXT_BUFFER (buffer), NULL);
|
||||
g_return_val_if_fail (line >= 0, NULL);
|
||||
return moo_line_buffer_get_marks_in_range (buffer->priv->line_buf, line, line);
|
||||
return _moo_line_buffer_get_marks_in_range (buffer->priv->line_buf, line, line);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -309,13 +309,13 @@ moo_text_search_forward (const GtkTextIter *start,
|
|||
}
|
||||
|
||||
if (!(flags & MOO_TEXT_SEARCH_WHOLE_WORDS))
|
||||
return gtk_source_iter_forward_search (start, str, gs_flags,
|
||||
match_start, match_end, end);
|
||||
return _gtk_source_iter_forward_search (start, str, gs_flags,
|
||||
match_start, match_end, end);
|
||||
|
||||
real_start = *start;
|
||||
|
||||
while (gtk_source_iter_forward_search (&real_start, str, gs_flags,
|
||||
match_start, match_end, end))
|
||||
while (_gtk_source_iter_forward_search (&real_start, str, gs_flags,
|
||||
match_start, match_end, end))
|
||||
{
|
||||
if (is_whole_word (match_start, match_end))
|
||||
return TRUE;
|
||||
|
@ -366,13 +366,13 @@ moo_text_search_backward (const GtkTextIter *start,
|
|||
gs_flags |= GTK_SOURCE_SEARCH_CASE_INSENSITIVE;
|
||||
|
||||
if (!(flags & MOO_TEXT_SEARCH_WHOLE_WORDS))
|
||||
return gtk_source_iter_backward_search (start, str, gs_flags,
|
||||
match_start, match_end, end);
|
||||
return _gtk_source_iter_backward_search (start, str, gs_flags,
|
||||
match_start, match_end, end);
|
||||
|
||||
real_start = *start;
|
||||
|
||||
while (gtk_source_iter_backward_search (&real_start, str, gs_flags,
|
||||
match_start, match_end, end))
|
||||
while (_gtk_source_iter_backward_search (&real_start, str, gs_flags,
|
||||
match_start, match_end, end))
|
||||
{
|
||||
if (is_whole_word (match_start, match_end))
|
||||
return TRUE;
|
||||
|
|
Loading…
Reference in New Issue