rggen-core 0.19.0 → 0.20.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/exe/rggen +0 -0
  3. data/lib/rggen/core.rb +4 -3
  4. data/lib/rggen/core/base/component.rb +16 -7
  5. data/lib/rggen/core/base/component_factory.rb +12 -9
  6. data/lib/rggen/core/base/component_layer_extension.rb +194 -0
  7. data/lib/rggen/core/base/feature_layer_extension.rb +158 -0
  8. data/lib/rggen/core/builder/builder.rb +25 -25
  9. data/lib/rggen/core/builder/component_entry.rb +3 -2
  10. data/lib/rggen/core/builder/component_registry.rb +22 -17
  11. data/lib/rggen/core/builder/{category.rb → layer.rb} +27 -26
  12. data/lib/rggen/core/builder/plugins.rb +5 -3
  13. data/lib/rggen/core/configuration/component.rb +5 -0
  14. data/lib/rggen/core/configuration/component_factory.rb +1 -1
  15. data/lib/rggen/core/configuration/input_data.rb +15 -0
  16. data/lib/rggen/core/input_base/component_factory.rb +37 -6
  17. data/lib/rggen/core/input_base/feature.rb +3 -3
  18. data/lib/rggen/core/input_base/input_data.rb +13 -10
  19. data/lib/rggen/core/input_base/loader.rb +2 -3
  20. data/lib/rggen/core/input_base/yaml_loader.rb +5 -4
  21. data/lib/rggen/core/output_base/code_generator.rb +10 -23
  22. data/lib/rggen/core/output_base/component.rb +42 -39
  23. data/lib/rggen/core/output_base/component_factory.rb +4 -0
  24. data/lib/rggen/core/output_base/feature.rb +6 -7
  25. data/lib/rggen/core/register_map.rb +3 -3
  26. data/lib/rggen/core/register_map/component.rb +4 -3
  27. data/lib/rggen/core/register_map/component_factory.rb +18 -1
  28. data/lib/rggen/core/register_map/feature.rb +2 -2
  29. data/lib/rggen/core/register_map/hash_loader.rb +16 -23
  30. data/lib/rggen/core/register_map/input_data.rb +30 -16
  31. data/lib/rggen/core/register_map/loader.rb +1 -1
  32. data/lib/rggen/core/register_map/ruby_loader.rb +1 -1
  33. data/lib/rggen/core/utility/code_utility.rb +8 -2
  34. data/lib/rggen/core/version.rb +1 -1
  35. metadata +7 -6
  36. data/lib/rggen/core/base/hierarchical_accessors.rb +0 -91
  37. data/lib/rggen/core/base/hierarchical_feature_accessors.rb +0 -83
@@ -6,7 +6,7 @@ module RgGen
6
6
  class Loader < InputBase::Loader
7
7
  private
8
8
 
9
- def register_map
9
+ def root
10
10
  input_data
11
11
  end
12
12
  end
@@ -7,7 +7,7 @@ module RgGen
7
7
  support_types [:rb]
8
8
 
9
9
  def read_file(file)
10
- register_map.load_file(file)
10
+ root.load_file(file)
11
11
  end
12
12
  end
13
13
  end
@@ -8,13 +8,15 @@ module RgGen
8
8
  code_block
9
9
  end
10
10
 
11
- private
11
+ module_function
12
12
 
13
13
  def newline
14
14
  "\n"
15
15
  end
16
16
 
17
- alias_method :nl, :newline
17
+ def nl
18
+ newline
19
+ end
18
20
 
19
21
  def comma
20
22
  ','
@@ -36,6 +38,10 @@ module RgGen
36
38
  "\"#{expression}\""
37
39
  end
38
40
 
41
+ def array_name(name, size)
42
+ [name, *size&.map { |s| "[#{s}]" }].join
43
+ end
44
+
39
45
  def code_block(indent = 0, &body)
40
46
  CodeBlock.new(indent, &body)
41
47
  end
@@ -3,7 +3,7 @@
3
3
  module RgGen
4
4
  module Core
5
5
  MAJOR = 0
6
- MINOR = 19
6
+ MINOR = 20
7
7
  PATCH = 0
8
8
  VERSION = "#{MAJOR}.#{MINOR}.#{PATCH}"
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rggen-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.19.0
4
+ version: 0.20.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taichi Ishitani
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-02-17 00:00:00.000000000 Z
11
+ date: 2020-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: docile
@@ -81,20 +81,20 @@ files:
81
81
  - lib/rggen/core.rb
82
82
  - lib/rggen/core/base/component.rb
83
83
  - lib/rggen/core/base/component_factory.rb
84
+ - lib/rggen/core/base/component_layer_extension.rb
84
85
  - lib/rggen/core/base/feature.rb
85
86
  - lib/rggen/core/base/feature_factory.rb
