[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gnash-commit
Subject:    [Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_final-1845-gc8e8dd5
From:       Petter Reinholdtsen <pere () hungry ! com>
Date:       2014-01-17 22:37:52
Message-ID: E1W4I2y-0004TM-Fc () vcs ! savannah ! gnu ! org
[Download RAW message or body]

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnash".

The branch, master has been updated
       via  c8e8dd5b7211258ca98588dd81a6a26b32af53ac (commit)
       via  9d6033e5ebc63835d7b76cbf5e4f6f7409dc5d72 (commit)
      from  a42ac2b7c700f18be5e14fb1ccc14b30bf80ca81 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit//commit/?id=c8e8dd5b7211258ca98588dd81a6a26b32af53ac


commit c8e8dd5b7211258ca98588dd81a6a26b32af53ac
Author: Petter Reinholdtsen <pere@hungry.com>
Date:   Fri Jan 17 23:37:46 2014 +0100

    Add local patches (make sure tree.hh do not take over the
    ducumentation and avoid the local emacs variables).

diff --git a/libbase/tree.hh b/libbase/tree.hh
index b2f3005..f0bdc9e 100644
--- a/libbase/tree.hh
+++ b/libbase/tree.hh
@@ -9,7 +9,7 @@
 // version 2 applies. Special permission to use tree.hh under
 // the LGPL for other projects can be requested from the author.
 
-/** \mainpage tree.hh
+/** \page tree.hh
     \author   Kasper Peeters
     \version  2.81
     \date     23-Aug-2011
@@ -2780,7 +2780,3 @@ typename tree<T, tree_node_allocator>::leaf_iterator& tree<T, \
tree_node_allocato  }
 
 #endif
-
-// Local variables:
-// default-tab-width: 3
-// End:

http://git.savannah.gnu.org/cgit//commit/?id=9d6033e5ebc63835d7b76cbf5e4f6f7409dc5d72


commit 9d6033e5ebc63835d7b76cbf5e4f6f7409dc5d72
Author: Petter Reinholdtsen <pere@hungry.com>
Date:   Fri Jan 17 23:34:23 2014 +0100

    Update tree.hh to latest version, from version 2.65 to 2.81.

diff --git a/libbase/tree.hh b/libbase/tree.hh
index 3b110bc..b2f3005 100644
--- a/libbase/tree.hh
+++ b/libbase/tree.hh
@@ -1,16 +1,20 @@
 
 //	STL-like templated tree class.
 //
-// Copyright (C) 2001-2009 Kasper Peeters <kasper.peeters@aei.mpg.de>
-// Distributed under the GNU General Public License version 3,
-// (eventually to be changed to the Boost Software License).
+// Copyright (C) 2001-2011 Kasper Peeters <kasper@phi-sci.com>
+// Distributed under the GNU General Public License version 3.
+//
+// When used together with the htmlcxx library to create 
+// HTML::Node template instances, the GNU Lesser General Public 
+// version 2 applies. Special permission to use tree.hh under
+// the LGPL for other projects can be requested from the author.
 
-/** \page tree.hh
+/** \mainpage tree.hh
     \author   Kasper Peeters
-    \version  2.65
-    \date     03-Apr-2009
-    \see      http://www.aei.mpg.de/~peekas/tree/
-    \see      http://www.aei.mpg.de/~peekas/tree/ChangeLog
+    \version  2.81
+    \date     23-Aug-2011
+    \see      http://tree.phi-sci.com/
+    \see      http://tree.phi-sci.com/ChangeLog
 
    The tree.hh library for C++ provides an STL-like container class
    for n-ary trees, templated over the data stored at the
@@ -31,42 +35,34 @@
 #include <set>
 #include <queue>
 #include <algorithm>
+#include <cstddef>
 
-// HP-style construct/destroy have gone from the standard,
-// so here is a copy.
-
-namespace kp {
-
-template <class T1, class T2>
-void constructor(T1* p, T2& val) 
-	{
-	new ((void *) p) T1(val);
-	}
-
-template <class T1>
-void constructor(T1* p) 
-	{
-	new ((void *) p) T1;
-	}
-
-template <class T1>
-void destructor(T1* p)
-	{
-	p->~T1();
-	}
-
-}
 
 /// A node in the tree, combining links to other nodes as well as the actual data.
 template<class T>
 class tree_node_ { // size: 5*4=20 bytes (on 32 bit arch), can be reduced by 8.
 	public:
+		tree_node_();
+		tree_node_(const T&);
+
 		tree_node_<T> *parent;
 	   tree_node_<T> *first_child, *last_child;
 		tree_node_<T> *prev_sibling, *next_sibling;
 		T data;
 }; // __attribute__((packed));
 
+template<class T>
+tree_node_<T>::tree_node_()
+	: parent(0), first_child(0), last_child(0), prev_sibling(0), next_sibling(0)
+	{
+	}
+
+template<class T>
+tree_node_<T>::tree_node_(const T& val)
+	: parent(0), first_child(0), last_child(0), prev_sibling(0), next_sibling(0), \
data(val) +	{
+	}
+
 template <class T, class tree_node_allocator = std::allocator<tree_node_<T> > >
 class tree {
 	protected:
@@ -86,7 +82,7 @@ class tree {
 		tree(const iterator_base&);
 		tree(const tree<T, tree_node_allocator>&);
 		~tree();
-		void operator=(const tree<T, tree_node_allocator>&);
+		tree<T,tree_node_allocator>& operator=(const tree<T, tree_node_allocator>&);
 
       /// Base class for iterators, only pointers stored, no traversal logic.
 #ifdef __SGI_STL_PORT
@@ -390,6 +386,9 @@ class tree {
 									  const iterator_base& end) const;
 		/// Determine whether the iterator is an 'end' iterator and thus not actually \
pointing to a node.  bool     is_valid(const iterator_base&) const;
+		/// Find the lowest common ancestor of two nodes, that is, the deepest node such \
that +		/// both nodes are descendants of it.
+		iterator lowest_common_ancestor(const iterator_base&, const iterator_base &) \
const;  
 		/// Determine the index of a node in the range of siblings to which it belongs.
 		unsigned int index(sibling_iterator it) const;
@@ -398,6 +397,10 @@ class tree {
 		/// Return iterator to the sibling indicated by index
 		sibling_iterator sibling(const iterator_base& position, unsigned int);  				
 		
+		/// For debugging only: verify internal consistency by inspecting all pointers in \
the tree +		/// (which will also trigger a valgrind error in case something got \
corrupted). +		void debug_verify_consistency() const;
+		
 		/// Comparator class for iterators (compares pointer values; why doesn't this work \
automatically?)  class iterator_base_less {
 			public:
@@ -495,6 +498,8 @@ template <class T, class tree_node_allocator>
 tree<T, tree_node_allocator>::~tree()
 	{
 	clear();
+	alloc_.destroy(head);
+	alloc_.destroy(feet);
 	alloc_.deallocate(head,1);
 	alloc_.deallocate(feet,1);
 	}
@@ -504,6 +509,8 @@ void tree<T, tree_node_allocator>::head_initialise_()
    { 
    head = alloc_.allocate(1,0); // MSVC does not have default second argument 
 	feet = alloc_.allocate(1,0);
+	alloc_.construct(head, tree_node_<T>());
+	alloc_.construct(feet, tree_node_<T>());
 
    head->parent=0;
    head->first_child=0;
@@ -519,9 +526,11 @@ void tree<T, tree_node_allocator>::head_initialise_()
    }
 
 template <class T, class tree_node_allocator>
-void tree<T, tree_node_allocator>::operator=(const tree<T, tree_node_allocator>& \
other) +tree<T,tree_node_allocator>& tree<T, tree_node_allocator>::operator=(const \
tree<T, tree_node_allocator>& other)  {
-	copy_(other);
+	if(this != &other)
+		copy_(other);
+	return *this;
 	}
 
 template <class T, class tree_node_allocator>
@@ -573,7 +582,8 @@ void tree<T, tree_node_allocator>::erase_children(const \
iterator_base& it)  prev=cur;
 		cur=cur->next_sibling;
 		erase_children(pre_order_iterator(prev));
-		kp::destructor(&prev->data);
+//		kp::destructor(&prev->data);
+		alloc_.destroy(prev);
 		alloc_.deallocate(prev,1);
 		}
 	it.node->first_child=0;
@@ -604,7 +614,8 @@ iter tree<T, tree_node_allocator>::erase(iter it)
 		cur->next_sibling->prev_sibling=cur->prev_sibling;
 		}
 
-	kp::destructor(&cur->data);
+//	kp::destructor(&cur->data);
+	alloc_.destroy(cur);
    alloc_.deallocate(cur,1);
 	return ret;
 	}
@@ -827,10 +838,12 @@ template <typename iter>
 iter tree<T, tree_node_allocator>::append_child(iter position)
  	{
 	assert(position.node!=head);
+	assert(position.node!=feet);
 	assert(position.node);
 
 	tree_node *tmp=alloc_.allocate(1,0);
-	kp::constructor(&tmp->data);
+	alloc_.construct(tmp, tree_node_<T>());
+//	kp::constructor(&tmp->data);
 	tmp->first_child=0;
 	tmp->last_child=0;
 
@@ -852,10 +865,12 @@ template <typename iter>
 iter tree<T, tree_node_allocator>::prepend_child(iter position)
  	{
 	assert(position.node!=head);
+	assert(position.node!=feet);
 	assert(position.node);
 
 	tree_node *tmp=alloc_.allocate(1,0);
-	kp::constructor(&tmp->data);
+	alloc_.construct(tmp, tree_node_<T>());
+//	kp::constructor(&tmp->data);
 	tmp->first_child=0;
 	tmp->last_child=0;
 
@@ -881,10 +896,12 @@ iter tree<T, tree_node_allocator>::append_child(iter position, \
const T& x)  // using 'insert'. See the documentation for further information, and \
sorry about  // the API change.
 	assert(position.node!=head);
+	assert(position.node!=feet);
 	assert(position.node);
 
 	tree_node* tmp = alloc_.allocate(1,0);
-	kp::constructor(&tmp->data, x);
+	alloc_.construct(tmp, x);
+//	kp::constructor(&tmp->data, x);
 	tmp->first_child=0;
 	tmp->last_child=0;
 
@@ -906,10 +923,12 @@ template <class iter>
 iter tree<T, tree_node_allocator>::prepend_child(iter position, const T& x)
 	{
 	assert(position.node!=head);
+	assert(position.node!=feet);
 	assert(position.node);
 
 	tree_node* tmp = alloc_.allocate(1,0);
-	kp::constructor(&tmp->data, x);
+	alloc_.construct(tmp, x);
+//	kp::constructor(&tmp->data, x);
 	tmp->first_child=0;
 	tmp->last_child=0;
 
@@ -931,6 +950,7 @@ template <class iter>
 iter tree<T, tree_node_allocator>::append_child(iter position, iter other)
 	{
 	assert(position.node!=head);
+	assert(position.node!=feet);
 	assert(position.node);
 
 	sibling_iterator aargh=append_child(position, value_type());
@@ -942,6 +962,7 @@ template <class iter>
 iter tree<T, tree_node_allocator>::prepend_child(iter position, iter other)
 	{
 	assert(position.node!=head);
+	assert(position.node!=feet);
 	assert(position.node);
 
 	sibling_iterator aargh=prepend_child(position, value_type());
@@ -953,6 +974,7 @@ template <class iter>
 iter tree<T, tree_node_allocator>::append_children(iter position, sibling_iterator \
from, sibling_iterator to)  {
 	assert(position.node!=head);
+	assert(position.node!=feet);
 	assert(position.node);
 
 	iter ret=from;
@@ -969,6 +991,7 @@ template <class iter>
 iter tree<T, tree_node_allocator>::prepend_children(iter position, sibling_iterator \
from, sibling_iterator to)  {
 	assert(position.node!=head);
+	assert(position.node!=feet);
 	assert(position.node);
 
 	iter ret=from;
@@ -996,7 +1019,8 @@ iter tree<T, tree_node_allocator>::insert(iter position, const \
T& x)  // insert before the feet.
 		}
 	tree_node* tmp = alloc_.allocate(1,0);
-	kp::constructor(&tmp->data, x);
+	alloc_.construct(tmp, x);
+//	kp::constructor(&tmp->data, x);
 	tmp->first_child=0;
 	tmp->last_child=0;
 
@@ -1018,7 +1042,8 @@ template <class T, class tree_node_allocator>
 typename tree<T, tree_node_allocator>::sibling_iterator tree<T, \
tree_node_allocator>::insert(sibling_iterator position, const T& x)  {
 	tree_node* tmp = alloc_.allocate(1,0);
-	kp::constructor(&tmp->data, x);
+	alloc_.construct(tmp, x);
+//	kp::constructor(&tmp->data, x);
 	tmp->first_child=0;
 	tmp->last_child=0;
 
@@ -1048,7 +1073,8 @@ template <class iter>
 iter tree<T, tree_node_allocator>::insert_after(iter position, const T& x)
 	{
 	tree_node* tmp = alloc_.allocate(1,0);
-	kp::constructor(&tmp->data, x);
+	alloc_.construct(tmp, x);
+//	kp::constructor(&tmp->data, x);
 	tmp->first_child=0;
 	tmp->last_child=0;
 
@@ -1101,8 +1127,11 @@ template <class T, class tree_node_allocator>
 template <class iter>
 iter tree<T, tree_node_allocator>::replace(iter position, const T& x)
 	{
-	kp::destructor(&position.node->data);
-	kp::constructor(&position.node->data, x);
+//	kp::destructor(&position.node->data);
+//	kp::constructor(&position.node->data, x);
+	position.node->data=x;
+//	alloc_.destroy(position.node);
+//	alloc_.construct(position.node, x);
 	return position;
 	}
 
@@ -1120,7 +1149,8 @@ iter tree<T, tree_node_allocator>::replace(iter position, const \
iterator_base& f  erase_children(position);	
 //	std::cout << "no warning!" << std::endl;
 	tree_node* tmp = alloc_.allocate(1,0);
-	kp::constructor(&tmp->data, (*from));
+	alloc_.construct(tmp, (*from));
+//	kp::constructor(&tmp->data, (*from));
 	tmp->first_child=0;
 	tmp->last_child=0;
 	if(current_to->prev_sibling==0) {
@@ -1140,7 +1170,8 @@ iter tree<T, tree_node_allocator>::replace(iter position, const \
iterator_base& f  }
 	tmp->next_sibling=current_to->next_sibling;
 	tmp->parent=current_to->parent;
-	kp::destructor(&current_to->data);
+//	kp::destructor(&current_to->data);
+	alloc_.destroy(current_to);
 	alloc_.deallocate(current_to,1);
 	current_to=tmp;
 	
@@ -1417,6 +1448,10 @@ template <typename iter> iter tree<T, \
tree_node_allocator>::move_ontop(iter targ  
 	if(dst==src) return source;
 
+//	if(dst==src->prev_sibling) {
+//
+//		}
+
 	// remember connection points
 	tree_node *b_prev_sibling=dst->prev_sibling;
 	tree_node *b_next_sibling=dst->next_sibling;
@@ -1822,6 +1857,29 @@ bool tree<T, tree_node_allocator>::is_valid(const \
iterator_base& it) const  }
 
 template <class T, class tree_node_allocator>
+typename tree<T, tree_node_allocator>::iterator tree<T, \
tree_node_allocator>::lowest_common_ancestor( +	const iterator_base& one, const \
iterator_base& two) const +	{
+	std::set<iterator, iterator_base_less> parents;
+
+	// Walk up from 'one' storing all parents.
+	iterator walk=one;
+	do {
+		walk=parent(walk);
+		parents.insert(walk);
+		} while( is_valid(parent(walk)) );
+
+	// Walk up from 'two' until we encounter a node in parents.
+	walk=two;
+	do {
+		walk=parent(walk);
+		if(parents.find(walk) != parents.end()) break;
+		} while( is_valid(parent(walk)) );
+
+	return walk;
+	}
+
+template <class T, class tree_node_allocator>
 unsigned int tree<T, tree_node_allocator>::index(sibling_iterator it) const
 	{
 	unsigned int ind=0;
@@ -1862,6 +1920,24 @@ typename tree<T, tree_node_allocator>::sibling_iterator \
tree<T, tree_node_alloca  return tmp;
    }
  
+template <class T, class tree_node_allocator>
+void tree<T, tree_node_allocator>::debug_verify_consistency() const
+	{
+	iterator it=begin();
+	while(it!=end()) {
+		if(it.node->parent!=0) {
+			if(it.node->prev_sibling==0) 
+				assert(it.node->parent->first_child==it.node);
+			else 
+				assert(it.node->prev_sibling->next_sibling==it.node);
+			if(it.node->next_sibling==0) 
+				assert(it.node->parent->last_child==it.node);
+			else
+				assert(it.node->next_sibling->prev_sibling==it.node);
+			}
+		++it;
+		}
+	}
 
 template <class T, class tree_node_allocator>
 typename tree<T, tree_node_allocator>::sibling_iterator tree<T, \
tree_node_allocator>::child(const iterator_base& it, unsigned int num)  @@ -2705,3 \
+2781,6 @@ typename tree<T, tree_node_allocator>::leaf_iterator& tree<T, \
tree_node_allocato  
 #endif
 
+// Local variables:
+// default-tab-width: 3
+// End:

-----------------------------------------------------------------------

Summary of changes:
 libbase/tree.hh |  171 +++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 123 insertions(+), 48 deletions(-)


hooks/post-receive
-- 
Gnash

_______________________________________________
Gnash-commit mailing list
Gnash-commit@gnu.org
https://lists.gnu.org/mailman/listinfo/gnash-commit


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic