zeroc-ice 3.7.11 → 3.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (895) hide show
  1. checksums.yaml +4 -4
  2. data/dist/IceRuby/Communicator.cpp +159 -376
  3. data/dist/IceRuby/Communicator.h +8 -9
  4. data/dist/IceRuby/Config.h +23 -89
  5. data/dist/IceRuby/Connection.cpp +111 -219
  6. data/dist/IceRuby/Connection.h +8 -12
  7. data/dist/IceRuby/DefaultSliceLoader.cpp +45 -0
  8. data/dist/IceRuby/DefaultSliceLoader.h +25 -0
  9. data/dist/IceRuby/Endpoint.cpp +63 -65
  10. data/dist/IceRuby/Endpoint.h +7 -11
  11. data/dist/IceRuby/ImplicitContext.cpp +26 -31
  12. data/dist/IceRuby/ImplicitContext.h +6 -10
  13. data/dist/IceRuby/Init.cpp +27 -40
  14. data/dist/IceRuby/Logger.cpp +23 -28
  15. data/dist/IceRuby/Logger.h +8 -12
  16. data/dist/IceRuby/Operation.cpp +177 -219
  17. data/dist/IceRuby/Operation.h +15 -18
  18. data/dist/IceRuby/Properties.cpp +133 -89
  19. data/dist/IceRuby/Properties.h +6 -10
  20. data/dist/IceRuby/Proxy.cpp +179 -649
  21. data/dist/IceRuby/Proxy.h +11 -12
  22. data/dist/IceRuby/RubySliceLoader.cpp +39 -0
  23. data/dist/IceRuby/RubySliceLoader.h +27 -0
  24. data/dist/IceRuby/Slice.cpp +88 -94
  25. data/dist/IceRuby/Slice.h +3 -7
  26. data/dist/IceRuby/Types.cpp +987 -1190
  27. data/dist/IceRuby/Types.h +390 -461
  28. data/dist/IceRuby/Util.cpp +214 -473
  29. data/dist/IceRuby/Util.h +378 -479
  30. data/dist/ice/cpp/include/Ice/AsyncResponseHandler.h +85 -0
  31. data/dist/ice/cpp/include/Ice/BatchRequest.h +39 -0
  32. data/dist/ice/cpp/include/Ice/BatchRequestQueueF.h +4 -10
  33. data/dist/ice/cpp/include/Ice/Buffer.h +116 -111
  34. data/dist/ice/cpp/include/Ice/Communicator.h +411 -0
  35. data/dist/ice/cpp/include/Ice/CommunicatorF.h +16 -0
  36. data/dist/ice/cpp/include/Ice/Config.h +46 -62
  37. data/dist/ice/cpp/include/Ice/Connection.h +410 -0
  38. data/dist/ice/cpp/include/Ice/ConnectionF.h +36 -0
  39. data/dist/ice/cpp/include/Ice/ConnectionIF.h +6 -28
  40. data/dist/ice/cpp/include/Ice/CtrlCHandler.h +56 -0
  41. data/dist/ice/cpp/include/Ice/Current.h +60 -0
  42. data/dist/ice/cpp/include/Ice/DefaultSliceLoader.h +160 -0
  43. data/dist/ice/cpp/include/Ice/Demangle.h +17 -0
  44. data/dist/ice/cpp/include/Ice/Endpoint.h +298 -0
  45. data/dist/ice/cpp/include/Ice/EndpointF.h +44 -0
  46. data/dist/ice/cpp/include/Ice/EndpointSelectionType.h +21 -0
  47. data/dist/ice/cpp/include/Ice/Exception.h +46 -151
  48. data/dist/ice/cpp/include/Ice/FacetMap.h +16 -0
  49. data/dist/ice/cpp/include/Ice/Format.h +11 -27
  50. data/dist/ice/cpp/include/Ice/Ice.h +53 -48
  51. data/dist/ice/cpp/include/Ice/IconvStringConverter.h +165 -326
  52. data/dist/ice/cpp/include/Ice/ImplicitContext.h +76 -0
  53. data/dist/ice/cpp/include/Ice/IncomingRequest.h +75 -0
  54. data/dist/ice/cpp/include/Ice/Initialize.h +113 -927
  55. data/dist/ice/cpp/include/Ice/InputStream.h +748 -1320
  56. data/dist/ice/cpp/include/Ice/InstanceF.h +4 -10
  57. data/dist/ice/cpp/include/Ice/Instrumentation.h +319 -0
  58. data/dist/ice/cpp/include/Ice/LocalException.h +58 -0
  59. data/dist/ice/cpp/include/Ice/LocalExceptions.h +870 -0
  60. data/dist/ice/cpp/include/Ice/Logger.h +62 -0
  61. data/dist/ice/cpp/include/Ice/LoggerUtil.h +124 -147
  62. data/dist/ice/cpp/include/Ice/MarshaledResult.h +50 -0
  63. data/dist/ice/cpp/include/Ice/NativePropertiesAdmin.h +41 -71
  64. data/dist/ice/cpp/include/Ice/Object.h +151 -490
  65. data/dist/ice/cpp/include/Ice/ObjectAdapter.h +324 -0
  66. data/dist/ice/cpp/include/Ice/ObjectAdapterF.h +16 -0
  67. data/dist/ice/cpp/include/Ice/ObjectF.h +5 -19
  68. data/dist/ice/cpp/include/Ice/ObserverHelper.h +115 -132
  69. data/dist/ice/cpp/include/Ice/OutgoingAsync.h +392 -748
  70. data/dist/ice/cpp/include/Ice/OutgoingResponse.h +129 -0
  71. data/dist/ice/cpp/include/Ice/OutputStream.h +756 -956
  72. data/dist/ice/cpp/include/Ice/Plugin.h +73 -0
  73. data/dist/ice/cpp/include/Ice/PluginFactory.h +77 -0
  74. data/dist/ice/cpp/include/{IceUtil → Ice}/PopDisableWarnings.h +8 -6
  75. data/dist/ice/cpp/include/Ice/Properties.h +307 -0
  76. data/dist/ice/cpp/include/Ice/PropertiesF.h +19 -0
  77. data/dist/ice/cpp/include/Ice/Proxy.h +665 -5094
  78. data/dist/ice/cpp/include/Ice/ProxyF.h +2 -44
  79. data/dist/ice/cpp/include/Ice/ProxyFunctions.h +209 -0
  80. data/dist/ice/cpp/include/Ice/PushDisableWarnings.h +29 -0
  81. data/dist/ice/cpp/include/Ice/ReferenceF.h +4 -19
  82. data/dist/ice/cpp/include/Ice/RequestHandlerF.h +8 -18
  83. data/dist/ice/cpp/include/Ice/SSL/ClientAuthenticationOptions.h +276 -0
  84. data/dist/ice/cpp/include/Ice/SSL/Config.h +54 -0
  85. data/dist/ice/cpp/include/Ice/SSL/ConnectionInfo.h +107 -0
  86. data/dist/ice/cpp/include/Ice/SSL/ConnectionInfoF.h +39 -0
  87. data/dist/ice/cpp/include/Ice/SSL/EndpointInfo.h +40 -0
  88. data/dist/ice/cpp/include/Ice/SSL/SSLException.h +32 -0
  89. data/dist/ice/cpp/include/Ice/SSL/ServerAuthenticationOptions.h +286 -0
  90. data/dist/ice/cpp/include/Ice/ServantLocator.h +51 -0
  91. data/dist/ice/cpp/include/Ice/Service.h +182 -342
  92. data/dist/ice/cpp/include/Ice/SliceLoader.h +67 -0
  93. data/dist/ice/cpp/include/Ice/SlicedData.h +113 -160
  94. data/dist/ice/cpp/include/Ice/SlicedDataF.h +17 -27
  95. data/dist/ice/cpp/include/Ice/StreamHelpers.h +532 -1070
  96. data/dist/ice/cpp/include/Ice/StreamableTraits.h +291 -0
  97. data/dist/ice/cpp/include/Ice/StringConverter.h +152 -63
  98. data/dist/ice/cpp/include/Ice/StringUtil.h +114 -0
  99. data/dist/ice/cpp/include/Ice/TimerTask.h +24 -0
  100. data/dist/ice/cpp/include/Ice/TupleCompare.h +103 -0
  101. data/dist/ice/cpp/include/Ice/UUID.h +6 -9
  102. data/dist/ice/cpp/include/Ice/UserException.h +46 -0
  103. data/dist/ice/cpp/include/Ice/UserExceptionFactory.h +4 -79
  104. data/dist/ice/cpp/include/Ice/Value.h +103 -115
  105. data/dist/ice/cpp/include/Ice/ValueF.h +6 -11
  106. data/dist/ice/cpp/include/IceDiscovery/IceDiscovery.h +16 -1877
  107. data/dist/ice/cpp/include/IceLocatorDiscovery/IceLocatorDiscovery.h +16 -1185
  108. data/dist/ice/cpp/include/generated/Ice/BuiltinSequences.h +46 -146
  109. data/dist/ice/cpp/include/generated/Ice/Context.h +40 -0
  110. data/dist/ice/cpp/include/generated/Ice/EndpointTypes.h +49 -93
  111. data/dist/ice/cpp/include/generated/Ice/Identity.h +70 -226
  112. data/dist/ice/cpp/include/generated/Ice/Locator.h +494 -3850
  113. data/dist/ice/cpp/include/generated/Ice/LocatorRegistry.h +443 -0
  114. data/dist/ice/cpp/include/generated/Ice/Metrics.h +937 -4603
  115. data/dist/ice/cpp/include/generated/Ice/OperationMode.h +73 -0
  116. data/dist/ice/cpp/include/generated/Ice/Process.h +197 -929
  117. data/dist/ice/cpp/include/generated/Ice/PropertiesAdmin.h +249 -1301
  118. data/dist/ice/cpp/include/generated/Ice/PropertyDict.h +39 -0
  119. data/dist/ice/cpp/include/generated/Ice/RemoteLogger.h +637 -2620
  120. data/dist/ice/cpp/include/generated/Ice/ReplyStatus.h +94 -0
  121. data/dist/ice/cpp/include/generated/Ice/Router.h +429 -1783
  122. data/dist/ice/cpp/include/generated/Ice/SliceChecksumDict.h +18 -65
  123. data/dist/ice/cpp/include/generated/Ice/Version.h +73 -318
  124. data/dist/ice/cpp/include/generated/IceDiscovery/Lookup.h +498 -0
  125. data/dist/ice/cpp/include/generated/IceLocatorDiscovery/Lookup.h +387 -0
  126. data/dist/ice/cpp/src/Ice/Acceptor.h +28 -24
  127. data/dist/ice/cpp/src/Ice/AcceptorF.h +6 -14
  128. data/dist/ice/cpp/src/Ice/AddDefaultPluginFactories.h +16 -0
  129. data/dist/ice/cpp/src/Ice/AddDefaultPluginFactories_all.cpp +43 -0
  130. data/dist/ice/cpp/src/Ice/AddDefaultPluginFactories_min.cpp +17 -0
  131. data/dist/ice/cpp/src/Ice/ArgVector.cpp +17 -18
  132. data/dist/ice/cpp/src/Ice/ArgVector.h +19 -25
  133. data/dist/ice/cpp/src/Ice/Base64.cpp +66 -66
  134. data/dist/ice/cpp/src/Ice/Base64.h +14 -19
  135. data/dist/ice/cpp/src/Ice/BatchRequestQueue.cpp +70 -121
  136. data/dist/ice/cpp/src/Ice/BatchRequestQueue.h +37 -47
  137. data/dist/ice/cpp/src/Ice/Buffer.cpp +73 -41
  138. data/dist/ice/cpp/src/Ice/CheckIdentity.h +21 -0
  139. data/dist/ice/cpp/src/Ice/CollocatedRequestHandler.cpp +215 -249
  140. data/dist/ice/cpp/src/Ice/CollocatedRequestHandler.h +38 -60
  141. data/dist/ice/cpp/src/Ice/Communicator.cpp +399 -0
  142. data/dist/ice/cpp/src/Ice/CommunicatorFlushBatchAsync.cpp +140 -0
  143. data/dist/ice/cpp/src/Ice/CommunicatorFlushBatchAsync.h +39 -0
  144. data/dist/ice/cpp/src/Ice/ConnectRequestHandler.cpp +63 -184
  145. data/dist/ice/cpp/src/Ice/ConnectRequestHandler.h +30 -51
  146. data/dist/ice/cpp/src/Ice/ConnectRequestHandlerF.h +4 -14
  147. data/dist/ice/cpp/src/Ice/Connection.cpp +44 -0
  148. data/dist/ice/cpp/src/Ice/ConnectionFactory.cpp +578 -792
  149. data/dist/ice/cpp/src/Ice/ConnectionFactory.h +200 -200
  150. data/dist/ice/cpp/src/Ice/ConnectionFactoryF.h +6 -19
  151. data/dist/ice/cpp/src/Ice/ConnectionI.cpp +1674 -1782
  152. data/dist/ice/cpp/src/Ice/ConnectionI.h +333 -293
  153. data/dist/ice/cpp/src/Ice/ConnectionOptions.h +22 -0
  154. data/dist/ice/cpp/src/Ice/Connector.h +25 -19
  155. data/dist/ice/cpp/src/Ice/ConnectorF.h +4 -11
  156. data/dist/ice/cpp/src/{IceUtil → Ice}/ConsoleUtil.cpp +32 -53
  157. data/dist/ice/cpp/src/Ice/ConsoleUtil.h +79 -0
  158. data/dist/ice/cpp/src/Ice/CtrlCHandler.cpp +189 -0
  159. data/dist/ice/cpp/src/Ice/Current.cpp +29 -0
  160. data/dist/ice/cpp/src/Ice/DLLMain.cpp +25 -35
  161. data/dist/ice/cpp/src/Ice/DefaultSliceLoader.cpp +39 -0
  162. data/dist/ice/cpp/src/Ice/DefaultsAndOverrides.cpp +41 -119
  163. data/dist/ice/cpp/src/Ice/DefaultsAndOverrides.h +27 -41
  164. data/dist/ice/cpp/src/Ice/DefaultsAndOverridesF.h +4 -11
  165. data/dist/ice/cpp/src/Ice/Demangle.cpp +26 -0
  166. data/dist/ice/cpp/src/Ice/DisableWarnings.h +31 -0
  167. data/dist/ice/cpp/src/Ice/DynamicLibrary.cpp +44 -112
  168. data/dist/ice/cpp/src/Ice/DynamicLibrary.h +91 -0
  169. data/dist/ice/cpp/src/Ice/Endian.h +40 -0
  170. data/dist/ice/cpp/src/Ice/EndpointFactory.cpp +35 -59
  171. data/dist/ice/cpp/src/Ice/EndpointFactory.h +82 -103
  172. data/dist/ice/cpp/src/Ice/EndpointFactoryF.h +4 -11
  173. data/dist/ice/cpp/src/Ice/EndpointFactoryManager.cpp +54 -87
  174. data/dist/ice/cpp/src/Ice/EndpointFactoryManager.h +28 -33
  175. data/dist/ice/cpp/src/Ice/EndpointFactoryManagerF.h +4 -11
  176. data/dist/ice/cpp/src/Ice/EndpointI.cpp +53 -23
  177. data/dist/ice/cpp/src/Ice/EndpointI.h +132 -200
  178. data/dist/ice/cpp/src/Ice/EndpointIF.h +11 -39
  179. data/dist/ice/cpp/src/Ice/EventHandler.cpp +3 -26
  180. data/dist/ice/cpp/src/Ice/EventHandler.h +46 -56
  181. data/dist/ice/cpp/src/Ice/EventHandlerF.h +4 -14
  182. data/dist/ice/cpp/src/Ice/Exception.cpp +3 -816
  183. data/dist/ice/cpp/src/Ice/FileUtil.cpp +476 -0
  184. data/dist/ice/cpp/src/Ice/FileUtil.h +152 -0
  185. data/dist/ice/cpp/src/Ice/FixedRequestHandler.cpp +34 -0
  186. data/dist/ice/cpp/src/Ice/FixedRequestHandler.h +29 -0
  187. data/dist/ice/cpp/src/Ice/HashUtil.h +46 -32
  188. data/dist/ice/cpp/src/Ice/HttpParser.cpp +431 -431
  189. data/dist/ice/cpp/src/Ice/HttpParser.h +95 -100
  190. data/dist/ice/cpp/src/Ice/IPEndpointI.cpp +207 -324
  191. data/dist/ice/cpp/src/Ice/IPEndpointI.h +80 -126
  192. data/dist/ice/cpp/src/Ice/IPEndpointIF.h +6 -17
  193. data/dist/ice/cpp/src/Ice/IdleTimeoutTransceiverDecorator.cpp +172 -0
  194. data/dist/ice/cpp/src/Ice/IdleTimeoutTransceiverDecorator.h +89 -0
  195. data/dist/ice/cpp/src/Ice/ImplicitContext.cpp +109 -0
  196. data/dist/ice/cpp/src/Ice/IncomingRequest.cpp +66 -0
  197. data/dist/ice/cpp/src/Ice/Initialize.cpp +48 -542
  198. data/dist/ice/cpp/src/Ice/InputStream.cpp +848 -1385
  199. data/dist/ice/cpp/src/Ice/Instance.cpp +816 -827
  200. data/dist/ice/cpp/src/Ice/Instance.h +202 -212
  201. data/dist/ice/cpp/src/Ice/InstrumentationI.cpp +526 -661
  202. data/dist/ice/cpp/src/Ice/InstrumentationI.h +171 -192
  203. data/dist/ice/cpp/src/Ice/LocalException.cpp +518 -0
  204. data/dist/ice/cpp/src/Ice/LocalExceptions.cpp +577 -0
  205. data/dist/ice/cpp/src/Ice/LocatorInfo.cpp +291 -329
  206. data/dist/ice/cpp/src/Ice/LocatorInfo.h +144 -157
  207. data/dist/ice/cpp/src/Ice/LocatorInfoF.h +8 -17
  208. data/dist/ice/cpp/src/Ice/LoggerAdminI.cpp +561 -743
  209. data/dist/ice/cpp/src/Ice/LoggerAdminI.h +18 -28
  210. data/dist/ice/cpp/src/Ice/LoggerI.cpp +66 -91
  211. data/dist/ice/cpp/src/Ice/LoggerI.h +36 -41
  212. data/dist/ice/cpp/src/Ice/LoggerMiddleware.cpp +176 -0
  213. data/dist/ice/cpp/src/Ice/LoggerMiddleware.h +42 -0
  214. data/dist/ice/cpp/src/Ice/LoggerUtil.cpp +14 -38
  215. data/dist/ice/cpp/src/Ice/MarshaledResult.cpp +20 -0
  216. data/dist/ice/cpp/src/Ice/MetricsAdminI.cpp +194 -280
  217. data/dist/ice/cpp/src/Ice/MetricsAdminI.h +600 -0
  218. data/dist/ice/cpp/src/Ice/MetricsFunctional.h +92 -0
  219. data/dist/ice/cpp/src/Ice/MetricsObserverI.h +587 -0
  220. data/dist/ice/cpp/src/Ice/NativePropertiesAdmin.cpp +185 -0
  221. data/dist/ice/cpp/src/Ice/Network.cpp +595 -917
  222. data/dist/ice/cpp/src/Ice/Network.h +189 -213
  223. data/dist/ice/cpp/src/Ice/NetworkF.h +2 -10
  224. data/dist/ice/cpp/src/Ice/NetworkProxy.cpp +99 -104
  225. data/dist/ice/cpp/src/Ice/NetworkProxy.h +49 -54
  226. data/dist/ice/cpp/src/Ice/NetworkProxyF.h +4 -11
  227. data/dist/ice/cpp/src/Ice/OSLogLoggerI.cpp +16 -18
  228. data/dist/ice/cpp/src/Ice/OSLogLoggerI.h +22 -27
  229. data/dist/ice/cpp/src/Ice/Object.cpp +152 -338
  230. data/dist/ice/cpp/src/Ice/ObjectAdapterFactory.cpp +170 -113
  231. data/dist/ice/cpp/src/Ice/ObjectAdapterFactory.h +41 -41
  232. data/dist/ice/cpp/src/Ice/ObjectAdapterFactoryF.h +4 -15
  233. data/dist/ice/cpp/src/Ice/ObjectAdapterI.cpp +580 -727
  234. data/dist/ice/cpp/src/Ice/ObjectAdapterI.h +149 -145
  235. data/dist/ice/cpp/src/Ice/ObserverHelper.cpp +36 -17
  236. data/dist/ice/cpp/src/Ice/ObserverMiddleware.cpp +96 -0
  237. data/dist/ice/cpp/src/Ice/ObserverMiddleware.h +25 -0
  238. data/dist/ice/cpp/src/Ice/OpaqueEndpointI.cpp +147 -187
  239. data/dist/ice/cpp/src/Ice/OpaqueEndpointI.h +56 -64
  240. data/dist/ice/cpp/src/{IceUtil → Ice}/Options.cpp +187 -258
  241. data/dist/ice/cpp/src/Ice/Options.h +119 -0
  242. data/dist/ice/cpp/src/Ice/OutgoingAsync.cpp +516 -732
  243. data/dist/ice/cpp/src/Ice/OutgoingResponse.cpp +276 -0
  244. data/dist/ice/cpp/src/Ice/OutputStream.cpp +610 -543
  245. data/dist/ice/cpp/src/Ice/OutputUtil.cpp +344 -0
  246. data/dist/ice/cpp/src/Ice/OutputUtil.h +173 -0
  247. data/dist/ice/cpp/src/Ice/PluginManagerI.cpp +118 -277
  248. data/dist/ice/cpp/src/Ice/PluginManagerI.h +41 -48
  249. data/dist/ice/cpp/src/Ice/Properties.cpp +931 -0
  250. data/dist/ice/cpp/src/Ice/PropertyNames.cpp +519 -1341
  251. data/dist/ice/cpp/src/Ice/PropertyNames.h +49 -64
  252. data/dist/ice/cpp/src/Ice/PropertyUtil.cpp +103 -0
  253. data/dist/ice/cpp/src/Ice/PropertyUtil.h +31 -0
  254. data/dist/ice/cpp/src/Ice/Protocol.cpp +129 -94
  255. data/dist/ice/cpp/src/Ice/Protocol.h +116 -0
  256. data/dist/ice/cpp/src/Ice/ProtocolInstance.cpp +117 -62
  257. data/dist/ice/cpp/src/Ice/ProtocolInstance.h +63 -82
  258. data/dist/ice/cpp/src/Ice/ProtocolInstanceF.h +4 -11
  259. data/dist/ice/cpp/src/Ice/ProtocolPluginFacade.cpp +10 -32
  260. data/dist/ice/cpp/src/Ice/ProtocolPluginFacade.h +25 -54
  261. data/dist/ice/cpp/src/Ice/Proxy.cpp +294 -1357
  262. data/dist/ice/cpp/src/Ice/ProxyAsync.cpp +684 -0
  263. data/dist/ice/cpp/src/Ice/ProxyFunctions.cpp +90 -0
  264. data/dist/ice/cpp/src/Ice/PushDisableDeprecatedWarnings.h +15 -0
  265. data/dist/ice/cpp/src/Ice/Random.cpp +29 -0
  266. data/dist/ice/cpp/src/Ice/Random.h +23 -0
  267. data/dist/ice/cpp/src/Ice/Reference.cpp +635 -1097
  268. data/dist/ice/cpp/src/Ice/Reference.h +314 -298
  269. data/dist/ice/cpp/src/Ice/ReferenceFactory.cpp +320 -378
  270. data/dist/ice/cpp/src/Ice/ReferenceFactory.h +48 -66
  271. data/dist/ice/cpp/src/Ice/ReferenceFactoryF.h +4 -9
  272. data/dist/ice/cpp/src/Ice/RequestHandler.cpp +15 -24
  273. data/dist/ice/cpp/src/Ice/RequestHandler.h +43 -68
  274. data/dist/ice/cpp/src/Ice/RequestHandlerCache.cpp +76 -0
  275. data/dist/ice/cpp/src/Ice/RequestHandlerCache.h +33 -0
  276. data/dist/ice/cpp/src/Ice/ResourceConfig.h +27 -0
  277. data/dist/ice/cpp/src/Ice/RetryQueue.cpp +51 -57
  278. data/dist/ice/cpp/src/Ice/RetryQueue.h +39 -46
  279. data/dist/ice/cpp/src/Ice/RetryQueueF.h +4 -9
  280. data/dist/ice/cpp/src/Ice/RouterInfo.cpp +97 -201
  281. data/dist/ice/cpp/src/Ice/RouterInfo.h +61 -118
  282. data/dist/ice/cpp/src/Ice/RouterInfoF.h +6 -14
  283. data/dist/ice/cpp/src/Ice/SHA1.cpp +86 -60
  284. data/dist/ice/cpp/src/Ice/SHA1.h +35 -0
  285. data/dist/ice/cpp/src/Ice/SSL/DistinguishedName.cpp +89 -0
  286. data/dist/ice/cpp/src/Ice/SSL/DistinguishedName.h +87 -0
  287. data/dist/ice/cpp/src/Ice/SSL/OpenSSLEngine.cpp +521 -0
  288. data/dist/ice/cpp/src/Ice/SSL/OpenSSLEngine.h +40 -0
  289. data/dist/ice/cpp/src/Ice/SSL/OpenSSLEngineF.h +13 -0
  290. data/dist/ice/cpp/src/Ice/SSL/OpenSSLTransceiverI.cpp +646 -0
  291. data/dist/ice/cpp/src/Ice/SSL/OpenSSLTransceiverI.h +80 -0
  292. data/dist/ice/cpp/src/{IceSSL → Ice/SSL}/RFC2253.cpp +85 -88
  293. data/dist/ice/cpp/src/Ice/SSL/RFC2253.h +58 -0
  294. data/dist/ice/cpp/src/Ice/SSL/SSLAcceptorI.cpp +124 -0
  295. data/dist/ice/cpp/src/Ice/SSL/SSLAcceptorI.h +52 -0
  296. data/dist/ice/cpp/src/Ice/SSL/SSLConnectorI.cpp +92 -0
  297. data/dist/ice/cpp/src/Ice/SSL/SSLConnectorI.h +38 -0
  298. data/dist/ice/cpp/src/Ice/SSL/SSLEndpointI.cpp +377 -0
  299. data/dist/ice/cpp/src/Ice/SSL/SSLEndpointI.h +84 -0
  300. data/dist/ice/cpp/src/Ice/SSL/SSLEngine.cpp +115 -0
  301. data/dist/ice/cpp/src/Ice/SSL/SSLEngine.h +69 -0
  302. data/dist/ice/cpp/src/Ice/SSL/SSLEngineF.h +14 -0
  303. data/dist/ice/cpp/src/Ice/SSL/SSLException.cpp +18 -0
  304. data/dist/ice/cpp/src/Ice/SSL/SSLInstance.cpp +27 -0
  305. data/dist/ice/cpp/src/Ice/SSL/SSLInstance.h +26 -0
  306. data/dist/ice/cpp/src/Ice/SSL/SSLInstanceF.h +19 -0
  307. data/dist/ice/cpp/src/Ice/SSL/SSLUtil.cpp +673 -0
  308. data/dist/ice/cpp/src/Ice/SSL/SSLUtil.h +118 -0
  309. data/dist/ice/cpp/src/Ice/SSL/SchannelEngine.cpp +1449 -0
  310. data/dist/ice/cpp/src/Ice/SSL/SchannelEngine.h +58 -0
  311. data/dist/ice/cpp/src/Ice/SSL/SchannelEngineF.h +18 -0
  312. data/dist/ice/cpp/src/Ice/SSL/SchannelTransceiverI.cpp +1088 -0
  313. data/dist/ice/cpp/src/Ice/SSL/SchannelTransceiverI.h +118 -0
  314. data/dist/ice/cpp/src/Ice/SSL/SecureTransportEngine.cpp +825 -0
  315. data/dist/ice/cpp/src/Ice/SSL/SecureTransportEngine.h +44 -0
  316. data/dist/ice/cpp/src/Ice/SSL/SecureTransportEngineF.h +18 -0
  317. data/dist/ice/cpp/src/Ice/SSL/SecureTransportTransceiverI.cpp +621 -0
  318. data/dist/ice/cpp/src/Ice/SSL/SecureTransportTransceiverI.h +91 -0
  319. data/dist/ice/cpp/src/Ice/SSL/SecureTransportUtil.cpp +1048 -0
  320. data/dist/ice/cpp/src/Ice/SSL/SecureTransportUtil.h +40 -0
  321. data/dist/ice/cpp/src/Ice/SSL/TrustManager.cpp +233 -0
  322. data/dist/ice/cpp/src/Ice/SSL/TrustManager.h +42 -0
  323. data/dist/ice/cpp/src/Ice/SSL/TrustManagerF.h +14 -0
  324. data/dist/ice/cpp/src/Ice/ScannerConfig.h +35 -0
  325. data/dist/ice/cpp/src/Ice/Selector.cpp +341 -606
  326. data/dist/ice/cpp/src/Ice/Selector.h +167 -224
  327. data/dist/ice/cpp/src/Ice/ServantManager.cpp +195 -128
  328. data/dist/ice/cpp/src/Ice/ServantManager.h +52 -55
  329. data/dist/ice/cpp/src/Ice/ServantManagerF.h +14 -0
  330. data/dist/ice/cpp/src/Ice/Service.cpp +548 -641
  331. data/dist/ice/cpp/src/Ice/SharedContext.h +13 -26
  332. data/dist/ice/cpp/src/Ice/SliceLoader.cpp +53 -0
  333. data/dist/ice/cpp/src/Ice/SlicedData.cpp +17 -96
  334. data/dist/ice/cpp/src/Ice/StreamSocket.cpp +104 -151
  335. data/dist/ice/cpp/src/Ice/StreamSocket.h +48 -60
  336. data/dist/ice/cpp/src/Ice/StringConverter.cpp +586 -0
  337. data/dist/ice/cpp/src/Ice/StringUtil.cpp +1137 -0
  338. data/dist/ice/cpp/src/Ice/SysLoggerI.cpp +41 -47
  339. data/dist/ice/cpp/src/Ice/SysLoggerI.h +24 -27
  340. data/dist/ice/cpp/src/Ice/SystemdJournalI.cpp +16 -17
  341. data/dist/ice/cpp/src/Ice/SystemdJournalI.h +19 -25
  342. data/dist/ice/cpp/src/Ice/TargetCompare.h +96 -0
  343. data/dist/ice/cpp/src/Ice/TcpAcceptor.cpp +67 -88
  344. data/dist/ice/cpp/src/Ice/TcpAcceptor.h +34 -40
  345. data/dist/ice/cpp/src/Ice/TcpConnector.cpp +42 -41
  346. data/dist/ice/cpp/src/Ice/TcpConnector.h +26 -35
  347. data/dist/ice/cpp/src/Ice/TcpEndpointI.cpp +172 -146
  348. data/dist/ice/cpp/src/Ice/TcpEndpointI.h +76 -80
  349. data/dist/ice/cpp/src/Ice/TcpTransceiver.cpp +38 -26
  350. data/dist/ice/cpp/src/Ice/TcpTransceiver.h +40 -45
  351. data/dist/ice/cpp/src/Ice/ThreadPool.cpp +333 -515
  352. data/dist/ice/cpp/src/Ice/ThreadPool.h +202 -290
  353. data/dist/ice/cpp/src/Ice/ThreadPoolF.h +14 -0
  354. data/dist/ice/cpp/src/Ice/TimeUtil.cpp +47 -0
  355. data/dist/ice/cpp/src/Ice/TimeUtil.h +21 -0
  356. data/dist/ice/cpp/src/Ice/Timer.cpp +73 -167
  357. data/dist/ice/cpp/src/Ice/Timer.h +212 -0
  358. data/dist/ice/cpp/src/Ice/TraceLevels.cpp +11 -29
  359. data/dist/ice/cpp/src/Ice/TraceLevels.h +22 -28
  360. data/dist/ice/cpp/src/Ice/TraceLevelsF.h +4 -11
  361. data/dist/ice/cpp/src/Ice/TraceUtil.cpp +136 -215
  362. data/dist/ice/cpp/src/Ice/TraceUtil.h +27 -16
  363. data/dist/ice/cpp/src/Ice/Transceiver.cpp +3 -7
  364. data/dist/ice/cpp/src/Ice/Transceiver.h +35 -32
  365. data/dist/ice/cpp/src/Ice/TransceiverF.h +10 -20
  366. data/dist/ice/cpp/src/Ice/UUID.cpp +79 -0
  367. data/dist/ice/cpp/src/Ice/UdpConnector.cpp +39 -39
  368. data/dist/ice/cpp/src/Ice/UdpConnector.h +27 -36
  369. data/dist/ice/cpp/src/Ice/UdpEndpointI.cpp +178 -213
  370. data/dist/ice/cpp/src/Ice/UdpEndpointI.h +82 -85
  371. data/dist/ice/cpp/src/Ice/UdpTransceiver.cpp +201 -221
  372. data/dist/ice/cpp/src/Ice/UdpTransceiver.h +68 -74
  373. data/dist/ice/cpp/{include/IceUtil → src/Ice}/UndefSysMacros.h +12 -12
  374. data/dist/ice/cpp/src/Ice/UniqueRef.h +77 -0
  375. data/dist/ice/cpp/src/Ice/UserException.cpp +58 -0
  376. data/dist/ice/cpp/src/Ice/Value.cpp +107 -38
  377. data/dist/ice/cpp/src/Ice/WSAcceptor.cpp +10 -15
  378. data/dist/ice/cpp/src/Ice/WSAcceptor.h +31 -37
  379. data/dist/ice/cpp/src/Ice/WSConnector.cpp +25 -40
  380. data/dist/ice/cpp/src/Ice/WSConnector.h +26 -33
  381. data/dist/ice/cpp/src/Ice/WSEndpoint.cpp +164 -217
  382. data/dist/ice/cpp/src/Ice/WSEndpoint.h +72 -83
  383. data/dist/ice/cpp/src/Ice/WSTransceiver.cpp +469 -458
  384. data/dist/ice/cpp/src/Ice/WSTransceiver.h +117 -123
  385. data/dist/ice/cpp/src/Ice/generated/BuiltinSequences.cpp +20 -29
  386. data/dist/ice/cpp/src/Ice/generated/Context.cpp +40 -0
  387. data/dist/ice/cpp/src/Ice/generated/EndpointTypes.cpp +20 -31
  388. data/dist/ice/cpp/src/Ice/generated/Identity.cpp +24 -34
  389. data/dist/ice/cpp/src/Ice/generated/Locator.cpp +454 -1744
  390. data/dist/ice/cpp/src/Ice/generated/LocatorRegistry.cpp +577 -0
  391. data/dist/ice/cpp/src/Ice/generated/Metrics.cpp +824 -1971
  392. data/dist/ice/cpp/src/Ice/generated/OperationMode.cpp +56 -0
  393. data/dist/ice/cpp/src/Ice/generated/Process.cpp +190 -331
  394. data/dist/ice/cpp/src/Ice/generated/PropertiesAdmin.cpp +289 -449
  395. data/dist/ice/cpp/src/Ice/generated/PropertyDict.cpp +40 -0
  396. data/dist/ice/cpp/src/Ice/generated/RemoteLogger.cpp +547 -867
  397. data/dist/ice/cpp/src/Ice/generated/ReplyStatus.cpp +70 -0
  398. data/dist/ice/cpp/src/Ice/generated/Router.cpp +406 -723
  399. data/dist/ice/cpp/src/Ice/generated/SliceChecksumDict.cpp +19 -29
  400. data/dist/ice/cpp/src/Ice/generated/Version.cpp +28 -31
  401. data/dist/ice/cpp/src/IceDiscovery/LocatorI.cpp +76 -139
  402. data/dist/ice/cpp/src/IceDiscovery/LocatorI.h +55 -96
  403. data/dist/ice/cpp/src/IceDiscovery/LookupI.cpp +190 -303
  404. data/dist/ice/cpp/src/IceDiscovery/LookupI.h +126 -185
  405. data/dist/ice/cpp/src/IceDiscovery/PluginI.cpp +56 -77
  406. data/dist/ice/cpp/src/IceDiscovery/PluginI.h +20 -25
  407. data/dist/ice/cpp/src/IceDiscovery/generated/Lookup.cpp +638 -0
  408. data/dist/ice/cpp/src/IceLocatorDiscovery/Plugin.h +14 -37
  409. data/dist/ice/cpp/src/IceLocatorDiscovery/PluginI.cpp +411 -649
  410. data/dist/ice/cpp/src/IceLocatorDiscovery/generated/Lookup.cpp +468 -0
  411. data/dist/ice/cpp/src/Slice/DeprecationReporter.cpp +172 -0
  412. data/dist/ice/cpp/src/Slice/DeprecationReporter.h +14 -0
  413. data/dist/ice/cpp/src/Slice/DocCommentParser.cpp +736 -0
  414. data/dist/ice/cpp/src/Slice/DocCommentParser.h +61 -0
  415. data/dist/ice/cpp/src/Slice/FileTracker.cpp +25 -75
  416. data/dist/ice/cpp/src/Slice/FileTracker.h +35 -56
  417. data/dist/ice/cpp/src/Slice/Grammar.cpp +2711 -3382
  418. data/dist/ice/cpp/src/Slice/Grammar.h +95 -75
  419. data/dist/ice/cpp/src/Slice/GrammarUtil.h +117 -217
  420. data/dist/ice/cpp/src/Slice/MetadataValidation.cpp +486 -0
  421. data/dist/ice/cpp/src/Slice/MetadataValidation.h +106 -0
  422. data/dist/ice/cpp/src/Slice/Parser.cpp +3068 -5223
  423. data/dist/ice/cpp/src/Slice/Parser.h +1086 -1065
  424. data/dist/ice/cpp/src/Slice/Preprocessor.cpp +97 -599
  425. data/dist/ice/cpp/src/Slice/Preprocessor.h +26 -42
  426. data/dist/ice/cpp/src/Slice/Scanner.cpp +1562 -924
  427. data/dist/ice/cpp/src/Slice/SliceUtil.cpp +517 -113
  428. data/dist/ice/cpp/src/Slice/StringLiteralUtil.cpp +254 -269
  429. data/dist/ice/cpp/src/Slice/Util.h +126 -35
  430. data/dist/ice/cpp/src/slice2rb/Main.cpp +13 -15
  431. data/dist/ice/cpp/src/slice2rb/Ruby.cpp +250 -0
  432. data/dist/ice/cpp/src/slice2rb/RubyUtil.cpp +1197 -0
  433. data/dist/ice/cpp/src/slice2rb/RubyUtil.h +56 -0
  434. data/dist/ice/slice/Glacier2/Metrics.ice +34 -75
  435. data/dist/ice/slice/Glacier2/PermissionsVerifier.ice +42 -98
  436. data/dist/ice/slice/Glacier2/Router.ice +80 -173
  437. data/dist/ice/slice/Glacier2/SSLInfo.ice +23 -40
  438. data/dist/ice/slice/Glacier2/Session.ice +120 -261
  439. data/dist/ice/slice/Ice/BuiltinSequences.ice +33 -38
  440. data/dist/ice/slice/Ice/Context.ice +24 -0
  441. data/dist/ice/slice/Ice/EndpointTypes.ice +35 -33
  442. data/dist/ice/slice/Ice/Identity.ice +24 -63
  443. data/dist/ice/slice/Ice/Locator.ice +61 -226
  444. data/dist/ice/slice/Ice/LocatorRegistry.ice +77 -0
  445. data/dist/ice/slice/Ice/Metrics.ice +189 -424
  446. data/dist/ice/slice/Ice/OperationMode.ice +38 -0
  447. data/dist/ice/slice/Ice/Process.ice +16 -52
  448. data/dist/ice/slice/Ice/PropertiesAdmin.ice +25 -75
  449. data/dist/ice/slice/Ice/PropertyDict.ice +23 -0
  450. data/dist/ice/slice/Ice/RemoteLogger.ice +113 -213
  451. data/dist/ice/slice/Ice/ReplyStatus.ice +65 -0
  452. data/dist/ice/slice/Ice/Router.ice +42 -91
  453. data/dist/ice/slice/Ice/SliceChecksumDict.ice +7 -25
  454. data/dist/ice/slice/Ice/Version.ice +31 -39
  455. data/dist/ice/slice/IceBox/ServiceManager.ice +79 -0
  456. data/dist/ice/slice/IceGrid/Admin.ice +942 -1918
  457. data/dist/ice/slice/IceGrid/Descriptor.ice +476 -1051
  458. data/dist/ice/slice/IceGrid/Exception.ice +86 -384
  459. data/dist/ice/slice/IceGrid/FileParser.ice +23 -59
  460. data/dist/ice/slice/IceGrid/Registry.ice +117 -256
  461. data/dist/ice/slice/IceGrid/Session.ice +46 -110
  462. data/dist/ice/slice/IceGrid/UserAccountMapper.ice +22 -57
  463. data/dist/ice/slice/IceStorm/IceStorm.ice +173 -401
  464. data/dist/ice/slice/IceStorm/Metrics.ice +28 -70
  465. data/dist/lib/Glacier2/Metrics.rb +16 -31
  466. data/dist/lib/Glacier2/PermissionsVerifier.rb +18 -50
  467. data/dist/lib/Glacier2/Router.rb +20 -42
  468. data/dist/lib/Glacier2/SSLInfo.rb +14 -22
  469. data/dist/lib/Glacier2/Session.rb +53 -113
  470. data/dist/lib/Glacier2.rb +6 -6
  471. data/dist/lib/Ice/BuiltinSequences.rb +14 -26
  472. data/dist/lib/Ice/CompressBatch.rb +50 -0
  473. data/dist/lib/Ice/Context.rb +12 -0
  474. data/dist/lib/Ice/EndpointSelectionType.rb +49 -0
  475. data/dist/lib/Ice/EndpointTypes.rb +14 -55
  476. data/dist/lib/Ice/Exception.rb +20 -0
  477. data/dist/lib/Ice/Identity.rb +10 -26
  478. data/dist/lib/Ice/IdentitySpaceship.rb +16 -0
  479. data/dist/lib/Ice/InitializationData.rb +12 -0
  480. data/dist/lib/Ice/LocalExceptions.rb +168 -0
  481. data/dist/lib/Ice/Locator.rb +21 -134
  482. data/dist/lib/Ice/LocatorRegistry.rb +73 -0
  483. data/dist/lib/Ice/Metrics.rb +85 -132
  484. data/dist/lib/Ice/OperationMode.rb +58 -0
  485. data/dist/lib/Ice/Process.rb +12 -31
  486. data/dist/lib/Ice/PropertiesAdmin.rb +12 -36
  487. data/dist/lib/Ice/PropertyDict.rb +12 -0
  488. data/dist/lib/Ice/Proxy.rb +85 -0
  489. data/dist/lib/Ice/ProxyFunctions.rb +69 -0
  490. data/dist/lib/Ice/RemoteLogger.rb +29 -60
  491. data/dist/lib/Ice/ReplyStatus.rb +65 -0
  492. data/dist/lib/Ice/Router.rb +19 -47
  493. data/dist/lib/Ice/SliceChecksumDict.rb +5 -17
  494. data/dist/lib/Ice/SliceUtil.rb +41 -0
  495. data/dist/lib/Ice/Struct.rb +11 -0
  496. data/dist/lib/Ice/ToStringMode.rb +50 -0
  497. data/dist/lib/Ice/Value.rb +93 -0
  498. data/dist/lib/Ice/Version.rb +12 -24
  499. data/dist/lib/Ice.rb +29 -665
  500. data/dist/lib/IceBox/ServiceManager.rb +104 -0
  501. data/dist/lib/IceBox.rb +2 -4
  502. data/dist/lib/IceGrid/Admin.rb +303 -291
  503. data/dist/lib/IceGrid/Descriptor.rb +147 -192
  504. data/dist/lib/IceGrid/Exception.rb +26 -257
  505. data/dist/lib/IceGrid/FileParser.rb +12 -36
  506. data/dist/lib/IceGrid/Registry.rb +35 -76
  507. data/dist/lib/IceGrid/Session.rb +19 -34
  508. data/dist/lib/IceGrid/UserAccountMapper.rb +11 -34
  509. data/dist/lib/IceGrid.rb +3 -3
  510. data/dist/lib/IceStorm/IceStorm.rb +51 -132
  511. data/dist/lib/IceStorm/Metrics.rb +19 -37
  512. data/dist/lib/IceStorm.rb +3 -5
  513. data/extconf.rb +6 -8
  514. data/ice.gemspec +3 -3
  515. data/scripts/slice2rb +1 -3
  516. metadata +206 -386
  517. data/dist/IceRuby/ValueFactoryManager.cpp +0 -445
  518. data/dist/IceRuby/ValueFactoryManager.h +0 -95
  519. data/dist/ice/cpp/include/Ice/Application.h +0 -326
  520. data/dist/ice/cpp/include/Ice/AsyncResult.h +0 -155
  521. data/dist/ice/cpp/include/Ice/AsyncResultF.h +0 -23
  522. data/dist/ice/cpp/include/Ice/BatchRequestInterceptor.h +0 -75
  523. data/dist/ice/cpp/include/Ice/CommunicatorAsync.h +0 -154
  524. data/dist/ice/cpp/include/Ice/Comparable.h +0 -205
  525. data/dist/ice/cpp/include/Ice/ConnectionAsync.h +0 -302
  526. data/dist/ice/cpp/include/Ice/ConsoleUtil.h +0 -23
  527. data/dist/ice/cpp/include/Ice/DefaultValueFactory.h +0 -57
  528. data/dist/ice/cpp/include/Ice/DispatchInterceptor.h +0 -41
  529. data/dist/ice/cpp/include/Ice/Dispatcher.h +0 -67
  530. data/dist/ice/cpp/include/Ice/DynamicLibrary.h +0 -102
  531. data/dist/ice/cpp/include/Ice/DynamicLibraryF.h +0 -24
  532. data/dist/ice/cpp/include/Ice/ExceptionHelpers.h +0 -74
  533. data/dist/ice/cpp/include/Ice/FactoryTable.h +0 -73
  534. data/dist/ice/cpp/include/Ice/FactoryTableInit.h +0 -84
  535. data/dist/ice/cpp/include/Ice/Functional.h +0 -140
  536. data/dist/ice/cpp/include/Ice/GCObject.h +0 -76
  537. data/dist/ice/cpp/include/Ice/Handle.h +0 -182
  538. data/dist/ice/cpp/include/Ice/Incoming.h +0 -225
  539. data/dist/ice/cpp/include/Ice/IncomingAsync.h +0 -186
  540. data/dist/ice/cpp/include/Ice/IncomingAsyncF.h +0 -36
  541. data/dist/ice/cpp/include/Ice/InterfaceByValue.h +0 -57
  542. data/dist/ice/cpp/include/Ice/LocalObject.h +0 -35
  543. data/dist/ice/cpp/include/Ice/LocalObjectF.h +0 -21
  544. data/dist/ice/cpp/include/Ice/MetricsAdminI.h +0 -715
  545. data/dist/ice/cpp/include/Ice/MetricsFunctional.h +0 -159
  546. data/dist/ice/cpp/include/Ice/MetricsObserverI.h +0 -669
  547. data/dist/ice/cpp/include/Ice/Optional.h +0 -1114
  548. data/dist/ice/cpp/include/Ice/OutgoingAsyncF.h +0 -39
  549. data/dist/ice/cpp/include/Ice/Protocol.h +0 -274
  550. data/dist/ice/cpp/include/Ice/ProxyFactoryF.h +0 -21
  551. data/dist/ice/cpp/include/Ice/ProxyHandle.h +0 -318
  552. data/dist/ice/cpp/include/Ice/RegisterPlugins.h +0 -127
  553. data/dist/ice/cpp/include/Ice/ResponseHandlerF.h +0 -25
  554. data/dist/ice/cpp/include/Ice/SHA1.h +0 -40
  555. data/dist/ice/cpp/include/Ice/ServantManagerF.h +0 -21
  556. data/dist/ice/cpp/include/Ice/SliceChecksums.h +0 -33
  557. data/dist/ice/cpp/include/Ice/ThreadPoolF.h +0 -23
  558. data/dist/ice/cpp/include/Ice/UniquePtr.h +0 -95
  559. data/dist/ice/cpp/include/Ice/UniqueRef.h +0 -97
  560. data/dist/ice/cpp/include/IceSSL/Config.h +0 -21
  561. data/dist/ice/cpp/include/IceSSL/IceSSL.h +0 -24
  562. data/dist/ice/cpp/include/IceSSL/OpenSSL.h +0 -147
  563. data/dist/ice/cpp/include/IceSSL/Plugin.h +0 -712
  564. data/dist/ice/cpp/include/IceSSL/SChannel.h +0 -72
  565. data/dist/ice/cpp/include/IceSSL/SecureTransport.h +0 -72
  566. data/dist/ice/cpp/include/IceUtil/Atomic.h +0 -179
  567. data/dist/ice/cpp/include/IceUtil/Cond.h +0 -317
  568. data/dist/ice/cpp/include/IceUtil/Config.h +0 -392
  569. data/dist/ice/cpp/include/IceUtil/ConsoleUtil.h +0 -92
  570. data/dist/ice/cpp/include/IceUtil/CountDownLatch.h +0 -45
  571. data/dist/ice/cpp/include/IceUtil/CtrlCHandler.h +0 -96
  572. data/dist/ice/cpp/include/IceUtil/DisableWarnings.h +0 -44
  573. data/dist/ice/cpp/include/IceUtil/Exception.h +0 -394
  574. data/dist/ice/cpp/include/IceUtil/FileUtil.h +0 -140
  575. data/dist/ice/cpp/include/IceUtil/Functional.h +0 -389
  576. data/dist/ice/cpp/include/IceUtil/Handle.h +0 -261
  577. data/dist/ice/cpp/include/IceUtil/IceUtil.h +0 -40
  578. data/dist/ice/cpp/include/IceUtil/InputUtil.h +0 -42
  579. data/dist/ice/cpp/include/IceUtil/Iterator.h +0 -31
  580. data/dist/ice/cpp/include/IceUtil/Lock.h +0 -128
  581. data/dist/ice/cpp/include/IceUtil/Monitor.h +0 -243
  582. data/dist/ice/cpp/include/IceUtil/Mutex.h +0 -349
  583. data/dist/ice/cpp/include/IceUtil/MutexProtocol.h +0 -23
  584. data/dist/ice/cpp/include/IceUtil/MutexPtrLock.h +0 -78
  585. data/dist/ice/cpp/include/IceUtil/MutexPtrTryLock.h +0 -77
  586. data/dist/ice/cpp/include/IceUtil/Optional.h +0 -433
  587. data/dist/ice/cpp/include/IceUtil/Options.h +0 -135
  588. data/dist/ice/cpp/include/IceUtil/OutputUtil.h +0 -383
  589. data/dist/ice/cpp/include/IceUtil/PushDisableWarnings.h +0 -33
  590. data/dist/ice/cpp/include/IceUtil/Random.h +0 -55
  591. data/dist/ice/cpp/include/IceUtil/RecMutex.h +0 -107
  592. data/dist/ice/cpp/include/IceUtil/ResourceConfig.h +0 -37
  593. data/dist/ice/cpp/include/IceUtil/ScannerConfig.h +0 -40
  594. data/dist/ice/cpp/include/IceUtil/ScopedArray.h +0 -98
  595. data/dist/ice/cpp/include/IceUtil/Shared.h +0 -127
  596. data/dist/ice/cpp/include/IceUtil/StopWatch.h +0 -49
  597. data/dist/ice/cpp/include/IceUtil/StringConverter.h +0 -195
  598. data/dist/ice/cpp/include/IceUtil/StringUtil.h +0 -97
  599. data/dist/ice/cpp/include/IceUtil/Thread.h +0 -160
  600. data/dist/ice/cpp/include/IceUtil/ThreadException.h +0 -94
  601. data/dist/ice/cpp/include/IceUtil/Time.h +0 -205
  602. data/dist/ice/cpp/include/IceUtil/Timer.h +0 -153
  603. data/dist/ice/cpp/include/IceUtil/UUID.h +0 -21
  604. data/dist/ice/cpp/include/generated/Glacier2/Metrics.h +0 -475
  605. data/dist/ice/cpp/include/generated/Glacier2/PermissionsVerifier.h +0 -1430
  606. data/dist/ice/cpp/include/generated/Glacier2/PermissionsVerifierF.h +0 -147
  607. data/dist/ice/cpp/include/generated/Glacier2/Router.h +0 -3260
  608. data/dist/ice/cpp/include/generated/Glacier2/RouterF.h +0 -125
  609. data/dist/ice/cpp/include/generated/Glacier2/SSLInfo.h +0 -223
  610. data/dist/ice/cpp/include/generated/Glacier2/Session.h +0 -5894
  611. data/dist/ice/cpp/include/generated/Ice/Communicator.h +0 -1162
  612. data/dist/ice/cpp/include/generated/Ice/CommunicatorF.h +0 -101
  613. data/dist/ice/cpp/include/generated/Ice/Connection.h +0 -1703
  614. data/dist/ice/cpp/include/generated/Ice/ConnectionF.h +0 -119
  615. data/dist/ice/cpp/include/generated/Ice/Current.h +0 -322
  616. data/dist/ice/cpp/include/generated/Ice/Endpoint.h +0 -979
  617. data/dist/ice/cpp/include/generated/Ice/EndpointF.h +0 -166
  618. data/dist/ice/cpp/include/generated/Ice/FacetMap.h +0 -80
  619. data/dist/ice/cpp/include/generated/Ice/ImplicitContext.h +0 -284
  620. data/dist/ice/cpp/include/generated/Ice/ImplicitContextF.h +0 -101
  621. data/dist/ice/cpp/include/generated/Ice/Instrumentation.h +0 -1203
  622. data/dist/ice/cpp/include/generated/Ice/InstrumentationF.h +0 -128
  623. data/dist/ice/cpp/include/generated/Ice/LocalException.h +0 -7437
  624. data/dist/ice/cpp/include/generated/Ice/LocatorF.h +0 -147
  625. data/dist/ice/cpp/include/generated/Ice/Logger.h +0 -237
  626. data/dist/ice/cpp/include/generated/Ice/LoggerF.h +0 -101
  627. data/dist/ice/cpp/include/generated/Ice/ObjectAdapter.h +0 -1181
  628. data/dist/ice/cpp/include/generated/Ice/ObjectAdapterF.h +0 -101
  629. data/dist/ice/cpp/include/generated/Ice/ObjectFactory.h +0 -203
  630. data/dist/ice/cpp/include/generated/Ice/Plugin.h +0 -318
  631. data/dist/ice/cpp/include/generated/Ice/PluginF.h +0 -110
  632. data/dist/ice/cpp/include/generated/Ice/ProcessF.h +0 -125
  633. data/dist/ice/cpp/include/generated/Ice/Properties.h +0 -452
  634. data/dist/ice/cpp/include/generated/Ice/PropertiesF.h +0 -134
  635. data/dist/ice/cpp/include/generated/Ice/RouterF.h +0 -125
  636. data/dist/ice/cpp/include/generated/Ice/ServantLocator.h +0 -305
  637. data/dist/ice/cpp/include/generated/Ice/ServantLocatorF.h +0 -101
  638. data/dist/ice/cpp/include/generated/Ice/ValueFactory.h +0 -330
  639. data/dist/ice/cpp/include/generated/IceBox/IceBox.h +0 -3269
  640. data/dist/ice/cpp/include/generated/IceGrid/Admin.h +0 -33773
  641. data/dist/ice/cpp/include/generated/IceGrid/Descriptor.h +0 -5254
  642. data/dist/ice/cpp/include/generated/IceGrid/Exception.h +0 -2834
  643. data/dist/ice/cpp/include/generated/IceGrid/FileParser.h +0 -824
  644. data/dist/ice/cpp/include/generated/IceGrid/PluginFacade.h +0 -635
  645. data/dist/ice/cpp/include/generated/IceGrid/Registry.h +0 -5089
  646. data/dist/ice/cpp/include/generated/IceGrid/Session.h +0 -2240
  647. data/dist/ice/cpp/include/generated/IceGrid/UserAccountMapper.h +0 -800
  648. data/dist/ice/cpp/include/generated/IcePatch2/FileInfo.h +0 -325
  649. data/dist/ice/cpp/include/generated/IcePatch2/FileServer.h +0 -2891
  650. data/dist/ice/cpp/include/generated/IceSSL/ConnectionInfo.h +0 -228
  651. data/dist/ice/cpp/include/generated/IceSSL/ConnectionInfoF.h +0 -101
  652. data/dist/ice/cpp/include/generated/IceSSL/EndpointInfo.h +0 -186
  653. data/dist/ice/cpp/include/generated/IceStorm/IceStorm.h +0 -6627
  654. data/dist/ice/cpp/include/generated/IceStorm/Metrics.h +0 -665
  655. data/dist/ice/cpp/src/Ice/ACM.cpp +0 -380
  656. data/dist/ice/cpp/src/Ice/ACM.h +0 -119
  657. data/dist/ice/cpp/src/Ice/ACMF.h +0 -30
  658. data/dist/ice/cpp/src/Ice/Acceptor.cpp +0 -16
  659. data/dist/ice/cpp/src/Ice/Application.cpp +0 -661
  660. data/dist/ice/cpp/src/Ice/AsyncResult.cpp +0 -70
  661. data/dist/ice/cpp/src/Ice/CommunicatorI.cpp +0 -586
  662. data/dist/ice/cpp/src/Ice/CommunicatorI.h +0 -167
  663. data/dist/ice/cpp/src/Ice/Cond.cpp +0 -381
  664. data/dist/ice/cpp/src/Ice/ConnectionRequestHandler.cpp +0 -73
  665. data/dist/ice/cpp/src/Ice/ConnectionRequestHandler.h +0 -41
  666. data/dist/ice/cpp/src/Ice/Connector.cpp +0 -16
  667. data/dist/ice/cpp/src/Ice/CountDownLatch.cpp +0 -171
  668. data/dist/ice/cpp/src/Ice/DispatchInterceptor.cpp +0 -37
  669. data/dist/ice/cpp/src/Ice/FactoryTable.cpp +0 -162
  670. data/dist/ice/cpp/src/Ice/FactoryTableInit.cpp +0 -88
  671. data/dist/ice/cpp/src/Ice/GCObject.cpp +0 -442
  672. data/dist/ice/cpp/src/Ice/IconvStringConverter.cpp +0 -51
  673. data/dist/ice/cpp/src/Ice/ImplicitContextI.cpp +0 -655
  674. data/dist/ice/cpp/src/Ice/ImplicitContextI.h +0 -48
  675. data/dist/ice/cpp/src/Ice/Incoming.cpp +0 -795
  676. data/dist/ice/cpp/src/Ice/IncomingAsync.cpp +0 -230
  677. data/dist/ice/cpp/src/Ice/IncomingRequest.h +0 -33
  678. data/dist/ice/cpp/src/Ice/LocalObject.cpp +0 -23
  679. data/dist/ice/cpp/src/Ice/MetricsObserverI.cpp +0 -8
  680. data/dist/ice/cpp/src/Ice/PropertiesAdminI.cpp +0 -265
  681. data/dist/ice/cpp/src/Ice/PropertiesAdminI.h +0 -64
  682. data/dist/ice/cpp/src/Ice/PropertiesI.cpp +0 -739
  683. data/dist/ice/cpp/src/Ice/PropertiesI.h +0 -70
  684. data/dist/ice/cpp/src/Ice/ProtocolPluginFacadeF.h +0 -21
  685. data/dist/ice/cpp/src/Ice/ProxyFactory.cpp +0 -300
  686. data/dist/ice/cpp/src/Ice/ProxyFactory.h +0 -57
  687. data/dist/ice/cpp/src/Ice/RegisterPluginsInit.cpp +0 -38
  688. data/dist/ice/cpp/src/Ice/RegisterPluginsInit.h +0 -20
  689. data/dist/ice/cpp/src/Ice/ReplyStatus.h +0 -24
  690. data/dist/ice/cpp/src/Ice/RequestHandlerFactory.cpp +0 -77
  691. data/dist/ice/cpp/src/Ice/RequestHandlerFactory.h +0 -37
  692. data/dist/ice/cpp/src/Ice/ResponseHandler.cpp +0 -12
  693. data/dist/ice/cpp/src/Ice/ResponseHandler.h +0 -43
  694. data/dist/ice/cpp/src/Ice/SliceChecksums.cpp +0 -75
  695. data/dist/ice/cpp/src/Ice/StringConverterPlugin.cpp +0 -192
  696. data/dist/ice/cpp/src/Ice/StringUtil.h +0 -30
  697. data/dist/ice/cpp/src/Ice/Thread.cpp +0 -569
  698. data/dist/ice/cpp/src/Ice/ValueFactoryManagerI.cpp +0 -61
  699. data/dist/ice/cpp/src/Ice/ValueFactoryManagerI.h +0 -37
  700. data/dist/ice/cpp/src/Ice/VirtualShared.h +0 -38
  701. data/dist/ice/cpp/src/Ice/generated/Communicator.cpp +0 -79
  702. data/dist/ice/cpp/src/Ice/generated/CommunicatorF.cpp +0 -61
  703. data/dist/ice/cpp/src/Ice/generated/Connection.cpp +0 -155
  704. data/dist/ice/cpp/src/Ice/generated/ConnectionF.cpp +0 -61
  705. data/dist/ice/cpp/src/Ice/generated/Current.cpp +0 -62
  706. data/dist/ice/cpp/src/Ice/generated/Endpoint.cpp +0 -147
  707. data/dist/ice/cpp/src/Ice/generated/EndpointF.cpp +0 -61
  708. data/dist/ice/cpp/src/Ice/generated/FacetMap.cpp +0 -49
  709. data/dist/ice/cpp/src/Ice/generated/ImplicitContext.cpp +0 -75
  710. data/dist/ice/cpp/src/Ice/generated/ImplicitContextF.cpp +0 -61
  711. data/dist/ice/cpp/src/Ice/generated/Instrumentation.cpp +0 -188
  712. data/dist/ice/cpp/src/Ice/generated/InstrumentationF.cpp +0 -66
  713. data/dist/ice/cpp/src/Ice/generated/LocalException.cpp +0 -3262
  714. data/dist/ice/cpp/src/Ice/generated/LocatorF.cpp +0 -63
  715. data/dist/ice/cpp/src/Ice/generated/Logger.cpp +0 -73
  716. data/dist/ice/cpp/src/Ice/generated/LoggerF.cpp +0 -61
  717. data/dist/ice/cpp/src/Ice/generated/ObjectAdapter.cpp +0 -79
  718. data/dist/ice/cpp/src/Ice/generated/ObjectAdapterF.cpp +0 -61
  719. data/dist/ice/cpp/src/Ice/generated/ObjectFactory.cpp +0 -75
  720. data/dist/ice/cpp/src/Ice/generated/Plugin.cpp +0 -87
  721. data/dist/ice/cpp/src/Ice/generated/PluginF.cpp +0 -61
  722. data/dist/ice/cpp/src/Ice/generated/ProcessF.cpp +0 -63
  723. data/dist/ice/cpp/src/Ice/generated/Properties.cpp +0 -78
  724. data/dist/ice/cpp/src/Ice/generated/PropertiesF.cpp +0 -63
  725. data/dist/ice/cpp/src/Ice/generated/RouterF.cpp +0 -63
  726. data/dist/ice/cpp/src/Ice/generated/ServantLocator.cpp +0 -75
  727. data/dist/ice/cpp/src/Ice/generated/ServantLocatorF.cpp +0 -61
  728. data/dist/ice/cpp/src/Ice/generated/ValueFactory.cpp +0 -83
  729. data/dist/ice/cpp/src/Ice/ios/StreamAcceptor.cpp +0 -154
  730. data/dist/ice/cpp/src/Ice/ios/StreamAcceptor.h +0 -49
  731. data/dist/ice/cpp/src/Ice/ios/StreamConnector.cpp +0 -146
  732. data/dist/ice/cpp/src/Ice/ios/StreamConnector.h +0 -52
  733. data/dist/ice/cpp/src/Ice/ios/StreamEndpointI.cpp +0 -477
  734. data/dist/ice/cpp/src/Ice/ios/StreamEndpointI.h +0 -156
  735. data/dist/ice/cpp/src/Ice/ios/StreamTransceiver.cpp +0 -570
  736. data/dist/ice/cpp/src/Ice/ios/StreamTransceiver.h +0 -93
  737. data/dist/ice/cpp/src/IceDiscovery/generated/IceDiscovery/IceDiscovery.h +0 -1889
  738. data/dist/ice/cpp/src/IceDiscovery/generated/IceDiscovery.cpp +0 -915
  739. data/dist/ice/cpp/src/IceLocatorDiscovery/generated/IceLocatorDiscovery/IceLocatorDiscovery.h +0 -1197
  740. data/dist/ice/cpp/src/IceLocatorDiscovery/generated/IceLocatorDiscovery.cpp +0 -730
  741. data/dist/ice/cpp/src/IceSSL/AcceptorI.cpp +0 -105
  742. data/dist/ice/cpp/src/IceSSL/AcceptorI.h +0 -52
  743. data/dist/ice/cpp/src/IceSSL/CertificateI.cpp +0 -301
  744. data/dist/ice/cpp/src/IceSSL/CertificateI.h +0 -64
  745. data/dist/ice/cpp/src/IceSSL/ConnectorI.cpp +0 -102
  746. data/dist/ice/cpp/src/IceSSL/ConnectorI.h +0 -44
  747. data/dist/ice/cpp/src/IceSSL/EndpointI.cpp +0 -372
  748. data/dist/ice/cpp/src/IceSSL/EndpointI.h +0 -100
  749. data/dist/ice/cpp/src/IceSSL/Instance.cpp +0 -28
  750. data/dist/ice/cpp/src/IceSSL/Instance.h +0 -37
  751. data/dist/ice/cpp/src/IceSSL/InstanceF.h +0 -33
  752. data/dist/ice/cpp/src/IceSSL/OpenSSLCertificateI.cpp +0 -688
  753. data/dist/ice/cpp/src/IceSSL/OpenSSLEngine.cpp +0 -1147
  754. data/dist/ice/cpp/src/IceSSL/OpenSSLEngine.h +0 -59
  755. data/dist/ice/cpp/src/IceSSL/OpenSSLEngineF.h +0 -27
  756. data/dist/ice/cpp/src/IceSSL/OpenSSLPluginI.cpp +0 -127
  757. data/dist/ice/cpp/src/IceSSL/OpenSSLTransceiverI.cpp +0 -1092
  758. data/dist/ice/cpp/src/IceSSL/OpenSSLTransceiverI.h +0 -90
  759. data/dist/ice/cpp/src/IceSSL/OpenSSLUtil.cpp +0 -288
  760. data/dist/ice/cpp/src/IceSSL/OpenSSLUtil.h +0 -58
  761. data/dist/ice/cpp/src/IceSSL/PluginI.cpp +0 -246
  762. data/dist/ice/cpp/src/IceSSL/PluginI.h +0 -67
  763. data/dist/ice/cpp/src/IceSSL/RFC2253.h +0 -62
  764. data/dist/ice/cpp/src/IceSSL/SChannelCertificateI.cpp +0 -721
  765. data/dist/ice/cpp/src/IceSSL/SChannelEngine.cpp +0 -1283
  766. data/dist/ice/cpp/src/IceSSL/SChannelEngine.h +0 -123
  767. data/dist/ice/cpp/src/IceSSL/SChannelEngineF.h +0 -31
  768. data/dist/ice/cpp/src/IceSSL/SChannelPluginI.cpp +0 -73
  769. data/dist/ice/cpp/src/IceSSL/SChannelTransceiverI.cpp +0 -1174
  770. data/dist/ice/cpp/src/IceSSL/SChannelTransceiverI.h +0 -133
  771. data/dist/ice/cpp/src/IceSSL/SSLEngine.cpp +0 -313
  772. data/dist/ice/cpp/src/IceSSL/SSLEngine.h +0 -100
  773. data/dist/ice/cpp/src/IceSSL/SSLEngineF.h +0 -21
  774. data/dist/ice/cpp/src/IceSSL/SecureTransportCertificateI.cpp +0 -999
  775. data/dist/ice/cpp/src/IceSSL/SecureTransportEngine.cpp +0 -1308
  776. data/dist/ice/cpp/src/IceSSL/SecureTransportEngine.h +0 -59
  777. data/dist/ice/cpp/src/IceSSL/SecureTransportEngineF.h +0 -29
  778. data/dist/ice/cpp/src/IceSSL/SecureTransportPluginI.cpp +0 -75
  779. data/dist/ice/cpp/src/IceSSL/SecureTransportTransceiverI.cpp +0 -719
  780. data/dist/ice/cpp/src/IceSSL/SecureTransportTransceiverI.h +0 -92
  781. data/dist/ice/cpp/src/IceSSL/SecureTransportUtil.cpp +0 -868
  782. data/dist/ice/cpp/src/IceSSL/SecureTransportUtil.h +0 -45
  783. data/dist/ice/cpp/src/IceSSL/TrustManager.cpp +0 -236
  784. data/dist/ice/cpp/src/IceSSL/TrustManager.h +0 -46
  785. data/dist/ice/cpp/src/IceSSL/TrustManagerF.h +0 -21
  786. data/dist/ice/cpp/src/IceSSL/Util.cpp +0 -192
  787. data/dist/ice/cpp/src/IceSSL/Util.h +0 -99
  788. data/dist/ice/cpp/src/IceSSL/generated/ConnectionInfo.cpp +0 -75
  789. data/dist/ice/cpp/src/IceSSL/generated/ConnectionInfoF.cpp +0 -61
  790. data/dist/ice/cpp/src/IceSSL/generated/EndpointInfo.cpp +0 -75
  791. data/dist/ice/cpp/src/IceUtil/ConvertUTF.cpp +0 -472
  792. data/dist/ice/cpp/src/IceUtil/ConvertUTF.h +0 -147
  793. data/dist/ice/cpp/src/IceUtil/CtrlCHandler.cpp +0 -259
  794. data/dist/ice/cpp/src/IceUtil/FileUtil.cpp +0 -471
  795. data/dist/ice/cpp/src/IceUtil/InputUtil.cpp +0 -36
  796. data/dist/ice/cpp/src/IceUtil/MutexProtocol.cpp +0 -19
  797. data/dist/ice/cpp/src/IceUtil/OutputUtil.cpp +0 -609
  798. data/dist/ice/cpp/src/IceUtil/Random.cpp +0 -180
  799. data/dist/ice/cpp/src/IceUtil/RecMutex.cpp +0 -238
  800. data/dist/ice/cpp/src/IceUtil/Shared.cpp +0 -71
  801. data/dist/ice/cpp/src/IceUtil/StringConverter.cpp +0 -690
  802. data/dist/ice/cpp/src/IceUtil/StringUtil.cpp +0 -1135
  803. data/dist/ice/cpp/src/IceUtil/ThreadException.cpp +0 -130
  804. data/dist/ice/cpp/src/IceUtil/Time.cpp +0 -307
  805. data/dist/ice/cpp/src/IceUtil/UUID.cpp +0 -165
  806. data/dist/ice/cpp/src/IceUtil/Unicode.cpp +0 -183
  807. data/dist/ice/cpp/src/IceUtil/Unicode.h +0 -43
  808. data/dist/ice/cpp/src/IceUtil/UtilException.cpp +0 -839
  809. data/dist/ice/cpp/src/Slice/CPlusPlusUtil.cpp +0 -1810
  810. data/dist/ice/cpp/src/Slice/CPlusPlusUtil.h +0 -72
  811. data/dist/ice/cpp/src/Slice/Checksum.cpp +0 -447
  812. data/dist/ice/cpp/src/Slice/Checksum.h +0 -21
  813. data/dist/ice/cpp/src/Slice/JavaUtil.cpp +0 -5183
  814. data/dist/ice/cpp/src/Slice/JavaUtil.h +0 -407
  815. data/dist/ice/cpp/src/Slice/MD5.cpp +0 -52
  816. data/dist/ice/cpp/src/Slice/MD5.h +0 -39
  817. data/dist/ice/cpp/src/Slice/MD5I.cpp +0 -393
  818. data/dist/ice/cpp/src/Slice/MD5I.h +0 -91
  819. data/dist/ice/cpp/src/Slice/PHPUtil.cpp +0 -157
  820. data/dist/ice/cpp/src/Slice/PHPUtil.h +0 -36
  821. data/dist/ice/cpp/src/Slice/Python.cpp +0 -830
  822. data/dist/ice/cpp/src/Slice/PythonUtil.cpp +0 -3439
  823. data/dist/ice/cpp/src/Slice/PythonUtil.h +0 -70
  824. data/dist/ice/cpp/src/Slice/Ruby.cpp +0 -350
  825. data/dist/ice/cpp/src/Slice/RubyUtil.cpp +0 -1571
  826. data/dist/ice/cpp/src/Slice/RubyUtil.h +0 -49
  827. data/dist/ice/slice/Glacier2/PermissionsVerifierF.ice +0 -30
  828. data/dist/ice/slice/Glacier2/RouterF.ice +0 -29
  829. data/dist/ice/slice/Ice/Communicator.ice +0 -676
  830. data/dist/ice/slice/Ice/CommunicatorF.ice +0 -31
  831. data/dist/ice/slice/Ice/Connection.ice +0 -516
  832. data/dist/ice/slice/Ice/ConnectionF.ice +0 -33
  833. data/dist/ice/slice/Ice/Current.ice +0 -170
  834. data/dist/ice/slice/Ice/Endpoint.ice +0 -291
  835. data/dist/ice/slice/Ice/EndpointF.ice +0 -43
  836. data/dist/ice/slice/Ice/FacetMap.ice +0 -36
  837. data/dist/ice/slice/Ice/ImplicitContext.ice +0 -119
  838. data/dist/ice/slice/Ice/ImplicitContextF.ice +0 -30
  839. data/dist/ice/slice/Ice/Instrumentation.ice +0 -509
  840. data/dist/ice/slice/Ice/InstrumentationF.ice +0 -38
  841. data/dist/ice/slice/Ice/LocalException.ice +0 -1040
  842. data/dist/ice/slice/Ice/LocatorF.ice +0 -32
  843. data/dist/ice/slice/Ice/Logger.ice +0 -99
  844. data/dist/ice/slice/Ice/LoggerF.ice +0 -31
  845. data/dist/ice/slice/Ice/ObjectAdapter.ice +0 -710
  846. data/dist/ice/slice/Ice/ObjectAdapterF.ice +0 -31
  847. data/dist/ice/slice/Ice/ObjectFactory.ice +0 -71
  848. data/dist/ice/slice/Ice/Plugin.ice +0 -131
  849. data/dist/ice/slice/Ice/PluginF.ice +0 -36
  850. data/dist/ice/slice/Ice/ProcessF.ice +0 -31
  851. data/dist/ice/slice/Ice/Properties.ice +0 -244
  852. data/dist/ice/slice/Ice/PropertiesF.ice +0 -32
  853. data/dist/ice/slice/Ice/RouterF.ice +0 -31
  854. data/dist/ice/slice/Ice/ServantLocator.ice +0 -136
  855. data/dist/ice/slice/Ice/ServantLocatorF.ice +0 -31
  856. data/dist/ice/slice/Ice/ValueFactory.ice +0 -133
  857. data/dist/ice/slice/IceBox/IceBox.ice +0 -216
  858. data/dist/ice/slice/IceGrid/PluginFacade.ice +0 -329
  859. data/dist/ice/slice/IcePatch2/FileInfo.ice +0 -85
  860. data/dist/ice/slice/IcePatch2/FileServer.ice +0 -191
  861. data/dist/lib/Glacier2/PermissionsVerifierF.rb +0 -30
  862. data/dist/lib/Glacier2/RouterF.rb +0 -25
  863. data/dist/lib/Ice/Communicator.rb +0 -87
  864. data/dist/lib/Ice/CommunicatorF.rb +0 -24
  865. data/dist/lib/Ice/Connection.rb +0 -413
  866. data/dist/lib/Ice/ConnectionF.rb +0 -32
  867. data/dist/lib/Ice/Current.rb +0 -141
  868. data/dist/lib/Ice/Endpoint.rb +0 -187
  869. data/dist/lib/Ice/EndpointF.rb +0 -48
  870. data/dist/lib/Ice/FacetMap.rb +0 -24
  871. data/dist/lib/Ice/ImplicitContext.rb +0 -26
  872. data/dist/lib/Ice/ImplicitContextF.rb +0 -24
  873. data/dist/lib/Ice/Instrumentation.rb +0 -169
  874. data/dist/lib/Ice/InstrumentationF.rb +0 -31
  875. data/dist/lib/Ice/LocalException.rb +0 -1031
  876. data/dist/lib/Ice/LocatorF.rb +0 -30
  877. data/dist/lib/Ice/Logger.rb +0 -24
  878. data/dist/lib/Ice/LoggerF.rb +0 -24
  879. data/dist/lib/Ice/ObjectAdapter.rb +0 -29
  880. data/dist/lib/Ice/ObjectAdapterF.rb +0 -24
  881. data/dist/lib/Ice/ObjectFactory.rb +0 -24
  882. data/dist/lib/Ice/Plugin.rb +0 -30
  883. data/dist/lib/Ice/PluginF.rb +0 -28
  884. data/dist/lib/Ice/ProcessF.rb +0 -25
  885. data/dist/lib/Ice/Properties.rb +0 -25
  886. data/dist/lib/Ice/PropertiesF.rb +0 -29
  887. data/dist/lib/Ice/RouterF.rb +0 -25
  888. data/dist/lib/Ice/ServantLocator.rb +0 -26
  889. data/dist/lib/Ice/ServantLocatorF.rb +0 -24
  890. data/dist/lib/Ice/ValueFactory.rb +0 -28
  891. data/dist/lib/IceBox/IceBox.rb +0 -164
  892. data/dist/lib/IceGrid/PluginFacade.rb +0 -35
  893. data/dist/lib/IcePatch2/FileInfo.rb +0 -115
  894. data/dist/lib/IcePatch2/FileServer.rb +0 -123
  895. data/dist/lib/IcePatch2.rb +0 -5
