File: ompragma.h

package info (click to toggle)
opari 1.1%2Bdfsg-9
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid, trixie
  • size: 720 kB
  • sloc: cpp: 2,005; ansic: 901; f90: 252; makefile: 130; sh: 86; fortran: 50
file content (75 lines) | stat: -rw-r--r-- 2,072 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*************************************************************************/
/* OPARI Version 1.1                                                     */
/* Copyright (C) 2001                                                    */
/* Forschungszentrum Juelich, Zentralinstitut fuer Angewandte Mathematik */
/*************************************************************************/

#ifndef OMPRAGMA_H
#define OMPRAGMA_H

#include <string>
  using std::string;
#include <vector>
  using std::vector;

class OMPragma {
public:
  OMPragma(const string& f, int l, int pl, int pp)
	  : filename(f), lineno(l), pline(pl), ppos(pp) {}
  void find_name();
  bool is_nowait();
  string find_sub_name();
  virtual void add_nowait() = 0;
  virtual OMPragma* split_combined() = 0;
  virtual ~OMPragma() {}

  string filename;
  int    lineno;
  unsigned          pline;               // current parsing line
  string::size_type ppos;                // current parsing position
  string name;
  vector<string> lines;

private:
  virtual string find_next_word() = 0;
  virtual bool find_word(const char* word, unsigned& line,
		         string::size_type& pos) = 0;
};

class OMPragmaF : public OMPragma {
public:
  OMPragmaF(const string& f, int l, int p, const string& line, int pomp)
	  : OMPragma(f, l, 0, p), slen(5+pomp) {
    lines.push_back(line);
    sentinel = pomp ? "$pomp" : "$omp";
  }
  virtual void add_nowait();
  virtual OMPragma* split_combined();

private:
  virtual string find_next_word();
  virtual bool find_word(const char* word, unsigned& line,
		         string::size_type& pos);
  void remove_empties();

  string sentinel;
  int slen;
};

class OMPragmaC : public OMPragma {
public:
  OMPragmaC(const string& f, int l, int pl, int pp, vector<string>& stmts)
	  : OMPragma(f, l, pl, pp) {
    lines.swap(stmts);
  }
  virtual void add_nowait();
  virtual OMPragma* split_combined();

private:
  virtual string find_next_word();
  virtual bool find_word(const char* word, unsigned& line,
		         string::size_type& pos);
  void remove_empties();
};

#endif