86
- - lib/rggen/core/base/hierarchical_accessors.rb
87
- - lib/rggen/core/base/hierarchical_feature_accessors.rb
87
+ - lib/rggen/core/base/feature_layer_extension.rb
88
88
  - lib/rggen/core/base/internal_struct.rb
89
89
  - lib/rggen/core/base/proxy_call.rb
90
90
  - lib/rggen/core/base/shared_context.rb
91
91
  - lib/rggen/core/builder.rb
92
92
  - lib/rggen/core/builder/builder.rb
93
- - lib/rggen/core/builder/category.rb
94
93
  - lib/rggen/core/builder/component_entry.rb
95
94
  - lib/rggen/core/builder/component_registry.rb
96
95
  - lib/rggen/core/builder/feature_registry.rb
97
96
  - lib/rggen/core/builder/input_component_registry.rb
97
+ - lib/rggen/core/builder/layer.rb
98
98
  - lib/rggen/core/builder/list_feature_entry.rb
99
99
  - lib/rggen/core/builder/output_component_registry.rb
100
100
  - lib/rggen/core/builder/plugins.rb
@@ -107,6 +107,7 @@ files:
107
107
  - lib/rggen/core/configuration/feature.rb
108
108
  - lib/rggen/core/configuration/feature_factory.rb
109
109
  - lib/rggen/core/configuration/hash_loader.rb
110
+ - lib/rggen/core/configuration/input_data.rb
110
111
  - lib/rggen/core/configuration/json_loader.rb
111
112
  - lib/rggen/core/configuration/loader.rb
112
113
  - lib/rggen/core/configuration/ruby_loader.rb
@@ -186,5 +187,5 @@ requirements: []
186
187
  rubygems_version: 3.1.2
187
188
  signing_key:
188
189
  specification_version: 4
189
- summary: rggen-core-0.19.0
190
+ summary: rggen-core-0.20.0
190
191
  test_files: []
@@ -1,91 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RgGen
4
- module Core
5
- module Base
6
- module HierarchicalAccessors
7
- module RegisterMap
8
- def hierarchy
9
- :register_map
10
- end
11
-
12
- def register_blocks
13
- children
14
- end
15
-
16
- def registers
17
- register_blocks.flat_map(&:children)
18
- end
19
-
20
- def bit_fields
21
- registers.flat_map(&:children)
22
- end
23
- end
24
-
25
- module RegisterBlock
26
- def hierarchy
27
- :register_block
28
- end
29
-
30
- def register_map
31
- parent
32
- end
33
-
34
- def registers
35
- children
36
- end
37
-
38
- def bit_fields
39
- registers.flat_map(&:children)
40
- end
41
- end
42
-
43
- module Register
44
- def hierarchy
45
- :register
46
- end
47
-
48
- def register_map
49
- register_block.parent
50
- end
51
-
52
- def register_block
53
- parent
54
- end
55
-
56
- def bit_fields
57
- children
58
- end
59
- end
60
-
61
- module BitField
62
- def hierarchy
63
- :bit_field
64
- end
65
-
66
- def register_map
67
- register_block.parent
68
- end
69
-
70
- def register_block
71
- register.parent
72
- end
73
-
74
- def register
75
- parent
76
- end
77
- end
78
-
79
- private
80
-
81
- ACCESSOR_EXTENSIONS = [
82
- RegisterMap, RegisterBlock, Register, BitField
83
- ].freeze
84
-
85
- def define_hierarchical_accessors
86
- extend ACCESSOR_EXTENSIONS[level]
87
- end
88
- end
89
- end
90
- end
91
- end
@@ -1,83 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RgGen
4
- module Core
5
- module Base
6
- module HierarchicalFeatureAccessors
7
- module RegisterMap
8
- def hierarchy
9
- :register_map
10
- end
11
-
12
- def register_map
13
- @component
14
- end
15
- end
16
-
17
- module RegisterBlock
18
- def hierarchy
19
- :register_block
20
- end
21
-
22
- def register_map
23
- register_block.parent
24
- end
25
-
26
- def register_block
27
- @component
28
- end
29
- end
30
-
31
- module Register
32
- def hierarchy
33
- :register
34
- end
35
-
36
- def register_map
37
- register_block.parent
38
- end
39
-
40
- def register_block
41
- register.parent
42
- end
43
-
44
- def register
45
- @component
46
- end
47
- end
48
-
49
- module BitField
50
- def hierarchy
51
- :bit_field
52
- end
53
-
54
- def register_map
55
- register_block.parent
56
- end
57
-
58
- def register_block
59
- register.parent
60
- end
61
-
62
- def register
63
- bit_field.parent
64
- end
65
-
66
- def bit_field
67
- @component
68
- end
69
- end
70
-
71
- private
72
-
73
- ACCESSOR_EXTENSIONS = [
74
- RegisterMap, RegisterBlock, Register, BitField
75
- ].freeze
76
-
77
- def define_hierarchical_accessors
78
- extend ACCESSOR_EXTENSIONS[@component.level]
79
- end
80
- end
81
- end
82
- end
83
- end