source: asp3_tinet_ecnl_arm/trunk/asp3_dcre/tecsgen/tecslib/core/unjoin_plugin.rb@ 374

Last change on this file since 374 was 374, checked in by coas-nagasima, 5 years ago

mbed関連を更新
シリアルドライバをmbedのHALを使うよう変更
ファイルディスクリプタの処理を更新

  • Property charset set to UTF-8
  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-ruby
File size: 7.2 KB
Line 
1# -*- coding: utf-8 -*-
2#
3# TECS Generator
4# Generator for TOPPERS Embedded Component System
5#
6# Copyright (C) 2008-2019 by TOPPERS Project
7#--
8# 上記著作権者
9は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
10# ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
11# 変・再é…
12å¸ƒï¼ˆä»¥ä¸‹ï¼Œåˆ©ç”¨ã¨å‘¼ã¶ï¼‰ã™ã‚‹ã“とを無償で許諾する.
13# (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
14# 権表示,この利用条件および下記の無保証規定が,そのままの形でソー
15# スコード中に含まれていること.
16# (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
17# 用できる形で再é…
18å¸ƒã™ã‚‹å ´åˆã«ã¯ï¼Œå†é…
19å¸ƒã«ä¼´ã†ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆï¼ˆåˆ©ç”¨
20# 者
21マニュアルなど)に,上記の著作権表示,この利用条件および下記
22# の無保証規定を掲載すること.
23# (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
24# 用できない形で再é…
25å¸ƒã™ã‚‹å ´åˆã«ã¯ï¼Œæ¬¡ã®ã„ずれかの条件を満たすこ
26# と.
27# (a) 再é…
28å¸ƒã«ä¼´ã†ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆï¼ˆåˆ©ç”¨è€…
29マニュアルなど)に,上記の著
30# 作権表示,この利用条件および下記の無保証規定を掲載すること.
31# (b) 再é…
32å¸ƒã®å½¢æ…
33‹ã‚’,別に定める方法によって,TOPPERSプロジェクトに
34# 報告すること.
35# (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
36# 害からも,上記著作権者
37およびTOPPERSプロジェクトをå…
38è²¬ã™ã‚‹ã“と.
39# また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
40# 由に基づく請求からも,上記著作権者
41およびTOPPERSプロジェクトを
42# å…
43è²¬ã™ã‚‹ã“と.
44#
45# 本ソフトウェアは,無保証で提供されているものである.上記著作権者
46お
47# よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
48# に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
49# アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
50# の責任を負わない.
51#
52# $Id$
53#++
54
55# Marshal.dump で不都合な事項
56への対策
57# Proc は _dump_data が定義されていないため、定義する.
58# plugin 関係は、tecsflow に Plugin クラスが存在しないため、消しておく.
59
60# Proc は、Marshal.dump することができないため _dump_data を定義
61class Proc
62 def _dump_data
63 nil
64 end
65end
66
67class Object
68 @@visited = {}
69 @@n_visited = 0
70 @@n_found = 0
71 @@n_plugin_proxy = 0
72
73 # do nothing now. this function is used to find remained Proxy object.
74 def find_plugin level, object_list
75
76 # find_plugin_1 level, object_list
77 # print "find_plugin: n_visted=", @@n_visited, " (len=", @@visited.length, ") found=", @@n_found, " proxy=", @@n_plugin_proxy, "\n"
78 end
79
80 def find_plugin_1 level, object_list
81 if @@visited[ self ] then
82 return
83 end
84 @@visited[ self ] = true
85 @@n_visited += 1
86
87 if kind_of? Expression then
88 # print # Expression では print が別に定義されている
89 get_elements.each{|ele|
90 ele.find_plugin_1 level+1, object_list
91 }
92 return
93 end
94
95 if level > 100 then # 100 is enough now, 50 is too small
96 print "reached max level: "
97 if respond_to? :get_name then
98 print "#{get_name}(#{self.class.name})\n"
99 else
100 print "(#{self.class.name})\n"
101 end
102 return
103 end
104
105 object_list.push self ##### ここから return 不可
106
107 if (kind_of? Plugin) || (kind_of? HRPSVCPlugin) then
108 @@n_found += 1
109 print "Plugin found: #{self.class.name}\n"
110 object_list.each{ |obj|
111 if obj.respond_to? :get_name then
112 print "#{obj.get_name}(#{obj.class.name}), "
113 else
114 print "(#{obj.class.name}), "
115 end
116 }
117 print "\n"
118 elsif kind_of? Join::ThroughPluginProxy then
119 @@n_plugin_proxy += 1
120 end
121
122 level += 1
123 if kind_of? Array then
124 each{ |val|
125 val.find_plugin_1 level, object_list
126 }
127 elsif kind_of? Hash then
128 each{ |key, val|
129 key.find_plugin_1 level, object_list
130 val.find_plugin_1 level, object_list
131 }
132 else
133 instance_variables.each{|iv|
134 iv_val = instance_variable_get iv
135 iv_val.find_plugin_1 level, object_list
136 }
137 end
138 object_list.pop ##### ここまで return 不可
139 end
140end
141
142class Namespace
143 def unjoin_plugin
144 @signature_list.each{ |sig| sig.unjoin_plugin }
145 @celltype_list.each{ |ct| ct.unjoin_plugin }
146 @cell_list.each{ |cell| cell.unjoin_plugin }
147 @namespace_list.each{ |ns| ns.unjoin_plugin}
148 end
149end
150
151class Region < Namespace
152 def unjoin_plugin
153 if @domain_type then
154 @domain_type.unjoin_plugin
155 end
156 @cell_port_throug_plugin_list.each{ |key, po|
157 proxy = Join::ThroughPluginProxy.new po.get_cell_namespace_path, po.get_through_entry_port_name, po.get_through_entry_port_subscript
158 @cell_port_throug_plugin_list[ key ] = proxy
159 }
160 super
161 end
162end
163
164class DomainType < Node
165 def unjoin_plugin
166 @plugin = nil
167 end
168end
169
170class Signature < NSBDNode
171 def unjoin_plugin
172 @generate = nil
173 end
174end
175
176class Celltype < NSBDNode
177 def unjoin_plugin
178 @generate = nil
179 @generate_list = []
180 @plugin = nil
181 end
182end
183
184class Cell < NSBDNode
185 def unjoin_plugin
186 @generate = nil
187 @plugin = nil
188 @join_list.get_items.each{ |j| j.unjoin_plugin }
189 end
190end
191
192class Join < BDNode
193 class ThroughPluginProxy
194 def initialize namespace_path, entry_port_name, entry_port_subscript
195 @namespace_path = namespace_path
196 @entry_port_name = entry_port_name
197 @entry_port_subscript = entry_port_subscript
198 end
199 def get_cell_namespace_path
200 @namespace_path
201 end
202 def get_through_entry_port_name
203 @entry_port_name
204 end
205 def get_through_entry_port_subscript
206 @entry_port_subscript
207 end
208 end
209
210 def unjoin_plugin
211 # @thourhg_generated_list is refered in get_rhs_cell, get_rhs_port
212 @through_generated_list.map!{|po| # po: plugin object
213 ThroughPluginProxy.new po.get_cell_namespace_path, po.get_through_entry_port_name, po.get_through_entry_port_subscript
214 }
215 @region_through_generated_list.map!{|po| # po: plugin object
216 ThroughPluginProxy.new po.get_cell_namespace_path, po.get_through_entry_port_name, po.get_through_entry_port_subscript
217 }
218 if @array_member2 then
219 @array_member2.each{ |j|
220 if j then
221 j.unjoin_plugin2
222 end
223 }
224 end
225 end
226 def unjoin_plugin2
227 @through_generated_list.map!{|po| # po: plugin object
228 ThroughPluginProxy.new po.get_cell_namespace_path, po.get_through_entry_port_name, po.get_through_entry_port_subscript
229 }
230 @region_through_generated_list.map!{|po| # po: plugin object
231 ThroughPluginProxy.new po.get_cell_namespace_path, po.get_through_entry_port_name, po.get_through_entry_port_subscript
232 }
233 end
234end
Note: See TracBrowser for help on using the repository browser.