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.
1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 |
# File 'lib/BOAST/Algorithm.rb', line 1204 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.
1201 1202 1203 |
# File 'lib/BOAST/Algorithm.rb', line 1201 def args @args end |
#func_name ⇒ Object (readonly)
Returns the value of attribute func_name.
1200 1201 1202 |
# File 'lib/BOAST/Algorithm.rb', line 1200 def func_name @func_name end |
#prefix ⇒ Object
Returns the value of attribute prefix.
1202 1203 1204 |
# File 'lib/BOAST/Algorithm.rb', line 1202 def prefix @prefix end |
Class Method Details
.parens(*args, &block) ⇒ Object
1196 1197 1198 |
# File 'lib/BOAST/Algorithm.rb', line 1196 def self.parens(*args,&block) return self::new(*args,&block) end |
Instance Method Details
#*(x) ⇒ Object
1238 1239 1240 |
# File 'lib/BOAST/Algorithm.rb', line 1238 def *(x) return Expression::new("*",self,x) end |
#+(x) ⇒ Object
1234 1235 1236 |
# File 'lib/BOAST/Algorithm.rb', line 1234 def +(x) return Expression::new("+",self,x) end |
#-(x) ⇒ Object
1246 1247 1248 |
# File 'lib/BOAST/Algorithm.rb', line 1246 def -(x) return Expression::new("-",self,x) end |
#-@ ⇒ Object
1250 1251 1252 |
# File 'lib/BOAST/Algorithm.rb', line 1250 def -@ return Expression::new("-",nil,self) end |
#/(x) ⇒ Object
1242 1243 1244 |
# File 'lib/BOAST/Algorithm.rb', line 1242 def /(x) return Expression::new("/",self,x) end |
#==(x) ⇒ Object
1230 1231 1232 |
# File 'lib/BOAST/Algorithm.rb', line 1230 def ==(x) return Expression::new("==",self,x) end |
#[](*args) ⇒ Object
1254 1255 1256 |
# File 'lib/BOAST/Algorithm.rb', line 1254 def [](*args) return Index::new(self,args) end |
#print(final = true) ⇒ Object
1273 1274 1275 1276 1277 1278 1279 1280 |
# File 'lib/BOAST/Algorithm.rb', line 1273 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
1226 1227 1228 |
# File 'lib/BOAST/Algorithm.rb', line 1226 def to_s self.to_str end |
#to_str ⇒ Object
1259 1260 1261 1262 |
# File 'lib/BOAST/Algorithm.rb', line 1259 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
1268 1269 1270 1271 1272 |
# File 'lib/BOAST/Algorithm.rb', line 1268 def to_str_c s = "" s += @prefix if @prefix s += "#{func_name}(#{@args.join(", ")})" end |
#to_str_fortran ⇒ Object
1263 1264 1265 1266 1267 |
# File 'lib/BOAST/Algorithm.rb', line 1263 def to_str_fortran s = "" s += @prefix if @prefix s += "#{func_name}(#{@args.join(", ")})" end |