Index: translator/CodeGen/CodeGenerator2.cc
===================================================================
--- translator/CodeGen/CodeGenerator2.cc	(revision d9a0e763800888addddd70d8848a8f432b825e4b)
+++ translator/CodeGen/CodeGenerator2.cc	(revision 17cd4ebabb684710b2f3698449093c4e84b8fb70)
@@ -20,696 +20,630 @@
 
 namespace CodeGen {
-
-  int CodeGenerator2::tabsize = 4;
-
-  CodeGenerator2::CodeGenerator2( std::ostream &os ) : cur_indent( 0 ), insideFunction( false ), before(os), after() { }
-
-  CodeGenerator2::CodeGenerator2(std::ostream &os, std::string init, int indent, bool infunp )
-    : cur_indent( indent ), insideFunction( infunp ), before(os), after()
-  {
-    //before << std::string( init );
-  }
-
-  CodeGenerator2::CodeGenerator2(std::ostream &os, char *init, int indent, bool infunp )
-    : cur_indent( indent ), insideFunction( infunp ), before(os), after()
-  {
-    //before << std::string( init );
-  }
-
-  CodeGenerator2::~CodeGenerator2() {
-    after.freeze( false );
-  }
-
-  string
-  mangleName( DeclarationWithType *decl ) {
-    if( decl->get_mangleName() != "" ) {
-      return decl->get_mangleName();
-    } else {
-      return decl->get_name();
-    }
-  }
-  
-  //*** Declarations
-  void CodeGenerator2::visit(FunctionDecl *functionDecl){
-  
-    handleStorageClass( functionDecl );
-    before << genType( functionDecl->get_functionType(), mangleName( functionDecl ) );
-
-    // how to get this to the Functype?
-    std::list< Declaration * > olds = functionDecl->get_oldDecls();
-    if( ! olds.empty() ) {
-      before << " /* function has old declaration */";
-    }
-
-    // acceptAll( functionDecl->get_oldDecls(), *this );
-    if( functionDecl->get_statements() ) {
-      functionDecl->get_statements()->accept(*this);
-    }
-  }
-
-  void CodeGenerator2::visit(ObjectDecl *objectDecl){
-
-    handleStorageClass( objectDecl );
-    before << genType( objectDecl->get_type(), mangleName( objectDecl ) );
+    int CodeGenerator2::tabsize = 4;
+
+    CodeGenerator2::CodeGenerator2( std::ostream &os ) : cur_indent( 0 ), insideFunction( false ), before( os ), after() { }
+
+    CodeGenerator2::CodeGenerator2( std::ostream &os, std::string init, int indent, bool infunp )
+	: cur_indent( indent ), insideFunction( infunp ), before( os )
+    {
+	//before << std::string( init );
+    }
+
+    CodeGenerator2::CodeGenerator2( std::ostream &os, char *init, int indent, bool infunp )
+	: cur_indent( indent ), insideFunction( infunp ), before( os )
+    {
+	//before << std::string( init );
+    }
+
+    string mangleName( DeclarationWithType *decl ) {
+	if ( decl->get_mangleName() != "" ) {
+	    return decl->get_mangleName();
+	} else {
+	    return decl->get_name();
+	} // if
+    }
+  
+    //*** Declarations
+    void CodeGenerator2::visit( FunctionDecl *functionDecl ) {
+	handleStorageClass( functionDecl );
+	before << genType( functionDecl->get_functionType(), mangleName( functionDecl ) );
+
+	// how to get this to the Functype?
+	std::list< Declaration * > olds = functionDecl->get_oldDecls();
+	if ( ! olds.empty() ) {
+	    before << " /* function has old declaration */";
+	} // if
+
+	// acceptAll( functionDecl->get_oldDecls(), *this );
+	if ( functionDecl->get_statements() ) {
+	    functionDecl->get_statements()->accept(*this );
+	} // if
+    }
+
+    void CodeGenerator2::visit( ObjectDecl *objectDecl ) {
+	handleStorageClass( objectDecl );
+	before << genType( objectDecl->get_type(), mangleName( objectDecl ) );
     
-    if( objectDecl->get_init() ) {
-      before << " = ";
-      objectDecl->get_init()->accept( *this );
-    }
-    if( objectDecl->get_bitfieldWidth() ) {
-      before << ":";
-      objectDecl->get_bitfieldWidth()->accept( *this );
-    }
-  }
-
-  void
-  CodeGenerator2::handleAggregate( AggregateDecl *aggDecl )
-  {
-    if ( aggDecl->get_name() != "" )
-      before << aggDecl->get_name();
+	if ( objectDecl->get_init() ) {
+	    before << " = ";
+	    objectDecl->get_init()->accept( *this );
+	} // if
+	if ( objectDecl->get_bitfieldWidth() ) {
+	    before << ":";
+	    objectDecl->get_bitfieldWidth()->accept( *this );
+	} // if
+    }
+
+    void CodeGenerator2::handleAggregate( AggregateDecl *aggDecl ) {
+	if ( aggDecl->get_name() != "" )
+	    before << aggDecl->get_name();
     
-    std::list< Declaration * > &memb = aggDecl->get_members();
-
-    if( ! memb.empty() ){
-      before << endl << string(cur_indent, ' ') << "{" << endl;
-
-      cur_indent += CodeGenerator2::tabsize; 
-      for(std::list< Declaration* >::iterator i = memb.begin(); i != memb.end();  i++){
-	before << string(cur_indent, ' '); 
-	(*i)->accept(*this);
-	before << ";" << endl;
-      }
-
-      cur_indent -= CodeGenerator2::tabsize; 
-
-      before << string(cur_indent, ' ') << "}";
-    }
-  }
-
-  void CodeGenerator2::visit( StructDecl *structDecl ){
-    before << "struct ";
-    handleAggregate( structDecl );
-  }
-
-  void 
-  CodeGenerator2::visit(UnionDecl *aggregateDecl)
-  {
-    before << "union ";
-    handleAggregate( aggregateDecl );
-  }
-  
-  void 
-  CodeGenerator2::visit(EnumDecl *aggDecl)
-  {
-    before << "enum ";
-
-    if ( aggDecl->get_name() != "" )
-      before << aggDecl->get_name();
+	std::list< Declaration * > &memb = aggDecl->get_members();
+
+	if ( ! memb.empty() ) {
+	    before << endl << string( cur_indent, ' ' ) << "{" << endl;
+
+	    cur_indent += CodeGenerator2::tabsize; 
+	    for ( std::list< Declaration* >::iterator i = memb.begin(); i != memb.end();  i++) {
+		before << string( cur_indent, ' ' ); 
+		(*i)->accept(*this );
+		before << ";" << endl;
+	    }
+
+	    cur_indent -= CodeGenerator2::tabsize; 
+
+	    before << string( cur_indent, ' ' ) << "}";
+	} // if
+    }
+
+    void CodeGenerator2::visit( StructDecl *structDecl ) {
+	before << "struct ";
+	handleAggregate( structDecl );
+    }
+
+    void CodeGenerator2::visit( UnionDecl *aggregateDecl ) {
+	before << "union ";
+	handleAggregate( aggregateDecl );
+    }
+  
+    void CodeGenerator2::visit( EnumDecl *aggDecl ) {
+	before << "enum ";
+
+	if ( aggDecl->get_name() != "" )
+	    before << aggDecl->get_name();
     
-    std::list< Declaration* > &memb = aggDecl->get_members();
-
-    if( ! memb.empty() ){
-      before << endl << "{" << endl;
-
-      cur_indent += CodeGenerator2::tabsize; 
-      for(std::list< Declaration* >::iterator i = memb.begin(); i != memb.end();  i++){
-        ObjectDecl *obj = dynamic_cast< ObjectDecl* >( *i );
-        assert( obj );
-	before << string(cur_indent, ' ') << mangleName( obj ); 
-	if( obj->get_init() ) {
-	  before << " = ";
-	  obj->get_init()->accept(*this);
+	std::list< Declaration* > &memb = aggDecl->get_members();
+
+	if ( ! memb.empty() ) {
+	    before << endl << "{" << endl;
+
+	    cur_indent += CodeGenerator2::tabsize; 
+	    for ( std::list< Declaration* >::iterator i = memb.begin(); i != memb.end();  i++) {
+		ObjectDecl *obj = dynamic_cast< ObjectDecl* >( *i );
+		assert( obj );
+		before << string( cur_indent, ' ' ) << mangleName( obj ); 
+		if ( obj->get_init() ) {
+		    before << " = ";
+		    obj->get_init()->accept(*this );
+		} // if
+		before << "," << endl;
+	    }
+
+	    cur_indent -= CodeGenerator2::tabsize; 
+
+	    before << "}" << endl;
+	} // if
+    }
+  
+    void CodeGenerator2::visit( ContextDecl *aggregateDecl ) {}
+  
+    void CodeGenerator2::visit( TypedefDecl *typeDecl ) {
+	before << "typedef ";
+	before << genType( typeDecl->get_base(), typeDecl->get_name() );
+    }
+  
+    void CodeGenerator2::visit( TypeDecl *typeDecl ) {
+	// really, we should mutate this into something that isn't a TypeDecl but that requires large-scale changes,
+	// still to be done
+	before << "extern unsigned long " << typeDecl->get_name();
+	if ( typeDecl->get_base() ) {
+	    before << " = sizeof( " << genType( typeDecl->get_base(), "" ) << " )";
+	} // if
+    }
+
+    void CodeGenerator2::visit( SingleInit *init ) {
+	init->get_value()->accept( *this );
+    }
+
+    void CodeGenerator2::visit( ListInit *init ) {
+	before << "{ ";
+	genCommaList( init->begin_initializers(), init->end_initializers() );
+	before << " }";
+    }
+
+    void CodeGenerator2::visit( Constant *constant ) { 
+	before << constant->get_value() ;
+    }
+
+    //*** Expressions
+    void CodeGenerator2::visit( ApplicationExpr *applicationExpr ) {
+	if ( VariableExpr *varExpr = dynamic_cast< VariableExpr* >( applicationExpr->get_function() ) ) {
+	    OperatorInfo opInfo;
+	    if ( varExpr->get_var()->get_linkage() == LinkageSpec::Intrinsic && operatorLookup( varExpr->get_var()->get_name(), opInfo ) ) {
+		std::list< Expression* >::iterator arg = applicationExpr->get_args().begin();
+		switch ( opInfo.type ) {
+		  case OT_PREFIXASSIGN:
+		  case OT_POSTFIXASSIGN:
+		  case OT_INFIXASSIGN:
+		    {
+			assert( arg != applicationExpr->get_args().end() );
+			if ( AddressExpr *addrExpr = dynamic_cast< AddressExpr * >( *arg ) ) {
+            
+			    *arg = addrExpr->get_arg();
+			} else {
+			    UntypedExpr *newExpr = new UntypedExpr( new NameExpr( "*?" ) );
+			    newExpr->get_args().push_back( *arg );
+			    *arg = newExpr;
+			} // if
+			break;
+		    }
+          
+		  default:
+		    // do nothing
+		    ;
+		}
+        
+		switch ( opInfo.type ) {
+		  case OT_INDEX:
+		    assert( applicationExpr->get_args().size() == 2 );
+		    (*arg++)->accept( *this );
+		    before << "[";
+		    (*arg)->accept( *this );
+		    before << "]";
+		    break;
+          
+		  case OT_CALL:
+		    // there are no intrinsic definitions of the function call operator
+		    assert( false );
+		    break;
+          
+		  case OT_PREFIX:
+		  case OT_PREFIXASSIGN:
+		    assert( applicationExpr->get_args().size() == 1 );
+		    before << "(";
+		    before << opInfo.symbol;
+		    (*arg)->accept( *this );
+		    before << ")";
+		    break;
+          
+		  case OT_POSTFIX:
+		  case OT_POSTFIXASSIGN:
+		    assert( applicationExpr->get_args().size() == 1 );
+		    (*arg)->accept( *this );
+		    before << opInfo.symbol;
+		    break;
+
+		  case OT_INFIX:
+		  case OT_INFIXASSIGN:
+		    assert( applicationExpr->get_args().size() == 2 );
+		    before << "(";
+		    (*arg++)->accept( *this );
+		    before << opInfo.symbol;
+		    (*arg)->accept( *this );
+		    before << ")";
+		    break;
+          
+		  case OT_CONSTANT:
+		    // there are no intrinsic definitions of 0 or 1 as functions
+		    assert( false );
+		}
+	    } else {
+		varExpr->accept( *this );
+		before << "(";
+		genCommaList( applicationExpr->get_args().begin(), applicationExpr->get_args().end() );
+		before << ")";
+	    } // if
+	} else {
+	    applicationExpr->get_function()->accept( *this );
+	    before << "(";
+	    genCommaList( applicationExpr->get_args().begin(), applicationExpr->get_args().end() );
+	    before << ")";
+	} // if
+    }
+  
+    void CodeGenerator2::visit( UntypedExpr *untypedExpr ) {
+	if ( NameExpr *nameExpr = dynamic_cast< NameExpr* >( untypedExpr->get_function() ) ) {
+	    OperatorInfo opInfo;
+	    if ( operatorLookup( nameExpr->get_name(), opInfo ) ) {
+		std::list< Expression* >::iterator arg = untypedExpr->get_args().begin();
+		switch ( opInfo.type ) {
+		  case OT_INDEX:
+		    assert( untypedExpr->get_args().size() == 2 );
+		    (*arg++)->accept( *this );
+		    before << "[";
+		    (*arg)->accept( *this );
+		    before << "]";
+		    break;
+          
+		  case OT_CALL:
+		    assert( false );
+		    break;
+          
+		  case OT_PREFIX:
+		  case OT_PREFIXASSIGN:
+		    assert( untypedExpr->get_args().size() == 1 );
+		    before << "(";
+		    before << opInfo.symbol;
+		    (*arg)->accept( *this );
+		    before << ")";
+		    break;
+          
+		  case OT_POSTFIX:
+		  case OT_POSTFIXASSIGN:
+		    assert( untypedExpr->get_args().size() == 1 );
+		    (*arg)->accept( *this );
+		    before << opInfo.symbol;
+		    break;
+  
+		  case OT_INFIX:
+		  case OT_INFIXASSIGN:
+		    assert( untypedExpr->get_args().size() == 2 );
+		    before << "(";
+		    (*arg++)->accept( *this );
+		    before << opInfo.symbol;
+		    (*arg)->accept( *this );
+		    before << ")";
+		    break;
+          
+		  case OT_CONSTANT:
+		    // there are no intrinsic definitions of 0 or 1 as functions
+		    assert( false );
+		}
+	    } else {
+		nameExpr->accept( *this );
+		before << "(";
+		genCommaList( untypedExpr->get_args().begin(), untypedExpr->get_args().end() );
+		before << ")";
+	    } // if
+	} else {
+	    untypedExpr->get_function()->accept( *this );
+	    before << "(";
+	    genCommaList( untypedExpr->get_args().begin(), untypedExpr->get_args().end() );
+	    before << ")";
+	} // if
+    }
+  
+    void CodeGenerator2::visit( NameExpr *nameExpr ) {
+	OperatorInfo opInfo;
+	if ( operatorLookup( nameExpr->get_name(), opInfo ) ) {
+	    assert( opInfo.type == OT_CONSTANT );
+	    before << opInfo.symbol;
+	} else {
+	    before << nameExpr->get_name();
+	} // if
+    }
+  
+    void CodeGenerator2::visit( AddressExpr *addressExpr ) {
+	before << "(&";
+	// this hack makes sure that we don't convert "constant_zero" to "0" if we're taking its address
+	if ( VariableExpr *variableExpr = dynamic_cast< VariableExpr* >( addressExpr->get_arg() ) ) {
+	    before << mangleName( variableExpr->get_var() );
+	} else {
+	    addressExpr->get_arg()->accept( *this );
+	} // if
+	before << ")";
+    }
+
+    void CodeGenerator2::visit( CastExpr *castExpr ) {
+	before << "((";
+	if ( castExpr->get_results().empty() ) {
+	    before << "void" ;
+	} else {
+	    before << genType( castExpr->get_results().front(), "" );
+	} // if
+	before << ")";
+	castExpr->get_arg()->accept( *this );
+	before << ")";
+    }
+  
+    void CodeGenerator2::visit( UntypedMemberExpr *memberExpr ) {
+	assert( false );
+    }
+  
+    void CodeGenerator2::visit( MemberExpr *memberExpr ) {
+	memberExpr->get_aggregate()->accept( *this );
+	before << "." << mangleName( memberExpr->get_member() );
+    }
+  
+    void CodeGenerator2::visit( VariableExpr *variableExpr ) {
+	OperatorInfo opInfo;
+	if ( variableExpr->get_var()->get_linkage() == LinkageSpec::Intrinsic && operatorLookup( variableExpr->get_var()->get_name(), opInfo ) && opInfo.type == OT_CONSTANT ) {
+	    before << opInfo.symbol;
+	} else {
+	    before << mangleName( variableExpr->get_var() );
+	} // if
+    }
+  
+    void CodeGenerator2::visit( ConstantExpr *constantExpr ) {
+	assert( constantExpr->get_constant() );
+	constantExpr->get_constant()->accept( *this );
+    }
+  
+    void CodeGenerator2::visit( SizeofExpr *sizeofExpr ) {
+	before << "sizeof(";
+	if ( sizeofExpr->get_isType() ) {
+	    before << genType( sizeofExpr->get_type(), "" );
+	} else {
+	    sizeofExpr->get_expr()->accept( *this );
+	} // if
+	before << ")";
+    }
+  
+    void CodeGenerator2::visit( LogicalExpr *logicalExpr ) {
+	before << "(";
+	logicalExpr->get_arg1()->accept( *this );
+	if ( logicalExpr->get_isAnd() ) {
+	    before << " && ";
+	} else {
+	    before << " || ";
+	} // if
+	logicalExpr->get_arg2()->accept( *this );
+	before << ")";
+    }
+  
+    void CodeGenerator2::visit( ConditionalExpr *conditionalExpr ) {
+	before << "(";
+	conditionalExpr->get_arg1()->accept( *this );
+	before << " ? ";
+	conditionalExpr->get_arg2()->accept( *this );
+	before << " : ";
+	conditionalExpr->get_arg3()->accept( *this );
+	before << ")";
+    }
+  
+    void CodeGenerator2::visit( CommaExpr *commaExpr ) {
+	before << "(";
+	commaExpr->get_arg1()->accept( *this );
+	before << " , ";
+	commaExpr->get_arg2()->accept( *this );
+	before << ")";
+    }
+  
+    void CodeGenerator2::visit( TupleExpr *tupleExpr ) {}
+  
+    void CodeGenerator2::visit( TypeExpr *typeExpr ) {}
+  
+  
+    //*** Statements
+    void CodeGenerator2::visit( CompoundStmt *compoundStmt ) {
+	std::list<Statement*> ks = compoundStmt->get_kids();
+
+	before << endl << string( cur_indent, ' ' ) << "{" << endl;
+
+	cur_indent += CodeGenerator2::tabsize; 
+
+	for ( std::list<Statement *>::iterator i = ks.begin(); i != ks.end();  i++) {
+	    before << string( cur_indent, ' ' ) << printLabels( (*i)->get_labels() )  ;
+	    (*i)->accept(*this );
+	    shift_left();
+	    before << endl;
 	}
-	before << "," << endl;
-      }
-
-      cur_indent -= CodeGenerator2::tabsize; 
-
-      before << "}" << endl;
-    }
-  }
-  
-  void 
-  CodeGenerator2::visit(ContextDecl *aggregateDecl)
-  {
-  }
-  
-  void 
-  CodeGenerator2::visit(TypedefDecl *typeDecl)
-  {
-    before << "typedef ";
-    before << genType( typeDecl->get_base(), typeDecl->get_name() );
-  }
-  
-  void 
-  CodeGenerator2::visit(TypeDecl *typeDecl)
-  {
-    // really, we should mutate this into something that isn't a TypeDecl
-    // but that requires large-scale changes, still to be done
-    before << "extern unsigned long " << typeDecl->get_name();
-    if( typeDecl->get_base() ) {
-      before << " = sizeof( " << genType( typeDecl->get_base(), "" ) << " )";
-    }
-  }
-
-  //*** Initializer
-  void
-  CodeGenerator2::visit(SingleInit *init)
-  {
-    init->get_value()->accept( *this );
-  }
-
-  void
-  CodeGenerator2::visit(ListInit *init)
-  {
-    before << "{ ";
-    genCommaList( init->begin_initializers(), init->end_initializers() );
-    before << " }";
-  }
-
-  //*** Constant
-  void CodeGenerator2::visit(Constant *constant) { 
-    before << constant->get_value() ;
-  }
-
-  //*** Expressions
-  void 
-  CodeGenerator2::visit(ApplicationExpr *applicationExpr)
-  {
-    if( VariableExpr *varExpr = dynamic_cast< VariableExpr* >( applicationExpr->get_function() ) ) {
-      OperatorInfo opInfo;
-      if( varExpr->get_var()->get_linkage() == LinkageSpec::Intrinsic && operatorLookup( varExpr->get_var()->get_name(), opInfo ) ) {
-        std::list< Expression* >::iterator arg = applicationExpr->get_args().begin();
-        switch( opInfo.type ) {
-        case OT_PREFIXASSIGN:
-        case OT_POSTFIXASSIGN:
-        case OT_INFIXASSIGN:
-        {
-          assert( arg != applicationExpr->get_args().end() );
-          if( AddressExpr *addrExpr = dynamic_cast< AddressExpr * >( *arg ) ) {
-            
-            *arg = addrExpr->get_arg();
-          } else {
-            UntypedExpr *newExpr = new UntypedExpr( new NameExpr( "*?" ) );
-            newExpr->get_args().push_back( *arg );
-            *arg = newExpr;
-          }
-          break;
-        }
-          
-        default:
-          // do nothing
-          ;
-        }
-        
-        switch( opInfo.type ) {
-        case OT_INDEX:
-          assert( applicationExpr->get_args().size() == 2 );
-          (*arg++)->accept( *this );
-          before << "[";
-          (*arg)->accept( *this );
-          before << "]";
-          break;
-          
-        case OT_CALL:
-          // there are no intrinsic definitions of the function call operator
-          assert( false );
-          break;
-          
-        case OT_PREFIX:
-        case OT_PREFIXASSIGN:
-          assert( applicationExpr->get_args().size() == 1 );
-          before << "(";
-          before << opInfo.symbol;
-          (*arg)->accept( *this );
-          before << ")";
-          break;
-          
-        case OT_POSTFIX:
-        case OT_POSTFIXASSIGN:
-          assert( applicationExpr->get_args().size() == 1 );
-          (*arg)->accept( *this );
-          before << opInfo.symbol;
-          break;
-
-        case OT_INFIX:
-        case OT_INFIXASSIGN:
-          assert( applicationExpr->get_args().size() == 2 );
-          before << "(";
-          (*arg++)->accept( *this );
-          before << opInfo.symbol;
-          (*arg)->accept( *this );
-          before << ")";
-          break;
-          
-        case OT_CONSTANT:
-          // there are no intrinsic definitions of 0 or 1 as functions
-          assert( false );
-        }
-      } else {
-        varExpr->accept( *this );
-        before << "(";
-        genCommaList( applicationExpr->get_args().begin(), applicationExpr->get_args().end() );
-        before << ")";
-      }
-    } else {
-      applicationExpr->get_function()->accept( *this );
-      before << "(";
-      genCommaList( applicationExpr->get_args().begin(), applicationExpr->get_args().end() );
-      before << ")";
-    }
-  }
-  
-  void 
-  CodeGenerator2::visit(UntypedExpr *untypedExpr)
-  {
-    if( NameExpr *nameExpr = dynamic_cast< NameExpr* >( untypedExpr->get_function() ) ) {
-      OperatorInfo opInfo;
-      if( operatorLookup( nameExpr->get_name(), opInfo ) ) {
-        std::list< Expression* >::iterator arg = untypedExpr->get_args().begin();
-        switch( opInfo.type ) {
-        case OT_INDEX:
-          assert( untypedExpr->get_args().size() == 2 );
-          (*arg++)->accept( *this );
-          before << "[";
-          (*arg)->accept( *this );
-          before << "]";
-          break;
-          
-        case OT_CALL:
-          assert( false );
-          break;
-          
-        case OT_PREFIX:
-        case OT_PREFIXASSIGN:
-          assert( untypedExpr->get_args().size() == 1 );
-          before << "(";
-          before << opInfo.symbol;
-          (*arg)->accept( *this );
-          before << ")";
-          break;
-          
-        case OT_POSTFIX:
-        case OT_POSTFIXASSIGN:
-          assert( untypedExpr->get_args().size() == 1 );
-          (*arg)->accept( *this );
-          before << opInfo.symbol;
-          break;
-  
-        case OT_INFIX:
-        case OT_INFIXASSIGN:
-          assert( untypedExpr->get_args().size() == 2 );
-          before << "(";
-          (*arg++)->accept( *this );
-          before << opInfo.symbol;
-          (*arg)->accept( *this );
-          before << ")";
-          break;
-          
-        case OT_CONSTANT:
-          // there are no intrinsic definitions of 0 or 1 as functions
-          assert( false );
-        }
-      } else {
-        nameExpr->accept( *this );
-        before << "(";
-        genCommaList( untypedExpr->get_args().begin(), untypedExpr->get_args().end() );
-        before << ")";
-      }
-    } else {
-      untypedExpr->get_function()->accept( *this );
-      before << "(";
-      genCommaList( untypedExpr->get_args().begin(), untypedExpr->get_args().end() );
-      before << ")";
-    }
-  }
-  
-  void 
-  CodeGenerator2::visit(NameExpr *nameExpr)
-  {
-    OperatorInfo opInfo;
-    if( operatorLookup( nameExpr->get_name(), opInfo ) ) {
-      assert( opInfo.type == OT_CONSTANT );
-      before << opInfo.symbol;
-    } else {
-      before << nameExpr->get_name();
-    }
-  }
-  
-  void 
-  CodeGenerator2::visit(AddressExpr *addressExpr)
-  {
-    before << "(&";
-    // this hack makes sure that we don't convert "constant_zero" to "0" if we're taking its address
-    if( VariableExpr *variableExpr = dynamic_cast< VariableExpr* >( addressExpr->get_arg() ) ) {
-      before << mangleName( variableExpr->get_var() );
-    } else {
-      addressExpr->get_arg()->accept( *this );
-    }
-    before << ")";
-  }
-
-  void 
-  CodeGenerator2::visit(CastExpr *castExpr)
-  {
-    before << "((";
-    if( castExpr->get_results().empty() ) {
-      before << "void" ;
-    } else {
-      before << genType( castExpr->get_results().front(), "" );
-    }
-    before << ")";
-    castExpr->get_arg()->accept( *this );
-    before << ")";
-  }
-  
-  void 
-  CodeGenerator2::visit(UntypedMemberExpr *memberExpr)
-  {
-    assert( false );
-  }
-  
-  void 
-  CodeGenerator2::visit(MemberExpr *memberExpr)
-  {
-    memberExpr->get_aggregate()->accept( *this );
-    before << "." << mangleName( memberExpr->get_member() );
-  }
-  
-  void 
-  CodeGenerator2::visit(VariableExpr *variableExpr)
-  {
-    OperatorInfo opInfo;
-    if( variableExpr->get_var()->get_linkage() == LinkageSpec::Intrinsic && operatorLookup( variableExpr->get_var()->get_name(), opInfo ) && opInfo.type == OT_CONSTANT ) {
-      before << opInfo.symbol;
-    } else {
-      before << mangleName( variableExpr->get_var() );
-    }
-  }
-  
-  void 
-  CodeGenerator2::visit(ConstantExpr *constantExpr)
-  {
-    assert( constantExpr->get_constant() );
-    constantExpr->get_constant()->accept( *this );
-  }
-  
-  void 
-  CodeGenerator2::visit(SizeofExpr *sizeofExpr)
-  {
-    before << "sizeof(";
-    if( sizeofExpr->get_isType() ) {
-      before << genType( sizeofExpr->get_type(), "" );
-    } else {
-      sizeofExpr->get_expr()->accept( *this );
-    }
-    before << ")";
- }
-  
-  void 
-  CodeGenerator2::visit(LogicalExpr *logicalExpr)
-  {
-    before << "(";
-    logicalExpr->get_arg1()->accept( *this );
-    if( logicalExpr->get_isAnd() ) {
-      before << " && ";
-    } else {
-      before << " || ";
-    }
-    logicalExpr->get_arg2()->accept( *this );
-    before << ")";
-  }
-  
-  void 
-  CodeGenerator2::visit(ConditionalExpr *conditionalExpr)
-  {
-    before << "(";
-    conditionalExpr->get_arg1()->accept( *this );
-    before << " ? ";
-    conditionalExpr->get_arg2()->accept( *this );
-    before << " : ";
-    conditionalExpr->get_arg3()->accept( *this );
-    before << ")";
-  }
-  
-  void 
-  CodeGenerator2::visit(CommaExpr *commaExpr)
-  {
-    before << "(";
-    commaExpr->get_arg1()->accept( *this );
-    before << " , ";
-    commaExpr->get_arg2()->accept( *this );
-    before << ")";
-  }
-  
-  void 
-  CodeGenerator2::visit(TupleExpr *tupleExpr)
-  {
-  }
-  
-  void 
-  CodeGenerator2::visit(TypeExpr *typeExpr)
-  {
-  }
-  
-  
-  //*** Statements
-  void CodeGenerator2::visit(CompoundStmt *compoundStmt){
-    std::list<Statement*> ks = compoundStmt->get_kids();
-
-    before << endl << string(cur_indent,' ') << "{" << endl;
-
-    cur_indent += CodeGenerator2::tabsize; 
-
-    for(std::list<Statement *>::iterator i = ks.begin(); i != ks.end();  i++){
-      before << string(cur_indent, ' ') << printLabels( (*i)->get_labels() )  ;
-      (*i)->accept(*this);
-      shift_left();
-      before << endl;
-    }
-    cur_indent -= CodeGenerator2::tabsize; 
-
-    before << string(cur_indent,' ') << "}" << endl;
-  }
-
-  void CodeGenerator2::visit(ExprStmt *exprStmt){
-    if(exprStmt != 0){
-      exprStmt->get_expr()->accept( *this );
-      shift_left();
-      before << ";" ;
-    }
-  }
-
-  void CodeGenerator2::visit(IfStmt *ifStmt){
-    before << "if (";
-    ifStmt->get_condition()->accept(*this);
-    after << ")" << endl ;
-    shift_left(); 
-
-    cur_indent += CodeGenerator2::tabsize;
-    before << string(cur_indent, ' ');
-    ifStmt->get_thenPart()->accept(*this);
-    cur_indent -= CodeGenerator2::tabsize; 
-    shift_left(); before << endl;
-
-    if(ifStmt->get_elsePart() != 0){
-      before << string(cur_indent, ' ') << " else " << endl ;
-
-      cur_indent += CodeGenerator2::tabsize; 
-      ifStmt->get_elsePart()->accept(*this);
-      cur_indent -= CodeGenerator2::tabsize; 
-    }
-  }
-
-  void CodeGenerator2::visit(SwitchStmt *switchStmt){
-    //before << /* "\r" << */ string(cur_indent, ' ') << CodeGenerator2::printLabels( switchStmt->get_labels() ) 
-    before << "switch (" ;
-    switchStmt->get_condition()->accept(*this);
-    after << ")" << std::endl ;
-    shift_left();
-
-    before << string(cur_indent, ' ') << "{" << std::endl;
-    cur_indent += CodeGenerator2::tabsize;
-
-    std::list< Statement * > stmts = switchStmt->get_branches();
-    bool lastBreak = false; 
-
-    // horrible, horrible hack
-    if( dynamic_cast<BranchStmt *>(stmts.back()) != 0 ) {
-      lastBreak = true;
-      stmts.pop_back();
-    }
-    acceptAll(stmts, *this );
-    if ( lastBreak ) {
-      Statement *st = switchStmt->get_branches().back();
-      before << CodeGenerator2::printLabels(st->get_labels());
-      st->accept(*this);
-    }
+	cur_indent -= CodeGenerator2::tabsize; 
+
+	before << string( cur_indent, ' ' ) << "}" << endl;
+    }
+
+    void CodeGenerator2::visit( ExprStmt *exprStmt ) {
+	if ( exprStmt != 0 ) {
+	    exprStmt->get_expr()->accept( *this );
+	    shift_left();
+	    before << ";" ;
+	} // if
+    }
+
+    void CodeGenerator2::visit( IfStmt *ifStmt ) {
+	before << "if (";
+	ifStmt->get_condition()->accept(*this );
+	after += ")\n";
+	shift_left(); 
+
+	cur_indent += CodeGenerator2::tabsize;
+	before << string( cur_indent, ' ' );
+	ifStmt->get_thenPart()->accept(*this );
+	cur_indent -= CodeGenerator2::tabsize; 
+	shift_left(); before << endl;
+
+	if ( ifStmt->get_elsePart() != 0) {
+	    before << string( cur_indent, ' ' ) << " else " << endl ;
+
+	    cur_indent += CodeGenerator2::tabsize; 
+	    ifStmt->get_elsePart()->accept(*this );
+	    cur_indent -= CodeGenerator2::tabsize; 
+	} // if
+    }
+
+    void CodeGenerator2::visit( SwitchStmt *switchStmt ) {
+	//before << /* "\r" << */ string( cur_indent, ' ' ) << CodeGenerator2::printLabels( switchStmt->get_labels() ) 
+	before << "switch (" ;
+	switchStmt->get_condition()->accept(*this );
+	after += ")\n";
+	shift_left();
+
+	before << string( cur_indent, ' ' ) << "{" << std::endl;
+	cur_indent += CodeGenerator2::tabsize;
+
+	std::list< Statement * > stmts = switchStmt->get_branches();
+	bool lastBreak = false; 
+
+	// horrible, horrible hack
+	if ( dynamic_cast<BranchStmt *>( stmts.back()) != 0 ) {
+	    lastBreak = true;
+	    stmts.pop_back();
+	} // if
+	acceptAll( stmts, *this );
+	if ( lastBreak ) {
+	    Statement *st = switchStmt->get_branches().back();
+	    before << CodeGenerator2::printLabels( st->get_labels());
+	    st->accept(*this );
+	} // if
       
-    cur_indent -= CodeGenerator2::tabsize; 
-
-    before << /* "\r" << */ string(cur_indent, ' ') << "}" << endl ;
-  }
-
-  void CodeGenerator2::visit(CaseStmt *caseStmt){
-    before << string(cur_indent, ' ');
-    if (caseStmt->isDefault()) 
-      before << "default "  ;
-    else {
-      before << "case "  ;
-      caseStmt->get_condition()->accept(*this);
-    }
-    after << ":" << std::endl ;
-    shift_left();
-
-    std::list<Statement *> sts = caseStmt->get_statements();
-
-    cur_indent += CodeGenerator2::tabsize;
-    for(std::list<Statement *>::iterator i = sts.begin(); i != sts.end();  i++){
-      before << /* "\r" << */ string(cur_indent, ' ') << printLabels( (*i)->get_labels() )  ;
-      (*i)->accept(*this);
-      shift_left();
-      before << ";" << endl;
-    }
-    cur_indent -= CodeGenerator2::tabsize;
-  }
-
-  void CodeGenerator2::visit(BranchStmt *branchStmt){
-    switch(branchStmt->get_type()){
-    case BranchStmt::Goto:
-      if( ! branchStmt->get_target().empty() )
-	before << "goto " << branchStmt->get_target();
-      else { 
-	if ( branchStmt->get_computedTarget() != 0 ) {
-	  before << "goto *";
-	  branchStmt->get_computedTarget()->accept(*this);
+	cur_indent -= CodeGenerator2::tabsize; 
+
+	before << /* "\r" << */ string( cur_indent, ' ' ) << "}" << endl ;
+    }
+
+    void CodeGenerator2::visit( CaseStmt *caseStmt ) {
+	before << string( cur_indent, ' ' );
+	if ( caseStmt->isDefault()) 
+	    before << "default "  ;
+	else {
+	    before << "case "  ;
+	    caseStmt->get_condition()->accept(*this );
+	} // if
+	after += ":\n";
+	shift_left();
+
+	std::list<Statement *> sts = caseStmt->get_statements();
+
+	cur_indent += CodeGenerator2::tabsize;
+	for ( std::list<Statement *>::iterator i = sts.begin(); i != sts.end();  i++) {
+	    before << /* "\r" << */ string( cur_indent, ' ' ) << printLabels( (*i)->get_labels() )  ;
+	    (*i)->accept(*this );
+	    shift_left();
+	    before << ";" << endl;
 	}
-      }
-      break;
-    case BranchStmt::Break:
-      before << "break";
-      break;
-    case BranchStmt::Continue:
-      before << "continue";
-      break;
-    }
-    before << ";";
-  }
-
-
-  void CodeGenerator2::visit(ReturnStmt *returnStmt){
-    before << "return ";
-
-    // xxx -- check for null expression;
-    if ( returnStmt->get_expr() ){
-      returnStmt->get_expr()->accept( *this );
-    }
-    after << ";";
-  }
-
-  void CodeGenerator2::visit(WhileStmt *whileStmt){
-    if( whileStmt->get_isDoWhile() )
-      before << "do" ;
-    else {
-      before << "while(" ;
-      whileStmt->get_condition()->accept(*this);
-      after << ")";
-    }
-    after << "{" << endl  ;
-    shift_left();
-
-    whileStmt->get_body()->accept( *this );
-
-    before << /* "\r" << */ string(cur_indent, ' ') << "}" ;
-
-    if( whileStmt->get_isDoWhile() ){
-      before << " while(" ;
-      whileStmt->get_condition()->accept(*this);
-      after << ");";
-    }
-
-    after << endl;
-  }
-
-  void CodeGenerator2::visit(ForStmt *forStmt){
-    before << "for (";
-
-    if( forStmt->get_initialization() != 0 )
-      forStmt->get_initialization()->accept( *this );
-    else
-      before << ";";
-    shift_left();
-
-    if( forStmt->get_condition() != 0 )
-      forStmt->get_condition()->accept( *this );
-    shift_left(); before << ";";
-
-    if( forStmt->get_increment() != 0 )
-      forStmt->get_increment()->accept( *this );
-    shift_left(); before << ")" << endl;
-
-    if( forStmt->get_body() != 0 ){
-      cur_indent += CodeGenerator2::tabsize; 
-      before << string(cur_indent, ' ') << CodeGenerator2::printLabels( forStmt->get_body()->get_labels() );
-      forStmt->get_body()->accept( *this );
-      cur_indent -= CodeGenerator2::tabsize; 
-    }
-  }
-
-  void CodeGenerator2::visit(NullStmt *nullStmt){
-    //before << /* "\r" << */ string(cur_indent, ' ') << CodeGenerator2::printLabels( nullStmt->get_labels() );
-    before << "/* null statement */ ;";
-  }
-
-  void CodeGenerator2::visit(DeclStmt *declStmt){
-    declStmt->get_decl()->accept( *this );
+	cur_indent -= CodeGenerator2::tabsize;
+    }
+
+    void CodeGenerator2::visit( BranchStmt *branchStmt ) {
+	switch ( branchStmt->get_type()) {
+	  case BranchStmt::Goto:
+	    if ( ! branchStmt->get_target().empty() )
+		before << "goto " << branchStmt->get_target();
+	    else { 
+		if ( branchStmt->get_computedTarget() != 0 ) {
+		    before << "goto *";
+		    branchStmt->get_computedTarget()->accept(*this );
+		} // if
+	    } // if
+	    break;
+	  case BranchStmt::Break:
+	    before << "break";
+	    break;
+	  case BranchStmt::Continue:
+	    before << "continue";
+	    break;
+	}
+	before << ";";
+    }
+
+
+    void CodeGenerator2::visit( ReturnStmt *returnStmt ) {
+	before << "return ";
+
+	// xxx -- check for null expression;
+	if ( returnStmt->get_expr() ) {
+	    returnStmt->get_expr()->accept( *this );
+	} // if
+	after += ";";
+    }
+
+    void CodeGenerator2::visit( WhileStmt *whileStmt ) {
+	if ( whileStmt->get_isDoWhile() )
+	    before << "do" ;
+	else {
+	    before << "while(" ;
+	    whileStmt->get_condition()->accept(*this );
+	    after += ")";
+	} // if
+	after += "{\n";
+	shift_left();
+
+	whileStmt->get_body()->accept( *this );
+
+	before << /* "\r" << */ string( cur_indent, ' ' ) << "}" ;
+
+	if ( whileStmt->get_isDoWhile() ) {
+	    before << " while(" ;
+	    whileStmt->get_condition()->accept(*this );
+	    after += ");";
+	} // if
+
+	after += "\n";
+    }
+
+    void CodeGenerator2::visit( ForStmt *forStmt ) {
+	before << "for (";
+
+	if ( forStmt->get_initialization() != 0 )
+	    forStmt->get_initialization()->accept( *this );
+	else
+	    before << ";";
+	shift_left();
+
+	if ( forStmt->get_condition() != 0 )
+	    forStmt->get_condition()->accept( *this );
+	shift_left(); before << ";";
+
+	if ( forStmt->get_increment() != 0 )
+	    forStmt->get_increment()->accept( *this );
+	shift_left(); before << ")" << endl;
+
+	if ( forStmt->get_body() != 0 ) {
+	    cur_indent += CodeGenerator2::tabsize; 
+	    before << string( cur_indent, ' ' ) << CodeGenerator2::printLabels( forStmt->get_body()->get_labels() );
+	    forStmt->get_body()->accept( *this );
+	    cur_indent -= CodeGenerator2::tabsize; 
+	} // if
+    }
+
+    void CodeGenerator2::visit( NullStmt *nullStmt ) {
+	//before << /* "\r" << */ string( cur_indent, ' ' ) << CodeGenerator2::printLabels( nullStmt->get_labels() );
+	before << "/* null statement */ ;";
+    }
+
+    void CodeGenerator2::visit( DeclStmt *declStmt ) {
+	declStmt->get_decl()->accept( *this );
     
-    if( doSemicolon( declStmt->get_decl() ) ) {
-      after << ";";
-    }
-    shift_left();
-  }
-
-  std::string CodeGenerator2::printLabels ( std::list< Label > &l ) {
-    std::string str("");
-    l.unique();
-
-    for( std::list< Label >::iterator i = l.begin(); i != l.end(); i++)
-      str += *i + ": ";
-
-    return str;
-  }
-
-  void CodeGenerator2::shift_left(){
-    before << string(after.str(), after.pcount());
-
-    after.freeze( false );
-    after.seekp(0);
-  }
-
-  void 
-  CodeGenerator2::handleStorageClass( Declaration *decl )
-  {
-    switch( decl->get_storageClass() ) {
-    case Declaration::NoStorageClass:
-      break;
-    case Declaration::Auto:
-      break;
-    case Declaration::Static:
-      before << "static ";
-      break;
-    case Declaration::Extern:
-      before << "extern ";
-      break;
-    case Declaration::Register:
-      before << "register ";
-      break;
-    case Declaration::Fortran:
-      before << "fortran ";
-      break;
-    }
-  }
-
+	if ( doSemicolon( declStmt->get_decl() ) ) {
+	    after += ";";
+	} // if
+	shift_left();
+    }
+
+    std::string CodeGenerator2::printLabels( std::list< Label > &l ) {
+	std::string str( "" );
+	l.unique();
+
+	for ( std::list< Label >::iterator i = l.begin(); i != l.end(); i++ )
+	    str += *i + ": ";
+
+	return str;
+    }
+
+    void CodeGenerator2::shift_left() {
+	before << after;
+	after = "";
+    }
+
+    void CodeGenerator2::handleStorageClass( Declaration *decl ) {
+	switch ( decl->get_storageClass() ) {
+	  case Declaration::NoStorageClass:
+	    break;
+	  case Declaration::Auto:
+	    break;
+	  case Declaration::Static:
+	    before << "static ";
+	    break;
+	  case Declaration::Extern:
+	    before << "extern ";
+	    break;
+	  case Declaration::Register:
+	    before << "register ";
+	    break;
+	  case Declaration::Fortran:
+	    before << "fortran ";
+	    break;
+	}
+    }
 } // namespace CodeGen
-
-
Index: translator/CodeGen/CodeGenerator2.h
===================================================================
--- translator/CodeGen/CodeGenerator2.h	(revision d9a0e763800888addddd70d8848a8f432b825e4b)
+++ translator/CodeGen/CodeGenerator2.h	(revision 17cd4ebabb684710b2f3698449093c4e84b8fb70)
@@ -10,107 +10,95 @@
 
 namespace CodeGen {
+    class CodeGenerator2 : public Visitor {
+      public:
+	static int tabsize;
 
-  class CodeGenerator2 : public Visitor
-    {
-    public:
-      static int tabsize;
+	CodeGenerator2( std::ostream &os );
+	CodeGenerator2( std::ostream &os, std::string, int indent = 0, bool infun = false );
+	CodeGenerator2( std::ostream &os, char *, int indent = 0, bool infun = false );
 
-      CodeGenerator2( std::ostream &os );
-      CodeGenerator2(std::ostream &os, std::string, int indent = 0, bool infun = false );
-      CodeGenerator2(std::ostream &os, char *, int indent = 0, bool infun = false );
+	CodeGenerator2( CodeGenerator2 & );
 
-      CodeGenerator2( CodeGenerator2 & );
+	//*** Declaration
+	virtual void visit( StructDecl * );
+	virtual void visit( FunctionDecl * );
+	virtual void visit( ObjectDecl * );
+	virtual void visit( UnionDecl *aggregateDecl );
+	virtual void visit( EnumDecl *aggregateDecl );
+	virtual void visit( ContextDecl *aggregateDecl );
+	virtual void visit( TypedefDecl *typeDecl );
+	virtual void visit( TypeDecl *typeDecl );
 
-      virtual ~CodeGenerator2();
+	//*** Initializer
+	virtual void visit( SingleInit * );
+	virtual void visit( ListInit * );
 
-      //*** Declaration
-      virtual void visit(StructDecl *);
-      virtual void visit(FunctionDecl *);
-      virtual void visit(ObjectDecl *);
-      virtual void visit(UnionDecl *aggregateDecl);
-      virtual void visit(EnumDecl *aggregateDecl);
-      virtual void visit(ContextDecl *aggregateDecl);
-      virtual void visit(TypedefDecl *typeDecl);
-      virtual void visit(TypeDecl *typeDecl);
+	//*** Constant
+	virtual void visit( Constant * );
 
-      //*** Initializer
-      virtual void visit(SingleInit *);
-      virtual void visit(ListInit *);
+	//*** Expression
+	virtual void visit( ApplicationExpr *applicationExpr );
+	virtual void visit( UntypedExpr *untypedExpr );
+	virtual void visit( NameExpr *nameExpr );
+	virtual void visit( AddressExpr *addressExpr );
+	virtual void visit( CastExpr *castExpr );
+	virtual void visit( UntypedMemberExpr *memberExpr );
+	virtual void visit( MemberExpr *memberExpr );
+	virtual void visit( VariableExpr *variableExpr );
+	virtual void visit( ConstantExpr *constantExpr ); 
+	virtual void visit( SizeofExpr *sizeofExpr );
+	virtual void visit( LogicalExpr *logicalExpr );
+	virtual void visit( ConditionalExpr *conditionalExpr );
+	virtual void visit( CommaExpr *commaExpr );
+	virtual void visit( TupleExpr *tupleExpr );
+	virtual void visit( TypeExpr *typeExpr );
 
-      //*** Constant
-      virtual void visit(Constant *);
+	//*** Statements
+	virtual void visit( CompoundStmt * );
+	virtual void visit( ExprStmt * );
+	virtual void visit( IfStmt * );
+	virtual void visit( SwitchStmt * );
+	virtual void visit( CaseStmt * );
+	virtual void visit( BranchStmt * );
+	virtual void visit( ReturnStmt * );
+	virtual void visit( WhileStmt * );
+	virtual void visit( ForStmt * );
+	virtual void visit( NullStmt * );
+	virtual void visit( DeclStmt * ); 
 
-      //*** Expression
-      virtual void visit(ApplicationExpr *applicationExpr);
-      virtual void visit(UntypedExpr *untypedExpr);
-      virtual void visit(NameExpr *nameExpr);
-      virtual void visit(AddressExpr *addressExpr);
-      virtual void visit(CastExpr *castExpr);
-      virtual void visit(UntypedMemberExpr *memberExpr);
-      virtual void visit(MemberExpr *memberExpr);
-      virtual void visit(VariableExpr *variableExpr);
-      virtual void visit(ConstantExpr *constantExpr); 
-      virtual void visit(SizeofExpr *sizeofExpr);
-      virtual void visit(LogicalExpr *logicalExpr);
-      virtual void visit(ConditionalExpr *conditionalExpr);
-      virtual void visit(CommaExpr *commaExpr);
-      virtual void visit(TupleExpr *tupleExpr);
-      virtual void visit(TypeExpr *typeExpr);
+	std::string get_string( void );
+	void add_string_left( std::string s ) { before << s; }
+	void shift_left();
+	template< class Iterator > void genCommaList( Iterator begin, Iterator end );
+      private:
+	int cur_indent;
+	bool insideFunction;
+	std::ostream &before;
+	std::string after;
 
-      //*** Statements
-      virtual void visit(CompoundStmt *);
-      virtual void visit(ExprStmt *);
-      virtual void visit(IfStmt *);
-      virtual void visit(SwitchStmt *);
-      virtual void visit(CaseStmt *);
-      virtual void visit(BranchStmt *);
-      virtual void visit(ReturnStmt *);
-      virtual void visit(WhileStmt *);
-      virtual void visit(ForStmt *);
-      virtual void visit(NullStmt *);
-      virtual void visit(DeclStmt *); 
-
-      std::string get_string(void);
-      void add_string_left(std::string s) { before << s; }
-      void shift_left();
-      template< class Iterator > void genCommaList( Iterator begin, Iterator end );
-
-    private:
-      int cur_indent;
-      bool insideFunction;
-      std::ostream &before;
-      std::ostrstream after;
-
-      static std::string printLabels ( std::list < Label > & );
-      void handleStorageClass( Declaration *decl );
-      void handleAggregate( AggregateDecl *aggDecl );
-      void handleTypedef( NamedTypeDecl *namedType );
+	static std::string printLabels ( std::list < Label > & );
+	void handleStorageClass( Declaration *decl );
+	void handleAggregate( AggregateDecl *aggDecl );
+	void handleTypedef( NamedTypeDecl *namedType );
 
     };
     
-  template< class Iterator >
-  void
-  CodeGenerator2::genCommaList( Iterator begin, Iterator end )
-  {
-    if( begin == end ) return;
-    
-    for( ;; ) {
-      (*begin++)->accept( *this );
-      
-      if( begin == end ) return;
-      
-      before << ", ";
+    template< class Iterator >
+    void CodeGenerator2::genCommaList( Iterator begin, Iterator end ) {
+	if ( begin == end ) return;
+
+	for ( ;; ) {
+	    (*begin++)->accept( *this );
+	    if ( begin == end ) return;
+	    before << ", ";
+	}
     }
-  }
   
-  inline bool
-  doSemicolon( Declaration* decl )
-  {
-    if( FunctionDecl* func = dynamic_cast< FunctionDecl* >( decl ) ) {
-      return !func->get_statements();
+    inline bool doSemicolon( Declaration* decl ) {
+	if ( FunctionDecl* func = dynamic_cast< FunctionDecl* >( decl ) ) {
+	    return !func->get_statements();
+	}
+	return true;
     }
-    return true;
-  }
-  
 } // namespace CodeGen
 
Index: translator/CodeGen/GenType.cc
===================================================================
--- translator/CodeGen/GenType.cc	(revision d9a0e763800888addddd70d8848a8f432b825e4b)
+++ translator/CodeGen/GenType.cc	(revision 17cd4ebabb684710b2f3698449093c4e84b8fb70)
@@ -1,9 +1,2 @@
-/*
- * This file is part of the Cforall project
- *
- * $Id: GenType.cc,v 1.6 2005/08/29 20:14:12 rcbilson Exp $
- *
- */
-
 #include <strstream>
 #include <cassert>
@@ -16,258 +9,175 @@
 
 namespace CodeGen {
+    class GenType : public Visitor {
+      public:
+	GenType( const std::string &typeString );
+	std::string get_typeString() const { return typeString; }
+	void set_typeString( const std::string &newValue ) { typeString = newValue; }
+  
+	virtual void visit( FunctionType *funcType );
+	virtual void visit( VoidType *voidType );
+	virtual void visit( BasicType *basicType );
+	virtual void visit( PointerType *pointerType );
+	virtual void visit( ArrayType *arrayType );
+	virtual void visit( StructInstType *structInst );
+	virtual void visit( UnionInstType *unionInst );
+	virtual void visit( EnumInstType *enumInst );
+	virtual void visit( TypeInstType *typeInst );
+  
+      private:
+	void handleQualifiers( Type *type );
+	void genArray( const Type::Qualifiers &qualifiers, Type *base, Expression *dimension, bool isVarLen, bool isStatic );
+  
+	std::string typeString;
+    };
 
-class GenType : public Visitor
-{
-public:
-  GenType( const std::string &typeString );
-  std::string get_typeString() const { return typeString; }
-  void set_typeString( const std::string &newValue ) { typeString = newValue; }
+    std::string genType( Type *type, const std::string &baseString ) {
+	GenType gt( baseString );
+	type->accept( gt );
+	return gt.get_typeString();
+    }
+
+    GenType::GenType( const std::string &typeString ) : typeString( typeString ) {}
+
+    void GenType::visit( VoidType *voidType ) {
+	typeString = "void " + typeString;
+	handleQualifiers( voidType );
+    }
+
+    void GenType::visit( BasicType *basicType ) {
+	BasicType::Kind kind = basicType->get_kind();
+	assert( 0 <= kind && kind < BasicType::NUMBER_OF_BASIC_TYPES );
+	typeString = std::string( BasicType::typeNames[kind] ) + " " + typeString;
+	handleQualifiers( basicType );
+    }
+
+    void GenType::genArray( const Type::Qualifiers &qualifiers, Type *base, Expression *dimension, bool isVarLen, bool isStatic ) {
+	std::ostrstream os;
+	if ( typeString != "" ) {
+	    if ( typeString[ 0 ] == '*' ) {
+		os << "(" << typeString << ")";
+	    } else {
+		os << typeString;
+	    } // if
+	} // if
+	os << "[";
+
+	if ( isStatic ) {
+	    os << "static ";
+	} // if
+	if ( qualifiers.isConst ) {
+	    os << "const ";
+	} // if
+	if ( qualifiers.isVolatile ) {
+	    os << "volatile ";
+	} // if
+	if ( qualifiers.isRestrict ) {
+	    os << "__restrict ";
+	} // if
+	if ( isVarLen ) {
+	    os << "*";
+	} // if
+	if ( dimension != 0 ) {
+	    CodeGenerator2 cg( os );
+	    dimension->accept( cg );
+	} // if
+	os << "]";
+
+	typeString = std::string( os.str(), os.pcount() );
   
-  virtual void visit( FunctionType *funcType );
-  virtual void visit( VoidType *voidType );
-  virtual void visit( BasicType *basicType );
-  virtual void visit( PointerType *pointerType );
-  virtual void visit( ArrayType *arrayType );
-  virtual void visit( StructInstType *structInst );
-  virtual void visit( UnionInstType *unionInst );
-  virtual void visit( EnumInstType *enumInst );
-  virtual void visit( TypeInstType *typeInst );
+	base->accept( *this );
+    }
+
+    void GenType::visit( PointerType *pointerType ) {
+	assert( pointerType->get_base() != 0);
+	if ( pointerType->get_isStatic() || pointerType->get_isVarLen() || pointerType->get_dimension() ) {
+	    genArray( pointerType->get_qualifiers(), pointerType->get_base(), pointerType->get_dimension(), pointerType->get_isVarLen(), pointerType->get_isStatic() );
+	} else {
+	    handleQualifiers( pointerType );
+	    if ( typeString[ 0 ] == '?' ) {
+		typeString = "* " + typeString;
+	    } else {
+		typeString = "*" + typeString;
+	    } // if
+	    pointerType->get_base()->accept( *this );
+	} // if
+    }
+
+    void GenType::visit( ArrayType *arrayType ){
+	genArray( arrayType->get_qualifiers(), arrayType->get_base(), arrayType->get_dimension(), arrayType->get_isVarLen(), arrayType->get_isStatic() );
+    }
+
+    void GenType::visit( FunctionType *funcType ) {
+	std::ostrstream os;
+
+	if ( typeString != "" ) {
+	    if ( typeString[ 0 ] == '*' ) {
+		os << "(" << typeString << ")";
+	    } else {
+		os << typeString;
+	    } // if
+	} // if
   
-private:
-  void handleQualifiers( Type *type );
-  void genArray( const Type::Qualifiers &qualifiers, Type *base, Expression *dimension, bool isVarLen, bool isStatic );
+	/************* parameters ***************/
+
+	const std::list<DeclarationWithType *> &pars = funcType->get_parameters();
+
+	if ( pars.empty() ) {
+	    if ( funcType->get_isVarArgs() ) {
+		os << "()";
+	    } else {
+		os << "(void)";
+	    } // if
+	} else {
+	    CodeGenerator2 cg( os );
+	    os << "(" ;
+
+	    cg.genCommaList( pars.begin(), pars.end() );
+
+	    if ( funcType->get_isVarArgs() ){
+		os << ", ...";
+	    } // if
+	    os << ")";
+	} // if
   
-  std::string typeString;
-};
+	typeString = std::string( os.str(), os.pcount() );
 
-std::string
-genType( Type *type, const std::string &baseString )
-{
-  GenType gt( baseString );
-  type->accept( gt );
-  return gt.get_typeString();
-}
+	if ( funcType->get_returnVals().size() == 0 ) {
+	    typeString = "void " + typeString;
+	} else {
+	    funcType->get_returnVals().front()->get_type()->accept( *this );
+	} // if
+    }
 
-GenType::GenType( const std::string &typeString )
-  : typeString( typeString )
-{
-}
+    void GenType::visit( StructInstType *structInst )  {
+	typeString = "struct " + structInst->get_name() + " " + typeString;
+	handleQualifiers( structInst );
+    }
 
-void GenType::visit(VoidType *voidType){
-  typeString = "void " + typeString;
-  handleQualifiers( voidType );
-}
+    void GenType::visit( UnionInstType *unionInst ) {
+	typeString = "union " + unionInst->get_name() + " " + typeString;
+	handleQualifiers( unionInst );
+    }
 
-void GenType::visit(BasicType *basicType)
-{
-  std::string typeWords;
-  switch(basicType->get_kind()){
-  case BasicType::Bool:
-    typeWords = "_Bool";
-    break;
-  case BasicType::Char:
-  case BasicType::SignedChar:
-    typeWords = "char";
-    break;
-  case BasicType::UnsignedChar:
-    typeWords = "unsigned char";
-    break;
-  case BasicType::ShortSignedInt:
-    typeWords = "short";
-    break;
-  case BasicType::ShortUnsignedInt:
-    typeWords = "short unsigned";
-    break;
-  case BasicType::SignedInt:
-    typeWords = "int";
-    break;
-  case BasicType::UnsignedInt:
-    typeWords = "unsigned int";
-    break;
-  case BasicType::LongSignedInt:
-    typeWords = "long int";
-    break;
-  case BasicType::LongUnsignedInt:
-    typeWords = "long unsigned int";
-    break;
-  case BasicType::LongLongSignedInt:
-    typeWords = "long long int";
-    break;
-  case BasicType::LongLongUnsignedInt:
-    typeWords = "long long unsigned int";
-    break;
-  case BasicType::Float:
-    typeWords = "float";
-    break;
-  case BasicType::Double:
-    typeWords = "double";
-    break;
-  case BasicType::LongDouble:
-    typeWords = "long double";
-    break;
-  case BasicType::FloatComplex:
-    typeWords = "float _Complex";
-    break;
-  case BasicType::DoubleComplex:
-    typeWords = "double _Complex";
-    break;
-  case BasicType::LongDoubleComplex:
-    typeWords = "long double _Complex";
-    break;
-  case BasicType::FloatImaginary:
-    typeWords = "float _Imaginary";
-    break;
-  case BasicType::DoubleImaginary:
-    typeWords = "double _Imaginary";
-    break;
-  case BasicType::LongDoubleImaginary:
-    typeWords = "long double _Imaginary";
-    break;
-  default:
-    assert( false );
-  }
-  typeString = typeWords + " " + typeString;
-  handleQualifiers( basicType );
-}
+    void GenType::visit( EnumInstType *enumInst ) {
+	typeString = "enum " + enumInst->get_name() + " " + typeString;
+	handleQualifiers( enumInst );
+    }
 
-void
-GenType::genArray( const Type::Qualifiers &qualifiers, Type *base, Expression *dimension, bool isVarLen, bool isStatic )
-{
-  std::ostrstream os;
-  if( typeString != "" ) {
-    if( typeString[ 0 ] == '*' ) {
-      os << "(" << typeString << ")";
-    } else {
-      os << typeString;
+    void GenType::visit( TypeInstType *typeInst ) {
+	typeString = typeInst->get_name() + " " + typeString;
+	handleQualifiers( typeInst );
     }
-  }
-  os << "[";
-  if( isStatic ) {
-    os << "static ";
-  }
-  if( qualifiers.isConst ) {
-    os << "const ";
-  }
-  if( qualifiers.isVolatile ) {
-    os << "volatile ";
-  }
-  if( isVarLen ) {
-    os << "*";
-  }
-  if( dimension != 0 ) {
-    CodeGenerator2 cg( os );
-    dimension->accept( cg );
-  }
-  os << "]";
-  
-  typeString = std::string( os.str(), os.pcount() );
-  
-  base->accept ( *this );
-}
 
-void GenType::visit(PointerType *pointerType) {
-  assert(pointerType->get_base() != 0);
-  if( pointerType->get_isStatic() || pointerType->get_isVarLen() || pointerType->get_dimension() ) {
-    genArray( pointerType->get_qualifiers(), pointerType->get_base(), pointerType->get_dimension(), pointerType->get_isVarLen(), pointerType->get_isStatic() );
-  } else {
-    handleQualifiers( pointerType );
-    if( typeString[ 0 ] == '?' ) {
-      typeString = "* " + typeString;
-    } else {
-      typeString = "*" + typeString;
+    void GenType::handleQualifiers( Type *type ) {
+	if ( type->get_isConst() ) {
+	    typeString = "const " + typeString;
+	} // if
+	if ( type->get_isVolatile() ) {
+	    typeString = "volatile " + typeString;
+	} // if
+	if ( type->get_isRestrict() ) {
+	    typeString = "__restrict " + typeString;
+	} // if
     }
-    pointerType->get_base()->accept ( *this );
-  }
-}
-
-void GenType::visit(ArrayType *arrayType){
-  genArray( arrayType->get_qualifiers(), arrayType->get_base(), arrayType->get_dimension(), arrayType->get_isVarLen(), arrayType->get_isStatic() );
-}
-
-void GenType::visit(FunctionType *funcType) {
-  std::ostrstream os;
-
-  if( typeString != "" ) {
-    if( typeString[ 0 ] == '*' ) {
-      os << "(" << typeString << ")";
-    } else {
-      os << typeString;
-    }
-  }
-  
-  /************* parameters ***************/
-
-  const std::list<DeclarationWithType*> &pars = funcType->get_parameters();
-
-  if( pars.empty() ) {
-    if( funcType->get_isVarArgs() ) {
-      os << "()";
-    } else {
-      os << "(void)";
-    }
-  } else {
-    CodeGenerator2 cg( os );
-    os << "(" ;
-
-    cg.genCommaList( pars.begin(), pars.end() );
-    
-    if( funcType->get_isVarArgs() ){
-      os << ", ...";
-    }
-    os << ")";
-  }
-  
-  typeString = std::string( os.str(), os.pcount() );
-
-  if( funcType->get_returnVals().size() == 0 ) {
-    typeString = "void " + typeString;
-  } else {
-
-    funcType->get_returnVals().front()->get_type()->accept( *this );
-
-  }
-  
-}
-
-void GenType::visit( StructInstType *structInst ) 
-{
-  typeString = "struct " + structInst->get_name() + " " + typeString;
-  handleQualifiers( structInst );
-}
-
-void 
-GenType::visit( UnionInstType *unionInst )
-{
-  typeString = "union " + unionInst->get_name() + " " + typeString;
-  handleQualifiers( unionInst );
-}
-
-void 
-GenType::visit( EnumInstType *enumInst )
-{
-  typeString = "enum " + enumInst->get_name() + " " + typeString;
-  handleQualifiers( enumInst );
-}
-
-void 
-GenType::visit( TypeInstType *typeInst )
-{
-  typeString = typeInst->get_name() + " " + typeString;
-  handleQualifiers( typeInst );
-}
-
-void 
-GenType::handleQualifiers( Type *type )
-{
-  if( type->get_isConst() ) {
-    typeString = "const " + typeString;
-  }
-  if( type->get_isVolatile() ) {
-    typeString = "volatile " + typeString;
-  }
-  if( type->get_isRestrict() ) {
-    typeString = "__restrict " + typeString;
-  }
-}
-
 } // namespace CodeGen
Index: translator/CodeGen/GenType.h
===================================================================
--- translator/CodeGen/GenType.h	(revision d9a0e763800888addddd70d8848a8f432b825e4b)
+++ translator/CodeGen/GenType.h	(revision 17cd4ebabb684710b2f3698449093c4e84b8fb70)
@@ -1,9 +1,2 @@
-/*
- * This file is part of the Cforall project
- *
- * $Id: GenType.h,v 1.2 2005/08/29 20:14:12 rcbilson Exp $
- *
- */
-
 #ifndef CODEGEN_GENTYPE_H
 #define CODEGEN_GENTYPE_H
@@ -13,8 +6,6 @@
 
 namespace CodeGen {
-
-std::string genType( Type *type, const std::string &baseString );
-
+    std::string genType( Type *type, const std::string &baseString );
 } // namespace CodeGen
 
-#endif /* #ifndef CODEGEN_GENTYPE_H */
+#endif // CODEGEN_GENTYPE_H
Index: translator/CodeGen/Generate.cc
===================================================================
--- translator/CodeGen/Generate.cc	(revision d9a0e763800888addddd70d8848a8f432b825e4b)
+++ translator/CodeGen/Generate.cc	(revision 17cd4ebabb684710b2f3698449093c4e84b8fb70)
@@ -12,24 +12,17 @@
 
 namespace CodeGen {
+    void generate( std::list< Declaration* > translationUnit, std::ostream &os, bool doIntrinsics ) {
+	CodeGen::CodeGenerator2 cgv( os );
 
-  void generate( std::list< Declaration* > translationUnit, std::ostream &os, bool doIntrinsics ) {
-
-    CodeGen::CodeGenerator2 cgv( os );
-
-    for(std::list<Declaration *>::iterator i = translationUnit.begin(); i != translationUnit.end();  i++)
-      {
-        if( LinkageSpec::isGeneratable( (*i)->get_linkage() ) && (doIntrinsics || !LinkageSpec::isBuiltin( (*i)->get_linkage() ) ) ) {
-    	  (*i)->accept(cgv);
-    	  cgv.shift_left();
-    	  if( doSemicolon( *i ) ) {
-      	    os << ";";
-      	  }
-      	  os << std::endl;
-    	}
-      }
-
-  }
-
+	for ( std::list<Declaration *>::iterator i = translationUnit.begin(); i != translationUnit.end();  i++ ) {
+	    if ( LinkageSpec::isGeneratable( (*i)->get_linkage() ) && (doIntrinsics || ! LinkageSpec::isBuiltin( (*i)->get_linkage() ) ) ) {
+		(*i)->accept(cgv);
+		cgv.shift_left();
+		if ( doSemicolon( *i ) ) {
+		    os << ";";
+		} // if
+		os << std::endl;
+	    } // if
+	} // for
+    }
 } // namespace CodeGen
-
-
Index: translator/GenPoly/CopyParams.cc
===================================================================
--- translator/GenPoly/CopyParams.cc	(revision d9a0e763800888addddd70d8848a8f432b825e4b)
+++ translator/GenPoly/CopyParams.cc	(revision 17cd4ebabb684710b2f3698449093c4e84b8fb70)
@@ -1,9 +1,2 @@
-/*
- * This file is part of the Cforall project
- *
- * $Id: CopyParams.cc,v 1.3 2005/08/29 20:14:13 rcbilson Exp $
- *
- */
-
 #include <set>
 #include <map>
@@ -19,79 +12,73 @@
 
 namespace GenPoly {
+    class CopyParams : public Visitor {
+      public:
+	CopyParams();
+  
+	virtual void visit( FunctionDecl *funcDecl );
+	virtual void visit( AddressExpr *addrExpr );
 
-class CopyParams : public Visitor
-{
-public:
-  CopyParams();
-  
-  virtual void visit( FunctionDecl *funcDecl );
-  virtual void visit( AddressExpr *addrExpr );
+      private:
+	std::set< UniqueId > modVars;
+	UniqueName namer;
+    };
 
-private:
-  std::set< UniqueId > modVars;
-  UniqueName namer;
-};
+    void copyParams( std::list< Declaration* > &translationUnit ) {
+	CopyParams copier;
+	acceptAll( translationUnit, copier );
+    }
 
-void
-copyParams( std::list< Declaration* > &translationUnit )
-{
-  CopyParams copier;
-  acceptAll( translationUnit, copier );
-}
+    CopyParams::CopyParams() : namer( "_cp" ) {}
 
-CopyParams::CopyParams()
-  : namer( "_cp" )
-{
-}
+    static const std::list< Label > noLabels;
 
-static const std::list< Label > noLabels;
+    void CopyParams::visit( FunctionDecl *funcDecl ) {
+	if ( funcDecl->get_statements() ) {
+	    funcDecl->get_statements()->accept( *this );
+    
+	    if ( ! modVars.empty() ) {
+		std::map< std::string, DeclarationWithType* > assignOps;
+		// assume the assignment operator is the first assert param after any "type" parameter
+		for ( std::list< TypeDecl* >::const_iterator tyVar = funcDecl->get_functionType()->get_forall().begin(); tyVar != funcDecl->get_functionType()->get_forall().end(); ++tyVar ) {
+		    if ( (*tyVar)->get_kind() == TypeDecl::Any ) {
+			assert( !(*tyVar)->get_assertions().empty() );
+			assignOps[ (*tyVar)->get_name() ] = (*tyVar)->get_assertions().front();
+		    } // if
+		} // for
+		for( std::list< DeclarationWithType* >::iterator param = funcDecl->get_functionType()->get_parameters().begin(); param != funcDecl->get_functionType()->get_parameters().end(); ++param ) {
+		    std::set< UniqueId >::const_iterator var = modVars.find( (*param)->get_uniqueId() );
+		    if ( var != modVars.end() ) {
+			TypeInstType *typeInst = dynamic_cast< TypeInstType* >( (*param)->get_type() );
+			assert( typeInst );
+			std::map< std::string, DeclarationWithType* >::const_iterator assignOp = assignOps.find( typeInst->get_name() );
+			if ( assignOp != assignOps.end() ) {
+			    DeclarationWithType *oldParam = *param;
+			    *param = (*param)->clone();
+			    (*param)->set_mangleName( namer.newName( (*param)->get_mangleName() ) );
+			    ApplicationExpr *assign = new ApplicationExpr( new VariableExpr( assignOp->second ) );
+			    assign->get_args().push_back( new VariableExpr( oldParam ) );
+			    assign->get_args().push_back( new VariableExpr( *param ) );
+			    funcDecl->get_statements()->get_kids().push_front( new ExprStmt( noLabels, assign ) );
+			    funcDecl->get_statements()->get_kids().push_front( new DeclStmt( noLabels, oldParam ) );
+			} // if
+			modVars.erase( var );
+		    } // if
+		} // for
+	    } // if
+	} // if
+    }
 
-void 
-CopyParams::visit( FunctionDecl *funcDecl )
-{
-  if( funcDecl->get_statements() ) {
-    funcDecl->get_statements()->accept( *this );
-    
-    if( !modVars.empty() ) {
-      std::map< std::string, DeclarationWithType* > assignOps;
-      // assume that the assignment operator is the first assert param after any "type" parameter
-      for( std::list< TypeDecl* >::const_iterator tyVar = funcDecl->get_functionType()->get_forall().begin(); tyVar != funcDecl->get_functionType()->get_forall().end(); ++tyVar ) {
-        if( (*tyVar)->get_kind() == TypeDecl::Any ) {
-          assert( !(*tyVar)->get_assertions().empty() );
-          assignOps[ (*tyVar)->get_name() ] = (*tyVar)->get_assertions().front();
-        }
-      }
-      for( std::list< DeclarationWithType* >::iterator param = funcDecl->get_functionType()->get_parameters().begin(); param != funcDecl->get_functionType()->get_parameters().end(); ++param ) {
-        std::set< UniqueId >::const_iterator var = modVars.find( (*param)->get_uniqueId() );
-        if( var != modVars.end() ) {
-          TypeInstType *typeInst = dynamic_cast< TypeInstType* >( (*param)->get_type() );
-          assert( typeInst );
-          std::map< std::string, DeclarationWithType* >::const_iterator assignOp = assignOps.find( typeInst->get_name() );
-          if( assignOp != assignOps.end() ) {
-            DeclarationWithType *oldParam = *param;
-            *param = (*param)->clone();
-            (*param)->set_name( namer.newName() );
-            ApplicationExpr *assign = new ApplicationExpr( new VariableExpr( assignOp->second ) );
-            assign->get_args().push_back( new VariableExpr( oldParam ) );
-            assign->get_args().push_back( new VariableExpr( *param ) );
-            funcDecl->get_statements()->get_kids().push_front( new ExprStmt( noLabels, assign ) );
-            funcDecl->get_statements()->get_kids().push_front( new DeclStmt( noLabels, oldParam ) );
-          }
-          modVars.erase( var );
-        }
-      }
+    // this test is insufficient because it is possible for values to be modified by being passed to other polymorphic
+    // routines (e.g., assignment operators) without having their addresses explicitly taken. Some thought is needed to
+    // make sure that all of the correct cases are identified where copies are necessary.
+    //
+    // As a temporary measure, for correctness at the expense of performance, ignore the modVars list entirely and copy
+    // every parameter of TypeInstType* when visiting the FunctionDecl.
+    void CopyParams::visit( AddressExpr *addrExpr ) {
+	if ( VariableExpr *varExpr = dynamic_cast< VariableExpr* >( addrExpr->get_arg() ) ) {
+	    if ( dynamic_cast< TypeInstType* >( varExpr->get_var()->get_type() ) ) {
+		modVars.insert( varExpr->get_var()->get_uniqueId() );
+	    } // if
+	} // if
     }
-  }
-}
-
-void 
-CopyParams::visit( AddressExpr *addrExpr )
-{
-  if( VariableExpr *varExpr = dynamic_cast< VariableExpr* >( addrExpr->get_arg() ) ) {
-    if( dynamic_cast< TypeInstType* >( varExpr->get_var()->get_type() ) ) {
-      modVars.insert( varExpr->get_var()->get_uniqueId() );
-    }
-  }
-}
-
 } // namespace GenPoly
Index: translator/Parser/DeclarationNode.cc
===================================================================
--- translator/Parser/DeclarationNode.cc	(revision d9a0e763800888addddd70d8848a8f432b825e4b)
+++ translator/Parser/DeclarationNode.cc	(revision 17cd4ebabb684710b2f3698449093c4e84b8fb70)
@@ -19,5 +19,5 @@
 /* these must remain in the same order as the corresponding DeclarationNode enumerations */
 const char *DeclarationNode::qualifierName[] = { "const", "restrict", "volatile", "lvalue" };
-const char *DeclarationNode::basicTypeName[] = { "char", "int", "float", "double", "void", "bool", "complex", "imaginary" };
+const char *DeclarationNode::basicTypeName[] = { "char", "int", "float", "double", "void", "_Bool", "_Complex", "_Imaginary" };
 const char *DeclarationNode::modifierName[] = { "signed", "unsigned", "short", "long" };
 const char *DeclarationNode::tyConName[] = { "struct", "union", "context" };
@@ -799,9 +799,9 @@
 		} else if ( StructDecl *agg = dynamic_cast< StructDecl* >( decl ) ) {
 		    StructInstType *inst = new StructInstType( Type::Qualifiers(), agg->get_name() );
-		   *out++ = new ObjectDecl( "", Declaration::NoStorageClass, linkage, 0, inst, 0 );
+		    *out++ = new ObjectDecl( "", Declaration::NoStorageClass, linkage, 0, inst, 0 );
 		    delete agg;
 		} else if ( UnionDecl *agg = dynamic_cast< UnionDecl* >( decl ) ) {
 		    UnionInstType *inst = new UnionInstType( Type::Qualifiers(), agg->get_name() );
-		   *out++ = new ObjectDecl( "", Declaration::NoStorageClass, linkage, 0, inst, 0 );
+		    *out++ = new ObjectDecl( "", Declaration::NoStorageClass, linkage, 0, inst, 0 );
 		}
 	    }
Index: translator/Parser/InitializerNode.cc
===================================================================
--- translator/Parser/InitializerNode.cc	(revision d9a0e763800888addddd70d8848a8f432b825e4b)
+++ translator/Parser/InitializerNode.cc	(revision 17cd4ebabb684710b2f3698449093c4e84b8fb70)
@@ -43,12 +43,12 @@
 	if ( designator != 0 ) {
 	    os << "designated by: (";
-	    ExpressionNode  *curdes = designator;
+	    ExpressionNode *curdes = designator;
 	    while( curdes != 0) {
 		curdes->printOneLine(os);
 		curdes = (ExpressionNode *)(curdes->get_link());
 		if ( curdes ) os << ", ";
-	    }
+	    } // while
 	    os << ")";
-	}
+	} // if
 	if ( expr ) expr->printOneLine(os);
     } else {  // It's an aggregate
@@ -57,5 +57,5 @@
 	    next_init()->printOneLine(os);
 	if (aggregate) os << "--]";
-    }
+    } // if
 
     InitializerNode *moreInit;
@@ -88,5 +88,5 @@
 	if ( get_expression() != 0)
 	    return new SingleInit( get_expression()->build(), designators );
-    }
+    } // if
 
     return 0;
Index: translator/Parser/ParseNode.h
===================================================================
--- translator/Parser/ParseNode.h	(revision d9a0e763800888addddd70d8848a8f432b825e4b)
+++ translator/Parser/ParseNode.h	(revision 17cd4ebabb684710b2f3698449093c4e84b8fb70)
@@ -456,5 +456,5 @@
   ExpressionNode *get_expression() const { return expr; }
 
-  InitializerNode *set_designators( ExpressionNode *des ) { designator = des;  return this; }
+  InitializerNode *set_designators( ExpressionNode *des ) { designator = des; return this; }
   ExpressionNode *get_designators() const { return designator; }
 
Index: translator/Parser/TypeData.cc
===================================================================
--- translator/Parser/TypeData.cc	(revision d9a0e763800888addddd70d8848a8f432b825e4b)
+++ translator/Parser/TypeData.cc	(revision 17cd4ebabb684710b2f3698449093c4e84b8fb70)
@@ -560,5 +560,5 @@
 	    if ( *i == DeclarationNode::Void ) {
 		if ( basic->typeSpec.size() != 1 || !basic->modifiers.empty() ) {
-		    throw SemanticError( "invalid type specifier \"void\" in type ", this );
+		    throw SemanticError( "invalid type specifier \"void\" in type: ", this );
 		} else {
 		    return new VoidType( buildQualifiers() );
@@ -571,5 +571,5 @@
 	      case DeclarationNode::Float:
 		if ( sawDouble ) {
-		    throw SemanticError( "invalid type specifier \"float\" in type ", this );
+		    throw SemanticError( "invalid type specifier \"float\" in type: ", this );
 		} else {
 		    switch ( ret ) {
@@ -581,5 +581,5 @@
 			break;
 		      default:
-			throw SemanticError( "invalid type specifier \"float\" in type ", this );
+			throw SemanticError( "invalid type specifier \"float\" in type: ", this );
 		    }
 		}
@@ -587,5 +587,5 @@
 	      case DeclarationNode::Double:
 		if ( sawDouble ) {
-		    throw SemanticError( "duplicate type specifier \"double\" in type ", this );
+		    throw SemanticError( "duplicate type specifier \"double\" in type: ", this );
 		} else {
 		    switch ( ret ) {
@@ -594,5 +594,5 @@
 			break;
 		      default:
-			throw SemanticError( "invalid type specifier \"double\" in type ", this );
+			throw SemanticError( "invalid type specifier \"double\" in type: ", this );
 		    }
 		}
@@ -609,5 +609,5 @@
 		    break;
 		  default:
-		    throw SemanticError( "invalid type specifier \"complex\" in type ", this );
+		    throw SemanticError( "invalid type specifier \"_Complex\" in type: ", this );
 		}
 		break;
@@ -623,10 +623,10 @@
 		    break;
 		  default:
-		    throw SemanticError( "invalid type specifier \"imaginary\" in type ", this );
+		    throw SemanticError( "invalid type specifier \"_Imaginary\" in type: ", this );
 		}
 		break;
         
 	      default:
-		throw SemanticError( std::string( "invalid type specifier \"" ) + DeclarationNode::basicTypeName[ *i ] + "\" in type ", this );
+		throw SemanticError( std::string( "invalid type specifier \"" ) + DeclarationNode::basicTypeName[ *i ] + "\" in type: ", this );
 	    }
 	}
@@ -666,5 +666,5 @@
 		    break;
 		  default:
-		    throw SemanticError( "invalid type modifier \"long\" in type ", this );
+		    throw SemanticError( "invalid type modifier \"long\" in type: ", this );
 		}
 	    }
@@ -683,5 +683,5 @@
 		    break;
 		  default:
-		    throw SemanticError( "invalid type modifier \"short\" in type ", this );
+		    throw SemanticError( "invalid type modifier \"short\" in type: ", this );
 		}
 	    }
@@ -692,5 +692,5 @@
 		ret = BasicType::SignedInt;
 	    } else if ( sawSigned ) {
-		throw SemanticError( "duplicate type modifer \"signed\" in type ", this );
+		throw SemanticError( "duplicate type modifer \"signed\" in type: ", this );
 	    } else {
 		switch ( ret ) {
@@ -702,5 +702,5 @@
 		    break;
 		  default:
-		    throw SemanticError( "invalid type modifer \"signed\" in type ", this );
+		    throw SemanticError( "invalid type modifer \"signed\" in type: ", this );
 		}
 	    }
@@ -711,5 +711,5 @@
 		ret = BasicType::UnsignedInt;
 	    } else if ( sawSigned ) {
-		throw SemanticError( "invalid type modifer \"unsigned\" in type ", this );
+		throw SemanticError( "invalid type modifer \"unsigned\" in type: ", this );
 	    } else {
 		switch ( ret ) {
@@ -727,5 +727,5 @@
 		    break;
 		  default:
-		    throw SemanticError( "invalid type modifer \"unsigned\" in type ", this );
+		    throw SemanticError( "invalid type modifer \"unsigned\" in type: ", this );
 		}
 	    }
Index: translator/Parser/cfa.y
===================================================================
--- translator/Parser/cfa.y	(revision d9a0e763800888addddd70d8848a8f432b825e4b)
+++ translator/Parser/cfa.y	(revision 17cd4ebabb684710b2f3698449093c4e84b8fb70)
@@ -10,6 +10,6 @@
  * Created On       : Sat Sep  1 20:22:55 2001
  * Last Modified By : Peter A. Buhr
- * Last Modified On : Tue Nov 25 23:52:54 2014
- * Update Count     : 890
+ * Last Modified On : Wed Jan  7 09:19:57 2015
+ * Update Count     : 906
  */
 
@@ -294,7 +294,7 @@
 		/* ENUMERATIONconstant is not included here; it is treated as a variable with type
 		   "enumeration constant". */
-	INTEGERconstant		{ $$ = new ConstantNode(ConstantNode::Integer,   $1); }
-	| FLOATINGconstant	{ $$ = new ConstantNode(ConstantNode::Float,     $1); }
-	| CHARACTERconstant	{ $$ = new ConstantNode(ConstantNode::Character, $1); }
+	INTEGERconstant					{ $$ = new ConstantNode(ConstantNode::Integer,   $1); }
+	| FLOATINGconstant				{ $$ = new ConstantNode(ConstantNode::Float,     $1); }
+	| CHARACTERconstant				{ $$ = new ConstantNode(ConstantNode::Character, $1); }
 	;
 
@@ -320,6 +320,6 @@
 
 string_literal_list:					/* juxtaposed strings are concatenated */
-	STRINGliteral				{ $$ = new ConstantNode(ConstantNode::String, $1); }
-	| string_literal_list STRINGliteral	{ $$ = $1->append( $2 ); }
+	STRINGliteral					{ $$ = new ConstantNode(ConstantNode::String, $1); }
+	| string_literal_list STRINGliteral		{ $$ = $1->append( $2 ); }
 	;
 
@@ -352,10 +352,8 @@
 		{ $$ = new CompositeExprNode($1, $3); }
 	| postfix_expression '.' no_attr_identifier
-		{ $$ = new CompositeExprNode(new OperatorNode(OperatorNode::FieldSel), $1,
-					     new VarRefNode($3)); }
+		{ $$ = new CompositeExprNode(new OperatorNode(OperatorNode::FieldSel), $1, new VarRefNode($3)); }
 	| postfix_expression '.' '[' push field_list pop ']' /* CFA, tuple field selector */
 	| postfix_expression ARROW no_attr_identifier
-		{ $$ = new CompositeExprNode(new OperatorNode(OperatorNode::PFieldSel), $1,
-					     new VarRefNode($3)); }
+		{ $$ = new CompositeExprNode(new OperatorNode(OperatorNode::PFieldSel), $1, new VarRefNode($3)); }
 	| postfix_expression ARROW '[' push field_list pop ']' /* CFA, tuple field selector */
 	| postfix_expression ICR
@@ -371,5 +369,5 @@
 	argument_expression
 	| argument_expression_list ',' argument_expression
-						{ $$ = (ExpressionNode *)($1->set_link($3)); }
+							{ $$ = (ExpressionNode *)($1->set_link($3)); }
 	;
 
@@ -379,5 +377,5 @@
 	| assignment_expression
 	| no_attr_identifier ':' assignment_expression
-                                                { $$ = $3->set_asArgName($1); }
+							{ $$ = $3->set_asArgName($1); }
 		/* Only a list of no_attr_identifier_or_typedef_name is allowed in this context. However, there
 		   is insufficient look ahead to distinguish between this list of parameter names and a tuple,
@@ -391,18 +389,18 @@
 field_list:						/* CFA, tuple field selector */
 	field
-	| field_list ',' field                  { $$ = (ExpressionNode *)$1->set_link( $3 ); }
+	| field_list ',' field				{ $$ = (ExpressionNode *)$1->set_link( $3 ); }
 	;
 
 field:							/* CFA, tuple field selector */
 	no_attr_identifier
-						{ $$ = new VarRefNode( $1 ); }
+							{ $$ = new VarRefNode( $1 ); }
 	| no_attr_identifier '.' field
-						{ $$ = new CompositeExprNode(new OperatorNode(OperatorNode::FieldSel), new VarRefNode( $1 ), $3); }
+							{ $$ = new CompositeExprNode(new OperatorNode(OperatorNode::FieldSel), new VarRefNode( $1 ), $3); }
 	| no_attr_identifier '.' '[' push field_list pop ']'
-						{ $$ = new CompositeExprNode(new OperatorNode(OperatorNode::FieldSel), new VarRefNode( $1 ), $5); }
+							{ $$ = new CompositeExprNode(new OperatorNode(OperatorNode::FieldSel), new VarRefNode( $1 ), $5); }
 	| no_attr_identifier ARROW field
-						{ $$ = new CompositeExprNode(new OperatorNode(OperatorNode::PFieldSel), new VarRefNode( $1 ), $3); }
+							{ $$ = new CompositeExprNode(new OperatorNode(OperatorNode::PFieldSel), new VarRefNode( $1 ), $3); }
 	| no_attr_identifier ARROW '[' push field_list pop ']'
-						{ $$ = new CompositeExprNode(new OperatorNode(OperatorNode::PFieldSel), new VarRefNode( $1 ), $5); }
+							{ $$ = new CompositeExprNode(new OperatorNode(OperatorNode::PFieldSel), new VarRefNode( $1 ), $5); }
 	;
 
@@ -440,13 +438,12 @@
 		{ $$ = new CompositeExprNode(new OperatorNode(OperatorNode::AlignOf), new TypeValueNode($3)); }
 	| ANDAND no_attr_identifier			/* GCC, address of label */
-		{ $$ = new CompositeExprNode(new OperatorNode(OperatorNode::LabelAddress),
-					     new VarRefNode($2, true)); }
+		{ $$ = new CompositeExprNode(new OperatorNode(OperatorNode::LabelAddress), new VarRefNode($2, true)); }
 	;
 
 unary_operator:
-	'&'                               { $$ = new OperatorNode(OperatorNode::AddressOf); }
-	| '+'                             { $$ = new OperatorNode(OperatorNode::UnPlus); }
-	| '-'                             { $$ = new OperatorNode(OperatorNode::UnMinus); }
-	| '~'                             { $$ = new OperatorNode(OperatorNode::BitNeg); }
+	'&'						{ $$ = new OperatorNode(OperatorNode::AddressOf); }
+	| '+'						{ $$ = new OperatorNode(OperatorNode::UnPlus); }
+	| '-'						{ $$ = new OperatorNode(OperatorNode::UnMinus); }
+	| '~'						{ $$ = new OperatorNode(OperatorNode::BitNeg); }
 	;
 
@@ -454,9 +451,7 @@
 	unary_expression
 	| '(' type_name_no_function ')' cast_expression
-						{ $$ = new CompositeExprNode(new OperatorNode(OperatorNode::Cast),
-								       new TypeValueNode($2), $4); }
+							{ $$ = new CompositeExprNode(new OperatorNode(OperatorNode::Cast), new TypeValueNode($2), $4); }
 	| '(' type_name_no_function ')' tuple
-						{ $$ = new CompositeExprNode(new OperatorNode(OperatorNode::Cast),
-								       new TypeValueNode($2), $4); }
+							{ $$ = new CompositeExprNode(new OperatorNode(OperatorNode::Cast), new TypeValueNode($2), $4); }
 	;
 
@@ -464,9 +459,9 @@
 	cast_expression
 	| multiplicative_expression '*' cast_expression
-						{ $$ = new CompositeExprNode(new OperatorNode(OperatorNode::Mul),$1,$3); }
+							{ $$ = new CompositeExprNode(new OperatorNode(OperatorNode::Mul),$1,$3); }
 	| multiplicative_expression '/' cast_expression
-						{ $$ = new CompositeExprNode(new OperatorNode(OperatorNode::Div),$1,$3); }
+							{ $$ = new CompositeExprNode(new OperatorNode(OperatorNode::Div),$1,$3); }
 	| multiplicative_expression '%' cast_expression
-						{ $$ = new CompositeExprNode(new OperatorNode(OperatorNode::Mod),$1,$3); }
+							{ $$ = new CompositeExprNode(new OperatorNode(OperatorNode::Mod),$1,$3); }
 	;
 
@@ -474,7 +469,7 @@
 	multiplicative_expression
 	| additive_expression '+' multiplicative_expression
-						{ $$ = new CompositeExprNode(new OperatorNode(OperatorNode::Plus),$1,$3); }
+							{ $$ = new CompositeExprNode(new OperatorNode(OperatorNode::Plus),$1,$3); }
 	| additive_expression '-' multiplicative_expression
-						{ $$ = new CompositeExprNode(new OperatorNode(OperatorNode::Minus),$1,$3); }
+							{ $$ = new CompositeExprNode(new OperatorNode(OperatorNode::Minus),$1,$3); }
 	;
 
@@ -482,5 +477,5 @@
 	additive_expression
 	| shift_expression LS additive_expression
-						{ $$ = new CompositeExprNode(new OperatorNode(OperatorNode::LShift),$1,$3); }
+							{ $$ = new CompositeExprNode(new OperatorNode(OperatorNode::LShift),$1,$3); }
 	| shift_expression RS additive_expression
 						{ $$ = new CompositeExprNode(new OperatorNode(OperatorNode::RShift),$1,$3); }
@@ -558,7 +553,7 @@
 	conditional_expression
 	| unary_expression '=' assignment_expression
-						{ $$ =new CompositeExprNode(new OperatorNode(OperatorNode::Assign), $1, $3); }
+							{ $$ =new CompositeExprNode(new OperatorNode(OperatorNode::Assign), $1, $3); }
 	| unary_expression assignment_operator assignment_expression
-						{ $$ =new CompositeExprNode($2, $1, $3); }
+							{ $$ =new CompositeExprNode($2, $1, $3); }
 	| tuple assignment_opt				/* CFA, tuple expression */
 		{
@@ -1209,5 +1204,5 @@
 			typedefTable.enterScope();
 		}
-	  type_parameter_list ')'		/* CFA */
+	  type_parameter_list ')'			/* CFA */
 		{
 			typedefTable.leaveScope();
@@ -1630,19 +1625,19 @@
 
 initializer_opt:
-	/* empty */                             { $$ = 0; }
-	| '=' initializer                       { $$ = $2; }
+	/* empty */                             	{ $$ = 0; }
+	| '=' initializer                       	{ $$ = $2; }
 	;
 
 initializer:
-	assignment_expression			{ $$ = new InitializerNode($1); }
-	| '{' initializer_list comma_opt '}'    { $$ = new InitializerNode($2, true); }
+	assignment_expression				{ $$ = new InitializerNode($1); }
+	| '{' initializer_list comma_opt '}'    	{ $$ = new InitializerNode($2, true); }
 	;
 
 initializer_list:
 	initializer
-	| designation initializer                            { $$ = $2->set_designators( $1 ); }
-	| initializer_list ',' initializer                   { $$ = (InitializerNode *)( $1->set_link($3) ); }
+	| designation initializer			{ $$ = $2->set_designators( $1 ); }
+	| initializer_list ',' initializer		{ $$ = (InitializerNode *)( $1->set_link($3) ); }
 	| initializer_list ',' designation initializer
-					   { $$ = (InitializerNode *)( $1->set_link( $4->set_designators($3) ) ); }
+							{ $$ = (InitializerNode *)( $1->set_link( $4->set_designators($3) ) ); }
 	;
 
@@ -1659,26 +1654,26 @@
 designation:
 	designator_list ':'				/* ANSI99, CFA uses ":" instead of "=" */
-	| no_attr_identifier_or_typedef_name ':'		/* GCC, field name */
-						       { $$ = new VarRefNode( $1 ); }
+	| no_attr_identifier_or_typedef_name ':'	/* GCC, field name */
+							{ $$ = new VarRefNode( $1 ); }
 	;
 
 designator_list:					/* ANSI99 */
 	designator
-	| designator_list designator                   { $$ = (ExpressionNode *)($1->set_link( $2 )); }
+	| designator_list designator			{ $$ = (ExpressionNode *)($1->set_link( $2 )); }
 	;
 
 designator:
 	'.' no_attr_identifier_or_typedef_name		/* ANSI99, field name */
-						       { $$ = new VarRefNode( $2 ); }
+							{ $$ = new VarRefNode( $2 ); }
 	| '[' push assignment_expression pop ']'	/* ANSI99, single array element */
 		/* assignment_expression used instead of constant_expression because of shift/reduce conflicts
 		   with tuple. */
-						       { $$ = $3; }
+							{ $$ = $3; }
 	| '[' push subrange pop ']'			/* CFA, multiple array elements */
-						       { $$ = $3; }
+							{ $$ = $3; }
 	| '[' push constant_expression ELLIPSIS constant_expression pop ']' /* GCC, multiple array elements */
-						       { $$ = new CompositeExprNode(new OperatorNode(OperatorNode::Range), $3, $5); }
+							{ $$ = new CompositeExprNode(new OperatorNode(OperatorNode::Range), $3, $5); }
 	| '.' '[' push field_list pop ']'		/* CFA, tuple field selector */
-						       { $$ = $4; }
+							{ $$ = $4; }
 	;
 
@@ -2492,18 +2487,21 @@
 	ISO/IEC 9899:1999 Section 6.7.5.2(1) : "The optional type qualifiers and the keyword static shall
 	appear only in a declaration of a function parameter with an array type, and then only in the
-	outermost array type derivation."
-   */
+	outermost array type derivation." */
 
 array_parameter_1st_dimension:
 	'[' push pop ']'
 		{ $$ = DeclarationNode::newArray( 0, 0, false ); }
+	// multi_array_dimension handles the '[' '*' ']' case
 	| '[' push type_qualifier_list '*' pop ']'	/* remaining ANSI99 */
 		{ $$ = DeclarationNode::newVarArray( $3 ); }
+	| '[' push type_qualifier_list pop ']'
+		{ $$ = DeclarationNode::newArray( 0, $3, false ); }
+	// multi_array_dimension handles the '[' assignment_expression ']' case
 	| '[' push type_qualifier_list assignment_expression pop ']'
 		{ $$ = DeclarationNode::newArray( $4, $3, false ); }
-	| '[' push STATIC assignment_expression pop ']'
-		{ $$ = DeclarationNode::newArray( $4, 0, true ); }
-	| '[' push STATIC type_qualifier_list assignment_expression pop ']'
+	| '[' push STATIC type_qualifier_list_opt assignment_expression pop ']'
 		{ $$ = DeclarationNode::newArray( $5, $4, true ); }
+	| '[' push type_qualifier_list STATIC assignment_expression pop ']'
+		{ $$ = DeclarationNode::newArray( $5, $3, true ); }
 	;
 
Index: translator/ResolvExpr/Resolver.cc
===================================================================
--- translator/ResolvExpr/Resolver.cc	(revision d9a0e763800888addddd70d8848a8f432b825e4b)
+++ translator/ResolvExpr/Resolver.cc	(revision 17cd4ebabb684710b2f3698449093c4e84b8fb70)
@@ -47,5 +47,5 @@
 	    (*i)->print( std::cerr );
 	    (*i)->accept( resolver );
-	}
+	} // for
 #endif
     }
@@ -81,6 +81,6 @@
 		for ( std::list< Alternative >::const_iterator i = finder.get_alternatives().begin(); i != finder.get_alternatives().end(); ++i ) {
 		    i->print( std::cout );
-		}
-	    }
+		} // for
+	    } // if
 #endif
 	    assert( finder.get_alternatives().size() == 1 );
@@ -98,5 +98,5 @@
 	    } else {
 		return true;
-	    }
+	    } // if
 	}
   
@@ -112,6 +112,6 @@
 		for ( std::list< Alternative >::const_iterator i = finder.get_alternatives().begin(); i != finder.get_alternatives().end(); ++i ) {
 		    i->print( std::cout );
-		}
-	    }
+		} // for
+	    } // if
 #endif
 	    Expression *newExpr = 0;
@@ -124,10 +124,10 @@
 			newExpr = i->expr->clone();
 			newEnv = &i->env;
-		    }
-		}
-	    }
+		    } // if
+		} // if
+	    } // for
 	    if ( !newExpr ) {
 		throw SemanticError( "Too many interpretations for switch control expression", untyped );
-	    }
+	    } // if
 	    finishExpr( newExpr, *newEnv );
 	    return newExpr;
@@ -147,5 +147,5 @@
 	    Type *new_type = resolveTypeof( typeDecl->get_base(), *this );
 	    typeDecl->set_base( new_type );
-	}
+	} // if
 	SymTab::Indexer::visit( typeDecl );
     }
@@ -163,5 +163,5 @@
 	for ( std::list< DeclarationWithType * >::const_iterator i = functionDecl->get_functionType()->get_returnVals().begin(); i != functionDecl->get_functionType()->get_returnVals().end(); ++i ) {
 	    functionReturn.push_back( (*i)->get_type() );
-	}
+	} // for
 	SymTab::Indexer::visit( functionDecl );
 	functionReturn = oldFunctionReturn;
@@ -173,5 +173,5 @@
 	    delete exprStmt->get_expr();
 	    exprStmt->set_expr( newExpr );
-	}
+	} // if
     }
 
@@ -196,5 +196,5 @@
 	    delete forStmt->get_condition();
 	    forStmt->set_condition( newExpr );
-	}
+	} // if
   
 	if ( forStmt->get_increment() ) {
@@ -202,5 +202,5 @@
 	    delete forStmt->get_increment();
 	    forStmt->set_increment( newExpr );
-	}
+	} // if
   
 	Visitor::visit( forStmt );
@@ -236,15 +236,15 @@
 	    delete castExpr;
 	    returnStmt->set_expr( newExpr );
-	}
+	} // if
     }
 
     void Resolver::visit( SingleInit *singleInit ) {
-	// if ( singleInit->get_value() ) {
-	//     CastExpr *castExpr = new CastExpr( singleInit->get_value(), initContext->clone() );
-	//     Expression *newExpr = findSingleExpression( castExpr, *this );
-	//     delete castExpr;
-	//     singleInit->set_value( newExpr );
-	// }
-	// singleInit->get_value()->accept( *this );
+	if ( singleInit->get_value() ) {
+	    CastExpr *castExpr = new CastExpr( singleInit->get_value(), initContext->clone() );
+	    Expression *newExpr = findSingleExpression( castExpr, *this );
+	    delete castExpr;
+	    singleInit->set_value( newExpr );
+	} // if
+	singleInit->get_value()->accept( *this );
     }
 
Index: translator/SymTab/Indexer.cc
===================================================================
--- translator/SymTab/Indexer.cc	(revision d9a0e763800888addddd70d8848a8f432b825e4b)
+++ translator/SymTab/Indexer.cc	(revision 17cd4ebabb684710b2f3698449093c4e84b8fb70)
@@ -1,9 +1,2 @@
-/*
- * This file is part of the Cforall project
- *
- * $Id: Indexer.cc,v 1.12 2005/08/29 20:14:17 rcbilson Exp $
- *
- */
-
 #include "SynTree/Declaration.h"
 #include "SynTree/Type.h"
@@ -15,41 +8,31 @@
 #include "utility.h"
 
-#define debugPrint(x) if( doDebug ) { std::cout << x; }
+#define debugPrint(x) if ( doDebug ) { std::cout << x; }
 
 namespace SymTab {
-
-Indexer::Indexer( bool useDebug )
-  : doDebug( useDebug )
-{
-}
-
-Indexer::~Indexer()
-{
-}
-
-void 
-Indexer::visit( ObjectDecl *objectDecl )
-{
-  maybeAccept( objectDecl->get_type(), *this );
-  maybeAccept( objectDecl->get_init(), *this );
-  maybeAccept( objectDecl->get_bitfieldWidth(), *this );
-  if( objectDecl->get_name() != "" ) {
-    debugPrint( "Adding object " << objectDecl->get_name() << std::endl );
-    idTable.addDecl( objectDecl );
-  }
-}
-
-void 
-Indexer::visit( FunctionDecl *functionDecl )
-{
-  if( functionDecl->get_name() == "" ) return;
-  debugPrint( "Adding function " << functionDecl->get_name() << std::endl );
-  idTable.addDecl( functionDecl );
-  enterScope();
-  maybeAccept( functionDecl->get_functionType(), *this );
-  acceptAll( functionDecl->get_oldDecls(), *this );
-  maybeAccept( functionDecl->get_statements(), *this );
-  leaveScope();
-}
+    Indexer::Indexer( bool useDebug ) : doDebug( useDebug ) {}
+
+    Indexer::~Indexer() {}
+
+    void Indexer::visit( ObjectDecl *objectDecl ) {
+	maybeAccept( objectDecl->get_type(), *this );
+	maybeAccept( objectDecl->get_init(), *this );
+	maybeAccept( objectDecl->get_bitfieldWidth(), *this );
+	if ( objectDecl->get_name() != "" ) {
+	    debugPrint( "Adding object " << objectDecl->get_name() << std::endl );
+	    idTable.addDecl( objectDecl );
+	}
+    }
+
+    void Indexer::visit( FunctionDecl *functionDecl ) {
+	if ( functionDecl->get_name() == "" ) return;
+	debugPrint( "Adding function " << functionDecl->get_name() << std::endl );
+	idTable.addDecl( functionDecl );
+	enterScope();
+	maybeAccept( functionDecl->get_functionType(), *this );
+	acceptAll( functionDecl->get_oldDecls(), *this );
+	maybeAccept( functionDecl->get_statements(), *this );
+	leaveScope();
+    }
 
 /********
@@ -72,211 +55,171 @@
  */
 
-void 
-Indexer::visit( TypeDecl *typeDecl )
-{
-  // see A NOTE ON THE ORDER OF TRAVERSAL, above
-  // note that assertions come after the type is added to the symtab, since they aren't part
-  // of the type proper and may depend on the type itself
-  enterScope();
-  acceptAll( typeDecl->get_parameters(), *this );
-  maybeAccept( typeDecl->get_base(), *this );
-  leaveScope();
-  debugPrint( "Adding type " << typeDecl->get_name() << std::endl );
-  typeTable.add( typeDecl );
-  acceptAll( typeDecl->get_assertions(), *this );
-}
-
-void 
-Indexer::visit( TypedefDecl *typeDecl )
-{
-  enterScope();
-  acceptAll( typeDecl->get_parameters(), *this );
-  maybeAccept( typeDecl->get_base(), *this );
-  leaveScope();
-  debugPrint( "Adding typedef " << typeDecl->get_name() << std::endl );
-  typeTable.add( typeDecl );
-}
-
-void 
-Indexer::visit( StructDecl *aggregateDecl )
-{
-  // make up a forward declaration and add it before processing the members
-  StructDecl fwdDecl( aggregateDecl->get_name() );
-  cloneAll( aggregateDecl->get_parameters(), fwdDecl.get_parameters() );
-  debugPrint( "Adding fwd decl for struct " << fwdDecl.get_name() << std::endl );
-  structTable.add( &fwdDecl );
-  
-  enterScope();
-  acceptAll( aggregateDecl->get_parameters(), *this );
-  acceptAll( aggregateDecl->get_members(), *this );
-  leaveScope();
-  
-  debugPrint( "Adding struct " << aggregateDecl->get_name() << std::endl );
-  // this addition replaces the forward declaration
-  structTable.add( aggregateDecl );
-}
-
-void 
-Indexer::visit( UnionDecl *aggregateDecl )
-{
-  // make up a forward declaration and add it before processing the members
-  UnionDecl fwdDecl( aggregateDecl->get_name() );
-  cloneAll( aggregateDecl->get_parameters(), fwdDecl.get_parameters() );
-  debugPrint( "Adding fwd decl for union " << fwdDecl.get_name() << std::endl );
-  unionTable.add( &fwdDecl );
-  
-  enterScope();
-  acceptAll( aggregateDecl->get_parameters(), *this );
-  acceptAll( aggregateDecl->get_members(), *this );
-  leaveScope();
-  
-  debugPrint( "Adding union " << aggregateDecl->get_name() << std::endl );
-  unionTable.add( aggregateDecl );
-}
-
-void 
-Indexer::visit( EnumDecl *aggregateDecl )
-{
-  debugPrint( "Adding enum " << aggregateDecl->get_name() << std::endl );
-  enumTable.add( aggregateDecl );
-  // unlike structs, contexts, and unions, enums inject their members into the
-  // global scope
-  acceptAll( aggregateDecl->get_members(), *this );
-}
-
-void 
-Indexer::visit( ContextDecl *aggregateDecl )
-{
-  enterScope();
-  acceptAll( aggregateDecl->get_parameters(), *this );
-  acceptAll( aggregateDecl->get_members(), *this );
-  leaveScope();
-  
-  debugPrint( "Adding context " << aggregateDecl->get_name() << std::endl );
-  contextTable.add( aggregateDecl );
-}
-
-void 
-Indexer::visit( CompoundStmt *compoundStmt )
-{
-  enterScope();
-  acceptAll( compoundStmt->get_kids(), *this );
-  leaveScope();
-}
-
-void 
-Indexer::visit( ContextInstType *contextInst )
-{
-  acceptAll( contextInst->get_parameters(), *this );
-  acceptAll( contextInst->get_members(), *this );
-}
-
-void 
-Indexer::visit( StructInstType *structInst )
-{
-  if( !structTable.lookup( structInst->get_name() ) ) {
-    debugPrint( "Adding struct " << structInst->get_name() << " from implicit forward declaration" << std::endl );
-    structTable.add( structInst->get_name() );
-  }
-  enterScope();
-  acceptAll( structInst->get_parameters(), *this );
-  leaveScope();
-}
-
-void 
-Indexer::visit( UnionInstType *unionInst )
-{
-  if( !unionTable.lookup( unionInst->get_name() ) ) {
-    debugPrint( "Adding union " << unionInst->get_name() << " from implicit forward declaration" << std::endl );
-    unionTable.add( unionInst->get_name() );
-  }
-  enterScope();
-  acceptAll( unionInst->get_parameters(), *this );
-  leaveScope();
-}
-
-void
-Indexer::lookupId( const std::string &id, std::list< DeclarationWithType* > &list ) const
-{
-  idTable.lookupId( id, list );
-}
-
-NamedTypeDecl *
-Indexer::lookupType( const std::string &id ) const
-{
-  return typeTable.lookup( id );
-}
-
-StructDecl *
-Indexer::lookupStruct( const std::string &id ) const
-{
-  return structTable.lookup( id );
-}
-
-EnumDecl *
-Indexer::lookupEnum( const std::string &id ) const
-{
-  return enumTable.lookup( id );
-}
-
-UnionDecl *
-Indexer::lookupUnion( const std::string &id ) const
-{
-  return unionTable.lookup( id );
-}
-
-ContextDecl *
-Indexer::lookupContext( const std::string &id ) const
-{
-  return contextTable.lookup( id );
-}
-
-void 
-Indexer::enterScope()
-{
-  if( doDebug ) {
-    std::cout << "--- Entering scope" << std::endl;
-  }
-  idTable.enterScope();
-  typeTable.enterScope();
-  structTable.enterScope();
-  enumTable.enterScope();
-  unionTable.enterScope();
-  contextTable.enterScope();
-}
-
-void 
-Indexer::leaveScope()
-{
-  using std::cout;
-  using std::endl;
-  
-  if( doDebug ) {
-    cout << "--- Leaving scope containing" << endl;
-    idTable.dump( cout );
-    typeTable.dump( cout );
-    structTable.dump( cout );
-    enumTable.dump( cout );
-    unionTable.dump( cout );
-    contextTable.dump( cout );
-  }
-  idTable.leaveScope();
-  typeTable.leaveScope();
-  structTable.leaveScope();
-  enumTable.leaveScope();
-  unionTable.leaveScope();
-  contextTable.leaveScope();
-}
-
-void 
-Indexer::print( std::ostream &os, int indent ) const
-{
-    idTable.dump( os );
-    typeTable.dump( os );
-    structTable.dump( os );
-    enumTable.dump( os );
-    unionTable.dump( os );
-    contextTable.dump( os );
-}
-
+    void Indexer::visit( TypeDecl *typeDecl ) {
+	// see A NOTE ON THE ORDER OF TRAVERSAL, above
+	// note that assertions come after the type is added to the symtab, since they aren't part
+	// of the type proper and may depend on the type itself
+	enterScope();
+	acceptAll( typeDecl->get_parameters(), *this );
+	maybeAccept( typeDecl->get_base(), *this );
+	leaveScope();
+	debugPrint( "Adding type " << typeDecl->get_name() << std::endl );
+	typeTable.add( typeDecl );
+	acceptAll( typeDecl->get_assertions(), *this );
+    }
+
+    void Indexer::visit( TypedefDecl *typeDecl ) {
+	enterScope();
+	acceptAll( typeDecl->get_parameters(), *this );
+	maybeAccept( typeDecl->get_base(), *this );
+	leaveScope();
+	debugPrint( "Adding typedef " << typeDecl->get_name() << std::endl );
+	typeTable.add( typeDecl );
+    }
+
+    void Indexer::visit( StructDecl *aggregateDecl ) {
+	// make up a forward declaration and add it before processing the members
+	StructDecl fwdDecl( aggregateDecl->get_name() );
+	cloneAll( aggregateDecl->get_parameters(), fwdDecl.get_parameters() );
+	debugPrint( "Adding fwd decl for struct " << fwdDecl.get_name() << std::endl );
+	structTable.add( &fwdDecl );
+  
+	enterScope();
+	acceptAll( aggregateDecl->get_parameters(), *this );
+	acceptAll( aggregateDecl->get_members(), *this );
+	leaveScope();
+  
+	debugPrint( "Adding struct " << aggregateDecl->get_name() << std::endl );
+	// this addition replaces the forward declaration
+	structTable.add( aggregateDecl );
+    }
+
+    void Indexer::visit( UnionDecl *aggregateDecl ) {
+	// make up a forward declaration and add it before processing the members
+	UnionDecl fwdDecl( aggregateDecl->get_name() );
+	cloneAll( aggregateDecl->get_parameters(), fwdDecl.get_parameters() );
+	debugPrint( "Adding fwd decl for union " << fwdDecl.get_name() << std::endl );
+	unionTable.add( &fwdDecl );
+  
+	enterScope();
+	acceptAll( aggregateDecl->get_parameters(), *this );
+	acceptAll( aggregateDecl->get_members(), *this );
+	leaveScope();
+  
+	debugPrint( "Adding union " << aggregateDecl->get_name() << std::endl );
+	unionTable.add( aggregateDecl );
+    }
+
+    void Indexer::visit( EnumDecl *aggregateDecl ) {
+	debugPrint( "Adding enum " << aggregateDecl->get_name() << std::endl );
+	enumTable.add( aggregateDecl );
+	// unlike structs, contexts, and unions, enums inject their members into the global scope
+	acceptAll( aggregateDecl->get_members(), *this );
+    }
+
+    void Indexer::visit( ContextDecl *aggregateDecl ) {
+	enterScope();
+	acceptAll( aggregateDecl->get_parameters(), *this );
+	acceptAll( aggregateDecl->get_members(), *this );
+	leaveScope();
+  
+	debugPrint( "Adding context " << aggregateDecl->get_name() << std::endl );
+	contextTable.add( aggregateDecl );
+    }
+
+    void Indexer::visit( CompoundStmt *compoundStmt ) {
+	enterScope();
+	acceptAll( compoundStmt->get_kids(), *this );
+	leaveScope();
+    }
+
+    void Indexer::visit( ContextInstType *contextInst ) {
+	acceptAll( contextInst->get_parameters(), *this );
+	acceptAll( contextInst->get_members(), *this );
+    }
+
+    void Indexer::visit( StructInstType *structInst ) {
+	if ( ! structTable.lookup( structInst->get_name() ) ) {
+	    debugPrint( "Adding struct " << structInst->get_name() << " from implicit forward declaration" << std::endl );
+	    structTable.add( structInst->get_name() );
+	}
+	enterScope();
+	acceptAll( structInst->get_parameters(), *this );
+	leaveScope();
+    }
+
+    void Indexer::visit( UnionInstType *unionInst ) {
+	if ( ! unionTable.lookup( unionInst->get_name() ) ) {
+	    debugPrint( "Adding union " << unionInst->get_name() << " from implicit forward declaration" << std::endl );
+	    unionTable.add( unionInst->get_name() );
+	}
+	enterScope();
+	acceptAll( unionInst->get_parameters(), *this );
+	leaveScope();
+    }
+
+    void Indexer::lookupId( const std::string &id, std::list< DeclarationWithType* > &list ) const {
+	idTable.lookupId( id, list );
+    }
+
+    NamedTypeDecl *Indexer::lookupType( const std::string &id ) const {
+	return typeTable.lookup( id );
+    }
+
+    StructDecl *Indexer::lookupStruct( const std::string &id ) const {
+	return structTable.lookup( id );
+    }
+
+    EnumDecl *Indexer::lookupEnum( const std::string &id ) const {
+	return enumTable.lookup( id );
+    }
+
+    UnionDecl *Indexer::lookupUnion( const std::string &id ) const {
+	return unionTable.lookup( id );
+    }
+
+    ContextDecl  * Indexer::lookupContext( const std::string &id ) const {
+	return contextTable.lookup( id );
+    }
+
+    void Indexer::enterScope() {
+	if ( doDebug ) {
+	    std::cout << "--- Entering scope" << std::endl;
+	}
+	idTable.enterScope();
+	typeTable.enterScope();
+	structTable.enterScope();
+	enumTable.enterScope();
+	unionTable.enterScope();
+	contextTable.enterScope();
+    }
+
+    void Indexer::leaveScope() {
+	using std::cout;
+	using std::endl;
+  
+	if ( doDebug ) {
+	    cout << "--- Leaving scope containing" << endl;
+	    idTable.dump( cout );
+	    typeTable.dump( cout );
+	    structTable.dump( cout );
+	    enumTable.dump( cout );
+	    unionTable.dump( cout );
+	    contextTable.dump( cout );
+	}
+	idTable.leaveScope();
+	typeTable.leaveScope();
+	structTable.leaveScope();
+	enumTable.leaveScope();
+	unionTable.leaveScope();
+	contextTable.leaveScope();
+    }
+
+    void Indexer::print( std::ostream &os, int indent ) const {
+	idTable.dump( os );
+	typeTable.dump( os );
+	structTable.dump( os );
+	enumTable.dump( os );
+	unionTable.dump( os );
+	contextTable.dump( os );
+    }
 } // namespace SymTab
Index: translator/SymTab/Indexer.h
===================================================================
--- translator/SymTab/Indexer.h	(revision d9a0e763800888addddd70d8848a8f432b825e4b)
+++ translator/SymTab/Indexer.h	(revision 17cd4ebabb684710b2f3698449093c4e84b8fb70)
@@ -1,12 +1,2 @@
-/*
- * This file is part of the Cforall project
- *
- * A class that indexes the syntax tree.  It is intended to be subclassed by a visitor class
- * that wants to use the index.
- *
- * $Id: Indexer.h,v 1.9 2005/08/29 20:14:18 rcbilson Exp $
- *
- */
-
 #ifndef SYMTAB_INDEXER_H
 #define SYMTAB_INDEXER_H