@@ -1,3439 +0,0 @@
1
- //
2
- // Copyright (c) ZeroC, Inc. All rights reserved.
3
- //
4
-
5
- #include <Slice/PythonUtil.h>
6
- #include <Slice/Checksum.h>
7
- #include <Slice/Util.h>
8
- #include <IceUtil/IceUtil.h>
9
- #include <IceUtil/StringUtil.h>
10
- #include <climits>
11
- #include <iterator>
12
-
13
- using namespace std;
14
- using namespace Slice;
15
- using namespace IceUtil;
16
- using namespace IceUtilInternal;
17
-
18
- namespace
19
- {
20
-
21
- string
22
- getEscapedParamName(const OperationPtr& p, const string& name)
23
- {
24
- ParamDeclList params = p->parameters();
25
-
26
- for(ParamDeclList::const_iterator i = params.begin(); i != params.end(); ++i)
27
- {
28
- if((*i)->name() == name)
29
- {
30
- return name + "_";
31
- }
32
- }
33
- return name;
34
- }
35
-
36
- }
37
-
38
- namespace Slice
39
- {
40
- namespace Python
41
- {
42
-
43
- class MetaDataVisitor : public ParserVisitor
44
- {
45
- public:
46
-
47
- virtual bool visitUnitStart(const UnitPtr&);
48
- virtual bool visitModuleStart(const ModulePtr&);
49
- virtual void visitClassDecl(const ClassDeclPtr&);
50
- virtual bool visitClassDefStart(const ClassDefPtr&);
51
- virtual bool visitExceptionStart(const ExceptionPtr&);
52
- virtual bool visitStructStart(const StructPtr&);
53
- virtual void visitOperation(const OperationPtr&);
54
- virtual void visitDataMember(const DataMemberPtr&);
55
- virtual void visitSequence(const SequencePtr&);
56
- virtual void visitDictionary(const DictionaryPtr&);
57
- virtual void visitEnum(const EnumPtr&);
58
- virtual void visitConst(const ConstPtr&);
59
-
60
- private:
61
-
62
- //
63
- // Validates sequence metadata.
64
- //
65
- StringList validateSequence(const string&, const string&, const TypePtr&, const StringList&);
66
-
67
- //
68
- // Checks a definition that doesn't currently support Python metadata.
69
- //
70
- void reject(const ContainedPtr&);
71
-
72
- StringSet _history;
73
- };
74
-
75
- //
76
- // ModuleVisitor finds all of the Slice modules whose include level is greater
77
- // than 0 and emits a statement of the following form:
78
- //
79
- // _M_Foo = Ice.openModule('Foo')
80
- //
81
- // This statement allows the code generated for this translation unit to refer
82
- // to types residing in those included modules.
83
- //
84
- class ModuleVisitor : public ParserVisitor
85
- {
86
- public:
87
-
88
- ModuleVisitor(Output&, set<string>&);
89
-
90
- virtual bool visitModuleStart(const ModulePtr&);
91
-
92
- private:
93
-
94
- Output& _out;
95
- set<string>& _history;
96
- };
97
-
98
- //
99
- // CodeVisitor generates the Python mapping for a translation unit.
100
- //
101
- class CodeVisitor : public ParserVisitor
102
- {
103
- public:
104
-
105
- CodeVisitor(IceUtilInternal::Output&, set<string>&);
106
-
107
- virtual bool visitModuleStart(const ModulePtr&);
108
- virtual void visitModuleEnd(const ModulePtr&);
109
- virtual void visitClassDecl(const ClassDeclPtr&);
110
- virtual bool visitClassDefStart(const ClassDefPtr&);
111
- virtual bool visitExceptionStart(const ExceptionPtr&);
112
- virtual bool visitStructStart(const StructPtr&);
113
- virtual void visitSequence(const SequencePtr&);
114
- virtual void visitDictionary(const DictionaryPtr&);
115
- virtual void visitEnum(const EnumPtr&);
116
- virtual void visitConst(const ConstPtr&);
117
-
118
- private:
119
-
120
- //
121
- // Emit Python code for the class operations
122
- //
123
- void writeOperations(const ClassDefPtr&);
124
-
125
- //
126
- // Return a Python symbol for the given parser element.
127
- //
128
- string getSymbol(const ContainedPtr&, const string& = "", const string& = "");
129
-
130
- //
131
- // Emit Python code to assign the given symbol in the current module.
132
- //
133
- void registerName(const string&);
134
-
135
- //
136
- // Emit the tuple for a Slice type.
137
- //
138
- void writeType(const TypePtr&);
139
-
140
- //
141
- // Write an initializer value for a given type.
142
- //
143
- void writeInitializer(const DataMemberPtr&);
144
-
145
- //
146
- // Add a value to a hash code.
147
- //
148
- void writeHash(const string&, const TypePtr&, int&);
149
-
150
- //
151
- // Write Python metadata as a tuple.
152
- //
153
- void writeMetaData(const StringList&);
154
-
155
- //
156
- // Convert an operation mode into a string.
157
- //
158
- string getOperationMode(Slice::Operation::Mode);
159
-
160
- struct MemberInfo
161
- {
162
- string fixedName;
163
- bool inherited;
164
- DataMemberPtr dataMember;
165
- };
166
- typedef list<MemberInfo> MemberInfoList;
167
-
168
- //
169
- // Write a member assignment statement for a constructor.
170
- //
171
- void writeAssign(const MemberInfo&);
172
-
173
- //
174
- // Write a constant value.
175
- //
176
- void writeConstantValue(const TypePtr&, const SyntaxTreeBasePtr&, const string&);
177
-
178
- //
179
- // Write constructor parameters with default values.
180
- //
181
- void writeConstructorParams(const MemberInfoList&);
182
-
183
- void collectClassMembers(const ClassDefPtr&, MemberInfoList&, bool);
184
- void collectExceptionMembers(const ExceptionPtr&, MemberInfoList&, bool);
185
-
186
- typedef vector<string> StringVec;
187
-
188
- StringVec stripMarkup(const string&);
189
-
190
- void writeDocstring(const string&, const string& = "");
191
- void writeDocstring(const string&, const DataMemberList&);
192
- void writeDocstring(const string&, const EnumeratorList&);
193
-
194
- typedef map<string, string> StringMap;
195
- struct OpComment
196
- {
197
- StringVec description;
198
- StringMap params;
199
- string returns;
200
- StringMap exceptions;
201
- };
202
- bool parseOpComment(const string&, OpComment&);
203
-
204
- enum DocstringMode { DocSync, DocAsync, DocAsyncBegin, DocAsyncEnd, DocDispatch, DocAsyncDispatch };
205
-
206
- void writeDocstring(const OperationPtr&, DocstringMode, bool);
207
-
208
- Output& _out;
209
- set<string>& _moduleHistory;
210
- list<string> _moduleStack;
211
- set<string> _classHistory;
212
- };
213
-
214
- }
215
- }
216
-
217
- static string
218
- lookupKwd(const string& name)
219
- {
220
- //
221
- // Keyword list. *Must* be kept in alphabetical order.
222
- //
223
- static const string keywordList[] =
224
- {
225
- "False",
226
- "None",
227
- "True",
228
- "and",
229
- "as",
230
- "assert",
231
- "async",
232
- "await",
233
- "break",
234
- "case",
235
- "class",
236
- "continue",
237
- "def",
238
- "del",
239
- "elif",
240
- "else",
241
- "except",
242
- "exec",
243
- "finally",
244
- "for",
245
- "from",
246
- "global",
247
- "if",
248
- "import",
249
- "in",
250
- "is",
251
- "lambda",
252
- "match",
253
- "nonlocal",
254
- "not",
255
- "or",
256
- "pass",
257
- "print",
258
- "raise",
259
- "return",
260
- "try",
261
- "while",
262
- "with",
263
- "yield"
264
- };
265
- bool found = binary_search(&keywordList[0],
266
- &keywordList[sizeof(keywordList) / sizeof(*keywordList)],
267
- name);
268
- return found ? "_" + name : name;
269
- }
270
-
271
- //
272
- // Split a scoped name into its components and return the components as a list of (unscoped) identifiers.
273
- //
274
- static vector<string>
275
- splitScopedName(const string& scoped)
276
- {
277
- assert(scoped[0] == ':');
278
- vector<string> ids;
279
- string::size_type next = 0;
280
- string::size_type pos;
281
- while((pos = scoped.find("::", next)) != string::npos)
282
- {
283
- pos += 2;
284
- if(pos != scoped.size())
285
- {
286
- string::size_type endpos = scoped.find("::", pos);
287
- if(endpos != string::npos)
288
- {
289
- ids.push_back(scoped.substr(pos, endpos - pos));
290
- }
291
- }
292
- next = pos;
293
- }
294
- if(next != scoped.size())
295
- {
296
- ids.push_back(scoped.substr(next));
297
- }
298
- else
299
- {
300
- ids.push_back("");
301
- }
302
-
303
- return ids;
304
- }
305
-
306
- static string
307
- getDictLookup(const ContainedPtr& cont, const string& suffix = "", const string& prefix = "")
308
- {
309
- string scope = Slice::Python::scopedToName(cont->scope());
310
- assert(!scope.empty());
311
-
312
- string package = Slice::Python::getPackageMetadata(cont);
313
- if(!package.empty())
314
- {
315
- scope = package + "." + scope;
316
- }
317
-
318
- return "'" + suffix + Slice::Python::fixIdent(cont->name() + prefix) + "' not in _M_" + scope + "__dict__";
319
- }
320
-
321
- //
322
- // ModuleVisitor implementation.
323
- //
324
- Slice::Python::ModuleVisitor::ModuleVisitor(Output& out, set<string>& history) :
325
- _out(out), _history(history)
326
- {
327
- }
328
-
329
- bool
330
- Slice::Python::ModuleVisitor::visitModuleStart(const ModulePtr& p)
331
- {
332
- if(p->includeLevel() > 0)
333
- {
334
- string abs = getAbsolute(p);
335
- if(_history.count(abs) == 0)
336
- {
337
- //
338
- // If this is a top-level module, then we check if it has package metadata.
339
- // If so, we need to emit statements to open each of the modules in the
340
- // package before we can open this module.
341
- //
342
- if(UnitPtr::dynamicCast(p->container()))
343
- {
344
- string pkg = getPackageMetadata(p);
345
- if(!pkg.empty())
346
- {
347
- vector<string> v;
348
- splitString(pkg, ".", v);
349
- string mod;
350
- for(vector<string>::iterator q = v.begin(); q != v.end(); ++q)
351
- {
352
- mod = mod.empty() ? *q : mod + "." + *q;
353
- if(_history.count(mod) == 0)
354
- {
355
- _out << nl << "_M_" << mod << " = Ice.openModule('" << mod << "')";
356
- _history.insert(mod);
357
- }
358
- }
359
- }
360
- }
361
-
362
- _out << sp << nl << "# Included module " << abs;
363
- _out << nl << "_M_" << abs << " = Ice.openModule('" << abs << "')";
364
- _history.insert(abs);
365
- }
366
- }
367
-
368
- return true;
369
- }
370
-
371
- //
372
- // CodeVisitor implementation.
373
- //
374
- Slice::Python::CodeVisitor::CodeVisitor(Output& out, set<string>& moduleHistory) :
375
- _out(out),
376
- _moduleHistory(moduleHistory)
377
- {
378
- }
379
-
380
- bool
381
- Slice::Python::CodeVisitor::visitModuleStart(const ModulePtr& p)
382
- {
383
- //
384
- // As each module is opened, we emit the statement
385
- //
386
- // __name__ = 'Foo'
387
- //
388
- // This renames the current module to 'Foo' so that subsequent
389
- // type definitions have the proper fully-qualified name.
390
- //
391
- // We also emit the statement
392
- //
393
- // _M_Foo = Ice.openModule('Foo')
394
- //
395
- // This allows us to create types in the module Foo.
396
- //
397
- string abs = getAbsolute(p);
398
- _out << sp << nl << "# Start of module " << abs;
399
- if(_moduleHistory.count(abs) == 0) // Don't emit this more than once for each module.
400
- {
401
- //
402
- // If this is a top-level module, then we check if it has package metadata.
403
- // If so, we need to emit statements to open each of the modules in the
404
- // package before we can open this module.
405
- //
406
- if(UnitPtr::dynamicCast(p->container()))
407
- {
408
- string pkg = getPackageMetadata(p);
409
- if(!pkg.empty())
410
- {
411
- vector<string> v;
412
- splitString(pkg, ".", v);
413
- string mod;
414
- for(vector<string>::iterator q = v.begin(); q != v.end(); ++q)
415
- {
416
- mod = mod.empty() ? *q : mod + "." + *q;
417
- if(_moduleHistory.count(mod) == 0) // Don't emit this more than once for each module.
418
- {
419
- _out << nl << "_M_" << mod << " = Ice.openModule('" << mod << "')";
420
- _moduleHistory.insert(mod);
421
- }
422
- }
423
- }
424
- }
425
- _out << nl << "_M_" << abs << " = Ice.openModule('" << abs << "')";
426
- _moduleHistory.insert(abs);
427
- }
428
- _out << nl << "__name__ = '" << abs << "'";
429
-
430
- writeDocstring(p->comment(), "_M_" + abs + ".__doc__ = ");
431
-
432
- _moduleStack.push_front(abs);
433
- return true;
434
- }
435
-
436
- void
437
- Slice::Python::CodeVisitor::visitModuleEnd(const ModulePtr&)
438
- {
439
- assert(!_moduleStack.empty());
440
- _out << sp << nl << "# End of module " << _moduleStack.front();
441
- _moduleStack.pop_front();
442
-
443
- if(!_moduleStack.empty())
444
- {
445
- _out << sp << nl << "__name__ = '" << _moduleStack.front() << "'";
446
- }
447
- }
448
-
449
- void
450
- Slice::Python::CodeVisitor::visitClassDecl(const ClassDeclPtr& p)
451
- {
452
- //
453
- // Emit forward declarations.
454
- //
455
- string scoped = p->scoped();
456
- if(_classHistory.count(scoped) == 0)
457
- {
458
- _out << sp << nl << "if " << getDictLookup(p) << ':';
459
- _out.inc();
460
-
461
- if(!p->isInterface() || p->isLocal())
462
- {
463
- _out << nl << "_M_" << getAbsolute(p, "_t_") << " = IcePy.declareValue('" << scoped << "')";
464
- }
465
-
466
- ClassDefPtr def = p->definition();
467
- if(!p->isLocal() && (p->isInterface() || (def && def->allOperations().size())))
468
- {
469
- _out << nl << "_M_" << getAbsolute(p, "_t_", "Disp") << " = IcePy.declareClass('" << scoped << "')";
470
- _out << nl << "_M_" << getAbsolute(p, "_t_", "Prx") << " = IcePy.declareProxy('" << scoped << "')";
471
- }
472
- _out.dec();
473
- _classHistory.insert(scoped); // Avoid redundant declarations.
474
- }
475
- }
476
-
477
- void
478
- Slice::Python::CodeVisitor::writeOperations(const ClassDefPtr& p)
479
- {
480
- OperationList ops = p->operations();
481
- if(!ops.empty())
482
- {
483
- //
484
- // Emit a placeholder for each operation.
485
- //
486
- for(OperationList::iterator oli = ops.begin(); oli != ops.end(); ++oli)
487
- {
488
- string fixedOpName = fixIdent((*oli)->name());
489
- if(!p->isLocal())
490
- {
491
- if((*oli)->hasMarshaledResult())
492
- {
493
- string name = (*oli)->name();
494
- name[0] = static_cast<char>(toupper(static_cast<unsigned char>(name[0])));
495
- _out << sp;
496
- _out << nl << "\"\"\"";
497
- _out << nl << "Immediately marshals the result of an invocation of " << (*oli)->name()
498
- << nl << "and returns an object that the servant implementation must return"
499
- << nl << "as its result."
500
- << nl << "Arguments:"
501
- << nl << "result -- The result (or result tuple) of the invocation."
502
- << nl << "current -- The Current object passed to the invocation."
503
- << nl << "Returns: An object containing the marshaled result.";
504
- _out << nl << "\"\"\"";
505
- _out << nl << "@staticmethod";
506
- _out << nl << "def " << name << "MarshaledResult(result, current):";
507
- _out.inc();
508
- _out << nl << "return IcePy.MarshaledResult(result, _M_" << getAbsolute(p) << "._op_"
509
- << (*oli)->name() << ", current.adapter.getCommunicator().getImpl(), current.encoding)";
510
- _out.dec();
511
- }
512
-
513
- _out << sp << nl << "def " << fixedOpName << "(self";
514
-
515
- ParamDeclList params = (*oli)->parameters();
516
-
517
- for(ParamDeclList::iterator pli = params.begin(); pli != params.end(); ++pli)
518
- {
519
- if(!(*pli)->isOutParam())
520
- {
521
- _out << ", " << fixIdent((*pli)->name());
522
- }
523
- }
524
-
525
- if(!p->isLocal())
526
- {
527
- const string currentParamName = getEscapedParamName(*oli, "current");
528
- _out << ", " << currentParamName << "=None";
529
- }
530
- _out << "):";
531
- _out.inc();
532
-
533
- writeDocstring(*oli, DocAsyncDispatch, false);
534
-
535
- _out << nl << "raise NotImplementedError(\"servant method '" << fixedOpName << "' not implemented\")";
536
- _out.dec();
537
- }
538
- else
539
- {
540
- _out << sp << nl << "def " << fixedOpName << "(self";
541
-
542
- ParamDeclList params = (*oli)->parameters();
543
-
544
- for(ParamDeclList::iterator pli = params.begin(); pli != params.end(); ++pli)
545
- {
546
- if(!(*pli)->isOutParam())
547
- {
548
- _out << ", " << fixIdent((*pli)->name());
549
- }
550
- }
551
- if(!p->isLocal())
552
- {
553
- const string currentParamName = getEscapedParamName(*oli, "current");
554
- _out << ", " << currentParamName << "=None";
555
- }
556
- _out << "):";
557
- _out.inc();
558
- writeDocstring(*oli, DocDispatch, p->isLocal());
559
- _out << nl << "raise NotImplementedError(\"method '" << fixedOpName << "' not implemented\")";
560
- _out.dec();
561
- }
562
- }
563
- }
564
- }
565
-
566
- bool
567
- Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
568
- {
569
- bool isLocal = p->isLocal();
570
- bool isInterface = p->isInterface();
571
- bool isAbstract = isInterface || p->allOperations().size() > 0; // Don't use isAbstract() - see bug 3739
572
-
573
- string scoped = p->scoped();
574
- string type = getAbsolute(p, "_t_");
575
- string classType = getAbsolute(p, "_t_", "Disp");
576
- string abs = getAbsolute(p);
577
- string className = isLocal || isInterface ? fixIdent(p->name()) : isAbstract ? fixIdent(p->name() + "Disp") : "None";
578
- string classAbs = isInterface ? getAbsolute(p) : getAbsolute(p, "", "Disp");
579
- string valueName = (isInterface && !isLocal) ? "Ice.Value" : fixIdent(p->name());
580
- string prxAbs = getAbsolute(p, "", "Prx");
581
- string prxName = fixIdent(p->name() + "Prx");
582
- string prxType = getAbsolute(p, "_t_", "Prx");
583
- ClassList bases = p->bases();
584
- ClassDefPtr base;
585
-
586
- if(!bases.empty() && !bases.front()->isInterface())
587
- {
588
- base = bases.front();
589
- }
590
-
591
- //
592
- // Define a class type for Value types or local classes.
593
- //
594
- if(isLocal || !isInterface)
595
- {
596
- _out << sp << nl << "if " << getDictLookup(p) << ':';
597
- _out.inc();
598
- _out << nl << "_M_" << abs << " = Ice.createTempClass()";
599
- _out << nl << "class " << valueName << '(';
600
- if(isLocal)
601
- {
602
- if(bases.empty())
603
- {
604
- _out << "object";
605
- }
606
- else
607
- {
608
- for(ClassList::const_iterator q = bases.begin(); q != bases.end(); ++q)
609
- {
610
- if(q != bases.begin())
611
- {
612
- _out << ", ";
613
- }
614
- _out << getSymbol(*q);
615
- }
616
- }
617
- }
618
- else
619
- {
620
- if(bases.empty() || bases.front()->isInterface())
621
- {
622
- _out << "Ice.Value";
623
- }
624
- else
625
- {
626
- _out << getSymbol(bases.front());
627
- }
628
- }
629
- _out << "):";
630
-
631
- _out.inc();
632
-
633
- writeDocstring(p->comment(), p->dataMembers());
634
-
635
- //
636
- // __init__
637
- //
638
- _out << nl << "def __init__(self";
639
- MemberInfoList allMembers;
640
- collectClassMembers(p, allMembers, false);
641
- writeConstructorParams(allMembers);
642
- _out << "):";
643
- _out.inc();
644
- if(!base && !p->hasDataMembers() && (!isAbstract || !isLocal))
645
- {
646
- _out << nl << "pass";
647
- }
648
- else
649
- {
650
- if(isAbstract && isLocal)
651
- {
652
- _out << nl << "if Ice.getType(self) == _M_" << abs << ':';
653
- _out.inc();
654
- _out << nl << "raise RuntimeError('" << abs << " is an abstract class')";
655
- _out.dec();
656
- }
657
- if(base)
658
- {
659
- _out << nl << getSymbol(base) << ".__init__(self";
660
- for(MemberInfoList::iterator q = allMembers.begin(); q != allMembers.end(); ++q)
661
- {
662
- if(q->inherited)
663
- {
664
- _out << ", " << q->fixedName;
665
- }
666
- }
667
- _out << ')';
668
- }
669
- for(MemberInfoList::iterator q = allMembers.begin(); q != allMembers.end(); ++q)
670
- {
671
- if(!q->inherited)
672
- {
673
- writeAssign(*q);
674
- }
675
- }
676
- }
677
- _out.dec();
678
-
679
- if(!isLocal)
680
- {
681
- //
682
- // ice_id
683
- //
684
- _out << sp << nl << "def ice_id(self):";
685
- _out.inc();
686
- _out << nl << "return '" << scoped << "'";
687
- _out.dec();
688
-
689
- //
690
- // ice_staticId
691
- //
692
- _out << sp << nl << "@staticmethod";
693
- _out << nl << "def ice_staticId():";
694
- _out.inc();
695
- _out << nl << "return '" << scoped << "'";
696
- _out.dec();
697
- }
698
- else
699
- {
700
- writeOperations(p);
701
- }
702
-
703
- //
704
- // __str__
705
- //
706
- _out << sp << nl << "def __str__(self):";
707
- _out.inc();
708
- _out << nl << "return IcePy.stringify(self, _M_" << type << ")";
709
- _out.dec();
710
- _out << sp << nl << "__repr__ = __str__";
711
-
712
- _out.dec();
713
-
714
- if(_classHistory.count(scoped) == 0 && p->canBeCyclic())
715
- {
716
- //
717
- // Emit a forward declaration for the class in case a data member refers to this type.
718
- //
719
- _out << sp << nl << "_M_" << type << " = IcePy.declareValue('" << scoped << "')";
720
- }
721
- DataMemberList members = p->dataMembers();
722
- _out << sp << nl << "_M_" << type << " = IcePy.defineValue('" << scoped << "', " << valueName
723
- << ", " << p->compactId() << ", ";
724
- writeMetaData(p->getMetaData());
725
- const bool preserved = p->hasMetaData("preserve-slice") || p->inheritsMetaData("preserve-slice");
726
- _out << ", " << (preserved ? "True" : "False") << ", " << (isInterface ? "True" : "False") << ", ";
727
- if(!base)
728
- {
729
- _out << "None";
730
- }
731
- else
732
- {
733
- _out << "_M_" << getAbsolute(base, "_t_");
734
- }
735
- _out << ", (";
736
- //
737
- // Members
738
- //
739
- // Data members are represented as a tuple:
740
- //
741
- // ('MemberName', MemberMetaData, MemberType, Optional, Tag)
742
- //
743
- // where MemberType is either a primitive type constant (T_INT, etc.) or the id of a constructed type.
744
- //
745
- if(members.size() > 1)
746
- {
747
- _out.inc();
748
- _out << nl;
749
- }
750
- bool isProtected = p->hasMetaData("protected");
751
- for(DataMemberList::iterator r = members.begin(); r != members.end(); ++r)
752
- {
753
- if(r != members.begin())
754
- {
755
- _out << ',' << nl;
756
- }
757
- _out << "('";
758
- if(isProtected || (*r)->hasMetaData("protected"))
759
- {
760
- _out << '_';
761
- }
762
- _out << fixIdent((*r)->name()) << "', ";
763
- writeMetaData((*r)->getMetaData());
764
- _out << ", ";
765
- writeType((*r)->type());
766
- _out << ", " << ((*r)->optional() ? "True" : "False") << ", "
767
- << ((*r)->optional() ? (*r)->tag() : 0) << ')';
768
- }
769
- if(members.size() == 1)
770
- {
771
- _out << ',';
772
- }
773
- else if(members.size() > 1)
774
- {
775
- _out.dec();
776
- _out << nl;
777
- }
778
- _out << "))";
779
- _out << nl << valueName << "._ice_type = _M_" << type;
780
-
781
- registerName(valueName);
782
-
783
- _out.dec();
784
- }
785
- else if(!isLocal && isInterface)
786
- {
787
- _out << sp << nl << "_M_" << type << " = IcePy.defineValue('" << scoped << "', Ice.Value, -1, ";
788
- writeMetaData(p->getMetaData());
789
- _out << ", False, True, None, ())";
790
- }
791
-
792
- if(!isLocal && isAbstract)
793
- {
794
- _out << sp << nl << "if " << getDictLookup(p, "", "Prx") << ':';
795
- _out.inc();
796
-
797
- // Define the proxy class
798
- _out << nl << "_M_" << prxAbs << " = Ice.createTempClass()";
799
- _out << nl << "class " << prxName << '(';
800
-
801
- {
802
- vector<string> baseClasses;
803
- for(ClassList::const_iterator q = bases.begin(); q != bases.end(); ++q)
804
- {
805
- ClassDefPtr d = *q;
806
- if(d->isInterface() || d->allOperations().size() > 0)
807
- {
808
- baseClasses.push_back(getSymbol(*q, "", "Prx"));
809
- }
810
- }
811
-
812
- if(baseClasses.empty())
813
- {
814
- _out << "Ice.ObjectPrx";
815
- }
816
- else
817
- {
818
- vector<string>::const_iterator q = baseClasses.begin();
819
- while(q != baseClasses.end())
820
- {
821
- _out << *q;
822
-
823
- if(++q != baseClasses.end())
824
- {
825
- _out << ", ";
826
- }
827
- }
828
- }
829
- }
830
- _out << "):";
831
- _out.inc();
832
-
833
- OperationList ops = p->operations();
834
- for(OperationList::iterator oli = ops.begin(); oli != ops.end(); ++oli)
835
- {
836
- string fixedOpName = fixIdent((*oli)->name());
837
- if(fixedOpName == "checkedCast" || fixedOpName == "uncheckedCast")
838
- {
839
- fixedOpName.insert(0, "_");
840
- }
841
- TypePtr ret = (*oli)->returnType();
842
- ParamDeclList paramList = (*oli)->parameters();
843
- string inParams;
844
- string inParamsDecl;
845
-
846
- // Find the last required parameter, all optional parameters after the last required parameter will use
847
- // Ice.Unset as the default.
848
- ParamDeclPtr lastRequiredParameter;
849
- for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
850
- {
851
- if(!(*q)->isOutParam() && !(*q)->optional())
852
- {
853
- lastRequiredParameter = *q;
854
- }
855
- }
856
-
857
- bool afterLastRequiredParameter = lastRequiredParameter == ICE_NULLPTR;
858
- for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
859
- {
860
- if(!(*q)->isOutParam())
861
- {
862
- if(!inParams.empty())
863
- {
864
- inParams.append(", ");
865
- inParamsDecl.append(", ");
866
- }
867
- string param = fixIdent((*q)->name());
868
- inParams.append(param);
869
- if(afterLastRequiredParameter)
870
- {
871
- param += "=Ice.Unset";
872
- }
873
- inParamsDecl.append(param);
874
-
875
- if(*q == lastRequiredParameter)
876
- {
877
- afterLastRequiredParameter = true;
878
- }
879
- }
880
- }
881
-
882
- _out << sp;
883
- writeDocstring(*oli, DocSync, false);
884
- _out << nl << "def " << fixedOpName << "(self";
885
- if(!inParamsDecl.empty())
886
- {
887
- _out << ", " << inParamsDecl;
888
- }
889
- const string contextParamName = getEscapedParamName(*oli, "context");
890
- _out << ", " << contextParamName << "=None):";
891
- _out.inc();
892
- _out << nl << "return _M_" << classAbs << "._op_" << (*oli)->name() << ".invoke(self, ((" << inParams;
893
- if(!inParams.empty() && inParams.find(',') == string::npos)
894
- {
895
- _out << ", ";
896
- }
897
- _out << "), " << contextParamName << "))";
898
- _out.dec();
899
-
900
- //
901
- // Async operations.
902
- //
903
- _out << sp;
904
- writeDocstring(*oli, DocAsync, false);
905
- _out << nl << "def " << (*oli)->name() << "Async(self";
906
- if(!inParams.empty())
907
- {
908
- _out << ", " << inParams;
909
- }
910
- _out << ", " << contextParamName << "=None):";
911
- _out.inc();
912
- _out << nl << "return _M_" << classAbs << "._op_" << (*oli)->name() << ".invokeAsync(self, ((" << inParams;
913
- if(!inParams.empty() && inParams.find(',') == string::npos)
914
- {
915
- _out << ", ";
916
- }
917
- _out << "), " << contextParamName << "))";
918
- _out.dec();
919
-
920
- _out << sp;
921
- writeDocstring(*oli, DocAsyncBegin, false);
922
- _out << nl << "def begin_" << (*oli)->name() << "(self";
923
- if(!inParams.empty())
924
- {
925
- _out << ", " << inParams;
926
- }
927
- _out << ", _response=None, _ex=None, _sent=None, " << contextParamName << "=None):";
928
- _out.inc();
929
- _out << nl << "return _M_" << classAbs << "._op_" << (*oli)->name() << ".begin(self, ((" << inParams;
930
- if(!inParams.empty() && inParams.find(',') == string::npos)
931
- {
932
- _out << ", ";
933
- }
934
- _out << "), _response, _ex, _sent, " << contextParamName << "))";
935
- _out.dec();
936
-
937
- _out << sp;
938
- writeDocstring(*oli, DocAsyncEnd, false);
939
- _out << nl << "def end_" << (*oli)->name() << "(self, _r):";
940
- _out.inc();
941
- _out << nl << "return _M_" << classAbs << "._op_" << (*oli)->name() << ".end(self, _r)";
942
- _out.dec();
943
- }
944
-
945
- _out << sp << nl << "@staticmethod";
946
- _out << nl << "def checkedCast(proxy, facetOrContext=None, context=None):";
947
- _out.inc();
948
- _out << nl << "return _M_" << prxAbs << ".ice_checkedCast(proxy, '" << scoped << "', facetOrContext, context)";
949
- _out.dec();
950
-
951
- _out << sp << nl << "@staticmethod";
952
- _out << nl << "def uncheckedCast(proxy, facet=None):";
953
- _out.inc();
954
- _out << nl << "return _M_" << prxAbs << ".ice_uncheckedCast(proxy, facet)";
955
- _out.dec();
956
-
957
- //
958
- // ice_staticId
959
- //
960
- _out << sp << nl << "@staticmethod";
961
- _out << nl << "def ice_staticId():";
962
- _out.inc();
963
- _out << nl << "return '" << scoped << "'";
964
- _out.dec();
965
-
966
- _out.dec(); // end prx class
967
-
968
- _out << nl << "_M_" << prxType << " = IcePy.defineProxy('" << scoped << "', " << prxName << ")";
969
-
970
- registerName(prxName);
971
-
972
- // Define the servant class
973
- _out << sp << nl << "_M_" << classAbs << " = Ice.createTempClass()";
974
- _out << nl << "class " << className << '(';
975
- {
976
- vector<string> baseClasses;
977
- for(ClassList::const_iterator q = bases.begin(); q != bases.end(); ++q)
978
- {
979
- ClassDefPtr d = *q;
980
- if(d->isInterface() || d->allOperations().size() > 0)
981
- {
982
- baseClasses.push_back(getSymbol(*q, "", d->isInterface() ? "" : "Disp"));
983
- }
984
- }
985
-
986
- if(baseClasses.empty())
987
- {
988
- _out << "Ice.Object";
989
- }
990
- else
991
- {
992
- vector<string>::const_iterator q = baseClasses.begin();
993
- while(q != baseClasses.end())
994
- {
995
- _out << *q;
996
-
997
- if(++q != baseClasses.end())
998
- {
999
- _out << ", ";
1000
- }
1001
- }
1002
- }
1003
- }
1004
- _out << "):";
1005
-
1006
- _out.inc();
1007
-
1008
- //
1009
- // ice_ids
1010
- //
1011
- ClassList allBases = p->allBases();
1012
- StringList ids;
1013
- #ifdef ICE_CPP11_COMPILER
1014
- transform(allBases.begin(), allBases.end(), back_inserter(ids),
1015
- [](const ContainedPtr& it)
1016
- {
1017
- return it->scoped();
1018
- });
1019
- #else
1020
- transform(allBases.begin(), allBases.end(), back_inserter(ids), IceUtil::constMemFun(&Contained::scoped));
1021
- #endif
1022
- StringList other;
1023
- other.push_back(scoped);
1024
- other.push_back("::Ice::Object");
1025
- other.sort();
1026
- ids.merge(other);
1027
- ids.unique();
1028
- _out << sp << nl << "def ice_ids(self, current=None):";
1029
- _out.inc();
1030
- _out << nl << "return (";
1031
- for(StringList::iterator q = ids.begin(); q != ids.end(); ++q)
1032
- {
1033
- if(q != ids.begin())
1034
- {
1035
- _out << ", ";
1036
- }
1037
- _out << "'" << *q << "'";
1038
- }
1039
- _out << ')';
1040
- _out.dec();
1041
-
1042
- //
1043
- // ice_id
1044
- //
1045
- _out << sp << nl << "def ice_id(self, current=None):";
1046
- _out.inc();
1047
- _out << nl << "return '" << scoped << "'";
1048
- _out.dec();
1049
-
1050
- //
1051
- // ice_staticId
1052
- //
1053
- _out << sp << nl << "@staticmethod";
1054
- _out << nl << "def ice_staticId():";
1055
- _out.inc();
1056
- _out << nl << "return '" << scoped << "'";
1057
- _out.dec();
1058
-
1059
- writeOperations(p);
1060
-
1061
- //
1062
- // __str__
1063
- //
1064
- _out << sp << nl << "def __str__(self):";
1065
- _out.inc();
1066
- _out << nl << "return IcePy.stringify(self, _M_" << getAbsolute(p, "_t_", "Disp") << ")";
1067
- _out.dec();
1068
- _out << sp << nl << "__repr__ = __str__";
1069
-
1070
- _out.dec();
1071
-
1072
- _out << sp << nl << "_M_" << classType << " = IcePy.defineClass('" << scoped << "', " << className
1073
- << ", ";
1074
- writeMetaData(p->getMetaData());
1075
- _out << ", ";
1076
- if(!base || (!base->isInterface() && base->allOperations().size() == 0))
1077
- {
1078
- _out << "None";
1079
- }
1080
- else
1081
- {
1082
- _out << "_M_" << getAbsolute(base, "_t_", "Disp");
1083
- }
1084
- _out << ", (";
1085
- //
1086
- // Interfaces
1087
- //
1088
- int interfaceCount = 0;
1089
- for(ClassList::const_iterator q = bases.begin(); q != bases.end(); ++q)
1090
- {
1091
- if((*q)->isInterface())
1092
- {
1093
- if(interfaceCount > 0)
1094
- {
1095
- _out << ", ";
1096
- }
1097
- _out << "_M_" << getAbsolute(*q, "_t_", "Disp");
1098
- ++interfaceCount;
1099
- }
1100
- }
1101
- if(interfaceCount == 1)
1102
- {
1103
- _out << ',';
1104
- }
1105
- _out << "))";
1106
- _out << nl << className << "._ice_type = _M_" << classType;
1107
-
1108
- //
1109
- // Define each operation. The arguments to the IcePy.Operation constructor are:
1110
- //
1111
- // 'opName', Mode, SendMode, AMD, Format, MetaData, (InParams), (OutParams), ReturnParam, (Exceptions)
1112
- //
1113
- // where InParams and OutParams are tuples of type descriptions, and Exceptions
1114
- // is a tuple of exception type ids.
1115
- //
1116
- if(!ops.empty())
1117
- {
1118
- _out << sp;
1119
- }
1120
- for(OperationList::iterator s = ops.begin(); s != ops.end(); ++s)
1121
- {
1122
- ParamDeclList params = (*s)->parameters();
1123
- ParamDeclList::iterator t;
1124
- int count;
1125
- string format;
1126
- switch((*s)->format())
1127
- {
1128
- case DefaultFormat:
1129
- format = "None";
1130
- break;
1131
- case CompactFormat:
1132
- format = "Ice.FormatType.CompactFormat";
1133
- break;
1134
- case SlicedFormat:
1135
- format = "Ice.FormatType.SlicedFormat";
1136
- break;
1137
- }
1138
-
1139
- _out << nl << className << "._op_" << (*s)->name() << " = IcePy.Operation('" << (*s)->name() << "', "
1140
- << getOperationMode((*s)->mode()) << ", " << getOperationMode((*s)->sendMode()) << ", "
1141
- << ((p->hasMetaData("amd") || (*s)->hasMetaData("amd")) ? "True" : "False") << ", "
1142
- << format << ", ";
1143
- writeMetaData((*s)->getMetaData());
1144
- _out << ", (";
1145
- for(t = params.begin(), count = 0; t != params.end(); ++t)
1146
- {
1147
- if(!(*t)->isOutParam())
1148
- {
1149
- if(count > 0)
1150
- {
1151
- _out << ", ";
1152
- }
1153
- _out << '(';
1154
- writeMetaData((*t)->getMetaData());
1155
- _out << ", ";
1156
- writeType((*t)->type());
1157
- _out << ", " << ((*t)->optional() ? "True" : "False") << ", "
1158
- << ((*t)->optional() ? (*t)->tag() : 0) << ')';
1159
- ++count;
1160
- }
1161
- }
1162
- if(count == 1)
1163
- {
1164
- _out << ',';
1165
- }
1166
- _out << "), (";
1167
- for(t = params.begin(), count = 0; t != params.end(); ++t)
1168
- {
1169
- if((*t)->isOutParam())
1170
- {
1171
- if(count > 0)
1172
- {
1173
- _out << ", ";
1174
- }
1175
- _out << '(';
1176
- writeMetaData((*t)->getMetaData());
1177
- _out << ", ";
1178
- writeType((*t)->type());
1179
- _out << ", " << ((*t)->optional() ? "True" : "False") << ", "
1180
- << ((*t)->optional() ? (*t)->tag() : 0) << ')';
1181
- ++count;
1182
- }
1183
- }
1184
- if(count == 1)
1185
- {
1186
- _out << ',';
1187
- }
1188
- _out << "), ";
1189
- TypePtr returnType = (*s)->returnType();
1190
- if(returnType)
1191
- {
1192
- //
1193
- // The return type has the same format as an in/out parameter:
1194
- //
1195
- // MetaData, Type, Optional?, OptionalTag
1196
- //
1197
- _out << "((), ";
1198
- writeType(returnType);
1199
- _out << ", " << ((*s)->returnIsOptional() ? "True" : "False") << ", "
1200
- << ((*s)->returnIsOptional() ? (*s)->returnTag() : 0) << ')';
1201
- }
1202
- else
1203
- {
1204
- _out << "None";
1205
- }
1206
- _out << ", (";
1207
- ExceptionList exceptions = (*s)->throws();
1208
- for(ExceptionList::iterator u = exceptions.begin(); u != exceptions.end(); ++u)
1209
- {
1210
- if(u != exceptions.begin())
1211
- {
1212
- _out << ", ";
1213
- }
1214
- _out << "_M_" << getAbsolute(*u, "_t_");
1215
- }
1216
- if(exceptions.size() == 1)
1217
- {
1218
- _out << ',';
1219
- }
1220
- _out << "))";
1221
-
1222
- string deprecateMetadata;
1223
- if((*s)->findMetaData("deprecate", deprecateMetadata) || p->findMetaData("deprecate", deprecateMetadata))
1224
- {
1225
- string msg;
1226
- string::size_type pos = deprecateMetadata.find(':');
1227
- if(pos != string::npos && pos < deprecateMetadata.size() - 1)
1228
- {
1229
- msg = deprecateMetadata.substr(pos + 1);
1230
- }
1231
- _out << nl << className << "._op_" << (*s)->name() << ".deprecate(\"" << msg << "\")";
1232
- }
1233
- }
1234
-
1235
- registerName(className);
1236
- _out.dec();
1237
- }
1238
-
1239
- if(_classHistory.count(scoped) == 0)
1240
- {
1241
- _classHistory.insert(scoped); // Avoid redundant declarations.
1242
- }
1243
-
1244
- return false;
1245
- }
1246
-
1247
- bool
1248
- Slice::Python::CodeVisitor::visitExceptionStart(const ExceptionPtr& p)
1249
- {
1250
- string scoped = p->scoped();
1251
- string abs = getAbsolute(p);
1252
- string name = fixIdent(p->name());
1253
-
1254
- _out << sp << nl << "if " << getDictLookup(p) << ':';
1255
- _out.inc();
1256
- _out << nl << "_M_" << abs << " = Ice.createTempClass()";
1257
- _out << nl << "class " << name << '(';
1258
- ExceptionPtr base = p->base();
1259
- string baseName;
1260
- if(base)
1261
- {
1262
- baseName = getSymbol(base);
1263
- _out << baseName;
1264
- }
1265
- else if(p->isLocal())
1266
- {
1267
- _out << "Ice.LocalException";
1268
- }
1269
- else
1270
- {
1271
- _out << "Ice.UserException";
1272
- }
1273
- _out << "):";
1274
- _out.inc();
1275
-
1276
- DataMemberList members = p->dataMembers();
1277
-
1278
- writeDocstring(p->comment(), members);
1279
-
1280
- //
1281
- // __init__
1282
- //
1283
- _out << nl << "def __init__(self";
1284
- MemberInfoList allMembers;
1285
- collectExceptionMembers(p, allMembers, false);
1286
- writeConstructorParams(allMembers);
1287
- _out << "):";
1288
- _out.inc();
1289
- if(!base && members.empty())
1290
- {
1291
- _out << nl << "pass";
1292
- }
1293
- else
1294
- {
1295
- if(base)
1296
- {
1297
- _out << nl << baseName << ".__init__(self";
1298
- for(MemberInfoList::iterator q = allMembers.begin(); q != allMembers.end(); ++q)
1299
- {
1300
- if(q->inherited)
1301
- {
1302
- _out << ", " << q->fixedName;
1303
- }
1304
- }
1305
- _out << ')';
1306
- }
1307
- for(MemberInfoList::iterator q = allMembers.begin(); q != allMembers.end(); ++q)
1308
- {
1309
- if(!q->inherited)
1310
- {
1311
- writeAssign(*q);
1312
- }
1313
- }
1314
- }
1315
- _out.dec();
1316
-
1317
- //
1318
- // __str__
1319
- //
1320
- _out << sp << nl << "def __str__(self):";
1321
- _out.inc();
1322
- _out << nl << "return IcePy.stringifyException(self)";
1323
- _out.dec();
1324
- _out << sp << nl << "__repr__ = __str__";
1325
-
1326
- //
1327
- // _ice_id
1328
- //
1329
- _out << sp << nl << "_ice_id = '" << scoped << "'";
1330
-
1331
- _out.dec();
1332
-
1333
- //
1334
- // Emit the type information.
1335
- //
1336
- string type = getAbsolute(p, "_t_");
1337
- _out << sp << nl << "_M_" << type << " = IcePy.defineException('" << scoped << "', " << name << ", ";
1338
- writeMetaData(p->getMetaData());
1339
- const bool preserved = p->hasMetaData("preserve-slice") || p->inheritsMetaData("preserve-slice");
1340
- _out << ", " << (preserved ? "True" : "False") << ", ";
1341
- if(!base)
1342
- {
1343
- _out << "None";
1344
- }
1345
- else
1346
- {
1347
- _out << "_M_" << getAbsolute(base, "_t_");
1348
- }
1349
- _out << ", (";
1350
- if(members.size() > 1)
1351
- {
1352
- _out.inc();
1353
- _out << nl;
1354
- }
1355
- //
1356
- // Data members are represented as a tuple:
1357
- //
1358
- // ('MemberName', MemberMetaData, MemberType, Optional, Tag)
1359
- //
1360
- // where MemberType is either a primitive type constant (T_INT, etc.) or the id of a constructed type.
1361
- //
1362
- for(DataMemberList::iterator dmli = members.begin(); dmli != members.end(); ++dmli)
1363
- {
1364
- if(dmli != members.begin())
1365
- {
1366
- _out << ',' << nl;
1367
- }
1368
- _out << "('" << fixIdent((*dmli)->name()) << "', ";
1369
- writeMetaData((*dmli)->getMetaData());
1370
- _out << ", ";
1371
- writeType((*dmli)->type());
1372
- _out << ", " << ((*dmli)->optional() ? "True" : "False") << ", "
1373
- << ((*dmli)->optional() ? (*dmli)->tag() : 0) << ')';
1374
- }
1375
- if(members.size() == 1)
1376
- {
1377
- _out << ',';
1378
- }
1379
- else if(members.size() > 1)
1380
- {
1381
- _out.dec();
1382
- _out << nl;
1383
- }
1384
- _out << "))";
1385
- _out << nl << name << "._ice_type = _M_" << type;
1386
-
1387
- registerName(name);
1388
-
1389
- _out.dec();
1390
-
1391
- return false;
1392
- }
1393
-
1394
- bool
1395
- Slice::Python::CodeVisitor::visitStructStart(const StructPtr& p)
1396
- {
1397
- string scoped = p->scoped();
1398
- string abs = getAbsolute(p);
1399
- string name = fixIdent(p->name());
1400
- DataMemberList members = p->dataMembers();
1401
- MemberInfoList memberList;
1402
-
1403
- {
1404
- for(DataMemberList::iterator q = members.begin(); q != members.end(); ++q)
1405
- {
1406
- memberList.push_back(MemberInfo());
1407
- memberList.back().fixedName = fixIdent((*q)->name());
1408
- memberList.back().inherited = false;
1409
- memberList.back().dataMember = *q;
1410
- }
1411
- }
1412
-
1413
- _out << sp << nl << "if " << getDictLookup(p) << ':';
1414
- _out.inc();
1415
- _out << nl << "_M_" << abs << " = Ice.createTempClass()";
1416
- _out << nl << "class " << name << "(object):";
1417
- _out.inc();
1418
-
1419
- writeDocstring(p->comment(), members);
1420
-
1421
- _out << nl << "def __init__(self";
1422
- writeConstructorParams(memberList);
1423
- _out << "):";
1424
- _out.inc();
1425
- for(MemberInfoList::iterator r = memberList.begin(); r != memberList.end(); ++r)
1426
- {
1427
- writeAssign(*r);
1428
- }
1429
- _out.dec();
1430
-
1431
- //
1432
- // Only generate __hash__ and the comparison operators if this structure type
1433
- // is a legal dictionary key type.
1434
- //
1435
- bool containsSequence = false;
1436
- if(Dictionary::legalKeyType(p, containsSequence))
1437
- {
1438
- _out << sp << nl << "def __hash__(self):";
1439
- _out.inc();
1440
- _out << nl << "_h = 0";
1441
- int iter = 0;
1442
- for(MemberInfoList::iterator r = memberList.begin(); r != memberList.end(); ++r)
1443
- {
1444
- string s = "self." + r->fixedName;
1445
- writeHash(s, r->dataMember->type(), iter);
1446
- }
1447
- _out << nl << "return _h % 0x7fffffff";
1448
- _out.dec();
1449
-
1450
- //
1451
- // Rich operators. __lt__, __le__, __eq__, __ne__, __gt__, __ge__
1452
- //
1453
-
1454
- _out << sp << nl << "def __compare(self, other):";
1455
- _out.inc();
1456
- _out << nl << "if other is None:";
1457
- _out.inc();
1458
- _out << nl << "return 1";
1459
- _out.dec();
1460
- _out << nl << "elif not isinstance(other, _M_" << abs << "):";
1461
- _out.inc();
1462
- _out << nl << "return NotImplemented";
1463
- _out.dec();
1464
- _out << nl << "else:";
1465
- _out.inc();
1466
- for(MemberInfoList::iterator r = memberList.begin(); r != memberList.end(); ++r)
1467
- {
1468
- //
1469
- // The None value is not orderable in Python 3.
1470
- //
1471
- _out << nl << "if self." << r->fixedName << " is None or other." << r->fixedName << " is None:";
1472
- _out.inc();
1473
- _out << nl << "if self." << r->fixedName << " != other." << r->fixedName << ':';
1474
- _out.inc();
1475
- _out << nl << "return (-1 if self." << r->fixedName << " is None else 1)";
1476
- _out.dec();
1477
- _out.dec();
1478
- _out << nl << "else:";
1479
- _out.inc();
1480
- _out << nl << "if self." << r->fixedName << " < other." << r->fixedName << ':';
1481
- _out.inc();
1482
- _out << nl << "return -1";
1483
- _out.dec();
1484
- _out << nl << "elif self." << r->fixedName << " > other." << r->fixedName << ':';
1485
- _out.inc();
1486
- _out << nl << "return 1";
1487
- _out.dec();
1488
- _out.dec();
1489
- }
1490
- _out << nl << "return 0";
1491
- _out.dec();
1492
- _out.dec();
1493
-
1494
- _out << sp << nl << "def __lt__(self, other):";
1495
- _out.inc();
1496
- _out << nl << "r = self.__compare(other)";
1497
- _out << nl << "if r is NotImplemented:";
1498
- _out.inc();
1499
- _out << nl << "return r";
1500
- _out.dec();
1501
- _out << nl << "else:";
1502
- _out.inc();
1503
- _out << nl << "return r < 0";
1504
- _out.dec();
1505
- _out.dec();
1506
-
1507
- _out << sp << nl << "def __le__(self, other):";
1508
- _out.inc();
1509
- _out << nl << "r = self.__compare(other)";
1510
- _out << nl << "if r is NotImplemented:";
1511
- _out.inc();
1512
- _out << nl << "return r";
1513
- _out.dec();
1514
- _out << nl << "else:";
1515
- _out.inc();
1516
- _out << nl << "return r <= 0";
1517
- _out.dec();
1518
- _out.dec();
1519
-
1520
- _out << sp << nl << "def __gt__(self, other):";
1521
- _out.inc();
1522
- _out << nl << "r = self.__compare(other)";
1523
- _out << nl << "if r is NotImplemented:";
1524
- _out.inc();
1525
- _out << nl << "return r";
1526
- _out.dec();
1527
- _out << nl << "else:";
1528
- _out.inc();
1529
- _out << nl << "return r > 0";
1530
- _out.dec();
1531
- _out.dec();
1532
-
1533
- _out << sp << nl << "def __ge__(self, other):";
1534
- _out.inc();
1535
- _out << nl << "r = self.__compare(other)";
1536
- _out << nl << "if r is NotImplemented:";
1537
- _out.inc();
1538
- _out << nl << "return r";
1539
- _out.dec();
1540
- _out << nl << "else:";
1541
- _out.inc();
1542
- _out << nl << "return r >= 0";
1543
- _out.dec();
1544
- _out.dec();
1545
-
1546
- _out << sp << nl << "def __eq__(self, other):";
1547
- _out.inc();
1548
- _out << nl << "r = self.__compare(other)";
1549
- _out << nl << "if r is NotImplemented:";
1550
- _out.inc();
1551
- _out << nl << "return r";
1552
- _out.dec();
1553
- _out << nl << "else:";
1554
- _out.inc();
1555
- _out << nl << "return r == 0";
1556
- _out.dec();
1557
- _out.dec();
1558
-
1559
- _out << sp << nl << "def __ne__(self, other):";
1560
- _out.inc();
1561
- _out << nl << "r = self.__compare(other)";
1562
- _out << nl << "if r is NotImplemented:";
1563
- _out.inc();
1564
- _out << nl << "return r";
1565
- _out.dec();
1566
- _out << nl << "else:";
1567
- _out.inc();
1568
- _out << nl << "return r != 0";
1569
- _out.dec();
1570
- _out.dec();
1571
- }
1572
- else
1573
- {
1574
- //
1575
- // Only generate the rich equality operators __eq__ and __ne__.
1576
- //
1577
-
1578
- _out << sp << nl << "def __eq__(self, other):";
1579
- _out.inc();
1580
- _out << nl << "if other is None:";
1581
- _out.inc();
1582
- _out << nl << "return False";
1583
- _out.dec();
1584
- _out << nl << "elif not isinstance(other, _M_" << abs << "):";
1585
- _out.inc();
1586
- _out << nl << "return NotImplemented";
1587
- _out.dec();
1588
- _out << nl << "else:";
1589
- _out.inc();
1590
- for(MemberInfoList::iterator r = memberList.begin(); r != memberList.end(); ++r)
1591
- {
1592
- //
1593
- // The None value is not orderable in Python 3.
1594
- //
1595
- _out << nl << "if self." << r->fixedName << " != other." << r->fixedName << ':';
1596
- _out.inc();
1597
- _out << nl << "return False";
1598
- _out.dec();
1599
- }
1600
- _out << nl << "return True";
1601
- _out.dec();
1602
- _out.dec();
1603
-
1604
- _out << sp << nl << "def __ne__(self, other):";
1605
- _out.inc();
1606
- _out << nl << "return not self.__eq__(other)";
1607
- _out.dec();
1608
- }
1609
-
1610
- //
1611
- // __str__
1612
- //
1613
- _out << sp << nl << "def __str__(self):";
1614
- _out.inc();
1615
- _out << nl << "return IcePy.stringify(self, _M_" << getAbsolute(p, "_t_") << ")";
1616
- _out.dec();
1617
- _out << sp << nl << "__repr__ = __str__";
1618
-
1619
- _out.dec();
1620
-
1621
- //
1622
- // Emit the type information.
1623
- //
1624
- _out << sp << nl << "_M_" << getAbsolute(p, "_t_") << " = IcePy.defineStruct('" << scoped << "', " << name << ", ";
1625
- writeMetaData(p->getMetaData());
1626
- _out << ", (";
1627
- //
1628
- // Data members are represented as a tuple:
1629
- //
1630
- // ('MemberName', MemberMetaData, MemberType)
1631
- //
1632
- // where MemberType is either a primitive type constant (T_INT, etc.) or the id of a constructed type.
1633
- //
1634
- if(memberList.size() > 1)
1635
- {
1636
- _out.inc();
1637
- _out << nl;
1638
- }
1639
- for(MemberInfoList::iterator r = memberList.begin(); r != memberList.end(); ++r)
1640
- {
1641
- if(r != memberList.begin())
1642
- {
1643
- _out << ',' << nl;
1644
- }
1645
- _out << "('" << r->fixedName << "', ";
1646
- writeMetaData(r->dataMember->getMetaData());
1647
- _out << ", ";
1648
- writeType(r->dataMember->type());
1649
- _out << ')';
1650
- }
1651
- if(memberList.size() == 1)
1652
- {
1653
- _out << ',';
1654
- }
1655
- else if(memberList.size() > 1)
1656
- {
1657
- _out.dec();
1658
- _out << nl;
1659
- }
1660
- _out << "))";
1661
-
1662
- registerName(name);
1663
-
1664
- _out.dec();
1665
-
1666
- return false;
1667
- }
1668
-
1669
- void
1670
- Slice::Python::CodeVisitor::visitSequence(const SequencePtr& p)
1671
- {
1672
- static const string protobuf = "python:protobuf:";
1673
- StringList metaData = p->getMetaData();
1674
- bool isCustom = false;
1675
- string customType;
1676
- for(StringList::const_iterator q = metaData.begin(); q != metaData.end(); ++q)
1677
- {
1678
- if(q->find(protobuf) == 0)
1679
- {
1680
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(p->type());
1681
- if(!builtin || builtin->kind() != Builtin::KindByte)
1682
- {
1683
- continue;
1684
- }
1685
- isCustom = true;
1686
- customType = q->substr(protobuf.size());
1687
- break;
1688
- }
1689
- }
1690
-
1691
- //
1692
- // Emit the type information.
1693
- //
1694
- string scoped = p->scoped();
1695
- _out << sp << nl << "if " << getDictLookup(p, "_t_") << ':';
1696
- _out.inc();
1697
- if(isCustom)
1698
- {
1699
- string package = customType.substr(0, customType.find('.'));
1700
- _out << nl << "import " << package;
1701
- _out << nl << "_M_" << getAbsolute(p, "_t_")
1702
- << " = IcePy.defineCustom('" << scoped << "', " << customType << ")";
1703
- }
1704
- else
1705
- {
1706
- _out << nl << "_M_" << getAbsolute(p, "_t_") << " = IcePy.defineSequence('" << scoped << "', ";
1707
- writeMetaData(metaData);
1708
- _out << ", ";
1709
- writeType(p->type());
1710
- _out << ")";
1711
- }
1712
- _out.dec();
1713
- }
1714
-
1715
- void
1716
- Slice::Python::CodeVisitor::visitDictionary(const DictionaryPtr& p)
1717
- {
1718
- //
1719
- // Emit the type information.
1720
- //
1721
- string scoped = p->scoped();
1722
- _out << sp << nl << "if " << getDictLookup(p, "_t_") << ':';
1723
- _out.inc();
1724
- _out << nl << "_M_" << getAbsolute(p, "_t_") << " = IcePy.defineDictionary('" << scoped << "', ";
1725
- writeMetaData(p->getMetaData());
1726
- _out << ", ";
1727
- writeType(p->keyType());
1728
- _out << ", ";
1729
- writeType(p->valueType());
1730
- _out << ")";
1731
- _out.dec();
1732
- }
1733
-
1734
- void
1735
- Slice::Python::CodeVisitor::visitEnum(const EnumPtr& p)
1736
- {
1737
- string scoped = p->scoped();
1738
- string abs = getAbsolute(p);
1739
- string name = fixIdent(p->name());
1740
- EnumeratorList enums = p->enumerators();
1741
- EnumeratorList::iterator q;
1742
-
1743
- _out << sp << nl << "if " << getDictLookup(p) << ':';
1744
- _out.inc();
1745
- _out << nl << "_M_" << abs << " = Ice.createTempClass()";
1746
- _out << nl << "class " << name << "(Ice.EnumBase):";
1747
- _out.inc();
1748
-
1749
- writeDocstring(p->comment(), enums);
1750
-
1751
- _out << sp << nl << "def __init__(self, _n, _v):";
1752
- _out.inc();
1753
- _out << nl << "Ice.EnumBase.__init__(self, _n, _v)";
1754
- _out.dec();
1755
-
1756
- _out << sp << nl << "def valueOf(self, _n):";
1757
- _out.inc();
1758
- _out << nl << "if _n in self._enumerators:";
1759
- _out.inc();
1760
- _out << nl << "return self._enumerators[_n]";
1761
- _out.dec();
1762
- _out << nl << "return None";
1763
- _out.dec();
1764
- _out << nl << "valueOf = classmethod(valueOf)";
1765
-
1766
- _out.dec();
1767
-
1768
- _out << sp;
1769
- for(q = enums.begin(); q != enums.end(); ++q)
1770
- {
1771
- string fixedEnum = fixIdent((*q)->name());
1772
- _out << nl << name << '.' << fixedEnum << " = " << name << "(\"" << (*q)->name() << "\", " << (*q)->value()
1773
- << ')';
1774
- }
1775
- _out << nl << name << "._enumerators = { ";
1776
- for(q = enums.begin(); q != enums.end(); ++q)
1777
- {
1778
- if(q != enums.begin())
1779
- {
1780
- _out << ", ";
1781
- }
1782
- string fixedEnum = fixIdent((*q)->name());
1783
- _out << (*q)->value() << ':' << name << '.' << fixedEnum;
1784
- }
1785
- _out << " }";
1786
-
1787
- //
1788
- // Emit the type information.
1789
- //
1790
- _out << sp << nl << "_M_" << getAbsolute(p, "_t_") << " = IcePy.defineEnum('" << scoped << "', " << name
1791
- << ", ";
1792
- writeMetaData(p->getMetaData());
1793
- _out << ", " << name << "._enumerators)";
1794
-
1795
- registerName(name);
1796
-
1797
- _out.dec();
1798
- }
1799
-
1800
- void
1801
- Slice::Python::CodeVisitor::visitConst(const ConstPtr& p)
1802
- {
1803
- Slice::TypePtr type = p->type();
1804
- string name = fixIdent(p->name());
1805
-
1806
- _out << sp << nl << "_M_" << getAbsolute(p) << " = ";
1807
- writeConstantValue(type, p->valueType(), p->value());
1808
- }
1809
-
1810
- string
1811
- Slice::Python::CodeVisitor::getSymbol(const ContainedPtr& p, const string& prefix, const string& suffix)
1812
- {
1813
- //
1814
- // An explicit reference to another type must always be prefixed with "_M_".
1815
- //
1816
- return "_M_" + getAbsolute(p, prefix, suffix);
1817
- }
1818
-
1819
- void
1820
- Slice::Python::CodeVisitor::registerName(const string& name)
1821
- {
1822
- assert(!_moduleStack.empty());
1823
- _out << sp << nl << "_M_" << _moduleStack.front() << '.' << name << " = " << name;
1824
- _out << nl << "del " << name;
1825
- }
1826
-
1827
- void
1828
- Slice::Python::CodeVisitor::writeType(const TypePtr& p)
1829
- {
1830
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(p);
1831
- if(builtin)
1832
- {
1833
- switch(builtin->kind())
1834
- {
1835
- case Builtin::KindBool:
1836
- {
1837
- _out << "IcePy._t_bool";
1838
- break;
1839
- }
1840
- case Builtin::KindByte:
1841
- {
1842
- _out << "IcePy._t_byte";
1843
- break;
1844
- }
1845
- case Builtin::KindShort:
1846
- {
1847
- _out << "IcePy._t_short";
1848
- break;
1849
- }
1850
- case Builtin::KindInt:
1851
- {
1852
- _out << "IcePy._t_int";
1853
- break;
1854
- }
1855
- case Builtin::KindLong:
1856
- {
1857
- _out << "IcePy._t_long";
1858
- break;
1859
- }
1860
- case Builtin::KindFloat:
1861
- {
1862
- _out << "IcePy._t_float";
1863
- break;
1864
- }
1865
- case Builtin::KindDouble:
1866
- {
1867
- _out << "IcePy._t_double";
1868
- break;
1869
- }
1870
- case Builtin::KindString:
1871
- {
1872
- _out << "IcePy._t_string";
1873
- break;
1874
- }
1875
- case Builtin::KindObject:
1876
- case Builtin::KindValue:
1877
- {
1878
- _out << "IcePy._t_Value";
1879
- break;
1880
- }
1881
- case Builtin::KindObjectProxy:
1882
- {
1883
- _out << "IcePy._t_ObjectPrx";
1884
- break;
1885
- }
1886
- case Builtin::KindLocalObject:
1887
- {
1888
- _out << "IcePy._t_LocalObject";
1889
- break;
1890
- }
1891
- }
1892
- return;
1893
- }
1894
-
1895
- ProxyPtr prx = ProxyPtr::dynamicCast(p);
1896
- if(prx)
1897
- {
1898
- ClassDefPtr def = prx->_class()->definition();
1899
- if(!def || def->isAbstract())
1900
- {
1901
- _out << "_M_" << getAbsolute(prx->_class(), "_t_", "Prx");
1902
- }
1903
- else
1904
- {
1905
- _out << "IcePy._t_ObjectPrx";
1906
- }
1907
- return;
1908
- }
1909
-
1910
- ContainedPtr cont = ContainedPtr::dynamicCast(p);
1911
- assert(cont);
1912
- _out << "_M_" << getAbsolute(cont, "_t_");
1913
- }
1914
-
1915
- void
1916
- Slice::Python::CodeVisitor::writeInitializer(const DataMemberPtr& m)
1917
- {
1918
- TypePtr p = m->type();
1919
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(p);
1920
- if(builtin)
1921
- {
1922
- switch(builtin->kind())
1923
- {
1924
- case Builtin::KindBool:
1925
- {
1926
- _out << "False";
1927
- break;
1928
- }
1929
- case Builtin::KindByte:
1930
- case Builtin::KindShort:
1931
- case Builtin::KindInt:
1932
- case Builtin::KindLong:
1933
- {
1934
- _out << "0";
1935
- break;
1936
- }
1937
- case Builtin::KindFloat:
1938
- case Builtin::KindDouble:
1939
- {
1940
- _out << "0.0";
1941
- break;
1942
- }
1943
- case Builtin::KindString:
1944
- {
1945
- _out << "''";
1946
- break;
1947
- }
1948
- case Builtin::KindValue:
1949
- case Builtin::KindObject:
1950
- case Builtin::KindObjectProxy:
1951
- case Builtin::KindLocalObject:
1952
- {
1953
- _out << "None";
1954
- break;
1955
- }
1956
- }
1957
- return;
1958
- }
1959
-
1960
- EnumPtr en = EnumPtr::dynamicCast(p);
1961
- if(en)
1962
- {
1963
- EnumeratorList enums = en->enumerators();
1964
- _out << getSymbol(en) << "." << fixIdent(enums.front()->name());
1965
- return;
1966
- }
1967
-
1968
- StructPtr st = StructPtr::dynamicCast(p);
1969
- if(st)
1970
- {
1971
- //
1972
- // We cannot emit a call to the struct's constructor here because Python
1973
- // only evaluates this expression once (see bug 3676). Instead, we emit
1974
- // a marker that allows us to determine whether the application has
1975
- // supplied a value.
1976
- //
1977
- _out << "Ice._struct_marker";
1978
- return;
1979
- }
1980
-
1981
- _out << "None";
1982
- }
1983
-
1984
- void
1985
- Slice::Python::CodeVisitor::writeHash(const string& name, const TypePtr& p, int& iter)
1986
- {
1987
- SequencePtr seq = SequencePtr::dynamicCast(p);
1988
- if(seq)
1989
- {
1990
- _out << nl << "if " << name << ':';
1991
- _out.inc();
1992
- _out << nl << "for _i" << iter << " in " << name << ':';
1993
- _out.inc();
1994
- ostringstream elem;
1995
- elem << "_i" << iter;
1996
- iter++;
1997
- writeHash(elem.str(), seq->type(), iter);
1998
- _out.dec();
1999
- _out.dec();
2000
- return;
2001
- }
2002
-
2003
- DictionaryPtr dict = DictionaryPtr::dynamicCast(p);
2004
- if(dict)
2005
- {
2006
- _out << nl << "if " << name << ':';
2007
- _out.inc();
2008
- _out << nl << "for _i" << iter << " in " << name << ':';
2009
- _out.inc();
2010
- ostringstream key;
2011
- key << "_i" << iter;
2012
- ostringstream value;
2013
- value << name << '[' << key.str() << ']';
2014
- iter++;
2015
- writeHash(key.str(), dict->keyType(), iter);
2016
- writeHash(value.str(), dict->valueType(), iter);
2017
- _out.dec();
2018
- _out.dec();
2019
- return;
2020
- }
2021
-
2022
- _out << nl << "_h = 5 * _h + Ice.getHash(" << name << ")";
2023
- }
2024
-
2025
- void
2026
- Slice::Python::CodeVisitor::writeMetaData(const StringList& meta)
2027
- {
2028
- int i = 0;
2029
- _out << '(';
2030
- for(StringList::const_iterator p = meta.begin(); p != meta.end(); ++p)
2031
- {
2032
- if(p->find("python:") == 0)
2033
- {
2034
- if(i > 0)
2035
- {
2036
- _out << ", ";
2037
- }
2038
- _out << "'" << *p << "'";
2039
- ++i;
2040
- }
2041
- }
2042
- if(i == 1)
2043
- {
2044
- _out << ',';
2045
- }
2046
- _out << ')';
2047
- }
2048
-
2049
- void
2050
- Slice::Python::CodeVisitor::writeAssign(const MemberInfo& info)
2051
- {
2052
- string paramName = info.fixedName;
2053
- string memberName = info.fixedName;
2054
-
2055
- //
2056
- // Structures are treated differently (see bug 3676).
2057
- //
2058
- StructPtr st = StructPtr::dynamicCast(info.dataMember->type());
2059
- if(st && !info.dataMember->optional())
2060
- {
2061
- _out << nl << "if " << paramName << " is Ice._struct_marker:";
2062
- _out.inc();
2063
- _out << nl << "self." << memberName << " = " << getSymbol(st) << "()";
2064
- _out.dec();
2065
- _out << nl << "else:";
2066
- _out.inc();
2067
- _out << nl << "self." << memberName << " = " << paramName;
2068
- _out.dec();
2069
- }
2070
- else
2071
- {
2072
- _out << nl << "self." << memberName << " = " << paramName;
2073
- }
2074
- }
2075
-
2076
- void
2077
- Slice::Python::CodeVisitor::writeConstantValue(const TypePtr& type, const SyntaxTreeBasePtr& valueType,
2078
- const string& value)
2079
- {
2080
- ConstPtr constant = ConstPtr::dynamicCast(valueType);
2081
- if(constant)
2082
- {
2083
- _out << "_M_" << getAbsolute(constant);
2084
- }
2085
- else
2086
- {
2087
- Slice::BuiltinPtr b = Slice::BuiltinPtr::dynamicCast(type);
2088
- Slice::EnumPtr en = Slice::EnumPtr::dynamicCast(type);
2089
- if(b)
2090
- {
2091
- switch(b->kind())
2092
- {
2093
- case Slice::Builtin::KindBool:
2094
- {
2095
- _out << (value == "true" ? "True" : "False");
2096
- break;
2097
- }
2098
- case Slice::Builtin::KindByte:
2099
- case Slice::Builtin::KindShort:
2100
- case Slice::Builtin::KindInt:
2101
- case Slice::Builtin::KindFloat:
2102
- case Slice::Builtin::KindDouble:
2103
- case Slice::Builtin::KindLong:
2104
- {
2105
- _out << value;
2106
- break;
2107
- }
2108
- case Slice::Builtin::KindString:
2109
- {
2110
- string sv2 = toStringLiteral(value, "\a\b\f\n\r\t\v", "", Octal, 0);
2111
- string sv3 = toStringLiteral(value, "\a\b\f\n\r\t\v", "", UCN, 0);
2112
-
2113
- _out << "\"" << sv2<< "\"";
2114
- if(sv2 != sv3)
2115
- {
2116
- _out << " if _version_info_[0] < 3 else \"" << sv3 << "\"";
2117
- }
2118
- break;
2119
- }
2120
- case Slice::Builtin::KindValue:
2121
- case Slice::Builtin::KindObject:
2122
- case Slice::Builtin::KindObjectProxy:
2123
- case Slice::Builtin::KindLocalObject:
2124
- assert(false);
2125
- }
2126
- }
2127
- else if(en)
2128
- {
2129
- EnumeratorPtr lte = EnumeratorPtr::dynamicCast(valueType);
2130
- assert(lte);
2131
- _out << getSymbol(lte);
2132
- }
2133
- else
2134
- {
2135
- assert(false); // Unknown const type.
2136
- }
2137
- }
2138
- }
2139
-
2140
- void
2141
- Slice::Python::CodeVisitor::writeConstructorParams(const MemberInfoList& members)
2142
- {
2143
- for(MemberInfoList::const_iterator p = members.begin(); p != members.end(); ++p)
2144
- {
2145
- _out << ", " << p->fixedName << "=";
2146
-
2147
- const DataMemberPtr member = p->dataMember;
2148
- if(member->defaultValueType())
2149
- {
2150
- writeConstantValue(member->type(), member->defaultValueType(), member->defaultValue());
2151
- }
2152
- else if(member->optional())
2153
- {
2154
- _out << "Ice.Unset";
2155
- }
2156
- else
2157
- {
2158
- writeInitializer(member);
2159
- }
2160
- }
2161
- }
2162
-
2163
- string
2164
- Slice::Python::CodeVisitor::getOperationMode(Slice::Operation::Mode mode)
2165
- {
2166
- string result;
2167
- switch(mode)
2168
- {
2169
- case Operation::Normal:
2170
- result = "Ice.OperationMode.Normal";
2171
- break;
2172
- case Operation::Nonmutating:
2173
- result = "Ice.OperationMode.Nonmutating";
2174
- break;
2175
- case Operation::Idempotent:
2176
- result = "Ice.OperationMode.Idempotent";
2177
- break;
2178
- }
2179
- return result;
2180
- }
2181
-
2182
- void
2183
- Slice::Python::CodeVisitor::collectClassMembers(const ClassDefPtr& p, MemberInfoList& allMembers, bool inherited)
2184
- {
2185
- ClassList bases = p->bases();
2186
- if(!bases.empty() && !bases.front()->isInterface())
2187
- {
2188
- collectClassMembers(bases.front(), allMembers, true);
2189
- }
2190
-
2191
- DataMemberList members = p->dataMembers();
2192
-
2193
- for(DataMemberList::iterator q = members.begin(); q != members.end(); ++q)
2194
- {
2195
- MemberInfo m;
2196
- if(p->hasMetaData("protected") || (*q)->hasMetaData("protected"))
2197
- {
2198
- m.fixedName = "_" + fixIdent((*q)->name());
2199
- }
2200
- else
2201
- {
2202
- m.fixedName = fixIdent((*q)->name());
2203
- }
2204
- m.inherited = inherited;
2205
- m.dataMember = *q;
2206
- allMembers.push_back(m);
2207
- }
2208
- }
2209
-
2210
- void
2211
- Slice::Python::CodeVisitor::collectExceptionMembers(const ExceptionPtr& p, MemberInfoList& allMembers, bool inherited)
2212
- {
2213
- ExceptionPtr base = p->base();
2214
- if(base)
2215
- {
2216
- collectExceptionMembers(base, allMembers, true);
2217
- }
2218
-
2219
- DataMemberList members = p->dataMembers();
2220
-
2221
- for(DataMemberList::iterator q = members.begin(); q != members.end(); ++q)
2222
- {
2223
- MemberInfo m;
2224
- m.fixedName = fixIdent((*q)->name());
2225
- m.inherited = inherited;
2226
- m.dataMember = *q;
2227
- allMembers.push_back(m);
2228
- }
2229
- }
2230
-
2231
- Slice::Python::CodeVisitor::StringVec
2232
- Slice::Python::CodeVisitor::stripMarkup(const string& comment)
2233
- {
2234
- //
2235
- // Strip HTML markup and javadoc links.
2236
- //
2237
- string text = comment;
2238
- string::size_type pos = 0;
2239
- do
2240
- {
2241
- pos = text.find('<', pos);
2242
- if(pos != string::npos)
2243
- {
2244
- string::size_type endpos = text.find('>', pos);
2245
- if(endpos == string::npos)
2246
- {
2247
- break;
2248
- }
2249
- text.erase(pos, endpos - pos + 1);
2250
- }
2251
- } while(pos != string::npos);
2252
-
2253
- const string link = "{@link";
2254
- pos = 0;
2255
- do
2256
- {
2257
- pos = text.find(link, pos);
2258
- if(pos != string::npos)
2259
- {
2260
- text.erase(pos, link.size());
2261
- string::size_type endpos = text.find('}', pos);
2262
- if(endpos != string::npos)
2263
- {
2264
- string::size_type identpos = text.find_first_not_of(" \t#", pos);
2265
- if(identpos != string::npos && identpos < endpos)
2266
- {
2267
- string ident = text.substr(identpos, endpos - identpos);
2268
- text.replace(pos, endpos - pos + 1, fixIdent(ident));
2269
- }
2270
- }
2271
- }
2272
- } while(pos != string::npos);
2273
-
2274
- //
2275
- // Strip @see sections.
2276
- //
2277
- static const string seeTag = "@see";
2278
- pos = 0;
2279
- do
2280
- {
2281
- //
2282
- // Look for the next @ and delete up to that, or
2283
- // to the end of the string, if not found.
2284
- //
2285
- pos = text.find(seeTag, pos);
2286
- if(pos != string::npos)
2287
- {
2288
- string::size_type next = text.find('@', pos + seeTag.size());
2289
- if(next != string::npos)
2290
- {
2291
- text.erase(pos, next - pos);
2292
- }
2293
- else
2294
- {
2295
- text.erase(pos, string::npos);
2296
- }
2297
- }
2298
- } while(pos != string::npos);
2299
-
2300
- //
2301
- // Escape triple quotes.
2302
- //
2303
- static const string singleQuotes = "'''";
2304
- pos = 0;
2305
- while((pos = text.find(singleQuotes, pos)) != string::npos)
2306
- {
2307
- text.insert(pos, "\\");
2308
- pos += singleQuotes.size() + 1;
2309
- }
2310
- static const string doubleQuotes = "\"\"\"";
2311
- pos = 0;
2312
- while((pos = text.find(doubleQuotes, pos)) != string::npos)
2313
- {
2314
- text.insert(pos, "\\");
2315
- pos += doubleQuotes.size() + 1;
2316
- }
2317
-
2318
- //
2319
- // Fold multiple empty lines.
2320
- //
2321
- pos = 0;
2322
- while(true)
2323
- {
2324
- pos = text.find('\n', pos);
2325
- if(pos == string::npos)
2326
- {
2327
- break;
2328
- }
2329
-
2330
- //
2331
- // Skip the next LF or CR/LF, if present.
2332
- //
2333
- if(pos < text.size() - 1 && text[pos + 1] == '\n')
2334
- {
2335
- pos += 2;
2336
- }
2337
- else if(pos < text.size() - 2 && text[pos + 1] == '\r' && text[pos + 2] == '\n')
2338
- {
2339
- pos += 3;
2340
- }
2341
- else
2342
- {
2343
- ++pos;
2344
- continue;
2345
- }
2346
-
2347
- //
2348
- // Erase any more CR/LF characters.
2349
- //
2350
- string::size_type next = text.find_first_not_of("\r\n", pos);
2351
- if(next != string::npos)
2352
- {
2353
- text.erase(pos, next - pos);
2354
- }
2355
- }
2356
-
2357
- //
2358
- // Remove trailing whitespace.
2359
- //
2360
- pos = text.find_last_not_of(" \t\r\n");
2361
- if(pos != string::npos)
2362
- {
2363
- text.erase(pos + 1, text.size() - pos - 1);
2364
- }
2365
-
2366
- //
2367
- // Split text into lines.
2368
- //
2369
- StringVec lines;
2370
- if(!text.empty())
2371
- {
2372
- string::size_type start = 0;
2373
- while(start != string::npos)
2374
- {
2375
- string::size_type newline = text.find_first_of("\r\n", start);
2376
- string line;
2377
- if(newline != string::npos)
2378
- {
2379
- line = text.substr(start, newline - start);
2380
- start = newline;
2381
- }
2382
- else
2383
- {
2384
- line = text.substr(start);
2385
- start = text.size();
2386
- }
2387
-
2388
- //
2389
- // Remove trailing whitespace
2390
- //
2391
- pos = line.find_last_not_of(" \t");
2392
- if(pos != string::npos)
2393
- {
2394
- line.erase(pos + 1, line.size() - pos - 1);
2395
- }
2396
-
2397
- lines.push_back(line);
2398
-
2399
- start = text.find_first_not_of("\r\n", start);
2400
- }
2401
- }
2402
-
2403
- return lines;
2404
- }
2405
-
2406
- void
2407
- Slice::Python::CodeVisitor::writeDocstring(const string& comment, const string& prefix)
2408
- {
2409
- StringVec lines = stripMarkup(comment);
2410
- if(lines.empty())
2411
- {
2412
- return;
2413
- }
2414
-
2415
- _out << nl << prefix << "\"\"\"";
2416
-
2417
- for(StringVec::const_iterator q = lines.begin(); q != lines.end(); ++q)
2418
- {
2419
- _out << nl << *q;
2420
- }
2421
-
2422
- _out << nl << "\"\"\"";
2423
- }
2424
-
2425
- void
2426
- Slice::Python::CodeVisitor::writeDocstring(const string& comment, const DataMemberList& members)
2427
- {
2428
- StringVec lines = stripMarkup(comment);
2429
- if(lines.empty())
2430
- {
2431
- return;
2432
- }
2433
-
2434
- _out << nl << "\"\"\"";
2435
-
2436
- for(StringVec::const_iterator q = lines.begin(); q != lines.end(); ++q)
2437
- {
2438
- _out << nl << *q;
2439
- }
2440
-
2441
- if(!members.empty())
2442
- {
2443
- //
2444
- // Collect docstrings (if any) for the members.
2445
- //
2446
- map<string, StringVec> docs;
2447
- for(DataMemberList::const_iterator m = members.begin(); m != members.end(); ++m)
2448
- {
2449
- StringVec doc = stripMarkup((*m)->comment());
2450
- if(!doc.empty())
2451
- {
2452
- docs[(*m)->name()] = doc;
2453
- }
2454
- }
2455
- //
2456
- // Only emit members if there's a docstring for at least one member.
2457
- //
2458
- if(!docs.empty())
2459
- {
2460
- _out << nl << "Members:";
2461
- for(DataMemberList::const_iterator m = members.begin(); m != members.end(); ++m)
2462
- {
2463
- _out << nl << fixIdent((*m)->name()) << " -- ";
2464
- map<string, StringVec>::iterator p = docs.find((*m)->name());
2465
- if(p != docs.end())
2466
- {
2467
- for(StringVec::const_iterator q = p->second.begin(); q != p->second.end(); ++q)
2468
- {
2469
- if(q != p->second.begin())
2470
- {
2471
- _out << nl;
2472
- }
2473
- _out << *q;
2474
- }
2475
- }
2476
- }
2477
- }
2478
- }
2479
-
2480
- _out << nl << "\"\"\"";
2481
- }
2482
-
2483
- void
2484
- Slice::Python::CodeVisitor::writeDocstring(const string& comment, const EnumeratorList& enums)
2485
- {
2486
- StringVec lines = stripMarkup(comment);
2487
- if(lines.empty())
2488
- {
2489
- return;
2490
- }
2491
-
2492
- _out << nl << "\"\"\"";
2493
-
2494
- for(StringVec::const_iterator q = lines.begin(); q != lines.end(); ++q)
2495
- {
2496
- _out << nl << *q;
2497
- }
2498
-
2499
- if(!enums.empty())
2500
- {
2501
- //
2502
- // Collect docstrings (if any) for the enumerators.
2503
- //
2504
- map<string, StringVec> docs;
2505
- for(EnumeratorList::const_iterator e = enums.begin(); e != enums.end(); ++e)
2506
- {
2507
- StringVec doc = stripMarkup((*e)->comment());
2508
- if(!doc.empty())
2509
- {
2510
- docs[(*e)->name()] = doc;
2511
- }
2512
- }
2513
- //
2514
- // Only emit enumerators if there's a docstring for at least one enumerator.
2515
- //
2516
- if(!docs.empty())
2517
- {
2518
- _out << nl << "Enumerators:";
2519
- for(EnumeratorList::const_iterator e = enums.begin(); e != enums.end(); ++e)
2520
- {
2521
- _out << nl << fixIdent((*e)->name()) << " -- ";
2522
- map<string, StringVec>::iterator p = docs.find((*e)->name());
2523
- if(p != docs.end())
2524
- {
2525
- for(StringVec::const_iterator q = p->second.begin(); q != p->second.end(); ++q)
2526
- {
2527
- if(q != p->second.begin())
2528
- {
2529
- _out << nl;
2530
- }
2531
- _out << *q;
2532
- }
2533
- }
2534
- }
2535
- }
2536
- }
2537
-
2538
- _out << nl << "\"\"\"";
2539
- }
2540
-
2541
- bool
2542
- Slice::Python::CodeVisitor::parseOpComment(const string& comment, OpComment& c)
2543
- {
2544
- //
2545
- // Remove most javadoc & HTML markup.
2546
- //
2547
- StringVec lines = stripMarkup(comment);
2548
- if(lines.empty())
2549
- {
2550
- return false;
2551
- }
2552
-
2553
- //
2554
- // Extract the descriptions of parameters, exceptions and return values.
2555
- //
2556
- string name;
2557
- bool inParam = false, inException = false, inReturn = false;
2558
- vector<string>::iterator i = lines.begin();
2559
- while(i != lines.end())
2560
- {
2561
- string l = *i;
2562
- string::size_type paramTag = l.find("@param");
2563
- string::size_type throwTag = l.find("@throw");
2564
- string::size_type returnTag = l.find("@return");
2565
-
2566
- if(paramTag != string::npos)
2567
- {
2568
- string::size_type pos = l.find_first_of(" \t", paramTag);
2569
- if(pos != string::npos)
2570
- {
2571
- pos = l.find_first_not_of(" \t", pos);
2572
- }
2573
- if(pos != string::npos)
2574
- {
2575
- string::size_type namePos = pos;
2576
- pos = l.find_first_of(" \t", pos);
2577
- inParam = true;
2578
- inException = false;
2579
- inReturn = false;
2580
- if(pos == string::npos)
2581
- {
2582
- //
2583
- // Doc assumed to have the format
2584
- //
2585
- // @param foo
2586
- // Description of foo...
2587
- //
2588
- name = l.substr(namePos);
2589
- c.params[name] = "";
2590
- }
2591
- else
2592
- {
2593
- name = l.substr(namePos, pos - namePos);
2594
- pos = l.find_first_not_of(" \t", pos);
2595
- if(pos != string::npos)
2596
- {
2597
- c.params[name] = l.substr(pos);
2598
- }
2599
- else
2600
- {
2601
- c.params[name] = "";
2602
- }
2603
- }
2604
- }
2605
- i = lines.erase(i);
2606
- continue;
2607
- }
2608
- else if(throwTag != string::npos)
2609
- {
2610
- string::size_type pos = l.find_first_of(" \t", throwTag);
2611
- if(pos != string::npos)
2612
- {
2613
- pos = l.find_first_not_of(" \t", pos);
2614
- }
2615
- if(pos != string::npos)
2616
- {
2617
- string::size_type namePos = pos;
2618
- pos = l.find_first_of(" \t", pos);
2619
- inException = true;
2620
- inParam = false;
2621
- inReturn = false;
2622
- if(pos == string::npos)
2623
- {
2624
- //
2625
- // Doc assumed to have the format
2626
- //
2627
- // @throw foo
2628
- // Description of foo...
2629
- //
2630
- name = l.substr(namePos);
2631
- c.exceptions[name] = "";
2632
- }
2633
- else
2634
- {
2635
- name = l.substr(namePos, pos - namePos);
2636
- pos = l.find_first_not_of(" \t", pos);
2637
- if(pos != string::npos)
2638
- {
2639
- c.exceptions[name] = l.substr(pos);
2640
- }
2641
- else
2642
- {
2643
- c.exceptions[name] = "";
2644
- }
2645
- }
2646
- }
2647
- i = lines.erase(i);
2648
- continue;
2649
- }
2650
- else if(returnTag != string::npos)
2651
- {
2652
- string::size_type pos = l.find_first_of(" \t", returnTag);
2653
- if(pos != string::npos)
2654
- {
2655
- pos = l.find_first_not_of(" \t", pos);
2656
- }
2657
- if(pos != string::npos)
2658
- {
2659
- inReturn = true;
2660
- inException = false;
2661
- inParam = false;
2662
- c.returns = l.substr(pos);
2663
- }
2664
- i = lines.erase(i);
2665
- continue;
2666
- }
2667
- else
2668
- {
2669
- //
2670
- // We didn't find a tag so we assume this line is a continuation of a
2671
- // previous description.
2672
- //
2673
- string::size_type pos = l.find_first_not_of(" \t");
2674
- if(pos != string::npos && l[pos] != '@')
2675
- {
2676
- if(inParam)
2677
- {
2678
- assert(!name.empty());
2679
- if(!c.params[name].empty())
2680
- {
2681
- c.params[name] += " ";
2682
- }
2683
- c.params[name] += l.substr(pos);
2684
- i = lines.erase(i);
2685
- continue;
2686
- }
2687
- else if(inException)
2688
- {
2689
- assert(!name.empty());
2690
- if(!c.exceptions[name].empty())
2691
- {
2692
- c.exceptions[name] += " ";
2693
- }
2694
- c.exceptions[name] += l.substr(pos);
2695
- i = lines.erase(i);
2696
- continue;
2697
- }
2698
- else if(inReturn)
2699
- {
2700
- if(!c.returns.empty())
2701
- {
2702
- c.returns += " ";
2703
- }
2704
- c.returns += l.substr(pos);
2705
- i = lines.erase(i);
2706
- continue;
2707
- }
2708
- }
2709
- }
2710
-
2711
- i++;
2712
- }
2713
-
2714
- //
2715
- // All remaining lines become the general description.
2716
- //
2717
- for(vector<string>::iterator p = lines.begin(); p != lines.end(); ++p)
2718
- {
2719
- if(p->find_first_not_of(" \t\n\r") != string::npos)
2720
- {
2721
- c.description.push_back(*p);
2722
- }
2723
- }
2724
-
2725
- return true;
2726
- }
2727
-
2728
- void
2729
- Slice::Python::CodeVisitor::writeDocstring(const OperationPtr& op, DocstringMode mode, bool local)
2730
- {
2731
- OpComment comment;
2732
- if(!parseOpComment(op->comment(), comment))
2733
- {
2734
- return;
2735
- }
2736
-
2737
- TypePtr ret = op->returnType();
2738
- ParamDeclList params = op->parameters();
2739
- vector<string> inParams, outParams;
2740
- for(ParamDeclList::iterator p = params.begin(); p != params.end(); ++p)
2741
- {
2742
- if((*p)->isOutParam())
2743
- {
2744
- outParams.push_back((*p)->name());
2745
- }
2746
- else
2747
- {
2748
- inParams.push_back((*p)->name());
2749
- }
2750
- }
2751
-
2752
- if(comment.description.empty())
2753
- {
2754
- if((mode == DocSync || mode == DocDispatch) && comment.params.empty() && comment.exceptions.empty() &&
2755
- comment.returns.empty())
2756
- {
2757
- return;
2758
- }
2759
- else if((mode == DocAsync || mode == DocAsyncBegin) && inParams.empty())
2760
- {
2761
- return;
2762
- }
2763
- else if(mode == DocAsyncEnd && outParams.empty() && comment.returns.empty())
2764
- {
2765
- return;
2766
- }
2767
- else if(mode == DocAsyncDispatch && inParams.empty() && comment.exceptions.empty())
2768
- {
2769
- return;
2770
- }
2771
- }
2772
-
2773
- //
2774
- // Emit the general description.
2775
- //
2776
- _out << nl << "\"\"\"";
2777
- if(!comment.description.empty())
2778
- {
2779
- for(StringVec::const_iterator q = comment.description.begin(); q != comment.description.end(); ++q)
2780
- {
2781
- _out << nl << *q;
2782
- }
2783
- }
2784
-
2785
- //
2786
- // Emit arguments.
2787
- //
2788
- bool needArgs = false;
2789
- switch(mode)
2790
- {
2791
- case DocSync:
2792
- case DocAsync:
2793
- case DocAsyncBegin:
2794
- case DocDispatch:
2795
- needArgs = !local || !inParams.empty();
2796
- break;
2797
- case DocAsyncEnd:
2798
- case DocAsyncDispatch:
2799
- needArgs = true;
2800
- break;
2801
- }
2802
-
2803
- if(needArgs)
2804
- {
2805
- _out << nl << "Arguments:";
2806
- for(vector<string>::iterator q = inParams.begin(); q != inParams.end(); ++q)
2807
- {
2808
- string fixed = fixIdent(*q);
2809
- _out << nl << fixed << " -- ";
2810
- StringMap::const_iterator r = comment.params.find(*q);
2811
- if(r == comment.params.end())
2812
- {
2813
- r = comment.params.find(fixed); // Just in case.
2814
- }
2815
- if(r != comment.params.end())
2816
- {
2817
- _out << r->second;
2818
- }
2819
- }
2820
- if(mode == DocAsyncBegin)
2821
- {
2822
- _out << nl << "_response -- The asynchronous response callback."
2823
- << nl << "_ex -- The asynchronous exception callback."
2824
- << nl << "_sent -- The asynchronous sent callback.";
2825
- }
2826
- if(!local && (mode == DocSync || mode == DocAsync || mode == DocAsyncBegin))
2827
- {
2828
- const string contextParamName = getEscapedParamName(op, "context");
2829
- _out << nl << contextParamName << " -- The request context for the invocation.";
2830
- }
2831
- if(!local && (mode == DocDispatch || mode == DocAsyncDispatch))
2832
- {
2833
- const string currentParamName = getEscapedParamName(op, "current");
2834
- _out << nl << currentParamName << " -- The Current object for the invocation.";
2835
- }
2836
- }
2837
- else if(mode == DocAsyncEnd)
2838
- {
2839
- _out << nl << "Arguments:"
2840
- << nl << "_r - The asynchronous result object for the invocation.";
2841
- }
2842
-
2843
- //
2844
- // Emit return value(s).
2845
- //
2846
- if(mode == DocAsync || mode == DocAsyncDispatch)
2847
- {
2848
- _out << nl << "Returns: A future object for the invocation.";
2849
- }
2850
- if(mode == DocAsyncBegin)
2851
- {
2852
- _out << nl << "Returns: An asynchronous result object for the invocation.";
2853
- }
2854
-
2855
- if((mode == DocSync || mode == DocAsyncEnd || mode == DocDispatch) && (ret || !outParams.empty()))
2856
- {
2857
- if((outParams.size() + (ret ? 1 : 0)) > 1)
2858
- {
2859
- _out << nl << "Returns a tuple containing the following:";
2860
- if(ret)
2861
- {
2862
- _out << nl << "_retval -- " << comment.returns;
2863
- }
2864
- for(vector<string>::iterator q = outParams.begin(); q != outParams.end(); ++q)
2865
- {
2866
- string fixed = fixIdent(*q);
2867
- _out << nl << fixed << " -- ";
2868
- StringMap::const_iterator r = comment.params.find(*q);
2869
- if(r == comment.params.end())
2870
- {
2871
- r = comment.params.find(fixed); // Just in case.
2872
- }
2873
- if(r != comment.params.end())
2874
- {
2875
- _out << r->second;
2876
- }
2877
- }
2878
- }
2879
- else if(ret && !comment.returns.empty())
2880
- {
2881
- _out << nl << "Returns: " << comment.returns;
2882
- }
2883
- else if(!outParams.empty())
2884
- {
2885
- assert(outParams.size() == 1);
2886
- _out << nl << "Returns:";
2887
- string fixed = fixIdent(outParams[0]);
2888
- _out << nl << fixed << " -- ";
2889
- StringMap::const_iterator r = comment.params.find(outParams[0]);
2890
- if(r == comment.params.end())
2891
- {
2892
- r = comment.params.find(fixed); // Just in case.
2893
- }
2894
- if(r != comment.params.end())
2895
- {
2896
- _out << r->second;
2897
- }
2898
- }
2899
- }
2900
-
2901
- //
2902
- // Emit exceptions.
2903
- //
2904
- if((mode == DocSync || mode == DocAsyncEnd || mode == DocDispatch || mode == DocAsyncDispatch) &&
2905
- !comment.exceptions.empty())
2906
- {
2907
- _out << nl << "Throws:";
2908
- for(StringMap::const_iterator r = comment.exceptions.begin(); r != comment.exceptions.end(); ++r)
2909
- {
2910
- _out << nl << r->first << " -- " << r->second;
2911
- }
2912
- }
2913
- _out << nl << "\"\"\"";
2914
- }
2915
-
2916
- string
2917
- Slice::Python::getPackageDirectory(const string& file, const UnitPtr& ut)
2918
- {
2919
- //
2920
- // file must be a fully-qualified path name.
2921
- //
2922
-
2923
- //
2924
- // Check if the file contains the python:pkgdir file metadata.
2925
- //
2926
- DefinitionContextPtr dc = ut->findDefinitionContext(file);
2927
- assert(dc);
2928
- const string prefix = "python:pkgdir:";
2929
- string pkgdir = dc->findMetaData(prefix);
2930
- if(!pkgdir.empty())
2931
- {
2932
- //
2933
- // The metadata is present, so the generated file was placed in the specified directory.
2934
- //
2935
- pkgdir = pkgdir.substr(prefix.size());
2936
- assert(!pkgdir.empty()); // This situation should have been caught by MetaDataVisitor.
2937
- }
2938
- return pkgdir;
2939
- }
2940
-
2941
- string
2942
- Slice::Python::getImportFileName(const string& file, const UnitPtr& ut, const vector<string>& includePaths)
2943
- {
2944
- //
2945
- // The file and includePaths arguments must be fully-qualified path names.
2946
- //
2947
-
2948
- //
2949
- // Check if the file contains the python:pkgdir file metadata.
2950
- //
2951
- string pkgdir = getPackageDirectory(file, ut);
2952
- if(!pkgdir.empty())
2953
- {
2954
- //
2955
- // The metadata is present, so the generated file was placed in the specified directory.
2956
- //
2957
- vector<string> names;
2958
- IceUtilInternal::splitString(pkgdir, "/", names);
2959
- assert(!names.empty());
2960
- pkgdir = "";
2961
- for(vector<string>::iterator p = names.begin(); p != names.end(); ++p)
2962
- {
2963
- if(p != names.begin())
2964
- {
2965
- pkgdir += ".";
2966
- }
2967
- pkgdir += fixIdent(*p);
2968
- }
2969
- string::size_type pos = file.rfind('/');
2970
- assert(pos != string::npos);
2971
- string name = file.substr(pos + 1); // Get the name of the file without the leading path.
2972
- assert(!name.empty());
2973
- replace(name.begin(), name.end(), '.', '_'); // Convert .ice to _ice
2974
- return pkgdir + "." + name;
2975
- }
2976
- else
2977
- {
2978
- //
2979
- // The metadata is not present, so we transform the file name using the include paths (-I)
2980
- // given to the compiler.
2981
- //
2982
- string name = changeInclude(file, includePaths);
2983
- replace(name.begin(), name.end(), '/', '_');
2984
- return name + "_ice";
2985
- }
2986
- }
2987
-
2988
- void
2989
- Slice::Python::generate(const UnitPtr& un, bool all, bool checksum, const vector<string>& includePaths,
2990
- Output& out)
2991
- {
2992
- Slice::Python::MetaDataVisitor visitor;
2993
- un->visit(&visitor, false);
2994
-
2995
- out << nl << "from sys import version_info as _version_info_";
2996
- out << nl << "import Ice, IcePy";
2997
-
2998
- if(!all)
2999
- {
3000
- vector<string> paths = includePaths;
3001
- for(vector<string>::iterator p = paths.begin(); p != paths.end(); ++p)
3002
- {
3003
- *p = fullPath(*p);
3004
- }
3005
-
3006
- StringList includes = un->includeFiles();
3007
- for(StringList::const_iterator q = includes.begin(); q != includes.end(); ++q)
3008
- {
3009
- out << nl << "import " << getImportFileName(*q, un, paths);
3010
- }
3011
- }
3012
-
3013
- set<string> moduleHistory;
3014
-
3015
- ModuleVisitor moduleVisitor(out, moduleHistory);
3016
- un->visit(&moduleVisitor, true);
3017
-
3018
- CodeVisitor codeVisitor(out, moduleHistory);
3019
- un->visit(&codeVisitor, false);
3020
-
3021
- if(checksum)
3022
- {
3023
- ChecksumMap checksums = createChecksums(un);
3024
- if(!checksums.empty())
3025
- {
3026
- out << sp;
3027
- for(ChecksumMap::const_iterator p = checksums.begin(); p != checksums.end(); ++p)
3028
- {
3029
- out << nl << "Ice.sliceChecksums[\"" << p->first << "\"] = \"";
3030
- ostringstream str;
3031
- str.flags(ios_base::hex);
3032
- str.fill('0');
3033
- for(vector<unsigned char>::const_iterator q = p->second.begin(); q != p->second.end(); ++q)
3034
- {
3035
- str << static_cast<int>(*q);
3036
- }
3037
- out << str.str() << "\"";
3038
- }
3039
- }
3040
- }
3041
-
3042
- out << nl; // Trailing newline.
3043
- }
3044
-
3045
- string
3046
- Slice::Python::scopedToName(const string& scoped)
3047
- {
3048
- string result = fixIdent(scoped);
3049
- if(result.find("::") == 0)
3050
- {
3051
- result.erase(0, 2);
3052
- }
3053
-
3054
- string::size_type pos;
3055
- while((pos = result.find("::")) != string::npos)
3056
- {
3057
- result.replace(pos, 2, ".");
3058
- }
3059
-
3060
- return result;
3061
- }
3062
-
3063
- string
3064
- Slice::Python::fixIdent(const string& ident)
3065
- {
3066
- if(ident[0] != ':')
3067
- {
3068
- return lookupKwd(ident);
3069
- }
3070
- vector<string> ids = splitScopedName(ident);
3071
- #ifdef ICE_CPP11_COMPILER
3072
- transform(ids.begin(), ids.end(), ids.begin(), [](const string& id) -> string { return lookupKwd(id); });
3073
- #else
3074
- transform(ids.begin(), ids.end(), ids.begin(), ptr_fun(lookupKwd));
3075
- #endif
3076
- stringstream result;
3077
- for(vector<string>::const_iterator i = ids.begin(); i != ids.end(); ++i)
3078
- {
3079
- result << "::" + *i;
3080
- }
3081
- return result.str();
3082
- }
3083
-
3084
- string
3085
- Slice::Python::getPackageMetadata(const ContainedPtr& cont)
3086
- {
3087
- //
3088
- // Traverse to the top-level module.
3089
- //
3090
- ModulePtr m;
3091
- ContainedPtr p = cont;
3092
- while(true)
3093
- {
3094
- if(ModulePtr::dynamicCast(p))
3095
- {
3096
- m = ModulePtr::dynamicCast(p);
3097
- }
3098
-
3099
- ContainerPtr c = p->container();
3100
- p = ContainedPtr::dynamicCast(c); // This cast fails for Unit.
3101
- if(!p)
3102
- {
3103
- break;
3104
- }
3105
- }
3106
-
3107
- assert(m);
3108
-
3109
- //
3110
- // The python:package metadata can be defined as file metadata or applied to a top-level module.
3111
- // We check for the metadata at the top-level module first and then fall back to the global scope.
3112
- //
3113
- static const string prefix = "python:package:";
3114
-
3115
- string q;
3116
- if(!m->findMetaData(prefix, q))
3117
- {
3118
- UnitPtr ut = cont->unit();
3119
- string file = cont->file();
3120
- assert(!file.empty());
3121
-
3122
- DefinitionContextPtr dc = ut->findDefinitionContext(file);
3123
- assert(dc);
3124
- q = dc->findMetaData(prefix);
3125
- }
3126
-
3127
- if(!q.empty())
3128
- {
3129
- q = q.substr(prefix.size());
3130
- }
3131
-
3132
- return q;
3133
- }
3134
-
3135
- string
3136
- Slice::Python::getAbsolute(const ContainedPtr& cont, const string& suffix, const string& nameSuffix)
3137
- {
3138
- string scope = scopedToName(cont->scope());
3139
-
3140
- string package = getPackageMetadata(cont);
3141
- if(!package.empty())
3142
- {
3143
- if(!scope.empty())
3144
- {
3145
- scope = package + "." + scope;
3146
- }
3147
- else
3148
- {
3149
- scope = package + ".";
3150
- }
3151
- }
3152
-
3153
- return scope + suffix + fixIdent(cont->name() + nameSuffix);
3154
- }
3155
-
3156
- void
3157
- Slice::Python::printHeader(IceUtilInternal::Output& out)
3158
- {
3159
- static const char* header =
3160
- "#\n"
3161
- "# Copyright (c) ZeroC, Inc. All rights reserved.\n"
3162
- "#\n"
3163
- ;
3164
-
3165
- out << header;
3166
- out << "#\n";
3167
- out << "# Ice version " << ICE_STRING_VERSION << "\n";
3168
- out << "#\n";
3169
- }
3170
-
3171
- bool
3172
- Slice::Python::MetaDataVisitor::visitUnitStart(const UnitPtr& p)
3173
- {
3174
- static const string prefix = "python:";
3175
-
3176
- //
3177
- // Validate file metadata in the top-level file and all included files.
3178
- //
3179
- StringList files = p->allFiles();
3180
- for(StringList::iterator q = files.begin(); q != files.end(); ++q)
3181
- {
3182
- string file = *q;
3183
- DefinitionContextPtr dc = p->findDefinitionContext(file);
3184
- assert(dc);
3185
- StringList globalMetaData = dc->getMetaData();
3186
- for(StringList::const_iterator r = globalMetaData.begin(); r != globalMetaData.end();)
3187
- {
3188
- string s = *r++;
3189
- if(s.find(prefix) == 0)
3190
- {
3191
- static const string packagePrefix = "python:package:";
3192
- if(s.find(packagePrefix) == 0 && s.size() > packagePrefix.size())
3193
- {
3194
- continue;
3195
- }
3196
- static const string pkgdirPrefix = "python:pkgdir:";
3197
- if(s.find(pkgdirPrefix) == 0 && s.size() > pkgdirPrefix.size())
3198
- {
3199
- continue;
3200
- }
3201
-
3202
- dc->warning(InvalidMetaData, file, "", "ignoring invalid file metadata `" + s + "'");
3203
- globalMetaData.remove(s);
3204
- }
3205
- }
3206
- dc->setMetaData(globalMetaData);
3207
- }
3208
- return true;
3209
- }
3210
-
3211
- bool
3212
- Slice::Python::MetaDataVisitor::visitModuleStart(const ModulePtr& p)
3213
- {
3214
- static const string prefix = "python:package:";
3215
-
3216
- StringList metaData = p->getMetaData();
3217
- for(StringList::const_iterator r = metaData.begin(); r != metaData.end();)
3218
- {
3219
- string s = *r++;
3220
- if(s.find(prefix) == 0)
3221
- {
3222
- //
3223
- // Must be a top-level module.
3224
- //
3225
- if(UnitPtr::dynamicCast(p->container()))
3226
- {
3227
- continue;
3228
- }
3229
- }
3230
-
3231
- if(s.find("python:") == 0)
3232
- {
3233
- p->definitionContext()->warning(InvalidMetaData, p->file(), "", "ignoring invalid metadata `" + s + "'");
3234
- metaData.remove(s);
3235
- }
3236
- }
3237
-
3238
- p->setMetaData(metaData);
3239
- return true;
3240
- }
3241
-
3242
- void
3243
- Slice::Python::MetaDataVisitor::visitClassDecl(const ClassDeclPtr& p)
3244
- {
3245
- reject(p);
3246
- }
3247
-
3248
- bool
3249
- Slice::Python::MetaDataVisitor::visitClassDefStart(const ClassDefPtr& p)
3250
- {
3251
- reject(p);
3252
- return true;
3253
- }
3254
-
3255
- bool
3256
- Slice::Python::MetaDataVisitor::visitExceptionStart(const ExceptionPtr& p)
3257
- {
3258
- reject(p);
3259
- return true;
3260
- }
3261
-
3262
- bool
3263
- Slice::Python::MetaDataVisitor::visitStructStart(const StructPtr& p)
3264
- {
3265
- reject(p);
3266
- return true;
3267
- }
3268
-
3269
- void
3270
- Slice::Python::MetaDataVisitor::visitOperation(const OperationPtr& p)
3271
- {
3272
- TypePtr ret = p->returnType();
3273
- if(ret)
3274
- {
3275
- validateSequence(p->file(), p->line(), ret, p->getMetaData());
3276
- }
3277
-
3278
- ParamDeclList params = p->parameters();
3279
- for(ParamDeclList::iterator q = params.begin(); q != params.end(); ++q)
3280
- {
3281
- validateSequence(p->file(), (*q)->line(), (*q)->type(), (*q)->getMetaData());
3282
- }
3283
- }
3284
-
3285
- void
3286
- Slice::Python::MetaDataVisitor::visitDataMember(const DataMemberPtr& p)
3287
- {
3288
- validateSequence(p->file(), p->line(), p->type(), p->getMetaData());
3289
- }
3290
-
3291
- void
3292
- Slice::Python::MetaDataVisitor::visitSequence(const SequencePtr& p)
3293
- {
3294
- static const string protobuf = "python:protobuf:";
3295
- StringList metaData = p->getMetaData();
3296
- const string file = p->file();
3297
- const string line = p->line();
3298
- StringList protobufMetaData;
3299
- const UnitPtr ut = p->unit();
3300
- const DefinitionContextPtr dc = ut->findDefinitionContext(file);
3301
- assert(dc);
3302
-
3303
- for(StringList::const_iterator q = metaData.begin(); q != metaData.end(); )
3304
- {
3305
- string s = *q++;
3306
- if(s.find(protobuf) == 0)
3307
- {
3308
- //
3309
- // Remove from list so validateSequence does not try to handle as well.
3310
- //
3311
- metaData.remove(s);
3312
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(p->type());
3313
- if(!builtin || builtin->kind() != Builtin::KindByte)
3314
- {
3315
- dc->warning(InvalidMetaData, file, line, "ignoring invalid metadata `" + s + ": " +
3316
- "`protobuf' encoding must be a byte sequence");
3317
- }
3318
- else
3319
- {
3320
- protobufMetaData.push_back(s);
3321
- }
3322
- }
3323
- }
3324
-
3325
- metaData = validateSequence(file, line, p, metaData);
3326
- metaData.insert(metaData.end(), protobufMetaData.begin(), protobufMetaData.end());
3327
- p->setMetaData(metaData);
3328
- }
3329
-
3330
- void
3331
- Slice::Python::MetaDataVisitor::visitDictionary(const DictionaryPtr& p)
3332
- {
3333
- reject(p);
3334
- }
3335
-
3336
- void
3337
- Slice::Python::MetaDataVisitor::visitEnum(const EnumPtr& p)
3338
- {
3339
- reject(p);
3340
- }
3341
-
3342
- void
3343
- Slice::Python::MetaDataVisitor::visitConst(const ConstPtr& p)
3344
- {
3345
- reject(p);
3346
- }
3347
-
3348
- StringList
3349
- Slice::Python::MetaDataVisitor::validateSequence(const string& file, const string& line,
3350
- const TypePtr& type, const StringList& metaData)
3351
- {
3352
- const UnitPtr ut = type->unit();
3353
- const DefinitionContextPtr dc = ut->findDefinitionContext(file);
3354
- assert(dc);
3355
-
3356
- static const string prefix = "python:";
3357
- StringList newMetaData = metaData;
3358
- for(StringList::const_iterator p = newMetaData.begin(); p != newMetaData.end();)
3359
- {
3360
- string s = *p++;
3361
- if(s.find(prefix) == 0)
3362
- {
3363
- SequencePtr seq = SequencePtr::dynamicCast(type);
3364
- if(seq)
3365
- {
3366
- static const string seqPrefix = "python:seq:";
3367
- if(s.find(seqPrefix) == 0)
3368
- {
3369
- string arg = s.substr(seqPrefix.size());
3370
- if(arg == "tuple" || arg == "list" || arg == "default")
3371
- {
3372
- continue;
3373
- }
3374
- }
3375
- else if(s.size() > prefix.size())
3376
- {
3377
- string arg = s.substr(prefix.size());
3378
- if(arg == "tuple" || arg == "list" || arg == "default")
3379
- {
3380
- continue;
3381
- }
3382
- else if(arg == "array.array" || arg == "numpy.ndarray" || arg.find("memoryview:") == 0)
3383
- {
3384
- //
3385
- // The memoryview sequence metadata is only valid for integral builtin
3386
- // types excluding strings.
3387
- //
3388
- BuiltinPtr builtin = BuiltinPtr::dynamicCast(seq->type());
3389
- if(builtin)
3390
- {
3391
- switch(builtin->kind())
3392
- {
3393
- case Builtin::KindBool:
3394
- case Builtin::KindByte:
3395
- case Builtin::KindShort:
3396
- case Builtin::KindInt:
3397
- case Builtin::KindLong:
3398
- case Builtin::KindFloat:
3399
- case Builtin::KindDouble:
3400
- {
3401
- continue;
3402
- }
3403
- default:
3404
- {
3405
- break;
3406
- }
3407
- }
3408
- }
3409
- }
3410
- }
3411
- }
3412
- dc->warning(InvalidMetaData, file, line, "ignoring invalid metadata `" + s + "'");
3413
- newMetaData.remove(s);
3414
- }
3415
- }
3416
- return newMetaData;
3417
- }
3418
-
3419
- void
3420
- Slice::Python::MetaDataVisitor::reject(const ContainedPtr& cont)
3421
- {
3422
- StringList localMetaData = cont->getMetaData();
3423
- static const string prefix = "python:";
3424
-
3425
- const UnitPtr ut = cont->unit();
3426
- const DefinitionContextPtr dc = ut->findDefinitionContext(cont->file());
3427
- assert(dc);
3428
-
3429
- for(StringList::const_iterator p = localMetaData.begin(); p != localMetaData.end();)
3430
- {
3431
- string s = *p++;
3432
- if(s.find(prefix) == 0)
3433
- {
3434
- dc->warning(InvalidMetaData, cont->file(), cont->line(), "ignoring invalid metadata `" + s + "'");
3435
- localMetaData.remove(s);
3436
- }
3437
- }
3438
- cont->setMetaData(localMetaData);
3439
- }