Index: src/CodeGen/CodeGenerator.cc
===================================================================
--- src/CodeGen/CodeGenerator.cc	(revision de62360d1d2709386152807b3d18e159e241ab1f)
+++ src/CodeGen/CodeGenerator.cc	(revision 94e0864d381ec34e8e25850109ea127ff29efbca)
@@ -9,7 +9,7 @@
 // Author           : Richard C. Bilson
 // Created On       : Mon May 18 07:44:20 2015
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Tue Jun 23 16:16:57 2015
-// Update Count     : 133
+// Last Modified By : Rob Schluntz
+// Last Modified On : Wed Jun 24 16:11:41 2015
+// Update Count     : 143
 //
 
@@ -44,13 +44,21 @@
 	}
 
-	CodeGenerator::CodeGenerator( std::ostream &os ) : cur_indent( 0 ), insideFunction( false ), output( os ) { }
-
-	CodeGenerator::CodeGenerator( std::ostream &os, std::string init, int indent, bool infunp )
-			: cur_indent( indent ), insideFunction( infunp ), output( os ) {
+	ostream & CodeGenerator::Indenter::operator()( ostream & output ) {
+	  return output << string( cg.cur_indent, ' ' );
+	}
+
+	ostream & operator<<( ostream & output, CodeGenerator::Indenter &indent ) {
+		return indent( output );
+	}
+
+	CodeGenerator::CodeGenerator( std::ostream &os ) : indent(*this), cur_indent( 0 ), insideFunction( false ), output( os ) { }
+
+	CodeGenerator::CodeGenerator( std::ostream &os, std::string init, int indentation, bool infunp )
+			: indent(*this), cur_indent( indentation ), insideFunction( infunp ), output( os ) {
 		//output << std::string( init );
 	}
 
-	CodeGenerator::CodeGenerator( std::ostream &os, char *init, int indent, bool infunp )
-			: cur_indent( indent ), insideFunction( infunp ), output( os ) {
+	CodeGenerator::CodeGenerator( std::ostream &os, char *init, int indentation, bool infunp )
+			: indent(*this), cur_indent( indentation ), insideFunction( infunp ), output( os ) {
 		//output << std::string( init );
 	}
@@ -63,5 +71,5 @@
 		} // if
 	}
-  
+
 	//*** Declarations
 	void CodeGenerator::visit( FunctionDecl *functionDecl ) {
@@ -108,9 +116,9 @@
 
 		if ( ! memb.empty() ) {
-			output << endl << string( cur_indent, ' ' ) << "{" << endl;
+			output << " {" << endl;
 
 			cur_indent += CodeGenerator::tabsize; 
 			for ( std::list< Declaration* >::iterator i = memb.begin(); i != memb.end();  i++) {
-				output << string( cur_indent, ' ' ); 
+				output << indent; 
 				(*i)->accept(*this );
 				output << ";" << endl;
@@ -119,5 +127,5 @@
 			cur_indent -= CodeGenerator::tabsize; 
 
-			output << string( cur_indent, ' ' ) << "}";
+			output << indent << "}";
 		} // if
 	}
@@ -142,5 +150,5 @@
 
 		if ( ! memb.empty() ) {
-			output << endl << "{" << endl;
+			output << " {" << endl;
 
 			cur_indent += CodeGenerator::tabsize; 
@@ -148,5 +156,5 @@
 				ObjectDecl *obj = dynamic_cast< ObjectDecl* >( *i );
 				assert( obj );
-				output << string( cur_indent, ' ' ) << mangleName( obj ); 
+				output << indent << mangleName( obj ); 
 				if ( obj->get_init() ) {
 					output << " = ";
@@ -158,5 +166,5 @@
 			cur_indent -= CodeGenerator::tabsize; 
 
-			output << "}" << endl;
+			output << indent << "}";
 		} // if
 	}
@@ -449,5 +457,5 @@
 
 		for ( std::list<Statement *>::iterator i = ks.begin(); i != ks.end();  i++) {
-			output << string( cur_indent, ' ' ) << printLabels( (*i)->get_labels() );
+			output << indent << printLabels( (*i)->get_labels() );
 			(*i)->accept(*this );
 
@@ -459,5 +467,5 @@
 		cur_indent -= CodeGenerator::tabsize; 
 
-		output << string( cur_indent, ' ' ) << "}";
+		output << indent << "}";
 	}
 
@@ -499,9 +507,9 @@
 		cur_indent -= CodeGenerator::tabsize;
 
-		output << string( cur_indent, ' ' ) << "}";
+		output << indent << "}";
 	}
 
 	void CodeGenerator::visit( CaseStmt *caseStmt ) {
-		output << string( cur_indent, ' ' );
+		output << indent;
 		if ( caseStmt->isDefault()) {
 			output << "default";
@@ -516,5 +524,5 @@
 		cur_indent += CodeGenerator::tabsize;
 		for ( std::list<Statement *>::iterator i = sts.begin(); i != sts.end();  i++) {
-			output << string( cur_indent, ' ' ) << printLabels( (*i)->get_labels() )  ;
+			output << indent << printLabels( (*i)->get_labels() )  ;
 			(*i)->accept(*this );
 			output << endl;
@@ -569,5 +577,5 @@
 		whileStmt->get_body()->accept( *this );
 
-		output << string( cur_indent, ' ' );
+		output << indent;
 
 		if ( whileStmt->get_isDoWhile() ) {
@@ -601,5 +609,5 @@
 
 	void CodeGenerator::visit( NullStmt *nullStmt ) {
-		//output << string( cur_indent, ' ' ) << CodeGenerator::printLabels( nullStmt->get_labels() );
+		//output << indent << CodeGenerator::printLabels( nullStmt->get_labels() );
 		output << "/* null statement */ ;";
 	}
