autoc 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +9 -1
- data/lib/autoc/composite.rb +2 -0
- data/lib/autoc/module.rb +10 -5
- data/lib/autoc/record.rb +4 -4
- data/lib/autoc/scaffold/glass_record.rb +9 -0
- data/lib/autoc/scaffold/project.rb +2 -2
- data/lib/autoc/scaffold/test_record_record.rb +21 -0
- data/lib/autoc/scaffold/tests.rb +1 -1
- data/lib/autoc.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 63b8d589357ec8f39556052ab6f23730e6a884620fe20dc32cb1d37707af9500
|
4
|
+
data.tar.gz: ccf9cc7c3183b92851edcac67e4d79f8ab42b0e927ca561a2e3038a9d1d74f74
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb3a6280555ff59a3249d6b1081f69df54106249b988bf8c81d46ca4537e70d55e7634f5f755db83f893bfa03cc4dfb85f12cc60de91ae4808cef7a08733cd83
|
7
|
+
data.tar.gz: b4939c6e87831c8ee72efa5dbd0489105b638e16b92fdba2a8b1eb5d8e5c5ba13cfeef8edc4b3ef4640c910b82fe153d28afaf2756e8cb78a461a09caef66d01
|
data/CHANGES.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
# 2.0.1
|
2
|
+
|
3
|
+
- Introduce switch for incremental module generation mode.
|
4
|
+
|
5
|
+
- Fix Record setter function type mismatch bug.
|
6
|
+
|
7
|
+
- Fix project structure conformance issue in CMake project scaffolder.
|
8
|
+
|
1
9
|
# 2.0.0
|
2
10
|
|
3
|
-
A complete package overhaul.
|
11
|
+
- A complete package overhaul.
|
data/lib/autoc/composite.rb
CHANGED
@@ -148,6 +148,8 @@ module AutoC
|
|
148
148
|
|
149
149
|
# Create a new type-bound function (aka method)
|
150
150
|
def method(result, name, parameters, inline: false, visibility: nil, constraint: true, instance: name, **kws)
|
151
|
+
name = name.to_sym
|
152
|
+
instance = instance.to_sym
|
151
153
|
method = method_class.new(
|
152
154
|
self,
|
153
155
|
result,
|
data/lib/autoc/module.rb
CHANGED
@@ -51,7 +51,12 @@ module AutoC
|
|
51
51
|
|
52
52
|
attr_accessor :source_threshold
|
53
53
|
|
54
|
-
def
|
54
|
+
def stateful? = @stateful == true
|
55
|
+
|
56
|
+
def initialize(name, stateful: true)
|
57
|
+
@name = name
|
58
|
+
@stateful = stateful
|
59
|
+
end
|
55
60
|
|
56
61
|
def header = @header ||= Header.new(self)
|
57
62
|
|
@@ -63,7 +68,7 @@ module AutoC
|
|
63
68
|
distribute_entities
|
64
69
|
header.render
|
65
70
|
sources.each(&:render)
|
66
|
-
State.new(self).collect.write
|
71
|
+
State.new(self).collect.write if stateful?
|
67
72
|
self
|
68
73
|
end
|
69
74
|
|
@@ -86,8 +91,8 @@ module AutoC
|
|
86
91
|
end
|
87
92
|
end
|
88
93
|
|
89
|
-
def self.render(name, &code)
|
90
|
-
m = self.new(name)
|
94
|
+
def self.render(name, **, &code)
|
95
|
+
m = self.new(name, **)
|
91
96
|
yield(m) if block_given?
|
92
97
|
m.render
|
93
98
|
end
|
@@ -114,7 +119,7 @@ module AutoC
|
|
114
119
|
end
|
115
120
|
|
116
121
|
def read
|
117
|
-
if File.exist?(file_name)
|
122
|
+
if self.module.stateful? && File.exist?(file_name)
|
118
123
|
# It's OK not to have this file but if it exists it must have proper contents
|
119
124
|
io = File.open(file_name, 'rt', chomp: true)
|
120
125
|
begin
|
data/lib/autoc/record.rb
CHANGED
@@ -217,17 +217,17 @@ module AutoC
|
|
217
217
|
@since 2.0
|
218
218
|
}
|
219
219
|
end
|
220
|
-
method(:void, "set_#{name}", { target: rvalue,
|
220
|
+
method(:void, "set_#{name}", { target: rvalue, value: type.const_rvalue } ).configure do
|
221
221
|
code %{
|
222
222
|
assert(target);
|
223
223
|
#{type.destroy.("target->#{name}") if type.destructible?};
|
224
|
-
#{type.copy.("target->#{name}",
|
224
|
+
#{type.copy.("target->#{name}", value)};
|
225
225
|
}
|
226
226
|
header %{
|
227
227
|
@brief Set value of field #{name}
|
228
228
|
|
229
229
|
@param[in] target record to modify
|
230
|
-
@param[in]
|
230
|
+
@param[in] value value to initalize field #{name} with
|
231
231
|
|
232
232
|
This function sets the field #{name} to contain a copy of specified value.
|
233
233
|
|
@@ -239,7 +239,7 @@ module AutoC
|
|
239
239
|
end
|
240
240
|
end
|
241
241
|
end
|
242
|
-
|
242
|
+
end
|
243
243
|
|
244
244
|
end # Record
|
245
245
|
|
@@ -19,10 +19,10 @@ end
|
|
19
19
|
###
|
20
20
|
def cmakelists_txt(project)
|
21
21
|
<<END
|
22
|
-
project(#{project})
|
23
|
-
|
24
22
|
cmake_minimum_required(VERSION 3.15)
|
25
23
|
|
24
|
+
project(#{project})
|
25
|
+
|
26
26
|
set(AUTOC_MODULE_NAME _${PROJECT_NAME})
|
27
27
|
set(AUTOC_MODULE_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.rb)
|
28
28
|
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'autoc/record'
|
2
|
+
|
3
|
+
require_relative 'glass_record'
|
4
|
+
|
5
|
+
t = type_test(AutoC::Record, :RecordRecord, { r: GlassRecord }) do
|
6
|
+
|
7
|
+
###
|
8
|
+
|
9
|
+
setup %{
|
10
|
+
#{self} t;
|
11
|
+
#{default_create.(:t)};
|
12
|
+
}
|
13
|
+
|
14
|
+
cleanup %{
|
15
|
+
#{destroy.(:t) if destructible?};
|
16
|
+
}
|
17
|
+
|
18
|
+
test :create_empty, %{
|
19
|
+
}
|
20
|
+
|
21
|
+
end
|
data/lib/autoc/scaffold/tests.rb
CHANGED
@@ -170,7 +170,7 @@ Dir[File.join(File.dirname(__FILE__), 'test_*.rb')].each { |t| require t }
|
|
170
170
|
|
171
171
|
require 'autoc/cmake'
|
172
172
|
|
173
|
-
x = AutoC::Module.render(:tests) do |m|
|
173
|
+
x = AutoC::Module.render(:tests, stateful: false) do |m|
|
174
174
|
m << $suite
|
175
175
|
m.source_threshold = 100*1024 # Split module code into a set of TUs with ~100 Kb in size
|
176
176
|
$tests.each { |t| $suite.dependencies << t }
|
data/lib/autoc.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: autoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oleg A. Khlybov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-03-
|
11
|
+
date: 2023-03-20 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |2
|
14
14
|
The package contains a functionality related to the C source code generation,
|
@@ -45,6 +45,7 @@ files:
|
|
45
45
|
- lib/autoc/scaffold.rb
|
46
46
|
- lib/autoc/scaffold/docs.rb
|
47
47
|
- lib/autoc/scaffold/generic_value.rb
|
48
|
+
- lib/autoc/scaffold/glass_record.rb
|
48
49
|
- lib/autoc/scaffold/project.rb
|
49
50
|
- lib/autoc/scaffold/test_cstring.rb
|
50
51
|
- lib/autoc/scaffold/test_cstring_hash_set.rb
|
@@ -52,6 +53,7 @@ files:
|
|
52
53
|
- lib/autoc/scaffold/test_int_hash_set.rb
|
53
54
|
- lib/autoc/scaffold/test_int_list.rb
|
54
55
|
- lib/autoc/scaffold/test_int_vector.rb
|
56
|
+
- lib/autoc/scaffold/test_record_record.rb
|
55
57
|
- lib/autoc/scaffold/test_v2v_hash_map.rb
|
56
58
|
- lib/autoc/scaffold/test_value_hash_set.rb
|
57
59
|
- lib/autoc/scaffold/test_value_vector.rb
|