Change license from GPLv2+ to GPLv3+.
[pspp-builds.git] / src / libpspp / tower.h
index e0ee12a758229bef02e9ae934c0437ee44b3a6bc..55184e51cdc54b0276a2a557950569221931309f 100644 (file)
@@ -1,20 +1,18 @@
-/* PSPP - computes sample statistics.
+/* PSPP - a program for statistical analysis.
    Copyright (C) 2007 Free Software Foundation, Inc.
 
-   This program is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
 
-   This program is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-   02110-1301, USA. */
+   along with this program.  If not, see <http://www.gnu.org/licenses/>. */
 
 /* "Tower" data structure, implemented as an augmented binary
    tree.
@@ -57,7 +55,7 @@
         ((STRUCT *) ((char *) (NODE) - offsetof (STRUCT, MEMBER)))
 
 /* A node within a tower. */
-struct tower_node 
+struct tower_node
   {
     struct abt_node abt_node;         /* ABT node. */
     unsigned long int subtree_height; /* Node's plus descendants' heights. */
@@ -66,15 +64,17 @@ struct tower_node
 
 /* Returns the height of a tower node. */
 static inline unsigned long
-tower_node_get_height (const struct tower_node *node) 
+tower_node_get_height (const struct tower_node *node)
 {
   return node->height;
 }
 
 /* A tower. */
-struct tower 
+struct tower
   {
-    struct abt abt;              /* Tree. */
+    struct abt abt;                   /* Tree. */
+    struct tower_node *cache;         /* Cache node. */
+    unsigned long int cache_bottom;   /* Height of cache's bottom. */
   };
 
 void tower_init (struct tower *);
@@ -95,7 +95,10 @@ struct tower_node *tower_lookup (const struct tower *,
                                  unsigned long int level,
                                  unsigned long int *node_start);
 struct tower_node *tower_first (const struct tower *);
+struct tower_node *tower_last (const struct tower *);
 struct tower_node *tower_next (const struct tower *,
                                const struct tower_node *);
+struct tower_node *tower_prev (const struct tower *,
+                               const struct tower_node *);
 
 #endif /* libpspp/tower.h */