Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flow #43

Draft
wants to merge 24 commits into
base: master
Choose a base branch
from
Draft

Flow #43

Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
master of block
  • Loading branch information
TApplencourt committed Sep 22, 2022
commit 07d1e855b5794d12e32a2f6fda4e9e07248fe4cc
29 changes: 15 additions & 14 deletions utils/gen_babeltrace_base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ def scope(&block)
@@indent -= 1
pr "}"
end
module_function :scope

def bt_set_conditionally(guard)
yield guard ? "BT_TRUE": "BT_FALSE" unless guard.nil?
end
end

module BTLocator
Expand Down Expand Up @@ -94,10 +97,10 @@ def trace_class

def get_declarator(self_component:, variable:)
pr "bt_trace_class *#{variable} = bt_trace_class_create(#{self_component});"
unless @assigns_automatic_stream_class_id.nil?
auto_sc_id = @assigns_automatic_stream_class_id ? "BT_TRUE": "BT_FALSE"
pr "bt_trace_class_set_assigns_automatic_stream_class_id(#{variable}, #{auto_sc_id});"
end

bt_set_conditionally ( @assigns_automatic_stream_class_id) { |v|
pr "bt_trace_class_set_assigns_automatic_stream_class_id(#{variable}, #{v});"
}

@stream_classes.each_with_index { |m,i|
stream_class_name = "#{variable}_sc_#{i}"
Expand Down Expand Up @@ -168,11 +171,10 @@ def get_declarator(trace_class:, variable:)
pr "bt_stream_class_set_event_common_context_field_class(#{variable}, #{var_ecc});"
}
end
# Need to do is avec packet and event_common_context because it can refer members to those
unless @assigns_automatic_event_class_id.nil?
auto_id_event_class = @assigns_automatic_event_class_id ? "BT_TRUE" : "BT_FALSE"
pr "bt_stream_class_set_assigns_automatic_event_class_id(#{variable}, #{auto_id_event_class});"
end
# Need to do is afert packet an devent_common_context because it can refer members to those
bt_set_conditionally( @assigns_automatic_event_class_id ) { |v|
pr "bt_stream_class_set_assigns_automatic_event_class_id(#{variable}, #{v});"
}

@event_classes.each_with_index { |ec,i|
var_name = "#{variable}_ec_#{i}"
Expand All @@ -182,10 +184,9 @@ def get_declarator(trace_class:, variable:)
}
}

unless @assigns_automatic_stream_id.nil?
auto_id_stream = @assigns_automatic_stream_id ? "BT_TRUE" : "BT_FALSE"
pr "bt_stream_class_set_assigns_automatic_stream_id(#{variable}, #{auto_id_stream});"
end
bt_set_conditionally( @assigns_automatic_stream_id ) { |v|
pr "bt_stream_class_set_assigns_automatic_stream_id(#{variable}, #{v});"
}
end
end

Expand Down