| [51587aa] | 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 | // | 
|---|
| [a08ba92] | 7 | // Processor.h -- | 
|---|
| [51587aa] | 8 | // | 
|---|
| [843054c2] | 9 | // Author           : Rodolfo G. Esteves | 
|---|
| [51587aa] | 10 | // Created On       : Mon May 18 07:44:20 2015 | 
|---|
| [a08ba92] | 11 | // Last Modified By : Peter A. Buhr | 
|---|
|  | 12 | // Last Modified On : Tue May 19 16:24:34 2015 | 
|---|
|  | 13 | // Update Count     : 3 | 
|---|
| [51587aa] | 14 | // | 
|---|
| [a08ba92] | 15 |  | 
|---|
| [51b73452] | 16 | #include "SynTree/Declaration.h" | 
|---|
|  | 17 | #include "SynTree/Expression.h" | 
|---|
|  | 18 | #include "SynTree/Type.h" | 
|---|
|  | 19 | #include "ResolvExpr/AlternativeFinder.h" | 
|---|
|  | 20 |  | 
|---|
|  | 21 | #include <vector> | 
|---|
|  | 22 | #include <string> | 
|---|
|  | 23 | #include <list> | 
|---|
|  | 24 | #include <map> | 
|---|
|  | 25 |  | 
|---|
|  | 26 | namespace Designators { | 
|---|
| [a08ba92] | 27 | class Matcher; | 
|---|
|  | 28 | class GenSym; | 
|---|
| [51b73452] | 29 |  | 
|---|
| [a08ba92] | 30 | template < class OutputIterator >  bool extractNames( std::list< DeclarationWithType * > &, OutputIterator ); | 
|---|
|  | 31 | template < class OutputIterator >  bool extractNames( Expression *, OutputIterator, Matcher ); | 
|---|
|  | 32 | void check_alternative( FunctionType *, ResolvExpr::AltList & ); | 
|---|
|  | 33 | ObjectDecl *extractTupleV( Matcher, TupleExpr *names ); | 
|---|
|  | 34 | bool fixDesignations( ResolvExpr::AlternativeFinder &finder, Expression *designation ); | 
|---|
|  | 35 | DeclarationWithType *gensym( GenSym &, DeclarationWithType * ); | 
|---|
| [51b73452] | 36 |  | 
|---|
| [a08ba92] | 37 | class GenSym { | 
|---|
|  | 38 | public: | 
|---|
|  | 39 | GenSym( std::string prefix = "" ) : gensym_count(0) {} | 
|---|
|  | 40 | GenSym( GenSym &other ) { gensym_count = other.gensym_count; } | 
|---|
| [51b73452] | 41 |  | 
|---|
|  | 42 | //    std::string get_symbol() { } | 
|---|
| [a08ba92] | 43 | private: | 
|---|
|  | 44 | std::string prefix; | 
|---|
|  | 45 | int gensym_count; | 
|---|
|  | 46 | }; | 
|---|
| [51b73452] | 47 |  | 
|---|
| [a08ba92] | 48 | // template< typename Key > | 
|---|
|  | 49 | class Matcher { | 
|---|
|  | 50 | public: | 
|---|
|  | 51 | typedef std::vector< std::string >::iterator iterator; | 
|---|
| [51b73452] | 52 |  | 
|---|
| [a08ba92] | 53 | Matcher( const std::list< DeclarationWithType * > & ); | 
|---|
|  | 54 | ~Matcher() {} | 
|---|
| [51b73452] | 55 |  | 
|---|
| [a08ba92] | 56 | template< class OutputIterator > bool get_reorderedCall( OutputIterator ); | 
|---|
|  | 57 | template< class InputIterator >  bool add(InputIterator, InputIterator, ResolvExpr::Alternative &); | 
|---|
|  | 58 | template< class InputIterator, class OutputIterator >  bool slice(InputIterator begin, InputIterator end, OutputIterator ); | 
|---|
|  | 59 | //std::vector<std::string> &get_order() const { return order; } | 
|---|
| [51b73452] | 60 |  | 
|---|
| [a08ba92] | 61 | iterator begin() { return order.begin(); } | 
|---|
|  | 62 | iterator end() { return order.end(); } | 
|---|
| [51b73452] | 63 |  | 
|---|
| [a08ba92] | 64 | //Expression *operator[]( int idx ) { return table( order[ idx ] ); } | 
|---|
|  | 65 | private: | 
|---|
|  | 66 | std::map< std::string, int > table; | 
|---|
|  | 67 | std::vector<std::string> order; | 
|---|
|  | 68 | std::vector<DeclarationWithType *> declarations; | 
|---|
|  | 69 | std::vector<ResolvExpr::Alternative *> alternatives; | 
|---|
|  | 70 | }; | 
|---|
|  | 71 | //  void pruneAlternatives( Expression *expr, ResolvExpr::AlternativeFinder & ); | 
|---|
| [51b73452] | 72 | } // namespace Designators | 
|---|
|  | 73 |  | 
|---|
| [51587aa] | 74 | // Local Variables: // | 
|---|
|  | 75 | // tab-width: 4 // | 
|---|
|  | 76 | // mode: c++ // | 
|---|
|  | 77 | // compile-command: "make install" // | 
|---|
|  | 78 | // End: // | 
|---|