Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
1 /* GLIB - Library of useful routines for C programming
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
3 * Portions copyright (c) 2006 Nokia Corporation. All rights reserved.
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
22 * Modified by the GLib Team and others 1997-2000. See the AUTHORS
23 * file for a list of people on the GLib Team. See the ChangeLog
24 * files for a list of changes. These files are distributed with
25 * GLib at ftp://ftp.gtk.org/pub/gtk/.
32 #include <glib/gmem.h>
36 typedef struct _GNode GNode;
38 /* Tree traverse flags */
41 G_TRAVERSE_LEAVES = 1 << 0,
42 G_TRAVERSE_NON_LEAVES = 1 << 1,
43 G_TRAVERSE_ALL = G_TRAVERSE_LEAVES | G_TRAVERSE_NON_LEAVES,
44 G_TRAVERSE_MASK = 0x03,
45 G_TRAVERSE_LEAFS = G_TRAVERSE_LEAVES,
46 G_TRAVERSE_NON_LEAFS = G_TRAVERSE_NON_LEAVES
49 /* Tree traverse orders */
58 typedef gboolean (*GNodeTraverseFunc) (GNode *node,
60 typedef void (*GNodeForeachFunc) (GNode *node,
62 typedef gpointer (*GCopyFunc) (gconstpointer src,
65 /* N-way tree implementation
76 #define G_NODE_IS_ROOT(node) (((GNode*) (node))->parent == NULL && \
77 ((GNode*) (node))->prev == NULL && \
78 ((GNode*) (node))->next == NULL)
79 #define G_NODE_IS_LEAF(node) (((GNode*) (node))->children == NULL)
81 IMPORT_C GNode* g_node_new (gpointer data);
82 IMPORT_C void g_node_destroy (GNode *root);
83 IMPORT_C void g_node_unlink (GNode *node);
84 IMPORT_C GNode* g_node_copy_deep (GNode *node,
87 IMPORT_C GNode* g_node_copy (GNode *node);
88 IMPORT_C GNode* g_node_insert (GNode *parent,
91 IMPORT_C GNode* g_node_insert_before (GNode *parent,
94 IMPORT_C GNode* g_node_insert_after (GNode *parent,
97 IMPORT_C GNode* g_node_prepend (GNode *parent,
99 IMPORT_C guint g_node_n_nodes (GNode *root,
100 GTraverseFlags flags);
101 IMPORT_C GNode* g_node_get_root (GNode *node);
102 IMPORT_C gboolean g_node_is_ancestor (GNode *node,
104 IMPORT_C guint g_node_depth (GNode *node);
105 IMPORT_C GNode* g_node_find (GNode *root,
107 GTraverseFlags flags,
110 /* convenience macros */
111 #define g_node_append(parent, node) \
112 g_node_insert_before ((parent), NULL, (node))
113 #define g_node_insert_data(parent, position, data) \
114 g_node_insert ((parent), (position), g_node_new (data))
115 #define g_node_insert_data_before(parent, sibling, data) \
116 g_node_insert_before ((parent), (sibling), g_node_new (data))
117 #define g_node_prepend_data(parent, data) \
118 g_node_prepend ((parent), g_node_new (data))
119 #define g_node_append_data(parent, data) \
120 g_node_insert_before ((parent), NULL, g_node_new (data))
122 /* traversal function, assumes that `node' is root
123 * (only traverses `node' and its subtree).
124 * this function is just a high level interface to
125 * low level traversal functions, optimized for speed.
127 IMPORT_C void g_node_traverse (GNode *root,
129 GTraverseFlags flags,
131 GNodeTraverseFunc func,
134 /* return the maximum tree height starting with `node', this is an expensive
135 * operation, since we need to visit all nodes. this could be shortened by
136 * adding `guint height' to struct _GNode, but then again, this is not very
137 * often needed, and would make g_node_insert() more time consuming.
139 IMPORT_C guint g_node_max_height (GNode *root);
141 IMPORT_C void g_node_children_foreach (GNode *node,
142 GTraverseFlags flags,
143 GNodeForeachFunc func,
145 IMPORT_C void g_node_reverse_children (GNode *node);
146 IMPORT_C guint g_node_n_children (GNode *node);
147 IMPORT_C GNode* g_node_nth_child (GNode *node,
149 IMPORT_C GNode* g_node_last_child (GNode *node);
150 IMPORT_C GNode* g_node_find_child (GNode *node,
151 GTraverseFlags flags,
153 IMPORT_C gint g_node_child_position (GNode *node,
155 IMPORT_C gint g_node_child_index (GNode *node,
158 IMPORT_C GNode* g_node_first_sibling (GNode *node);
159 IMPORT_C GNode* g_node_last_sibling (GNode *node);
161 #define g_node_prev_sibling(node) ((node) ? \
162 ((GNode*) (node))->prev : NULL)
163 #define g_node_next_sibling(node) ((node) ? \
164 ((GNode*) (node))->next : NULL)
165 #define g_node_first_child(node) ((node) ? \
166 ((GNode*) (node))->children : NULL)
168 #ifndef G_DISABLE_DEPRECATED
169 IMPORT_C void g_node_push_allocator (gpointer dummy);
170 IMPORT_C void g_node_pop_allocator (void);
174 #endif /* __G_NODE_H__ */