@@ -22,52 +12,48 @@
 
 namespace SymTab {
+    class Indexer : public Visitor {
+      public:
+	Indexer( bool useDebug = false );
+	virtual ~Indexer();
 
-class Indexer : public Visitor
-{
-public:
-  Indexer( bool useDebug = false );
-  virtual ~Indexer();
+	//using Visitor::visit;
+	virtual void visit( ObjectDecl *objectDecl );
+	virtual void visit( FunctionDecl *functionDecl );
+	virtual void visit( TypeDecl *typeDecl );
+	virtual void visit( TypedefDecl *typeDecl );
+	virtual void visit( StructDecl *aggregateDecl );
+	virtual void visit( UnionDecl *aggregateDecl );
+	virtual void visit( EnumDecl *aggregateDecl );
+	virtual void visit( ContextDecl *aggregateDecl );
 
-///   using Visitor::visit;
-  virtual void visit( ObjectDecl *objectDecl );
-  virtual void visit( FunctionDecl *functionDecl );
-  virtual void visit( TypeDecl *typeDecl );
-  virtual void visit( TypedefDecl *typeDecl );
-  virtual void visit( StructDecl *aggregateDecl );
-  virtual void visit( UnionDecl *aggregateDecl );
-  virtual void visit( EnumDecl *aggregateDecl );
-  virtual void visit( ContextDecl *aggregateDecl );
+	virtual void visit( CompoundStmt *compoundStmt );
 
-  virtual void visit( CompoundStmt *compoundStmt );
+	virtual void visit( ContextInstType *contextInst );
+	virtual void visit( StructInstType *contextInst );
+	virtual void visit( UnionInstType *contextInst );
+  
+	// when using an indexer manually (e.g., within a mutator traversal), it is necessary to tell the indexer
+	// explicitly when scopes begin and end
+	void enterScope();
+	void leaveScope();
 
-  virtual void visit( ContextInstType *contextInst );
-  virtual void visit( StructInstType *contextInst );
-  virtual void visit( UnionInstType *contextInst );
+	void lookupId( const std::string &id, std::list< DeclarationWithType* >& ) const;
+	NamedTypeDecl *lookupType( const std::string &id ) const;
+	StructDecl *lookupStruct( const std::string &id ) const;
+	EnumDecl *lookupEnum( const std::string &id ) const;
+	UnionDecl *lookupUnion( const std::string &id ) const;
+	ContextDecl *lookupContext( const std::string &id ) const;
   
-  // when using an indexer manually (e.g., within a mutator traversal), it is
-  // necessary to tell the indexer explicitly when scopes begin and end
-  void enterScope();
-  void leaveScope();
-
-  void lookupId( const std::string &id, std::list< DeclarationWithType* >& ) const;
-  NamedTypeDecl *lookupType( const std::string &id ) const;
-  StructDecl *lookupStruct( const std::string &id ) const;
-  EnumDecl *lookupEnum( const std::string &id ) const;
-  UnionDecl *lookupUnion( const std::string &id ) const;
-  ContextDecl *lookupContext( const std::string &id ) const;
+	void print( std::ostream &os, int indent = 0 ) const;
+      private:
+	IdTable idTable;
+	TypeTable typeTable;
+	StructTable structTable;
+	EnumTable enumTable;
+	UnionTable unionTable;
+	ContextTable contextTable;
   
-  void print( std::ostream &os, int indent = 0 ) const;
-
- private:
-  IdTable idTable;
-  TypeTable typeTable;
-  StructTable structTable;
-  EnumTable enumTable;
-  UnionTable unionTable;
-  ContextTable contextTable;
-  
-  bool doDebug;		// display debugging trace
-};
-
+	bool doDebug;					// display debugging trace
+    };
 } // namespace SymTab
 
Index: translator/SymTab/Validate.cc
===================================================================
--- translator/SymTab/Validate.cc	(revision d9a0e763800888addddd70d8848a8f432b825e4b)
+++ translator/SymTab/Validate.cc	(revision 17cd4ebabb684710b2f3698449093c4e84b8fb70)
@@ -185,7 +185,7 @@
 	    if ( ! visitor.get_declsToAdd().empty() ) {
 		translationUnit.splice( addBefore ? i : next, visitor.get_declsToAdd() );
-	    }
+	    } // if
 	    i = next;
-	}
+	} // while
     }
 
@@ -206,9 +206,9 @@
 		if ( doDelete ) {
 		    delete *i;
-		}
+		} // if
 		declList.erase( i );
-	    }
+	    } // if
 	    i = next;
-	}
+	} // while
     }
 
@@ -227,5 +227,5 @@
 	    Visitor::visit( aggregateDecl );
 	    inStruct = false;
-	}
+	} // if
 	// Always remove the hoisted aggregate from the inner structure.
 	filter( aggregateDecl->get_members(), isStructOrUnion, false );
@@ -275,9 +275,9 @@
 	// Set the type of each member of the enumeration to be EnumConstant
   
-	for( std::list< Declaration * >::iterator i = enumDecl->get_members().begin(); i != enumDecl->get_members().end(); ++i ) {
+	for ( std::list< Declaration * >::iterator i = enumDecl->get_members().begin(); i != enumDecl->get_members().end(); ++i ) {
 	    ObjectDecl *obj = dynamic_cast< ObjectDecl * >( *i );
 	    assert( obj );
 	    obj->set_type( new EnumInstType( Type::Qualifiers( true, false, false, false ), enumDecl->get_name() ) );
-	}
+	} // for
 	Parent::visit( enumDecl );
     }
@@ -285,6 +285,5 @@
     namespace {
 	template< typename DWTIterator >
-	void
-	fixFunctionList( DWTIterator begin, DWTIterator end, FunctionType *func ) {
+	void fixFunctionList( DWTIterator begin, DWTIterator end, FunctionType *func ) {
 	    // the only case in which "void" is valid is where it is the only one in the list; then
 	    // it should be removed entirely
@@ -300,15 +299,15 @@
 		if ( i != end ) { 
 		    throw SemanticError( "invalid type void in function type ", func );
-		}
+		} // if
 	    } else {
 		++i;
-		for( ; i != end; ++i ) {
+		for ( ; i != end; ++i ) {
 		    FixFunction fixer;
 		    *i = (*i )->acceptMutator( fixer );
 		    if ( fixer.get_isVoid() ) {
 			throw SemanticError( "invalid type void in function type ", func );
-		    }
-		}
-	    }
+		    } // if
+		} // for
+	    } // if
 	}
     }
@@ -326,5 +325,5 @@
 	} else {
 	    indexer = this;
-	}
+	} // if
     }
 
@@ -336,9 +335,9 @@
 	    assert( ! structInst->get_baseStruct() || structInst->get_baseStruct()->get_members().empty() || ! st->get_members().empty() );
 	    structInst->set_baseStruct( st );
-	}
+	} // if
 	if ( ! st || st->get_members().empty() ) {
 	    // use of forward declaration
 	    forwardStructs[ structInst->get_name() ].push_back( structInst );
-	}
+	} // if
     }
 
@@ -349,9 +348,9 @@
 	if ( un ) {
 	    unionInst->set_baseUnion( un );
-	}
+	} // if
 	if ( ! un || un->get_members().empty() ) {
 	    // use of forward declaration
 	    forwardUnions[ unionInst->get_name() ].push_back( unionInst );
-	}
+	} // if
     }
 
@@ -361,14 +360,14 @@
 	if ( ! ctx ) {
 	    throw SemanticError( "use of undeclared context " + contextInst->get_name() );
-	}
-	for( std::list< TypeDecl * >::const_iterator i = ctx->get_parameters().begin(); i != ctx->get_parameters().end(); ++i ) {
-	    for( std::list< DeclarationWithType * >::const_iterator assert = (*i )->get_assertions().begin(); assert != (*i )->get_assertions().end(); ++assert ) {
+	} // if
+	for ( std::list< TypeDecl * >::const_iterator i = ctx->get_parameters().begin(); i != ctx->get_parameters().end(); ++i ) {
+	    for ( std::list< DeclarationWithType * >::const_iterator assert = (*i )->get_assertions().begin(); assert != (*i )->get_assertions().end(); ++assert ) {
 		if ( ContextInstType *otherCtx = dynamic_cast< ContextInstType * >(*assert ) ) {
 		    cloneAll( otherCtx->get_members(), contextInst->get_members() );
 		} else {
 		    contextInst->get_members().push_back( (*assert )->clone() );
-		}
-	    }
-	}
+		} // if
+	    } // for
+	} // for
 	applySubstitution( ctx->get_parameters().begin(), ctx->get_parameters().end(), contextInst->get_parameters().begin(), ctx->get_members().begin(), ctx->get_members().end(), back_inserter( contextInst->get_members() ) );
     }
@@ -378,10 +377,10 @@
 	    ForwardStructsType::iterator fwds = forwardStructs.find( structDecl->get_name() );
 	    if ( fwds != forwardStructs.end() ) {
-		for( std::list< StructInstType * >::iterator inst = fwds->second.begin(); inst != fwds->second.end(); ++inst ) {
+		for ( std::list< StructInstType * >::iterator inst = fwds->second.begin(); inst != fwds->second.end(); ++inst ) {
 		    (*inst )->set_baseStruct( structDecl );
-		}
+		} // for
 		forwardStructs.erase( fwds );
-	    }
-	}
+	    } // if
+	} // if
 	Indexer::visit( structDecl );
     }
@@ -391,10 +390,10 @@
 	    ForwardUnionsType::iterator fwds = forwardUnions.find( unionDecl->get_name() );
 	    if ( fwds != forwardUnions.end() ) {
-		for( std::list< UnionInstType * >::iterator inst = fwds->second.begin(); inst != fwds->second.end(); ++inst ) {
+		for ( std::list< UnionInstType * >::iterator inst = fwds->second.begin(); inst != fwds->second.end(); ++inst ) {
 		    (*inst )->set_baseUnion( unionDecl );
-		}
+		} // for
 		forwardUnions.erase( fwds );
-	    }
-	}
+	    } // if
+	} // if
 	Indexer::visit( unionDecl );
     }
@@ -404,6 +403,6 @@
 	    if ( TypeDecl *typeDecl = dynamic_cast< TypeDecl * >( namedTypeDecl ) ) {
 		typeInst->set_isFtype( typeDecl->get_kind() == TypeDecl::Ftype );
-	    }
-	}
+	    } // if
+	} // if
     }
 
@@ -413,16 +412,16 @@
 	} else {
 	    indexer = this;
-	}
+	} // if
     }
 
     void forallFixer( Type *func ) {
 	// Fix up assertions
-	for( std::list< TypeDecl * >::iterator type = func->get_forall().begin(); type != func->get_forall().end(); ++type ) {
+	for ( std::list< TypeDecl * >::iterator type = func->get_forall().begin(); type != func->get_forall().end(); ++type ) {
 	    std::list< DeclarationWithType * > toBeDone, nextRound;
 	    toBeDone.splice( toBeDone.end(), (*type )->get_assertions() );
 	    while ( ! toBeDone.empty() ) {
-		for( std::list< DeclarationWithType * >::iterator assertion = toBeDone.begin(); assertion != toBeDone.end(); ++assertion ) {
+		for ( std::list< DeclarationWithType * >::iterator assertion = toBeDone.begin(); assertion != toBeDone.end(); ++assertion ) {
 		    if ( ContextInstType *ctx = dynamic_cast< ContextInstType * >( (*assertion )->get_type() ) ) {
-			for( std::list< Declaration * >::const_iterator i = ctx->get_members().begin(); i != ctx->get_members().end(); ++i ) {
+			for ( std::list< Declaration * >::const_iterator i = ctx->get_members().begin(); i != ctx->get_members().end(); ++i ) {
 			    DeclarationWithType *dwt = dynamic_cast< DeclarationWithType * >( *i );
 			    assert( dwt );
@@ -449,5 +448,5 @@
 	if ( PointerType *pointer = dynamic_cast< PointerType * >( object->get_type() ) ) {
 	    forallFixer( pointer->get_base() );
-	}
+	} // if
 	Parent::visit( object );
 	object->fixUniqueId();
@@ -546,5 +545,5 @@
 	assignDecl->fixUniqueId();
   
-	for( std::list< Declaration * >::const_iterator member = aggregateDecl->get_members().begin(); member != aggregateDecl->get_members().end(); ++member ) {
+	for ( std::list< Declaration * >::const_iterator member = aggregateDecl->get_members().begin(); member != aggregateDecl->get_members().end(); ++member ) {
 	    if ( DeclarationWithType *dwt = dynamic_cast< DeclarationWithType * >( *member ) ) {
 		if ( ArrayType *array = dynamic_cast< ArrayType * >( dwt->get_type() ) ) {
@@ -552,7 +551,7 @@
 		} else {
 		    makeScalarAssignment( srcParam, dstParam, dwt, back_inserter( assignDecl->get_statements()->get_kids() ) );
-		}
-	    }
-	}
+		} // if
+	    } // if
+	} // for
 	assignDecl->get_statements()->get_kids().push_back( new ReturnStmt( noLabels, new VariableExpr( srcParam ) ) );
   
@@ -594,5 +593,5 @@
 	    declsToAdd.push_back( makeStructAssignment( structDecl, structInst, functionNesting ) );
 	    structsDone.insert( structDecl->get_name() );
-	}
+	} // if
     }
 
@@ -602,5 +601,5 @@
 	    unionInst->set_baseUnion( unionDecl );
 	    declsToAdd.push_back( makeUnionAssignment( unionDecl, unionInst, functionNesting ) );
-	}
+	} // if
     }
 
@@ -617,5 +616,5 @@
 	    assign->get_args().push_back( new CastExpr( new VariableExpr( src ), typeDecl->get_base()->clone() ) );
 	    stmts->get_kids().push_back( new ReturnStmt( std::list< Label >(), assign ) );
-	}
+	} // if
 	FunctionType *type = new FunctionType( Type::Qualifiers(), false );
 	type->get_returnVals().push_back( new ObjectDecl( "", Declaration::NoStorageClass, LinkageSpec::Cforall, 0, typeInst, 0 ) );
@@ -628,24 +627,21 @@
     void addDecls( std::list< Declaration * > &declsToAdd, std::list< Statement * > &statements, std::list< Statement * >::iterator i ) {
 	if ( ! declsToAdd.empty() ) {
-	    for( std::list< Declaration * >::iterator decl = declsToAdd.begin(); decl != declsToAdd.end(); ++decl ) {
+	    for ( std::list< Declaration * >::iterator decl = declsToAdd.begin(); decl != declsToAdd.end(); ++decl ) {
 		statements.insert( i, new DeclStmt( noLabels, *decl ) );
-	    }
+	    } // for
 	    declsToAdd.clear();
-	}
+	} // if
     }
 
     void AddStructAssignment::visit( FunctionType *) {
-	// ensure that we don't add assignment ops for types defined
-	// as part of the function
+	// ensure that we don't add assignment ops for types defined as part of the function
     }
 
     void AddStructAssignment::visit( PointerType *) {
-	// ensure that we don't add assignment ops for types defined
-	// as part of the pointer
+	// ensure that we don't add assignment ops for types defined as part of the pointer
     }
 
     void AddStructAssignment::visit( ContextDecl *) {
-	// ensure that we don't add assignment ops for types defined
-	// as part of the context
+	// ensure that we don't add assignment ops for types defined as part of the context
     }
 
@@ -714,5 +710,5 @@
 	    delete typeInst;
 	    return ret;
-	}
+	} // if
 	return typeInst;
     }
@@ -721,11 +717,19 @@
 	Declaration *ret = Mutator::mutate( tyDecl );
 	typedefNames[ tyDecl->get_name() ] = tyDecl;
-	if ( AggregateDecl *aggDecl = dynamic_cast< AggregateDecl * >( tyDecl->get_base() ) ) {
-	    tyDecl->set_base( 0 );
-	    delete tyDecl;
-	    return aggDecl;
+	// When a typedef is a forward declaration:
+	//    typedef struct screen SCREEN;
+	// the declaration portion must be retained:
+	//    struct screen;
+	// because the expansion of the typedef is:
+	//    void rtn( SCREEN *p ) => void rtn( struct screen *p )
+	// hence the type-name "screen" must be defined.
+	// Note, qualifiers on the typedef are superfluous for the forward declaration.
+	if ( StructInstType *aggDecl = dynamic_cast< StructInstType * >( tyDecl->get_base() ) ) {
+	    return new StructDecl( aggDecl->get_name() );
+	} else if ( UnionInstType *aggDecl = dynamic_cast< UnionInstType * >( tyDecl->get_base() ) ) {
+	    return new UnionDecl( aggDecl->get_name() );
 	} else {
 	    return ret;
-	}
+	} // if
     }
 
@@ -734,5 +738,5 @@
 	if ( i != typedefNames.end() ) {
 	    typedefNames.erase( i ) ;
-	}
+	} // if
 	return typeDecl;
     }
@@ -770,8 +774,8 @@
 		    delete *i;
 		    compoundStmt->get_kids().erase( i );
-		}
-	    }
+		} // if
+	    } // if
 	    i = next;
-	}
+	} // while
 	typedefNames = oldNames;
 	return ret;
Index: translator/SynTree/BasicType.cc
===================================================================
--- translator/SynTree/BasicType.cc	(revision d9a0e763800888addddd70d8848a8f432b825e4b)
+++ translator/SynTree/BasicType.cc	(revision 17cd4ebabb684710b2f3698449093c4e84b8fb70)
@@ -1,9 +1,2 @@
-/*
- * This file is part of the Cforall project
- *
- * $Id: BasicType.cc,v 1.10 2005/08/29 20:59:25 rcbilson Exp $
- *
- */
-
 #include <cassert>
 
@@ -11,17 +4,12 @@
 
 
-BasicType::BasicType( const Type::Qualifiers &tq, Kind bt )
-    : Type( tq ), kind( bt )
-{
-}
+BasicType::BasicType( const Type::Qualifiers &tq, Kind bt ) : Type( tq ), kind( bt ) {}
 
