[337] | 1 | # -*- coding: utf-8 -*-
|
---|
| 2 | #
|
---|
| 3 | # TECS Generator
|
---|
| 4 | # Generator for TOPPERS Embedded Component System
|
---|
| 5 | #
|
---|
[374] | 6 | # Copyright (C) 2018 by TOPPERS Project
|
---|
[337] | 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 | #
|
---|
[359] | 37 | # $Id$
|
---|
[337] | 38 | #++
|
---|
| 39 |
|
---|
| 40 | #
|
---|
| 41 | # 各メソッドの役割りは、DomainPlugin.rb を参照のこと
|
---|
| 42 | # HRP2カーネル用ドメインプラグイン
|
---|
| 43 | class HRP2Plugin < DomainPlugin
|
---|
| 44 |
|
---|
| 45 | def initialize( region, name, option )
|
---|
[374] | 46 | super
|
---|
[337] | 47 | print "HRP2Plugin: initialize: region=#{region.get_name}, domainName=#{name}, option=#{option}\n"
|
---|
[374] | 48 | @region = region
|
---|
| 49 | @name = name
|
---|
| 50 |
|
---|
| 51 | case option
|
---|
| 52 | when "trusted", "nontrusted", "OutOfDomain"
|
---|
| 53 | # OK
|
---|
| 54 | @option = option
|
---|
| 55 | else
|
---|
| 56 | cdl_error( "HRPPlugin: '$1' is unacceptable domain kind, specify 'trusted' or 'nontrusted'", option )
|
---|
| 57 | @option = "trusted" # とりあえず trusted を設定しておく
|
---|
| 58 | end
|
---|
[337] | 59 | end
|
---|
| 60 |
|
---|
| 61 | def add_through_plugin( join, current_region, next_region, through_type )
|
---|
| 62 | # join.get_owner:Cell 左辺のセル
|
---|
| 63 | # join.get_definition:Port 呼び口
|
---|
| 64 | # join.get_subscript:Integer or nil 呼び口配列の添数 (Join::@subscript の説明参照)
|
---|
| 65 | # join.get_cell:Cell 右辺のセル
|
---|
| 66 | # join.get_port_name:Symbol 受け口
|
---|
| 67 | # get_rhs_subscript:Integer or nil 受け口配列の添数 (Join::@rhs_subscript の説明参照)
|
---|
| 68 | # return []
|
---|
| 69 | print "HRP2Plugin: add_through_plugin: #{current_region.get_name}=>#{next_region.get_name}, #{join.get_owner.get_name}.#{join.get_definition.get_name}=>#{join.get_cell.get_name}.#{join.get_port_name}, #{through_type}\n"
|
---|
| 70 |
|
---|
| 71 | puts "=====Join Check Start====="
|
---|
| 72 | puts "caller: #{join.get_owner.get_name.to_s}, callee: #{join.get_cell.get_name.to_s}"
|
---|
| 73 | puts "=====Join Check param====="
|
---|
| 74 | current_domain = current_region.get_domain_root.get_domain_type
|
---|
| 75 | next_domain = next_region.get_domain_root.get_domain_type
|
---|
| 76 | puts current_domain.get_option.to_s
|
---|
| 77 | if !next_domain.nil?
|
---|
| 78 | puts next_domain.get_option.to_s
|
---|
| 79 | else
|
---|
| 80 | puts "next domain is nil!"
|
---|
| 81 | end
|
---|
| 82 |
|
---|
| 83 | if HRP2KernelObjectPlugin.include_celltype?(join.get_cell.get_celltype)
|
---|
| 84 | # 結合先がカーネルオブジェクトセル
|
---|
| 85 | # @plugin_body = HRP2SVCPlugin.new(cell_name, plugin_arg, next_cell, next_cell_port_name, signature, celltype, caller_cell)
|
---|
| 86 | # 何もしないthrough
|
---|
| 87 | puts "***** #{join.get_cell.get_celltype.get_name} is kernel object"
|
---|
| 88 | return []
|
---|
| 89 | # return [ :HRP2SVCPlugin, "channelCelltype=tMessagebufferChannel,noClientSemaphore=true" ]
|
---|
| 90 | # elsif @end_region.is_root?
|
---|
| 91 | # elsif next_region.get_option == OutOfDomain
|
---|
| 92 | # elsif next_domain.nil?
|
---|
| 93 | elsif next_domain.get_option.to_s == "OutOfDomain"
|
---|
| 94 | # # 結合先が無所属
|
---|
| 95 | # # 何もしないthrough
|
---|
| 96 | # # @plugin_body = HRP2SVCPlugin.new(cell_name, plugin_arg, next_cell, next_cell_port_name, signature, celltype, caller_cell)
|
---|
| 97 | puts "***** nil"
|
---|
| 98 | return []
|
---|
| 99 | # return [ :HRP2SVCPlugin, "channelCelltype=tMessagebufferChannel,noClientSemaphore=true" ]
|
---|
| 100 | #elsif @start_region.get_param != :KERNEL_DOMAIN && @end_region.get_param == :KERNEL_DOMAIN
|
---|
| 101 | elsif current_domain.get_option.to_s != "trusted" && next_domain.get_option.to_s == "trusted"
|
---|
| 102 | # ユーザドメインからカーネルドメインへの結合
|
---|
| 103 | # @plugin_body = HRP2SVCPlugin.new(cell_name, plugin_arg, next_cell, next_cell_port_name, signature, celltype, caller_cell)
|
---|
| 104 | puts "***** svc"
|
---|
| 105 | return [ :HRP2SVCPlugin, "" ]
|
---|
| 106 | elsif current_domain != next_domain
|
---|
| 107 | # ユーザドメインから別のユーザドメインへの結合
|
---|
| 108 | # @plugin_body = HRP2RPCPlugin.new(cell_name, plugin_arg, next_cell, next_cell_port_name, signature, celltype, caller_cell)
|
---|
| 109 | puts "***** rpc"
|
---|
| 110 | return [ :HRP2RPCPlugin, "channelCelltype=tMessagebufferChannel,noClientSemaphore=true" ]
|
---|
| 111 | else
|
---|
| 112 | # その他
|
---|
| 113 | # 何もしないthrough
|
---|
| 114 | # @plugin_body = HRP2SVCPlugin.new(cell_name, plugin_arg, next_cell, next_cell_port_name, signature, celltype, caller_cell)
|
---|
| 115 | print "warning: at HRP2 Join Check"
|
---|
| 116 | return nil
|
---|
| 117 | end
|
---|
| 118 |
|
---|
| 119 | puts "=====Join Check End====="
|
---|
| 120 | end
|
---|
| 121 |
|
---|
[374] | 122 | #== ドメイン種別を返す
|
---|
| 123 | #return::Symbol :kernel, :user, :OutOfDomain
|
---|
| 124 | def get_kind
|
---|
| 125 | case @option
|
---|
| 126 | when "trusted"
|
---|
| 127 | return :kernel
|
---|
| 128 | when "nontrusted"
|
---|
| 129 | return :user
|
---|
| 130 | when "OutOfDomain"
|
---|
| 131 | return :OutOfDomain
|
---|
| 132 | end
|
---|
| 133 | end
|
---|
| 134 |
|
---|
[337] | 135 | def joinable?(current_region, next_region, through_type )
|
---|
| 136 | print "HRP2Plugin: joinable? from #{current_region.get_name} to #{next_region.get_name} (#{through_type})\n"
|
---|
| 137 | return true
|
---|
| 138 | end
|
---|
| 139 |
|
---|
| 140 | def self.gen_post_code file
|
---|
| 141 | end
|
---|
| 142 | end
|
---|