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,280 @@
|
|
|
1
|
+
#
|
|
2
|
+
# TECS Generator
|
|
3
|
+
# Generator for TOPPERS Embedded Component System
|
|
4
|
+
#
|
|
5
|
+
# Copyright (C) 2017-2018 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: TECSInfoPlugin.rb 2952 2018-05-07 10:19:07Z okuma-top $
|
|
37
|
+
#++
|
|
38
|
+
|
|
39
|
+
#== CelltypePlugin for tTECSInfo
|
|
40
|
+
class TECSInfoPlugin < CelltypePlugin
|
|
41
|
+
@@cell_list = []
|
|
42
|
+
# @celltype::Celltype
|
|
43
|
+
# @plugin_arg_str::String
|
|
44
|
+
# @plugin_arg_list::{argNameString=>argOptionString}
|
|
45
|
+
# @cell_list::[Cell]
|
|
46
|
+
|
|
47
|
+
# celltype:: Celltype セルタイプ(インスタンス)
|
|
48
|
+
def initialize(celltype, option)
|
|
49
|
+
super
|
|
50
|
+
if $unopt_entry == false
|
|
51
|
+
cdl_info("TIF0001 forcely set --unoptimize-entry by TECSInfoPlugin (by importing TECSInfo.cdl)")
|
|
52
|
+
$unopt_entry = true
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
#=== 新しいセル
|
|
57
|
+
# cell:: Cell セル
|
|
58
|
+
#
|
|
59
|
+
# celltype プラグインを指定されたセルタイプのセルが生成された
|
|
60
|
+
# セルタイププラグインに対する新しいセルの報告
|
|
61
|
+
def new_cell(cell)
|
|
62
|
+
@@cell_list << cell
|
|
63
|
+
|
|
64
|
+
# AppFile は、重ね書きようなので、やめる
|
|
65
|
+
# p "import: cell nTECSInfo::tTECSInfoSub TECSInfoSub under #{cell.get_region.get_name}"
|
|
66
|
+
# TECSInfoSub セルのプロトタイプ宣言
|
|
67
|
+
fn = "#{$gen}/tmp_#{cell.get_region.get_global_name}_TECSInfoSub.cdl"
|
|
68
|
+
File.open(fn, "w"){|f|
|
|
69
|
+
f.print "/* prototype declaration of TECSInfoSub */\n"
|
|
70
|
+
nest = cell.get_region.gen_region_str_pre f
|
|
71
|
+
indent = " " * nest
|
|
72
|
+
f.print <<EOT
|
|
73
|
+
#{indent}[in_through()]
|
|
74
|
+
#{indent}region rTECSInfo {
|
|
75
|
+
#{indent} cell nTECSInfo::tTECSInfoSub TECSInfoSub;
|
|
76
|
+
#{indent}}; /* rTECSInfo} */
|
|
77
|
+
EOT
|
|
78
|
+
cell.get_region.gen_region_str_post f
|
|
79
|
+
}
|
|
80
|
+
Import.new fn
|
|
81
|
+
|
|
82
|
+
# セルに cTECSInfo の結合があるか?
|
|
83
|
+
if cell.get_join_list.get_item(:cTECSInfo).nil?
|
|
84
|
+
# cTECSInfo = rTECSInfo::TECSInfosub.eTECSInfo; の追加
|
|
85
|
+
nsp = NamespacePath.new(:rTECSInfo, false)
|
|
86
|
+
nsp.append! :TECSInfoSub
|
|
87
|
+
rhs = Expression.create_cell_join_expression nsp, nil, :eTECSInfo
|
|
88
|
+
join = Join.new :cTECSInfo, nil, rhs
|
|
89
|
+
cell.new_join join
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
#=== tCelltype_factory.h に挿入するコードを生成する
|
|
94
|
+
# file 以外の他のファイルにファクトリコードを生成してもよい
|
|
95
|
+
# セルタイププラグインが指定されたセルタイプのみ呼び出される
|
|
96
|
+
def gen_factory(file)
|
|
97
|
+
File.open("#{$gen}/include_all_signature_header.h", "w"){|f|
|
|
98
|
+
f.print <<EOT
|
|
99
|
+
#ifndef include_all_signature_header_h
|
|
100
|
+
#define include_all_signature_header_h
|
|
101
|
+
|
|
102
|
+
EOT
|
|
103
|
+
Namespace.get_root.travers_all_signature{|sig|
|
|
104
|
+
f.print "#include \"#{sig.get_global_name}_tecsgen.h\"\n"
|
|
105
|
+
}
|
|
106
|
+
f.print <<EOT
|
|
107
|
+
|
|
108
|
+
#endif /* include_all_signature_header_h */
|
|
109
|
+
EOT
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
undefs2 = [:INITIALIZE_CB, :FOREACH_CELL, :END_FOREACH_CELL]
|
|
113
|
+
f = AppFile.open("#{$gen}/nTECSInfo_tVarDeclInfo_factory.h")
|
|
114
|
+
Namespace.get_root.print_struct_define f
|
|
115
|
+
|
|
116
|
+
undefs = [:VALID_IDX, :GET_CELLCB, :CELLCB, :CELLIDX,
|
|
117
|
+
:tVarDeclInfo_IDX, :ATTR_name, :ATTR_sizeIsExpr,
|
|
118
|
+
:ATTR_declType, :ATTR_offset]
|
|
119
|
+
|
|
120
|
+
f.print <<EOT
|
|
121
|
+
|
|
122
|
+
/***** Offset of attr & var of celltype *****/
|
|
123
|
+
#define TOPPERS_CB_TYPE_ONLY
|
|
124
|
+
|
|
125
|
+
/* In case a celltype has 'inline' entry,
|
|
126
|
+
* some macros are temporally defined
|
|
127
|
+
* even if TOPPERS_CB_TYPE_ONLY is defined.
|
|
128
|
+
* To avoid redefinition warning, undef these macros.
|
|
129
|
+
*/
|
|
130
|
+
#{undefs.map {|u| "#undef #{u}\n"}.join}
|
|
131
|
+
EOT
|
|
132
|
+
if $ram_initializer
|
|
133
|
+
undefs2.each{|u|
|
|
134
|
+
f.print "#undef #{u}\n"
|
|
135
|
+
}
|
|
136
|
+
end
|
|
137
|
+
Namespace.get_root.print_celltype_define_offset f
|
|
138
|
+
f.print <<EOT
|
|
139
|
+
|
|
140
|
+
/* redefine macros */
|
|
141
|
+
#define tVarDeclInfo_IDX nTECSInfo_tVarDeclInfo_IDX
|
|
142
|
+
|
|
143
|
+
EOT
|
|
144
|
+
if $ram_initializer
|
|
145
|
+
f.print <<EOT
|
|
146
|
+
#define FOREACH_CELL(i,p_cb) { (void)(i);
|
|
147
|
+
#define END_FOREACH_CELL }
|
|
148
|
+
#define INITIALIZE_CB(p_that) (void)(p_that);
|
|
149
|
+
#define SET_CB_INIB_POINTER(i,p_that)
|
|
150
|
+
EOT
|
|
151
|
+
end
|
|
152
|
+
f.close
|
|
153
|
+
|
|
154
|
+
undefs = [:N_CP_cEntryInfo, :NCP_cEntryInfo, :N_CP_cCallInfo, :NCP_cCallInfo,
|
|
155
|
+
:N_CP_cAttrInfo, :NCP_cAttrInfo, :N_CP_cVarInfo, :NCP_cVarInfo,
|
|
156
|
+
:VALID_IDX, :GET_CELLCB, :CELLCB, :CELLIDX, :ATTR_name, :ATTR_b_singleton,
|
|
157
|
+
:ATTR_b_IDX_is_ID_act, :ATTR_sizeOfCB, :ATTR_sizeOfINIB, :ATTR_n_cellInLinUnit,
|
|
158
|
+
:ATTR_n_cellInSystem, :cEntryInfo_getName, :cEntryInfo_getNameLength,
|
|
159
|
+
:cEntryInfo_getSignatureInfo, :cEntryInfo_getArraySize, :cEntryInfo_isInline,
|
|
160
|
+
:cCallInfo_getName, :cCallInfo_getNameLength, :cCallInfo_getSignatureInfo,
|
|
161
|
+
:cCallInfo_getArraySize, :cCallInfo_getSpecifierInfo, :cCallInfo_getInternalInfo,
|
|
162
|
+
:cCallInfo_getLocationInfo, :cCallInfo_getOptimizeInfo, :cAttrInfo_getName,
|
|
163
|
+
:cAttrInfo_getOffset, :cAttrInfo_getTypeInfo, :cAttrInfo_getSizeIsExpr,
|
|
164
|
+
:cAttrInfo_getSizeIs, :cVarInfo_getName, :cVarInfo_getOffset, :cVarInfo_getTypeInfo,
|
|
165
|
+
:cVarInfo_getSizeIsExpr, :cVarInfo_getSizeIs, :cEntryInfo_refer_to_descriptor,
|
|
166
|
+
:cEntryInfo_ref_desc, :cCallInfo_refer_to_descriptor, :cCallInfo_ref_desc,
|
|
167
|
+
:cAttrInfo_refer_to_descriptor, :cAttrInfo_ref_desc, :cVarInfo_refer_to_descriptor,
|
|
168
|
+
:cVarInfo_ref_desc, :is_cEntryInfo_joined, :is_cCallInfo_joined,
|
|
169
|
+
:is_cAttrInfo_joined, :is_cVarInfo_joined, :eCelltypeInfo_getName,
|
|
170
|
+
:eCelltypeInfo_getNameLength, :eCelltypeInfo_getNAttr, :eCelltypeInfo_getAttrInfo,
|
|
171
|
+
:eCelltypeInfo_getNVar, :eCelltypeInfo_getVarInfo, :eCelltypeInfo_getNCall,
|
|
172
|
+
:eCelltypeInfo_getCallInfo, :eCelltypeInfo_getNEntry, :eCelltypeInfo_getEntryInfo,
|
|
173
|
+
:eCelltypeInfo_isSingleton, :eCelltypeInfo_isIDX_is_ID, :eCelltypeInfo_hasCB,
|
|
174
|
+
:eCelltypeInfo_hasINIB, :FOREACH_CELL, :END_FOREACH_CELL]
|
|
175
|
+
|
|
176
|
+
f = AppFile.open("#{$gen}/nTECSInfo_tCelltypeInfo_factory.h")
|
|
177
|
+
undefs.each{|u|
|
|
178
|
+
f.print "#undef #{u}\n"
|
|
179
|
+
}
|
|
180
|
+
f.print "#define TOPPERS_CB_TYPE_ONLY\n"
|
|
181
|
+
Namespace.get_root.print_celltype_define f
|
|
182
|
+
# FOREACH_CELL を出しなおす
|
|
183
|
+
ct = Namespace.find ["::", :nTECSInfo, :tCelltypeInfo]
|
|
184
|
+
ct.gen_ph_foreach_cell f
|
|
185
|
+
ct.gen_ph_cb_initialize_macro f
|
|
186
|
+
f.print "\n"
|
|
187
|
+
f.close
|
|
188
|
+
|
|
189
|
+
undefs = [:VALID_IDX, :GET_CELLCB, :CELLCB, :CELLIDX,
|
|
190
|
+
:tCallInfo_IDX, :ATTR_name, :ATTR_offset, :ATTR_b_inCB,
|
|
191
|
+
:ATTR_b_optional, :ATTR_b_omit, :ATTR_b_dynamic,
|
|
192
|
+
:ATTR_b_ref_desc, :ATTR_b_allocator_port,
|
|
193
|
+
:ATTR_b_require_port, :ATTR_b_VMT_useless,
|
|
194
|
+
:ATTR_b_skelton_useless, :ATTR_b_cell_unique,
|
|
195
|
+
:cSignatureInfo_getName, :cSignatureInfo_getNameLength,
|
|
196
|
+
:cSignatureInfo_getNFunction,
|
|
197
|
+
:cSignatureInfo_getFunctionInfo,
|
|
198
|
+
:cSignatureInfo_refer_to_descriptor,
|
|
199
|
+
:cSignatureInfo_ref_desc, :eCallInfo_getName,
|
|
200
|
+
:eCallInfo_getNameLength, :eCallInfo_getSignatureInfo,
|
|
201
|
+
:eCallInfo_getArraySize, :eCallInfo_isOptional,
|
|
202
|
+
:eCallInfo_isDynamic, :eCallInfo_isRefDesc,
|
|
203
|
+
:eCallInfo_isOmit]
|
|
204
|
+
|
|
205
|
+
f = AppFile.open("#{$gen}/nTECSInfo_tCallInfo_factory.h")
|
|
206
|
+
f.print <<EOT
|
|
207
|
+
|
|
208
|
+
/***** Offset of attr & var of celltype *****/
|
|
209
|
+
#define TOPPERS_CB_TYPE_ONLY
|
|
210
|
+
|
|
211
|
+
/* In case a celltype has 'inline' entry,
|
|
212
|
+
* some macros are temporally defined
|
|
213
|
+
* even if TOPPERS_CB_TYPE_ONLY is defined.
|
|
214
|
+
* To avoid redefinition warning, undef these macros.
|
|
215
|
+
*/
|
|
216
|
+
#{undefs.map{|u| "#undef #{u}\n"}.join}
|
|
217
|
+
EOT
|
|
218
|
+
if $ram_initializer
|
|
219
|
+
undefs2.each{|u|
|
|
220
|
+
f.print "#undef #{u}\n"
|
|
221
|
+
}
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
Namespace.get_root.print_call_define f
|
|
225
|
+
f.print <<EOT
|
|
226
|
+
|
|
227
|
+
/* redefine macros */
|
|
228
|
+
#define tCallInfo_IDX nTECSInfo_tCallInfo_IDX
|
|
229
|
+
|
|
230
|
+
EOT
|
|
231
|
+
if $ram_initializer
|
|
232
|
+
f.print <<EOT
|
|
233
|
+
#define FOREACH_CELL(i,p_cb) { (void)(i);
|
|
234
|
+
#define END_FOREACH_CELL }
|
|
235
|
+
#define INITIALIZE_CB(p_that) (void)(p_that);
|
|
236
|
+
#define SET_CB_INIB_POINTER(i,p_that)
|
|
237
|
+
|
|
238
|
+
EOT
|
|
239
|
+
end
|
|
240
|
+
f.close
|
|
241
|
+
|
|
242
|
+
f = AppFile.open("#{$gen}/nTECSInfo_tEntryInfo_factory.h")
|
|
243
|
+
Namespace.get_root.print_entry_define f
|
|
244
|
+
f.close
|
|
245
|
+
|
|
246
|
+
undefs = [:GET_CELLCB, :CELLCB, :CELLIDX, :ATTR_name, :INITIALIZE_CB, :FOREACH_CELL]
|
|
247
|
+
f = AppFile.open("#{$gen}/nTECSInfo_tCellInfo_factory.h")
|
|
248
|
+
undefs.each{|u|
|
|
249
|
+
f.print "#undef #{u}\n"
|
|
250
|
+
}
|
|
251
|
+
Region.get_root.print_cell_define f
|
|
252
|
+
# FOREACH_CELL を出しなおす
|
|
253
|
+
ct = Namespace.find ["::", :nTECSInfo, :tCellInfo]
|
|
254
|
+
ct.gen_ph_foreach_cell f
|
|
255
|
+
ct.gen_ph_cb_initialize_macro f
|
|
256
|
+
f.close
|
|
257
|
+
|
|
258
|
+
f = AppFile.open("#{$gen}/nTECSInfo_tRawEntryDescriptorInfo_factory.h")
|
|
259
|
+
Region.get_root.print_entry_descriptor_define f
|
|
260
|
+
f.close
|
|
261
|
+
end
|
|
262
|
+
|
|
263
|
+
#=== 後ろの CDL コードを生成
|
|
264
|
+
# プラグインの後ろの CDL コードを生成
|
|
265
|
+
# file:: File:
|
|
266
|
+
def self.gen_post_code(file)
|
|
267
|
+
if Generator.get_n_error > 0
|
|
268
|
+
Generator.info("I9999 TECSInfoPlugin does not generate TECSInfo code because of early error")
|
|
269
|
+
return
|
|
270
|
+
end
|
|
271
|
+
# 複数のプラグインの post_code が一つのファイルに含まれるため、以下のような見出しをつけること
|
|
272
|
+
file.print <<EOT
|
|
273
|
+
/*------------ #{self.name} post code ------------*/
|
|
274
|
+
EOT
|
|
275
|
+
@@cell_list.each{|cell|
|
|
276
|
+
root = cell.get_region # .get_link_root
|
|
277
|
+
TECSInfo.print_info file, root
|
|
278
|
+
}
|
|
279
|
+
end
|
|
280
|
+
end
|
|
@@ -0,0 +1,333 @@
|
|
|
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: ThroughPlugin.rb 2952 2018-05-07 10:19:07Z okuma-top $
|
|
37
|
+
#++
|
|
38
|
+
|
|
39
|
+
# mikan through plugin: namespace が考慮されていない
|
|
40
|
+
|
|
41
|
+
#== スループラグインの共通の親クラス かつ (何もせず)スルーするセルを挿入するスループラグイン
|
|
42
|
+
# スループラグインは ThroughPlugin の子クラスとして定義する
|
|
43
|
+
class ThroughPlugin < Plugin
|
|
44
|
+
# @cell_name:: Symbol 生成するセル名(複数セルを生成する場合、受け口側のセル)
|
|
45
|
+
# @plugin_arg_str:: string through で指定された引数
|
|
46
|
+
# @next_cell:: Cell 呼び口を結合するセル
|
|
47
|
+
# @next_cell_port_name:: Symbol 呼び口を結合する受口の名前
|
|
48
|
+
# @next_cell_port_subscript::Nil|Integer 呼び口を結合する受口の配列添数.受け口配列でない場合 nil
|
|
49
|
+
# @signature:: Signature シグニチャ
|
|
50
|
+
# @celltype:: Celltype 呼び先のセルのセルタイプ. through が連接する場合、最終的な呼び先のセルのセルタイプ
|
|
51
|
+
# @entry_port_name::Symbol 生成するセルの受け口名 "eThroughEntry"
|
|
52
|
+
# @call_port_name:: Symbol 生成するセルの呼び口名 "cCall"
|
|
53
|
+
# @ct_name:: Symbol 生成するセルのセルタイプ名 "t#{self.class.name}_#{@signature.get_global_name}"
|
|
54
|
+
# @plugin_arg_list:: Hash プラグイン引数をパースした結果のハッシュ変数
|
|
55
|
+
# @caller_cell:: Cell 呼び元のセル.through プラグインが連接する場合では、最も呼び元のセル.($source$)
|
|
56
|
+
# through プラグインが合流するケースでは、1つ目の呼び元セルのみ引数として与えられる
|
|
57
|
+
# 従って TracePlugin の呼び元の判別に利用する場合は、異なる呼び元から呼ばれる可能性があることに注意しなくてはならない
|
|
58
|
+
# @callee_cell:: Cell 呼び先のセル($destination$)
|
|
59
|
+
# @plugin_arg_check_proc_tab:: [string => Proc] プラグイン引数名⇒チェック関数
|
|
60
|
+
# 以下の変数は、initialize ではなく、後から設定される
|
|
61
|
+
# @start_@region:: Region 始まりのリージョン: caller_cell のリージョンとは異なる可能性がある ($start_region$)
|
|
62
|
+
# @end_region:: Region 終わりのリージョン: next_cell のリージョンとは異なる可能性がある ($end_region$)
|
|
63
|
+
# @region:: Region @start_region と @end_region のいずれかで、cell を置くのが好ましいリージョン ($preferred_region$)
|
|
64
|
+
# @through_type:: Symbol :THROUGH, :TO_THROUGH, :IN_THROUGH, :OUT_THROUGH のいずれか
|
|
65
|
+
|
|
66
|
+
# この Plugin が生成したセルタイプのリスト
|
|
67
|
+
@@generated_celltype = {}
|
|
68
|
+
|
|
69
|
+
#=== ThroughPlugin の初期化
|
|
70
|
+
# through が指定された時点で生成が行われる
|
|
71
|
+
# 初期化では、指定された引数を記録するに留める
|
|
72
|
+
# cell_name:: Symbol 生成すべきセル名(受口側)
|
|
73
|
+
# plugin_arg:: string through で指定された引数
|
|
74
|
+
# next_cell:: Cell 呼び口を接続するセル
|
|
75
|
+
# next_cell_port_name:: Symbol 呼び口を接続する受口の名前
|
|
76
|
+
# next_cell_port_subscript:: Nil|Integer 呼び口を接続する受口配列添数
|
|
77
|
+
# signature:: Signature シグニチャ
|
|
78
|
+
# celltype:: Celltype セルタイプ (呼び先のセルのセルタイプ)
|
|
79
|
+
# caller_cell:: Cell 呼び元のセル.@caller_cell の項を参照
|
|
80
|
+
def initialize(cell_name, plugin_arg, next_cell, next_cell_port_name, next_cell_port_subscript, signature, celltype, caller_cell)
|
|
81
|
+
super()
|
|
82
|
+
@cell_name = cell_name # 生成すべきセル名(受け口側のセル名)
|
|
83
|
+
# この呼び先に別セルを生成する場合、この名前を接頭辞とすべき
|
|
84
|
+
@next_cell = next_cell # 呼び先のセル
|
|
85
|
+
@next_cell_port_name = next_cell_port_name
|
|
86
|
+
@next_cell_port_subscript = next_cell_port_subscript
|
|
87
|
+
@signature = signature
|
|
88
|
+
@entry_port_name = :eThroughEntry
|
|
89
|
+
@call_port_name = :cCall
|
|
90
|
+
@ct_name = :"t#{self.class.name}_#{@signature.get_global_name}"
|
|
91
|
+
@celltype = celltype
|
|
92
|
+
@plugin_arg_str = plugin_arg
|
|
93
|
+
@plugin_arg_list = {} # プラグイン引数をパースした結果のハッシュ変数
|
|
94
|
+
@caller_cell = caller_cell
|
|
95
|
+
Join.set_through_info self # 引数で渡らない(後から追加された)ものは set_through_info で設定される
|
|
96
|
+
print("#{self.class.name}.new( '#{cell_name}', '#{plugin_arg}', '#{next_cell.get_name}', '#{next_cell_port_name}', #{celltype.get_name} )\n")
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
#=== 情報を設定する
|
|
100
|
+
# 共有チャンネルの場合 caller_cell, next_cell のいずれの region でもないケースがある
|
|
101
|
+
# 後から追加したので initialize の引数ではなく、別メソッドで設定
|
|
102
|
+
# このメソッドは、オーバーライドしないでください
|
|
103
|
+
# Join と ThrougPlugin の間の連絡用で、今後とも引数が追加される可能性があるため
|
|
104
|
+
# このメソッドは V1.C.0.34 で位置が移動され、ThroughPlugin#initialize で呼び出される
|
|
105
|
+
def set_through_info(start_region, end_region, through_type, join, callee_cell, count)
|
|
106
|
+
@start_region = start_region
|
|
107
|
+
@end_region = end_region
|
|
108
|
+
@through_type = through_type
|
|
109
|
+
@join = join
|
|
110
|
+
@callee_cell = callee_cell
|
|
111
|
+
@count = count
|
|
112
|
+
|
|
113
|
+
# preferred_region の設定
|
|
114
|
+
case through_type
|
|
115
|
+
when :IN_THROUGH, :THROUGH
|
|
116
|
+
@region = end_region
|
|
117
|
+
when :OUT_THROUGH, :TO_THROUGH
|
|
118
|
+
@region = start_region
|
|
119
|
+
else
|
|
120
|
+
raise "Unknown through_type #{through_type}"
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
#=== セルの名前を得る
|
|
125
|
+
def get_cell_name
|
|
126
|
+
@cell_name
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
#=== NamespacePath を得る
|
|
130
|
+
# 生成するセルの namespace path を生成する
|
|
131
|
+
def get_cell_namespace_path
|
|
132
|
+
# nsp = @region.get_namespace.get_namespace_path
|
|
133
|
+
nsp = @region.get_namespace_path
|
|
134
|
+
return nsp.append(@cell_name)
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
#=== 生成されたセルの受け口の名前を得る
|
|
138
|
+
def get_through_entry_port_name
|
|
139
|
+
@entry_port_name
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
#=== 生成されたセルの受け口配列添数を得る
|
|
143
|
+
def get_through_entry_port_subscript
|
|
144
|
+
@entry_port_subscript
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
#=== 宣言コードの生成
|
|
148
|
+
# typedef, signature, celltype など(cell 以外)のコードを生成
|
|
149
|
+
# 重複して生成してはならない(すでに生成されている場合は出力しないこと)
|
|
150
|
+
# file:: FILE 生成するファイル
|
|
151
|
+
def gen_plugin_decl_code(file)
|
|
152
|
+
# このセルタイプ(同じシグニチャ)は既に生成されているか?
|
|
153
|
+
if @@generated_celltype[@ct_name].nil?
|
|
154
|
+
@@generated_celltype[@ct_name] = [self]
|
|
155
|
+
else
|
|
156
|
+
@@generated_celltype[@ct_name] << self
|
|
157
|
+
return
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
file2 = CFile.open("#{$gen}/#{@ct_name}.cdl", "w")
|
|
161
|
+
|
|
162
|
+
send_receive = []
|
|
163
|
+
if !@signature.nil?
|
|
164
|
+
@signature.each_param{|fd, param|
|
|
165
|
+
dir = param.get_direction
|
|
166
|
+
case dir
|
|
167
|
+
when :SEND, :RECEIVE
|
|
168
|
+
send_receive << [dir, fd, param]
|
|
169
|
+
end
|
|
170
|
+
}
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
file2.print <<EOT
|
|
174
|
+
celltype #{@ct_name} {
|
|
175
|
+
EOT
|
|
176
|
+
|
|
177
|
+
if send_receive.length > 0
|
|
178
|
+
file2.print " [ allocator(\n"
|
|
179
|
+
delim = ""
|
|
180
|
+
send_receive.each {|a|
|
|
181
|
+
file2.print "#{delim}\t#{a[1].get_name}.#{a[2].get_name}<=#{@call_port_name}.#{a[1].get_name}.#{a[2].get_name}"
|
|
182
|
+
delim = ",\n"
|
|
183
|
+
}
|
|
184
|
+
file2.print "\n )]\n"
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
file2.print <<EOT
|
|
188
|
+
entry #{@signature.get_namespace_path} #{@entry_port_name};
|
|
189
|
+
call #{@signature.get_namespace_path} #{@call_port_name};
|
|
190
|
+
};
|
|
191
|
+
EOT
|
|
192
|
+
file2.close
|
|
193
|
+
|
|
194
|
+
file.print "import( \"#{$gen}/#{@ct_name}.cdl\" );\n"
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
#=== CDL ファイルの生成
|
|
198
|
+
# file:: FILE 生成するファイル
|
|
199
|
+
def gen_cdl_file(file)
|
|
200
|
+
gen_plugin_decl_code(file)
|
|
201
|
+
gen_through_cell_code(file)
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
#=== セルコードの生成
|
|
205
|
+
# through 指定により生じるセルコード(CDL)を生成する
|
|
206
|
+
# file:: FILE 生成するファイル
|
|
207
|
+
def gen_through_cell_code(file)
|
|
208
|
+
nest = @region.gen_region_str_pre file
|
|
209
|
+
nest_str = " " * nest
|
|
210
|
+
|
|
211
|
+
file.print <<EOT
|
|
212
|
+
#{nest_str}cell #{@ct_name} #{@cell_name} {
|
|
213
|
+
#{nest_str} #{@call_port_name} = #{@next_cell.get_namespace_path.get_path_str}.#{@next_cell_port_name};
|
|
214
|
+
#{nest_str}};
|
|
215
|
+
EOT
|
|
216
|
+
@region.gen_region_str_post file
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
#=== 後ろのコードを生成
|
|
220
|
+
# プラグインの後ろのコード (CDL) を生成
|
|
221
|
+
# file:: File:
|
|
222
|
+
def self.gen_post_code(file)
|
|
223
|
+
# 複数のプラグインの post_code が一つのファイルに含まれるため、以下のような見出しをつけること
|
|
224
|
+
# file.print "/* '#{self.class.name}' post code */\n"
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
#=== 受け口関数の本体(C言語)を生成する
|
|
228
|
+
# 通常であれば、ジェネレータは受け口関数のテンプレートを生成する
|
|
229
|
+
# プラグインの場合、変更する必要のないセルタイプコードを生成する
|
|
230
|
+
# file:: FILE 出力先ファイル
|
|
231
|
+
# b_singleton:: bool true if singleton
|
|
232
|
+
# ct_name:: Symbol
|
|
233
|
+
# global_ct_name:: string
|
|
234
|
+
# sig_name:: string
|
|
235
|
+
# ep_name:: string
|
|
236
|
+
# func_name:: string
|
|
237
|
+
# func_global_name:: string
|
|
238
|
+
# func_type:: class derived from Type
|
|
239
|
+
def gen_ep_func_body(file, b_singleton, ct_name, global_ct_name, sig_name, ep_name, func_name, func_global_name, func_type, params)
|
|
240
|
+
ret_type = func_type.get_type
|
|
241
|
+
b_ret_void = ret_type.is_void?
|
|
242
|
+
|
|
243
|
+
if !b_ret_void
|
|
244
|
+
file.print(" #{ret_type.get_type_str} retval;\n")
|
|
245
|
+
end
|
|
246
|
+
|
|
247
|
+
if !b_singleton
|
|
248
|
+
|
|
249
|
+
file.print <<EOT
|
|
250
|
+
#{ct_name}_CB *p_cellcb;
|
|
251
|
+
if( VALID_IDX( idx ) ){
|
|
252
|
+
p_cellcb = #{global_ct_name}_GET_CELLCB(idx);
|
|
253
|
+
}else{
|
|
254
|
+
/* エラー処理コードをここに記述 */
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
EOT
|
|
258
|
+
end
|
|
259
|
+
|
|
260
|
+
# p "celltype_name, sig_name, func_name, func_global_name"
|
|
261
|
+
# p "#{ct_name}, #{sig_name}, #{func_name}, #{func_global_name}"
|
|
262
|
+
|
|
263
|
+
delim = ""
|
|
264
|
+
if !b_ret_void
|
|
265
|
+
file.print(" retval = ")
|
|
266
|
+
end
|
|
267
|
+
|
|
268
|
+
file.print("#{@call_port_name}_#{func_name}(")
|
|
269
|
+
|
|
270
|
+
# if ( ! b_singleton ) then
|
|
271
|
+
# file.print( " tecs_this" )
|
|
272
|
+
# delim = ","
|
|
273
|
+
# end
|
|
274
|
+
|
|
275
|
+
params.each{|param|
|
|
276
|
+
file.printf("#{delim} #{param.get_name}")
|
|
277
|
+
delim = ","
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
file.print(" );\n")
|
|
281
|
+
|
|
282
|
+
if !b_ret_void
|
|
283
|
+
file.print(" return retval;\n")
|
|
284
|
+
end
|
|
285
|
+
end
|
|
286
|
+
|
|
287
|
+
#=== Through プラグインの引数の名前を置換する
|
|
288
|
+
def check_plugin_arg(ident, rhs)
|
|
289
|
+
rhs = subst_name rhs
|
|
290
|
+
super(ident, rhs)
|
|
291
|
+
end
|
|
292
|
+
|
|
293
|
+
#=== ThroughPlugin#名前の置換
|
|
294
|
+
# プラグインオプション引数内の文字列を置換する
|
|
295
|
+
# $source$ … 呼び元のセル名
|
|
296
|
+
# $destination$ … 呼び先のセル名
|
|
297
|
+
# $SOURCE$ … 呼び元のセル名 (リージョン名を '_' で連結した global_name)
|
|
298
|
+
# $DESTINATION$ … 呼び先のセル名 (リージョン名を '_' で連結した global_name)
|
|
299
|
+
# $next$ … 次のセル名
|
|
300
|
+
# 複数の through がつながっている場合、すぐ後ろに来るもの
|
|
301
|
+
# $NEXT$ … 次のセル名 (リージョン名を '_' で連結した global_name)
|
|
302
|
+
# 複数の through がつながっている場合、すぐ後ろに来るもの
|
|
303
|
+
# $start_region$ … $source$ のセルの存在する region (global_name)
|
|
304
|
+
# $end_region$ … $destination$ のセルの存在する region (global_name)
|
|
305
|
+
# $preferred_region$ … 適切な region (global_name), start_region または end_region
|
|
306
|
+
# $count$ … region 間の through の適用数
|
|
307
|
+
# $$ … $ に置換
|
|
308
|
+
def subst_name(str)
|
|
309
|
+
# セル名の置換
|
|
310
|
+
str = str.gsub(/(^|[^\$])\$source\$/, "\\1#{@caller_cell.get_name}")
|
|
311
|
+
str = str.gsub(/(^|[^\$])\$destination\$/, "\\1#{@callee_cell.get_name}")
|
|
312
|
+
str = str.gsub(/(^|[^\$])\$SOURCE\$/, "\\1#{@caller_cell.get_global_name}")
|
|
313
|
+
str = str.gsub(/(^|[^\$])\$DESTINATION\$/, "\\1#{@callee_cell.get_global_name}")
|
|
314
|
+
str = str.gsub(/(^|[^\$])\$next\$/, "\\1#{@next_cell.get_name}")
|
|
315
|
+
str = str.gsub(/(^|[^\$])\$NEXT\$/, "\\1#{@next_cell.get_global_name}")
|
|
316
|
+
# region 名の置換
|
|
317
|
+
str = str.gsub(/(^|[^\$])\$start_region\$/, "\\1#{@start_region.get_global_name}")
|
|
318
|
+
str = str.gsub(/(^|[^\$])\$end_region\$/, "\\1#{@end_region.get_global_name}")
|
|
319
|
+
str = str.gsub(/(^|[^\$])\$preferred_region\$/, "\\1#{@region.get_global_name}")
|
|
320
|
+
str = str.gsub(/(^|[^\$])\$count\$/, "\\1#{@count}")
|
|
321
|
+
|
|
322
|
+
str = str.gsub(/\$\$/, "\$") # $$ を $ に置換
|
|
323
|
+
|
|
324
|
+
return str
|
|
325
|
+
end
|
|
326
|
+
|
|
327
|
+
def show_tree(indent)
|
|
328
|
+
indent.times { print " " }
|
|
329
|
+
puts "Plugin: celltype: #{@ct_name} cell: #{@cell_name}"
|
|
330
|
+
(indent + 1).times { print " " }
|
|
331
|
+
puts "next: signature: #{@signature.get_namespace_path} call = #{@next_cell.get_name}.#{@next_cell_port_name}"
|
|
332
|
+
end
|
|
333
|
+
end
|