module BOAST::OpenMP::Pragma

Public Class Methods

register_clause( name, arg_type ) click to toggle source

Registers an openmp clause, arg_type can be :none, :option, :option_list, :simple, :list, :multilist

# File lib/BOAST/Language/OpenMP.rb, line 20
      def self.register_clause( name, arg_type )
        s = <<EOF
      def openmp_clause_#{name}(c)
EOF
        case arg_type
        when :none
          s << <<EOF
        return " #{name}"
EOF
        when :option
          s << <<EOF
        return " \#{c}"
EOF
        when :option_list
          s << <<EOF
        return " (\#{[c].flatten.collect(&:to_s).join(", ")})"
EOF
        when :simple
          s << <<EOF
        return " #{name}(\#{c})"
EOF
        when :list
s << <<EOF
        return " #{name}(\#{[c].flatten.collect(&:to_s).join(", ")})"
EOF
        when :multilist
s << <<EOF
        s = ""
        c.each { |id, list|
          s << " #{name}(\#{id}: \#{[list].flatten.collect(&:to_s).join(", ")})"
        }
        return s
EOF
        else
          raise "Unknown argument type!"
        end
        s << <<EOF
      end
EOF
        eval s
      end

Public Instance Methods

openmp_end_clauses_to_s() click to toggle source
# File lib/BOAST/Language/OpenMP.rb, line 109
def openmp_end_clauses_to_s
  s = ""
  if lang == FORTRAN then
    get_end_clauses.each { |c|
      s << self.send( c, @openmp_clauses[c] ) if @openmp_clauses[c]
    }
  end
  return s
end
openmp_open_clauses_to_s() click to toggle source
# File lib/BOAST/Language/OpenMP.rb, line 96
def openmp_open_clauses_to_s
  s = ""
  get_open_clauses.each { |c|
    s << self.send( "openmp_clause_#{c}", @openmp_clauses[c] ) if @openmp_clauses[c]
  }
  if lang == C then
    get_end_clauses.each { |c|
      s << self.send( c, @openmp_clauses[c] ) if @openmp_clauses[c]
    }
  end
  return s
end
openmp_pragma_to_s() click to toggle source
# File lib/BOAST/Language/OpenMP.rb, line 7
def openmp_pragma_to_s
  s = ""
  if lang == FORTRAN then
    s << "!$omp"
  elsif lang == C then
    s << "#pragma omp"
  else
    raise LanguageError, "Language does not support OpenMP!"
  end
  return s
end