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 | // |
---|
7 | // Processor.h -- |
---|
8 | // |
---|
9 | // Author : Rodolfo G. Esteves |
---|
10 | // Created On : Mon May 18 07:44:20 2015 |
---|
11 | // Last Modified By : Peter A. Buhr |
---|
12 | // Last Modified On : Tue May 19 16:24:34 2015 |
---|
13 | // Update Count : 3 |
---|
14 | // |
---|
15 | |
---|
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 { |
---|
27 | class Matcher; |
---|
28 | class GenSym; |
---|
29 | |
---|
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 * ); |
---|
36 | |
---|
37 | class GenSym { |
---|
38 | public: |
---|
39 | GenSym( std::string prefix = "" ) : gensym_count(0) {} |
---|
40 | GenSym( GenSym &other ) { gensym_count = other.gensym_count; } |
---|
41 | |
---|
42 | // std::string get_symbol() { } |
---|
43 | private: |
---|
44 | std::string prefix; |
---|
45 | int gensym_count; |
---|
46 | }; |
---|
47 | |
---|
48 | // template< typename Key > |
---|
49 | class Matcher { |
---|
50 | public: |
---|
51 | typedef std::vector< std::string >::iterator iterator; |
---|
52 | |
---|
53 | Matcher( const std::list< DeclarationWithType * > & ); |
---|
54 | ~Matcher() {} |
---|
55 | |
---|
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; } |
---|
60 | |
---|
61 | iterator begin() { return order.begin(); } |
---|
62 | iterator end() { return order.end(); } |
---|
63 | |
---|
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 & ); |
---|
72 | } // namespace Designators |
---|
73 | |
---|
74 | // Local Variables: // |
---|
75 | // tab-width: 4 // |
---|
76 | // mode: c++ // |
---|
77 | // compile-command: "make install" // |
---|
78 | // End: // |
---|