Integrate adding files with the file manager
[anjuta-git-plugin.git] / plugins / debug-manager / sparse_buffer.h
blob6f9cd4b7cd8af61808d87d6e3202947b9b8fc38a
1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 /*
3 sparse_buffer.h
4 Copyright (C) 2006 Sebastien Granjoux
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 #ifndef _SPARSE_BUFFER_H
22 #define _SPARSE_BUFFER_H
24 #include <gtk/gtk.h>
26 #define DMA_SPARSE_BUFFER_TYPE (dma_sparse_buffer_get_type ())
27 #define DMA_SPARSE_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DMA_SPARSE_BUFFER_TYPE, DmaSparseBuffer))
28 #define DMA_SPARSE_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DMA_SPARSE_BUFFER_TYPE, DmaSparseBufferClass))
29 #define DMA_IS_SPARSE_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DMA_SPARSE_BUFFER_TYPE))
30 #define DMA_IS_SPARSE_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DMA_SPARSE_BUFFER_TYPE))
31 #define DMA_GET_SPARSE_BUFFER_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DMA_SPARSE_BUFFER_TYPE, DmaSparseBufferClass))
33 typedef struct _DmaSparseBuffer DmaSparseBuffer;
34 typedef struct _DmaSparseBufferClass DmaSparseBufferClass;
36 typedef struct _DmaSparseBufferNode DmaSparseBufferNode;
37 typedef struct _DmaSparseIter DmaSparseIter;
38 typedef struct _DmaSparseBufferTransport DmaSparseBufferTransport;
40 GType dma_sparse_buffer_get_type (void);
42 DmaSparseBuffer *dma_sparse_buffer_new (guint lower, guint upper);
43 void dma_sparse_buffer_free (DmaSparseBuffer *buffer);
45 void dma_sparse_buffer_insert (DmaSparseBuffer *buffer, DmaSparseBufferNode *node);
46 void dma_sparse_buffer_remove (DmaSparseBuffer *buffer, DmaSparseBufferNode *node);
47 void dma_sparse_buffer_remove_all (DmaSparseBuffer *buffer);
48 DmaSparseBufferNode *dma_sparse_buffer_lookup (DmaSparseBuffer *self, guint address);
49 DmaSparseBufferNode *dma_sparse_buffer_first (DmaSparseBuffer *self);
51 guint dma_sparse_buffer_get_lower (const DmaSparseBuffer *buffer);
52 guint dma_sparse_buffer_get_upper (const DmaSparseBuffer *buffer);
54 void dma_sparse_buffer_changed (const DmaSparseBuffer *buffer);
56 void dma_sparse_buffer_add_mark (DmaSparseBuffer *buffer, guint address, gint mark);
57 void dma_sparse_buffer_remove_mark (DmaSparseBuffer *buffer, guint address, gint mark);
58 void dma_sparse_buffer_remove_all_mark (DmaSparseBuffer *buffer, gint mark);
59 gint dma_sparse_buffer_get_marks (DmaSparseBuffer *buffer, guint address);
61 void dma_sparse_buffer_get_iterator_at_address (DmaSparseBuffer *buffer, DmaSparseIter *iter, guint address);
62 void dma_sparse_buffer_get_iterator_near_address (DmaSparseBuffer *buffer, DmaSparseIter *iter, guint address);
63 void dma_sparse_iter_copy (DmaSparseIter *dst, const DmaSparseIter *src);
64 void dma_sparse_iter_move_at (DmaSparseIter *iter, guint address);
65 void dma_sparse_iter_move_near (DmaSparseIter *iter, guint address);
66 void dma_sparse_iter_refresh (DmaSparseIter *iter);
67 void dma_sparse_iter_round (DmaSparseIter *iter, gboolean round_up);
68 void dma_sparse_iter_insert_lines (DmaSparseIter *iter, GtkTextIter *dst, guint count);
69 gboolean dma_sparse_iter_forward_lines (DmaSparseIter *iter, gint count);
70 gulong dma_sparse_iter_get_address (DmaSparseIter *iter);
72 DmaSparseBufferTransport* dma_sparse_buffer_alloc_transport (DmaSparseBuffer *buffer, guint lines, guint chars);
73 void dma_sparse_buffer_free_transport (DmaSparseBufferTransport *trans);
75 struct _DmaSparseBuffer
77 GObject parent;
79 guint lower;
80 guint upper;
82 struct
84 DmaSparseBufferNode *head;
85 DmaSparseBufferNode *tail;
86 } cache;
87 DmaSparseBufferNode *head;
89 gint stamp;
90 DmaSparseBufferTransport *pending;
92 GHashTable* mark;
95 struct _DmaSparseBufferClass
97 GObjectClass parent;
99 void (*changed) (const DmaSparseBuffer *buffer);
101 void (*insert_line) (DmaSparseIter *iter, GtkTextIter *dst);
102 gboolean (*refresh_iter) (DmaSparseIter *iter);
103 void (*round_iter) (DmaSparseIter *iter, gboolean round_up);
104 gboolean (*forward_line) (DmaSparseIter *iter);
105 gboolean (*backward_line) (DmaSparseIter *iter);
106 gulong (*get_address) (DmaSparseIter *iter);
109 struct _DmaSparseBufferNode
111 struct
113 DmaSparseBufferNode *prev;
114 DmaSparseBufferNode *next;
115 } cache;
116 DmaSparseBufferNode *prev;
117 DmaSparseBufferNode *next;
119 guint lower; /* Lowest address of block */
120 guint upper; /* Highest address in the block (avoid overflow) */
123 struct _DmaSparseIter
125 DmaSparseBuffer *buffer;
126 gint stamp;
127 DmaSparseBufferNode *node;
128 gulong base;
129 glong offset;
130 gint line;
133 struct _DmaSparseBufferTransport
135 DmaSparseBuffer *buffer;
136 gulong start;
137 gulong length;
138 guint lines;
139 guint chars;
140 guint stamp;
141 gint tag;
142 DmaSparseBufferTransport *next;
145 #endif /* _SPARSE_BUFFER_H */