Index: src/CodeGen/CodeGenerator.cc
===================================================================
--- src/CodeGen/CodeGenerator.cc	(revision a12d5aaf574b9eda122e096ee19ea16b8f778731)
+++ src/CodeGen/CodeGenerator.cc	(revision f7cb0bc76af10982d6f4f34f060acc53a8dc27f9)
@@ -66,12 +66,4 @@
 	} // extension
 
-	ostream & CodeGenerator::Indenter::operator()( ostream & output ) const {
-	  return output << string( cg.cur_indent, ' ' );
-	}
-
-	ostream & operator<<( ostream & output, const CodeGenerator::Indenter &indent ) {
-		return indent( output );
-	}
-
 	CodeGenerator::LabelPrinter & CodeGenerator::LabelPrinter::operator()( std::list< Label > & l ) {
 		labels = &l;
@@ -111,5 +103,5 @@
 	}
 
-	CodeGenerator::CodeGenerator( std::ostream & os, bool pretty, bool genC, bool lineMarks ) : indent( *this), cur_indent( 0 ), insideFunction( false ), output( os ), printLabels( *this ), pretty( pretty ), genC( genC ), lineMarks( lineMarks ) {}
+	CodeGenerator::CodeGenerator( std::ostream & os, bool pretty, bool genC, bool lineMarks ) : indent( CodeGenerator::tabsize ), insideFunction( false ), output( os ), printLabels( *this ), pretty( pretty ), genC( genC ), lineMarks( lineMarks ) {}
 
 	string CodeGenerator::mangleName( DeclarationWithType * decl ) {
@@ -202,5 +194,5 @@
 			output << " {" << endl;
 
-			cur_indent += CodeGenerator::tabsize;
+			++indent;
 			for ( std::list< Declaration* >::iterator i = memb.begin(); i != memb.end(); i++ ) {
 				output << lineDirective( *i ) << indent;
@@ -209,5 +201,5 @@
 			} // for
 
-			cur_indent -= CodeGenerator::tabsize;
+			--indent;
 
 			output << indent << "}";
@@ -239,5 +231,5 @@
 			output << " {" << endl;
 
-			cur_indent += CodeGenerator::tabsize;
+			++indent;
 			for ( std::list< Declaration* >::iterator i = memb.begin(); i != memb.end();  i++) {
 				ObjectDecl * obj = dynamic_cast< ObjectDecl* >( *i );
@@ -251,5 +243,5 @@
 			} // for
 
-			cur_indent -= CodeGenerator::tabsize;
+			--indent;
 
 			output << indent << "}";
@@ -755,5 +747,5 @@
 		std::list< Statement * > & stmts = stmtExpr->get_statements()->get_kids();
 		output << lineDirective( stmtExpr) << "({" << std::endl;
-		cur_indent += CodeGenerator::tabsize;
+		++indent;
 		unsigned int numStmts = stmts.size();
 		unsigned int i = 0;
@@ -778,5 +770,5 @@
 			++i;
 		}
-		cur_indent -= CodeGenerator::tabsize;
+		--indent;
 		output << indent << "})";
 	}
@@ -787,5 +779,5 @@
 		output << "{" << endl;
 
-		cur_indent += CodeGenerator::tabsize;
+		++indent;
 
 		for ( std::list<Statement *>::iterator i = ks.begin(); i != ks.end();  i++ ) {
@@ -798,5 +790,5 @@
 			} // if
 		} // for
-		cur_indent -= CodeGenerator::tabsize;
+		--indent;
 
 		output << indent << "}";
@@ -866,7 +858,7 @@
 
 		output << "{" << std::endl;
-		cur_indent += CodeGenerator::tabsize;
+		++indent;
 		acceptAll( switchStmt->get_statements(), *this );
-		cur_indent -= CodeGenerator::tabsize;
+		--indent;
 		output << indent << "}";
 	}
@@ -885,5 +877,5 @@
 		std::list<Statement *> sts = caseStmt->get_statements();
 
-		cur_indent += CodeGenerator::tabsize;
+		++indent;
 		for ( std::list<Statement *>::iterator i = sts.begin(); i != sts.end();  i++) {
 			output << indent << printLabels( (*i)->get_labels() )  ;
@@ -891,5 +883,5 @@
 			output << endl;
 		} // for
-		cur_indent -= CodeGenerator::tabsize;
+		--indent;
 	}
 
Index: src/CodeGen/CodeGenerator.h
===================================================================
--- src/CodeGen/CodeGenerator.h	(revision a12d5aaf574b9eda122e096ee19ea16b8f778731)
+++ src/CodeGen/CodeGenerator.h	(revision f7cb0bc76af10982d6f4f34f060acc53a8dc27f9)
@@ -25,4 +25,5 @@
 #include "SymTab/Indexer.h"
 
+#include "Common/Indenter.h"
 #include "Common/utility.h"
 
@@ -102,10 +103,4 @@
 		template< class Iterator > void genCommaList( Iterator begin, Iterator end );
 
-		struct Indenter {
-			Indenter(CodeGenerator &cg) : cg(cg) {}
-			CodeGenerator & cg;
-			std::ostream& operator()(std::ostream & os) const;
-		};
-
 		struct LabelPrinter {
 			LabelPrinter(CodeGenerator &cg) : cg(cg), labels( 0 ) {}
@@ -130,5 +125,4 @@
 	  private:
 		Indenter indent;
-		int cur_indent;
 		bool insideFunction;
 		std::ostream &output;
