metababel 1.1.3 → 1.1.4
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/bin/metababel +10 -12
- data/lib/metababel/bt2_trace_class_generator.rb +26 -3
- data/lib/metababel/bt2_values_generator.rb +31 -10
- data/lib/metababel/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6fef536b3f7091c580764b9e74b5a33cdfa268231fba8678a6097f71038b83ec
|
|
4
|
+
data.tar.gz: f715e0f2921b5542f0069e7b1a43624699d6381418a5052bface9c657d601f2d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1a802b99efa22f8e34def1c7ec1610fc0a3e25897f14f48faa80156a3af32e5696e297a2d95b6053f05e6b0015814aa067332d01af1623bbb5461d9e608e609e
|
|
7
|
+
data.tar.gz: 85206279e0e3b4971721c04b40bf484a23d103bb062f2e4ae3983b8a498673ab0ad34f304a6defe0943b7b8996fe40b9cc160840ffc139e44209185512230284
|
data/bin/metababel
CHANGED
|
@@ -125,18 +125,17 @@ class Dispatcher < BaseDispatch
|
|
|
125
125
|
end
|
|
126
126
|
end
|
|
127
127
|
|
|
128
|
-
#
|
|
129
|
-
#
|
|
130
|
-
#
|
|
131
|
-
#
|
|
128
|
+
# Prepend a newline to align the rendered body correctly.
|
|
129
|
+
# Without this, ERB adds unwanted indentation to <%= body %>.
|
|
130
|
+
# Since body_args[1] is already indented, we avoid double-indentation.
|
|
131
|
+
# The extra leading blank line is removed later.
|
|
132
132
|
def body
|
|
133
133
|
"\n" + body_args[1]
|
|
134
134
|
end
|
|
135
135
|
|
|
136
136
|
def args
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
evt_args += body_args[0].fetch('outputs', [])
|
|
137
|
+
timestamp = @default_clock_class ? [GeneratedArg.new('int64_t', '_timestamp')] : []
|
|
138
|
+
timestamp + body_args[0].fetch('outputs', [])
|
|
140
139
|
end
|
|
141
140
|
|
|
142
141
|
def args_to_free
|
|
@@ -191,16 +190,15 @@ def parse_argv
|
|
|
191
190
|
parser.on('-o', '--output FOLDER', '[Optional] Output folder path.')
|
|
192
191
|
parser.on('-i', '--usr-data-header NAME', '[Optional] User datatypes definitions.')
|
|
193
192
|
parser.on('--enable-callbacks NAME', Array, '[Optional] Enable some callbacks type')
|
|
194
|
-
parser.on('--display-shared-callback PLUGIN')
|
|
193
|
+
parser.on('--display-shared-callback PLUGIN') do |plugin|
|
|
195
194
|
path = Dir["#{__dir__}/../shared/*#{plugin}*"].first
|
|
196
195
|
puts File.readlines(path)
|
|
197
196
|
exit
|
|
198
|
-
|
|
199
|
-
parser.on('--drop','[Optional] Drop unknow messages')
|
|
197
|
+
end
|
|
198
|
+
parser.on('--drop', '[Optional] Drop unknow messages')
|
|
200
199
|
|
|
201
200
|
options = { 'disable-callbaks': ['on_downstream'].to_set,
|
|
202
|
-
'component-name': 'btx'
|
|
203
|
-
}
|
|
201
|
+
'component-name': 'btx' }
|
|
204
202
|
parser.parse!(into: options)
|
|
205
203
|
raise OptionParser::MissingArgument if options[:'component-type'].nil?
|
|
206
204
|
|
|
@@ -249,7 +249,6 @@ module Babeltrace2Gen
|
|
|
249
249
|
|
|
250
250
|
def initialize(parent:, name: nil, specific_context_field_class: nil, payload_field_class: nil, id: nil,
|
|
251
251
|
set_id: nil, domain: nil, register: true)
|
|
252
|
-
|
|
253
252
|
@set_id = set_id
|
|
254
253
|
@domain = domain
|
|
255
254
|
@register = register
|
|
@@ -365,6 +364,7 @@ module Babeltrace2Gen
|
|
|
365
364
|
include BTLocator
|
|
366
365
|
include BTPrinter
|
|
367
366
|
include BTMatch
|
|
367
|
+
|
|
368
368
|
using HashRefinements
|
|
369
369
|
|
|
370
370
|
BT_MATCH_ATTRS = %i[type cast_type cast_type_is_struct]
|
|
@@ -470,6 +470,7 @@ module Babeltrace2Gen
|
|
|
470
470
|
|
|
471
471
|
class BTFieldClass::BitArray < BTFieldClass
|
|
472
472
|
extend BTFromH
|
|
473
|
+
|
|
473
474
|
attr_reader :length
|
|
474
475
|
|
|
475
476
|
@bt_type = 'uint64_t'
|
|
@@ -597,6 +598,7 @@ module Babeltrace2Gen
|
|
|
597
598
|
|
|
598
599
|
class BTFieldClass::Enumeration::Unsigned < BTFieldClass::Integer::Unsigned
|
|
599
600
|
include BTFieldClass::Enumeration
|
|
601
|
+
|
|
600
602
|
class BTFieldClass::Enumeration::Unsigned::Mapping < BTFieldClass::Enumeration::Mapping
|
|
601
603
|
@bt_type_internal = 'unsigned'
|
|
602
604
|
end
|
|
@@ -608,6 +610,7 @@ module Babeltrace2Gen
|
|
|
608
610
|
|
|
609
611
|
class BTFieldClass::Enumeration::Signed < BTFieldClass::Integer::Signed
|
|
610
612
|
include BTFieldClass::Enumeration
|
|
613
|
+
|
|
611
614
|
class BTFieldClass::Enumeration::Signed::Mapping < BTFieldClass::Enumeration::Mapping
|
|
612
615
|
@bt_type_internal = 'signed'
|
|
613
616
|
end
|
|
@@ -629,7 +632,7 @@ module Babeltrace2Gen
|
|
|
629
632
|
end
|
|
630
633
|
|
|
631
634
|
def get_getter(field:, arg_variables:)
|
|
632
|
-
return super
|
|
635
|
+
return super unless @cast_type_is_struct
|
|
633
636
|
|
|
634
637
|
bt_func_get = self.class.instance_variable_get(:@bt_func) % 'get'
|
|
635
638
|
variable = bt_get_variable(arg_variables).name
|
|
@@ -639,7 +642,7 @@ module Babeltrace2Gen
|
|
|
639
642
|
end
|
|
640
643
|
|
|
641
644
|
def get_setter(field:, arg_variables:)
|
|
642
|
-
return super
|
|
645
|
+
return super unless @cast_type_is_struct
|
|
643
646
|
|
|
644
647
|
variable = bt_get_variable(arg_variables).name
|
|
645
648
|
|
|
@@ -667,6 +670,7 @@ module Babeltrace2Gen
|
|
|
667
670
|
|
|
668
671
|
class BTFieldClass::Array::Static < BTFieldClass::Array
|
|
669
672
|
extend BTFromH
|
|
673
|
+
|
|
670
674
|
using HashRefinements
|
|
671
675
|
attr_reader :length
|
|
672
676
|
|
|
@@ -712,6 +716,7 @@ module Babeltrace2Gen
|
|
|
712
716
|
|
|
713
717
|
class BTFieldClass::Array::Dynamic < BTFieldClass::Array
|
|
714
718
|
extend BTFromH
|
|
719
|
+
|
|
715
720
|
module WithLengthField
|
|
716
721
|
attr_reader :length_field_path
|
|
717
722
|
end
|
|
@@ -722,6 +727,7 @@ module Babeltrace2Gen
|
|
|
722
727
|
return unless length_field_path
|
|
723
728
|
|
|
724
729
|
extend(WithLengthField)
|
|
730
|
+
|
|
725
731
|
@length_field_path = length_field_path
|
|
726
732
|
end
|
|
727
733
|
|
|
@@ -891,6 +897,7 @@ module Babeltrace2Gen
|
|
|
891
897
|
|
|
892
898
|
class BTFieldClass::Option::WithSelectorField::Bool < BTFieldClass::Option::WithSelectorField
|
|
893
899
|
extend BTFromH
|
|
900
|
+
|
|
894
901
|
attr_reader :selector_is_reversed
|
|
895
902
|
|
|
896
903
|
def initialize(parent:, field_class:, selector_field_path:, selector_is_reversed: nil)
|
|
@@ -901,6 +908,7 @@ module Babeltrace2Gen
|
|
|
901
908
|
|
|
902
909
|
class BTFieldClass::Option::WithSelectorField::IntegerUnsigned < BTFieldClass::Option::WithSelectorField
|
|
903
910
|
extend BTFromH
|
|
911
|
+
|
|
904
912
|
attr_reader :selector_ranges
|
|
905
913
|
|
|
906
914
|
def initialize(parent:, field_class:, selector_field_path:, selector_ranges:)
|
|
@@ -911,6 +919,7 @@ module Babeltrace2Gen
|
|
|
911
919
|
|
|
912
920
|
class BTFieldClass::Option::WithSelectorField::IntegerSigned < BTFieldClass::Option::WithSelectorField
|
|
913
921
|
extend BTFromH
|
|
922
|
+
|
|
914
923
|
attr_reader :selector_ranges
|
|
915
924
|
|
|
916
925
|
def initialize(parent:, field_class:, selector_field_path:, selector_ranges:)
|
|
@@ -921,6 +930,7 @@ module Babeltrace2Gen
|
|
|
921
930
|
|
|
922
931
|
class BTFieldClass::Variant < BTFieldClass
|
|
923
932
|
extend BTFromH
|
|
933
|
+
|
|
924
934
|
attr_reader :options
|
|
925
935
|
|
|
926
936
|
class Option
|
|
@@ -953,6 +963,7 @@ module Babeltrace2Gen
|
|
|
953
963
|
@parent = parent
|
|
954
964
|
if selector_field_class
|
|
955
965
|
extend(WithSelectorField)
|
|
966
|
+
|
|
956
967
|
@selector_field_class = selector_field_class
|
|
957
968
|
@options = options.collect do |o|
|
|
958
969
|
BTFieldClass::Variant::WithSelectorField::Option.new(name: o[:name], field_class: o[:field_class],
|
|
@@ -960,6 +971,7 @@ module Babeltrace2Gen
|
|
|
960
971
|
end
|
|
961
972
|
else
|
|
962
973
|
extend(WithoutSelectorField)
|
|
974
|
+
|
|
963
975
|
@options = options.collect do |o|
|
|
964
976
|
BTFieldClass::Variant::Option.new(name: o[:name], field_class: o[:field_class])
|
|
965
977
|
end
|
|
@@ -972,6 +984,7 @@ module Babeltrace2Gen
|
|
|
972
984
|
include BTLocator
|
|
973
985
|
include BTMatchMembers
|
|
974
986
|
extend BTFromH
|
|
987
|
+
|
|
975
988
|
attr_reader :parent, :entries
|
|
976
989
|
|
|
977
990
|
BT_MATCH_ATTRS = [:entries]
|
|
@@ -993,6 +1006,7 @@ module Babeltrace2Gen
|
|
|
993
1006
|
class BTEntryClass
|
|
994
1007
|
include BTPrinter
|
|
995
1008
|
include BTMatch
|
|
1009
|
+
|
|
996
1010
|
using HashRefinements
|
|
997
1011
|
|
|
998
1012
|
BT_MATCH_ATTRS = %i[name type]
|
|
@@ -1012,6 +1026,7 @@ module Babeltrace2Gen
|
|
|
1012
1026
|
raise "No type in #{model}" unless type || is_match_model
|
|
1013
1027
|
|
|
1014
1028
|
h = { 'string' => BTEntryClass::String,
|
|
1029
|
+
'integer_unsigned' => BTEntryClass::IntegerUnsigned,
|
|
1015
1030
|
'integer_signed' => BTEntryClass::IntegerSigned }.freeze
|
|
1016
1031
|
|
|
1017
1032
|
raise "Type #{type} not supported" unless h.include?(type) || is_match_model
|
|
@@ -1055,4 +1070,12 @@ module Babeltrace2Gen
|
|
|
1055
1070
|
# Sadly it's ` bt_trace_set_environment_entry_integer() ` and not ` bt_trace_set_environment_entry_integer_signed()`
|
|
1056
1071
|
@bt_type_set = 'integer'
|
|
1057
1072
|
end
|
|
1073
|
+
|
|
1074
|
+
class BTEntryClass::IntegerUnsigned < BTEntryClass
|
|
1075
|
+
extend BTFromH
|
|
1076
|
+
|
|
1077
|
+
@bt_type = 'uint64_t'
|
|
1078
|
+
# Sadly it's ` bt_trace_set_environment_entry_integer() ` and not ` bt_trace_set_environment_entry_integer_unsigned()`
|
|
1079
|
+
@bt_type_set = 'integer'
|
|
1080
|
+
end
|
|
1058
1081
|
end
|
|
@@ -11,7 +11,8 @@ module Babeltrace2Gen
|
|
|
11
11
|
h = { 'map' => BTValueCLass::Map,
|
|
12
12
|
'string' => BTValueCLass::String,
|
|
13
13
|
'bool' => BTValueCLass::Bool,
|
|
14
|
-
'integer_unsigned' => BTValueCLass::IntegerUnsigned
|
|
14
|
+
'integer_unsigned' => BTValueCLass::IntegerUnsigned,
|
|
15
|
+
'integer_signed' => BTValueCLass::IntegerSigned }.freeze
|
|
15
16
|
raise "Type #{key} not supported" unless h.include?(key)
|
|
16
17
|
|
|
17
18
|
cast_type = model.delete(:cast_type)
|
|
@@ -45,10 +46,12 @@ module Babeltrace2Gen
|
|
|
45
46
|
default_value = @usr_default_value || bt_default_value
|
|
46
47
|
|
|
47
48
|
pr "if (#{val} != NULL) {"
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
if bt_type_is
|
|
50
|
+
pr " if (#{bt_type_is}(#{val}) != BT_TRUE) {"
|
|
51
|
+
pr " fprintf(stderr,\"Bad value for command line argument '%s' the value must be '%s'. \\n\",\"#{@name}\",\"#{bt_type}\");"
|
|
52
|
+
pr ' exit(1);'
|
|
53
|
+
pr ' }'
|
|
54
|
+
end
|
|
52
55
|
pr " #{name} = #{cast_func}bt_value_#{bt_type}_get(#{val});"
|
|
53
56
|
pr '} else {'
|
|
54
57
|
pr " #{name} = #{cast_func}#{default_value};"
|
|
@@ -96,7 +99,7 @@ module Babeltrace2Gen
|
|
|
96
99
|
raise "Bad default_value for '#{name}' in params.yaml, it must be #{bt_type} (BT_TRUE or BT_FALSE) but provided '#{usr_default_value}'."
|
|
97
100
|
end
|
|
98
101
|
|
|
99
|
-
super
|
|
102
|
+
super
|
|
100
103
|
end
|
|
101
104
|
end
|
|
102
105
|
|
|
@@ -119,17 +122,35 @@ module Babeltrace2Gen
|
|
|
119
122
|
|
|
120
123
|
class BTValueCLass::IntegerUnsigned < BTValueCLass::Scalar
|
|
121
124
|
@bt_type = 'integer_unsigned'
|
|
122
|
-
@bt_type_is = '
|
|
125
|
+
@bt_type_is = nil # 'bt_value_is_unsigned_integer'. Workarround `isIntegerUnsigned` broken
|
|
123
126
|
@bt_return_type = 'uint64_t'
|
|
124
127
|
@bt_default_value = '0'
|
|
125
128
|
|
|
126
129
|
def initialize(name, usr_default_value)
|
|
127
130
|
bt_type = self.class.instance_variable_get(:@bt_type)
|
|
128
|
-
if !usr_default_value.nil? && (!usr_default_value.is_a?(Integer) || !usr_default_value.between?(0,
|
|
129
|
-
|
|
131
|
+
if !usr_default_value.nil? && (!usr_default_value.is_a?(Integer) || !usr_default_value.between?(0,
|
|
132
|
+
(2**64) - 1))
|
|
133
|
+
raise "Bad default_value for '#{name}' in params.yaml, it must be #{bt_type} and must be in [0, 2**64 - 1], but provided '#{usr_default_value}'."
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
super
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
class BTValueCLass::IntegerSigned < BTValueCLass::Scalar
|
|
141
|
+
@bt_type = 'integer_signed'
|
|
142
|
+
@bt_type_is = 'bt_value_is_signed_integer'
|
|
143
|
+
@bt_return_type = 'int64_t'
|
|
144
|
+
@bt_default_value = '0'
|
|
145
|
+
|
|
146
|
+
def initialize(name, usr_default_value)
|
|
147
|
+
bt_type = self.class.instance_variable_get(:@bt_type)
|
|
148
|
+
if !usr_default_value.nil? && (!usr_default_value.is_a?(Integer) || !usr_default_value.between?(-2**63,
|
|
149
|
+
(2**63) - 1))
|
|
150
|
+
raise "Bad default_value for '#{name}' in params.yaml, it must be #{bt_type} and must be in [-2**63, 2**63 - 1], but provided '#{usr_default_value}'."
|
|
130
151
|
end
|
|
131
152
|
|
|
132
|
-
super
|
|
153
|
+
super
|
|
133
154
|
end
|
|
134
155
|
end
|
|
135
156
|
end
|
data/lib/metababel/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: metababel
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Thomas Applencourt
|
|
@@ -10,7 +10,7 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date: 2025-
|
|
13
|
+
date: 2025-11-03 00:00:00.000000000 Z
|
|
14
14
|
dependencies: []
|
|
15
15
|
description:
|
|
16
16
|
email:
|