-void
-BasicType::print( std::ostream &os, int indent ) const
-{
+void BasicType::print( std::ostream &os, int indent ) const {
     static const char *kindNames[] = {	
-	"bool", "char", "signed char", "unsigned char", "short signed int", "short unsigned int",
+	"_Bool", "char", "signed char", "unsigned char", "short signed int", "short unsigned int",
 	"signed int", "unsigned int", "long signed int", "long unsigned int", "long long signed int",
-	"long long unsigned int", "float", "double", "long double", "float complex", "double complex",
-	"long double complex", "float imaginary", "double imaginary", "long double imaginary"
+	"long long unsigned int", "float", "double", "long double", "float _Complex", "double _Complex",
+	"long double _Complex", "float _Imaginary", "double _Imaginary", "long double _Imaginary"
     };
 
@@ -30,34 +18,32 @@
 }
 
-bool 
-BasicType::isInteger() const
-{
+bool BasicType::isInteger() const {
     switch( kind ) {
-    case Bool:
-    case Char:
-    case SignedChar:
-    case UnsignedChar:
-    case ShortSignedInt:
-    case ShortUnsignedInt:
-    case SignedInt:
-    case UnsignedInt:
-    case LongSignedInt:
-    case LongUnsignedInt:
-    case LongLongSignedInt:
-    case LongLongUnsignedInt:
+      case Bool:
+      case Char:
+      case SignedChar:
+      case UnsignedChar:
+      case ShortSignedInt:
+      case ShortUnsignedInt:
+      case SignedInt:
+      case UnsignedInt:
+      case LongSignedInt:
+      case LongUnsignedInt:
+      case LongLongSignedInt:
+      case LongLongUnsignedInt:
 	return true;
 
-    case Float:
-    case Double:
-    case LongDouble:
-    case FloatComplex:
-    case DoubleComplex:
-    case LongDoubleComplex:
-    case FloatImaginary:
-    case DoubleImaginary:
-    case LongDoubleImaginary:
+      case Float:
+      case Double:
+      case LongDouble:
+      case FloatComplex:
+      case DoubleComplex:
+      case LongDoubleComplex:
+      case FloatImaginary:
+      case DoubleImaginary:
+      case LongDoubleImaginary:
 	return false;
 
-    case NUMBER_OF_BASIC_TYPES:
+      case NUMBER_OF_BASIC_TYPES:
 	assert( false );
     }
Index: translator/SynTree/Declaration.h
===================================================================
--- translator/SynTree/Declaration.h	(revision d9a0e763800888addddd70d8848a8f432b825e4b)
+++ translator/SynTree/Declaration.h	(revision 17cd4ebabb684710b2f3698449093c4e84b8fb70)
@@ -1,9 +1,2 @@
-/*
- * This file is part of the Cforall project
- *
- * $Id: Declaration.h,v 1.22 2005/08/29 20:59:25 rcbilson Exp $
- *
- */
-
 #ifndef DECLARATION_H
 #define DECLARATION_H
@@ -15,9 +8,7 @@
 
 
-class Declaration
-{
-public:
-    enum StorageClass
-    {  
+class Declaration {
+  public:
+    enum StorageClass {  
 	NoStorageClass,
 	Auto,
@@ -27,5 +18,5 @@
 	Fortran
     };	
-    
+
     Declaration( const std::string &name, StorageClass sc, LinkageSpec::Type linkage );
     Declaration( const Declaration &other );
@@ -39,5 +30,5 @@
     void set_linkage( LinkageSpec::Type newValue ) { linkage = newValue; }
     UniqueId get_uniqueId() const { return uniqueId; }
-    
+
     void fixUniqueId( void );
     virtual Declaration *clone() const = 0;
@@ -46,11 +37,10 @@
     virtual void print( std::ostream &os, int indent = 0 ) const = 0;
     virtual void printShort( std::ostream &os, int indent = 0 ) const = 0;
-    
+
     static const char* storageClassName[];  
-    
+
     static void dumpIds( std::ostream &os );
     static Declaration *declFromId( UniqueId id );
-    
-private:
+  private:
     std::string name;
     StorageClass storageClass;
@@ -59,7 +49,6 @@
 };
 
-class DeclarationWithType : public Declaration
-{
-public:
+class DeclarationWithType : public Declaration {
+  public:
     DeclarationWithType( const std::string &name, StorageClass sc, LinkageSpec::Type linkage );
     DeclarationWithType( const DeclarationWithType &other );
@@ -68,22 +57,18 @@
     std::string get_mangleName() const { return mangleName; }
     void set_mangleName( std::string newValue ) { mangleName = newValue; }
-    
+
     virtual DeclarationWithType *clone() const = 0;
     virtual DeclarationWithType *acceptMutator( Mutator &m ) = 0;
-    
+
     virtual Type *get_type() const = 0;
     virtual void set_type(Type *) = 0;
-    
-private:
-    // this represents the type with all types and typedefs expanded
-    // it is generated by SymTab::Validate::Pass2
+  private:
+    // this represents the type with all types and typedefs expanded it is generated by SymTab::Validate::Pass2
     std::string mangleName;
 };
 
-class ObjectDecl : public DeclarationWithType
-{
+class ObjectDecl : public DeclarationWithType {
     typedef DeclarationWithType Parent;
-
-public:
+  public:
     ObjectDecl( const std::string &name, StorageClass sc, LinkageSpec::Type linkage, Expression *bitfieldWidth, Type *type, Initializer *init );
     ObjectDecl( const ObjectDecl &other );
@@ -97,5 +82,5 @@
     Expression *get_bitfieldWidth() const { return bitfieldWidth; }
     void set_bitfieldWidth( Expression *newValue ) { bitfieldWidth = newValue; }
-    
+
     virtual ObjectDecl *clone() const { return new ObjectDecl( *this ); }
     virtual void accept( Visitor &v ) { v.visit( this ); }
@@ -103,6 +88,5 @@
     virtual void print( std::ostream &os, int indent = 0 ) const;
     virtual void printShort( std::ostream &os, int indent = 0 ) const;
-    
-private:
+  private:
     Type *type;
     Initializer *init;
@@ -110,9 +94,7 @@
 };
 
-class FunctionDecl : public DeclarationWithType
-{
+class FunctionDecl : public DeclarationWithType {
     typedef DeclarationWithType Parent;
-
-public:
+  public:
     FunctionDecl( const std::string &name, StorageClass sc, LinkageSpec::Type linkage, FunctionType *type, CompoundStmt *statements, bool isInline );
     FunctionDecl( const FunctionDecl &other );
@@ -130,5 +112,5 @@
     std::list< std::string >& get_oldIdents() { return oldIdents; }
     std::list< Declaration* >& get_oldDecls() { return oldDecls; }
-    
+
     virtual FunctionDecl *clone() const { return new FunctionDecl( *this ); }
     virtual void accept( Visitor &v ) { v.visit( this ); }
@@ -136,6 +118,5 @@
     virtual void print( std::ostream &os, int indent = 0 ) const;
     virtual void printShort( std::ostream &os, int indent = 0 ) const;
-    
-private:
+  private:
     FunctionType *type;
     CompoundStmt *statements;
@@ -145,9 +126,7 @@
 };
 
-class NamedTypeDecl : public Declaration
-{
+class NamedTypeDecl : public Declaration {
     typedef Declaration Parent;
-
-public:
+  public:
     NamedTypeDecl( const std::string &name, StorageClass sc, Type *type );
     NamedTypeDecl( const TypeDecl &other );
@@ -162,9 +141,7 @@
     virtual void print( std::ostream &os, int indent = 0 ) const;
     virtual void printShort( std::ostream &os, int indent = 0 ) const;
-    
-protected:
+  protected:
     virtual std::string typeString() const = 0;
-    
-private:
+  private:
     Type *base;
     std::list< TypeDecl* > parameters;
@@ -172,14 +149,12 @@
 };
 
-class TypeDecl : public NamedTypeDecl
-{
+class TypeDecl : public NamedTypeDecl {
     typedef NamedTypeDecl Parent;
-
-public:
+  public:
     enum Kind { Any, Dtype, Ftype };
 
     TypeDecl( const std::string &name, StorageClass sc, Type *type, Kind kind );
     TypeDecl( const TypeDecl &other );
-    
+
     Kind get_kind() const { return kind; }
 
@@ -187,31 +162,25 @@
     virtual void accept( Visitor &v ) { v.visit( this ); }
     virtual TypeDecl *acceptMutator( Mutator &m ) { return m.mutate( this ); }
-
-private:
+  private:
     virtual std::string typeString() const;
     Kind kind;
 };
-    
-class TypedefDecl : public NamedTypeDecl
-{
+
+class TypedefDecl : public NamedTypeDecl {
     typedef NamedTypeDecl Parent;
-
-public:
+  public:
     TypedefDecl( const std::string &name, StorageClass sc, Type *type ) : Parent( name, sc, type ) {}
     TypedefDecl( const TypedefDecl &other ) : Parent( other ) {}
-    
+
     virtual TypedefDecl *clone() const { return new TypedefDecl( *this ); }
     virtual void accept( Visitor &v ) { v.visit( this ); }
     virtual Declaration *acceptMutator( Mutator &m ) { return m.mutate( this ); }
-
-private:
-    virtual std::string typeString() const;
-};
-    
-class AggregateDecl : public Declaration
-{
+  private:
+    virtual std::string typeString() const;
+};
+
+class AggregateDecl : public Declaration {
     typedef Declaration Parent;
-
-public:
+  public:
     AggregateDecl( const std::string &name );
     AggregateDecl( const AggregateDecl &other );
@@ -220,81 +189,67 @@
     std::list<Declaration*>& get_members() { return members; }
     std::list<TypeDecl*>& get_parameters() { return parameters; }
-    
-    virtual void print( std::ostream &os, int indent = 0 ) const;
-    virtual void printShort( std::ostream &os, int indent = 0 ) const;
-
-protected:
+
+    virtual void print( std::ostream &os, int indent = 0 ) const;
+    virtual void printShort( std::ostream &os, int indent = 0 ) const;
+  protected:
     virtual std::string typeString() const = 0;
-    
-private:
+
+  private:
     std::list<Declaration*> members;
     std::list<TypeDecl*> parameters;
 };
 
-class StructDecl : public AggregateDecl
-{
-    typedef AggregateDecl Parent;
-
-public:
+class StructDecl : public AggregateDecl {
+    typedef AggregateDecl Parent;
+  public:
     StructDecl( const std::string &name ) : Parent( name ) {}
     StructDecl( const StructDecl &other ) : Parent( other ) {}
-    
+
     virtual StructDecl *clone() const { return new StructDecl( *this ); }
     virtual void accept( Visitor &v ) { v.visit( this ); }
     virtual Declaration *acceptMutator( Mutator &m ) { return m.mutate( this ); }
 
-private:
-    virtual std::string typeString() const;
-};
-    
-class UnionDecl : public AggregateDecl
-{
-    typedef AggregateDecl Parent;
-
-public:
+  private:
+    virtual std::string typeString() const;
+};
+
+class UnionDecl : public AggregateDecl {
+    typedef AggregateDecl Parent;
+  public:
     UnionDecl( const std::string &name ) : Parent( name ) {}
     UnionDecl( const UnionDecl &other ) : Parent( other ) {}
-    
+
     virtual UnionDecl *clone() const { return new UnionDecl( *this ); }
     virtual void accept( Visitor &v ) { v.visit( this ); }
     virtual Declaration *acceptMutator( Mutator &m ) { return m.mutate( this ); }
-
-private:
-    virtual std::string typeString() const;
-};
-    
-class EnumDecl : public AggregateDecl
-{
-    typedef AggregateDecl Parent;
-
-public:
+  private:
+    virtual std::string typeString() const;
+};
+
+class EnumDecl : public AggregateDecl {
+    typedef AggregateDecl Parent;
+  public:
     EnumDecl( const std::string &name ) : Parent( name ) {}
     EnumDecl( const EnumDecl &other ) : Parent( other ) {}
-    
+
     virtual EnumDecl *clone() const { return new EnumDecl( *this ); }
     virtual void accept( Visitor &v ) { v.visit( this ); }
     virtual Declaration *acceptMutator( Mutator &m ) { return m.mutate( this ); }
-
-private:
-    virtual std::string typeString() const;
-};
-    
-class ContextDecl : public AggregateDecl
-{
-    typedef AggregateDecl Parent;
-
-public:
+  private:
+    virtual std::string typeString() const;
+};
+
+class ContextDecl : public AggregateDecl {
+    typedef AggregateDecl Parent;
+  public:
     ContextDecl( const std::string &name ) : Parent( name ) {}
     ContextDecl( const ContextDecl &other ) : Parent( other ) {}
-    
+
     virtual ContextDecl *clone() const { return new ContextDecl( *this ); }
     virtual void accept( Visitor &v ) { v.visit( this ); }
     virtual Declaration *acceptMutator( Mutator &m ) { return m.mutate( this ); }
-
-private:
-    virtual std::string typeString() const;
-};
-    
-
-
-#endif /* #ifndef DECLARATION_H */
+  private:
+    virtual std::string typeString() const;
+};
+
+#endif // DECLARATION_H
Index: translator/SynTree/NamedTypeDecl.cc
===================================================================
--- translator/SynTree/NamedTypeDecl.cc	(revision d9a0e763800888addddd70d8848a8f432b825e4b)
+++ translator/SynTree/NamedTypeDecl.cc	(revision 17cd4ebabb684710b2f3698449093c4e84b8fb70)
@@ -6,6 +6,5 @@
 NamedTypeDecl::NamedTypeDecl( const std::string &name, StorageClass sc, Type *base )
     : Parent( name, sc, LinkageSpec::Cforall ), base( base )
-{
-}
+{}
 
 NamedTypeDecl::NamedTypeDecl( const TypeDecl &other )
@@ -16,6 +15,5 @@
 }
 
-NamedTypeDecl::~NamedTypeDecl()
-{
+NamedTypeDecl::~NamedTypeDecl() {
     delete base;
     deleteAll( parameters );
@@ -23,52 +21,47 @@
 }
 
-void 
-NamedTypeDecl::print( std::ostream &os, int indent ) const
-{
+void NamedTypeDecl::print( std::ostream &os, int indent ) const {
     using namespace std;
     
-    if( get_name() != "" ) {
+    if ( get_name() != "" ) {
 	os << get_name() << ": a ";
-    }
-    if( get_storageClass() != NoStorageClass ) {
+    } // if
+    if ( get_storageClass() != NoStorageClass ) {
 	os << storageClassName[ get_storageClass() ] << ' ';
-    }
+    } // if
     os << typeString();
-    if( base ) {
+    if ( base ) {
 	os << " for ";
 	base->print( os, indent );
-    }
-    if( !parameters.empty() ) {
+    } // if
+    if ( !parameters.empty() ) {
 	os << endl << string( indent, ' ' ) << "with parameters" << endl;
 	printAll( parameters, os, indent+2 );
-    }
-    if( !assertions.empty() ) {
+    } // if
+    if ( !assertions.empty() ) {
 	os << endl << string( indent, ' ' ) << "with assertions" << endl;
 	printAll( assertions, os, indent+2 );
-    }
+    } // if
 }
 
-void 
-NamedTypeDecl::printShort( std::ostream &os, int indent ) const
-{
+void NamedTypeDecl::printShort( std::ostream &os, int indent ) const {
     using namespace std;
     
-    if( get_name() != "" ) {
+    if ( get_name() != "" ) {
 	os << get_name() << ": a ";
-    }
-    if( get_storageClass() != NoStorageClass ) {
+    } // if
+    if ( get_storageClass() != NoStorageClass ) {
 	os << storageClassName[ get_storageClass() ] << ' ';
-    }
+    } // if
     os << typeString();
-    if( base ) {
+    if ( base ) {
 	os << " for ";
 	base->print( os, indent );
-    }
-    if( !parameters.empty() ) {
+    } // if
+    if ( !parameters.empty() ) {
 	os << endl << string( indent, ' ' ) << "with parameters" << endl;
 	printAll( parameters, os, indent+2 );
-    }
+    } // if
 }
 
 std::string TypedefDecl::typeString() const { return "typedef"; }
-    
Index: translator/SynTree/Type.cc
===================================================================
--- translator/SynTree/Type.cc	(revision d9a0e763800888addddd70d8848a8f432b825e4b)
+++ translator/SynTree/Type.cc	(revision 17cd4ebabb684710b2f3698449093c4e84b8fb70)
@@ -1,9 +1,2 @@
-/*
- * This file is part of the Cforall project
- *
- * $Id: Type.cc,v 1.6 2005/08/29 20:59:26 rcbilson Exp $
- *
- */
-
 #include "SynTree.h"
 #include "Visitor.h"
@@ -12,41 +5,55 @@
 #include "utility.h"
 
+const char *BasicType::typeNames[BasicType::NUMBER_OF_BASIC_TYPES] = {
+    "_Bool",
+    "char",
+    "char",
+    "unsigned char",
+    "short",
+    "short unsigned",
+    "int",
+    "unsigned int",
+    "long int",
+    "long unsigned int",
+    "long long int",
+    "long long unsigned int",
+    "float",
+    "double",
+    "long double",
+    "float _Complex",
+    "double _Complex",
+    "long double _Complex",
+    "float _Imaginary",
+    "double _Imaginary",
+    "long double _Imaginary",
+};
 
-Type::Type( const Qualifiers &tq )
-    : tq( tq )
-{
-}
+Type::Type( const Qualifiers &tq ) : tq( tq ) {}
 
-Type::Type( const Type &other )
-    : tq( other.tq )
-{
+Type::Type( const Type &other ) : tq( other.tq ) {
     cloneAll( other.forall, forall );
 }
 
-Type::~Type()
-{
+Type::~Type() {
     deleteAll( forall );
 }
 
-void
-Type::print( std::ostream &os, int indent ) const
-{
-    if( !forall.empty() ) {
+void Type::print( std::ostream &os, int indent ) const {
+    if ( !forall.empty() ) {
 	os << "forall" << std::endl;
 	printAll( forall, os, indent + 4 );
 	os << std::string( indent+2, ' ' );
-    }
-    if( tq.isConst ) {
+    } // if
+    if ( tq.isConst ) {
 	os << "const ";
-    }
-    if( tq.isVolatile ) {
+    } // if
+    if ( tq.isVolatile ) {
 	os << "volatile ";
-    }
-    if( tq.isRestrict ) {
+    } // if
+    if ( tq.isRestrict ) {
 	os << "restrict ";
-    }
-    if( tq.isLvalue ) {
+    } // if
+    if ( tq.isLvalue ) {
 	os << "lvalue ";
-    }
+    } // if
 }
-
Index: translator/SynTree/Type.h
===================================================================
--- translator/SynTree/Type.h	(revision d9a0e763800888addddd70d8848a8f432b825e4b)
+++ translator/SynTree/Type.h	(revision 17cd4ebabb684710b2f3698449093c4e84b8fb70)
@@ -90,4 +90,6 @@
     };  
 
+    static const char *typeNames[];			// string names for basic types, MUST MATCH with Kind
+
     BasicType( const Type::Qualifiers &tq, Kind bt );
 
Index: translator/Tests/Parser/Makefile
===================================================================
--- translator/Tests/Parser/Makefile	(revision d9a0e763800888addddd70d8848a8f432b825e4b)
+++ translator/Tests/Parser/Makefile	(revision 17cd4ebabb684710b2f3698449093c4e84b8fb70)
@@ -4,5 +4,5 @@
 TESTS = $(EXPECTED:Expected/%=%)
 TEST_IN = $(TESTS:.tst=.c)
-DIFF = /software/gnu/bin/diff#diff
+DIFF = diff
 
 %.tst:%.c $(CFA)
@@ -15,2 +15,5 @@
 	  $(DIFF) -B -w Expected/$$i $$i | tee -a report; \
 	done
+
+clean:
+	rm -f *.tst
Index: translator/examples/Makefile
===================================================================
--- translator/examples/Makefile	(revision d9a0e763800888addddd70d8848a8f432b825e4b)
+++ translator/examples/Makefile	(revision 17cd4ebabb684710b2f3698449093c4e84b8fb70)
@@ -20,8 +20,8 @@
 
 ${EXEC1} : ${OBJECTS1}				# link step 1st executable
-	${CC} ${CCFLAGS} $^ -o $@		# additional object files before $^
+	${CC} ${CFLAGS} $^ -o $@		# additional object files before $^
 
 ${EXEC2} : ${OBJECTS2}				# link step 2nd executable
-	${CC} ${CCFLAGS} $^ -o $@		# additional object files before $^
+	${CC} ${CFLAGS} $^ -o $@		# additional object files before $^
 
 ${OBJECTS} : ${MAKEFILE_NAME}			# OPTIONAL : changes to this file => recompile
Index: translator/examples/includes.c
===================================================================
--- translator/examples/includes.c	(revision d9a0e763800888addddd70d8848a8f432b825e4b)
+++ translator/examples/includes.c	(revision 17cd4ebabb684710b2f3698449093c4e84b8fb70)
@@ -25,7 +25,8 @@
 //#include <wchar.h>        // FAILS -- includes locale.h
 //#include <wctype.h>       // FAILS -- includes locale.h
+#include <curses.h>
 #else
-#include <curses.h>
-#endif
+#include <aio.h>
+#endif // 0
 
 // Local Variables: //
Index: translator/examples/swap.c
===================================================================
--- translator/examples/swap.c	(revision d9a0e763800888addddd70d8848a8f432b825e4b)
+++ translator/examples/swap.c	(revision 17cd4ebabb684710b2f3698449093c4e84b8fb70)
@@ -4,15 +4,18 @@
 
 forall( type T )
-void swap( T left, T right ) {
-    T temp = left;
-    left = right;
-    right = temp;
+T swap( T *left, T *right ) {
+    T temp;
+    temp = *left;
+    *left = *right;
+    *right = temp;
+    return *right;
 }
 
 int main() {
     int x = 1, y = 2;
-    printf( "%d %d", x, y );
-    swap( x, y );
-    printf( "%d %d", x, y );
+    printf( "%d %d\n", x, y );
+    int w;
+    w = swap( &x, &y );
+    printf( "%d %d %d\n", w, x, y );
 }
 
Index: translator/examples/vector_test.c
===================================================================
--- translator/examples/vector_test.c	(revision d9a0e763800888addddd70d8848a8f432b825e4b)
+++ translator/examples/vector_test.c	(revision 17cd4ebabb684710b2f3698449093c4e84b8fb70)
@@ -22,14 +22,14 @@
     sout << "Array elements:\n";
 //    write_all( begin( vec ), end( vec ), sout );
-    sout << "\n";
-#if 0
-    write_reverse( begin( vec ), end( vec ), sout );
-    sout << "\n";
-
-#endif
+//    sout << "\n";
     for ( int index = 0; index <= last( vec ); index += 1 ) {
 	sout << vec[ index ] << " ";
     }
     sout << "\n";
+#if 1
+    sout << "Array elements reversed:\n";
+    write_reverse( begin( vec ), end( vec ), sout );
+    sout << "\n";
+#endif
 }
 
