Class: BOAST::FuncCall

Inherits:
Object
  • Object
show all
Extended by:
Functor
Includes:
Arithmetic, Inspectable, PrivateStateAccessor
Defined in:
lib/BOAST/Language/FuncCall.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Functor

extended

Methods included from Inspectable

#inspect

Methods included from Arithmetic

#!, #!=, #*, #**, #+, #+@, #-, #-@, #/, #<, #<=, #==, #===, #>, #>=, #and, #cast, #coerce, #components, #dereference, #or, #reference

Methods included from PrivateStateAccessor

#address_size, #address_size=, #annotate, #annotate=, #annotate?, #annotate_indepth_list, #annotate_indepth_list=, #annotate_level, #annotate_level=, #annotate_list, #annotate_list=, #architecture, #architecture=, #array_start, #array_start=, #chain_code, #chain_code=, #chain_code?, #debug, #debug=, #debug?, #debug_kernel_source, #debug_kernel_source=, #debug_kernel_source?, #debug_source, #debug_source=, #debug_source?, #decl_module, #decl_module=, #decl_module?, #default_align, #default_align=, #default_int_signed, #default_int_signed=, #default_int_signed?, #default_int_size, #default_int_size=, #default_real_size, #default_real_size=, #default_type, #default_type=, #disable_openmp, #disable_openmp=, #disable_openmp?, #executable, #executable=, #executable?, #ffi, #ffi=, #ffi?, #fortran_line_length, #fortran_line_length=, #get_address_size, #get_annotate, #get_annotate_indepth_list, #get_annotate_level, #get_annotate_list, #get_architecture, #get_array_start, #get_chain_code, #get_debug, #get_debug_kernel_source, #get_debug_source, #get_decl_module, #get_default_align, #get_default_int_signed, #get_default_int_size, #get_default_real_size, #get_default_type, #get_disable_openmp, #get_executable, #get_ffi, #get_fortran_line_length, #get_indent_increment, #get_indent_level, #get_keep_temp, #get_lang, #get_model, #get_optimizer_log, #get_optimizer_log_file, #get_output, #get_replace_constants, #get_synchro, #get_use_vla, #get_verbose, #indent_increment, #indent_increment=, #indent_level, #indent_level=, #keep_temp, #keep_temp=, #keep_temp?, #lang, #lang=, #model, #model=, #optimizer_log, #optimizer_log=, #optimizer_log?, #optimizer_log_file, #optimizer_log_file=, #output, #output=, #replace_constants, #replace_constants=, #replace_constants?, #set_address_size, #set_annotate, #set_annotate_indepth_list, #set_annotate_level, #set_annotate_list, #set_architecture, #set_array_start, #set_chain_code, #set_debug, #set_debug_kernel_source, #set_debug_source, #set_decl_module, #set_default_align, #set_default_int_signed, #set_default_int_size, #set_default_real_size, #set_default_type, #set_disable_openmp, #set_executable, #set_ffi, #set_fortran_line_length, #set_indent_increment, #set_indent_level, #set_keep_temp, #set_lang, #set_model, #set_optimizer_log, #set_optimizer_log_file, #set_output, #set_replace_constants, #set_synchro, #set_use_vla, #set_verbose, #synchro, #synchro=, #use_vla, #use_vla=, #use_vla?, #verbose, #verbose=, #verbose?

Constructor Details

#initialize(func_name, *args) ⇒ FuncCall

Returns a new instance of FuncCall.



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/BOAST/Language/FuncCall.rb', line 14

def initialize(func_name, *args)
  @prefix = nil
  @func_name = func_name
  if args.last.kind_of?(Hash) then
    @options = args.last
    @args = args[0..-2]
  else
    @args = args
    @options = {}
  end
  @return_type = @options[:return] ? @options[:return] : @options[:returns] if @options
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



11
12
13
# File 'lib/BOAST/Language/FuncCall.rb', line 11

def args
  @args
end

#func_nameObject (readonly)

Returns the value of attribute func_name.



10
11
12
# File 'lib/BOAST/Language/FuncCall.rb', line 10

def func_name
  @func_name
end

#prefixObject

Returns the value of attribute prefix.



12
13
14
# File 'lib/BOAST/Language/FuncCall.rb', line 12

def prefix
  @prefix
end

Instance Method Details

#prObject



62
63
64
65
66
67
68
69
# File 'lib/BOAST/Language/FuncCall.rb', line 62

def pr
  s=""
  s << indent
  s << to_s
  s << ";" if [C, CL, CUDA].include?( lang )
  output.puts s
  return self
end

#to_sObject



43
44
45
46
# File 'lib/BOAST/Language/FuncCall.rb', line 43

def to_s
  return to_s_fortran if lang == FORTRAN
  return to_s_c if [C, CL, CUDA].include?( lang )
end

#to_varObject



31
32
33
34
35
36
37
38
39
40
41
# File 'lib/BOAST/Language/FuncCall.rb', line 31

def to_var
  if @return_type then
    if @return_type.kind_of?(Variable)
      return @return_type.copy("#{self}")
    else
      return Variable::new("#{self}", @return_type)
    end
  else
    return Variable::new("#{self}", get_default_type)
  end
end

#typeObject



27
28
29
# File 'lib/BOAST/Language/FuncCall.rb', line 27

def type
  return @return_type.type if @return_type
end