Class: BOAST::FuncCall
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#func_name ⇒ Object
readonly
Returns the value of attribute func_name.
-
#prefix ⇒ Object
Returns the value of attribute prefix.
Class Method Summary collapse
Instance Method Summary collapse
- #*(x) ⇒ Object
- #+(x) ⇒ Object
- #-(x) ⇒ Object
- #-@ ⇒ Object
- #/(x) ⇒ Object
- #==(x) ⇒ Object
- #[](*args) ⇒ Object
-
#initialize(func_name, *args) ⇒ FuncCall
constructor
A new instance of FuncCall.
- #print(final = true) ⇒ Object
- #to_s ⇒ Object
- #to_str ⇒ Object
- #to_str_c ⇒ Object
- #to_str_fortran ⇒ Object
- #to_var ⇒ Object
Constructor Details
#initialize(func_name, *args) ⇒ FuncCall
Returns a new instance of FuncCall.
1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 |
# File 'lib/BOAST/Algorithm.rb', line 1119 def initialize(func_name, *args) @func_name = func_name if args.last.kind_of?(Hash) then @options = args.last @args = args[0..-2] else @args = args end @return_type = @options[:returns] if @options end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
1116 1117 1118 |
# File 'lib/BOAST/Algorithm.rb', line 1116 def args @args end |
#func_name ⇒ Object (readonly)
Returns the value of attribute func_name.
1115 1116 1117 |
# File 'lib/BOAST/Algorithm.rb', line 1115 def func_name @func_name end |
#prefix ⇒ Object
Returns the value of attribute prefix.
1117 1118 1119 |
# File 'lib/BOAST/Algorithm.rb', line 1117 def prefix @prefix end |
Class Method Details
.parens(*args, &block) ⇒ Object
1111 1112 1113 |
# File 'lib/BOAST/Algorithm.rb', line 1111 def self.parens(*args,&block) return self::new(*args,&block) end |
Instance Method Details
#*(x) ⇒ Object
1153 1154 1155 |
# File 'lib/BOAST/Algorithm.rb', line 1153 def *(x) return Expression::new("*",self,x) end |
#+(x) ⇒ Object
1149 1150 1151 |
# File 'lib/BOAST/Algorithm.rb', line 1149 def +(x) return Expression::new("+",self,x) end |
#-(x) ⇒ Object
1161 1162 1163 |
# File 'lib/BOAST/Algorithm.rb', line 1161 def -(x) return Expression::new("-",self,x) end |
#-@ ⇒ Object
1165 1166 1167 |
# File 'lib/BOAST/Algorithm.rb', line 1165 def -@ return Expression::new("-",nil,self) end |
#/(x) ⇒ Object
1157 1158 1159 |
# File 'lib/BOAST/Algorithm.rb', line 1157 def /(x) return Expression::new("/",self,x) end |
#==(x) ⇒ Object
1145 1146 1147 |
# File 'lib/BOAST/Algorithm.rb', line 1145 def ==(x) return Expression::new("==",self,x) end |
#[](*args) ⇒ Object
1169 1170 1171 |
# File 'lib/BOAST/Algorithm.rb', line 1169 def [](*args) return Index::new(self,args) end |
#print(final = true) ⇒ Object
1188 1189 1190 1191 1192 1193 1194 1195 |
# File 'lib/BOAST/Algorithm.rb', line 1188 def print(final=true) s="" s += " "*BOAST::get_indent_level if final s += self.to_str s += ";" if final and [C, CL, CUDA].include?( BOAST::get_lang ) BOAST::get_output.puts s if final return s end |
#to_s ⇒ Object
1141 1142 1143 |
# File 'lib/BOAST/Algorithm.rb', line 1141 def to_s self.to_str end |
#to_str ⇒ Object
1174 1175 1176 1177 |
# File 'lib/BOAST/Algorithm.rb', line 1174 def to_str return self.to_str_fortran if BOAST::get_lang == FORTRAN return self.to_str_c if [C, CL, CUDA].include?( BOAST::get_lang ) end |
#to_str_c ⇒ Object
1183 1184 1185 1186 1187 |
# File 'lib/BOAST/Algorithm.rb', line 1183 def to_str_c s = "" s += @prefix if @prefix s += "#{func_name}(#{@args.join(", ")})" end |
#to_str_fortran ⇒ Object
1178 1179 1180 1181 1182 |
# File 'lib/BOAST/Algorithm.rb', line 1178 def to_str_fortran s = "" s += @prefix if @prefix s += "#{func_name}(#{@args.join(", ")})" end |