22 from omniidl
import idlast, idlvisitor, idlutil
25 from omniidl_be.cxx
import support, ast, id
28 from omniidl_be.doil
import util, config
30 import re, sys, os.path
32 cpp_args = [
"-D__OMNIIDL_CXX__"]
34 -Wbm=<mapfile> Specify type mapping rule file (mandatory) 35 -Wbi=<include> Specify include files 36 -Wbimplicit Process included IDLs implicitly 37 -Wbinterface Generate doil C++ interface header 38 -Wbcorbaservant Generate doil servant class for CORBA 39 -Wbcorbaadapter Generate doil adapter class for CORBA 40 -Wbcorbaproxy Generate doil proxy class for CORBA 41 -Wbiceslice Generate Ice slice file from CORBA IDL 42 -Wbiceservant Generate doil servant class for Ice 43 -Wbiceadapter Generate doil adapter class for Ice 44 -Wbiceproxy Generate doil proxy class for Ice 46 [ options for servant class ] 47 -Wbss=<suffix> Specify suffix for generated servant files [default Servant] 48 -Wbsp=<prefix> Specify prefix for generated servant files [default None] 49 -Wbsns=<ns> Specify namespsace of generated servant class [default None] 50 -Wbsdir=<ns> Specify directory of generated servant header [default None] 52 [ options for adapter class ] 53 -Wbas=<suffix> Specify suffix for generated adapter class [default Adapter] 54 -Wbap=<prefix> Specify prefix for generated adapter class [default None] 55 -Wbans=<ns> Specify namespsace of generated adapter class [default None] 56 -Wbadir=<ns> Specify directory of generated adapter header [default None] 58 [ options for proxy class ] 59 -Wbps=<suffix> Specify suffix for generated proxy class [default Proxy] 60 -Wbpp=<prefix> Specify prefix for generated proxy class [default None] 61 -Wbpns=<ns> Specify namespsace of generated proxy class [default None] 62 -Wbpdir=<ns> Specify directory of generated proxy header [default None] 64 [ options for interface class ] 65 -Wbis=<suffix> Specify suffix for local interface class [default None] 66 -Wbip=<prefix> Specify prefix for local interface class [default I] 67 -Wbins=<ns> Specify namespsace of local interface class [default None] 68 -Wbidir=<ns> Specify directory of local interface class [default None] 75 AST_unsupported_nodes = [
"Native",
"StateMember",
"Factory",
"ValueForward",
76 "ValueBox",
"ValueAbs",
"Value" ]
81 config.state[
'Debug'] =
True 83 config.state[
'MappingFile'] = arg[2:]
85 config.state[
'IncludeHeaders'].
append(arg[2:])
87 elif arg ==
"implicit":
88 config.state[
'ImplicitInclude'] =
True 89 elif arg ==
"interface":
90 config.state[
'Interface'] =
True 91 elif arg ==
"corbaservant":
92 config.state[
'CORBAServant'] =
True 93 elif arg ==
"corbaadapter":
94 config.state[
'CORBAAdapter'] =
True 95 elif arg ==
"corbaproxy":
96 config.state[
'CORBAProxy'] =
True 97 elif arg ==
"iceslice":
98 config.state[
'IceSlice'] =
True 99 elif arg ==
"iceservant":
100 config.state[
'IceServant'] =
True 101 elif arg ==
"iceadapter":
102 config.state[
'IceAdapter'] =
True 103 elif arg ==
"iceproxy":
104 config.state[
'IceProxy'] =
True 106 elif arg[:3] ==
"ss=":
107 config.state[
'ServantSuffix'] = arg[3:]
108 elif arg[:3] ==
"sp=":
109 config.state[
'ServantPrefix'] = arg[3:]
110 elif arg[:4] ==
"sns=":
111 config.state[
'ServantNs'] = arg[4:].
split(
'::')
112 elif arg[:5] ==
"sdir=":
113 config.state[
'ServantDir'] = arg[5:]
115 elif arg[:3] ==
"as=":
116 config.state[
'AdapterSuffix'] = arg[3:]
117 elif arg[:3] ==
"ap=":
118 config.state[
'AdapterPrefix'] = arg[3:]
119 elif arg[:4] ==
"ans=":
120 config.state[
'AdapterNs'] = arg[4:].
split(
'::')
121 elif arg[:5] ==
"adir=":
122 config.state[
'AdapterDir'] = arg[5:]
124 elif arg[:3] ==
"ps=":
125 config.state[
'ProxySuffix'] = arg[3:]
126 elif arg[:3] ==
"pp=":
127 config.state[
'ProxyPrefix'] = arg[3:]
128 elif arg[:4] ==
"pns=":
129 config.state[
'ProxyNs'] = arg[4:].
split(
'::')
130 elif arg[:5] ==
"pdir=":
131 config.state[
'ProxyDir'] = arg[5:]
133 elif arg[:3] ==
"is=":
134 config.state[
'IfaceSuffix'] = arg[3:]
135 elif arg[:3] ==
"ip=":
136 config.state[
'IfacePrefix'] = arg[3:]
137 elif arg[:4] ==
"ins=":
138 config.state[
'IfaceNs'] = arg[4:].
split(
'::')
139 elif arg[:5] ==
"idir=":
140 config.state[
'IfaceDir'] = arg[5:]
142 util.fatalError(
"Argument \"" + str(arg) +
"\" is unknown")
148 """Entrypoint to the doil backend""" 153 util.fatalError(
"Sorry, the doil backend cannot process more " 154 "than one IDL file at a time.")
157 dirname, filename = os.path.split(tree.file())
158 basename,ext = os.path.splitext(filename)
159 config.state[
'Basename'] = basename
160 config.state[
'Directory'] = dirname
164 if config.state[
'MappingFile'] ==
'':
165 config.state[
'TypeMapping'] = {}
168 mapping_file = config.state[
'MappingFile']
169 f = open(mapping_file,
"r") 170 mapping = yaml.load(f.read()) 172 config.state['TypeMapping'] = mapping
177 support.checkIDL(tree)
182 tree.accept(id.WalkTree())
186 from omniidl_be.doil
import dictbuilder
187 dict = dictbuilder.run(tree, config.state)
189 if config.state[
'Interface']:
190 from omniidl_be.doil
import interface
191 interface.generate_interface(dict)
192 interface.generate_types(dict)
193 if config.state[
'CORBAServant']:
194 from omniidl_be.doil
import corba
195 corba.generate_servant(dict)
196 corba.generate_types(dict)
197 if config.state[
'CORBAAdapter']:
198 from omniidl_be.doil
import corba
199 corba.generate_adapter(dict)
200 corba.generate_types(dict)
201 if config.state[
'CORBAProxy']:
202 from omniidl_be.doil
import corba
203 corba.generate_proxy(dict)
204 corba.generate_types(dict)
205 if config.state[
'IceSlice']:
206 from omniidl_be.doil
import ice
207 ice.generate_slice(dict)
209 if config.state[
'IceAdapter']:
210 from omniidl_be.doil
import ice
211 ice.generate_adapter(dict)
213 if config.state[
'IceProxy']:
214 from omniidl_be.doil
import ice
215 ice.generate_proxy(dict)
217 if config.state[
'IceServant']:
218 from omniidl_be.doil
import ice
219 ice.generate_servant(dict)
221 except AttributeError, e:
223 unsupported_visitors = map(
lambda x:
"visit" + x,
224 AST_unsupported_nodes[:])
225 if name
in unsupported_visitors:
226 util.unsupportedIDL()
228 util.fatalError(
"An AttributeError exception was caught")
229 except SystemExit, e:
232 util.fatalError(
"An internal exception was caught")
vstring split(const std::string &input, const std::string &delimiter, bool ignore_empty)
Split string by delimiter.
void append(SDOPackage::NVList &dest, const SDOPackage::NVList &src)
Append an element to NVList.