[388] | 1 | # coding: utf-8
|
---|
| 2 | #
|
---|
| 3 | # TECS Generator
|
---|
| 4 | # Generator for TOPPERS Embedded Component System
|
---|
| 5 | #
|
---|
| 6 | # Copyright (C) 2008-2018 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 | require_tecsgen_lib "lib/GenOpaqueMarshaler.rb"
|
---|
| 56 | require_tecsgen_lib "lib/GenParamCopy.rb"
|
---|
| 57 |
|
---|
| 58 | #= HRPRPCPlugin ãã©ã°ã¤ã³
|
---|
| 59 | # ã¹ã«ã¼ãã©ã°ã¤ã³ (through)
|
---|
| 60 | # ã»OpaqueMarshalerPlugin ã使ç¨ãã¦ãã¼ã·ã£ã©ã»ã«ã¿ã¤ããçæãã
|
---|
| 61 | # ã»ãã¼ã·ã£ã©ãTDRããã£ã³ãã«ãã¡ãã»ã¼ã¸ãããã¡ãçæãã
|
---|
| 62 | #
|
---|
| 63 | class HRPRPCPlugin < ThroughPlugin
|
---|
| 64 |
|
---|
| 65 | include GenOpaqueMarshaler
|
---|
| 66 | include GenParamCopy
|
---|
| 67 |
|
---|
| 68 | # RPCPlugin å°ç¨ã®ãªãã·ã§ã³
|
---|
| 69 | HRPRPCPluginArgProc = RPCPluginArgProc.dup # è¤è£½ãä½ã£ã¦å
|
---|
| 70 | ãå¤æ´ããªãããã«ãã
|
---|
| 71 | HRPRPCPluginArgProc[ "noClientSemaphore" ] = Proc.new { |obj,rhs| obj.set_noClientSemaphore rhs }
|
---|
| 72 | HRPRPCPluginArgProc[ "semaphoreCelltype" ] = Proc.new { |obj,rhs| obj.set_semaphoreCelltype rhs }
|
---|
| 73 | @@isFirstInstance = true
|
---|
| 74 |
|
---|
| 75 | #=== RPCPlugin ã® initialize
|
---|
| 76 | # 説æ㯠ThroughPlugin (plugin.rb) ãåç
|
---|
| 77 | §
|
---|
| 78 | def initialize( cell_name, plugin_arg, next_cell, next_cell_port_name, next_cell_port_subscript, signature, celltype, caller_cell )
|
---|
| 79 | super
|
---|
| 80 | @b_noClientSemaphore = false
|
---|
| 81 | @semaphoreCelltype = "tSemaphore"
|
---|
| 82 | initialize_opaque_marshaler
|
---|
| 83 |
|
---|
| 84 | # ãªãã·ã§ã³ï¼GenOpaqueMarshaler åç
|
---|
| 85 | §
|
---|
| 86 | @plugin_arg_check_proc_tab = HRPRPCPluginArgProc
|
---|
| 87 | parse_plugin_arg
|
---|
| 88 |
|
---|
| 89 | @rpc_channel_celltype_name = "tRPCPlugin_#{@TDRCelltype}_#{@channelCelltype}_#{@signature.get_name}"
|
---|
| 90 | @rpc_channel_celltype_file_name = "#{$gen}/#{@rpc_channel_celltype_name}.cdl"
|
---|
| 91 |
|
---|
| 92 | if @signature.get_context == "non-task" then
|
---|
| 93 | cdl_error( "HRP9999 RPC cannot be applied to non-task context signature '$1'", @signature.get_name )
|
---|
| 94 | elsif @signature.get_context == "any" then
|
---|
| 95 | cdl_info( "HRP9999 RPC is applied to any context signature '$1'", @signature.get_name )
|
---|
| 96 | end
|
---|
| 97 |
|
---|
| 98 | if @signature.need_PPAllocator?(true) then
|
---|
| 99 | if @PPAllocatorSize == nil then
|
---|
| 100 | cdl_error( "HRP9999 PPAllocatorSize must be speicified for pointer argments" )
|
---|
| 101 | # @PPAllocatorSize = 0 # 仮㫠0 ã¨ãã¦ãã (cdl ã®æ§æã¨ã©ã¼ãé¿ãããã)
|
---|
| 102 | end
|
---|
| 103 | elsif @PPAllocatorSize then
|
---|
| 104 | cdl_warning( "HRP9999 PPAllocatorSize speicified in spite of PPAllocator unnecessary" )
|
---|
| 105 | @PPAllocatorSize = nil
|
---|
| 106 | end
|
---|
| 107 |
|
---|
| 108 | # @signature.each_param{ |func_decl, param_decl|
|
---|
| 109 | # if func_decl.get_type.is_oneway? then
|
---|
| 110 | # if ( param_decl.get_size || param_decl.get_count ) && param_decl.get_string then
|
---|
| 111 | # cdl_error( "array of string not supported for oneway function in Transparent RPC" ) # mikan æååã®é
|
---|
| 112 | å
|
---|
| 113 | # elsif param_decl.get_string == -1 then
|
---|
| 114 | # cdl_error( "length unspecified string is not permited for oneway function in Transparent RPC" ) # mikan é·ãæªæå®æåå
|
---|
| 115 | # end
|
---|
| 116 | # end
|
---|
| 117 | # }
|
---|
| 118 |
|
---|
| 119 | #
|
---|
| 120 | # tecsgen/tecs/rpcã«includeãã¹ãéã
|
---|
| 121 | # #include "tecs_rpc.h" ãå®ç¾ããããã«å¿
|
---|
| 122 | è¦
|
---|
| 123 | # 大山:åé¤ Makefile.tecsgen ã« vpath, INCLUDES ãå
|
---|
| 124 | ¥ããã®ã¯ããããªãèã
|
---|
| 125 | # TECSGEN.add_search_path 㧠Makefile_templ ã«å
|
---|
| 126 | ¥ããã®ããã
|
---|
| 127 | # if @@isFirstInstance
|
---|
| 128 | # f = AppFile.open( "#{$gen}/Makefile.tecsgen" )
|
---|
| 129 | # f.puts "INCLUDES := $(INCLUDES) -I $(TECSPATH) -I $(TECSPATH)/rpc"
|
---|
| 130 | # f.puts "vpath %.c $(TECSPATH) $(TECSPATH)/rpc"
|
---|
| 131 | # f.close()
|
---|
| 132 | # @@isFirstInstance = false
|
---|
| 133 | # end
|
---|
| 134 | end
|
---|
| 135 |
|
---|
| 136 | #=== plugin ã®å®£è¨ã³ã¼ã (celltype ã®å®ç¾©) çæ
|
---|
| 137 | def gen_plugin_decl_code( file )
|
---|
| 138 |
|
---|
| 139 | ct_name = "#{@ct_name}_#{@channelCelltype}"
|
---|
| 140 |
|
---|
| 141 | # ãã®ã»ã«ã¿ã¤ãï¼åãã·ã°ããã£ï¼ã¯æ¢ã«çæããã¦ãããï¼
|
---|
| 142 | if @@generated_celltype[ ct_name ] == nil then
|
---|
| 143 | @@generated_celltype[ ct_name ] = [ self ]
|
---|
| 144 | else
|
---|
| 145 | @@generated_celltype[ ct_name ] << self
|
---|
| 146 | return
|
---|
| 147 | end
|
---|
| 148 |
|
---|
| 149 | f = CFile.open( @rpc_channel_celltype_file_name, "w" )
|
---|
| 150 | # åãå
|
---|
| 151 | 容ãäºåº¦æ¸ãå¯è½æ§ãã (AppFile ã¯ä¸å¯)
|
---|
| 152 |
|
---|
| 153 | f.print <<EOT
|
---|
| 154 | import( <rpc.cdl> );
|
---|
| 155 | import( <tMessageBufferCEP.cdl> );
|
---|
| 156 | generate( OpaqueMarshalerPlugin, #{@signature.get_namespace_path}, "" );
|
---|
| 157 |
|
---|
| 158 | composite tOpaqueMarshaler_#{@signature.get_global_name}_through {
|
---|
| 159 | entry #{@signature.get_namespace_path} eThroughEntry;
|
---|
| 160 | call sTDR cTDR;
|
---|
| 161 | [optional]
|
---|
| 162 | call sSemaphore cLockChannel;
|
---|
| 163 | [optional]
|
---|
| 164 | call sRPCErrorHandler cErrorHandler;
|
---|
| 165 |
|
---|
| 166 | cell tOpaqueMarshaler_#{@signature.get_global_name} Marshaler{
|
---|
| 167 | cTDR => composite.cTDR;
|
---|
| 168 | cLockChannel => composite.cLockChannel;
|
---|
| 169 | cErrorHandler => composite.cErrorHandler;
|
---|
| 170 | };
|
---|
| 171 | composite.eThroughEntry => Marshaler.eClientEntry;
|
---|
| 172 | };
|
---|
| 173 |
|
---|
| 174 | EOT
|
---|
| 175 |
|
---|
| 176 | f.close
|
---|
| 177 | end
|
---|
| 178 |
|
---|
| 179 | #=== through cell ã³ã¼ããçæ
|
---|
| 180 | #
|
---|
| 181 | #
|
---|
| 182 | def gen_through_cell_code( file )
|
---|
| 183 |
|
---|
| 184 | gen_plugin_decl_code( file )
|
---|
| 185 | file.print <<EOT
|
---|
| 186 | import( <#{@rpc_channel_celltype_file_name}> );
|
---|
| 187 | EOT
|
---|
| 188 |
|
---|
| 189 | case @start_region.get_domain_root.get_domain_type.get_kind
|
---|
| 190 | when :kernel
|
---|
| 191 | tacp_str = "\"TACP_KERNEL"
|
---|
| 192 | when :user
|
---|
| 193 | tacp_str = "\"TACP(#{@start_region.get_domain_root.get_name})"
|
---|
| 194 | when :OutOfDomain
|
---|
| 195 | tacp_str = "\"TACP_SHARED"
|
---|
| 196 | end
|
---|
| 197 | # p "end_region=#{@end_region.get_name} kind=#{@end_region.get_domain_root.get_domain_type.get_kind}"
|
---|
| 198 | case @end_region.get_domain_root.get_domain_type.get_kind
|
---|
| 199 | when :kernel
|
---|
| 200 | tacp_str += "|TACP_KERNEL\""
|
---|
| 201 | when :user
|
---|
| 202 | tacp_str += "|TACP(#{@end_region.get_domain_root.get_name})\""
|
---|
| 203 | when :OutOfDomain
|
---|
| 204 | tacp_str += "|TACP_SHARED\""
|
---|
| 205 | end
|
---|
| 206 | nest_str = ""
|
---|
| 207 | file.print <<EOT
|
---|
| 208 | #{nest_str} // MessageBuffer client=>server
|
---|
| 209 | #{nest_str} cell tMessageBuffer #{@clientChannelCell}Body0{
|
---|
| 210 | #{nest_str} maxMessageSize = 64; /* This value must be same as MessageBufferCEP's buffer size */
|
---|
| 211 | #{nest_str} bufferSize = 128;
|
---|
| 212 | #{nest_str} accessPattern1 = C_EXP( #{tacp_str} );
|
---|
| 213 | #{nest_str} accessPattern2 = C_EXP( #{tacp_str} );
|
---|
| 214 | #{nest_str} accessPattern3 = C_EXP( #{tacp_str} );
|
---|
| 215 | #{nest_str} accessPattern4 = C_EXP( #{tacp_str} );
|
---|
| 216 | #{nest_str} };
|
---|
| 217 | EOT
|
---|
| 218 | file.print <<EOT
|
---|
| 219 |
|
---|
| 220 | #{nest_str} // MessageBuffer server=>client
|
---|
| 221 | #{nest_str} cell tMessageBuffer #{@clientChannelCell}Body1{
|
---|
| 222 | #{nest_str} maxMessageSize = 64; /* This value must be same as MessageBufferCEP's buffer size */
|
---|
| 223 | #{nest_str} bufferSize = 128;
|
---|
| 224 | #{nest_str} accessPattern1 = C_EXP( #{tacp_str} );
|
---|
| 225 | #{nest_str} accessPattern2 = C_EXP( #{tacp_str} );
|
---|
| 226 | #{nest_str} accessPattern3 = C_EXP( #{tacp_str} );
|
---|
| 227 | #{nest_str} accessPattern4 = C_EXP( #{tacp_str} );
|
---|
| 228 | #{nest_str} };
|
---|
| 229 | EOT
|
---|
| 230 |
|
---|
| 231 | ##### ã¯ã©ã¤ã¢ã³ãå´ã®ã»ã«ã®çæ #####
|
---|
| 232 | nest = @start_region.gen_region_str_pre file
|
---|
| 233 | nest_str = " " * nest
|
---|
| 234 |
|
---|
| 235 | # ã»ããã©ã®çæ
|
---|
| 236 | if @b_noClientSemaphore == false then
|
---|
| 237 | file.print <<EOT
|
---|
| 238 | #{nest_str} // Semaphore for Multi-task use ("specify noClientSemaphore" option to delete this)
|
---|
| 239 | #{nest_str} cell #{@semaphoreCelltype} #{@serverChannelCell}_Semaphore{
|
---|
| 240 | #{nest_str} initialCount = 1;
|
---|
| 241 | #{nest_str} };
|
---|
| 242 | EOT
|
---|
| 243 | end
|
---|
| 244 |
|
---|
| 245 | # ã¯ã©ã¤ã¢ã³ãå´ãã£ã³ãã« (tMessageBufferCEP)ã®çæ
|
---|
| 246 | # ãã£ã³ãã«ã¯å¿
|
---|
| 247 | ããªã¼ã¸ã§ã³ä¸ã«ããã®ã§ã '::' ã§ã¤ãªã (ã§ãªããã°ãã«ã¼ããªã¼ã¸ã§ã³ã«ãªãããã§ãã¯ãå¿
|
---|
| 248 | è¦ï¼
|
---|
| 249 |
|
---|
| 250 | file.print <<EOT
|
---|
| 251 | #{nest_str} // Client Side Channel
|
---|
| 252 | #{nest_str} cell tMessageBufferCEP #{@clientChannelCell}_CEP{
|
---|
| 253 | #{nest_str} cMessageBuffer0 = #{@clientChannelCell}Body0.eMessageBuffer;
|
---|
| 254 | #{nest_str} cMessageBuffer1 = #{@clientChannelCell}Body1.eMessageBuffer;
|
---|
| 255 | #{nest_str} };
|
---|
| 256 |
|
---|
| 257 | #{nest_str} // Client Side TDR
|
---|
| 258 | #{nest_str} cell tTDR #{@clientChannelCell}_TDR{
|
---|
| 259 | #{nest_str} cChannel = #{@clientChannelCell}_CEP.eChannel;
|
---|
| 260 | #{nest_str} };
|
---|
| 261 |
|
---|
| 262 | #{nest_str} // Marshaler
|
---|
| 263 | EOT
|
---|
| 264 |
|
---|
| 265 | # ã»ããã©ã®çµåæ
|
---|
| 266 | if @b_noClientSemaphore == false then
|
---|
| 267 | semaphore = "#{nest_str} cLockChannel = #{@serverChannelCell}_Semaphore.eSemaphore;\n"
|
---|
| 268 | else
|
---|
| 269 | semaphore = ""
|
---|
| 270 | end
|
---|
| 271 |
|
---|
| 272 | ### ã¯ã©ã¤ã¢ã³ãå´ãã£ã³ãã« (ãã¼ã·ã£ã©+TDR)ã®çæ ###
|
---|
| 273 | cell = @next_cell
|
---|
| 274 | # ã¢ãã±ã¼ã¿ã®æå®ããããï¼
|
---|
| 275 | if cell.get_allocator_list.length > 0 then
|
---|
| 276 |
|
---|
| 277 | file.print nest_str
|
---|
| 278 | file.print "[allocator("
|
---|
| 279 |
|
---|
| 280 | delim = ""
|
---|
| 281 | cell.get_allocator_list.each do |type, eport, subsc, func, buf, alloc|
|
---|
| 282 |
|
---|
| 283 | alloc_str = alloc.to_s
|
---|
| 284 | subst = @substituteAllocator[alloc_str.to_sym]
|
---|
| 285 | if subst then
|
---|
| 286 | alloc_str = subst[2]+"."+subst[3]
|
---|
| 287 | end
|
---|
| 288 |
|
---|
| 289 | file.print delim
|
---|
| 290 | delim = ",\n" # æçµè¡ã«ã¯åºããªã
|
---|
| 291 |
|
---|
| 292 | if subsc then # é
|
---|
| 293 | åæ·»æ°
|
---|
| 294 | subsc_str = '[#{subsc}]'
|
---|
| 295 | else
|
---|
| 296 | subsc_str = ""
|
---|
| 297 | end
|
---|
| 298 |
|
---|
| 299 | eport = "eThroughEntry" #RPCã®åãå£åã«å¤æ´
|
---|
| 300 | file.print nest_str
|
---|
| 301 | file.print "#{eport}#{subsc_str}.#{func}.#{buf} = #{alloc_str}"
|
---|
| 302 | end
|
---|
| 303 |
|
---|
| 304 | file.puts ")]"
|
---|
| 305 | end
|
---|
| 306 |
|
---|
| 307 | if @clientErrorHandler then
|
---|
| 308 | clientErrorHandler_str = "#{nest_str} cErrorHandler = #{@clientErrorHandler};\n"
|
---|
| 309 | else
|
---|
| 310 | clientErrorHandler_str = ""
|
---|
| 311 | end
|
---|
| 312 |
|
---|
| 313 | file.print <<EOT
|
---|
| 314 | #{nest_str} cell tOpaqueMarshaler_#{@signature.get_global_name}_through #{@cell_name} {
|
---|
| 315 | #{nest_str} cTDR = #{@clientChannelCell}_TDR.eTDR;
|
---|
| 316 | #{clientErrorHandler_str}#{semaphore}#{nest_str} };
|
---|
| 317 | EOT
|
---|
| 318 | ### END: ã¯ã©ã¤ã¢ã³ãå´ãã£ã³ãã« (ãã¼ã·ã£ã©+TDR)ã®çæ ###
|
---|
| 319 | @start_region.gen_region_str_post file
|
---|
| 320 | file.print "\n\n"
|
---|
| 321 |
|
---|
| 322 | ##### ãµã¼ãã¼å´ã®ã»ã«ã®çæ #####
|
---|
| 323 | nest = @end_region.gen_region_str_pre file
|
---|
| 324 | nest_str = " " * nest
|
---|
| 325 |
|
---|
| 326 | if @serverErrorHandler then
|
---|
| 327 | serverErrorHandler_str = "#{nest_str} cErrorHandler = #{@serverErrorHandler};\n"
|
---|
| 328 | else
|
---|
| 329 | serverErrorHandler_str = ""
|
---|
| 330 | end
|
---|
| 331 |
|
---|
| 332 | if @b_genOpener then
|
---|
| 333 | opener = "#{nest_str} cOpener = #{@serverChannelCell}.eOpener;\n"
|
---|
| 334 | else
|
---|
| 335 | opener = ""
|
---|
| 336 | end
|
---|
| 337 |
|
---|
| 338 | # ãµã¼ãã¼å´ãã£ã³ãã« (tMessageBufferCEP)
|
---|
| 339 | if @PPAllocatorSize then
|
---|
| 340 | alloc_cell =<<EOT
|
---|
| 341 |
|
---|
| 342 | #{nest_str} cell tPPAllocator #{@serverChannelCell}_PPAllocator {
|
---|
| 343 | #{nest_str} heapSize = #{@PPAllocatorSize};
|
---|
| 344 | #{nest_str} };
|
---|
| 345 | EOT
|
---|
| 346 | alloc_call_port_join = "#{nest_str} cPPAllocator = #{@serverChannelCell}_PPAllocator.ePPAllocator;\n"
|
---|
| 347 | else
|
---|
| 348 | alloc_cell = ""
|
---|
| 349 | alloc_call_port_join = ""
|
---|
| 350 | end
|
---|
| 351 |
|
---|
| 352 | file.print <<EOT
|
---|
| 353 | #{nest_str} // Server Side Channel
|
---|
| 354 | #{nest_str} cell tMessageBufferCEP #{@serverChannelCell}_CEP{
|
---|
| 355 | #{nest_str} cMessageBuffer0 = #{@clientChannelCell}Body1.eMessageBuffer;
|
---|
| 356 | #{nest_str} cMessageBuffer1 = #{@clientChannelCell}Body0.eMessageBuffer;
|
---|
| 357 | #{nest_str} };
|
---|
| 358 | EOT
|
---|
| 359 |
|
---|
| 360 | # ãµã¼ãã¼å´TDR
|
---|
| 361 | file.print <<EOT
|
---|
| 362 |
|
---|
| 363 | #{nest_str} // Server Side TDR
|
---|
| 364 | #{nest_str} cell tTDR #{@serverChannelCell}_TDR{
|
---|
| 365 | #{nest_str} cChannel = #{@serverChannelCell}_CEP.eChannel;
|
---|
| 366 | #{nest_str} };
|
---|
| 367 | EOT
|
---|
| 368 |
|
---|
| 369 | if @next_cell_port_subscript then
|
---|
| 370 | subscript = '[' + @next_cell_port_subscript.to_s + ']'
|
---|
| 371 | else
|
---|
| 372 | subscript = ""
|
---|
| 373 | end
|
---|
| 374 |
|
---|
| 375 | # ãµã¼ãã¼å´ãã£ã³ãã« (ã¢ã³ãã¼ã·ã£ã©)
|
---|
| 376 | file.print <<EOT
|
---|
| 377 | #{alloc_cell}
|
---|
| 378 | #{nest_str} // Unmarshaler
|
---|
| 379 | #{nest_str} cell tOpaqueUnmarshaler_#{@signature.get_global_name} #{@serverChannelCell}_Unmarshaler {
|
---|
| 380 | #{nest_str} cTDR = #{@serverChannelCell}_TDR.eTDR;
|
---|
| 381 | #{nest_str} cServerCall = #{@next_cell.get_namespace_path.get_path_str}.#{@next_cell_port_name}#{subscript};
|
---|
| 382 | #{alloc_call_port_join}#{serverErrorHandler_str}#{nest_str} };
|
---|
| 383 | EOT
|
---|
| 384 |
|
---|
| 385 | # ãµã¼ãã¼å´ã¿ã¹ã¯ã¡ã¤ã³
|
---|
| 386 | file.print <<EOT
|
---|
| 387 |
|
---|
| 388 | #{nest_str} // Unmarshaler Task Main
|
---|
| 389 | #{nest_str} cell #{@taskMainCelltype} #{@serverChannelCell}_TaskMain {
|
---|
| 390 | #{nest_str} cMain = #{@serverChannelCell}_Unmarshaler.eService;
|
---|
| 391 | #{opener}#{nest_str} };
|
---|
| 392 | EOT
|
---|
| 393 |
|
---|
| 394 | # ãµã¼ãã¼å´ã¿ã¹ã¯
|
---|
| 395 | file.print <<EOT
|
---|
| 396 |
|
---|
| 397 | #{nest_str} // Unmarshaler Task
|
---|
| 398 | #{nest_str} cell #{@taskCelltype} #{@serverChannelCell}_Task {
|
---|
| 399 | #{nest_str} cTaskBody = #{@serverChannelCell}_TaskMain.eMain;
|
---|
| 400 | #{nest_str} priority = #{@taskPriority};
|
---|
| 401 | #{nest_str} stackSize = #{@stackSize};
|
---|
| 402 | #{nest_str} attribute = C_EXP( "TA_ACT" ); /* mikan : marshaler task starts at beginning */
|
---|
| 403 | #{nest_str} };
|
---|
| 404 | EOT
|
---|
| 405 | @end_region.gen_region_str_post file
|
---|
| 406 | end
|
---|
| 407 |
|
---|
| 408 |
|
---|
| 409 | #=== ãã©ã°ã¤ã³å¼æ° noClientSemaphore ã®ãã§ãã¯
|
---|
| 410 | def set_noClientSemaphore rhs
|
---|
| 411 | rhs = rhs.to_sym
|
---|
| 412 | if rhs == :true then
|
---|
| 413 | @b_noClientSemaphore = true
|
---|
| 414 | elsif rhs == :false then
|
---|
| 415 | @b_noClientSemaphore = false
|
---|
| 416 | else
|
---|
| 417 | cdl_error( "RPCPlugin: specify true or false for noClientSemaphore" )
|
---|
| 418 | end
|
---|
| 419 | end
|
---|
| 420 |
|
---|
| 421 | #=== ãã©ã°ã¤ã³å¼æ° semaphoreCelltype ã®ãã§ãã¯
|
---|
| 422 | def set_semaphoreCelltype rhs
|
---|
| 423 | @semaphoreCelltype = rhs.to_sym
|
---|
| 424 | nsp = NamespacePath.analyze( @semaphoreCelltype.to_s )
|
---|
| 425 | obj = Namespace.find( nsp )
|
---|
| 426 | if ! obj.instance_of?( Celltype ) && ! obj.instance_of?( CompositeCelltype ) then
|
---|
| 427 | cdl_error( "RPCPlugin: semaphoreCelltype '#{rhs}' not celltype or not defined" )
|
---|
| 428 | end
|
---|
| 429 | end
|
---|
| 430 |
|
---|
| 431 | #=== NamespacePath ãå¾ã
|
---|
| 432 | # çæããã»ã«ã® namespace path ãçæãã
|
---|
| 433 | def get_cell_namespace_path
|
---|
| 434 | # nsp = @region.get_namespace.get_namespace_path
|
---|
| 435 | nsp = @start_region.get_namespace_path
|
---|
| 436 | return nsp.append( @cell_name )
|
---|
| 437 | end
|
---|
| 438 |
|
---|
| 439 | end
|
---|
| 440 |
|
---|
| 441 |
|
---|