OpenMPI  0.1.1
ompragma.h
1 /****************************************************************************
2 ** SCALASCA http://www.scalasca.org/ **
3 ** KOJAK http://www.fz-juelich.de/jsc/kojak/ **
4 *****************************************************************************
5 ** Copyright (c) 1998-2008 **
6 ** Forschungszentrum Juelich, Juelich Supercomputing Centre **
7 ** **
8 ** See the file COPYING in the package base directory for details **
9 ****************************************************************************/
10 
11 #ifndef OMPRAGMA_H
12 #define OMPRAGMA_H
13 
14 #include <string>
15  using std::string;
16 #include <vector>
17  using std::vector;
18 
19 class OMPragma {
20 public:
21  OMPragma(const string& f, int l, int pl, int pp, bool a)
22  : filename(f), lineno(l), pline(pl), ppos(pp), asd(a) {}
23  void find_name();
24  bool is_nowait();
25  bool has_copypriv();
26  string find_sub_name();
27  virtual void add_nowait() = 0;
28  virtual void add_descr(int n) = 0;
29  virtual OMPragma* split_combined() = 0;
30  virtual ~OMPragma() {}
31 
32  string filename;
33  int lineno;
34  unsigned pline; // current parsing line
35  string::size_type ppos; // current parsing position
36  bool asd;
37  string name;
38  vector<string> lines;
39 
40 private:
41  virtual string find_next_word() = 0;
42  virtual bool find_word(const char* word, unsigned& line,
43  string::size_type& pos) = 0;
44 };
45 
46 class OMPragmaF : public OMPragma {
47 public:
48  OMPragmaF(const string& f, int l, int p, const string& line, int pomp, bool a)
49  : OMPragma(f, l, 0, p, a), slen(5+pomp) {
50  lines.push_back(line);
51  sentinel = pomp ? "$pomp" : "$omp";
52  }
53  virtual void add_nowait();
54  virtual void add_descr(int n);
55  virtual OMPragma* split_combined();
56 
57 private:
58  virtual string find_next_word();
59  virtual bool find_word(const char* word, unsigned& line,
60  string::size_type& pos);
61  void remove_empties();
62 
63  string sentinel;
64  int slen;
65 };
66 
67 class OMPragmaC : public OMPragma {
68 public:
69  OMPragmaC(const string& f, int l, int pl, int pp, vector<string>& stmts,
70  bool a) : OMPragma(f, l, pl, pp, a) {
71  lines.swap(stmts);
72  }
73  virtual void add_nowait();
74  virtual void add_descr(int n);
75  virtual OMPragma* split_combined();
76 
77 private:
78  virtual string find_next_word();
79  virtual bool find_word(const char* word, unsigned& line,
80  string::size_type& pos);
81  void remove_empties();
82 };
83 
84 #endif
Definition: ompragma.h:67
Definition: ompragma.h:46
Definition: ompragma.h:19