tecscde 0.6.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 +7 -0
- data/.gitignore +12 -0
- data/.rubocop.yml +125 -0
- data/.rubocop_todo.yml +188 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile +6 -0
- data/LICENSE +46 -0
- data/LICENSE.ja +32 -0
- data/README.ja.md +200 -0
- data/README.md +35 -0
- data/Rakefile +27 -0
- data/bin/tecscde +64 -0
- data/glade/tecscde-cell-property.glade +205 -0
- data/glade/tecscde-celltype-property.glade +172 -0
- data/glade/tecscde-celltype.glade +414 -0
- data/glade/tecscde-export.glade +161 -0
- data/glade/test-cell-plugin.rb +51 -0
- data/glade/test-cell-property.rb +35 -0
- data/glade/test-export.rb +35 -0
- data/glade/test-palette.rb +26 -0
- data/lib/tcflow.rb +148 -0
- data/lib/tecscde.rb +65 -0
- data/lib/tecscde/NewCell.png +0 -0
- data/lib/tecscde/SelectArrow.png +0 -0
- data/lib/tecscde/attr_tree_view.rb +253 -0
- data/lib/tecscde/cell_plugin_dialog.glade +294 -0
- data/lib/tecscde/cell_plugin_dialog.rb +89 -0
- data/lib/tecscde/celltype_tree_view.rb +105 -0
- data/lib/tecscde/change_set_control.rb +35 -0
- data/lib/tecscde/change_set_control/change_set.rb +32 -0
- data/lib/tecscde/change_set_control/change_set_manager.rb +62 -0
- data/lib/tecscde/command.rb +35 -0
- data/lib/tecscde/control.rb +491 -0
- data/lib/tecscde/highlighted_objects.rb +180 -0
- data/lib/tecscde/logger.rb +74 -0
- data/lib/tecscde/main_view_and_model.rb +80 -0
- data/lib/tecscde/palette.glade +553 -0
- data/lib/tecscde/palette.rb +174 -0
- data/lib/tecscde/preferences.glade +117 -0
- data/lib/tecscde/preferences.rb +44 -0
- data/lib/tecscde/tecs_model.rb +1137 -0
- data/lib/tecscde/tecs_model/hbar.rb +68 -0
- data/lib/tecscde/tecs_model/tm_c_port.rb +122 -0
- data/lib/tecscde/tecs_model/tm_c_port_array.rb +98 -0
- data/lib/tecscde/tecs_model/tm_cell.rb +496 -0
- data/lib/tecscde/tecs_model/tm_e_port.rb +126 -0
- data/lib/tecscde/tecs_model/tm_e_port_array.rb +78 -0
- data/lib/tecscde/tecs_model/tm_join.rb +293 -0
- data/lib/tecscde/tecs_model/tm_join_bar.rb +146 -0
- data/lib/tecscde/tecs_model/tm_port.rb +238 -0
- data/lib/tecscde/tecs_model/tm_port_array.rb +246 -0
- data/lib/tecscde/tecs_model/tm_region.rb +107 -0
- data/lib/tecscde/tecs_model/tm_uneditable.rb +68 -0
- data/lib/tecscde/tecs_model/vbar.rb +68 -0
- data/lib/tecscde/templates/_cell_info.cde.erb +15 -0
- data/lib/tecscde/templates/_join_info.cde.erb +28 -0
- data/lib/tecscde/templates/main.cde.erb +49 -0
- data/lib/tecscde/tm_object.rb +91 -0
- data/lib/tecscde/version.rb +4 -0
- data/lib/tecscde/view.rb +58 -0
- data/lib/tecscde/view/cairo_matrix.rb +90 -0
- data/lib/tecscde/view/canvas.rb +59 -0
- data/lib/tecscde/view/constants.rb +114 -0
- data/lib/tecscde/view/main_view.rb +1245 -0
- data/lib/tecsflow.rb +475 -0
- data/lib/tecsflow/C_parser.tab.rb +2471 -0
- data/lib/tecsflow/C_parser.y.rb +1087 -0
- data/lib/tecsflow/classes.rb +421 -0
- data/lib/tecsgen.rb +581 -0
- data/lib/tecsgen/core/C_parser.tab.rb +2477 -0
- data/lib/tecsgen/core/C_parser.y +1032 -0
- data/lib/tecsgen/core/bnf-deb.tab.rb +5193 -0
- data/lib/tecsgen/core/bnf.tab.rb +5193 -0
- data/lib/tecsgen/core/bnf.y +2211 -0
- data/lib/tecsgen/core/componentobj.rb +7901 -0
- data/lib/tecsgen/core/ctypes.rb +226 -0
- data/lib/tecsgen/core/expression.rb +1031 -0
- data/lib/tecsgen/core/gen_xml.rb +374 -0
- data/lib/tecsgen/core/generate.rb +5206 -0
- data/lib/tecsgen/core/location.rb +116 -0
- data/lib/tecsgen/core/messages.rb +101 -0
- data/lib/tecsgen/core/optimize.rb +456 -0
- data/lib/tecsgen/core/plugin.rb +332 -0
- data/lib/tecsgen/core/pluginModule.rb +165 -0
- data/lib/tecsgen/core/syntaxobj.rb +1234 -0
- data/lib/tecsgen/core/tecs_lang.rb +306 -0
- data/lib/tecsgen/core/tecsgen.rb +453 -0
- data/lib/tecsgen/core/tecsinfo.rb +860 -0
- data/lib/tecsgen/core/tool_info.rb +258 -0
- data/lib/tecsgen/core/types.rb +1632 -0
- data/lib/tecsgen/core/unjoin_plugin.rb +218 -0
- data/lib/tecsgen/core/value.rb +650 -0
- data/lib/tecsgen/messages/messages_console_en_US.rb +1171 -0
- data/lib/tecsgen/messages/messages_console_ja_JP.rb +1171 -0
- data/lib/tecsgen/messages/messages_file_en_US.rb +334 -0
- data/lib/tecsgen/messages/messages_file_ja_JP.rb +163 -0
- data/lib/tecsgen/plugin/ATK1AlarmPlugin.rb +196 -0
- data/lib/tecsgen/plugin/ATK1DelayTaskPlugin.rb +106 -0
- data/lib/tecsgen/plugin/ATK1EventPlugin.rb +147 -0
- data/lib/tecsgen/plugin/ATK1ISRPlugin.rb +174 -0
- data/lib/tecsgen/plugin/ATK1KernelPlugin.rb +287 -0
- data/lib/tecsgen/plugin/ATK1ResourcePlugin.rb +124 -0
- data/lib/tecsgen/plugin/ATK1TaskPlugin.rb +220 -0
- data/lib/tecsgen/plugin/C2TECSBridgePlugin.rb +210 -0
- data/lib/tecsgen/plugin/CellPlugin.rb +61 -0
- data/lib/tecsgen/plugin/CelltypePlugin.rb +72 -0
- data/lib/tecsgen/plugin/CompositePlugin.rb +66 -0
- data/lib/tecsgen/plugin/DomainPlugin.rb +89 -0
- data/lib/tecsgen/plugin/HRP2AlarmHandlerPlugin.rb +76 -0
- data/lib/tecsgen/plugin/HRP2Cache.rb +1 -0
- data/lib/tecsgen/plugin/HRP2CyclicHandlerPlugin.rb +75 -0
- data/lib/tecsgen/plugin/HRP2DataqueuePlugin.rb +68 -0
- data/lib/tecsgen/plugin/HRP2EventflagPlugin.rb +68 -0
- data/lib/tecsgen/plugin/HRP2FixedSizeMemoryPoolPlugin.rb +68 -0
- data/lib/tecsgen/plugin/HRP2HandlerPlugin.rb +117 -0
- data/lib/tecsgen/plugin/HRP2KernelObjectPlugin.rb +372 -0
- data/lib/tecsgen/plugin/HRP2ObjectPlugin.rb +94 -0
- data/lib/tecsgen/plugin/HRP2Plugin.rb +140 -0
- data/lib/tecsgen/plugin/HRP2PostHook.rb +111 -0
- data/lib/tecsgen/plugin/HRP2PriorityDataqueuePlugin.rb +66 -0
- data/lib/tecsgen/plugin/HRP2RPCPlugin.rb +319 -0
- data/lib/tecsgen/plugin/HRP2SVCPlugin.rb +473 -0
- data/lib/tecsgen/plugin/HRP2SemaphorePlugin.rb +67 -0
- data/lib/tecsgen/plugin/HRP2TaskPlugin.rb +200 -0
- data/lib/tecsgen/plugin/HRPHandlerPlugin.rb +125 -0
- data/lib/tecsgen/plugin/HRPKernelObjectManager.rb +72 -0
- data/lib/tecsgen/plugin/HRPKernelObjectPlugin.rb +333 -0
- data/lib/tecsgen/plugin/HRPObjectPlugin.rb +93 -0
- data/lib/tecsgen/plugin/HRPPlugin.rb +356 -0
- data/lib/tecsgen/plugin/HRPRPCPlugin.rb +407 -0
- data/lib/tecsgen/plugin/HRPSVCPlugin.rb +859 -0
- data/lib/tecsgen/plugin/HRPTaskPlugin.rb +107 -0
- data/lib/tecsgen/plugin/Mruby2CBridgePlugin.rb +86 -0
- data/lib/tecsgen/plugin/MrubyBridgeCellPlugin.rb +264 -0
- data/lib/tecsgen/plugin/MrubyBridgeCelltypePlugin.rb +293 -0
- data/lib/tecsgen/plugin/MrubyBridgeCompositePlugin.rb +49 -0
- data/lib/tecsgen/plugin/MrubyBridgePlugin.rb +67 -0
- data/lib/tecsgen/plugin/MrubyBridgeSignaturePlugin.rb +1307 -0
- data/lib/tecsgen/plugin/MrubyInfoBridgePlugin.rb +14 -0
- data/lib/tecsgen/plugin/MrubyInfoBridgeSignaturePlugin.rb +994 -0
- data/lib/tecsgen/plugin/MultiPlugin.rb +57 -0
- data/lib/tecsgen/plugin/NotifierPlugin.rb +1217 -0
- data/lib/tecsgen/plugin/OpaqueMarshalerPlugin.rb +81 -0
- data/lib/tecsgen/plugin/OpaqueRPCPlugin.rb +323 -0
- data/lib/tecsgen/plugin/RPCPlugin.rb +266 -0
- data/lib/tecsgen/plugin/RepeatCellPlugin.rb +166 -0
- data/lib/tecsgen/plugin/RepeatJoinPlugin.rb +130 -0
- data/lib/tecsgen/plugin/SharedOpaqueRPCPlugin.rb +357 -0
- data/lib/tecsgen/plugin/SharedRPCPlugin.rb +329 -0
- data/lib/tecsgen/plugin/SignaturePlugin.rb +77 -0
- data/lib/tecsgen/plugin/TECS2CBridgePlugin.rb +178 -0
- data/lib/tecsgen/plugin/TECSInfoPlugin.rb +280 -0
- data/lib/tecsgen/plugin/ThroughPlugin.rb +333 -0
- data/lib/tecsgen/plugin/TracePlugin.rb +484 -0
- data/lib/tecsgen/plugin/lib/GenHRP2Marshaler.rb +761 -0
- data/lib/tecsgen/plugin/lib/GenOpaqueMarshaler.rb +1107 -0
- data/lib/tecsgen/plugin/lib/GenParamCopy.rb +365 -0
- data/lib/tecsgen/plugin/lib/GenTransparentMarshaler.rb +683 -0
- data/lib/tecsgen/plugin/lib/MrubyBridgeCelltypePluginModule.rb +283 -0
- data/lib/tecsgen/plugin/lib/MrubyBridgeSignaturePluginModule.rb +277 -0
- data/lib/tecsgen/version.rb +6 -0
- data/samples/FigureSamples/active/active.cde +104 -0
- data/samples/FigureSamples/active/active.cdl +20 -0
- data/samples/FigureSamples/active/active.pdf +0 -0
- data/samples/FigureSamples/active/active.png +0 -0
- data/samples/FigureSamples/active/gen/tmp_C_src.c +36 -0
- data/samples/FigureSamples/active/gen/tmp_cygwin_tecs.h +1908 -0
- data/samples/FigureSamples/active/gen/tmp_plugin_post_code.cdl +0 -0
- data/samples/FigureSamples/allocator/allocator-internal.png +0 -0
- data/samples/FigureSamples/allocator/allocator.cde +171 -0
- data/samples/FigureSamples/allocator/allocator.cdl +58 -0
- data/samples/FigureSamples/allocator/allocator.png +0 -0
- data/samples/FigureSamples/basic/Makefile +87 -0
- data/samples/FigureSamples/basic/SimpleSample-trace.cdl +50 -0
- data/samples/FigureSamples/basic/SimpleSample.cde +91 -0
- data/samples/FigureSamples/basic/SimpleSample.cdl +47 -0
- data/samples/FigureSamples/basic/basic.cde +93 -0
- data/samples/FigureSamples/basic/basic.cdl +46 -0
- data/samples/FigureSamples/basic/basic.png +0 -0
- data/samples/FigureSamples/callback/callback.cde +130 -0
- data/samples/FigureSamples/callback/callback.cdl +29 -0
- data/samples/FigureSamples/callback/callback.png +0 -0
- data/samples/FigureSamples/carray/carray.cde +144 -0
- data/samples/FigureSamples/carray/carray.cdl +38 -0
- data/samples/FigureSamples/carray/carray.png +0 -0
- data/samples/FigureSamples/cearray/cearray.cde +314 -0
- data/samples/FigureSamples/cearray/cearray.cdl +60 -0
- data/samples/FigureSamples/cearray/cearray.png +0 -0
- data/samples/FigureSamples/composite/composite-internal.png +0 -0
- data/samples/FigureSamples/composite/composite.cde +216 -0
- data/samples/FigureSamples/composite/composite.cdl +95 -0
- data/samples/FigureSamples/composite/composite.png +0 -0
- data/samples/FigureSamples/earray/earray.cde +142 -0
- data/samples/FigureSamples/earray/earray.cdl +38 -0
- data/samples/FigureSamples/earray/earray.png +0 -0
- data/samples/FigureSamples/join/Makefile +87 -0
- data/samples/FigureSamples/join/join.cde +132 -0
- data/samples/FigureSamples/join/join.cdl +40 -0
- data/samples/FigureSamples/join/join.png +0 -0
- data/samples/FigureSamples/relay/Makefile +99 -0
- data/samples/FigureSamples/relay/relay-internal.png +0 -0
- data/samples/FigureSamples/relay/relay.cde +284 -0
- data/samples/FigureSamples/relay/relay.cdl +52 -0
- data/samples/FigureSamples/relay/relay.png +0 -0
- data/samples/FigureSamples/rpc/Makefile +123 -0
- data/samples/FigureSamples/rpc/rpc-expand.png +0 -0
- data/samples/FigureSamples/rpc/rpc.cde +245 -0
- data/samples/FigureSamples/rpc/rpc.png +0 -0
- data/samples/FigureSamples/rpc/rpc_sample.cdl +53 -0
- data/samples/SimpleSample/Makefile +25 -0
- data/samples/SimpleSample/SimpleSample/Makefile +86 -0
- data/samples/SimpleSample/SimpleSample/Makefile-trace +91 -0
- data/samples/SimpleSample/SimpleSample/README.txt +106 -0
- data/samples/SimpleSample/SimpleSample/SimpleSample-trace.cdl +50 -0
- data/samples/SimpleSample/SimpleSample/SimpleSample.cdl +45 -0
- data/samples/SimpleSample/SimpleSample/src/tSample.c +77 -0
- data/samples/SimpleSample/SimpleSample/src/tSimple.c +48 -0
- data/samples/SimpleSample/SimpleSample/src/tecs-types.h +27 -0
- data/samples/SimpleSample/SimpleSampleOpaqueRPC/Makefile +51 -0
- data/samples/SimpleSample/SimpleSampleOpaqueRPC/Makefile-trace +91 -0
- data/samples/SimpleSample/SimpleSampleOpaqueRPC/README.txt +106 -0
- data/samples/SimpleSample/SimpleSampleOpaqueRPC/SimpleSample-trace.cdl +80 -0
- data/samples/SimpleSample/SimpleSampleOpaqueRPC/SimpleSample.cdl +77 -0
- data/samples/SimpleSample/SimpleSampleOpaqueRPC/rSample/Makefile +112 -0
- data/samples/SimpleSample/SimpleSampleOpaqueRPC/rSimple/Makefile +109 -0
- data/samples/SimpleSample/SimpleSampleOpaqueRPC/src/tSample.c +80 -0
- data/samples/SimpleSample/SimpleSampleOpaqueRPC/src/tSimple.c +47 -0
- data/samples/SimpleSample/SimpleSampleOpaqueRPC/src/tTaskMain.c +66 -0
- data/samples/SimpleSample/SimpleSampleOpaqueRPC/src/tecs-types.h +27 -0
- data/samples/SimpleSample/SimpleSampleTransparentRPC/Makefile +125 -0
- data/samples/SimpleSample/SimpleSampleTransparentRPC/Makefile-trace +130 -0
- data/samples/SimpleSample/SimpleSampleTransparentRPC/SimpleSample-trace.cdl +54 -0
- data/samples/SimpleSample/SimpleSampleTransparentRPC/SimpleSample.cdl +53 -0
- data/samples/SimpleSample/SimpleSampleTransparentRPC/src/tSample.c +80 -0
- data/samples/SimpleSample/SimpleSampleTransparentRPC/src/tSimple.c +54 -0
- data/tecscde.gemspec +41 -0
- metadata +353 -0
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
#
|
|
2
|
+
# TECS Generator
|
|
3
|
+
# Generator for TOPPERS Embedded Component System
|
|
4
|
+
#
|
|
5
|
+
# Copyright (C) 2015-2018 by TOPPERS Project
|
|
6
|
+
#
|
|
7
|
+
#--
|
|
8
|
+
# 上記著作権者は,以下の(1)〜(4)の条件を満たす場合に限り,本ソフトウェ
|
|
9
|
+
# ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
|
|
10
|
+
# 変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
|
|
11
|
+
# (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
|
|
12
|
+
# 権表示,この利用条件および下記の無保証規定が,そのままの形でソー
|
|
13
|
+
# スコード中に含まれていること.
|
|
14
|
+
# (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
|
|
15
|
+
# 用できる形で再配布する場合には,再配布に伴うドキュメント(利用
|
|
16
|
+
# 者マニュアルなど)に,上記の著作権表示,この利用条件および下記
|
|
17
|
+
# の無保証規定を掲載すること.
|
|
18
|
+
# (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
|
|
19
|
+
# 用できない形で再配布する場合には,次のいずれかの条件を満たすこ
|
|
20
|
+
# と.
|
|
21
|
+
# (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
|
|
22
|
+
# 作権表示,この利用条件および下記の無保証規定を掲載すること.
|
|
23
|
+
# (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
|
|
24
|
+
# 報告すること.
|
|
25
|
+
# (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
|
|
26
|
+
# 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
|
|
27
|
+
# また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
|
|
28
|
+
# 由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
|
|
29
|
+
# 免責すること.
|
|
30
|
+
#
|
|
31
|
+
# 本ソフトウェアは,無保証で提供されているものである.上記著作権者お
|
|
32
|
+
# よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
|
|
33
|
+
# に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
|
|
34
|
+
# アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
|
|
35
|
+
# の責任を負わない.
|
|
36
|
+
#
|
|
37
|
+
# $Id: RepeatCellPlugin.rb 2952 2018-05-07 10:19:07Z okuma-top $
|
|
38
|
+
#++
|
|
39
|
+
|
|
40
|
+
#== cell を count 個繰り返すセルプラグイン
|
|
41
|
+
# 不完全点:
|
|
42
|
+
# 指定子に対応していない
|
|
43
|
+
# cell の指定子 (allocator, id)
|
|
44
|
+
# 結合の指定子 (through)
|
|
45
|
+
class RepeatCellPlugin < CellPlugin
|
|
46
|
+
@@plugin_list = []
|
|
47
|
+
RepeatCellPluginArgProc = {
|
|
48
|
+
"count" => Proc.new {|obj, rhs| obj.set_count rhs }
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
def initialize(cell, option)
|
|
52
|
+
super
|
|
53
|
+
@@plugin_list << self
|
|
54
|
+
print "RepeatCellPlugin: #{@cell.get_name}\n"
|
|
55
|
+
# cell.show_tree 0
|
|
56
|
+
# @cell.get_join_list.get_items.each{ |j|
|
|
57
|
+
# print "Join: #{j.get_name} = #{j.get_rhs.to_s}\n"
|
|
58
|
+
# }
|
|
59
|
+
@count = 0
|
|
60
|
+
@plugin_arg_check_proc_tab = RepeatCellPluginArgProc
|
|
61
|
+
parse_plugin_arg
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def gen_cdl_file(file)
|
|
65
|
+
if $verbose
|
|
66
|
+
print "#{self.class}: repeat #{@cell.get_name} #(num} times\n"
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
nest = @cell.get_region.gen_region_str_pre file
|
|
70
|
+
indent_str = " " * nest
|
|
71
|
+
@cell.get_name.to_s =~ /.*[^0-9]([0-9]+)\z/
|
|
72
|
+
if $1
|
|
73
|
+
tail_zero = $1
|
|
74
|
+
bname = @cell.get_name.to_s.gsub(/[0-9]+\z/, "")
|
|
75
|
+
else
|
|
76
|
+
cdl_error("#{self.class}: #{@cell.get_name}'s name ends without '0-9'")
|
|
77
|
+
return
|
|
78
|
+
end
|
|
79
|
+
base_count = tail_zero.to_i
|
|
80
|
+
|
|
81
|
+
count = 1
|
|
82
|
+
num = @count
|
|
83
|
+
file.print "/* #{num} times repeat of '#{@cell.get_name}' */\n"
|
|
84
|
+
while count < num
|
|
85
|
+
|
|
86
|
+
# セル名のカウント
|
|
87
|
+
count_str = (count + base_count).to_s
|
|
88
|
+
if tail_zero.length > count_str.length
|
|
89
|
+
leading_zero = "0" * (tail_zero.length - count_str.length)
|
|
90
|
+
else
|
|
91
|
+
leading_zero = ""
|
|
92
|
+
end
|
|
93
|
+
cname = bname + leading_zero + count_str
|
|
94
|
+
|
|
95
|
+
# "cell tCelltype Cell {"
|
|
96
|
+
file.print "#{indent_str}cell #{@cell.get_celltype.get_name} #{cname}{\n"
|
|
97
|
+
|
|
98
|
+
# Join の CDL 文字列生成
|
|
99
|
+
@cell.get_join_list.get_items.each{|j|
|
|
100
|
+
|
|
101
|
+
# Join の右辺の解析
|
|
102
|
+
res = j.get_rhs.analyze_cell_join_expression
|
|
103
|
+
if res
|
|
104
|
+
nsp, subscript, port_name = res[0], res[1], res[2]
|
|
105
|
+
else
|
|
106
|
+
nsp = j.get_rhs.analyze_single_identifier
|
|
107
|
+
if nsp
|
|
108
|
+
subscript, port_name = nil, nil
|
|
109
|
+
else
|
|
110
|
+
file.print "#{indent_str} #{j.get_name} = #{j.get_rhs};\n"
|
|
111
|
+
next
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
# 右辺のセル名 (末尾の数字をカウントアップ)
|
|
116
|
+
nsp.get_name.to_s =~ /(.*[^0-9])([0-9]+)\z/
|
|
117
|
+
if $2
|
|
118
|
+
rhs_tail_num = $2
|
|
119
|
+
rhs_name_count = count + rhs_tail_num.to_i
|
|
120
|
+
if rhs_tail_num.length > rhs_name_count.to_s.length
|
|
121
|
+
leading_zero = "0" * (rhs_tail_num.length - rhs_name_count.to_s.length)
|
|
122
|
+
else
|
|
123
|
+
leading_zero = ""
|
|
124
|
+
end
|
|
125
|
+
rhs_cname = $1 + leading_zero + rhs_name_count.to_s
|
|
126
|
+
nsp = nsp.change_name_clone rhs_cname
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
# Join 文字列の出力
|
|
130
|
+
if port_name
|
|
131
|
+
# 右辺は セルの結合
|
|
132
|
+
if subscript
|
|
133
|
+
file.print "#{indent_str} #{j.get_name} = #{nsp.get_path_str}.#{port_name}[#{(count + subscript)}];\n"
|
|
134
|
+
else
|
|
135
|
+
file.print "#{indent_str} #{j.get_name} = #{nsp.get_path_str}.#{port_name};\n"
|
|
136
|
+
end
|
|
137
|
+
else
|
|
138
|
+
# 右辺は単一の識別子
|
|
139
|
+
file.print "#{indent_str} #{j.get_name} = #{nsp.get_path_str};\n"
|
|
140
|
+
end
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
file.print "#{indent_str}};\n\n"
|
|
144
|
+
count += 1
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
@cell.get_region.gen_region_str_post file
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
#=== count オプションの解析
|
|
151
|
+
def set_count(rhs)
|
|
152
|
+
if rhs =~ /\A\d+\z/
|
|
153
|
+
@count = rhs.to_i
|
|
154
|
+
else
|
|
155
|
+
nsp = NamespacePath.new(rhs.to_sym, true)
|
|
156
|
+
expr = Expression.create_single_identifier(nsp, nil)
|
|
157
|
+
res = expr.eval_const(nil)
|
|
158
|
+
if res.nil?
|
|
159
|
+
cdl_error("count value ($1): not single identifier or integer number", rhs.to_s)
|
|
160
|
+
@count = 0
|
|
161
|
+
else
|
|
162
|
+
@count = res
|
|
163
|
+
end
|
|
164
|
+
end
|
|
165
|
+
end
|
|
166
|
+
end
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
#
|
|
2
|
+
# TECS Generator
|
|
3
|
+
# Generator for TOPPERS Embedded Component System
|
|
4
|
+
#
|
|
5
|
+
# Copyright (C) 2015-2018 by TOPPERS Project
|
|
6
|
+
#
|
|
7
|
+
#--
|
|
8
|
+
# 上記著作権者は,以下の(1)〜(4)の条件を満たす場合に限り,本ソフトウェ
|
|
9
|
+
# ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
|
|
10
|
+
# 変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
|
|
11
|
+
# (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
|
|
12
|
+
# 権表示,この利用条件および下記の無保証規定が,そのままの形でソー
|
|
13
|
+
# スコード中に含まれていること.
|
|
14
|
+
# (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
|
|
15
|
+
# 用できる形で再配布する場合には,再配布に伴うドキュメント(利用
|
|
16
|
+
# 者マニュアルなど)に,上記の著作権表示,この利用条件および下記
|
|
17
|
+
# の無保証規定を掲載すること.
|
|
18
|
+
# (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
|
|
19
|
+
# 用できない形で再配布する場合には,次のいずれかの条件を満たすこ
|
|
20
|
+
# と.
|
|
21
|
+
# (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
|
|
22
|
+
# 作権表示,この利用条件および下記の無保証規定を掲載すること.
|
|
23
|
+
# (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
|
|
24
|
+
# 報告すること.
|
|
25
|
+
# (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
|
|
26
|
+
# 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
|
|
27
|
+
# また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
|
|
28
|
+
# 由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
|
|
29
|
+
# 免責すること.
|
|
30
|
+
#
|
|
31
|
+
# 本ソフトウェアは,無保証で提供されているものである.上記著作権者お
|
|
32
|
+
# よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
|
|
33
|
+
# に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
|
|
34
|
+
# アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
|
|
35
|
+
# の責任を負わない.
|
|
36
|
+
#
|
|
37
|
+
# $Id: RepeatJoinPlugin.rb 2952 2018-05-07 10:19:07Z okuma-top $
|
|
38
|
+
#++
|
|
39
|
+
|
|
40
|
+
class RepeatJoinPlugin < CellPlugin
|
|
41
|
+
RepeatJoinPluginArgProc = {
|
|
42
|
+
"count" => Proc.new {|obj, rhs| obj.set_count rhs }
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
def initialize(cell, option)
|
|
46
|
+
super
|
|
47
|
+
print "RepeatJoinPlugin: #{@cell.get_name}\n"
|
|
48
|
+
# cell.show_tree 0
|
|
49
|
+
@plugin_arg_check_proc_tab = RepeatJoinPluginArgProc
|
|
50
|
+
parse_plugin_arg
|
|
51
|
+
|
|
52
|
+
@cell.get_join_list.get_items.each{|j|
|
|
53
|
+
# print "Join: #{j.get_name} = #{j.get_rhs.to_s}\n"
|
|
54
|
+
|
|
55
|
+
# Join の右辺を解析
|
|
56
|
+
ret = j.get_rhs.analyze_cell_join_expression
|
|
57
|
+
if ret.nil?
|
|
58
|
+
next
|
|
59
|
+
end
|
|
60
|
+
rhs_nsp = ret[0]
|
|
61
|
+
rhs_subscript = ret[1]
|
|
62
|
+
rhs_port_name = ret[2]
|
|
63
|
+
|
|
64
|
+
# 呼び口配列で、添数が 0 の場合にのみカウントアップさせる
|
|
65
|
+
if j.get_subscript == 0
|
|
66
|
+
rhs_name = rhs_nsp.get_name.to_s
|
|
67
|
+
if rhs_name =~ /(.*[^0-9])([0-9]+)\z/
|
|
68
|
+
b_rhs_name_count = true
|
|
69
|
+
rhs_name = $1
|
|
70
|
+
n_digits = $2.length
|
|
71
|
+
rhs_count_base = $2.to_i
|
|
72
|
+
else
|
|
73
|
+
b_rhs_name_count = false
|
|
74
|
+
rhs_count_base = 0
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
if rhs_subscript && rhs_subscript == 0
|
|
78
|
+
b_rhs_subscript_count = true
|
|
79
|
+
else
|
|
80
|
+
b_rhs_subscript_count = false
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
count = 1
|
|
84
|
+
while count < @count
|
|
85
|
+
count_str = (count + rhs_count_base).to_s
|
|
86
|
+
|
|
87
|
+
if b_rhs_subscript_count
|
|
88
|
+
rhs_subscript = count
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
if b_rhs_name_count
|
|
92
|
+
if n_digits - count_str.length > 0
|
|
93
|
+
leading_zero = "0" * (n_digits - count_str.length)
|
|
94
|
+
else
|
|
95
|
+
leading_zero = ""
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
rhs_name_real = rhs_name + leading_zero + count_str
|
|
99
|
+
else
|
|
100
|
+
rhs_name_real = rhs_name
|
|
101
|
+
end
|
|
102
|
+
rhs_nsp2 = rhs_nsp.change_name_clone rhs_name_real.to_sym
|
|
103
|
+
|
|
104
|
+
rhs = Expression.create_cell_join_expression(rhs_nsp2, rhs_subscript, rhs_port_name)
|
|
105
|
+
j2 = Join.new(j.get_name, count, rhs)
|
|
106
|
+
cell.new_join j2
|
|
107
|
+
|
|
108
|
+
count += 1
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
}
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
#=== count オプションの解析
|
|
115
|
+
def set_count(rhs)
|
|
116
|
+
if rhs =~ /\A\d+\z/
|
|
117
|
+
@count = rhs.to_i
|
|
118
|
+
else
|
|
119
|
+
nsp = NamespacePath.new(rhs.to_sym, true)
|
|
120
|
+
expr = Expression.create_single_identifier(nsp, nil)
|
|
121
|
+
res = expr.eval_const(nil)
|
|
122
|
+
if res.nil?
|
|
123
|
+
cdl_error("count value ($1): not single identifier or integer number", rhs.to_s)
|
|
124
|
+
@count = 0
|
|
125
|
+
else
|
|
126
|
+
@count = res
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
end
|
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
#
|
|
2
|
+
# TECS Generator
|
|
3
|
+
# Generator for TOPPERS Embedded Component System
|
|
4
|
+
#
|
|
5
|
+
# Copyright (C) 2008-2014 by TOPPERS Project
|
|
6
|
+
#--
|
|
7
|
+
# 上記著作権者は,以下の(1)〜(4)の条件を満たす場合に限り,本ソフトウェ
|
|
8
|
+
# ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
|
|
9
|
+
# 変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
|
|
10
|
+
# (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
|
|
11
|
+
# 権表示,この利用条件および下記の無保証規定が,そのままの形でソー
|
|
12
|
+
# スコード中に含まれていること.
|
|
13
|
+
# (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
|
|
14
|
+
# 用できる形で再配布する場合には,再配布に伴うドキュメント(利用
|
|
15
|
+
# 者マニュアルなど)に,上記の著作権表示,この利用条件および下記
|
|
16
|
+
# の無保証規定を掲載すること.
|
|
17
|
+
# (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
|
|
18
|
+
# 用できない形で再配布する場合には,次のいずれかの条件を満たすこ
|
|
19
|
+
# と.
|
|
20
|
+
# (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
|
|
21
|
+
# 作権表示,この利用条件および下記の無保証規定を掲載すること.
|
|
22
|
+
# (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
|
|
23
|
+
# 報告すること.
|
|
24
|
+
# (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
|
|
25
|
+
# 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
|
|
26
|
+
# また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
|
|
27
|
+
# 由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
|
|
28
|
+
# 免責すること.
|
|
29
|
+
#
|
|
30
|
+
# 本ソフトウェアは,無保証で提供されているものである.上記著作権者お
|
|
31
|
+
# よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
|
|
32
|
+
# に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
|
|
33
|
+
# アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
|
|
34
|
+
# の責任を負わない.
|
|
35
|
+
#
|
|
36
|
+
# $Id: SharedOpaqueRPCPlugin.rb 2952 2018-05-07 10:19:07Z okuma-top $
|
|
37
|
+
#++
|
|
38
|
+
|
|
39
|
+
require_tecsgen_lib "lib/GenOpaqueMarshaler.rb"
|
|
40
|
+
require_tecsgen_lib "lib/GenParamCopy.rb"
|
|
41
|
+
|
|
42
|
+
#= SharedOpaqueRPC プラグイン
|
|
43
|
+
# SharedOpaqueRPC チャンネルを生成する
|
|
44
|
+
# プラグイン引数は GenTransparentMarshaler 参照
|
|
45
|
+
|
|
46
|
+
# mikan through plugin: namespace が考慮されていない
|
|
47
|
+
# これを利用する場合、以下のように toppers_jsp.cdl sChannel.cdl を指定する必要がある
|
|
48
|
+
# tecsgen toppers_jsp.cdl sChannel.cdl your_description.cdl
|
|
49
|
+
|
|
50
|
+
# 以下を仮定(制限事項)
|
|
51
|
+
# 呼び元、呼び先のエンディアン、char, short, int_t, long_t, intptr_t のサイズが同じ
|
|
52
|
+
# 有符号、無符号でサイズが同じ
|
|
53
|
+
|
|
54
|
+
class SharedOpaqueRPCPlugin < ThroughPlugin
|
|
55
|
+
# チャンネルを共有するプラグインオブジェクトへのハッシュリスト
|
|
56
|
+
@@shared_channel_list = {} # { chan_name => [ Plugin_obj0, Plugin_Obj1, ... ] }
|
|
57
|
+
|
|
58
|
+
attr_reader :cell_name, :start_region, :end_region
|
|
59
|
+
include GenOpaqueMarshaler
|
|
60
|
+
include GenParamCopy
|
|
61
|
+
|
|
62
|
+
# SharedOpaqueRPCPlugin 専用のオプション
|
|
63
|
+
SharedOpaqueRPCPluginArgProc = RPCPluginArgProc.dup # 複製を作って元を変更しないようにする
|
|
64
|
+
SharedOpaqueRPCPluginArgProc["sharedChannelName"] = Proc.new {|obj, rhs| obj.set_sharedChannelName rhs }
|
|
65
|
+
|
|
66
|
+
#=== RPCPlugin の initialize
|
|
67
|
+
# 説明は ThroughPlugin (plugin.rb) を参照
|
|
68
|
+
def initialize(cell_name, plugin_arg, next_cell, next_cell_port_name, next_cell_port_subscript, signature, celltype, caller_cell)
|
|
69
|
+
super
|
|
70
|
+
initialize_opaque_marshaler
|
|
71
|
+
@entry_port_name = :eClientEntry # Marshaler の受け口名 (through セルの入り口)
|
|
72
|
+
|
|
73
|
+
# オプション:GenOpaqueMarshaler 参照
|
|
74
|
+
@plugin_arg_check_proc_tab = SharedOpaqueRPCPluginArgProc
|
|
75
|
+
@sharedChannelName = nil
|
|
76
|
+
parse_plugin_arg
|
|
77
|
+
check_opener_code
|
|
78
|
+
check_PPAllocator
|
|
79
|
+
|
|
80
|
+
@shared_channel_ct_name = :tSharedOpaqueRPCPluginChannel_tTDR
|
|
81
|
+
@shared_channel_server_ct_name = :"#{@shared_channel_ct_name}_Server"
|
|
82
|
+
@shared_channel_client_ct_name = :"#{@shared_channel_ct_name}_Client"
|
|
83
|
+
@shared_channel_ct_file_name = "#{$gen}/#{@shared_channel_ct_name}.cdl"
|
|
84
|
+
if @sharedChannelName.nil?
|
|
85
|
+
cdl_error("'sharedChannelName' option: mandatory")
|
|
86
|
+
else
|
|
87
|
+
@shared_channel_cell = @sharedChannelName
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
if @@shared_channel_list[@shared_channel_cell].nil?
|
|
91
|
+
@@shared_channel_list[@shared_channel_cell] = [self]
|
|
92
|
+
else
|
|
93
|
+
@@shared_channel_list[@shared_channel_cell] << self
|
|
94
|
+
end
|
|
95
|
+
@sub_channel_no = @@shared_channel_list[@shared_channel_cell].length - 1
|
|
96
|
+
|
|
97
|
+
prev_start = @@shared_channel_list[@shared_channel_cell][0].start_region
|
|
98
|
+
if @start_region != prev_start
|
|
99
|
+
# 初出と start リージョン不一致 (初出は、自分自身とチェックされる。無駄だが小さいので放置)
|
|
100
|
+
cdl_error("SharedRPCPlugin: start region mismatch current: #{@region.get_name} previous: #{prev_start.get_name}")
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
prev_end = @@shared_channel_list[@shared_channel_cell][0].end_region
|
|
104
|
+
if @end_region != prev_end
|
|
105
|
+
# 初出と end リージョン不一致 (初出は、自分自身とチェックされる。無駄だが小さいので放置)
|
|
106
|
+
cdl_error("SharedRPCPlugin: end region mismatch current: #{@region.get_name} previous: #{prev_end.get_name}")
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
# def set_through_info( start_region, end_region, through_type )
|
|
111
|
+
# super
|
|
112
|
+
# end
|
|
113
|
+
|
|
114
|
+
#=== プラグイン引数 sharedChannelCell のチェック
|
|
115
|
+
def set_sharedChannelName(rhs)
|
|
116
|
+
@sharedChannelName = rhs
|
|
117
|
+
# path = [ "::", rhs ]
|
|
118
|
+
# obj = Namespace.find( path )
|
|
119
|
+
# if ! obj.instance_of?( Cell ) then
|
|
120
|
+
# cdl_error( "SharedOpaqueRPCPlugin: sharedChannelName '#{rhs}' not cell" )
|
|
121
|
+
# end
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
def gen_plugin_decl_code(file)
|
|
125
|
+
# このセルタイプ(同じシグニチャ)は既に生成されているか?
|
|
126
|
+
if @@generated_celltype[@shared_channel_server_ct_name].nil?
|
|
127
|
+
@@generated_celltype[@shared_channel_server_ct_name] = [self]
|
|
128
|
+
else
|
|
129
|
+
@@generated_celltype[@shared_channel_server_ct_name] << self
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
gen_marshaler_celltype
|
|
133
|
+
|
|
134
|
+
# 同じ内容を二度書く可能性あり (AppFile は不可)
|
|
135
|
+
|
|
136
|
+
if @PPAllocatorSize
|
|
137
|
+
alloc_call_port = " call sPPAllocator cPPAllocator;\n"
|
|
138
|
+
alloc_call_port_join = " cPPAllocator => composite.cPPAllocator;\n"
|
|
139
|
+
else
|
|
140
|
+
alloc_call_port = ""
|
|
141
|
+
alloc_call_port_join = ""
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
f = CFile.open(@shared_channel_ct_file_name, "w")
|
|
145
|
+
# 同じ内容を二度書く可能性あり (AppFile は不可)
|
|
146
|
+
|
|
147
|
+
f.print <<EOT
|
|
148
|
+
|
|
149
|
+
/* Shared Channel Celltype for Client */
|
|
150
|
+
composite #{@shared_channel_client_ct_name} {
|
|
151
|
+
entry sTDR eTDR;
|
|
152
|
+
entry sSemaphore eSemaphore[];
|
|
153
|
+
call sChannel cClientChannel;
|
|
154
|
+
|
|
155
|
+
cell tTDR TDR {
|
|
156
|
+
cChannel => composite.cClientChannel;
|
|
157
|
+
};
|
|
158
|
+
cell tSemaphore Semaphore {
|
|
159
|
+
count = 1;
|
|
160
|
+
attribute = C_EXP("TA_NULL");
|
|
161
|
+
};
|
|
162
|
+
cell tRPCSharedChannelMan SharedChannelMan{
|
|
163
|
+
cSemaphore = Semaphore.eSemaphore;
|
|
164
|
+
cClientSideTDR = TDR.eTDR;
|
|
165
|
+
};
|
|
166
|
+
composite.eSemaphore => SharedChannelMan.eSemaphore;
|
|
167
|
+
composite.eTDR => TDR.eTDR;
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
/* Shared Channel Celltype for Server */
|
|
171
|
+
[active]
|
|
172
|
+
composite #{@shared_channel_server_ct_name} {
|
|
173
|
+
entry sTDR eTDR;
|
|
174
|
+
call sChannel cServerChannel;
|
|
175
|
+
call sUnmarshalerMain cUnmarshalAndCallFunction[];
|
|
176
|
+
call sServerChannelOpener cOpener;
|
|
177
|
+
attr {
|
|
178
|
+
PRI priority;
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
cell tTDR TDR {
|
|
182
|
+
cChannel => composite.cServerChannel;
|
|
183
|
+
};
|
|
184
|
+
cell tRPCSharedTaskMainWithOpener RPCSharedTaskMain {
|
|
185
|
+
cUnmarshalAndCallFunction => composite.cUnmarshalAndCallFunction;
|
|
186
|
+
cServerSideTDR = TDR.eTDR;
|
|
187
|
+
cOpener => composite.cOpener;
|
|
188
|
+
};
|
|
189
|
+
cell tTask Task {
|
|
190
|
+
cBody = RPCSharedTaskMain.eMain;
|
|
191
|
+
taskAttribute = C_EXP("TA_ACT");
|
|
192
|
+
stackSize = 4096;
|
|
193
|
+
priority = composite.priority;
|
|
194
|
+
};
|
|
195
|
+
composite.eTDR => TDR.eTDR;
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
EOT
|
|
199
|
+
f.close
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
#=== through cell コードを生成
|
|
203
|
+
#
|
|
204
|
+
#
|
|
205
|
+
def gen_through_cell_code(file)
|
|
206
|
+
gen_plugin_decl_code(file)
|
|
207
|
+
|
|
208
|
+
file.print <<EOT
|
|
209
|
+
|
|
210
|
+
import( "#{@marshaler_celltype_file_name}" );
|
|
211
|
+
import( "#{@shared_channel_ct_file_name}" );
|
|
212
|
+
EOT
|
|
213
|
+
|
|
214
|
+
# nest = @caller_cell.get_region.gen_region_str_pre file
|
|
215
|
+
nest = @start_region.gen_region_str_pre file
|
|
216
|
+
indent_str = " " * nest
|
|
217
|
+
nest_str = " " * nest
|
|
218
|
+
if @next_cell_port_subscript
|
|
219
|
+
subscript = "[" + @next_cell_port_subscript.to_s + "]"
|
|
220
|
+
else
|
|
221
|
+
subscript = ""
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
# セルを探す
|
|
225
|
+
# path =["::",@next_cell.get_name]
|
|
226
|
+
# cell = Namespace.find( path )
|
|
227
|
+
cell = Namespace.find(@next_cell.get_namespace_path)
|
|
228
|
+
|
|
229
|
+
# 共有される通信チャンネルの生成のプロトタイプ宣言
|
|
230
|
+
file.print <<EOT
|
|
231
|
+
#{indent_str}cell #{@shared_channel_client_ct_name} #{@shared_channel_cell};
|
|
232
|
+
EOT
|
|
233
|
+
|
|
234
|
+
# マーシャラセルの生成(アロケータコードの生成から)
|
|
235
|
+
# アロケータの指定があるか?
|
|
236
|
+
if cell.get_allocator_list.length > 0
|
|
237
|
+
|
|
238
|
+
file.print "#{indent_str}[allocator("
|
|
239
|
+
|
|
240
|
+
delim = ""
|
|
241
|
+
cell.get_allocator_list.each do |type, eport, subsc, func, buf, alloc|
|
|
242
|
+
|
|
243
|
+
alloc_str = alloc.to_s
|
|
244
|
+
subst = @substituteAllocator[alloc_str.to_sym]
|
|
245
|
+
|
|
246
|
+
if subst
|
|
247
|
+
alloc_str = subst[2] + "." + subst[3]
|
|
248
|
+
end
|
|
249
|
+
|
|
250
|
+
file.print delim
|
|
251
|
+
delim = ",\n#{indent_str} " # 最終行には出さない
|
|
252
|
+
|
|
253
|
+
if subsc # 配列添数
|
|
254
|
+
subsc_str = '[#{subsc}]'
|
|
255
|
+
else
|
|
256
|
+
subsc_str = ""
|
|
257
|
+
end
|
|
258
|
+
|
|
259
|
+
eport = @entry_port_name # RPCの受け口名に変更
|
|
260
|
+
file.print "#{eport}#{subsc_str}.#{func}.#{buf} = #{alloc_str}"
|
|
261
|
+
end
|
|
262
|
+
|
|
263
|
+
file.puts ")]"
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
# マーシャラセル本体生成
|
|
267
|
+
file.print <<EOT
|
|
268
|
+
/* OpaqueRPC Marshaler Cell */
|
|
269
|
+
#{indent_str}cell #{@marshaler_celltype_name} #{@cell_name} {
|
|
270
|
+
#{indent_str} cTDR = #{@shared_channel_cell}.eTDR;
|
|
271
|
+
#{indent_str} cLockChannel = #{@shared_channel_cell}.eSemaphore[#{@sub_channel_no}];
|
|
272
|
+
#{indent_str}};
|
|
273
|
+
EOT
|
|
274
|
+
# @caller_cell.get_region.gen_region_str_post file
|
|
275
|
+
@start_region.gen_region_str_post file
|
|
276
|
+
|
|
277
|
+
# アンマーシャラセルの出力
|
|
278
|
+
# セル本体の生成
|
|
279
|
+
nest = @end_region.gen_region_str_pre file
|
|
280
|
+
|
|
281
|
+
file.print <<EOT
|
|
282
|
+
/* Server Channel Cell prototype */
|
|
283
|
+
#{indent_str}cell #{@shared_channel_server_ct_name} #{@sharedChannelName}_Server;
|
|
284
|
+
|
|
285
|
+
EOT
|
|
286
|
+
|
|
287
|
+
# PPAllocator が必要か?
|
|
288
|
+
if @PPAllocatorSize
|
|
289
|
+
if @sub_channel_no == 0
|
|
290
|
+
file.print <<EOT
|
|
291
|
+
#{indent_str}cell tPPAllocator PPAllocator_#{@shared_channel_cell}{
|
|
292
|
+
#{indent_str} heapSize = #{@PPAllocatorSize};
|
|
293
|
+
#{indent_str}};
|
|
294
|
+
EOT
|
|
295
|
+
end
|
|
296
|
+
|
|
297
|
+
ppallocator_join = "#{indent_str} cPPAllocator = PPAllocator_#{@shared_channel_cell}.ePPAllocator;\n"
|
|
298
|
+
else
|
|
299
|
+
ppallocator_join = ""
|
|
300
|
+
end
|
|
301
|
+
|
|
302
|
+
file.print <<EOT
|
|
303
|
+
#{indent_str}cell #{@unmarshaler_celltype_name} #{@cell_name}_Server {
|
|
304
|
+
#{indent_str} cTDR = #{@shared_channel_cell}_Server.eTDR;
|
|
305
|
+
#{indent_str} cServerCall = #{@next_cell.get_namespace_path.get_path_str}.#{@next_cell_port_name}#{subscript};
|
|
306
|
+
#{ppallocator_join}#{indent_str}};
|
|
307
|
+
EOT
|
|
308
|
+
@end_region.gen_region_str_post file
|
|
309
|
+
end
|
|
310
|
+
|
|
311
|
+
#=== post コード(CDL) を生成
|
|
312
|
+
# プラグインの後のコードを生成
|
|
313
|
+
# file:: File:
|
|
314
|
+
def self.gen_post_code(file)
|
|
315
|
+
file.print "/* '#{self.name}' post code */\n"
|
|
316
|
+
|
|
317
|
+
@@shared_channel_list.each{|chan_name, plugin_obj_array|
|
|
318
|
+
file.print "/* '#{chan_name}' shared channel */\n"
|
|
319
|
+
plugin_obj_array[0].gen_post_code(file, plugin_obj_array)
|
|
320
|
+
}
|
|
321
|
+
end
|
|
322
|
+
|
|
323
|
+
#=== post コード(CDL) を生成
|
|
324
|
+
# 共有チャンネルを生成する
|
|
325
|
+
# このメソッドは、チャンネルを共有する最初のプラグインオブジェクトのみ呼び出される
|
|
326
|
+
def gen_post_code(file, plugin_obj_array)
|
|
327
|
+
# 共有されている通信チャンネルの生成
|
|
328
|
+
# 各プラグインインスタンスでは @shared_channel_ct_name として記憶している
|
|
329
|
+
# region = @caller_cell.get_region
|
|
330
|
+
nest = @start_region.gen_region_str_pre file
|
|
331
|
+
indent_str = " " * nest
|
|
332
|
+
file.print <<EOT
|
|
333
|
+
#{indent_str}cell #{@shared_channel_client_ct_name} #{@sharedChannelName} {
|
|
334
|
+
#{indent_str} cClientChannel = #{@clientChannelCell}.eC0;
|
|
335
|
+
#{indent_str}};
|
|
336
|
+
EOT
|
|
337
|
+
@start_region.gen_region_str_post file
|
|
338
|
+
|
|
339
|
+
nest = @end_region.gen_region_str_pre file
|
|
340
|
+
indent_str = " " * nest
|
|
341
|
+
file.print "#{indent_str}cell #{@shared_channel_server_ct_name} #{@sharedChannelName}_Server {\n"
|
|
342
|
+
file.print <<EOT
|
|
343
|
+
#{indent_str} cServerChannel = #{@serverChannelCell}.eC1;
|
|
344
|
+
#{indent_str} cOpener = #{@serverChannelCell}.eOpener;
|
|
345
|
+
EOT
|
|
346
|
+
plugin_obj_array.each{|po|
|
|
347
|
+
file.print <<EOT
|
|
348
|
+
#{indent_str} cUnmarshalAndCallFunction[] = #{po.cell_name}_Server.eService;
|
|
349
|
+
EOT
|
|
350
|
+
}
|
|
351
|
+
file.printf <<EOT
|
|
352
|
+
#{indent_str} priority = #{@taskPriority};
|
|
353
|
+
#{indent_str}};
|
|
354
|
+
EOT
|
|
355
|
+
@end_region.gen_region_str_post file
|
|
356
|
+
end
|
|
357
|
+
end
|