BOAST 0.99993 → 0.99994
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/BOAST.gemspec +1 -1
- data/lib/BOAST/DataTypes.rb +26 -0
- data/lib/BOAST/Index.rb +21 -8
- data/lib/BOAST/Variable.rb +7 -6
- metadata +2 -2
data/BOAST.gemspec
CHANGED
data/lib/BOAST/DataTypes.rb
CHANGED
@@ -49,6 +49,15 @@ module BOAST
|
|
49
49
|
return !!signed
|
50
50
|
end
|
51
51
|
|
52
|
+
def suffix
|
53
|
+
s = ""
|
54
|
+
# if [C, CL, CUDA].include?( lang ) then
|
55
|
+
# s += "U" if not @signed
|
56
|
+
# s += "LL" if @size == 8
|
57
|
+
# end
|
58
|
+
return s
|
59
|
+
end
|
60
|
+
|
52
61
|
end
|
53
62
|
|
54
63
|
class Real < DataType
|
@@ -123,6 +132,17 @@ module BOAST
|
|
123
132
|
return "double#{@vector_length}" if @size == 8
|
124
133
|
end
|
125
134
|
end
|
135
|
+
|
136
|
+
def suffix
|
137
|
+
s = ""
|
138
|
+
if [C, CL, CUDA].include?( lang ) then
|
139
|
+
s += "f" if @size == 4
|
140
|
+
elsif lang == FORTRAN then
|
141
|
+
s += "_wp" if @size == 8
|
142
|
+
end
|
143
|
+
return s
|
144
|
+
end
|
145
|
+
|
126
146
|
end
|
127
147
|
|
128
148
|
class Int < DataType
|
@@ -242,6 +262,12 @@ module BOAST
|
|
242
262
|
end
|
243
263
|
end
|
244
264
|
end
|
265
|
+
|
266
|
+
def suffix
|
267
|
+
s = ""
|
268
|
+
return s
|
269
|
+
end
|
270
|
+
|
245
271
|
end
|
246
272
|
|
247
273
|
class CStruct < DataType
|
data/lib/BOAST/Index.rb
CHANGED
@@ -15,6 +15,27 @@ module BOAST
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def to_s
|
18
|
+
if get_replace_constants then
|
19
|
+
begin
|
20
|
+
const = @source.constant
|
21
|
+
indxs = @indexes.reverse
|
22
|
+
dims = @source.dimension.reverse
|
23
|
+
(0...dims.length).each { |indx|
|
24
|
+
dim = dims[indx]
|
25
|
+
s = "#{indxs[indx]}"
|
26
|
+
if dim.val2 then
|
27
|
+
s += " - (#{dim.val1})"
|
28
|
+
elsif 0 != get_array_start then
|
29
|
+
s += " - (#{get_array_start})"
|
30
|
+
end
|
31
|
+
ind = eval(s)
|
32
|
+
ind = ind.to_i
|
33
|
+
const = const[ind]
|
34
|
+
}
|
35
|
+
return "#{const}#{@source.type.suffix}"
|
36
|
+
rescue Exception => e
|
37
|
+
end
|
38
|
+
end
|
18
39
|
return to_s_fortran if lang == FORTRAN
|
19
40
|
return to_s_c if [C, CL, CUDA].include?( lang )
|
20
41
|
end
|
@@ -102,14 +123,6 @@ module BOAST
|
|
102
123
|
def to_s_c
|
103
124
|
return to_s_texture if @source.texture
|
104
125
|
sub = to_s_c_reversed
|
105
|
-
if get_replace_constants then
|
106
|
-
begin
|
107
|
-
indx = eval(sub)
|
108
|
-
indx = indx.to_i
|
109
|
-
return "#{@source.constant[indx]}"
|
110
|
-
rescue Exception => e
|
111
|
-
end
|
112
|
-
end
|
113
126
|
s = "#{@source}[" + sub + "]"
|
114
127
|
return s
|
115
128
|
end
|
data/lib/BOAST/Variable.rb
CHANGED
@@ -51,10 +51,10 @@ module BOAST
|
|
51
51
|
return s if first.nil?
|
52
52
|
s += "(/ &\n"
|
53
53
|
s += first.to_s
|
54
|
-
s +=
|
54
|
+
s += @type.suffix if @type
|
55
55
|
self[1..-1].each { |v|
|
56
56
|
s += ", &\n"+v.to_s
|
57
|
-
s +=
|
57
|
+
s += @type.suffix if @type
|
58
58
|
}
|
59
59
|
s += " /)"
|
60
60
|
end
|
@@ -63,9 +63,11 @@ module BOAST
|
|
63
63
|
s = ""
|
64
64
|
return s if first.nil?
|
65
65
|
s += "{\n"
|
66
|
-
s += first.to_s
|
66
|
+
s += first.to_s
|
67
|
+
s += @type.suffix if @type
|
67
68
|
self[1..-1].each { |v|
|
68
69
|
s += ",\n"+v.to_s
|
70
|
+
s += @type.suffix if @type
|
69
71
|
}
|
70
72
|
s += "}"
|
71
73
|
end
|
@@ -191,8 +193,7 @@ module BOAST
|
|
191
193
|
|
192
194
|
def to_s
|
193
195
|
if force_replace_constant? or ( replace_constant? and constant? and replace_constants? and not dimension? ) then
|
194
|
-
s = @constant.to_s
|
195
|
-
s += "_wp" if lang == FORTRAN and @type and @type.size == 8
|
196
|
+
s = @constant.to_s + @type.suffix
|
196
197
|
return s
|
197
198
|
end
|
198
199
|
if @scalar_output and [C, CL, CUDA].include?( lang ) then
|
@@ -343,7 +344,7 @@ module BOAST
|
|
343
344
|
s += " :: #{@name}"
|
344
345
|
if constant? then
|
345
346
|
s += " = #{@constant}"
|
346
|
-
s +=
|
347
|
+
s += @type.suffix if not dimension? and @type
|
347
348
|
end
|
348
349
|
s += finalize
|
349
350
|
output.print s
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: BOAST
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.99994'
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-10-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: narray
|