Index: src/InitTweak/Association.cc
===================================================================
--- src/InitTweak/Association.cc	(revision 9b4c936ccc92263445f7d8482d370551639e0f1f)
+++ 	(revision )
@@ -1,30 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// Association.cc -- 
-//
-// Author           : Rodolfo G. Esteves
-// Created On       : Mon May 18 07:44:20 2015
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Tue May 19 16:25:09 2015
-// Update Count     : 1
-//
-
-#include "Association.h"
-
-Association::~Association() {}
-
-SingleName::~SingleName() {}
-PointAssociation::~PointAssociation() {}
-
-const int RangeAssociation::RangeAssociation::UNDEF = -1;
-RangeAssociation::~RangeAssociation() {}
-
-// Local Variables: //
-// tab-width: 4 //
-// mode: c++ //
-// compile-command: "make install" //
-// End: //
Index: src/InitTweak/Association.h
===================================================================
--- src/InitTweak/Association.h	(revision 9b4c936ccc92263445f7d8482d370551639e0f1f)
+++ 	(revision )
@@ -1,292 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// Association.h -- 
-//
-// Author           : Rodolfo G. Esteves
-// Created On       : Mon May 18 07:44:20 2015
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Tue May 19 16:27:09 2015
-// Update Count     : 2
-//
-
-#ifndef _ASSOCIATION_H_
-#define _ASSOCIATION_H_
-
-#include <map>
-#include <list>
-#include <string>
-#include <vector>
-#include <iostream>
-#include <stdexcept>
-#include <algorithm>
-
-#include "SynTree/Expression.h"
-#include "diet_map.h"
-
-class Association;
-class SingleName;
-class PointAssociation;
-class RangeAssociation;
-
-// ** exceptions
-class AssocException : public std::exception {
-  public:
-	AssocException() {}
-	AssocException( std::string _what ) : what( _what ) {}
-	~AssocException() throw () {}
-
-	std::string get_what() const { return what; }
-	void set_what( std::string newValue ) { what = newValue; }
-  private:
-	std::string what;
-};
-
-// ** visitors
-class AssociationVisitor {
-  public:
-	AssociationVisitor() {}
-	virtual ~AssociationVisitor() {}
-
-	virtual void visit( SingleName * ) = 0;
-	virtual void visit( PointAssociation * ) = 0;
-	virtual void visit( RangeAssociation * ) = 0;
-};
-
-// ** containers
-class Association {
-  public:
-	virtual ~Association();
-
-	virtual Association *clone() = 0;
-	virtual long int add_single( std::string, Expression *) = 0;
-	virtual long int add_single( long int, Expression *expr) = 0;
-
-	virtual Association *operator[]( int idx ) = 0;
-	virtual Association *operator[]( std::string ) = 0;
-
-	//  virtual AssociationIterator *get_iterator() = 0;
-
-	virtual void accept( AssociationVisitor & ) = 0;
-	virtual void display( std::ostream & ) = 0;
-};
-
-class SingleName : public Association {
-  public:
-	SingleName( Expression *initExpr = 0 ) : expr( initExpr ) {}
-	virtual ~SingleName();
-
-	virtual SingleName *clone() {
-		return 0; // XXX!
-	}
-
-	virtual long int add_single( long int idx, Expression *newExpr) {
-		if ( expr == 0 ) //|| *expr == *newExpr )
-			expr = newExpr;
-		return 0;
-	}
-
-	virtual long int add_single( std::string str, Expression *newExpr ) {
-		if ( expr == 0 ) //|| *expr == *newExpr )
-			expr = newExpr;
-		return 0;
-	}
-
-	virtual Association *operator[]( int idx ) { assert(false); }
-	virtual Association *operator[]( std::string idx ) { assert(false); }
-
-	virtual void accept( AssociationVisitor &v ) { v.visit( this ); }
-	virtual void display( std::ostream &os ) {
-		os << "Single association" << std::endl;
-	}
-
-	Expression *get_expr() const { return expr; }
-
-  private:
-	Expression *expr;
-	Expression *deflt;
-};
-
-class PointAssociation : public Association {
-  public:
-	typedef std::map< std::string, std::pair< long int, Association *> > map_type;
-
-	PointAssociation() {}
-	PointAssociation( const PointAssociation &other ) {
-		copy( other.anonym.begin(), other.anonym.end(), back_inserter( anonym ));
-	}
-
-	virtual ~PointAssociation();
-
-	virtual PointAssociation *clone() {
-		return ( new PointAssociation( *this ) );
-	}
-
-	virtual long int add_single( long int idx, Expression *expr) {
-		long int ret;
-
-		if ( idx >= (long int)ordering.size() ) throw AssocException("extra (spurious) members");
-
-		if ( ordering[ idx ] == "")
-			std::cerr << "Checkpoint 2" << std::endl;
-		else {
-			assert( table[ordering[idx]].second != 0 );
-			ret = idx;
-			table[ ordering[idx] ].second->add_single("", expr );
-		} // if
-		return ret;
-	}
-
-	virtual long int add_single( std::string idx, Expression *expr) {
-		if ( idx == "" )
-			std::cerr << "Checkpoint 1" << std::endl;
-		else {
-			map_type::iterator j;
-			if (  (j = table.find( idx )) == table.end() )  // this doesn't amount for reachable members deeper down the structure, fix
-				throw AssocException("No such member");
-			else
-				return add_single( j->second.first, expr );
-		} // if
-
-		return -1;
-	}
-
-	void add_member( std::string str ) {
-		if ( table.find( str ) != table.end() ) return;
-		ordering.push_back( str );
-		if ( str != "" ) {
-			std::pair<long int, Association *> p( ordering.size() - 1, 0 );
-			table.insert( std::pair< std::string, std::pair<long int, Association *> >(str, p) );
-		} // if
-		return;
-	}
-
-	virtual void set_member( std::string str, Association *assoc ) {
-		if ( str == "" )
-			anonym.push_back( assoc );
-		else  if ( table.find( str ) == table.end() )
-			throw AssocException( "no such member" );
-		else
-			table[ str ] = std::pair<long int, Association *>(ordering.size() - 1, assoc);
-
-		return;
-	}
-
-	virtual Association *operator[]( int idx ) {
-		if ( ordering[idx] == "" ) {
-			std::cerr << "Error, anonymous members not implemented yet" << std::endl;
-			throw 0;
-		} else
-			return table[ ordering[idx] ].second;
-	}
-
-	virtual Association *operator[]( std::string idx ) {
-		if ( table.find( idx ) == table.end() )
-			throw AssocException("Member not found");
-		else
-			return table[ idx ].second;
-	}
-
-	/*
-	  virtual AssociationIterator *get_iterator() {
-	  PointAssocIterator *it;
-	  return it;
-	  }
-	*/
-
-	void accept( AssociationVisitor &v ) { v.visit( this ); }
-
-	virtual void display( std::ostream &os ) {
-		os << "Point association: " << std::endl;
-		for ( map_type::iterator i = table.begin(); i != table.end(); i++ ) {
-			os << "Member [" << i->first << ", index = " << i->second.first << "]";
-			if ( i->second.second != 0 )
-				i->second.second->display( os );
-			else
-				std::cerr << "No recursive association" << std::endl;
-
-			os << std::endl;
-		} // for
-	}
-
-	const int size() const { return ordering.size(); }
-
-  private:
-	PointAssociation &operator=(const PointAssociation &);
-	std::vector<std::string> ordering;
-	std::list< Association * > anonym;
-	std::map< std::string, std::pair<long int, Association *> > table;
-};
-
-class RangeAssociation : public Association {
-  public:
-	static const int UNDEF;
-	RangeAssociation( int _hi= UNDEF ) : hi( _hi ) {
-		std::cerr << "Constructed RangeAssociation with: [" << hi << "]" << std::endl;
-	}
-
-	virtual ~RangeAssociation();
-
-	virtual RangeAssociation *clone() {
-		return 0; // XXX !!!!
-	}
-
-	virtual Association *operator[]( int idx ) {
-		return 0; // XXX !!!
-	}
-
-	virtual Association *operator[]( std::string idx ) { assert(false); return 0; }
-
-	/*
-	  virtual AssociationIterator *get_iterator() {
-	  RangeAssocIterator *it;
-	  return it;
-	  }
-	*/
-
-	virtual long int add_single( long int idx, Expression *newExpr) { return 0; }
-	virtual long int add_single( std::string, Expression *) { return 0; }
-	void accept( AssociationVisitor &v ) { v.visit( this ); }
-	virtual void display( std::ostream &os ) {
-		os << "Range association, with limit: " << std::endl;
-	}
-
-  private:
-	int hi;
-	diet::diet_tree<int> tree;
-	/*
-	  for ( diet_tree<int>::iterator i = tree.begin(); i != tree.end(); i++ )
-	  std::cout << "--(" << (*i).first << ", " << (*i).second << ")--" << std::endl;
-	  diet_tree<int> tree;
-	  tree.insert(100,200);
-	*/
-};
-
-// ** builders
-class AssociationBuilder {
-  public:
-	/* AssociationBuilder( Declaration * ) */
-	virtual ~AssociationBuilder() {}
-	virtual Association *get_assoc() = 0;
-	virtual Association *grab_assoc() = 0;
-	virtual void set_assoc(   Association * ) = 0;
-};
-
-class AssociationFiller {
-  public:
-	// AssociationFiller( Declaration * ) {}
-	virtual ~AssociationFiller() {}
-	virtual Association *get_assoc() = 0;
-	virtual void set_assoc( Association * ) = 0;
-};
-
-#endif // _ASSOCIATION_H_
-
-// Local Variables: //
-// tab-width: 4 //
-// mode: c++ //
-// compile-command: "make install" //
-// End: //
Index: src/InitTweak/BasicInit.cc
===================================================================
--- src/InitTweak/BasicInit.cc	(revision 9b4c936ccc92263445f7d8482d370551639e0f1f)
+++ 	(revision )
@@ -1,268 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// BasicInit.cc -- 
-//
-// Author           : Rodolfo G. Esteves
-// Created On       : Mon May 18 07:44:20 2015
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Tue May 19 16:30:43 2015
-// Update Count     : 1
-//
-
-#include <list>
-#include <cassert>
-#include <iostream>
-#include <iterator>
-#include <algorithm>
-
-#include "Common/utility.h"
-
-#include "SynTree/Type.h"
-#include "SynTree/Statement.h"
-#include "SynTree/Expression.h"
-#include "SynTree/Declaration.h"
-#include "SynTree/Initializer.h"
-
-#include "BasicInit.h"
-#include "NameCollector.h"
-#include "NameAssociation.h"
-
-namespace InitTweak {
-	CompoundStmt* BasicInit::mutate(CompoundStmt *compoundStmt) {
-		index.visit( compoundStmt );
-
-		std::list< Statement * > &kids = compoundStmt->get_kids();
-		std::list< Statement * > newKids;
-
-		for ( std::list< Statement * >::iterator i = kids.begin(); i!= kids.end(); i++ ) {
-			//BasicInit newMut(  );
-			(*i)->acceptMutator( *this );
-			newKids.push_back( *i );
-
-			if ( has_bindings() ) { //       if ( get_bindings() != 0  ) {
-				std::list< Statement *> newSt = get_statements();
-				//newSt.push_back( *i );
-				newKids.splice( newKids.end(), newSt );
-				bindings = 0;
-				stmts.clear();
-			} // if
-		} // for
-
-		compoundStmt->get_kids() = newKids;
-		return compoundStmt;
-	}
-
-	Statement * BasicInit::mutate(DeclStmt *declStmt) {
-		declStmt->accept( index );
-
-		ObjectDecl *odecl = 0;
-
-		if ( ( odecl = dynamic_cast<ObjectDecl *>(declStmt->get_decl()) ) != 0 ) {
-			Initializer *init = odecl->get_init();
-			if ( init == 0 ) return declStmt;
-
-			if ( Classify::type( odecl->get_type() ) == Classify::COMPOUND_T )
-				if ( Classify::initializer(init) == Classify::SINGLE_I )
-					throw( 0 ); // mismatch of type and initializer
-				else {
-					NameInCollection *col = Classify::declaration( odecl, &index );
-					bindings = NameAssociation< Expression *, BreakInitializer >::createNameAssoc(col);
-					bindings->add_value( std::string(""), BreakInitializer(init) );
-					BasicInit::build_statements( bindings, odecl->get_name(), stmts );
-				} // if
-			else
-				if ( Classify::initializer(init) == Classify::COMPOUND_I )
-					throw( 0 ); // mismatch of type and initializer
-				else {
-					// Single inits
-					SingleInit *sinit = dynamic_cast< SingleInit * > ( init );
-					assert( sinit != 0);
-
-					std::list<Expression *> args;
-					args.push_back( new AddressExpr( new NameExpr( odecl->get_name() )) );    // have to get address of object
-					args.push_back( sinit->get_value() );
-					// replace declaration with initialization
-					stmts.push_back(new ExprStmt(std::list<Label>(), new UntypedExpr(new NameExpr("?=?"), args)));
-				} // if
-
-			delete init;
-			odecl->set_init( 0 );
-		} else {
-			// no declaration statement
-		} // if
-
-		return declStmt;
-	}
-
-	ExprStmt *assignFromDecl( DeclStmt *declStmt ) {
-		ObjectDecl *decl;
-		if ( (decl = dynamic_cast<ObjectDecl *>( declStmt->get_decl() )) != 0 ) {
-			SingleInit *init;
-			if ( (init = dynamic_cast<SingleInit *>(decl->get_init())) != 0 ) {
-			} // if
-		} // if
-
-		return 0;
-	}
-
-	bool isDeclStmtP(Statement *stmt) {
-		return ( dynamic_cast< DeclStmt *>(stmt) != 0 );
-	}
-
-	BasicInit::Classify::TypeKind BasicInit::Classify::type( Type *toClassify ) {
-		if ( toClassify == 0 ) return NULL_T;
-
-		if ( dynamic_cast< StructInstType * >(toClassify) ||
-			 dynamic_cast< UnionInstType * >(toClassify) ||
-			 dynamic_cast< ArrayType * >(toClassify)         )
-			return COMPOUND_T;
-		else
-			return SINGLE_T;
-	}
-
-	BasicInit::Classify::InitKind BasicInit::Classify::initializer( Initializer *init) {
-		if ( init == 0 ) return NULL_I;
-		if ( dynamic_cast< ListInit * >(init) )
-			return COMPOUND_I;
-		if ( dynamic_cast< SingleInit * >(init) )
-			return SINGLE_I;
-
-		return NULL_I; // shouldn't be here anyways
-	}
-
-	NameInCollection * BasicInit::Classify::declaration( ObjectDecl *objdecl, SymTab::Indexer *index ) {
-		assert ( index != 0 );
-
-		ReferenceToType *reftype;
-		if ( (reftype = dynamic_cast< StructInstType * >( objdecl->get_type() )) != 0 ) {
-			StructDecl *strDecl = index->lookupStruct( reftype->get_name() );
-			if ( strDecl != 0 ) {
-				NameCollectionBuilder bld;
-				NameCollector nc( bld );
-				strDecl->accept( nc );
-				NameInCollection *col = nc.get_builder().get_collection();
-				nc.get_builder().set_collection( 0 );
-
-				return col;
-			} else
-				throw( SemanticError( std::string("No structure of name: ") + reftype->get_name() ) );
-		} else {
-			throw(SemanticError( reftype->get_name() + std::string("is not a reference to type") ));
-			return 0;
-		} // if
-	}
-
-	std::list< Statement * >
-	BasicInit::Classify::matchInit( NameInCollection *col, ObjectDecl *toInitialize, Initializer *init ) {
-		assert ( col != 0 );
-
-		std::list< Statement * > arranged(0); //( col->size() ); 
-		std::fill( arranged.begin(), arranged.end(), (Statement *)0 );
-		int current = 0;
-
-		if ( init == 0 )
-			// no initializer... shouldn't even bother... fix this. 
-			return arranged;
-
-		ListInit *li = dynamic_cast< ListInit * >( init );
-
-		if ( li != 0 ) {
-			for ( std::list<Initializer *>::iterator i = li->begin_initializers();
-				  i != li->end_initializers();
-				  i++) {
-				std::list<Expression *> d_orig = (*i)->get_designators();
-
-				NameInCollection *corrsp; // corresponding element to this initializer
-				if ( ! d_orig.empty() ) {
-					// 1) has designators
-					std::list<NameExpr *> des;
-					std::transform( d_orig.begin(), d_orig.end(),
-									std::back_inserter( des ), cast_ptr<Expression, NameExpr > );
-
-					for ( std::list<NameExpr *>::iterator j = des.begin(); j != des.end(); j++ ) {
-						// check for existence of the element
-
-						if ( (corrsp = (*col)[ (*j)->get_name() ]) != 0 ) {
-							// current++;
-							SingleInit *sinit;
-							if ( (sinit = dynamic_cast< SingleInit * >( *i )) != 0 )
-								arranged.push_back( constructAssgn( corrsp->get_name(), toInitialize, sinit ) );
-							else
-								; // recursive call to matchInit
-						} else
-							// error, member doesn't exist
-							return arranged; // throw( 0 ); // XXX
-					}
-				} else {
-					// 2) doesn't have designators
-					if ( (corrsp = (*col)[ current++ ]) != 0 ) {
-						SingleInit *sinit;
-						if ( (sinit = dynamic_cast< SingleInit * >( *i )) != 0 )
-							arranged.push_back( constructAssgn( corrsp->get_name(), toInitialize, sinit ) );
-						else
-							; // recursive call to matchInit
-					} else {
-						// Shouldn't be here... probably too many elements in initializer?
-					} // if
-				} // if
-			} // for
-		} // if
-
-		return arranged;
-	}
-
-	Statement *BasicInit::Classify::constructAssgn( std::string membName, ObjectDecl *toInit, SingleInit *sinit ) {
-		std::list< Expression * > args;
-		args.push_back(new AddressExpr( new UntypedMemberExpr( membName, new NameExpr(toInit->get_name()) )));
-		args.push_back( sinit->get_value() );
-		Statement *ret = new ExprStmt(std::list<Label>(), new UntypedExpr(new NameExpr("?=?"), args));
-		return ret;
-	}
-
-	void BasicInit::build_statements( NameAssociation< Expression *, BreakInitializer > *assoc,  std::string aggName, std::list< Statement *> &stmts ) {
-		assert( assoc != 0 );
-		static std::list< std::string > prefix;
-
-		NameInCollection *col = assoc->get_collection();
-		if ( col->isComposite() ) {
-			VariousNames *vc = dynamic_cast< VariousNames * >( col ); 
-			for ( VariousNames::key_iterator it = vc->keys_begin(); it != vc->keys_end(); it++ ) {
-				prefix.push_back( *it );
-				if ( (*assoc)[ *it ] != 0 )
-					build_statements( (*assoc)[ *it ], aggName, stmts );
-
-				prefix.pop_back();
-			}
-		} else {
-			SingleNameAssoc< Expression *, BreakInitializer > *sa = \
-				dynamic_cast< SingleNameAssoc< Expression *, BreakInitializer > * >( assoc );
-			assert( sa != 0 );
-
-			Expression * rh = sa->get_data();
-
-			if (rh != 0) {
-				// construct assignment statement list
-				Expression *lh = new NameExpr ( aggName );
-				for ( std::list< std::string >::iterator i = prefix.begin(); i != prefix.end(); i++ )
-					lh = new UntypedMemberExpr( *i, lh );
-
-				std::list< Expression * > args;
-				args.push_back( new AddressExpr(lh) ); 	args.push_back( rh );
-
-				stmts.push_back( new ExprStmt(std::list<Label>(), new UntypedExpr(new NameExpr("?=?"), args)) );
-			} // if
-		} // if
-
-		return;
-	}
-} // namespace InitTweak
-
-// Local Variables: //
-// tab-width: 4 //
-// mode: c++ //
-// compile-command: "make install" //
-// End: //
Index: src/InitTweak/BasicInit.h
===================================================================
--- src/InitTweak/BasicInit.h	(revision 9b4c936ccc92263445f7d8482d370551639e0f1f)
+++ 	(revision )
@@ -1,222 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// BasicInit.h -- 
-//
-// Author           : Rodolfo G. Esteves
-// Created On       : Mon May 18 07:44:20 2015
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Tue May 19 16:32:21 2015
-// Update Count     : 3
-//
-
-#ifndef _BASINIT_H_
-#define _BASINIT_H_
-
-#include <list>
-
-#include "SynTree/Visitor.h"
-#include "SymTab/Indexer.h"
-
-#include "SynTree/Type.h"
-#include "SynTree/Initializer.h"
-#include "SynTree/Expression.h"
-#include "NameInCollection.h"
-#include "NameAssociation.h"
-
-namespace InitTweak {
-	bool isDeclStmtP(Statement *stmt);
-
-	class BreakInitializer;
-	class BreakDesignator;
-
-	class BasicInit: public Mutator {
-	  public:
-		BasicInit() : bindings( 0 ) {}
-		BasicInit( SymTab::Indexer &_index ) : bindings( 0 ), index( _index ) {}
-		BasicInit( const BasicInit &other ) {
-			bindings = other.get_bindings();
-			index = other.index;
-		}
-
-		~BasicInit() { /* delete bindings; bindings = 0; */ }
-
-		NameAssociation< Expression *, BreakInitializer > *get_bindings() const { return bindings; }
-		void set_bindings( NameAssociation< Expression *, BreakInitializer > *newValue ) {
-			bindings = newValue;
-		}
-
-		bool has_bindings() {
-			return ( get_bindings() != 0 || ! stmts.empty() );
-		}
-
-		virtual ObjectDecl     *mutate( ObjectDecl *objectDecl )
-			{ index.visit( objectDecl ); return objectDecl; }
-		virtual TypeDecl       *mutate( TypeDecl *typeDecl )
-			{ index.visit( typeDecl ); return typeDecl; }
-		virtual TypedefDecl    *mutate( TypedefDecl *typeDecl )
-			{ index.visit( typeDecl ); return typeDecl; }
-		virtual StructDecl     *mutate( StructDecl *aggregateDecl )
-			{ index.visit( aggregateDecl ); return aggregateDecl; }
-		virtual UnionDecl      *mutate( UnionDecl *aggregateDecl )
-			{ index.visit( aggregateDecl ); return aggregateDecl; }
-		virtual EnumDecl       *mutate( EnumDecl *aggregateDecl )
-			{ index.visit( aggregateDecl ); return aggregateDecl; }
-
-		virtual Type           *mutate( StructInstType *aggrInst )
-			{ index.visit( aggrInst ); return aggrInst; }
-		virtual Type           *mutate( UnionInstType *aggrInst )
-			{ index.visit( aggrInst ); return aggrInst; }
-
-		virtual CompoundStmt   *mutate(CompoundStmt *compoundStmt);
-		virtual Statement *mutate(DeclStmt *declStmt);
-
-		std::list< Statement *> get_statements() const { return stmts;  }
-
-		static void build_statements( NameAssociation< Expression *, BreakInitializer > *assoc, std::string aggName, std::list< Statement *> &stmts );
-	  private:
-		NameAssociation< Expression *, BreakInitializer > *bindings;
-		Statement *assignFromDecl( DeclStmt *declStmt );
-		SymTab::Indexer index;
-		std::list< Statement *> stmts;
-
-		class Classify {
-		  public:
-			enum TypeKind { NULL_T, SINGLE_T, COMPOUND_T };
-			enum InitKind { NULL_I, SINGLE_I, COMPOUND_I };
-
-			static TypeKind type( Type * );
-			static InitKind initializer( Initializer *);
-
-			static NameInCollection *declaration( ObjectDecl *objdecl, SymTab::Indexer *index );
-			static std::list< Statement * >
-			matchInit( NameInCollection *, ObjectDecl *, Initializer * );
-			static Statement *constructAssgn( std::string membname, ObjectDecl *toInit, SingleInit *sinit );
-
-			// static std::list< Statement * > constructListAssgn( NameAssociation<Expression *, BreakDesignator > assoc );
-		};
-	};
-
-	class BreakInitializer {
-		enum InitKind { EMPTY, SINGLE, COMPOUND };
-
-		class BreakDesignator;
-		typedef BreakDesignator NameSplitter;
-
-	  public:
-		typedef std::list<Initializer *>::iterator element_iterator;
-		typedef std::list< NameSplitter >::iterator name_iterator;
-
-		BreakInitializer ( Initializer *_init ) : kind( EMPTY ), sinit(0), cinit(0) {
-			std::list<Expression *> temp;
-
-			if ( ( sinit=dynamic_cast< SingleInit * >(_init) ) != 0 ) {
-				kind = SINGLE;
-				temp = sinit->get_designators();
-			} else if ( ( cinit=dynamic_cast< ListInit * >(_init) ) != 0 ) {
-				kind = COMPOUND;
-				temp = cinit->get_designators();
-			} // if
-
-			std::transform( temp.begin(), temp.end(), std::back_inserter( designators ), ctor_noptr<NameSplitter, Expression *> );
-		}
-
-		//BreakInitializer( const BreakInitializer &other ) { this.col = other.col; }
-		~BreakInitializer () {}
-
-		BreakInitializer set_name( NameSplitter &name ) {
-			designators.clear();
-			designators.push_back( name );
-
-			return *this;
-		}
-
-		element_iterator element_begin() {
-			assert( cinit != 0 );
-			return cinit->begin_initializers();
-		}
-		element_iterator element_end() {
-			assert( cinit != 0 );
-			return cinit->end_initializers();
-		}
-
-		name_iterator names_begin() { return designators.begin(); }
-		name_iterator names_end() { return designators.end(); }
-
-		int names_size() const { return designators.size(); }
-
-		bool has_index() const { return ! designators.empty(); }
-		bool is_single() const { return kind == SINGLE; }
-		bool is_composite() const { return kind == COMPOUND;  }
-
-		Expression *get_value() {
-			switch ( kind ) {
-			  case EMPTY:
-				return 0;
-				break;
-			  case SINGLE:
-				return sinit->get_value();
-				break;
-			  case COMPOUND:
-				assert(false);
-				break;
-			  default:
-				assert(false);
-			} // switch
-			return 0;
-		}
-		// attributes
-	  private:
-		InitKind kind;
-		SingleInit *sinit;
-		ListInit *cinit;
-		std::list< BreakDesignator > designators;
-		// helper classes
-	  public:
-		class BreakDesignator {
-		  public:
-			BreakDesignator( Expression *exp ) {
-				Expression *prfx = exp;
-				UntypedMemberExpr *me = 0;
-
-				do {
-					if ( (me=dynamic_cast< UntypedMemberExpr * >( prfx )) == 0 ) break;
-					blown_struct.push_front( me->get_member() );
-					prfx = me->get_aggregate();
-				} while ( prfx != 0 );
-
-				NameExpr *ne;
-				if ( (ne=dynamic_cast< NameExpr * >( prfx )) != 0 ) 
-					blown_struct.push_front( ne->get_name() );
-			}
-
-			BreakDesignator( std::string name ) {
-				blown_struct.push_front( name );
-			}
-
-			bool is_flat() const { return blown_struct.size() == 1; }
-			bool is_nested() const { return blown_struct.size() > 1; }
-
-			std::string get_name() { return blown_struct.front(); }
-
-			BreakDesignator &name_remainder() {
-				blown_struct.pop_front();
-				return *this;
-			}
-
-		  private:
-			std::list< std::string > blown_struct;
-		};
-	};
-} // namespace InitTweak
-
-#endif // _BASINIT_H_
-
-// Local Variables: //
-// tab-width: 4 //
-// mode: c++ //
-// compile-command: "make install" //
-// End: //
Index: src/InitTweak/DeclarationHoister.cc
===================================================================
--- src/InitTweak/DeclarationHoister.cc	(revision 9b4c936ccc92263445f7d8482d370551639e0f1f)
+++ 	(revision )
@@ -1,60 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// DeclarationHoister.cc -- 
-//
-// Author           : Rodolfo G. Esteves
-// Created On       : Mon May 18 07:44:20 2015
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Tue May 19 16:33:20 2015
-// Update Count     : 2
-//
-
-#include <list>
-#include <cassert>
-#include <iostream>
-#include <iterator>
-#include <algorithm>
-
-#include "Common/utility.h"
-
-#include "SynTree/Statement.h"
-#include "SynTree/Expression.h"
-#include "SynTree/Declaration.h"
-
-#include "DeclarationHoister.h"
-
-namespace InitTweak {
-	CompoundStmt* DeclarationHoister::mutate( CompoundStmt *compoundStmt ) {
-		typedef std::list<Statement *>::iterator stmt_it;
-		// 1. collect Declaration Statements  in this scope
-		std::list<Statement *> &kids = compoundStmt->get_kids();
-		std::list<Statement *>::iterator result = kids.begin();
-		std::list< stmt_it > decls;
-
-		while ( result !=  kids.end() ) {
-			result = std::find_if (result, kids.end(), cast_ptr< Statement, DeclStmt > );
-
-			if ( result != kids.end() ) {
-				decls.push_back( result );
-				std::advance( result, 1 );
-			} // if
-		} // while
-
-		for ( std::list< stmt_it >::reverse_iterator i = decls.rbegin(); i!= decls.rend(); i++ ) {
-			kids.push_front( **i );
-			kids.erase( *i );
-		} // for
-
-		return compoundStmt;
-	}
-} // namespace InitTweak
-
-// Local Variables: //
-// tab-width: 4 //
-// mode: c++ //
-// compile-command: "make install" //
-// End: //
Index: src/InitTweak/DeclarationHoister.h
===================================================================
--- src/InitTweak/DeclarationHoister.h	(revision 9b4c936ccc92263445f7d8482d370551639e0f1f)
+++ 	(revision )
@@ -1,32 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// DeclarationHoister.h -- 
-//
-// Author           : Rodolfo G. Esteves
-// Created On       : Mon May 18 07:44:20 2015
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Tue May 19 16:33:48 2015
-// Update Count     : 2
-//
-
-#include "SynTree/Visitor.h"
-#include "SymTab/Indexer.h"
-
-namespace InitTweak {
-	bool isDeclStmtP(Statement *stmt);
-
-	class DeclarationHoister: public Mutator {
-	  public:
-		virtual CompoundStmt   *mutate(CompoundStmt *compoundStmt);
-	};
-}  // namespace InitTweak
-
-// Local Variables: //
-// tab-width: 4 //
-// mode: c++ //
-// compile-command: "make install" //
-// End: //
Index: src/InitTweak/InitModel.cc
===================================================================
--- src/InitTweak/InitModel.cc	(revision 9b4c936ccc92263445f7d8482d370551639e0f1f)
+++ 	(revision )
@@ -1,226 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// InitModel.cc --
-//
-// Author           : Rodolfo G. Esteves
-// Created On       : Mon May 18 07:44:20 2015
-// Last Modified By : Rob Schluntz
-// Last Modified On : Thu Jan 07 13:38:46 2016
-// Update Count     : 5
-//
-
-#include "SynTree/Constant.h"
-#include "InitModel.h"
-
-#include <cassert>
-#include <cstdlib>
-#include <algorithm>
-
-namespace InitTweak {
-	InitModelBuilder::InitModelBuilder( Declaration *_decl )
-		: taken( false ), decl( 0 ), building(0) {
-
-		ObjectDecl *_odecl = dynamic_cast< ObjectDecl * >( _decl );
-		assert( _odecl != 0 );
-		Type *objectType = _odecl->get_type();
-
-		/* this to be replaced by dynamic dispatch */
-		if ( dynamic_cast< BasicType * >(objectType) != 0 ) {
-			if ( building == 0 ) building = new SingleName;
-		} else if ( ReferenceToType *rt = dynamic_cast< ReferenceToType * >(objectType) ) {
-			rt->accept( *this );
-		} else if ( ArrayType *at = dynamic_cast< ArrayType * >(objectType) ) {
-			at->accept( *this );
-		} else // if (tuples)
-			std::cerr << "Got something else" << std::endl;
-
-		if ( decl != 0 ) init();
-	}
-
-	InitModelBuilder::~InitModelBuilder() { if ( ! taken ) { delete building; building = 0; } }
-
-	void InitModelBuilder::init() {
-		assert( decl != 0 );
-		decl->accept( *this );
-	}
-
-	// Visitor interface
-	void InitModelBuilder::visit( ArrayType *at ) {
-		if ( building == 0 ) building = new RangeAssociation(interpretDimension( at->get_dimension() ));
-		decl = 0;
-		return;
-	}
-
-	void InitModelBuilder::visit( StructInstType *st ) {
-		if ( building == 0 ) building = new PointAssociation;
-		decl = st->get_baseStruct();
-		return;
-	}
-
-	void InitModelBuilder::visit( UnionInstType *ut ) {
-		decl = ut->get_baseUnion();
-		return;
-	}
-	void InitModelBuilder::visit( EnumInstType * ) {}
-
-	void InitModelBuilder::visit( StructDecl *aggregateDecl) {
-		PointAssociation *pa = dynamic_cast< PointAssociation * >( building );
-		assert( pa != 0 );
-		std::list< Declaration * > mem = aggregateDecl->get_members();
-
-		for ( std::list<Declaration *>::iterator i = mem.begin(); i != mem.end(); i++ ) {
-			pa->add_member( (*i)->get_name() );
-			InitModelBuilder rec(*i);
-			pa->set_member( (*i)->get_name(), rec.grab_assoc() );
-		} // for
-
-		return;
-	}
-
-	void InitModelBuilder::visit( UnionDecl *) {}
-	void InitModelBuilder::visit( EnumDecl *) {}
-
-	// InitModelBuilder::ConstantFolder
-	void InitModelBuilder::ConstantFolder::visit( ConstantExpr *cnst ) {
-		Constant *c = cnst->get_constant();
-		assert (c != 0);
-		if ( BasicType *bt = dynamic_cast<BasicType *>( c->get_type() ) ) {
-			if ( bt->isInteger() ) {
-				// need more intelligence here, not necessarily base 10
-				value = std::strtol( c->get_value().c_str(), NULL, 10 );
-				return;
-			} else
-				std::cerr << "Basic type but not integer" << std::endl;
-		} // if
-		throw 0;
-	}
-
-	// InitModelFiller
-	InitModelFiller::InitModelFiller( Association *_model, Initializer *_init, bool _topLevel )
-		: model( _model ), orgInit( _init ), topLevel( _topLevel ), next( 0 ) {
-		//next = model.begin();
-		if ( orgInit != 0 ) init();
-	}
-
-	void InitModelFiller::init() {
-		assert( model != 0 ); // change it into a reference
-		assert( orgInit != 0 );
-		orgInit->accept( *this );
-	}
-
-	void InitModelFiller::visit( SingleInit *singleInit ) {
-		std::list< Expression *> &des = singleInit->get_designators();
-
-		if ( topLevel ) {
-			assert ( des.empty() );
-			assert ( dynamic_cast< SingleName * >(model) != 0 );
-			try {
-				model->add_single( next++, singleInit->get_value() );
-			} catch (...) {
-				std::cerr << "Illegal initialization" << std::endl;
-			}
-			return;
-		} // if
-
-		if ( des.empty() ) {
-			assert( model != 0 );
-			try {
-				model->add_single( next++, singleInit->get_value() );
-			} catch ( AssocException &e ) {
-				throw SemanticError( "Illegal initialization: " + e.get_what() );
-			} catch ( ... ) {
-				std::cerr << "Shouldn't be here" << std::endl;
-			} // try
-			return;
-		} // if
-
-		// not general enough (does not contend well with designated arrays)
-		std::list<std::string> desnames;
-		std::transform( des.begin(), des.end(), back_inserter(desnames), Initializer::designator_name );
-
-		for ( std::list<std::string>::iterator i = desnames.begin(); i != desnames.end(); i++ ) {
-			try {
-				next = model->add_single( *i, singleInit->get_value() );
-				next++;
-			} catch ( AssocException &e ) {
-				throw SemanticError( "Illegal initialization: " + e.get_what() );
-			} catch ( ... ) {
-				std::cerr << "Shouldn't happen, check association" << std::endl;
-			} // try
-		} // for
-
-		return;
-	}
-
-	void InitModelFiller::visit( ListInit *listInit ) {
-		assert( listInit != 0 );
-
-		// designators
-		std::list< Expression *> &des = listInit->get_designators();
-		std::list< Initializer *> &ini = listInit->get_initializers();
-
-		if ( ! des.empty() ) {
-			if (topLevel)
-				throw SemanticError( "Invalid initializer: designated at top level." );
-
-			std::list<Expression *> des2;
-			std::copy (des.begin(), des.end(), back_inserter( des2 ));
-			std::list< Expression * > empty;
-			listInit->set_designators( empty );
-			for ( std::list<Expression *>::iterator i = des2.begin(); i != des2.end(); i++ ) {
-				Association * newModel = 0;
-				if ( NameExpr *n = dynamic_cast< NameExpr * >( *i ) )
-					try {
-						newModel = (*model)[ n->get_name() ];
-					} catch( AssocException &e ) {
-						std::cerr << "Didn't find member: " << e.get_what() << std::endl;
-					}
-				else // if ( RangeExpr *r = dynamic_cast< RangeExpr * >( *i ) )
-					std::cerr << "Invalid designator specification" << std::endl;
-
-				InitModelFiller rec( newModel, listInit, true );
-			} // for
-		} else
-			if (topLevel) {
-				topLevel = false;
-				for ( std::list<Initializer*>::iterator i = ini.begin(); i != ini.end(); i++ )
-					(*i)->accept(*this);
-			} else
-				// next available uninitialized member
-				InitModelFiller rec( (*model)[next++], listInit, true );
-	}
-
-	void InitUnspooler::visit( SingleName *single ) {
-		assert(init == 0 && single != 0);
-		std::list< Expression * > empty;
-		init = new SingleInit( single->get_expr(), empty, false ); // cannot be constructed
-		return;
-	}
-
-	void InitUnspooler::visit( PointAssociation *pa ) {
-		assert( pa != 0 );
-
-		std::list< Initializer * > contents;
-		for ( int i = 0; i < pa->size(); i++ )
-			if ( (*pa)[i] != 0 ) {
-				InitUnspooler rec;
-				(*pa)[i]->accept( rec );
-				assert( rec.get_initializer() != 0 );
-				contents.push_back( rec.grab_initializer() );
-			} // if
-
-		std::list< Expression * > desig;
-		init = new ListInit( contents, desig, false ); // cannot be constructed
-		return;
-	}
-} // namespace InitTweak
-
-// Local Variables: //
-// tab-width: 4 //
-// mode: c++ //
-// compile-command: "make install" //
-// End: //
Index: src/InitTweak/InitModel.h
===================================================================
--- src/InitTweak/InitModel.h	(revision 9b4c936ccc92263445f7d8482d370551639e0f1f)
+++ 	(revision )
@@ -1,132 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// InitModel.h -- 
-//
-// Author           : Rodolfo G. Esteves
-// Created On       : Mon May 18 07:44:20 2015
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Tue May 19 16:37:52 2015
-// Update Count     : 2
-//
-
-#ifndef _INITTWEAK_MODEL_H_
-#define _INITTWEAK_MODEL_H_
-
-#include "Association.h"
-#include "Common/SemanticError.h"
-#include "SynTree/Visitor.h"
-
-#include "SynTree/Initializer.h"
-#include "SynTree/Declaration.h"
-#include "SynTree/Expression.h"
-#include "SynTree/Type.h"
-
-namespace InitTweak {
-	class InitModelBuilder : public AssociationBuilder, public Visitor {
-	  public:
-		InitModelBuilder( Declaration * );
-		~InitModelBuilder();
-
-		virtual Association *grab_assoc() { taken = true; return building; }
-		virtual Association *get_assoc() { return building; }
-		void set_assoc( Association *newAssoc ) { building = newAssoc; }
-
-		void init();
-		static int interpretDimension( Expression *exp ) {
-			ConstantFolder folder( exp );
-			try {
-				return folder.get_constant();
-			} catch (...) {
-				throw SemanticError("Invalid array dimension");
-			}
-		}
-
-		// types
-		virtual void visit( ArrayType * );
-		virtual void visit( StructInstType * );
-		virtual void visit( UnionInstType * );
-		virtual void visit( EnumInstType * );
-		virtual void visit( ContextInstType * ) { throw 0; }
-		virtual void visit( TypeInstType * )    { throw 0; }
-		// virtual void visit( TupleType *tupleType );
-		// declarations
-		virtual void visit( StructDecl *);
-		virtual void visit( UnionDecl *);
-		virtual void visit( EnumDecl *);
-	  private:
-		class ConstantFolder : public Visitor {
-		  public:
-			ConstantFolder( Expression *_expr = 0 ): expr(_expr) {}
-			int get_constant() throw() { expr->accept( *this ); return value; }
-			void set_constant( Expression *newExp ) { expr = newExp; }
-			// Visitor interface
-			void visit( Expression * ) { throw 0; }
-			void visit( NameExpr * ) { throw 0; }
-			void visit( CastExpr * ) { throw 0; }
-			void visit( UntypedMemberExpr * ) { throw 0; }
-			void visit( VariableExpr * ) { throw 0; }
-			void visit( ConstantExpr * );
-			void visit( SizeofExpr * ) { throw 0; }
-			void visit( AlignofExpr * ) { throw 0; }
-			void visit( UntypedOffsetofExpr * ) { throw 0; }
-			void visit( OffsetofExpr * ) { throw 0; }
-			void visit( OffsetPackExpr * ) { throw 0; }
-			void visit( AttrExpr * ) { throw 0; }
-			void visit( LogicalExpr * ) { throw 0; }
-			void visit( ConditionalExpr * ) { throw 0; }
-			void visit( CommaExpr * ) { throw 0; }
-		  private:
-			Expression *expr;
-			int value;
-		};
-
-		bool taken;
-		Declaration *decl;  // ?
-		Association *building;
-	};
-
-	class InitModelFiller : public AssociationFiller, public Visitor {
-	  public:
-		InitModelFiller( Association *, Initializer *, bool _topLevel = false );
-		~InitModelFiller() { /* pointers in here are not owned by object (never created by object either) */ }
-		virtual Association *get_assoc() { return model; }
-		virtual void set_assoc( Association *newAssoc ) { model = newAssoc; }
-
-		void init();
-		// Visitor interface
-		virtual void visit( SingleInit *singleInit );
-		virtual void visit( ListInit *listInit );
-	  private:
-		Association *model;
-		Initializer *orgInit;
-		bool topLevel;
-		long int next;
-	};
-
-	class InitUnspooler : public AssociationVisitor {
-	  public:
-		InitUnspooler() : init(0), taken( false ) {}
-		virtual ~InitUnspooler() { if ( ! taken && (init != 0)) { delete init; init = 0; } }
-		Initializer *get_initializer() { return init; }
-		Initializer *grab_initializer() { taken = true; return init; }
-
-		virtual void visit( SingleName * );
-		virtual void visit( PointAssociation * );
-		virtual void visit( RangeAssociation * ) { std::cerr << "InitUnspooler - In a range assoc" << std::endl; return; }
-	  private:
-		Initializer *init;
-		bool taken;
-	};
-} // namespace InitTweak
-
-#endif // _INITTWEAK_MODEL_H_
-
-// Local Variables: //
-// tab-width: 4 //
-// mode: c++ //
-// compile-command: "make install" //
-// End: //
Index: src/InitTweak/Mutate.cc
===================================================================
--- src/InitTweak/Mutate.cc	(revision 9b4c936ccc92263445f7d8482d370551639e0f1f)
+++ 	(revision )
@@ -1,39 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// Mutate.cc --
-//
-// Author           : Rodolfo G. Esteves
-// Created On       : Mon May 18 07:44:20 2015
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Tue May 19 16:38:19 2015
-// Update Count     : 1
-//
-
-#include "SynTree/Mutator.h"
-
-#include "Mutate.h"
-//#include "BasicInit.h"
-//#include "DeclarationHoister.h"
-//#include "NameCollector.h"
-
-namespace InitTweak {
-	void mutate( std::list< Declaration * > translationUnit ) {
-		//BasicInit bi;
-		InitExpander ini;
-		//DeclarationHoister dh;
-
-		//mutateAll( translationUnit, bi );
-		mutateAll( translationUnit, ini );
-		//mutateAll( translationUnit, dh );
-	}
-} // namespace InitTweak
-
-// Local Variables: //
-// tab-width: 4 //
-// mode: c++ //
-// compile-command: "make install" //
-// End: //
Index: src/InitTweak/Mutate.h
===================================================================
--- src/InitTweak/Mutate.h	(revision 9b4c936ccc92263445f7d8482d370551639e0f1f)
+++ 	(revision )
@@ -1,33 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// Mutate.h -- 
-//
-// Author           : Rodolfo G. Esteves
-// Created On       : Mon May 18 07:44:20 2015
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Tue May 19 16:38:52 2015
-// Update Count     : 2
-//
-
-#ifndef INIT_MUTATE_H
-#define INIT_MUTATE_H
-
-#include <list>
-
-#include "SynTree/Declaration.h"
-
-namespace InitTweak {
-	void mutate( std::list< Declaration* > translationUnit );
-} // namespace InitTweak
-
-#endif // INIT_MUTATE_H
-
-// Local Variables: //
-// tab-width: 4 //
-// mode: c++ //
-// compile-command: "make install" //
-// End: //
Index: src/InitTweak/diet_map.h
===================================================================
--- src/InitTweak/diet_map.h	(revision 9b4c936ccc92263445f7d8482d370551639e0f1f)
+++ 	(revision )
@@ -1,220 +1,0 @@
-//
-// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// diet_map.h -- 
-//
-// Author           : Rodolfo G. Esteves
-// Created On       : Mon May 18 07:44:20 2015
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Tue May 19 16:41:17 2015
-// Update Count     : 2
-//
-
-#include <cassert>
-#include <string>
-#include <stack>
-
-namespace diet {
-	/* A DIET ( Discrete Interval Encoding Tree ) range-map
-	 */
-
-	class diet_tree_exception : public std::exception {
-	  public:
-		diet_tree_exception() {}
-		diet_tree_exception( std::string _what ) : what( _what ) {}
-		~diet_tree_exception() throw () {}
-
-		std::string get_what() const { return what; }
-		void set_what( std::string newValue ) { what = newValue; }
-	  private:
-		std::string what;
-	};
-
-	template < typename T > class diet_tree_node;
-	template < typename T > class diet_tree_iterator;
-
-	template< typename key_type >
-	class diet_tree {
-		typedef key_type OrderedValue;
-		typedef OrderedValue T;
-		friend class diet_tree_iterator<T>;
-	  public:
-		typedef OrderedValue value_type;
-		typedef diet_tree_iterator<OrderedValue> iterator;
-		typedef std::pair<value_type, value_type> pair_type;
-
-		diet_tree() : root(0), left(0), right(0) {}
-		~diet_tree() {
-			if ( root != 0 ) { delete root; root = 0; }
-			if ( left != 0 ) { delete left; left = 0; }
-			if ( right != 0 ) { delete right; right = 0; }
-		}
-
-		void insert( value_type _lo, value_type _hi ) {
-			if ( _lo > _hi ) return; // throw exception?
-			if ( root == 0 )
-				root = new diet_tree_node<value_type>(_lo, _hi);
-			else {
-				value_type lo = root->get_lo(), hi = root->get_hi();
-				if ( _lo < lo ) {
-					if ( _hi > hi ) {
-						/* can either minimize the work or minimize the number of nodes.
-						   Let's minimize the work. */
-						if ( left == 0 ) left = new diet_tree<T>();
-						left->insert( _lo, lo );
-						if ( right == 0 ) right = new diet_tree<T>();
-						right->insert( _hi, hi );
-						return;
-					} else if ( _hi < lo ) {
-						if ( left == 0 ) left = new diet_tree<T>();
-						left->insert( _lo, _hi );
-					} else if ( _hi <= hi ) {
-						if ( left == 0 ) left = new diet_tree<T>();
-						left->insert( _lo, _hi );
-						root->set_range(_hi,hi);
-					}
-				} else if (_lo >= lo && _hi <= hi ) {
-					root->set_range(_lo,_hi);
-				} else if ( _hi > hi) {
-					if ( _lo > hi ) {
-						if ( right == 0 ) right = new diet_tree<T>();
-						right->insert( _lo, _hi );
-					} else if ( _lo < hi ) {
-						root->set_range(lo, _lo);
-						if ( right == 0 ) right = new diet_tree<T>();
-						right->insert(_lo, _hi);
-					} // if
-				} // if
-			} // if
-			return;
-		}
-
-		void insert( std::pair<value_type, value_type> p ) {
-			insert(p.first, p.second);
-		}
-
-		pair_type get_range_pair() const {
-			return pair_type(root->get_lo(),root->get_hi());
-		}
-
-		/*
-		  void display( std::ostream &os = std::cout ) {
-		  if ( root != 0 ) {
-		  if ( left != 0 ) left->display(os);
-		  os << "(" << root->get_lo() << ", " << root->get_hi() << ")" << std::endl;
-		  if ( right != 0 ) right->display(os);
-		  }
-		  return;
-		  }
-		*/
-
-		iterator begin() { return iterator( this ); }
-		iterator end() { return iterator( (diet_tree< value_type > *)0 ); }
-
-	  protected:
-		diet_tree( diet_tree_node< OrderedValue > *_root ) : root( _root ) {}
-	  private:
-		diet_tree_node< value_type > *root;
-		diet_tree< value_type > *left, *right;
-	};
-
-	template< typename OrderedValue >
-	class diet_tree_node {
-	  public:
-		typedef OrderedValue value_type;
-
-		diet_tree_node( const OrderedValue &_lo, const OrderedValue &_hi )
-			: lo( _lo ), hi( _hi ) {
-			if ( lo >= hi ) throw diet_tree_exception( "Invalid range" );
-		}
-
-		void set_range(const OrderedValue &newLo, const OrderedValue &newHi)
-			{ lo = newLo; hi = newHi; }
-		OrderedValue get_lo() const { return lo; }
-		OrderedValue get_hi() const { return hi; }
-
-	  private:
-		OrderedValue lo, hi;
-	};
-
-	/* forward iterator */
-	template < typename T >
-	class diet_tree_iterator {
-		typedef diet_tree_iterator<T> self;
-		typedef typename diet_tree<T>::pair_type pair_type;
-
-	  public:
-		//    typedef forward_iterator_tag iterator_category;
-
-		diet_tree_iterator( diet_tree<T> *_tree ) : current( _tree ) {
-			// current is allowed to be 0 only for `end'
-			if (_tree != 0) go_leftmost();
-		}
-
-		~diet_tree_iterator() {}
-		pair_type operator*() {
-			if ( current == 0 ) throw diet_tree_exception( "Invalid dereference" );
-			return current->get_range_pair();
-		}
-
-		bool operator==( const diet_tree_iterator<T> &other ) { return current == other.current;  }
-		bool operator!=( const diet_tree_iterator<T> &other ) { return current != other.current;  }
-
-		diet_tree_iterator<T> operator++() {
-			assert(current != 0);
-			if ( current->right == 0 )
-				if ( ! st.empty() )
-					{ current = st.top(); st.pop(); }
-				else
-					current = 0;
-			else {
-				current = current->right;
-				go_leftmost();
-			} // if
-			return *this;
-		}
-
-		diet_tree_iterator<T> operator++(int) {
-			self temp = *this;
-			this->operator++();
-			return temp;
-		}
-
-	  private:
-		void go_leftmost() {
-			assert(current != 0);
-			diet_tree<T> *next = 0;
-			while ( current->left != 0 ) {
-				next = current->left; st.push( current ); current = next;
-			}
-			return;
-		}
-
-		void defrag() {
-			/* join adjacent trees */
-			return;
-		}
-
-		diet_tree<T> *current;
-		std::stack< diet_tree<T> * > st;
-	};
-
-	template < typename Key, typename Value >
-	class diet_tree_assoc_node : public diet_tree_node<Key> {
-	  public:
-		typedef Key key_type;
-		typedef Value data_type;
-		typedef std::pair<Key,Value> value_type;
-	  private:
-		Value data;
-	};
-} // namespace diet
-
-// Local Variables: //
-// tab-width: 4 //
-// mode: c++ //
-// compile-command: "make install" //
-// End: //
