[a32b204] | 1 | // |
---|
| 2 | // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo |
---|
| 3 | // |
---|
| 4 | // The contents of this file are covered under the licence agreement in the |
---|
| 5 | // file "LICENCE" distributed with Cforall. |
---|
| 6 | // |
---|
[906e24d] | 7 | // AlternativePrinter.cc -- |
---|
[a32b204] | 8 | // |
---|
| 9 | // Author : Richard C. Bilson |
---|
| 10 | // Created On : Sun May 17 06:53:19 2015 |
---|
| 11 | // Last Modified By : Peter A. Buhr |
---|
| 12 | // Last Modified On : Sun May 17 06:55:05 2015 |
---|
| 13 | // Update Count : 2 |
---|
| 14 | // |
---|
| 15 | |
---|
[51b7345] | 16 | #include "AlternativePrinter.h" |
---|
[ea6332d] | 17 | |
---|
| 18 | #include <list> // for _List_const_iterator, list<>... |
---|
| 19 | |
---|
| 20 | #include "Alternative.h" // for AltList, Alternative |
---|
| 21 | #include "AlternativeFinder.h" // for AlternativeFinder |
---|
| 22 | #include "ResolvExpr/TypeEnvironment.h" // for TypeEnvironment |
---|
| 23 | #include "SynTree/Expression.h" // for Expression |
---|
| 24 | #include "SynTree/Statement.h" // for ExprStmt |
---|
| 25 | #include "SynTree/Type.h" // for Type |
---|
[51b7345] | 26 | |
---|
| 27 | namespace ResolvExpr { |
---|
[bff09c8] | 28 | AlternativePrinter::AlternativePrinter( std::ostream &os ) : os( os ) {} |
---|
[51b7345] | 29 | |
---|
[bff09c8] | 30 | void AlternativePrinter::postvisit( ExprStmt *exprStmt ) { |
---|
[a32b204] | 31 | TypeEnvironment env; |
---|
[bff09c8] | 32 | AlternativeFinder finder( indexer, env ); |
---|
[a32b204] | 33 | finder.findWithAdjustment( exprStmt->get_expr() ); |
---|
| 34 | int count = 1; |
---|
| 35 | os << "There are " << finder.get_alternatives().size() << " alternatives" << std::endl; |
---|
| 36 | for ( AltList::const_iterator i = finder.get_alternatives().begin(); i != finder.get_alternatives().end(); ++i ) { |
---|
| 37 | os << "Alternative " << count++ << " ==============" << std::endl; |
---|
[906e24d] | 38 | i->expr->get_result()->print( os ); |
---|
[a32b204] | 39 | // i->print( os ); |
---|
| 40 | os << std::endl; |
---|
| 41 | } // for |
---|
| 42 | } // AlternativePrinter::visit |
---|
[51b7345] | 43 | } // namespace ResolvExpr |
---|
[a32b204] | 44 | |
---|
| 45 | // Local Variables: // |
---|
| 46 | // tab-width: 4 // |
---|
| 47 | // mode: c++ // |
---|
| 48 | // compile-command: "make install" // |
---|
| 49 | // End: // |
---|