BOAST 1.1.0 → 1.2.0
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.
- checksums.yaml +4 -4
- data/BOAST.gemspec +1 -1
- data/lib/BOAST/Language/Case.rb +7 -6
- data/lib/BOAST/Language/If.rb +11 -10
- data/lib/BOAST/Language/Intrinsics.rb +12 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 939618b7050d9d0298fa5f06b310ac5a881b85ef
|
4
|
+
data.tar.gz: 60b1fc0bc92e9b1dad4003604a30c9f4de634d87
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc1877354a30495b196128bd5e94055808197c14e9e7d6fd9dbb8c1e6c6dc603efbd5a877fd6d64f4d7f12b0fe88a0a8c1801cacb3baf13d206d25740914af4e
|
7
|
+
data.tar.gz: 858093b8d634b8f0ff61f90aa5a2b7a8d67c5b49e9013cdc4093a453095adfaf9ba3490ad8548082b1bd0728cd280184a2ccacf147d94dcdbf541fff124217ec
|
data/BOAST.gemspec
CHANGED
data/lib/BOAST/Language/Case.rb
CHANGED
@@ -75,14 +75,15 @@ module BOAST
|
|
75
75
|
attr_reader :expression
|
76
76
|
attr_reader :case_conditions
|
77
77
|
|
78
|
-
def initialize(expression,
|
78
|
+
def initialize(expression, control = {}, &block)
|
79
79
|
@expression = expression
|
80
80
|
@case_conditions = []
|
81
|
-
control.
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
81
|
+
default = control.delete(:default)
|
82
|
+
default = block unless default or not block
|
83
|
+
control.each { |key, value|
|
84
|
+
@case_conditions.push CaseCondition::new( [key].flatten, &value )
|
85
|
+
}
|
86
|
+
@case_conditions.push CaseCondition::new( &default ) if default
|
86
87
|
end
|
87
88
|
|
88
89
|
def get_c_strings
|
data/lib/BOAST/Language/If.rb
CHANGED
@@ -4,19 +4,20 @@ module BOAST
|
|
4
4
|
|
5
5
|
attr_reader :conditions
|
6
6
|
|
7
|
-
def initialize(
|
8
|
-
raise "Illegal if construct!" if conditions.size == 0
|
9
|
-
conditions.push(block) if block
|
7
|
+
def initialize(conditions, &block)
|
10
8
|
@conditions = []
|
11
9
|
@blocks = []
|
12
|
-
if conditions.
|
13
|
-
|
10
|
+
if conditions.is_a?(Hash) then
|
11
|
+
else_block = conditions.delete(:else)
|
12
|
+
else_block = block unless else_block or not block
|
13
|
+
conditions.each { |key, value|
|
14
|
+
@conditions.push key
|
15
|
+
@blocks.push value
|
16
|
+
}
|
17
|
+
@blocks.push else_block if else_block
|
14
18
|
else
|
15
|
-
|
16
|
-
|
17
|
-
@blocks.push conditions.shift
|
18
|
-
end
|
19
|
-
@blocks.push conditions.shift if conditions.size > 0
|
19
|
+
@conditions.push conditions
|
20
|
+
@blocks.push block if block
|
20
21
|
end
|
21
22
|
end
|
22
23
|
|
@@ -8,15 +8,22 @@ module BOAST
|
|
8
8
|
X86 = 1
|
9
9
|
ARM = 2
|
10
10
|
|
11
|
-
native_flags =
|
11
|
+
native_flags = []
|
12
12
|
|
13
13
|
if OS.mac? then
|
14
14
|
native_flags = `sysctl -n machdep.cpu.features`.split
|
15
15
|
else
|
16
|
-
|
16
|
+
yaml_cpuinfo = YAML::load(`cat /proc/cpuinfo`)
|
17
|
+
cpuinfo_flags = yaml_cpuinfo["flags"]
|
18
|
+
cpuinfo_flags = yaml_cpuinfo["Features"] unless cpuinfo_flags
|
19
|
+
if cpuinfo_flags then
|
20
|
+
native_flags = cpuinfo_flags.upcase.gsub("_",".").split
|
21
|
+
else
|
22
|
+
warn "Unable to determine architecture flags for native!"
|
23
|
+
end
|
17
24
|
end
|
18
25
|
|
19
|
-
MODELS={ "native" => native_flags }
|
26
|
+
MODELS = { "native" => native_flags }
|
20
27
|
MODELS.update(X86architectures)
|
21
28
|
INSTRUCTIONS = {}
|
22
29
|
INSTRUCTIONS.update(X86CPUID_by_name)
|
@@ -38,11 +45,9 @@ module BOAST
|
|
38
45
|
else
|
39
46
|
instruction = INTRINSICS[get_architecture][intr_symbol][type]
|
40
47
|
end
|
48
|
+
return instruction if get_architecture == ARM
|
41
49
|
raise IntrinsicsError, "Unsupported operation #{intr_symbol} for #{type}#{type2 ? "and #{type2}" : ""} on #{get_architecture_name}!" unless instruction
|
42
|
-
supported =
|
43
|
-
INSTRUCTIONS[instruction.to_s].each { |flag|
|
44
|
-
supported = true if MODELS[get_model].include?(flag)
|
45
|
-
}
|
50
|
+
supported = (INSTRUCTIONS[instruction.to_s] & MODELS[get_model.to_s]).size > 0
|
46
51
|
raise IntrinsicsError, "Unsupported operation #{intr_symbol} for #{type}#{type2 ? "and #{type2}" : ""} on #{get_model}! (requires #{INSTRUCTIONS[instruction.to_s].join(" or ")})" unless supported
|
47
52
|
return instruction
|
48
53
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: BOAST
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brice Videau
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: narray
|