20 """Produce Dictionary from IDL AST""" 25 from omniidl
import idlast, idlvisitor, idltype
28 from omniidl_be.cxx
import ast, id, types, output
29 import omniidl_be.cxx.id
as corba_cxx_id
32 from omniidl_be.doil
import util
34 import omniidl_be.doil.yat
as yat
41 bits = name.suffix(
"Servant").fullName()
42 return string.join(bits,
"_")
45 def run(tree, config):
72 self.
dict[
'tree'] = []
75 idl_fname = ast.mainFile()
76 self.
dict[
'idl_fname'] = idl_fname
80 idl_incs = ast.includes()
85 elif self.
config[
'ImplicitInclude']:
89 self.
dict[
'idl_includes'] = incs
92 self.
dict[
'include_h'] = self.
config[
"IncludeHeaders"]
101 idltype.tk_null :
"tk_null",
102 idltype.tk_void :
"tk_void",
103 idltype.tk_short :
"tk_short",
104 idltype.tk_long :
"tk_long",
105 idltype.tk_ushort :
"tk_ushort",
106 idltype.tk_ulong :
"tk_ulong",
107 idltype.tk_float :
"tk_float",
108 idltype.tk_double :
"tk_double",
109 idltype.tk_boolean :
"tk_boolean",
110 idltype.tk_char :
"tk_char",
111 idltype.tk_octet :
"tk_octet",
112 idltype.tk_any :
"tk_any",
113 idltype.tk_TypeCode :
"tk_TypeCode",
114 idltype.tk_Principal :
"tk_Principal",
115 idltype.tk_objref :
"tk_objref",
116 idltype.tk_struct :
"tk_struct",
117 idltype.tk_union :
"tk_union",
118 idltype.tk_enum :
"tk_enum",
119 idltype.tk_string :
"tk_string",
120 idltype.tk_sequence :
"tk_sequence",
121 idltype.tk_array :
"tk_array",
122 idltype.tk_alias :
"tk_alias",
123 idltype.tk_except :
"tk_except",
124 idltype.tk_longlong :
"tk_longlong",
125 idltype.tk_ulonglong :
"tk_ulonglong",
126 idltype.tk_longdouble :
"tk_longdouble",
127 idltype.tk_wchar :
"tk_wchar",
128 idltype.tk_wstring :
"tk_wstring",
129 idltype.tk_fixed :
"tk_fixed",
130 idltype.tk_value :
"tk_value",
131 idltype.tk_value_box :
"tk_value_box",
132 idltype.tk_native :
"tk_native",
133 idltype.tk_abstract_interface :
"tk_abstract_interface",
134 idltype.tk_local_interface :
"tk_local_interface" 138 "CORBA::Short" :
"short int",
139 "CORBA::UShort" :
"unsigned short int",
140 "CORBA::Long" :
"int",
141 "CORBA::ULong" :
"unsigned int",
142 "CORBA::Float" :
"float",
143 "CORBA::Double" :
"double",
144 "CORBA::Char" :
"char",
145 "CORBA::Boolean" :
"bool",
146 "char*" :
"::std::string",
147 "CORBA::Any" :
"::std::string",
148 "CORBA::TypeCode_ptr" :
"::std::string" 153 idl_path_list = idl_path.split(
'/')
154 idl_fname = idl_path_list[-1]
156 dict[
'idl_fname'] = idl_fname
157 dict[
'idl_fname_path'] = idl_path
160 base_name = idl_fname.split(
'.')[0]
161 inc_guard = base_name.upper() +
'TYPES_H' 162 dict[
'types_h'] = types_h = base_name +
'Types.h' 163 dict[
'typeconv_h'] = base_name +
'TypeConversion.h' 164 dict[
'typeconv_cpp'] = base_name +
'TypeConversion.cpp' 165 dict[
'types_include_guard'] = inc_guard
166 if self.
config[
'IfaceDir'] !=
"":
167 inc_types_h_path = self.
config[
'IfaceDir'] \
170 inc_types_h_path = types_h
171 dict[
'types_h_path'] = inc_types_h_path
174 dict[
'typeconv_h'] = typeconv_h = base_name +
'TypeConversion.h' 175 dict[
'typeconv_cpp'] = base_name +
'TypeConversion.cpp' 176 tc_inc_guard = base_name.upper() +
'TYPECONVERSION_H' 177 dict[
'typeconv_include_guard'] = tc_inc_guard
178 if self.
config[
'ServantDir'] !=
"":
179 inc_typeconv_h_path = self.
config[
'ServantDir'] \
182 inc_typeconv_h_path = typeconv_h
183 dict[
'typeconv_h_path'] = inc_typeconv_h_path
192 decl_type: 宣言のタイプ, struct, interface, union など corba:
decl_type: 宣言のタイプ, struct, interface, union など
corba_ns: [] ネームスペースのリスト
local:
decl_type: 宣言のタイプ, struct, interface, union など
local_ns: [] ローカルインターフェースのネームスペース
adapter_ns: [] アダプタのネームスペース
servant_ns: [] サーバントのネームスペース
194 decl_type: 宣言のタイプ, struct, interface, union など corba_ns: [] ネームスペースのリスト
local:
decl_type: 宣言のタイプ, struct, interface, union など
local_ns: [] ローカルインターフェースのネームスペース
adapter_ns: [] アダプタのネームスペース
servant_ns: [] サーバントのネームスペース
195 corba_ns: [] ネームスペースのリスト 197 decl_type: 宣言のタイプ, struct, interface, union など local_ns: [] ローカルインターフェースのネームスペース
adapter_ns: [] アダプタのネームスペース
servant_ns: [] サーバントのネームスペース
198 local_ns: [] ローカルインターフェースのネームスペース 199 adapter_ns: [] アダプタのネームスペース 200 servant_ns: [] サーバントのネームスペース 202 cdict = {
'decl_type': decl_type}
203 ldict = {
'decl_type': decl_type}
204 cdict[
'corba_ns'] = self.
module 205 ldict[
'iface_ns'] = self.
module + self.
config[
'IfaceNs']
206 ldict[
'adapter_ns'] = self.
module + self.
config[
'AdapterNs']
207 ldict[
'proxy_ns'] = self.
module + self.
config[
'ProxyNs']
208 ldict[
'servant_ns'] = self.
module + self.
config[
'ServantNs']
209 return {
'decl_type': decl_type,
'corba': cdict,
'local': ldict}
214 CORBA と Local の型名を取得する 216 corba_type = typeobj.base()
218 if corba_type[:2] ==
"::":
219 corba_type = corba_type[2:]
222 if self.typemap.has_key(corba_type):
223 local_type = self.
typemap[corba_type]
226 elif self.corba_primitive.has_key(corba_type):
228 if corba_type[:5] ==
'CORBA':
229 corba_type =
'::' + corba_type
230 tk = self.
tk_map[typeobj.kind()]
231 primitive = [
"tk_short",
"tk_long",
"tk_ushort",
232 "tk_ulong",
"tk_float",
"tk_double",
233 "tk_boolean",
"tk_char",
"tk_octet"]
234 if primitive.count(tk) > 0:
240 corba_scoped_type = corba_type.split(
'::')
241 corba_ns = corba_scoped_type[:-1]
242 corba_base = corba_scoped_type[-1]
243 local_ns = corba_ns + self.
config[
'IfaceNs']
244 local_scope = string.join(local_ns,
'::')
246 corba_base = corba_base[:corba_base.rfind(
'_ptr')]
247 local_type = local_scope +
'::' + \
248 self.
config[
'IfacePrefix'] + \
250 self.
config[
'IfaceSuffix']
251 elif typeobj.sequence():
252 seqType = types.Type(typeobj.type().seqType())
254 (corba_etype, local_etype, eis_primitive) = self.
getType(seqType)
256 local_etype = local_etype +
'*' 257 local_type =
"std::vector< " + local_etype +
" >" 260 local_type = local_scope +
'::' + corba_base
261 corba_type =
'::' + corba_type
262 local_type =
'::' + local_type
263 return (corba_type, local_type, is_primitive)
269 主に、識別子のIDL、C++、Local名を生成する createDeclで生成したディクショナリとnodeを引数に取る
corba:
idl_name: 宣言のidl上の識別子
name: C++にマッピングされた識別子
name_fq: C++識別子の完全修飾名
scoped_name: [] リスト形式の完全修飾名
local:
idl_name: 宣言のidl上の識別子
name: C++にマッピングされた識別子
name_fq: C++識別子の完全修飾名
scoped_name: [] リスト形式の完全修飾名
270 createDeclで生成したディクショナリとnodeを引数に取る
corba:
idl_name: 宣言のidl上の識別子
name: C++にマッピングされた識別子
name_fq: C++識別子の完全修飾名
scoped_name: [] リスト形式の完全修飾名
local:
idl_name: 宣言のidl上の識別子
name: C++にマッピングされた識別子
name_fq: C++識別子の完全修飾名
scoped_name: [] リスト形式の完全修飾名
273 idl_name: 宣言のidl上の識別子 274 name: C++にマッピングされた識別子 275 name_fq: C++識別子の完全修飾名 276 scoped_name: [] リスト形式の完全修飾名 278 idl_name: 宣言のidl上の識別子 279 name: C++にマッピングされた識別子 280 name_fq: C++識別子の完全修飾名 281 scoped_name: [] リスト形式の完全修飾名 284 cdict = dict[
'corba']
285 ldict = dict[
'local']
287 cdict[
'idl_name'] = idl_name = node.identifier()
288 cdict[
'name'] = cxx_name = id.mapID(idl_name)
289 ns = node.scopedName()[:-1]
290 cdict[
'corba_ns'] = ns
291 ldict[
'iface_ns'] = ns + self.
config[
'IfaceNs']
292 ldict[
'adapter_ns'] = ns + self.
config[
'AdapterNs']
293 ldict[
'proxy_ns'] = ns + self.
config[
'ProxyNs']
294 ldict[
'servant_ns'] = ns + self.
config[
'ServantNs']
295 cxx_fq_name = id.Name(node.scopedName()).fullyQualify()
296 cdict[
'name_fq'] =
'::' + cxx_fq_name
297 cdict[
'scoped_name'] = node.scopedName()
299 iface_ns =
'::' + string.join(ldict[
'iface_ns'],
'::')
301 if self.typemap.has_key(cxx_fq_name):
302 local_fq_name = self.
typemap[cxx_fq_name]
303 local_name = local_fq_name.split(
'::')[-1]
304 elif self.corba_primitive.has_key(cxx_fq_name):
306 local_name = local_fq_name
308 local_name = cxx_name
309 local_fq_name = iface_ns +
'::' + local_name
311 ldict[
'name'] = local_name
312 ldict[
'name_fq'] = local_fq_name
313 ldict[
'scoped_name'] = ldict[
'iface_ns'] + [local_name]
319 インターフェース宣言の識別子に関するディクショナリの生成 320 interface/servant/adapter 名を作成しディクショナリに追加する
corba:
name_poa: CORBA POAクラス名
local:
iface_name: Interfaceの識別子
iface_name_fq: Interfaceの完全修飾名
iface_scoped_name: Interfaceのリスト形式完全修飾名
servant_name: Servantの識別子
servant_name_fq: Servantの完全修飾名
servant_scoped_name: Servantのリスト形式完全修飾名
adapter_name: Adapterの識別子
adapter_name_fq: Adapterの完全修飾名
adapter_scoped_name: Adapterのリスト形式完全修飾名
323 name_poa: CORBA POAクラス名 325 iface_name: Interfaceの識別子 326 iface_name_fq: Interfaceの完全修飾名 327 iface_scoped_name: Interfaceのリスト形式完全修飾名 328 servant_name: Servantの識別子 329 servant_name_fq: Servantの完全修飾名 330 servant_scoped_name: Servantのリスト形式完全修飾名 331 adapter_name: Adapterの識別子 332 adapter_name_fq: Adapterの完全修飾名 333 adapter_scoped_name: Adapterのリスト形式完全修飾名 337 cdict = dict[
'corba']
338 ldict = dict[
'local']
339 cdict[
'name_poa'] =
'::POA_' + cdict[
'name_fq'].strip(
':')
346 for t
in [
'Iface',
'Servant',
'Adapter',
'Proxy']:
348 key = t.lower() +
'_name' 349 local_name = self.
config[t + p] + name + self.
config[t + s]
350 scoped_name = cdict[
'corba_ns'] + self.
config[t + n] + [local_name]
351 local_fq_name =
'::' + string.join(scoped_name,
'::')
352 ldict[key] = local_name
353 ldict[key +
'_fq'] = local_fq_name
354 ldict[key +
'_scoped_name'] = scoped_name
360 インターフェース関連ファイル名のディクショナリの生成 363 iface_h: Interfaceヘッダファイル名 364 iface_cpp: Interface実装ファイル名 365 iface_h_path: Interfaceヘッダのインクルードパス 366 iface_include_guard: Interfaceヘッダののインクルードガード 367 servant_h: Servantヘッダファイル名 368 servant_cpp: Servant実装ファイル名 369 servant_h_path: Servantヘッダのインクルードパス 370 servant_include_guard: Servantヘッダののインクルードガード 371 adapter_h: Adapterヘッダファイル名 372 adapter_cpp: Adapter実装ファイル名 373 adapter_h_path: Adapterヘッダのインクルードパス 374 adapter_include_guard: Adapterヘッダののインクルードガード 377 cdict = dict[
'corba']
378 ldict = dict[
'local']
379 ldict[
'include_h'] = self.
config[
"IncludeHeaders"]
383 for t
in [
'Iface',
'Servant',
'Adapter',
'Proxy']:
386 ldict[k +
'_h'] = ldict[k +
'_name'] +
".h" 387 ldict[k +
'_cpp'] = ldict[k +
'_name'] +
".cpp" 388 if self.
config[t +
'Dir'] ==
'':
389 ldict[k +
'_h_path'] = ldict[k +
'_h']
391 ldict[k +
'_h_path'] = \
392 self.
config[t +
'Dir'] +
'/' + ldict[k +
'_h']
393 ns = string.join(map(
lambda x: x +
'_',
394 ldict[k +
'_ns']),
'')
396 name = ldict[k +
'_name'].upper()
397 ldict[k +
'_include_guard'] = ns + name +
"_H" 403 共用体宣言のの識別子に関するディクショナリの生成 406 idl_name: 宣言のidl上の識別子 407 name: C++にマッピングされた識別子 408 name_fq: C++識別子の完全修飾名 409 scoped_name: [] リスト形式の完全修飾名 410 switch_type: switchの型 411 switch_fq_type: switchの完全修飾型 412 deref_switch_type: switchの非参照型 414 idl_name: 宣言のidl上の識別子 415 name: C++にマッピングされた識別子 416 name_fq: C++識別子の完全修飾名 417 scoped_name: [] リスト形式の完全修飾名 421 cdict = dict[
'corba']
422 ldict = dict[
'local']
424 switchType = types.Type(node.switchType())
425 ast.markDefaultCase(node)
426 hasDefault = ast.defaultCase(node) !=
None 428 (ctype, ltype, is_primitive) = self.
getType(switchType)
429 cdict[
'switch_fq_type'] = ctype
430 cdict[
'switch_type'] = ctype.split(
'::')[-1]
431 ldict[
'switch_fq_type'] = ltype
432 ldict[
'switch_type'] = ltype.split(
'::')[-1]
449 corba_name = dict[
'corba'][
'name']
450 outer_environment = id.lookup(node)
451 environment = outer_environment.enter(id.mapID(corba_name))
452 scope = environment.scope()
455 for member
in node.members():
460 memberType = types.Type(member.memberType())
463 memtype = memberType.member(environment)
464 for decl
in member.declarators():
468 dict[
'members'] = members
474 cdict = dict[
'corba']
475 ldict = dict[
'local']
477 memberType = types.Type(member.memberType())
478 memtype = memberType.member(env)
480 (ctype, ltype, is_primitive) = self.
getType(memberType)
481 cdict[
'base_type'] = ctype
482 cdict[
'tk'] = self.
tk_map[memberType.kind()]
483 ldict[
'base_type'] = ltype
484 cdict[
'member_name'] = id.mapID(decl.identifier())
485 cdict[
'member_dims'] = decl.sizes()
486 ldict[
'member_name'] = cdict[
'member_name']
487 ldict[
'member_dims'] = cdict[
'member_dims']
489 if memberType.objref():
491 local_mtype = ltype +
'*' 496 cdict[
'member_type'] = corba_mtype
497 ldict[
'member_type'] = local_mtype
503 switchType = types.Type(node.switchType())
504 ast.markDefaultCase(node)
505 outer_environment = id.lookup(node)
506 environment = outer_environment.enter(node.identifier())
508 for case
in node.cases():
512 dict[
'cases'] = cases
518 cdict = dict[
'corba']
519 ldict = dict[
'local']
521 caseType = types.Type(case.caseType())
522 d_caseType = caseType.deref()
523 (corba_ctype, local_ctype, is_primitive) = self.
getType(caseType)
524 cdict[
'case_type'] = corba_ctype
525 ldict[
'case_type'] = local_ctype
527 decl = case.declarator()
528 case_member = id.mapID(decl.identifier())
529 cdict[
'case_member'] = case_member
530 ldict[
'case_member'] = case_member
532 decl_dims = decl.sizes()
533 full_dims = decl_dims + caseType.dims()
534 is_array = full_dims != []
535 if is_array:
raise "array union case type is not supported." 539 def choose(switchType = switchtype,
540 values = ast.allCaseLabelValues(node),
541 environment = environment):
542 switchType = switchType.deref()
543 def min_unused(start, used = values):
548 kind = switchType.type().kind()
549 if switchType.integer():
550 (low, high) = ast.integer_type_ranges[kind]
551 s = switchType.literal(min_unused(low+1))
553 elif kind == idltype.tk_char:
554 all = map(chr, range(0, 255))
555 elif kind == idltype.tk_boolean:
557 elif kind == idltype.tk_enum:
558 all = switchType.type().decl().enumerators()
560 util.fatalError(
"Failed to generate a default union " +\
561 "discriminator value")
562 possibles = util.minus(all, values)
563 return switchType.literal(possibles[0], environment)
566 labels = case.labels()
568 non_default_labels = filter(
lambda x:
not x.default(), labels)
569 if non_default_labels == []:
572 discrimvalue = choose()
573 elif len(non_default_labels) > 1:
576 label = non_default_labels[1]
579 label = non_default_labels[0]
582 discrimvalue = choose()
584 discrimvalue = switchtype.literal(label.value(),
586 cdict[
'discriminator'] = discrimvalue
587 ldict[
'discriminator'] = discrimvalue
589 if switchtype.enum():
590 corba_ns =
'::' + string.join(cdict[
'corba_ns'],
'::')
591 local_ns =
'::' + string.join(ldict[
'iface_ns'],
'::')
592 cdict[
'discriminator_fq'] = corba_ns +
'::' + discrimvalue
593 ldict[
'discriminator_fq'] = local_ns +
'::' + discrimvalue
595 cdict[
'discriminator_fq'] = discrimvalue
596 ldict[
'discriminator_fq'] = discrimvalue
597 non_default_labels = filter(
lambda x:
not x.default(), labels)
603 typedef宣言に関するディクショナリの生成 607 derived_fq_type: 完全修飾導出型名 609 deref_fq_type: 完全修飾非参型名 613 derived_fq_type: 完全修飾導出型名 615 deref_fq_type: 完全修飾非参型名 619 cdict = dict[
'corba']
620 ldict = dict[
'local']
622 (cdict[
'base_type'], ldict[
'base_type'], is_primitive) = self.
getType(aliasType)
623 derivedName = id.mapID(decl.identifier())
624 alias_dims = aliasType.dims()
625 cdict[
'derived_type'] = derivedName
626 ldict[
'derived_type'] = derivedName
628 corba_ns =
'::' + string.join(cdict[
'corba_ns'],
'::')
629 local_ns =
'::' + string.join(ldict[
'iface_ns'],
'::')
630 cdict[
'derived_type_fq'] = corba_ns +
'::' + derivedName
631 ldict[
'derived_type_fq'] = local_ns +
'::' + derivedName
632 cdict[
'tk'] = tk = self.
tk_map[aliasType.kind()]
633 primitive = [
"tk_short",
"tk_long",
"tk_ushort",
634 "tk_ulong",
"tk_float",
"tk_double",
635 "tk_boolean",
"tk_char",
"tk_octet"]
636 if primitive.count(tk) > 0:
637 cdict[
'is_primitive'] =
'YES' 639 if aliasType.sequence():
640 seqType = types.Type(aliasType.type().seqType())
642 (corba_etype, local_etype, is_primitive) = self.
getType(seqType)
643 cdict[
'element_tk'] = self.
tk_map[seqType.kind()]
645 cdict[
'element_type_fq'] = corba_etype
646 ldict[
'element_type_fq'] = local_etype +
'*' 648 cdict[
'element_type_fq'] = corba_etype
649 ldict[
'element_type_fq'] = local_etype
660 dict[
'name'] = id.mapID(operation.identifier())
662 for r
in operation.raises():
665 dict[
'raises'].
append(edict)
670 dict[
'name'] = id.mapID(ident)
697 cdict = dict[
'corba']
698 ldict = dict[
'local']
700 retType = types.Type(operation.returnType())
701 (corba_type, local_type, is_primitive) = self.
getType(retType)
702 cdict[
'base_type'] = corba_type
703 ldict[
'base_type'] = local_type
704 if is_primitive !=
None:
705 cdict[
'is_primitive'] = is_primitive
706 retn_type = types.Type(operation.returnType()).op(types.RET)
707 retn_type = retn_type.replace(
'CORBA',
'::CORBA')
708 retn_type = retn_type.replace(
'RTC',
'::RTC')
709 retn_type = retn_type.replace(
'SDOPackage',
'::SDOPackage')
710 retn_type = retn_type.replace(
'::::',
'::')
711 cdict[
'retn_type'] = retn_type
713 if retType.objref(): local_rtype = local_type +
'*' 714 else: local_rtype = local_type
716 ldict[
'retn_type'] = local_rtype
717 cdict[
'tk'] = ldict[
'tk'] = self.
tk_map[retType.kind()]
719 if retType.deref().sequence():
720 retType = retType.deref()
722 if retType.sequence():
723 seqType = types.Type(retType.type().seqType())
725 (corba_etype, local_etype, is_primitive) = self.
getType(seqType)
726 cdict[
'deref_tk'] = self.
tk_map[seqType.kind()]
728 derefType = retType.deref()
729 (corba_dtype, local_dtype, is_primitive) = self.
getType(derefType)
730 cdict[
'deref_tk'] = self.
tk_map[derefType.kind()]
767 direction = [
'in',
'out',
'inout',
'return']
768 for arg
in operation.parameters():
771 cdict = dict[
'corba']
772 ldict = dict[
'local']
774 paramType = types.Type(arg.paramType())
775 (corba_type, local_type, is_primitive) = self.
getType(paramType)
777 cdict[
'base_type'] = corba_type
778 ldict[
'base_type'] = local_type
779 if is_primitive !=
None:
780 cdict[
'is_primitive'] = is_primitive
782 arg_name = id.mapID(arg.identifier())
783 cdict[
'arg_name'] = arg_name
784 ldict[
'arg_name'] = arg_name
785 cdict[
'var_name'] =
'_' + arg_name
786 ldict[
'var_name'] =
'_' + arg_name
788 direction_val = direction[arg.direction()]
789 cdict[
'direction'] = direction_val
790 ldict[
'direction'] = direction_val
792 cdict[
'tk'] = ldict[
'tk'] = self.
tk_map[paramType.kind()]
793 arg_type = paramType.op(types.direction(arg), use_out = 0)
794 arg_type = arg_type.replace(
'CORBA',
'::CORBA')
795 arg_type = arg_type.replace(
'RTC',
'::RTC')
796 arg_type = arg_type.replace(
'SDOPackage',
'::SDOPackage')
797 arg_type = arg_type.replace(
'::::',
'::')
798 cdict[
'arg_type'] = arg_type
805 (corba_type, local_type, is_primitive) = self.
getType(typeobj)
806 cdict = dict[
'corba']
807 ldict = dict[
'local']
808 if is_primitive !=
None:
809 cdict[
'is_primitive'] = is_primitive
812 if paramType.typedef():
813 paramType = paramType.deref()
815 if paramType.is_basic_data_types():
816 if out: ldict[
'arg_type'] = local_type +
'&' 817 else: ldict[
'arg_type'] = local_type
818 ldict[
'var_type'] = local_type
819 cdict[
'var_type'] = corba_type
821 elif paramType.enum():
822 if out: ldict[
'arg_type'] = local_type +
'&' 823 else: ldict[
'arg_type'] = local_type
824 ldict[
'var_type'] = local_type
825 cdict[
'var_type'] = corba_type
829 elif paramType.struct()
or paramType.sequence()
or \
831 if out: ldict[
'arg_type'] = local_type +
'&' 832 else: ldict[
'arg_type'] =
'const '+local_type+
'&' 833 ldict[
'var_type'] = local_type
834 cdict[
'var_type'] = corba_type +
'*' 836 elif paramType.objref():
837 if out: ldict[
'arg_type'] = local_type +
'*' 838 else: ldict[
'arg_type'] =
'const '+local_type+
'*' 839 ldict[
'var_type'] = local_type +
'*' 840 cdict[
'var_type'] = corba_type
843 elif paramType.any()
or paramType.string():
844 if out: ldict[
'arg_type'] = local_type +
'&' 845 else: ldict[
'arg_type'] =
'const ' + local_type +
'&' 846 ldict[
'var_type'] = local_type
847 cdict[
'var_type'] = corba_type
849 raise "UNKNOWN TYPE", (
850 self.
tk_map[paramType.kind()],
859 for n
in node.declarations():
860 if ast.shouldGenerateCodeForDecl(n):
865 module = id.mapID(node.identifier())
866 self.module.append(module)
867 for n
in node.definitions():
874 print "Declarator", id.mapID(node.identifier())
889 self.getUnionIdent(dict, node)
927 cdict = dict[
'corba']
928 ldict = dict[
'local']
931 enumerators = node.enumerators()
932 memberlist = map(
lambda x: id.Name(x.scopedName()).simple(),
934 cdict[
'members'] = memberlist
935 ldict[
'members'] = memberlist
941 environment = id.lookup(node)
942 scope = environment.scope()
943 aliasType = types.Type(node.aliasType())
944 aliasTypeID = aliasType.member(environment)
946 if node.constrType():
947 node.aliasType().decl().accept(self)
950 for decl
in node.declarators():
966 self.__allInterfaces.append(node)
972 dict[
'inherits'] = []
973 for ihnode
in ast.allInherits(node):
977 dict[
'inherits'].
append(idict)
979 env = id.lookup(node)
981 allInterfaces = [node]
982 allCallables = util.fold( map(
lambda x:x.callables(), allInterfaces),
983 [],
lambda x, y: x + y )
985 dict[
'operations'] = []
986 dict[
'attributes'] = []
987 for c
in allCallables:
988 if isinstance(c, idlast.Attribute):
989 attrType = types.Type(c.attrType())
990 d_attrType = attrType.deref()
991 (corba_atype, local_atype, is_primitive) = self.
getType(attrType)
993 for i
in c.identifiers():
995 returnType = attrType.op(types.RET)
996 inType = attrType.op(types.IN)
999 cdict = adict[
'corba']
1000 ldict = adict[
'local']
1001 cdict[
'base_type'] = corba_atype;
1002 ldict[
'base_type'] = local_atype
1003 cdict[
'name'] = ident
1006 self.
createArg(adict[
'arg'], attrType,
False)
1008 dict[
'attributes'].
append(adict)
1010 dict[
'readonly'] =
'yes' 1011 dict[
'attributes'].
append(gdict)
1013 elif isinstance(c, idlast.Operation):
1018 dict[
'operations'].
append(op_dict)
1020 util.fatalError(
"Internal error generating interface member")
1021 raise "No code for interface member: " + repr(c)
def createUnionCase(self, case, node, switchtype, environment)
def getType(self, typeobj)
def createIdent(self, dict, node)
def visitUnionForward(self, node)
def visitStruct(self, node)
def createMembers(self, dict, node)
def createArgs(self, operation, env)
def visitDeclarator(self, node)
def createHeaderInfo(self, idl_path)
def createUnionIdent(self, dict, node)
def createTypedef(self, aliasType, decl, env)
def visitException(self, node)
def createMember(self, decl, member, env)
def createStructIdent(self, dict, node)
def visitTypedef(self, node)
def visitModule(self, node)
def visitStructForward(self, node)
def createEnumIdent(self, dict, node)
def createArg(self, dict, typeobj, out)
void append(SDOPackage::NVList &dest, const SDOPackage::NVList &src)
Append an element to NVList.
def createOperation(self, operation)
def createDecl(self, decl_type)
def visitForward(self, node)
def createExceptionIdent(self, dict, node)
def createReturn(self, operation)
def visitEnum(self, node)
def visitInterface(self, node)
def visitUnion(self, node)
def createInterfaceFileInfo(self, dict, node)
def __init__(self, tree, config)
def createUnionCases(self, dict, node)
def createInterfaceIdent(self, dict, node)
def createAttribute(self, ident)