zeroc-ice 3.6.5 → 3.7.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (777) hide show
  1. checksums.yaml +5 -5
  2. data/ICE_LICENSE +17 -17
  3. data/LICENSE +12 -12
  4. data/bin/slice2rb +1 -6
  5. data/ext/Communicator.cpp +223 -61
  6. data/ext/Communicator.h +1 -6
  7. data/ext/Config.h +23 -7
  8. data/ext/Connection.cpp +108 -76
  9. data/ext/Connection.h +4 -6
  10. data/ext/Endpoint.cpp +16 -54
  11. data/ext/Endpoint.h +1 -6
  12. data/ext/ImplicitContext.cpp +1 -10
  13. data/ext/ImplicitContext.h +1 -6
  14. data/ext/Init.cpp +4 -6
  15. data/ext/Logger.cpp +1 -6
  16. data/ext/Logger.h +1 -6
  17. data/ext/Operation.cpp +38 -54
  18. data/ext/Operation.h +1 -6
  19. data/ext/Properties.cpp +3 -8
  20. data/ext/Properties.h +1 -6
  21. data/ext/Proxy.cpp +111 -70
  22. data/ext/Proxy.h +1 -6
  23. data/ext/Slice.cpp +5 -20
  24. data/ext/Slice.h +1 -6
  25. data/ext/Types.cpp +313 -224
  26. data/ext/Types.h +118 -71
  27. data/ext/Util.cpp +69 -36
  28. data/ext/Util.h +117 -42
  29. data/ext/ValueFactoryManager.cpp +440 -0
  30. data/ext/ValueFactoryManager.h +95 -0
  31. data/ext/extconf.rb +52 -48
  32. data/ext/ice/cpp/include/Ice/Application.h +275 -105
  33. data/ext/ice/cpp/include/Ice/AsyncResult.h +124 -337
  34. data/ext/ice/cpp/include/Ice/AsyncResultF.h +4 -7
  35. data/ext/ice/cpp/include/Ice/BatchRequestInterceptor.h +39 -16
  36. data/ext/ice/cpp/include/Ice/BatchRequestQueueF.h +1 -6
  37. data/ext/ice/cpp/include/Ice/Buffer.h +10 -15
  38. data/ext/ice/cpp/include/Ice/CommunicatorAsync.h +56 -17
  39. data/ext/ice/cpp/include/Ice/Comparable.h +205 -0
  40. data/ext/ice/cpp/include/Ice/Config.h +16 -39
  41. data/ext/ice/cpp/include/Ice/ConnectionAsync.h +203 -16
  42. data/ext/ice/cpp/include/Ice/ConnectionIF.h +7 -6
  43. data/ext/ice/cpp/include/Ice/ConsoleUtil.h +23 -0
  44. data/ext/ice/cpp/include/Ice/DefaultValueFactory.h +57 -0
  45. data/ext/ice/cpp/include/Ice/DispatchInterceptor.h +20 -12
  46. data/ext/ice/cpp/include/Ice/Dispatcher.h +35 -19
  47. data/ext/ice/cpp/include/Ice/DynamicLibrary.h +7 -10
  48. data/ext/ice/cpp/include/Ice/DynamicLibraryF.h +1 -6
  49. data/ext/ice/cpp/include/Ice/Exception.h +110 -63
  50. data/ext/ice/cpp/include/Ice/ExceptionHelpers.h +74 -0
  51. data/ext/ice/cpp/include/Ice/FactoryTable.h +22 -18
  52. data/ext/ice/cpp/include/Ice/FactoryTableInit.h +28 -31
  53. data/ext/ice/cpp/include/Ice/Format.h +17 -18
  54. data/ext/ice/cpp/include/Ice/Functional.h +38 -38
  55. data/ext/ice/cpp/include/Ice/GCObject.h +9 -10
  56. data/ext/ice/cpp/include/Ice/Handle.h +6 -16
  57. data/ext/ice/cpp/include/Ice/Ice.h +9 -10
  58. data/ext/ice/cpp/include/Ice/IconvStringConverter.h +377 -0
  59. data/ext/ice/cpp/include/Ice/Incoming.h +132 -38
  60. data/ext/ice/cpp/include/Ice/IncomingAsync.h +109 -31
  61. data/ext/ice/cpp/include/Ice/IncomingAsyncF.h +7 -6
  62. data/ext/ice/cpp/include/Ice/Initialize.h +872 -60
  63. data/ext/ice/cpp/include/Ice/InputStream.h +1514 -0
  64. data/ext/ice/cpp/include/Ice/InstanceF.h +1 -7
  65. data/ext/ice/cpp/include/Ice/InterfaceByValue.h +57 -0
  66. data/ext/ice/cpp/include/Ice/LocalObject.h +13 -14
  67. data/ext/ice/cpp/include/Ice/LocalObjectF.h +1 -6
  68. data/ext/ice/cpp/include/Ice/LoggerUtil.h +56 -24
  69. data/ext/ice/cpp/include/Ice/MetricsAdminI.h +124 -71
  70. data/ext/ice/cpp/include/Ice/MetricsFunctional.h +25 -10
  71. data/ext/ice/cpp/include/Ice/MetricsObserverI.h +116 -32
  72. data/ext/ice/cpp/include/Ice/NativePropertiesAdmin.h +61 -30
  73. data/ext/ice/cpp/include/Ice/Object.h +413 -78
  74. data/ext/ice/cpp/include/Ice/ObjectF.h +12 -8
  75. data/ext/ice/cpp/include/Ice/ObserverHelper.h +18 -13
  76. data/ext/ice/cpp/include/Ice/Optional.h +1114 -0
  77. data/ext/ice/cpp/include/Ice/OutgoingAsync.h +684 -89
  78. data/ext/ice/cpp/include/Ice/OutgoingAsyncF.h +12 -11
  79. data/ext/ice/cpp/include/Ice/OutputStream.h +1092 -0
  80. data/ext/ice/cpp/include/Ice/Protocol.h +49 -17
  81. data/ext/ice/cpp/include/Ice/Proxy.h +3438 -745
  82. data/ext/ice/cpp/include/Ice/ProxyF.h +13 -38
  83. data/ext/ice/cpp/include/Ice/ProxyFactoryF.h +1 -6
  84. data/ext/ice/cpp/include/Ice/ProxyHandle.h +43 -55
  85. data/ext/ice/cpp/include/Ice/ReferenceF.h +1 -6
  86. data/ext/ice/cpp/include/Ice/RegisterPlugins.h +84 -12
  87. data/ext/ice/cpp/include/Ice/RequestHandlerF.h +10 -9
  88. data/ext/ice/cpp/include/Ice/ResponseHandlerF.h +6 -6
  89. data/ext/ice/cpp/include/Ice/SHA1.h +42 -0
  90. data/ext/ice/cpp/include/Ice/ServantManagerF.h +1 -6
  91. data/ext/ice/cpp/include/Ice/Service.h +273 -154
  92. data/ext/ice/cpp/include/Ice/SliceChecksums.h +5 -6
  93. data/ext/ice/cpp/include/Ice/SlicedData.h +121 -53
  94. data/ext/ice/cpp/include/Ice/SlicedDataF.h +17 -11
  95. data/ext/ice/cpp/include/Ice/StreamHelpers.h +453 -140
  96. data/ext/ice/cpp/include/Ice/StringConverter.h +78 -0
  97. data/ext/ice/cpp/include/Ice/ThreadPoolF.h +1 -6
  98. data/ext/ice/cpp/include/Ice/UUID.h +19 -0
  99. data/ext/ice/cpp/include/{IceUtil → Ice}/UniquePtr.h +22 -28
  100. data/ext/ice/cpp/include/Ice/UniqueRef.h +97 -0
  101. data/ext/ice/cpp/include/Ice/UserExceptionFactory.h +45 -13
  102. data/ext/ice/cpp/include/Ice/Value.h +139 -0
  103. data/ext/ice/cpp/include/Ice/ValueF.h +21 -0
  104. data/ext/ice/cpp/include/IceSSL/Config.h +8 -28
  105. data/ext/ice/cpp/include/IceSSL/IceSSL.h +17 -11
  106. data/ext/ice/cpp/include/IceSSL/OpenSSL.h +147 -0
  107. data/ext/ice/cpp/include/IceSSL/Plugin.h +461 -448
  108. data/ext/ice/cpp/include/IceSSL/SChannel.h +72 -0
  109. data/ext/ice/cpp/include/IceSSL/SecureTransport.h +72 -0
  110. data/ext/ice/cpp/include/IceSSL/UWP.h +62 -0
  111. data/ext/ice/cpp/include/IceUtil/Atomic.h +7 -14
  112. data/ext/ice/cpp/include/IceUtil/Cond.h +17 -23
  113. data/ext/ice/cpp/include/IceUtil/Config.h +166 -46
  114. data/ext/ice/cpp/include/IceUtil/ConsoleUtil.h +92 -0
  115. data/ext/ice/cpp/include/IceUtil/CountDownLatch.h +5 -10
  116. data/ext/ice/cpp/include/IceUtil/CtrlCHandler.h +63 -41
  117. data/ext/ice/cpp/include/IceUtil/DisableWarnings.h +5 -13
  118. data/ext/ice/cpp/include/IceUtil/Exception.h +284 -75
  119. data/ext/ice/cpp/include/IceUtil/FileUtil.h +143 -0
  120. data/ext/ice/cpp/include/IceUtil/Functional.h +4 -6
  121. data/ext/ice/cpp/include/IceUtil/Handle.h +11 -16
  122. data/ext/ice/cpp/include/IceUtil/IceUtil.h +4 -15
  123. data/ext/ice/cpp/include/IceUtil/InputUtil.h +3 -8
  124. data/ext/ice/cpp/include/IceUtil/Iterator.h +2 -7
  125. data/ext/ice/cpp/include/IceUtil/Lock.h +8 -15
  126. data/ext/ice/cpp/include/IceUtil/Monitor.h +1 -7
  127. data/ext/ice/cpp/include/IceUtil/Mutex.h +19 -23
  128. data/ext/ice/cpp/include/IceUtil/MutexProtocol.h +2 -7
  129. data/ext/ice/cpp/include/IceUtil/MutexPtrLock.h +4 -9
  130. data/ext/ice/cpp/include/IceUtil/MutexPtrTryLock.h +4 -9
  131. data/ext/ice/cpp/include/IceUtil/Optional.h +134 -23
  132. data/ext/ice/cpp/include/IceUtil/Options.h +17 -23
  133. data/ext/ice/cpp/include/IceUtil/OutputUtil.h +61 -37
  134. data/ext/ice/cpp/include/IceUtil/PopDisableWarnings.h +6 -11
  135. data/ext/ice/cpp/include/IceUtil/PushDisableWarnings.h +18 -15
  136. data/ext/ice/cpp/include/IceUtil/Random.h +39 -8
  137. data/ext/ice/cpp/include/IceUtil/RecMutex.h +7 -13
  138. data/ext/ice/cpp/include/IceUtil/ResourceConfig.h +53 -0
  139. data/ext/ice/cpp/include/IceUtil/ScannerConfig.h +10 -15
  140. data/ext/ice/cpp/include/IceUtil/ScopedArray.h +8 -7
  141. data/ext/ice/cpp/include/IceUtil/Shared.h +5 -12
  142. data/ext/ice/cpp/{src → include}/IceUtil/StopWatch.h +2 -7
  143. data/ext/ice/cpp/include/IceUtil/StringConverter.h +146 -126
  144. data/ext/ice/cpp/include/IceUtil/StringUtil.h +32 -26
  145. data/ext/ice/cpp/include/IceUtil/Thread.h +10 -17
  146. data/ext/ice/cpp/include/IceUtil/ThreadException.h +33 -47
  147. data/ext/ice/cpp/include/IceUtil/Time.h +3 -8
  148. data/ext/ice/cpp/include/IceUtil/Timer.h +18 -18
  149. data/ext/ice/cpp/include/IceUtil/UUID.h +6 -7
  150. data/ext/ice/cpp/include/IceUtil/UndefSysMacros.h +1 -6
  151. data/ext/ice/cpp/include/generated/Ice/BuiltinSequences.h +170 -0
  152. data/ext/ice/cpp/include/generated/Ice/Communicator.h +1156 -0
  153. data/ext/ice/cpp/include/{Ice → generated/Ice}/CommunicatorF.h +51 -16
  154. data/ext/ice/cpp/include/generated/Ice/Connection.h +1660 -0
  155. data/ext/ice/cpp/include/generated/Ice/ConnectionF.h +119 -0
  156. data/ext/ice/cpp/include/generated/Ice/Current.h +322 -0
  157. data/ext/ice/cpp/include/generated/Ice/Endpoint.h +943 -0
  158. data/ext/ice/cpp/include/generated/Ice/EndpointF.h +166 -0
  159. data/ext/ice/cpp/include/generated/Ice/EndpointTypes.h +118 -0
  160. data/ext/ice/cpp/include/{Ice → generated/Ice}/FacetMap.h +31 -15
  161. data/ext/ice/cpp/include/generated/Ice/Identity.h +264 -0
  162. data/ext/ice/cpp/include/generated/Ice/ImplicitContext.h +278 -0
  163. data/ext/ice/cpp/include/{Ice → generated/Ice}/ImplicitContextF.h +51 -16
  164. data/ext/ice/cpp/include/generated/Ice/Instrumentation.h +1143 -0
  165. data/ext/ice/cpp/include/generated/Ice/InstrumentationF.h +128 -0
  166. data/ext/ice/cpp/include/generated/Ice/LocalException.h +7041 -0
  167. data/ext/ice/cpp/include/generated/Ice/Locator.h +3850 -0
  168. data/ext/ice/cpp/include/generated/Ice/LocatorF.h +147 -0
  169. data/ext/ice/cpp/include/generated/Ice/Logger.h +231 -0
  170. data/ext/ice/cpp/include/{Ice → generated/Ice}/LoggerF.h +51 -16
  171. data/ext/ice/cpp/include/generated/Ice/Metrics.h +4717 -0
  172. data/ext/ice/cpp/include/generated/Ice/ObjectAdapter.h +1175 -0
  173. data/ext/ice/cpp/include/{Ice → generated/Ice}/ObjectAdapterF.h +51 -16
  174. data/ext/ice/cpp/include/generated/Ice/ObjectFactory.h +197 -0
  175. data/ext/ice/cpp/include/generated/Ice/Plugin.h +306 -0
  176. data/ext/ice/cpp/include/generated/Ice/PluginF.h +110 -0
  177. data/ext/ice/cpp/include/generated/Ice/Process.h +971 -0
  178. data/ext/ice/cpp/include/generated/Ice/ProcessF.h +125 -0
  179. data/ext/ice/cpp/include/generated/Ice/Properties.h +446 -0
  180. data/ext/ice/cpp/include/generated/Ice/PropertiesAdmin.h +1360 -0
  181. data/ext/ice/cpp/include/generated/Ice/PropertiesF.h +134 -0
  182. data/ext/ice/cpp/include/generated/Ice/RemoteLogger.h +2689 -0
  183. data/ext/ice/cpp/include/generated/Ice/Router.h +1838 -0
  184. data/ext/ice/cpp/include/generated/Ice/RouterF.h +125 -0
  185. data/ext/ice/cpp/include/generated/Ice/ServantLocator.h +299 -0
  186. data/ext/ice/cpp/include/{Ice → generated/Ice}/ServantLocatorF.h +51 -16
  187. data/ext/ice/cpp/include/{Ice → generated/Ice}/SliceChecksumDict.h +34 -14
  188. data/ext/ice/cpp/include/generated/Ice/ValueFactory.h +318 -0
  189. data/ext/ice/cpp/include/generated/Ice/Version.h +357 -0
  190. data/ext/ice/cpp/include/generated/IceSSL/ConnectionInfo.h +223 -0
  191. data/ext/ice/cpp/include/generated/IceSSL/ConnectionInfoF.h +101 -0
  192. data/ext/ice/cpp/include/generated/IceSSL/EndpointInfo.h +181 -0
  193. data/ext/ice/cpp/src/Ice/ACM.cpp +38 -27
  194. data/ext/ice/cpp/src/Ice/ACM.h +9 -7
  195. data/ext/ice/cpp/src/Ice/ACMF.h +30 -0
  196. data/ext/ice/cpp/src/Ice/Acceptor.cpp +6 -6
  197. data/ext/ice/cpp/src/Ice/Acceptor.h +4 -8
  198. data/ext/ice/cpp/src/Ice/AcceptorF.h +1 -6
  199. data/ext/ice/cpp/src/Ice/ArgVector.cpp +59 -0
  200. data/ext/ice/cpp/src/Ice/ArgVector.h +36 -0
  201. data/ext/ice/cpp/src/Ice/AsyncResult.cpp +15 -544
  202. data/ext/ice/cpp/src/Ice/Base64.cpp +22 -28
  203. data/ext/ice/cpp/src/Ice/Base64.h +1 -6
  204. data/ext/ice/cpp/src/Ice/BatchRequestQueue.cpp +41 -18
  205. data/ext/ice/cpp/src/Ice/BatchRequestQueue.h +15 -15
  206. data/ext/ice/cpp/src/Ice/Buffer.cpp +75 -18
  207. data/ext/ice/cpp/src/Ice/BuiltinSequences.cpp +21 -12
  208. data/ext/ice/cpp/src/Ice/CollocatedRequestHandler.cpp +86 -197
  209. data/ext/ice/cpp/src/Ice/CollocatedRequestHandler.h +17 -23
  210. data/ext/ice/cpp/src/Ice/Communicator.cpp +43 -15
  211. data/ext/ice/cpp/src/Ice/CommunicatorF.cpp +28 -11
  212. data/ext/ice/cpp/src/Ice/CommunicatorI.cpp +318 -117
  213. data/ext/ice/cpp/src/Ice/CommunicatorI.h +95 -40
  214. data/ext/ice/cpp/src/{IceUtil → Ice}/Cond.cpp +3 -8
  215. data/ext/ice/cpp/src/Ice/ConnectRequestHandler.cpp +55 -122
  216. data/ext/ice/cpp/src/Ice/ConnectRequestHandler.h +15 -31
  217. data/ext/ice/cpp/src/Ice/ConnectRequestHandlerF.h +6 -7
  218. data/ext/ice/cpp/src/Ice/Connection.cpp +111 -20
  219. data/ext/ice/cpp/src/Ice/ConnectionF.cpp +28 -11
  220. data/ext/ice/cpp/src/Ice/ConnectionFactory.cpp +300 -107
  221. data/ext/ice/cpp/src/Ice/ConnectionFactory.h +44 -28
  222. data/ext/ice/cpp/src/Ice/ConnectionFactoryF.h +30 -0
  223. data/ext/ice/cpp/src/Ice/ConnectionI.cpp +785 -713
  224. data/ext/ice/cpp/src/Ice/ConnectionI.h +105 -80
  225. data/ext/ice/cpp/src/Ice/ConnectionRequestHandler.cpp +2 -20
  226. data/ext/ice/cpp/src/Ice/ConnectionRequestHandler.h +5 -9
  227. data/ext/ice/cpp/src/Ice/Connector.cpp +6 -6
  228. data/ext/ice/cpp/src/Ice/Connector.h +4 -8
  229. data/ext/ice/cpp/src/Ice/ConnectorF.h +1 -6
  230. data/ext/ice/cpp/src/{IceUtil → Ice}/CountDownLatch.cpp +4 -9
  231. data/ext/ice/cpp/src/Ice/Current.cpp +30 -12
  232. data/ext/ice/cpp/src/Ice/DefaultsAndOverrides.cpp +10 -16
  233. data/ext/ice/cpp/src/Ice/DefaultsAndOverrides.h +1 -6
  234. data/ext/ice/cpp/src/Ice/DefaultsAndOverridesF.h +1 -6
  235. data/ext/ice/cpp/src/Ice/DispatchInterceptor.cpp +13 -25
  236. data/ext/ice/cpp/src/Ice/DynamicLibrary.cpp +34 -28
  237. data/ext/ice/cpp/src/Ice/Endpoint.cpp +107 -19
  238. data/ext/ice/cpp/src/Ice/EndpointF.cpp +28 -11
  239. data/ext/ice/cpp/src/Ice/EndpointFactory.cpp +152 -6
  240. data/ext/ice/cpp/src/Ice/EndpointFactory.h +72 -11
  241. data/ext/ice/cpp/src/Ice/EndpointFactoryF.h +1 -6
  242. data/ext/ice/cpp/src/Ice/EndpointFactoryManager.cpp +41 -36
  243. data/ext/ice/cpp/src/Ice/EndpointFactoryManager.h +10 -9
  244. data/ext/ice/cpp/src/Ice/EndpointFactoryManagerF.h +1 -6
  245. data/ext/ice/cpp/src/Ice/EndpointI.cpp +18 -7
  246. data/ext/ice/cpp/src/Ice/EndpointI.h +39 -18
  247. data/ext/ice/cpp/src/Ice/EndpointIF.h +18 -10
  248. data/ext/ice/cpp/src/Ice/EndpointTypes.cpp +19 -12
  249. data/ext/ice/cpp/src/Ice/EventHandler.cpp +6 -9
  250. data/ext/ice/cpp/src/Ice/EventHandler.h +13 -13
  251. data/ext/ice/cpp/src/Ice/EventHandlerF.h +5 -7
  252. data/ext/ice/cpp/src/Ice/Exception.cpp +102 -98
  253. data/ext/ice/cpp/src/Ice/FacetMap.cpp +21 -12
  254. data/ext/ice/cpp/src/Ice/FactoryTable.cpp +37 -33
  255. data/ext/ice/cpp/src/Ice/FactoryTableInit.cpp +2 -9
  256. data/ext/ice/cpp/src/Ice/GCObject.cpp +29 -31
  257. data/ext/ice/cpp/src/Ice/HashUtil.h +3 -9
  258. data/ext/ice/cpp/src/Ice/HttpParser.cpp +1 -7
  259. data/ext/ice/cpp/src/Ice/HttpParser.h +1 -6
  260. data/ext/ice/cpp/src/Ice/IPEndpointI.cpp +128 -111
  261. data/ext/ice/cpp/src/Ice/IPEndpointI.h +23 -19
  262. data/ext/ice/cpp/src/Ice/IPEndpointIF.h +6 -7
  263. data/ext/ice/cpp/src/Ice/IconvStringConverter.cpp +51 -0
  264. data/ext/ice/cpp/src/Ice/Identity.cpp +25 -16
  265. data/ext/ice/cpp/src/Ice/ImplicitContext.cpp +41 -13
  266. data/ext/ice/cpp/src/Ice/ImplicitContextF.cpp +28 -11
  267. data/ext/ice/cpp/src/Ice/ImplicitContextI.cpp +11 -28
  268. data/ext/ice/cpp/src/Ice/ImplicitContextI.h +7 -10
  269. data/ext/ice/cpp/src/Ice/Incoming.cpp +284 -255
  270. data/ext/ice/cpp/src/Ice/IncomingAsync.cpp +104 -214
  271. data/ext/ice/cpp/src/Ice/IncomingRequest.h +5 -9
  272. data/ext/ice/cpp/src/Ice/Initialize.cpp +309 -193
  273. data/ext/ice/cpp/src/Ice/InputStream.cpp +2726 -0
  274. data/ext/ice/cpp/src/Ice/Instance.cpp +243 -262
  275. data/ext/ice/cpp/src/Ice/Instance.h +30 -23
  276. data/ext/ice/cpp/src/Ice/Instrumentation.cpp +137 -23
  277. data/ext/ice/cpp/src/Ice/InstrumentationF.cpp +28 -11
  278. data/ext/ice/cpp/src/Ice/InstrumentationI.cpp +118 -105
  279. data/ext/ice/cpp/src/Ice/InstrumentationI.h +30 -36
  280. data/ext/ice/cpp/src/Ice/LocalException.cpp +1191 -422
  281. data/ext/ice/cpp/src/Ice/LocalObject.cpp +1 -7
  282. data/ext/ice/cpp/src/Ice/Locator.cpp +1282 -1222
  283. data/ext/ice/cpp/src/Ice/LocatorF.cpp +30 -12
  284. data/ext/ice/cpp/src/Ice/LocatorInfo.cpp +150 -186
  285. data/ext/ice/cpp/src/Ice/LocatorInfo.h +31 -36
  286. data/ext/ice/cpp/src/Ice/LocatorInfoF.h +1 -6
  287. data/ext/ice/cpp/src/Ice/Logger.cpp +39 -12
  288. data/ext/ice/cpp/src/Ice/LoggerAdminI.cpp +182 -88
  289. data/ext/ice/cpp/src/Ice/LoggerAdminI.h +4 -9
  290. data/ext/ice/cpp/src/Ice/LoggerF.cpp +28 -11
  291. data/ext/ice/cpp/src/Ice/LoggerI.cpp +26 -55
  292. data/ext/ice/cpp/src/Ice/LoggerI.h +7 -18
  293. data/ext/ice/cpp/src/Ice/LoggerUtil.cpp +10 -17
  294. data/ext/ice/cpp/src/Ice/Metrics.cpp +1280 -1107
  295. data/ext/ice/cpp/src/Ice/MetricsAdminI.cpp +58 -33
  296. data/ext/ice/cpp/src/Ice/MetricsObserverI.cpp +1 -7
  297. data/ext/ice/cpp/src/Ice/Network.cpp +753 -408
  298. data/ext/ice/cpp/src/Ice/Network.h +99 -36
  299. data/ext/ice/cpp/src/Ice/NetworkF.h +2 -7
  300. data/ext/ice/cpp/src/Ice/NetworkProxy.cpp +20 -19
  301. data/ext/ice/cpp/src/Ice/NetworkProxy.h +5 -7
  302. data/ext/ice/cpp/src/Ice/NetworkProxyF.h +1 -6
  303. data/ext/ice/cpp/src/Ice/OSLogLoggerI.cpp +57 -0
  304. data/ext/ice/cpp/src/Ice/OSLogLoggerI.h +40 -0
  305. data/ext/ice/cpp/src/Ice/Object.cpp +227 -232
  306. data/ext/ice/cpp/src/Ice/ObjectAdapter.cpp +45 -13
  307. data/ext/ice/cpp/src/Ice/ObjectAdapterF.cpp +28 -11
  308. data/ext/ice/cpp/src/Ice/ObjectAdapterFactory.cpp +83 -33
  309. data/ext/ice/cpp/src/Ice/ObjectAdapterFactory.h +13 -12
  310. data/ext/ice/cpp/src/Ice/ObjectAdapterFactoryF.h +25 -0
  311. data/ext/ice/cpp/src/Ice/ObjectAdapterI.cpp +298 -191
  312. data/ext/ice/cpp/src/Ice/ObjectAdapterI.h +44 -39
  313. data/ext/ice/cpp/src/Ice/ObjectFactory.cpp +41 -13
  314. data/ext/ice/cpp/src/Ice/ObserverHelper.cpp +9 -37
  315. data/ext/ice/cpp/src/Ice/OpaqueEndpointI.cpp +67 -67
  316. data/ext/ice/cpp/src/Ice/OpaqueEndpointI.h +15 -11
  317. data/ext/ice/cpp/src/Ice/OutgoingAsync.cpp +801 -366
  318. data/ext/ice/cpp/src/Ice/OutputStream.cpp +1367 -0
  319. data/ext/ice/cpp/src/Ice/Plugin.cpp +52 -14
  320. data/ext/ice/cpp/src/Ice/PluginF.cpp +28 -11
  321. data/ext/ice/cpp/src/Ice/PluginManagerI.cpp +27 -51
  322. data/ext/ice/cpp/src/Ice/PluginManagerI.h +7 -13
  323. data/ext/ice/cpp/src/Ice/Process.cpp +294 -128
  324. data/ext/ice/cpp/src/Ice/ProcessF.cpp +30 -12
  325. data/ext/ice/cpp/src/Ice/Properties.cpp +42 -15
  326. data/ext/ice/cpp/src/Ice/PropertiesAdmin.cpp +382 -340
  327. data/ext/ice/cpp/src/Ice/PropertiesAdminI.cpp +83 -24
  328. data/ext/ice/cpp/src/Ice/PropertiesAdminI.h +29 -10
  329. data/ext/ice/cpp/src/Ice/PropertiesF.cpp +30 -12
  330. data/ext/ice/cpp/src/Ice/PropertiesI.cpp +46 -57
  331. data/ext/ice/cpp/src/Ice/PropertiesI.h +18 -26
  332. data/ext/ice/cpp/src/Ice/PropertyNames.cpp +112 -19
  333. data/ext/ice/cpp/src/Ice/PropertyNames.h +4 -7
  334. data/ext/ice/cpp/src/Ice/Protocol.cpp +6 -19
  335. data/ext/ice/cpp/src/Ice/ProtocolInstance.cpp +37 -7
  336. data/ext/ice/cpp/src/Ice/ProtocolInstance.h +9 -25
  337. data/ext/ice/cpp/src/Ice/ProtocolInstanceF.h +1 -6
  338. data/ext/ice/cpp/src/Ice/ProtocolPluginFacade.cpp +6 -6
  339. data/ext/ice/cpp/src/Ice/ProtocolPluginFacade.h +3 -6
  340. data/ext/ice/cpp/src/Ice/ProtocolPluginFacadeF.h +1 -6
  341. data/ext/ice/cpp/src/Ice/Proxy.cpp +729 -957
  342. data/ext/ice/cpp/src/Ice/ProxyFactory.cpp +33 -38
  343. data/ext/ice/cpp/src/Ice/ProxyFactory.h +16 -16
  344. data/ext/ice/cpp/src/Ice/Reference.cpp +190 -106
  345. data/ext/ice/cpp/src/Ice/Reference.h +39 -28
  346. data/ext/ice/cpp/src/Ice/ReferenceFactory.cpp +69 -118
  347. data/ext/ice/cpp/src/Ice/ReferenceFactory.h +12 -17
  348. data/ext/ice/cpp/src/Ice/ReferenceFactoryF.h +1 -6
  349. data/ext/ice/cpp/src/Ice/RegisterPluginsInit.cpp +19 -9
  350. data/ext/ice/cpp/src/Ice/RegisterPluginsInit.h +1 -6
  351. data/ext/ice/cpp/src/Ice/RemoteLogger.cpp +766 -565
  352. data/ext/ice/cpp/src/Ice/ReplyStatus.h +1 -6
  353. data/ext/ice/cpp/src/Ice/RequestHandler.cpp +5 -8
  354. data/ext/ice/cpp/src/Ice/RequestHandler.h +10 -18
  355. data/ext/ice/cpp/src/Ice/RequestHandlerFactory.cpp +10 -11
  356. data/ext/ice/cpp/src/Ice/RequestHandlerFactory.h +2 -7
  357. data/ext/ice/cpp/src/Ice/ResponseHandler.cpp +3 -11
  358. data/ext/ice/cpp/src/Ice/ResponseHandler.h +16 -12
  359. data/ext/ice/cpp/src/Ice/RetryQueue.cpp +12 -20
  360. data/ext/ice/cpp/src/Ice/RetryQueue.h +7 -11
  361. data/ext/ice/cpp/src/Ice/RetryQueueF.h +1 -6
  362. data/ext/ice/cpp/src/Ice/Router.cpp +614 -492
  363. data/ext/ice/cpp/src/Ice/RouterF.cpp +30 -12
  364. data/ext/ice/cpp/src/Ice/RouterInfo.cpp +93 -99
  365. data/ext/ice/cpp/src/Ice/RouterInfo.h +42 -38
  366. data/ext/ice/cpp/src/Ice/RouterInfoF.h +1 -6
  367. data/ext/ice/cpp/src/{IceUtil → Ice}/SHA1.cpp +23 -28
  368. data/ext/ice/cpp/src/Ice/Selector.cpp +948 -855
  369. data/ext/ice/cpp/src/Ice/Selector.h +100 -152
  370. data/ext/ice/cpp/src/Ice/ServantLocator.cpp +41 -13
  371. data/ext/ice/cpp/src/Ice/ServantLocatorF.cpp +28 -11
  372. data/ext/ice/cpp/src/Ice/ServantManager.cpp +24 -45
  373. data/ext/ice/cpp/src/Ice/ServantManager.h +1 -6
  374. data/ext/ice/cpp/src/Ice/SharedContext.h +2 -7
  375. data/ext/ice/cpp/src/Ice/SliceChecksumDict.cpp +21 -12
  376. data/ext/ice/cpp/src/Ice/SliceChecksums.cpp +2 -7
  377. data/ext/ice/cpp/src/Ice/SlicedData.cpp +72 -25
  378. data/ext/ice/cpp/src/Ice/StreamSocket.cpp +208 -76
  379. data/ext/ice/cpp/src/Ice/StreamSocket.h +13 -9
  380. data/ext/ice/cpp/src/Ice/StringConverterPlugin.cpp +57 -22
  381. data/ext/ice/cpp/src/Ice/StringUtil.h +30 -0
  382. data/ext/ice/cpp/src/Ice/SysLoggerI.cpp +6 -7
  383. data/ext/ice/cpp/src/Ice/SysLoggerI.h +2 -8
  384. data/ext/ice/cpp/src/Ice/SystemdJournalI.cpp +66 -0
  385. data/ext/ice/cpp/src/Ice/SystemdJournalI.h +39 -0
  386. data/ext/ice/cpp/src/Ice/TcpAcceptor.cpp +169 -49
  387. data/ext/ice/cpp/src/Ice/TcpAcceptor.h +12 -10
  388. data/ext/ice/cpp/src/Ice/TcpConnector.cpp +6 -12
  389. data/ext/ice/cpp/src/Ice/TcpConnector.h +1 -7
  390. data/ext/ice/cpp/src/Ice/TcpEndpointI.cpp +51 -46
  391. data/ext/ice/cpp/src/Ice/TcpEndpointI.h +12 -14
  392. data/ext/ice/cpp/src/Ice/TcpTransceiver.cpp +17 -32
  393. data/ext/ice/cpp/src/Ice/TcpTransceiver.h +7 -15
  394. data/ext/ice/cpp/src/{IceUtil → Ice}/Thread.cpp +41 -54
  395. data/ext/ice/cpp/src/Ice/ThreadPool.cpp +242 -274
  396. data/ext/ice/cpp/src/Ice/ThreadPool.h +46 -48
  397. data/ext/ice/cpp/src/{IceUtil → Ice}/Timer.cpp +38 -26
  398. data/ext/ice/cpp/src/Ice/TraceLevels.cpp +2 -7
  399. data/ext/ice/cpp/src/Ice/TraceLevels.h +1 -6
  400. data/ext/ice/cpp/src/Ice/TraceLevelsF.h +2 -7
  401. data/ext/ice/cpp/src/Ice/TraceUtil.cpp +53 -36
  402. data/ext/ice/cpp/src/Ice/TraceUtil.h +13 -11
  403. data/ext/ice/cpp/src/Ice/Transceiver.cpp +1 -7
  404. data/ext/ice/cpp/src/Ice/Transceiver.h +8 -12
  405. data/ext/ice/cpp/src/Ice/TransceiverF.h +3 -8
  406. data/ext/ice/cpp/src/Ice/UdpConnector.cpp +5 -13
  407. data/ext/ice/cpp/src/Ice/UdpConnector.h +1 -7
  408. data/ext/ice/cpp/src/Ice/UdpEndpointI.cpp +118 -60
  409. data/ext/ice/cpp/src/Ice/UdpEndpointI.h +13 -10
  410. data/ext/ice/cpp/src/Ice/UdpTransceiver.cpp +177 -236
  411. data/ext/ice/cpp/src/Ice/UdpTransceiver.h +15 -22
  412. data/ext/ice/cpp/src/Ice/Value.cpp +76 -0
  413. data/ext/ice/cpp/src/Ice/ValueFactory.cpp +83 -0
  414. data/ext/ice/cpp/src/Ice/ValueFactoryManagerI.cpp +61 -0
  415. data/ext/ice/cpp/src/Ice/ValueFactoryManagerI.h +37 -0
  416. data/ext/ice/cpp/src/Ice/Version.cpp +25 -20
  417. data/ext/ice/cpp/src/Ice/VirtualShared.h +38 -0
  418. data/ext/ice/cpp/src/Ice/WSAcceptor.cpp +3 -14
  419. data/ext/ice/cpp/src/Ice/WSAcceptor.h +3 -12
  420. data/ext/ice/cpp/src/Ice/WSConnector.cpp +5 -16
  421. data/ext/ice/cpp/src/Ice/WSConnector.h +3 -11
  422. data/ext/ice/cpp/src/Ice/WSEndpoint.cpp +188 -89
  423. data/ext/ice/cpp/src/Ice/WSEndpoint.h +22 -37
  424. data/ext/ice/cpp/src/Ice/WSTransceiver.cpp +65 -66
  425. data/ext/ice/cpp/src/Ice/WSTransceiver.h +7 -27
  426. data/ext/ice/cpp/src/IceDiscovery/IceDiscovery.cpp +596 -281
  427. data/ext/ice/cpp/src/IceDiscovery/IceDiscovery.h +1383 -543
  428. data/ext/ice/cpp/src/IceDiscovery/LocatorI.cpp +89 -32
  429. data/ext/ice/cpp/src/IceDiscovery/LocatorI.h +59 -28
  430. data/ext/ice/cpp/src/IceDiscovery/LookupI.cpp +315 -66
  431. data/ext/ice/cpp/src/IceDiscovery/LookupI.h +83 -41
  432. data/ext/ice/cpp/src/IceDiscovery/PluginI.cpp +57 -64
  433. data/ext/ice/cpp/src/IceDiscovery/PluginI.h +3 -8
  434. data/ext/ice/cpp/src/IceLocatorDiscovery/IceLocatorDiscovery.cpp +450 -172
  435. data/ext/ice/cpp/src/IceLocatorDiscovery/IceLocatorDiscovery.h +863 -406
  436. data/ext/ice/cpp/src/IceLocatorDiscovery/Plugin.h +47 -0
  437. data/ext/ice/cpp/src/IceLocatorDiscovery/PluginI.cpp +636 -144
  438. data/ext/ice/cpp/src/IceSSL/AcceptorI.cpp +20 -173
  439. data/ext/ice/cpp/src/IceSSL/AcceptorI.h +8 -22
  440. data/ext/ice/cpp/src/IceSSL/CertificateI.cpp +279 -0
  441. data/ext/ice/cpp/src/IceSSL/CertificateI.h +64 -0
  442. data/ext/ice/cpp/src/IceSSL/ConnectionInfo.cpp +42 -17
  443. data/ext/ice/cpp/src/IceSSL/ConnectionInfoF.cpp +61 -0
  444. data/ext/ice/cpp/src/IceSSL/ConnectorI.cpp +15 -64
  445. data/ext/ice/cpp/src/IceSSL/ConnectorI.h +6 -18
  446. data/ext/ice/cpp/src/IceSSL/EndpointI.cpp +207 -204
  447. data/ext/ice/cpp/src/IceSSL/EndpointI.h +43 -40
  448. data/ext/ice/cpp/src/IceSSL/EndpointInfo.cpp +42 -16
  449. data/ext/ice/cpp/src/IceSSL/Instance.cpp +1 -11
  450. data/ext/ice/cpp/src/IceSSL/Instance.h +7 -12
  451. data/ext/ice/cpp/src/IceSSL/InstanceF.h +11 -12
  452. data/ext/ice/cpp/src/IceSSL/OpenSSLCertificateI.cpp +583 -0
  453. data/ext/ice/cpp/src/IceSSL/OpenSSLEngine.cpp +134 -115
  454. data/ext/ice/cpp/src/IceSSL/OpenSSLEngine.h +59 -0
  455. data/ext/ice/cpp/src/IceSSL/OpenSSLEngineF.h +27 -0
  456. data/ext/ice/cpp/src/IceSSL/OpenSSLPluginI.cpp +127 -0
  457. data/ext/ice/cpp/src/IceSSL/OpenSSLTransceiverI.cpp +477 -182
  458. data/ext/ice/cpp/src/IceSSL/OpenSSLTransceiverI.h +32 -26
  459. data/ext/ice/cpp/src/IceSSL/OpenSSLUtil.cpp +286 -0
  460. data/ext/ice/cpp/src/IceSSL/OpenSSLUtil.h +58 -0
  461. data/ext/ice/cpp/src/IceSSL/PluginI.cpp +71 -46
  462. data/ext/ice/cpp/src/IceSSL/PluginI.h +13 -23
  463. data/ext/ice/cpp/src/IceSSL/RFC2253.cpp +9 -60
  464. data/ext/ice/cpp/src/IceSSL/RFC2253.h +7 -12
  465. data/ext/ice/cpp/src/IceSSL/SChannelCertificateI.cpp +580 -0
  466. data/ext/ice/cpp/src/IceSSL/SChannelEngine.cpp +523 -74
  467. data/ext/ice/cpp/src/IceSSL/SChannelEngine.h +123 -0
  468. data/ext/ice/cpp/src/IceSSL/SChannelEngineF.h +31 -0
  469. data/ext/ice/cpp/src/IceSSL/SChannelPluginI.cpp +73 -0
  470. data/ext/ice/cpp/src/IceSSL/SChannelTransceiverI.cpp +187 -221
  471. data/ext/ice/cpp/src/IceSSL/SChannelTransceiverI.h +24 -26
  472. data/ext/ice/cpp/src/IceSSL/SSLEngine.cpp +97 -94
  473. data/ext/ice/cpp/src/IceSSL/SSLEngine.h +26 -192
  474. data/ext/ice/cpp/src/IceSSL/SSLEngineF.h +4 -24
  475. data/ext/ice/cpp/src/IceSSL/SecureTransportCertificateI.cpp +868 -0
  476. data/ext/ice/cpp/src/IceSSL/SecureTransportEngine.cpp +69 -201
  477. data/ext/ice/cpp/src/IceSSL/SecureTransportEngine.h +59 -0
  478. data/ext/ice/cpp/src/IceSSL/SecureTransportEngineF.h +29 -0
  479. data/ext/ice/cpp/src/IceSSL/SecureTransportPluginI.cpp +75 -0
  480. data/ext/ice/cpp/src/IceSSL/SecureTransportTransceiverI.cpp +174 -161
  481. data/ext/ice/cpp/src/IceSSL/SecureTransportTransceiverI.h +29 -33
  482. data/ext/ice/cpp/src/IceSSL/SecureTransportUtil.cpp +864 -0
  483. data/ext/ice/cpp/src/IceSSL/SecureTransportUtil.h +45 -0
  484. data/ext/ice/cpp/src/IceSSL/TrustManager.cpp +12 -22
  485. data/ext/ice/cpp/src/IceSSL/TrustManager.h +4 -9
  486. data/ext/ice/cpp/src/IceSSL/TrustManagerF.h +3 -8
  487. data/ext/ice/cpp/src/IceSSL/UWPCertificateI.cpp +266 -0
  488. data/ext/ice/cpp/src/IceSSL/UWPEngine.cpp +338 -0
  489. data/ext/ice/cpp/src/IceSSL/UWPEngine.h +41 -0
  490. data/ext/ice/cpp/src/IceSSL/UWPEngineF.h +26 -0
  491. data/ext/ice/cpp/src/IceSSL/UWPPluginI.cpp +89 -0
  492. data/ext/ice/cpp/src/IceSSL/UWPTransceiverI.cpp +383 -0
  493. data/ext/ice/cpp/src/IceSSL/UWPTransceiverI.h +71 -0
  494. data/ext/ice/cpp/src/IceSSL/Util.cpp +71 -1260
  495. data/ext/ice/cpp/src/IceSSL/Util.h +48 -142
  496. data/ext/ice/cpp/src/IceUtil/ConsoleUtil.cpp +157 -0
  497. data/ext/ice/cpp/src/IceUtil/ConvertUTF.cpp +22 -27
  498. data/ext/ice/cpp/src/IceUtil/ConvertUTF.h +34 -31
  499. data/ext/ice/cpp/src/IceUtil/CtrlCHandler.cpp +22 -36
  500. data/ext/ice/cpp/src/IceUtil/FileUtil.cpp +30 -126
  501. data/ext/ice/cpp/src/IceUtil/InputUtil.cpp +1 -6
  502. data/ext/ice/cpp/src/IceUtil/MutexProtocol.cpp +1 -6
  503. data/ext/ice/cpp/src/IceUtil/Options.cpp +20 -33
  504. data/ext/ice/cpp/src/IceUtil/OutputUtil.cpp +47 -21
  505. data/ext/ice/cpp/src/IceUtil/Random.cpp +15 -20
  506. data/ext/ice/cpp/src/IceUtil/RecMutex.cpp +4 -19
  507. data/ext/ice/cpp/src/IceUtil/Shared.cpp +8 -8
  508. data/ext/ice/cpp/src/IceUtil/StringConverter.cpp +501 -269
  509. data/ext/ice/cpp/src/IceUtil/StringUtil.cpp +582 -244
  510. data/ext/ice/cpp/src/IceUtil/ThreadException.cpp +37 -79
  511. data/ext/ice/cpp/src/IceUtil/Time.cpp +6 -11
  512. data/ext/ice/cpp/src/IceUtil/UUID.cpp +17 -22
  513. data/ext/ice/cpp/src/IceUtil/Unicode.cpp +97 -101
  514. data/ext/ice/cpp/src/IceUtil/Unicode.h +21 -40
  515. data/ext/ice/cpp/src/IceUtil/UtilException.cpp +839 -0
  516. data/ext/ice/cpp/src/Slice/CPlusPlusUtil.cpp +894 -234
  517. data/ext/ice/cpp/src/Slice/CPlusPlusUtil.h +72 -0
  518. data/ext/ice/cpp/src/Slice/Checksum.cpp +2 -7
  519. data/ext/ice/cpp/src/Slice/Checksum.h +21 -0
  520. data/ext/ice/cpp/src/Slice/FileTracker.cpp +25 -83
  521. data/ext/ice/cpp/{include → src}/Slice/FileTracker.h +9 -14
  522. data/ext/ice/cpp/src/Slice/Grammar.cpp +1981 -1944
  523. data/ext/ice/cpp/src/Slice/Grammar.h +39 -19
  524. data/ext/ice/cpp/src/Slice/GrammarUtil.h +14 -20
  525. data/ext/ice/cpp/src/Slice/JavaUtil.cpp +2752 -1948
  526. data/ext/ice/cpp/src/Slice/JavaUtil.h +398 -0
  527. data/ext/ice/cpp/src/Slice/MD5.cpp +1 -6
  528. data/ext/ice/cpp/src/Slice/MD5.h +1 -6
  529. data/ext/ice/cpp/src/Slice/MD5I.cpp +8 -1
  530. data/ext/ice/cpp/src/Slice/MD5I.h +1 -1
  531. data/ext/ice/cpp/src/Slice/PHPUtil.cpp +17 -20
  532. data/ext/ice/cpp/src/Slice/PHPUtil.h +36 -0
  533. data/ext/ice/cpp/src/Slice/Parser.cpp +1190 -426
  534. data/ext/ice/cpp/{include → src}/Slice/Parser.h +143 -91
  535. data/ext/ice/cpp/src/Slice/Preprocessor.cpp +67 -36
  536. data/ext/ice/cpp/{include → src}/Slice/Preprocessor.h +8 -18
  537. data/ext/ice/cpp/src/Slice/Python.cpp +218 -111
  538. data/ext/ice/cpp/src/Slice/PythonUtil.cpp +787 -699
  539. data/ext/ice/cpp/src/Slice/PythonUtil.h +70 -0
  540. data/ext/ice/cpp/src/Slice/Ruby.cpp +42 -43
  541. data/ext/ice/cpp/src/Slice/RubyUtil.cpp +175 -445
  542. data/ext/ice/cpp/{include → src}/Slice/RubyUtil.h +6 -11
  543. data/ext/ice/cpp/src/Slice/Scanner.cpp +390 -399
  544. data/ext/ice/cpp/src/Slice/{Util.cpp → SliceUtil.cpp} +36 -69
  545. data/ext/ice/cpp/src/Slice/StringLiteralUtil.cpp +456 -0
  546. data/ext/ice/cpp/src/Slice/Util.h +50 -0
  547. data/ice.gemspec +2 -9
  548. data/lib/Glacier2.rb +1 -6
  549. data/lib/Glacier2/Metrics.rb +6 -50
  550. data/lib/Glacier2/PermissionsVerifier.rb +23 -99
  551. data/lib/Glacier2/PermissionsVerifierF.rb +2 -7
  552. data/lib/Glacier2/Router.rb +31 -78
  553. data/lib/Glacier2/RouterF.rb +2 -7
  554. data/lib/Glacier2/SSLInfo.rb +3 -11
  555. data/lib/Glacier2/Session.rb +87 -311
  556. data/lib/Ice.rb +84 -58
  557. data/lib/Ice/BuiltinSequences.rb +3 -8
  558. data/lib/Ice/Communicator.rb +54 -61
  559. data/lib/Ice/CommunicatorF.rb +2 -7
  560. data/lib/Ice/Connection.rb +152 -166
  561. data/lib/Ice/ConnectionF.rb +2 -7
  562. data/lib/Ice/Current.rb +3 -15
  563. data/lib/Ice/Endpoint.rb +56 -137
  564. data/lib/Ice/EndpointF.rb +2 -7
  565. data/lib/Ice/EndpointTypes.rb +2 -11
  566. data/lib/Ice/FacetMap.rb +3 -8
  567. data/lib/Ice/Identity.rb +4 -12
  568. data/lib/Ice/ImplicitContext.rb +4 -38
  569. data/lib/Ice/ImplicitContextF.rb +2 -7
  570. data/lib/Ice/Instrumentation.rb +22 -279
  571. data/lib/Ice/InstrumentationF.rb +2 -7
  572. data/lib/Ice/LocalException.rb +94 -145
  573. data/lib/Ice/Locator.rb +50 -169
  574. data/lib/Ice/LocatorF.rb +2 -7
  575. data/lib/Ice/Logger.rb +4 -38
  576. data/lib/Ice/LoggerF.rb +2 -7
  577. data/lib/Ice/Metrics.rb +60 -420
  578. data/lib/Ice/ObjectAdapter.rb +29 -0
  579. data/lib/Ice/ObjectAdapterF.rb +2 -7
  580. data/lib/Ice/ObjectFactory.rb +4 -34
  581. data/lib/Ice/Plugin.rb +6 -64
  582. data/lib/Ice/PluginF.rb +2 -7
  583. data/lib/Ice/Process.rb +15 -56
  584. data/lib/Ice/ProcessF.rb +2 -7
  585. data/lib/Ice/Properties.rb +4 -45
  586. data/lib/Ice/PropertiesAdmin.rb +18 -60
  587. data/lib/Ice/PropertiesF.rb +2 -7
  588. data/lib/Ice/RemoteLogger.rb +33 -119
  589. data/lib/Ice/Router.rb +28 -105
  590. data/lib/Ice/RouterF.rb +2 -7
  591. data/lib/Ice/ServantLocator.rb +26 -0
  592. data/lib/Ice/ServantLocatorF.rb +24 -0
  593. data/lib/Ice/SliceChecksumDict.rb +2 -7
  594. data/lib/Ice/ValueFactory.rb +28 -0
  595. data/lib/Ice/Version.rb +4 -15
  596. data/lib/IceBox.rb +1 -6
  597. data/lib/IceBox/IceBox.rb +43 -152
  598. data/lib/IceGrid.rb +1 -9
  599. data/lib/IceGrid/Admin.rb +550 -431
  600. data/lib/IceGrid/Descriptor.rb +61 -533
  601. data/lib/IceGrid/Exception.rb +23 -49
  602. data/lib/IceGrid/FileParser.rb +13 -54
  603. data/lib/IceGrid/PluginFacade.rb +35 -0
  604. data/lib/IceGrid/Registry.rb +150 -62
  605. data/lib/IceGrid/Session.rb +24 -68
  606. data/lib/IceGrid/UserAccountMapper.rb +13 -54
  607. data/lib/IcePatch2.rb +1 -6
  608. data/lib/IcePatch2/FileInfo.rb +4 -15
  609. data/lib/IcePatch2/FileServer.rb +32 -80
  610. data/lib/IceStorm.rb +1 -6
  611. data/lib/IceStorm/IceStorm.rb +78 -210
  612. data/lib/IceStorm/Metrics.rb +10 -93
  613. data/slice/Glacier2/Metrics.ice +20 -10
  614. data/slice/Glacier2/PermissionsVerifier.ice +19 -12
  615. data/slice/Glacier2/PermissionsVerifierF.ice +16 -9
  616. data/slice/Glacier2/Router.ice +19 -13
  617. data/slice/Glacier2/RouterF.ice +16 -9
  618. data/slice/Glacier2/SSLInfo.ice +17 -10
  619. data/slice/Glacier2/Session.ice +24 -18
  620. data/slice/Ice/BuiltinSequences.ice +18 -9
  621. data/slice/Ice/Communicator.ice +180 -64
  622. data/slice/Ice/CommunicatorF.ice +18 -9
  623. data/slice/Ice/Connection.ice +208 -75
  624. data/slice/Ice/ConnectionF.ice +18 -9
  625. data/slice/Ice/Current.ice +37 -28
  626. data/slice/Ice/Endpoint.ice +73 -21
  627. data/slice/Ice/EndpointF.ice +19 -10
  628. data/slice/Ice/EndpointTypes.ice +21 -13
  629. data/slice/Ice/FacetMap.ice +19 -10
  630. data/slice/Ice/Identity.ice +24 -10
  631. data/slice/Ice/ImplicitContext.ice +41 -33
  632. data/slice/Ice/ImplicitContextF.ice +17 -9
  633. data/slice/Ice/Instrumentation.ice +37 -30
  634. data/slice/Ice/InstrumentationF.ice +19 -10
  635. data/slice/Ice/LocalException.ice +118 -112
  636. data/slice/Ice/Locator.ice +28 -21
  637. data/slice/Ice/LocatorF.ice +18 -9
  638. data/slice/Ice/Logger.ice +26 -18
  639. data/slice/Ice/LoggerF.ice +18 -9
  640. data/slice/Ice/Metrics.ice +42 -30
  641. data/slice/Ice/ObjectAdapter.ice +88 -53
  642. data/slice/Ice/ObjectAdapterF.ice +18 -9
  643. data/slice/Ice/ObjectFactory.ice +28 -17
  644. data/slice/Ice/Plugin.ice +25 -13
  645. data/slice/Ice/PluginF.ice +22 -9
  646. data/slice/Ice/Process.ice +20 -11
  647. data/slice/Ice/ProcessF.ice +18 -9
  648. data/slice/Ice/Properties.ice +42 -28
  649. data/slice/Ice/PropertiesAdmin.ice +20 -10
  650. data/slice/Ice/PropertiesF.ice +18 -9
  651. data/slice/Ice/RemoteLogger.ice +23 -19
  652. data/slice/Ice/Router.ice +28 -13
  653. data/slice/Ice/RouterF.ice +18 -9
  654. data/slice/Ice/ServantLocator.ice +40 -29
  655. data/slice/Ice/ServantLocatorF.ice +18 -9
  656. data/slice/Ice/SliceChecksumDict.ice +18 -9
  657. data/slice/Ice/ValueFactory.ice +132 -0
  658. data/slice/Ice/Version.ice +20 -10
  659. data/slice/IceBT/ConnectionInfo.ice +58 -0
  660. data/slice/IceBT/EndpointInfo.ice +56 -0
  661. data/slice/IceBT/Types.ice +44 -0
  662. data/slice/IceBox/IceBox.ice +45 -27
  663. data/slice/IceDiscovery/IceDiscovery.ice +75 -10
  664. data/slice/IceGrid/Admin.ice +410 -44
  665. data/slice/IceGrid/Descriptor.ice +47 -34
  666. data/slice/IceGrid/Exception.ice +43 -32
  667. data/slice/IceGrid/FileParser.ice +21 -12
  668. data/slice/IceGrid/PluginFacade.ice +26 -18
  669. data/slice/IceGrid/Registry.ice +150 -21
  670. data/slice/IceGrid/Session.ice +25 -17
  671. data/slice/IceGrid/UserAccountMapper.ice +23 -14
  672. data/slice/IceIAP/ConnectionInfo.ice +73 -0
  673. data/slice/IceIAP/EndpointInfo.ice +67 -0
  674. data/slice/IceLocatorDiscovery/IceLocatorDiscovery.ice +19 -12
  675. data/slice/IcePatch2/FileInfo.ice +19 -13
  676. data/slice/IcePatch2/FileServer.ice +27 -18
  677. data/slice/IceSSL/ConnectionInfo.ice +27 -23
  678. data/slice/IceSSL/ConnectionInfoF.ice +30 -0
  679. data/slice/IceSSL/EndpointInfo.ice +21 -36
  680. data/slice/IceStorm/IceStorm.ice +33 -24
  681. data/slice/IceStorm/Metrics.ice +19 -11
  682. metadata +148 -120
  683. data/ext/ObjectFactory.cpp +0 -140
  684. data/ext/ObjectFactory.h +0 -50
  685. data/ext/ice/cpp/include/Ice/ACMF.h +0 -30
  686. data/ext/ice/cpp/include/Ice/BasicStream.h +0 -1335
  687. data/ext/ice/cpp/include/Ice/BuiltinSequences.h +0 -82
  688. data/ext/ice/cpp/include/Ice/Communicator.h +0 -200
  689. data/ext/ice/cpp/include/Ice/Connection.h +0 -497
  690. data/ext/ice/cpp/include/Ice/ConnectionF.h +0 -74
  691. data/ext/ice/cpp/include/Ice/ConnectionFactoryF.h +0 -30
  692. data/ext/ice/cpp/include/Ice/Current.h +0 -102
  693. data/ext/ice/cpp/include/Ice/DefaultObjectFactory.h +0 -48
  694. data/ext/ice/cpp/include/Ice/DeprecatedStringConverter.h +0 -62
  695. data/ext/ice/cpp/include/Ice/Endpoint.h +0 -341
  696. data/ext/ice/cpp/include/Ice/EndpointF.h +0 -93
  697. data/ext/ice/cpp/include/Ice/EndpointTypes.h +0 -82
  698. data/ext/ice/cpp/include/Ice/Identity.h +0 -168
  699. data/ext/ice/cpp/include/Ice/ImplicitContext.h +0 -102
  700. data/ext/ice/cpp/include/Ice/Instrumentation.h +0 -365
  701. data/ext/ice/cpp/include/Ice/InstrumentationF.h +0 -75
  702. data/ext/ice/cpp/include/Ice/LocalException.h +0 -1030
  703. data/ext/ice/cpp/include/Ice/Locator.h +0 -2193
  704. data/ext/ice/cpp/include/Ice/LocatorF.h +0 -93
  705. data/ext/ice/cpp/include/Ice/Logger.h +0 -100
  706. data/ext/ice/cpp/include/Ice/Metrics.h +0 -2974
  707. data/ext/ice/cpp/include/Ice/ObjectAdapter.h +0 -168
  708. data/ext/ice/cpp/include/Ice/ObjectAdapterFactoryF.h +0 -26
  709. data/ext/ice/cpp/include/Ice/ObjectFactory.h +0 -92
  710. data/ext/ice/cpp/include/Ice/ObjectFactoryF.h +0 -66
  711. data/ext/ice/cpp/include/Ice/ObjectFactoryManagerF.h +0 -26
  712. data/ext/ice/cpp/include/Ice/Outgoing.h +0 -225
  713. data/ext/ice/cpp/include/Ice/Plugin.h +0 -125
  714. data/ext/ice/cpp/include/Ice/PluginF.h +0 -70
  715. data/ext/ice/cpp/include/Ice/Process.h +0 -574
  716. data/ext/ice/cpp/include/Ice/ProcessF.h +0 -83
  717. data/ext/ice/cpp/include/Ice/Properties.h +0 -136
  718. data/ext/ice/cpp/include/Ice/PropertiesAdmin.h +0 -830
  719. data/ext/ice/cpp/include/Ice/PropertiesF.h +0 -87
  720. data/ext/ice/cpp/include/Ice/RemoteLogger.h +0 -1500
  721. data/ext/ice/cpp/include/Ice/Router.h +0 -1159
  722. data/ext/ice/cpp/include/Ice/RouterF.h +0 -83
  723. data/ext/ice/cpp/include/Ice/ServantLocator.h +0 -96
  724. data/ext/ice/cpp/include/Ice/Stream.h +0 -447
  725. data/ext/ice/cpp/include/Ice/StreamF.h +0 -30
  726. data/ext/ice/cpp/include/Ice/Version.h +0 -262
  727. data/ext/ice/cpp/include/IceSSL/ConnectionInfo.h +0 -158
  728. data/ext/ice/cpp/include/IceSSL/EndpointInfo.h +0 -142
  729. data/ext/ice/cpp/include/IceUtil/AbstractMutex.h +0 -119
  730. data/ext/ice/cpp/include/IceUtil/Cache.h +0 -362
  731. data/ext/ice/cpp/include/IceUtil/IconvStringConverter.h +0 -302
  732. data/ext/ice/cpp/include/IceUtil/SHA1.h +0 -47
  733. data/ext/ice/cpp/include/Slice/CPlusPlusUtil.h +0 -65
  734. data/ext/ice/cpp/include/Slice/Checksum.h +0 -26
  735. data/ext/ice/cpp/include/Slice/CsUtil.h +0 -92
  736. data/ext/ice/cpp/include/Slice/DotNetNames.h +0 -34
  737. data/ext/ice/cpp/include/Slice/JavaUtil.h +0 -279
  738. data/ext/ice/cpp/include/Slice/ObjCUtil.h +0 -127
  739. data/ext/ice/cpp/include/Slice/PHPUtil.h +0 -50
  740. data/ext/ice/cpp/include/Slice/PythonUtil.h +0 -64
  741. data/ext/ice/cpp/include/Slice/Util.h +0 -56
  742. data/ext/ice/cpp/src/Ice/BasicStream.cpp +0 -3428
  743. data/ext/ice/cpp/src/Ice/DeprecatedStringConverter.cpp +0 -62
  744. data/ext/ice/cpp/src/Ice/ObjectFactoryF.cpp +0 -44
  745. data/ext/ice/cpp/src/Ice/ObjectFactoryManager.cpp +0 -139
  746. data/ext/ice/cpp/src/Ice/ObjectFactoryManager.h +0 -43
  747. data/ext/ice/cpp/src/Ice/Outgoing.cpp +0 -694
  748. data/ext/ice/cpp/src/Ice/Stream.cpp +0 -53
  749. data/ext/ice/cpp/src/Ice/StreamI.cpp +0 -832
  750. data/ext/ice/cpp/src/Ice/StreamI.h +0 -198
  751. data/ext/ice/cpp/src/IceSSL/Certificate.cpp +0 -1336
  752. data/ext/ice/cpp/src/IceUtil/ArgVector.cpp +0 -64
  753. data/ext/ice/cpp/src/IceUtil/ArgVector.h +0 -41
  754. data/ext/ice/cpp/src/IceUtil/Exception.cpp +0 -792
  755. data/ext/ice/cpp/src/IceUtil/FileUtil.h +0 -185
  756. data/ext/ice/cpp/src/Slice/CsUtil.cpp +0 -2660
  757. data/ext/ice/cpp/src/Slice/DotNetNames.cpp +0 -146
  758. data/ext/ice/cpp/src/Slice/ObjCUtil.cpp +0 -1310
  759. data/lib/Ice/ObjectFactoryF.rb +0 -29
  760. data/lib/IceGrid/Locator.rb +0 -106
  761. data/lib/IceGrid/Observer.rb +0 -572
  762. data/lib/IceGrid/Query.rb +0 -169
  763. data/slice/Freeze/BackgroundSaveEvictor.ice +0 -111
  764. data/slice/Freeze/CatalogData.ice +0 -49
  765. data/slice/Freeze/Connection.ice +0 -121
  766. data/slice/Freeze/ConnectionF.ice +0 -20
  767. data/slice/Freeze/DB.ice +0 -37
  768. data/slice/Freeze/Evictor.ice +0 -346
  769. data/slice/Freeze/EvictorF.ice +0 -22
  770. data/slice/Freeze/EvictorStorage.ice +0 -72
  771. data/slice/Freeze/Exception.ice +0 -100
  772. data/slice/Freeze/Transaction.ice +0 -58
  773. data/slice/Freeze/TransactionalEvictor.ice +0 -50
  774. data/slice/Ice/ObjectFactoryF.ice +0 -21
  775. data/slice/IceGrid/Locator.ice +0 -57
  776. data/slice/IceGrid/Observer.ice +0 -395
  777. data/slice/IceGrid/Query.ice +0 -131
@@ -1,19 +1,12 @@
1
- // **********************************************************************
2
1
  //
3
- // Copyright (c) 2003-2018 ZeroC, Inc. All rights reserved.
2
+ // Copyright (c) ZeroC, Inc. All rights reserved.
4
3
  //
5
- // This copy of Ice is licensed to you under the terms described in the
6
- // ICE_LICENSE file included in this distribution.
7
- //
8
- // **********************************************************************
9
4
 
10
5
  #include <Slice/PythonUtil.h>
11
6
  #include <Slice/Checksum.h>
12
7
  #include <Slice/Util.h>
13
8
  #include <IceUtil/IceUtil.h>
14
9
  #include <IceUtil/StringUtil.h>
15
- #include <IceUtil/InputUtil.h>
16
- #include <IceUtil/Unicode.h>
17
10
  #include <climits>
18
11
  #include <iterator>
19
12
 
@@ -22,6 +15,26 @@ using namespace Slice;
22
15
  using namespace IceUtil;
23
16
  using namespace IceUtilInternal;
24
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
+
25
38
  namespace Slice
26
39
  {
27
40
  namespace Python
@@ -49,7 +62,7 @@ private:
49
62
  //
50
63
  // Validates sequence metadata.
51
64
  //
52
- void validateSequence(const string&, const string&, const TypePtr&, const StringList&);
65
+ StringList validateSequence(const string&, const string&, const TypePtr&, const StringList&);
53
66
 
54
67
  //
55
68
  // Checks a definition that doesn't currently support Python metadata.
@@ -104,10 +117,15 @@ public:
104
117
 
105
118
  private:
106
119
 
120
+ //
121
+ // Emit Python code for the class operations
122
+ //
123
+ void writeOperations(const ClassDefPtr&);
124
+
107
125
  //
108
126
  // Return a Python symbol for the given parser element.
109
127
  //
110
- string getSymbol(const ContainedPtr&, const string& = string());
128
+ string getSymbol(const ContainedPtr&, const string& = "", const string& = "");
111
129
 
112
130
  //
113
131
  // Emit Python code to assign the given symbol in the current module.
@@ -183,7 +201,7 @@ private:
183
201
  };
184
202
  bool parseOpComment(const string&, OpComment&);
185
203
 
186
- enum DocstringMode { DocSync, DocAsyncBegin, DocAsyncEnd, DocDispatch, DocAsyncDispatch };
204
+ enum DocstringMode { DocSync, DocAsync, DocAsyncBegin, DocAsyncEnd, DocDispatch, DocAsyncDispatch };
187
205
 
188
206
  void writeDocstring(const OperationPtr&, DocstringMode, bool);
189
207
 
@@ -196,44 +214,6 @@ private:
196
214
  }
197
215
  }
198
216
 
199
- string
200
- u32CodePoint(unsigned int value)
201
- {
202
- ostringstream s;
203
- s << "\\U";
204
- s << hex;
205
- s.width(8);
206
- s.fill('0');
207
- s << value;
208
- return s.str();
209
- }
210
-
211
- void
212
- writeU8Buffer(const vector<unsigned char>& u8buffer, ostringstream& out)
213
- {
214
- vector<unsigned int> u32buffer;
215
- IceUtilInternal::ConversionResult result = convertUTF8ToUTF32(u8buffer, u32buffer, IceUtil::lenientConversion);
216
- switch(result)
217
- {
218
- case conversionOK:
219
- break;
220
- case sourceExhausted:
221
- throw IceUtil::IllegalConversionException(__FILE__, __LINE__, "string source exhausted");
222
- case sourceIllegal:
223
- throw IceUtil::IllegalConversionException(__FILE__, __LINE__, "string source illegal");
224
- default:
225
- {
226
- assert(0);
227
- throw IceUtil::IllegalConversionException(__FILE__, __LINE__);
228
- }
229
- }
230
-
231
- for(vector<unsigned int>::const_iterator c = u32buffer.begin(); c != u32buffer.end(); ++c)
232
- {
233
- out << u32CodePoint(*c);
234
- }
235
- }
236
-
237
217
  static string
238
218
  lookupKwd(const string& name)
239
219
  {
@@ -288,7 +268,7 @@ splitScopedName(const string& scoped)
288
268
  }
289
269
 
290
270
  static string
291
- getDictLookup(const ContainedPtr& cont, const string& suffix = string())
271
+ getDictLookup(const ContainedPtr& cont, const string& suffix = "", const string& prefix = "")
292
272
  {
293
273
  string scope = Slice::Python::scopedToName(cont->scope());
294
274
  assert(!scope.empty());
@@ -299,7 +279,7 @@ getDictLookup(const ContainedPtr& cont, const string& suffix = string())
299
279
  scope = package + "." + scope;
300
280
  }
301
281
 
302
- return "'" + suffix + Slice::Python::fixIdent(cont->name()) + "' not in _M_" + scope + "__dict__";
282
+ return "'" + suffix + Slice::Python::fixIdent(cont->name() + prefix) + "' not in _M_" + scope + "__dict__";
303
283
  }
304
284
 
305
285
  //
@@ -356,7 +336,8 @@ Slice::Python::ModuleVisitor::visitModuleStart(const ModulePtr& p)
356
336
  // CodeVisitor implementation.
357
337
  //
358
338
  Slice::Python::CodeVisitor::CodeVisitor(Output& out, set<string>& moduleHistory) :
359
- _out(out), _moduleHistory(moduleHistory)
339
+ _out(out),
340
+ _moduleHistory(moduleHistory)
360
341
  {
361
342
  }
362
343
 
@@ -440,10 +421,16 @@ Slice::Python::CodeVisitor::visitClassDecl(const ClassDeclPtr& p)
440
421
  {
441
422
  _out << sp << nl << "if " << getDictLookup(p) << ':';
442
423
  _out.inc();
443
- string type = getAbsolute(p, "_t_");
444
- _out << nl << "_M_" << type << " = IcePy.declareClass('" << scoped << "')";
445
- if(!p->isLocal())
424
+
425
+ if(!p->isInterface() || p->isLocal())
426
+ {
427
+ _out << nl << "_M_" << getAbsolute(p, "_t_") << " = IcePy.declareValue('" << scoped << "')";
428
+ }
429
+
430
+ ClassDefPtr def = p->definition();
431
+ if(!p->isLocal() && (p->isInterface() || (def && def->allOperations().size())))
446
432
  {
433
+ _out << nl << "_M_" << getAbsolute(p, "_t_", "Disp") << " = IcePy.declareClass('" << scoped << "')";
447
434
  _out << nl << "_M_" << getAbsolute(p, "_t_", "Prx") << " = IcePy.declareProxy('" << scoped << "')";
448
435
  }
449
436
  _out.dec();
@@ -451,150 +438,10 @@ Slice::Python::CodeVisitor::visitClassDecl(const ClassDeclPtr& p)
451
438
  }
452
439
  }
453
440
 
454
- bool
455
- Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
441
+ void
442
+ Slice::Python::CodeVisitor::writeOperations(const ClassDefPtr& p)
456
443
  {
457
- string scoped = p->scoped();
458
- string type = getAbsolute(p, "_t_");
459
- string abs = getAbsolute(p);
460
- string name = fixIdent(p->name());
461
- string prxAbs = getAbsolute(p, "", "Prx");
462
- string prxName = fixIdent(p->name() + "Prx");
463
- string prxType = getAbsolute(p, "_t_", "Prx");
464
- ClassList bases = p->bases();
465
- ClassDefPtr base;
466
444
  OperationList ops = p->operations();
467
- bool isAbstract = p->isInterface() || p->allOperations().size() > 0; // Don't use isAbstract() - see bug 3739
468
-
469
- //
470
- // Define the class.
471
- //
472
- _out << sp << nl << "if " << getDictLookup(p) << ':';
473
- _out.inc();
474
- _out << nl << "_M_" << abs << " = Ice.createTempClass()";
475
- _out << nl << "class " << name << '(';
476
- if(bases.empty())
477
- {
478
- if(p->isLocal())
479
- {
480
- _out << "object";
481
- }
482
- else
483
- {
484
- _out << "Ice.Object";
485
- }
486
- }
487
- else
488
- {
489
- for(ClassList::const_iterator q = bases.begin(); q != bases.end(); ++q)
490
- {
491
- if(q != bases.begin())
492
- {
493
- _out << ", ";
494
- }
495
- _out << getSymbol(*q);
496
- }
497
- if(!bases.front()->isInterface())
498
- {
499
- base = bases.front();
500
- }
501
- }
502
- _out << "):";
503
-
504
- _out.inc();
505
-
506
- writeDocstring(p->comment(), p->dataMembers());
507
-
508
- //
509
- // __init__
510
- //
511
- _out << nl << "def __init__(self";
512
- MemberInfoList allMembers;
513
- collectClassMembers(p, allMembers, false);
514
- writeConstructorParams(allMembers);
515
- _out << "):";
516
- _out.inc();
517
- if(!base && !p->hasDataMembers() && !isAbstract)
518
- {
519
- _out << nl << "pass";
520
- }
521
- else
522
- {
523
- if(isAbstract)
524
- {
525
- _out << nl << "if Ice.getType(self) == _M_" << abs << ':';
526
- _out.inc();
527
- _out << nl << "raise RuntimeError('" << abs << " is an abstract class')";
528
- _out.dec();
529
- }
530
- if(base)
531
- {
532
- _out << nl << getSymbol(base) << ".__init__(self";
533
- for(MemberInfoList::iterator q = allMembers.begin(); q != allMembers.end(); ++q)
534
- {
535
- if(q->inherited)
536
- {
537
- _out << ", " << q->fixedName;
538
- }
539
- }
540
- _out << ')';
541
- }
542
- for(MemberInfoList::iterator q = allMembers.begin(); q != allMembers.end(); ++q)
543
- {
544
- if(!q->inherited)
545
- {
546
- writeAssign(*q);
547
- }
548
- }
549
- }
550
- _out.dec();
551
-
552
- if(!p->isLocal())
553
- {
554
- //
555
- // ice_ids
556
- //
557
- ClassList allBases = p->allBases();
558
- StringList ids;
559
- transform(allBases.begin(), allBases.end(), back_inserter(ids), IceUtil::constMemFun(&Contained::scoped));
560
- StringList other;
561
- other.push_back(scoped);
562
- other.push_back("::Ice::Object");
563
- other.sort();
564
- ids.merge(other);
565
- ids.unique();
566
- _out << sp << nl << "def ice_ids(self, current=None):";
567
- _out.inc();
568
- _out << nl << "return (";
569
- for(StringList::iterator q = ids.begin(); q != ids.end(); ++q)
570
- {
571
- if(q != ids.begin())
572
- {
573
- _out << ", ";
574
- }
575
- _out << "'" << *q << "'";
576
- }
577
- _out << ')';
578
- _out.dec();
579
-
580
- //
581
- // ice_id
582
- //
583
- _out << sp << nl << "def ice_id(self, current=None):";
584
- _out.inc();
585
- _out << nl << "return '" << scoped << "'";
586
- _out.dec();
587
-
588
- //
589
- // ice_staticId
590
- //
591
- _out << sp << nl << "def ice_staticId():";
592
- _out.inc();
593
- _out << nl << "return '" << scoped << "'";
594
- _out.dec();
595
- _out << nl << "ice_staticId = staticmethod(ice_staticId)";
596
- }
597
-
598
445
  if(!ops.empty())
599
446
  {
600
447
  //
@@ -603,9 +450,31 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
603
450
  for(OperationList::iterator oli = ops.begin(); oli != ops.end(); ++oli)
604
451
  {
605
452
  string fixedOpName = fixIdent((*oli)->name());
606
- if(!p->isLocal() && (p->hasMetaData("amd") || (*oli)->hasMetaData("amd")))
453
+ if(!p->isLocal())
607
454
  {
608
- _out << sp << nl << "def " << (*oli)->name() << "_async(self, _cb";
455
+ if((*oli)->hasMarshaledResult())
456
+ {
457
+ string name = (*oli)->name();
458
+ name[0] = static_cast<char>(toupper(static_cast<unsigned char>(name[0])));
459
+ _out << sp;
460
+ _out << nl << "\"\"\"";
461
+ _out << nl << "Immediately marshals the result of an invocation of " << (*oli)->name()
462
+ << nl << "and returns an object that the servant implementation must return"
463
+ << nl << "as its result."
464
+ << nl << "Arguments:"
465
+ << nl << "result -- The result (or result tuple) of the invocation."
466
+ << nl << "current -- The Current object passed to the invocation."
467
+ << nl << "Returns: An object containing the marshaled result.";
468
+ _out << nl << "\"\"\"";
469
+ _out << nl << "@staticmethod";
470
+ _out << nl << "def " << name << "MarshaledResult(result, current):";
471
+ _out.inc();
472
+ _out << nl << "return IcePy.MarshaledResult(result, _M_" << getAbsolute(p) << "._op_"
473
+ << (*oli)->name() << ", current.adapter.getCommunicator().getImpl(), current.encoding)";
474
+ _out.dec();
475
+ }
476
+
477
+ _out << sp << nl << "def " << fixedOpName << "(self";
609
478
 
610
479
  ParamDeclList params = (*oli)->parameters();
611
480
 
@@ -616,16 +485,18 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
616
485
  _out << ", " << fixIdent((*pli)->name());
617
486
  }
618
487
  }
488
+
619
489
  if(!p->isLocal())
620
490
  {
621
- _out << ", current=None";
491
+ const string currentParamName = getEscapedParamName(*oli, "current");
492
+ _out << ", " << currentParamName << "=None";
622
493
  }
623
494
  _out << "):";
624
495
  _out.inc();
625
496
 
626
497
  writeDocstring(*oli, DocAsyncDispatch, false);
627
498
 
628
- _out << nl << "pass";
499
+ _out << nl << "raise NotImplementedError(\"servant method '" << fixedOpName << "' not implemented\")";
629
500
  _out.dec();
630
501
  }
631
502
  else
@@ -643,54 +514,287 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
643
514
  }
644
515
  if(!p->isLocal())
645
516
  {
646
- _out << ", current=None";
517
+ const string currentParamName = getEscapedParamName(*oli, "current");
518
+ _out << ", " << currentParamName << "=None";
647
519
  }
648
520
  _out << "):";
649
521
  _out.inc();
650
522
  writeDocstring(*oli, DocDispatch, p->isLocal());
651
- _out << nl << "pass";
523
+ _out << nl << "raise NotImplementedError(\"method '" << fixedOpName << "' not implemented\")";
652
524
  _out.dec();
653
525
  }
654
526
  }
655
527
  }
528
+ }
656
529
 
657
- //
658
- // __str__
659
- //
660
- _out << sp << nl << "def __str__(self):";
661
- _out.inc();
662
- _out << nl << "return IcePy.stringify(self, _M_" << getAbsolute(p, "_t_") << ")";
663
- _out.dec();
664
- _out << sp << nl << "__repr__ = __str__";
530
+ bool
531
+ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
532
+ {
533
+ bool isLocal = p->isLocal();
534
+ bool isInterface = p->isInterface();
535
+ bool isAbstract = isInterface || p->allOperations().size() > 0; // Don't use isAbstract() - see bug 3739
665
536
 
666
- _out.dec();
537
+ string scoped = p->scoped();
538
+ string type = getAbsolute(p, "_t_");
539
+ string classType = getAbsolute(p, "_t_", "Disp");
540
+ string abs = getAbsolute(p);
541
+ string className = isLocal || isInterface ? fixIdent(p->name()) : isAbstract ? fixIdent(p->name() + "Disp") : "None";
542
+ string classAbs = isInterface ? getAbsolute(p) : getAbsolute(p, "", "Disp");
543
+ string valueName = (isInterface && !isLocal) ? "Ice.Value" : fixIdent(p->name());
544
+ string prxAbs = getAbsolute(p, "", "Prx");
545
+ string prxName = fixIdent(p->name() + "Prx");
546
+ string prxType = getAbsolute(p, "_t_", "Prx");
547
+ ClassList bases = p->bases();
548
+ ClassDefPtr base;
549
+
550
+ if(!bases.empty() && !bases.front()->isInterface())
551
+ {
552
+ base = bases.front();
553
+ }
667
554
 
668
555
  //
669
- // Define the proxy class.
556
+ // Define a class type for Value types or local classes.
670
557
  //
671
- if(!p->isLocal())
558
+ if(isLocal || !isInterface)
672
559
  {
673
- _out << sp << nl << "_M_" << prxAbs << " = Ice.createTempClass()";
674
- _out << nl << "class " << prxName << "(";
675
- if(bases.empty())
560
+ _out << sp << nl << "if " << getDictLookup(p) << ':';
561
+ _out.inc();
562
+ _out << nl << "_M_" << abs << " = Ice.createTempClass()";
563
+ _out << nl << "class " << valueName << '(';
564
+ if(isLocal)
565
+ {
566
+ if(bases.empty())
567
+ {
568
+ _out << "object";
569
+ }
570
+ else
571
+ {
572
+ for(ClassList::const_iterator q = bases.begin(); q != bases.end(); ++q)
573
+ {
574
+ if(q != bases.begin())
575
+ {
576
+ _out << ", ";
577
+ }
578
+ _out << getSymbol(*q);
579
+ }
580
+ }
581
+ }
582
+ else
676
583
  {
677
- _out << "Ice.ObjectPrx";
584
+ if(bases.empty() || bases.front()->isInterface())
585
+ {
586
+ _out << "Ice.Value";
587
+ }
588
+ else
589
+ {
590
+ _out << getSymbol(bases.front());
591
+ }
592
+ }
593
+ _out << "):";
594
+
595
+ _out.inc();
596
+
597
+ writeDocstring(p->comment(), p->dataMembers());
598
+
599
+ //
600
+ // __init__
601
+ //
602
+ _out << nl << "def __init__(self";
603
+ MemberInfoList allMembers;
604
+ collectClassMembers(p, allMembers, false);
605
+ writeConstructorParams(allMembers);
606
+ _out << "):";
607
+ _out.inc();
608
+ if(!base && !p->hasDataMembers() && (!isAbstract || !isLocal))
609
+ {
610
+ _out << nl << "pass";
678
611
  }
679
612
  else
680
613
  {
681
- ClassList::const_iterator q = bases.begin();
682
- while(q != bases.end())
614
+ if(isAbstract && isLocal)
615
+ {
616
+ _out << nl << "if Ice.getType(self) == _M_" << abs << ':';
617
+ _out.inc();
618
+ _out << nl << "raise RuntimeError('" << abs << " is an abstract class')";
619
+ _out.dec();
620
+ }
621
+ if(base)
683
622
  {
684
- _out << getSymbol(*q, "Prx");
685
- if(++q != bases.end())
623
+ _out << nl << getSymbol(base) << ".__init__(self";
624
+ for(MemberInfoList::iterator q = allMembers.begin(); q != allMembers.end(); ++q)
686
625
  {
687
- _out << ", ";
626
+ if(q->inherited)
627
+ {
628
+ _out << ", " << q->fixedName;
629
+ }
630
+ }
631
+ _out << ')';
632
+ }
633
+ for(MemberInfoList::iterator q = allMembers.begin(); q != allMembers.end(); ++q)
634
+ {
635
+ if(!q->inherited)
636
+ {
637
+ writeAssign(*q);
638
+ }
639
+ }
640
+ }
641
+ _out.dec();
642
+
643
+ if(!isLocal)
644
+ {
645
+ //
646
+ // ice_id
647
+ //
648
+ _out << sp << nl << "def ice_id(self):";
649
+ _out.inc();
650
+ _out << nl << "return '" << scoped << "'";
651
+ _out.dec();
652
+
653
+ //
654
+ // ice_staticId
655
+ //
656
+ _out << sp << nl << "@staticmethod";
657
+ _out << nl << "def ice_staticId():";
658
+ _out.inc();
659
+ _out << nl << "return '" << scoped << "'";
660
+ _out.dec();
661
+ }
662
+ else
663
+ {
664
+ writeOperations(p);
665
+ }
666
+
667
+ //
668
+ // __str__
669
+ //
670
+ _out << sp << nl << "def __str__(self):";
671
+ _out.inc();
672
+ _out << nl << "return IcePy.stringify(self, _M_" << type << ")";
673
+ _out.dec();
674
+ _out << sp << nl << "__repr__ = __str__";
675
+
676
+ _out.dec();
677
+
678
+ if(_classHistory.count(scoped) == 0 && p->canBeCyclic())
679
+ {
680
+ //
681
+ // Emit a forward declaration for the class in case a data member refers to this type.
682
+ //
683
+ _out << sp << nl << "_M_" << type << " = IcePy.declareValue('" << scoped << "')";
684
+ }
685
+ DataMemberList members = p->dataMembers();
686
+ _out << sp << nl << "_M_" << type << " = IcePy.defineValue('" << scoped << "', " << valueName
687
+ << ", " << p->compactId() << ", ";
688
+ writeMetaData(p->getMetaData());
689
+ const bool preserved = p->hasMetaData("preserve-slice") || p->inheritsMetaData("preserve-slice");
690
+ _out << ", " << (preserved ? "True" : "False") << ", " << (isInterface ? "True" : "False") << ", ";
691
+ if(!base)
692
+ {
693
+ _out << "None";
694
+ }
695
+ else
696
+ {
697
+ _out << "_M_" << getAbsolute(base, "_t_");
698
+ }
699
+ _out << ", (";
700
+ //
701
+ // Members
702
+ //
703
+ // Data members are represented as a tuple:
704
+ //
705
+ // ('MemberName', MemberMetaData, MemberType, Optional, Tag)
706
+ //
707
+ // where MemberType is either a primitive type constant (T_INT, etc.) or the id of a constructed type.
708
+ //
709
+ if(members.size() > 1)
710
+ {
711
+ _out.inc();
712
+ _out << nl;
713
+ }
714
+ bool isProtected = p->hasMetaData("protected");
715
+ for(DataMemberList::iterator r = members.begin(); r != members.end(); ++r)
716
+ {
717
+ if(r != members.begin())
718
+ {
719
+ _out << ',' << nl;
720
+ }
721
+ _out << "('";
722
+ if(isProtected || (*r)->hasMetaData("protected"))
723
+ {
724
+ _out << '_';
725
+ }
726
+ _out << fixIdent((*r)->name()) << "', ";
727
+ writeMetaData((*r)->getMetaData());
728
+ _out << ", ";
729
+ writeType((*r)->type());
730
+ _out << ", " << ((*r)->optional() ? "True" : "False") << ", "
731
+ << ((*r)->optional() ? (*r)->tag() : 0) << ')';
732
+ }
733
+ if(members.size() == 1)
734
+ {
735
+ _out << ',';
736
+ }
737
+ else if(members.size() > 1)
738
+ {
739
+ _out.dec();
740
+ _out << nl;
741
+ }
742
+ _out << "))";
743
+ _out << nl << valueName << "._ice_type = _M_" << type;
744
+
745
+ registerName(valueName);
746
+
747
+ _out.dec();
748
+ }
749
+ else if(!isLocal && isInterface)
750
+ {
751
+ _out << sp << nl << "_M_" << type << " = IcePy.defineValue('" << scoped << "', Ice.Value, -1, ";
752
+ writeMetaData(p->getMetaData());
753
+ _out << ", False, True, None, ())";
754
+ }
755
+
756
+ if(!isLocal && isAbstract)
757
+ {
758
+ _out << sp << nl << "if " << getDictLookup(p, "", "Prx") << ':';
759
+ _out.inc();
760
+
761
+ // Define the proxy class
762
+ _out << nl << "_M_" << prxAbs << " = Ice.createTempClass()";
763
+ _out << nl << "class " << prxName << '(';
764
+
765
+ {
766
+ vector<string> baseClasses;
767
+ for(ClassList::const_iterator q = bases.begin(); q != bases.end(); ++q)
768
+ {
769
+ ClassDefPtr d = *q;
770
+ if(d->isInterface() || d->allOperations().size() > 0)
771
+ {
772
+ baseClasses.push_back(getSymbol(*q, "", "Prx"));
773
+ }
774
+ }
775
+
776
+ if(baseClasses.empty())
777
+ {
778
+ _out << "Ice.ObjectPrx";
779
+ }
780
+ else
781
+ {
782
+ vector<string>::const_iterator q = baseClasses.begin();
783
+ while(q != baseClasses.end())
784
+ {
785
+ _out << *q;
786
+
787
+ if(++q != baseClasses.end())
788
+ {
789
+ _out << ", ";
790
+ }
688
791
  }
689
792
  }
690
793
  }
691
794
  _out << "):";
692
795
  _out.inc();
693
796
 
797
+ OperationList ops = p->operations();
694
798
  for(OperationList::iterator oli = ops.begin(); oli != ops.end(); ++oli)
695
799
  {
696
800
  string fixedOpName = fixIdent((*oli)->name());
@@ -721,19 +825,37 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
721
825
  {
722
826
  _out << ", " << inParams;
723
827
  }
724
- _out << ", _ctx=None):";
828
+ const string contextParamName = getEscapedParamName(*oli, "context");
829
+ _out << ", " << contextParamName << "=None):";
725
830
  _out.inc();
726
- _out << nl << "return _M_" << abs << "._op_" << (*oli)->name() << ".invoke(self, ((" << inParams;
831
+ _out << nl << "return _M_" << classAbs << "._op_" << (*oli)->name() << ".invoke(self, ((" << inParams;
727
832
  if(!inParams.empty() && inParams.find(',') == string::npos)
728
833
  {
729
834
  _out << ", ";
730
835
  }
731
- _out << "), _ctx))";
836
+ _out << "), " << contextParamName << "))";
732
837
  _out.dec();
733
838
 
734
839
  //
735
840
  // Async operations.
736
841
  //
842
+ _out << sp;
843
+ writeDocstring(*oli, DocAsync, false);
844
+ _out << nl << "def " << (*oli)->name() << "Async(self";
845
+ if(!inParams.empty())
846
+ {
847
+ _out << ", " << inParams;
848
+ }
849
+ _out << ", " << contextParamName << "=None):";
850
+ _out.inc();
851
+ _out << nl << "return _M_" << classAbs << "._op_" << (*oli)->name() << ".invokeAsync(self, ((" << inParams;
852
+ if(!inParams.empty() && inParams.find(',') == string::npos)
853
+ {
854
+ _out << ", ";
855
+ }
856
+ _out << "), " << contextParamName << "))";
857
+ _out.dec();
858
+
737
859
  _out << sp;
738
860
  writeDocstring(*oli, DocAsyncBegin, false);
739
861
  _out << nl << "def begin_" << (*oli)->name() << "(self";
@@ -741,150 +863,187 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
741
863
  {
742
864
  _out << ", " << inParams;
743
865
  }
744
- _out << ", _response=None, _ex=None, _sent=None, _ctx=None):";
866
+ _out << ", _response=None, _ex=None, _sent=None, " << contextParamName << "=None):";
745
867
  _out.inc();
746
- _out << nl << "return _M_" << abs << "._op_" << (*oli)->name() << ".begin(self, ((" << inParams;
868
+ _out << nl << "return _M_" << classAbs << "._op_" << (*oli)->name() << ".begin(self, ((" << inParams;
747
869
  if(!inParams.empty() && inParams.find(',') == string::npos)
748
870
  {
749
871
  _out << ", ";
750
872
  }
751
- _out << "), _response, _ex, _sent, _ctx))";
873
+ _out << "), _response, _ex, _sent, " << contextParamName << "))";
752
874
  _out.dec();
753
875
 
754
876
  _out << sp;
755
877
  writeDocstring(*oli, DocAsyncEnd, false);
756
878
  _out << nl << "def end_" << (*oli)->name() << "(self, _r):";
757
879
  _out.inc();
758
- _out << nl << "return _M_" << abs << "._op_" << (*oli)->name() << ".end(self, _r)";
880
+ _out << nl << "return _M_" << classAbs << "._op_" << (*oli)->name() << ".end(self, _r)";
759
881
  _out.dec();
760
882
  }
761
883
 
762
- _out << sp << nl << "def checkedCast(proxy, facetOrCtx=None, _ctx=None):";
884
+ _out << sp << nl << "@staticmethod";
885
+ _out << nl << "def checkedCast(proxy, facetOrContext=None, context=None):";
763
886
  _out.inc();
764
- _out << nl << "return _M_" << prxAbs << ".ice_checkedCast(proxy, '" << scoped << "', facetOrCtx, _ctx)";
887
+ _out << nl << "return _M_" << prxAbs << ".ice_checkedCast(proxy, '" << scoped << "', facetOrContext, context)";
765
888
  _out.dec();
766
- _out << nl << "checkedCast = staticmethod(checkedCast)";
767
889
 
768
- _out << sp << nl << "def uncheckedCast(proxy, facet=None):";
890
+ _out << sp << nl << "@staticmethod";
891
+ _out << nl << "def uncheckedCast(proxy, facet=None):";
769
892
  _out.inc();
770
893
  _out << nl << "return _M_" << prxAbs << ".ice_uncheckedCast(proxy, facet)";
771
894
  _out.dec();
772
- _out << nl << "uncheckedCast = staticmethod(uncheckedCast)";
773
895
 
774
-
775
- //
896
+ //
776
897
  // ice_staticId
777
898
  //
778
- _out << sp << nl << "def ice_staticId():";
899
+ _out << sp << nl << "@staticmethod";
900
+ _out << nl << "def ice_staticId():";
779
901
  _out.inc();
780
902
  _out << nl << "return '" << scoped << "'";
781
903
  _out.dec();
782
- _out << nl << "ice_staticId = staticmethod(ice_staticId)";
783
904
 
784
- _out.dec();
905
+ _out.dec(); // end prx class
785
906
 
786
- _out << sp << nl << "_M_" << prxType << " = IcePy.defineProxy('" << scoped << "', " << prxName << ")";
787
- }
907
+ _out << nl << "_M_" << prxType << " = IcePy.defineProxy('" << scoped << "', " << prxName << ")";
908
+
909
+ registerName(prxName);
910
+
911
+ // Define the servant class
912
+ _out << sp << nl << "_M_" << classAbs << " = Ice.createTempClass()";
913
+ _out << nl << "class " << className << '(';
914
+ {
915
+ vector<string> baseClasses;
916
+ for(ClassList::const_iterator q = bases.begin(); q != bases.end(); ++q)
917
+ {
918
+ ClassDefPtr d = *q;
919
+ if(d->isInterface() || d->allOperations().size() > 0)
920
+ {
921
+ baseClasses.push_back(getSymbol(*q, "", d->isInterface() ? "" : "Disp"));
922
+ }
923
+ }
924
+
925
+ if(baseClasses.empty())
926
+ {
927
+ _out << "Ice.Object";
928
+ }
929
+ else
930
+ {
931
+ vector<string>::const_iterator q = baseClasses.begin();
932
+ while(q != baseClasses.end())
933
+ {
934
+ _out << *q;
935
+
936
+ if(++q != baseClasses.end())
937
+ {
938
+ _out << ", ";
939
+ }
940
+ }
941
+ }
942
+ }
943
+ _out << "):";
944
+
945
+ _out.inc();
788
946
 
789
- if(_classHistory.count(scoped) == 0 && p->canBeCyclic())
790
- {
791
947
  //
792
- // Emit a forward declaration for the class in case a data member refers to this type.
948
+ // ice_ids
793
949
  //
794
- _out << sp << nl << "_M_" << type << " = IcePy.declareClass('" << scoped << "')";
795
- }
796
-
797
- DataMemberList members = p->dataMembers();
798
- _out << sp << nl << "_M_" << type << " = IcePy.defineClass('" << scoped << "', " << name << ", " << p->compactId()
799
- << ", ";
800
- writeMetaData(p->getMetaData());
801
- const bool preserved = p->hasMetaData("preserve-slice") || p->inheritsMetaData("preserve-slice");
802
- _out << ", " << (isAbstract ? "True" : "False") << ", " << (preserved ? "True" : "False") << ", ";
803
- if(!base)
804
- {
805
- _out << "None";
806
- }
807
- else
808
- {
809
- _out << "_M_" << getAbsolute(base, "_t_");
810
- }
811
- _out << ", (";
812
- //
813
- // Interfaces
814
- //
815
- int interfaceCount = 0;
816
- for(ClassList::const_iterator q = bases.begin(); q != bases.end(); ++q)
817
- {
818
- if((*q)->isInterface())
950
+ ClassList allBases = p->allBases();
951
+ StringList ids;
952
+ transform(allBases.begin(), allBases.end(), back_inserter(ids), IceUtil::constMemFun(&Contained::scoped));
953
+ StringList other;
954
+ other.push_back(scoped);
955
+ other.push_back("::Ice::Object");
956
+ other.sort();
957
+ ids.merge(other);
958
+ ids.unique();
959
+ _out << sp << nl << "def ice_ids(self, current=None):";
960
+ _out.inc();
961
+ _out << nl << "return (";
962
+ for(StringList::iterator q = ids.begin(); q != ids.end(); ++q)
819
963
  {
820
- if(interfaceCount > 0)
964
+ if(q != ids.begin())
821
965
  {
822
966
  _out << ", ";
823
967
  }
824
- _out << "_M_" << getAbsolute(*q, "_t_");
825
- ++interfaceCount;
968
+ _out << "'" << *q << "'";
826
969
  }
827
- }
828
- if(interfaceCount == 1)
829
- {
830
- _out << ',';
831
- }
832
- //
833
- // Members
834
- //
835
- // Data members are represented as a tuple:
836
- //
837
- // ('MemberName', MemberMetaData, MemberType, Optional, Tag)
838
- //
839
- // where MemberType is either a primitive type constant (T_INT, etc.) or the id of a constructed type.
840
- //
841
- _out << "), (";
842
- if(members.size() > 1)
843
- {
970
+ _out << ')';
971
+ _out.dec();
972
+
973
+ //
974
+ // ice_id
975
+ //
976
+ _out << sp << nl << "def ice_id(self, current=None):";
844
977
  _out.inc();
845
- _out << nl;
846
- }
847
- bool isProtected = p->hasMetaData("protected");
848
- for(DataMemberList::iterator r = members.begin(); r != members.end(); ++r)
849
- {
850
- if(r != members.begin())
978
+ _out << nl << "return '" << scoped << "'";
979
+ _out.dec();
980
+
981
+ //
982
+ // ice_staticId
983
+ //
984
+ _out << sp << nl << "@staticmethod";
985
+ _out << nl << "def ice_staticId():";
986
+ _out.inc();
987
+ _out << nl << "return '" << scoped << "'";
988
+ _out.dec();
989
+
990
+ writeOperations(p);
991
+
992
+ //
993
+ // __str__
994
+ //
995
+ _out << sp << nl << "def __str__(self):";
996
+ _out.inc();
997
+ _out << nl << "return IcePy.stringify(self, _M_" << getAbsolute(p, "_t_", "Disp") << ")";
998
+ _out.dec();
999
+ _out << sp << nl << "__repr__ = __str__";
1000
+
1001
+ _out.dec();
1002
+
1003
+ _out << sp << nl << "_M_" << classType << " = IcePy.defineClass('" << scoped << "', " << className
1004
+ << ", ";
1005
+ writeMetaData(p->getMetaData());
1006
+ _out << ", ";
1007
+ if(!base || (!base->isInterface() && base->allOperations().size() == 0))
851
1008
  {
852
- _out << ',' << nl;
1009
+ _out << "None";
853
1010
  }
854
- _out << "('";
855
- if(isProtected || (*r)->hasMetaData("protected"))
1011
+ else
856
1012
  {
857
- _out << '_';
1013
+ _out << "_M_" << getAbsolute(base, "_t_", "Disp");
858
1014
  }
859
- _out << fixIdent((*r)->name()) << "', ";
860
- writeMetaData((*r)->getMetaData());
861
- _out << ", ";
862
- writeType((*r)->type());
863
- _out << ", " << ((*r)->optional() ? "True" : "False") << ", "
864
- << ((*r)->optional() ? (*r)->tag() : 0) << ')';
865
- }
866
- if(members.size() == 1)
867
- {
868
- _out << ',';
869
- }
870
- else if(members.size() > 1)
871
- {
872
- _out.dec();
873
- _out << nl;
874
- }
875
- _out << "))";
876
- _out << nl << name << "._ice_type = _M_" << type;
1015
+ _out << ", (";
1016
+ //
1017
+ // Interfaces
1018
+ //
1019
+ int interfaceCount = 0;
1020
+ for(ClassList::const_iterator q = bases.begin(); q != bases.end(); ++q)
1021
+ {
1022
+ if((*q)->isInterface())
1023
+ {
1024
+ if(interfaceCount > 0)
1025
+ {
1026
+ _out << ", ";
1027
+ }
1028
+ _out << "_M_" << getAbsolute(*q, "_t_", "Disp");
1029
+ ++interfaceCount;
1030
+ }
1031
+ }
1032
+ if(interfaceCount == 1)
1033
+ {
1034
+ _out << ',';
1035
+ }
1036
+ _out << "))";
1037
+ _out << nl << className << "._ice_type = _M_" << classType;
877
1038
 
878
- //
879
- // Define each operation. The arguments to the IcePy.Operation constructor are:
880
- //
881
- // 'opName', Mode, SendMode, AMD, Format, MetaData, (InParams), (OutParams), ReturnParam, (Exceptions)
882
- //
883
- // where InParams and OutParams are tuples of type descriptions, and Exceptions
884
- // is a tuple of exception type ids.
885
- //
886
- if(!p->isLocal())
887
- {
1039
+ //
1040
+ // Define each operation. The arguments to the IcePy.Operation constructor are:
1041
+ //
1042
+ // 'opName', Mode, SendMode, AMD, Format, MetaData, (InParams), (OutParams), ReturnParam, (Exceptions)
1043
+ //
1044
+ // where InParams and OutParams are tuples of type descriptions, and Exceptions
1045
+ // is a tuple of exception type ids.
1046
+ //
888
1047
  if(!ops.empty())
889
1048
  {
890
1049
  _out << sp;
@@ -908,10 +1067,10 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
908
1067
  break;
909
1068
  }
910
1069
 
911
- _out << nl << name << "._op_" << (*s)->name() << " = IcePy.Operation('" << (*s)->name() << "', "
912
- << getOperationMode((*s)->mode()) << ", " << getOperationMode((*s)->sendMode()) << ", "
913
- << ((p->hasMetaData("amd") || (*s)->hasMetaData("amd")) ? "True" : "False") << ", "
914
- << format << ", ";
1070
+ _out << nl << className << "._op_" << (*s)->name() << " = IcePy.Operation('" << (*s)->name() << "', "
1071
+ << getOperationMode((*s)->mode()) << ", " << getOperationMode((*s)->sendMode()) << ", "
1072
+ << ((p->hasMetaData("amd") || (*s)->hasMetaData("amd")) ? "True" : "False") << ", "
1073
+ << format << ", ";
915
1074
  writeMetaData((*s)->getMetaData());
916
1075
  _out << ", (";
917
1076
  for(t = params.begin(), count = 0; t != params.end(); ++t)
@@ -949,7 +1108,7 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
949
1108
  _out << ", ";
950
1109
  writeType((*t)->type());
951
1110
  _out << ", " << ((*t)->optional() ? "True" : "False") << ", "
952
- << ((*t)->optional() ? (*t)->tag() : 0) << ')';
1111
+ << ((*t)->optional() ? (*t)->tag() : 0) << ')';
953
1112
  ++count;
954
1113
  }
955
1114
  }
@@ -1000,20 +1159,14 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
1000
1159
  {
1001
1160
  msg = deprecateMetadata.substr(pos + 1);
1002
1161
  }
1003
- _out << nl << name << "._op_" << (*s)->name() << ".deprecate(\"" << msg << "\")";
1162
+ _out << nl << className << "._op_" << (*s)->name() << ".deprecate(\"" << msg << "\")";
1004
1163
  }
1005
1164
  }
1006
- }
1007
-
1008
- registerName(name);
1009
1165
 
1010
- if(!p->isLocal())
1011
- {
1012
- registerName(prxName);
1166
+ registerName(className);
1167
+ _out.dec();
1013
1168
  }
1014
1169
 
1015
- _out.dec();
1016
-
1017
1170
  if(_classHistory.count(scoped) == 0)
1018
1171
  {
1019
1172
  _classHistory.insert(scoped); // Avoid redundant declarations.
@@ -1102,9 +1255,9 @@ Slice::Python::CodeVisitor::visitExceptionStart(const ExceptionPtr& p)
1102
1255
  _out << sp << nl << "__repr__ = __str__";
1103
1256
 
1104
1257
  //
1105
- // _ice_name
1258
+ // _ice_id
1106
1259
  //
1107
- _out << sp << nl << "_ice_name = '" << scoped.substr(2) << "'";
1260
+ _out << sp << nl << "_ice_id = '" << scoped << "'";
1108
1261
 
1109
1262
  _out.dec();
1110
1263
 
@@ -1515,7 +1668,7 @@ Slice::Python::CodeVisitor::visitEnum(const EnumPtr& p)
1515
1668
  string scoped = p->scoped();
1516
1669
  string abs = getAbsolute(p);
1517
1670
  string name = fixIdent(p->name());
1518
- EnumeratorList enums = p->getEnumerators();
1671
+ EnumeratorList enums = p->enumerators();
1519
1672
  EnumeratorList::iterator q;
1520
1673
 
1521
1674
  _out << sp << nl << "if " << getDictLookup(p) << ':';
@@ -1586,12 +1739,12 @@ Slice::Python::CodeVisitor::visitConst(const ConstPtr& p)
1586
1739
  }
1587
1740
 
1588
1741
  string
1589
- Slice::Python::CodeVisitor::getSymbol(const ContainedPtr& p, const string& nameSuffix)
1742
+ Slice::Python::CodeVisitor::getSymbol(const ContainedPtr& p, const string& prefix, const string& suffix)
1590
1743
  {
1591
1744
  //
1592
1745
  // An explicit reference to another type must always be prefixed with "_M_".
1593
1746
  //
1594
- return "_M_" + getAbsolute(p, "", nameSuffix);
1747
+ return "_M_" + getAbsolute(p, prefix, suffix);
1595
1748
  }
1596
1749
 
1597
1750
  void
@@ -1651,8 +1804,9 @@ Slice::Python::CodeVisitor::writeType(const TypePtr& p)
1651
1804
  break;
1652
1805
  }
1653
1806
  case Builtin::KindObject:
1807
+ case Builtin::KindValue:
1654
1808
  {
1655
- _out << "IcePy._t_Object";
1809
+ _out << "IcePy._t_Value";
1656
1810
  break;
1657
1811
  }
1658
1812
  case Builtin::KindObjectProxy:
@@ -1672,7 +1826,15 @@ Slice::Python::CodeVisitor::writeType(const TypePtr& p)
1672
1826
  ProxyPtr prx = ProxyPtr::dynamicCast(p);
1673
1827
  if(prx)
1674
1828
  {
1675
- _out << "_M_" << getAbsolute(prx->_class(), "_t_", "Prx");
1829
+ ClassDefPtr def = prx->_class()->definition();
1830
+ if(!def || def->isAbstract())
1831
+ {
1832
+ _out << "_M_" << getAbsolute(prx->_class(), "_t_", "Prx");
1833
+ }
1834
+ else
1835
+ {
1836
+ _out << "IcePy._t_ObjectPrx";
1837
+ }
1676
1838
  return;
1677
1839
  }
1678
1840
 
@@ -1714,6 +1876,7 @@ Slice::Python::CodeVisitor::writeInitializer(const DataMemberPtr& m)
1714
1876
  _out << "''";
1715
1877
  break;
1716
1878
  }
1879
+ case Builtin::KindValue:
1717
1880
  case Builtin::KindObject:
1718
1881
  case Builtin::KindObjectProxy:
1719
1882
  case Builtin::KindLocalObject:
@@ -1728,7 +1891,7 @@ Slice::Python::CodeVisitor::writeInitializer(const DataMemberPtr& m)
1728
1891
  EnumPtr en = EnumPtr::dynamicCast(p);
1729
1892
  if(en)
1730
1893
  {
1731
- EnumeratorList enums = en->getEnumerators();
1894
+ EnumeratorList enums = en->enumerators();
1732
1895
  _out << getSymbol(en) << "." << fixIdent(enums.front()->name());
1733
1896
  return;
1734
1897
  }
@@ -1875,274 +2038,17 @@ Slice::Python::CodeVisitor::writeConstantValue(const TypePtr& type, const Syntax
1875
2038
  }
1876
2039
  case Slice::Builtin::KindString:
1877
2040
  {
1878
- ostringstream sv2;
1879
- ostringstream sv3;
1880
-
1881
- //
1882
- // Expand strings into the basic source character set. We can't use isalpha() and the like
1883
- // here because they are sensitive to the current locale.
1884
- //
1885
- static const string basicSourceChars = "abcdefghijklmnopqrstuvwxyz"
1886
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
1887
- "0123456789"
1888
- "_{}[]#()<>%:;.?*+-/^&|~!=, '";
1889
- static const set<char> charSet(basicSourceChars.begin(), basicSourceChars.end());
1890
-
1891
- for(size_t i = 0; i < value.size();)
1892
- {
1893
- char c = value[i];
1894
- switch(c)
1895
- {
1896
- case '"':
1897
- {
1898
- sv2 << "\\\"";
1899
- break;
1900
- }
1901
- case '\\':
1902
- {
1903
- string s = "\\";
1904
- size_t j = i + 1;
1905
- for(; j < value.size(); ++j)
1906
- {
1907
- if(value[j] != '\\')
1908
- {
1909
- break;
1910
- }
1911
- s += "\\";
1912
- }
1913
-
1914
- //
1915
- // An even number of slash \ will escape the backslash and
1916
- // the codepoint will be interpreted as its charaters
1917
- //
1918
- // \\u00000041 - ['\\', 'u', '0', '0', '0', '0', '0', '0', '4', '1']
1919
- // \\\u00000041 - ['\\', 'A'] (41 is the codepoint for 'A')
1920
- //
1921
- if(s.size() % 2 != 0 && (value[j] == 'U' || value[j] == 'u'))
1922
- {
1923
- //
1924
- // Convert codepoint to UTF8 bytes and write the escaped bytes
1925
- //
1926
- sv2 << s.substr(0, s.size() - 1);
1927
-
1928
- size_t sz = value[j] == 'U' ? 8 : 4;
1929
- string codepoint = value.substr(j + 1, sz);
1930
- assert(codepoint.size() == sz);
1931
-
1932
- IceUtil::Int64 v = IceUtilInternal::strToInt64(codepoint.c_str(), 0, 16);
1933
-
1934
- vector<unsigned int> u32buffer;
1935
- u32buffer.push_back(static_cast<unsigned int>(v));
1936
-
1937
- vector<unsigned char> u8buffer;
1938
- IceUtilInternal::ConversionResult result = convertUTF32ToUTF8(u32buffer, u8buffer, IceUtil::lenientConversion);
1939
- switch(result)
1940
- {
1941
- case conversionOK:
1942
- break;
1943
- case sourceExhausted:
1944
- throw IceUtil::IllegalConversionException(__FILE__, __LINE__, "string source exhausted");
1945
- case sourceIllegal:
1946
- throw IceUtil::IllegalConversionException(__FILE__, __LINE__, "string source illegal");
1947
- default:
1948
- {
1949
- assert(0);
1950
- throw IceUtil::IllegalConversionException(__FILE__, __LINE__);
1951
- }
1952
- }
1953
-
1954
- ostringstream s;
1955
- for(vector<unsigned char>::const_iterator q = u8buffer.begin(); q != u8buffer.end(); ++q)
1956
- {
1957
- s << "\\";
1958
- s.fill('0');
1959
- s.width(3);
1960
- s << oct;
1961
- s << static_cast<unsigned int>(*q);
1962
- }
1963
- sv2 << s.str();
1964
-
1965
- i = j + 1 + sz;
1966
- }
1967
- else
1968
- {
1969
- sv2 << s;
1970
- i = j;
1971
- }
1972
- continue;
1973
- }
1974
- case '\r':
1975
- {
1976
- sv2 << "\\r";
1977
- break;
1978
- }
1979
- case '\n':
1980
- {
1981
- sv2 << "\\n";
1982
- break;
1983
- }
1984
- case '\t':
1985
- {
1986
- sv2 << "\\t";
1987
- break;
1988
- }
1989
- case '\b':
1990
- {
1991
- sv2 << "\\b";
1992
- break;
1993
- }
1994
- case '\f':
1995
- {
1996
- sv2 << "\\f";
1997
- break;
1998
- }
1999
- default:
2000
- {
2001
- if(charSet.find(c) == charSet.end())
2002
- {
2003
- unsigned char uc = c; // Char may be signed, so make it positive.
2004
- stringstream s;
2005
- s << "\\"; // Print as octal if not in basic source character set.
2006
- s.flags(ios_base::oct);
2007
- s.width(3);
2008
- s.fill('0');
2009
- s << static_cast<unsigned>(uc);
2010
- sv2 << s.str();
2011
- }
2012
- else
2013
- {
2014
- sv2 << c; // Print normally if in basic source character set.
2015
- }
2016
- break;
2017
- }
2018
- }
2019
- ++i;
2020
- }
2021
-
2022
- vector<unsigned char> u8buffer; // Buffer to convert multibyte characters
2041
+ string sv2 = toStringLiteral(value, "\a\b\f\n\r\t\v", "", Octal, 0);
2042
+ string sv3 = toStringLiteral(value, "\a\b\f\n\r\t\v", "", UCN, 0);
2023
2043
 
2024
- for(size_t i = 0; i < value.size();)
2044
+ _out << "\"" << sv2<< "\"";
2045
+ if(sv2 != sv3)
2025
2046
  {
2026
- if(charSet.find(value[i]) == charSet.end())
2027
- {
2028
- char c = value[i];
2029
- if(static_cast<unsigned char>(c) < 128) // Single byte character
2030
- {
2031
- //
2032
- // Print as unicode if not in basic source character set
2033
- //
2034
- switch(c)
2035
- {
2036
- //
2037
- // Don't encode this special characters as universal characters
2038
- //
2039
- case '\r':
2040
- {
2041
- sv3 << "\\r";
2042
- break;
2043
- }
2044
- case '\n':
2045
- {
2046
- sv3 << "\\n";
2047
- break;
2048
- }
2049
- case '\\':
2050
- {
2051
- sv3 << "\\";
2052
- break;
2053
- }
2054
- default:
2055
- {
2056
- sv3 << u32CodePoint(c);
2057
- break;
2058
- }
2059
- }
2060
- }
2061
- else
2062
- {
2063
- u8buffer.push_back(value[i]);
2064
- }
2065
- }
2066
- else
2067
- {
2068
- //
2069
- // Write any pedding characters in the utf8 buffer
2070
- //
2071
- if(!u8buffer.empty())
2072
- {
2073
- writeU8Buffer(u8buffer, sv3);
2074
- u8buffer.clear();
2075
- }
2076
- switch(value[i])
2077
- {
2078
- case '\\':
2079
- {
2080
- string s = "\\";
2081
- size_t j = i + 1;
2082
- for(; j < value.size(); ++j)
2083
- {
2084
- if(value[j] != '\\')
2085
- {
2086
- break;
2087
- }
2088
- s += "\\";
2089
- }
2090
-
2091
- //
2092
- // An even number of slash \ will escape the backslash and
2093
- // the codepoint will be interpreted as its charaters
2094
- //
2095
- // \\U00000041 - ['\\', 'U', '0', '0', '0', '0', '0', '0', '4', '1']
2096
- // \\\U00000041 - ['\\', 'A'] (41 is the codepoint for 'A')
2097
- //
2098
- if(s.size() % 2 != 0 && (value[j] == 'U' || value[j] == 'u'))
2099
- {
2100
- size_t sz = value[j] == 'U' ? 8 : 4;
2101
- sv3 << s.substr(0, s.size() - 1);
2102
- i = j + 1;
2103
-
2104
- string codepoint = value.substr(j + 1, sz);
2105
- assert(codepoint.size() == sz);
2106
-
2107
- IceUtil::Int64 v = IceUtilInternal::strToInt64(codepoint.c_str(), 0, 16);
2108
- sv3 << u32CodePoint(static_cast<unsigned int>(v));
2109
- i = j + 1 + sz;
2110
- }
2111
- else
2112
- {
2113
- sv3 << s;
2114
- i = j;
2115
- }
2116
- continue;
2117
- }
2118
- case '"':
2119
- {
2120
- sv3 << "\\";
2121
- break;
2122
- }
2123
- }
2124
- sv3 << value[i]; // Print normally if in basic source character set
2125
- }
2126
- i++;
2127
- }
2128
-
2129
- //
2130
- // Write any pedding characters in the utf8 buffer
2131
- //
2132
- if(!u8buffer.empty())
2133
- {
2134
- writeU8Buffer(u8buffer, sv3);
2135
- u8buffer.clear();
2136
- }
2137
-
2138
-
2139
- _out << "\"" << sv2.str() << "\"";
2140
- if(sv2.str() != sv3.str())
2141
- {
2142
- _out << " if _version_info_[0] < 3 else \"" << sv3.str() << "\"";
2047
+ _out << " if _version_info_[0] < 3 else \"" << sv3 << "\"";
2143
2048
  }
2144
2049
  break;
2145
2050
  }
2051
+ case Slice::Builtin::KindValue:
2146
2052
  case Slice::Builtin::KindObject:
2147
2053
  case Slice::Builtin::KindObjectProxy:
2148
2054
  case Slice::Builtin::KindLocalObject:
@@ -2151,18 +2057,9 @@ Slice::Python::CodeVisitor::writeConstantValue(const TypePtr& type, const Syntax
2151
2057
  }
2152
2058
  else if(en)
2153
2059
  {
2154
- string enumName = getSymbol(en);
2155
- string::size_type colon = value.rfind(':');
2156
- string enumerator;
2157
- if(colon != string::npos)
2158
- {
2159
- enumerator = fixIdent(value.substr(colon + 1));
2160
- }
2161
- else
2162
- {
2163
- enumerator = fixIdent(value);
2164
- }
2165
- _out << enumName << '.' << enumerator;
2060
+ EnumeratorPtr lte = EnumeratorPtr::dynamicCast(valueType);
2061
+ assert(lte);
2062
+ _out << getSymbol(lte);
2166
2063
  }
2167
2064
  else
2168
2065
  {
@@ -2406,12 +2303,12 @@ Slice::Python::CodeVisitor::stripMarkup(const string& comment)
2406
2303
  string::size_type start = 0;
2407
2304
  while(start != string::npos)
2408
2305
  {
2409
- string::size_type nl = text.find_first_of("\r\n", start);
2306
+ string::size_type newline = text.find_first_of("\r\n", start);
2410
2307
  string line;
2411
- if(nl != string::npos)
2308
+ if(newline != string::npos)
2412
2309
  {
2413
- line = text.substr(start, nl - start);
2414
- start = nl;
2310
+ line = text.substr(start, newline - start);
2311
+ start = newline;
2415
2312
  }
2416
2313
  else
2417
2314
  {
@@ -2419,6 +2316,15 @@ Slice::Python::CodeVisitor::stripMarkup(const string& comment)
2419
2316
  start = text.size();
2420
2317
  }
2421
2318
 
2319
+ //
2320
+ // Remove trailing whitespace
2321
+ //
2322
+ pos = line.find_last_not_of(" \t");
2323
+ if(pos != string::npos)
2324
+ {
2325
+ line.erase(pos + 1, line.size() - pos - 1);
2326
+ }
2327
+
2422
2328
  lines.push_back(line);
2423
2329
 
2424
2330
  start = text.find_first_not_of("\r\n", start);
@@ -2580,10 +2486,10 @@ Slice::Python::CodeVisitor::parseOpComment(const string& comment, OpComment& c)
2580
2486
  //
2581
2487
  string name;
2582
2488
  bool inParam = false, inException = false, inReturn = false;
2583
- vector<string>::size_type i = 0;
2584
- while(i < lines.size())
2489
+ vector<string>::iterator i = lines.begin();
2490
+ while(i != lines.end())
2585
2491
  {
2586
- string l = lines[i];
2492
+ string l = *i;
2587
2493
  string::size_type paramTag = l.find("@param");
2588
2494
  string::size_type throwTag = l.find("@throw");
2589
2495
  string::size_type returnTag = l.find("@return");
@@ -2627,7 +2533,7 @@ Slice::Python::CodeVisitor::parseOpComment(const string& comment, OpComment& c)
2627
2533
  }
2628
2534
  }
2629
2535
  }
2630
- lines.erase(lines.begin() + i);
2536
+ i = lines.erase(i);
2631
2537
  continue;
2632
2538
  }
2633
2539
  else if(throwTag != string::npos)
@@ -2669,7 +2575,7 @@ Slice::Python::CodeVisitor::parseOpComment(const string& comment, OpComment& c)
2669
2575
  }
2670
2576
  }
2671
2577
  }
2672
- lines.erase(lines.begin() + i);
2578
+ i = lines.erase(i);
2673
2579
  continue;
2674
2580
  }
2675
2581
  else if(returnTag != string::npos)
@@ -2686,7 +2592,7 @@ Slice::Python::CodeVisitor::parseOpComment(const string& comment, OpComment& c)
2686
2592
  inParam = false;
2687
2593
  c.returns = l.substr(pos);
2688
2594
  }
2689
- lines.erase(lines.begin() + i);
2595
+ i = lines.erase(i);
2690
2596
  continue;
2691
2597
  }
2692
2598
  else
@@ -2706,7 +2612,7 @@ Slice::Python::CodeVisitor::parseOpComment(const string& comment, OpComment& c)
2706
2612
  c.params[name] += " ";
2707
2613
  }
2708
2614
  c.params[name] += l.substr(pos);
2709
- lines.erase(lines.begin() + i);
2615
+ i = lines.erase(i);
2710
2616
  continue;
2711
2617
  }
2712
2618
  else if(inException)
@@ -2717,7 +2623,7 @@ Slice::Python::CodeVisitor::parseOpComment(const string& comment, OpComment& c)
2717
2623
  c.exceptions[name] += " ";
2718
2624
  }
2719
2625
  c.exceptions[name] += l.substr(pos);
2720
- lines.erase(lines.begin() + i);
2626
+ i = lines.erase(i);
2721
2627
  continue;
2722
2628
  }
2723
2629
  else if(inReturn)
@@ -2727,7 +2633,7 @@ Slice::Python::CodeVisitor::parseOpComment(const string& comment, OpComment& c)
2727
2633
  c.returns += " ";
2728
2634
  }
2729
2635
  c.returns += l.substr(pos);
2730
- lines.erase(lines.begin() + i);
2636
+ i = lines.erase(i);
2731
2637
  continue;
2732
2638
  }
2733
2639
  }
@@ -2781,7 +2687,7 @@ Slice::Python::CodeVisitor::writeDocstring(const OperationPtr& op, DocstringMode
2781
2687
  {
2782
2688
  return;
2783
2689
  }
2784
- else if(mode == DocAsyncBegin && inParams.empty())
2690
+ else if((mode == DocAsync || mode == DocAsyncBegin) && inParams.empty())
2785
2691
  {
2786
2692
  return;
2787
2693
  }
@@ -2814,6 +2720,7 @@ Slice::Python::CodeVisitor::writeDocstring(const OperationPtr& op, DocstringMode
2814
2720
  switch(mode)
2815
2721
  {
2816
2722
  case DocSync:
2723
+ case DocAsync:
2817
2724
  case DocAsyncBegin:
2818
2725
  case DocDispatch:
2819
2726
  needArgs = !local || !inParams.empty();
@@ -2827,10 +2734,6 @@ Slice::Python::CodeVisitor::writeDocstring(const OperationPtr& op, DocstringMode
2827
2734
  if(needArgs)
2828
2735
  {
2829
2736
  _out << nl << "Arguments:";
2830
- if(mode == DocAsyncDispatch)
2831
- {
2832
- _out << nl << "_cb -- The asynchronous callback object.";
2833
- }
2834
2737
  for(vector<string>::iterator q = inParams.begin(); q != inParams.end(); ++q)
2835
2738
  {
2836
2739
  string fixed = fixIdent(*q);
@@ -2851,13 +2754,15 @@ Slice::Python::CodeVisitor::writeDocstring(const OperationPtr& op, DocstringMode
2851
2754
  << nl << "_ex -- The asynchronous exception callback."
2852
2755
  << nl << "_sent -- The asynchronous sent callback.";
2853
2756
  }
2854
- if(!local && (mode == DocSync || mode == DocAsyncBegin))
2757
+ if(!local && (mode == DocSync || mode == DocAsync || mode == DocAsyncBegin))
2855
2758
  {
2856
- _out << nl << "_ctx -- The request context for the invocation.";
2759
+ const string contextParamName = getEscapedParamName(op, "context");
2760
+ _out << nl << contextParamName << " -- The request context for the invocation.";
2857
2761
  }
2858
2762
  if(!local && (mode == DocDispatch || mode == DocAsyncDispatch))
2859
2763
  {
2860
- _out << nl << "current -- The Current object for the invocation.";
2764
+ const string currentParamName = getEscapedParamName(op, "current");
2765
+ _out << nl << currentParamName << " -- The Current object for the invocation.";
2861
2766
  }
2862
2767
  }
2863
2768
  else if(mode == DocAsyncEnd)
@@ -2869,6 +2774,10 @@ Slice::Python::CodeVisitor::writeDocstring(const OperationPtr& op, DocstringMode
2869
2774
  //
2870
2775
  // Emit return value(s).
2871
2776
  //
2777
+ if(mode == DocAsync || mode == DocAsyncDispatch)
2778
+ {
2779
+ _out << nl << "Returns: A future object for the invocation.";
2780
+ }
2872
2781
  if(mode == DocAsyncBegin)
2873
2782
  {
2874
2783
  _out << nl << "Returns: An asynchronous result object for the invocation.";
@@ -2935,8 +2844,81 @@ Slice::Python::CodeVisitor::writeDocstring(const OperationPtr& op, DocstringMode
2935
2844
  _out << nl << "\"\"\"";
2936
2845
  }
2937
2846
 
2847
+ string
2848
+ Slice::Python::getPackageDirectory(const string& file, const UnitPtr& ut)
2849
+ {
2850
+ //
2851
+ // file must be a fully-qualified path name.
2852
+ //
2853
+
2854
+ //
2855
+ // Check if the file contains the python:pkgdir global metadata.
2856
+ //
2857
+ DefinitionContextPtr dc = ut->findDefinitionContext(file);
2858
+ assert(dc);
2859
+ const string prefix = "python:pkgdir:";
2860
+ string pkgdir = dc->findMetaData(prefix);
2861
+ if(!pkgdir.empty())
2862
+ {
2863
+ //
2864
+ // The metadata is present, so the generated file was placed in the specified directory.
2865
+ //
2866
+ pkgdir = pkgdir.substr(prefix.size());
2867
+ assert(!pkgdir.empty()); // This situation should have been caught by MetaDataVisitor.
2868
+ }
2869
+ return pkgdir;
2870
+ }
2871
+
2872
+ string
2873
+ Slice::Python::getImportFileName(const string& file, const UnitPtr& ut, const vector<string>& includePaths)
2874
+ {
2875
+ //
2876
+ // The file and includePaths arguments must be fully-qualified path names.
2877
+ //
2878
+
2879
+ //
2880
+ // Check if the file contains the python:pkgdir global metadata.
2881
+ //
2882
+ string pkgdir = getPackageDirectory(file, ut);
2883
+ if(!pkgdir.empty())
2884
+ {
2885
+ //
2886
+ // The metadata is present, so the generated file was placed in the specified directory.
2887
+ //
2888
+ vector<string> names;
2889
+ IceUtilInternal::splitString(pkgdir, "/", names);
2890
+ assert(!names.empty());
2891
+ pkgdir = "";
2892
+ for(vector<string>::iterator p = names.begin(); p != names.end(); ++p)
2893
+ {
2894
+ if(p != names.begin())
2895
+ {
2896
+ pkgdir += ".";
2897
+ }
2898
+ pkgdir += fixIdent(*p);
2899
+ }
2900
+ string::size_type pos = file.rfind('/');
2901
+ assert(pos != string::npos);
2902
+ string name = file.substr(pos + 1); // Get the name of the file without the leading path.
2903
+ assert(!name.empty());
2904
+ replace(name.begin(), name.end(), '.', '_'); // Convert .ice to _ice
2905
+ return pkgdir + "." + name;
2906
+ }
2907
+ else
2908
+ {
2909
+ //
2910
+ // The metadata is not present, so we transform the file name using the include paths (-I)
2911
+ // given to the compiler.
2912
+ //
2913
+ string name = changeInclude(file, includePaths);
2914
+ replace(name.begin(), name.end(), '/', '_');
2915
+ return name + "_ice";
2916
+ }
2917
+ }
2918
+
2938
2919
  void
2939
- Slice::Python::generate(const UnitPtr& un, bool all, bool checksum, const vector<string>& includePaths, Output& out)
2920
+ Slice::Python::generate(const UnitPtr& un, bool all, bool checksum, const vector<string>& includePaths,
2921
+ Output& out)
2940
2922
  {
2941
2923
  Slice::Python::MetaDataVisitor visitor;
2942
2924
  un->visit(&visitor, false);
@@ -2955,9 +2937,7 @@ Slice::Python::generate(const UnitPtr& un, bool all, bool checksum, const vector
2955
2937
  StringList includes = un->includeFiles();
2956
2938
  for(StringList::const_iterator q = includes.begin(); q != includes.end(); ++q)
2957
2939
  {
2958
- string file = changeInclude(*q, paths);
2959
- replace(file.begin(), file.end(), '/', '_');
2960
- out << nl << "import " << file << "_ice";
2940
+ out << nl << "import " << getImportFileName(*q, un, paths);
2961
2941
  }
2962
2942
  }
2963
2943
 
@@ -3031,18 +3011,51 @@ Slice::Python::fixIdent(const string& ident)
3031
3011
  string
3032
3012
  Slice::Python::getPackageMetadata(const ContainedPtr& cont)
3033
3013
  {
3034
- UnitPtr unit = cont->container()->unit();
3035
- string file = cont->file();
3036
- assert(!file.empty());
3014
+ //
3015
+ // Traverse to the top-level module.
3016
+ //
3017
+ ModulePtr m;
3018
+ ContainedPtr p = cont;
3019
+ while(true)
3020
+ {
3021
+ if(ModulePtr::dynamicCast(p))
3022
+ {
3023
+ m = ModulePtr::dynamicCast(p);
3024
+ }
3025
+
3026
+ ContainerPtr c = p->container();
3027
+ p = ContainedPtr::dynamicCast(c); // This cast fails for Unit.
3028
+ if(!p)
3029
+ {
3030
+ break;
3031
+ }
3032
+ }
3037
3033
 
3034
+ assert(m);
3035
+
3036
+ //
3037
+ // The python:package metadata can be defined as global metadata or applied to a top-level module.
3038
+ // We check for the metadata at the top-level module first and then fall back to the global scope.
3039
+ //
3038
3040
  static const string prefix = "python:package:";
3039
- DefinitionContextPtr dc = unit->findDefinitionContext(file);
3040
- assert(dc);
3041
- string q = dc->findMetaData(prefix);
3041
+
3042
+ string q;
3043
+ if(!m->findMetaData(prefix, q))
3044
+ {
3045
+ UnitPtr ut = cont->unit();
3046
+ string file = cont->file();
3047
+ assert(!file.empty());
3048
+
3049
+ DefinitionContextPtr dc = ut->findDefinitionContext(file);
3050
+ assert(dc);
3051
+ q = dc->findMetaData(prefix);
3052
+ }
3053
+
3042
3054
  if(!q.empty())
3043
3055
  {
3044
3056
  q = q.substr(prefix.size());
3045
3057
  }
3058
+
3046
3059
  return q;
3047
3060
  }
3048
3061
 
@@ -3064,28 +3077,16 @@ Slice::Python::getAbsolute(const ContainedPtr& cont, const string& suffix, const
3064
3077
  }
3065
3078
  }
3066
3079
 
3067
- if(suffix.empty())
3068
- {
3069
- return scope + fixIdent(cont->name() + nameSuffix);
3070
- }
3071
- else
3072
- {
3073
- return scope + suffix + fixIdent(cont->name() + nameSuffix);
3074
- }
3080
+ return scope + suffix + fixIdent(cont->name() + nameSuffix);
3075
3081
  }
3076
3082
 
3077
3083
  void
3078
3084
  Slice::Python::printHeader(IceUtilInternal::Output& out)
3079
3085
  {
3080
3086
  static const char* header =
3081
- "# **********************************************************************\n"
3082
3087
  "#\n"
3083
- "# Copyright (c) 2003-2018 ZeroC, Inc. All rights reserved.\n"
3088
+ "# Copyright (c) ZeroC, Inc. All rights reserved.\n"
3084
3089
  "#\n"
3085
- "# This copy of Ice is licensed to you under the terms described in the\n"
3086
- "# ICE_LICENSE file included in this distribution.\n"
3087
- "#\n"
3088
- "# **********************************************************************\n"
3089
3090
  ;
3090
3091
 
3091
3092
  out << header;
@@ -3103,30 +3104,33 @@ Slice::Python::MetaDataVisitor::visitUnitStart(const UnitPtr& p)
3103
3104
  // Validate global metadata in the top-level file and all included files.
3104
3105
  //
3105
3106
  StringList files = p->allFiles();
3106
-
3107
3107
  for(StringList::iterator q = files.begin(); q != files.end(); ++q)
3108
3108
  {
3109
3109
  string file = *q;
3110
3110
  DefinitionContextPtr dc = p->findDefinitionContext(file);
3111
3111
  assert(dc);
3112
3112
  StringList globalMetaData = dc->getMetaData();
3113
- for(StringList::const_iterator r = globalMetaData.begin(); r != globalMetaData.end(); ++r)
3113
+ for(StringList::const_iterator r = globalMetaData.begin(); r != globalMetaData.end();)
3114
3114
  {
3115
- string s = *r;
3116
- if(_history.count(s) == 0)
3115
+ string s = *r++;
3116
+ if(s.find(prefix) == 0)
3117
3117
  {
3118
- _history.insert(s);
3119
- if(s.find(prefix) == 0)
3118
+ static const string packagePrefix = "python:package:";
3119
+ if(s.find(packagePrefix) == 0 && s.size() > packagePrefix.size())
3120
3120
  {
3121
- static const string packagePrefix = "python:package:";
3122
- if(s.find(packagePrefix) == 0 && s.size() > packagePrefix.size())
3123
- {
3124
- continue;
3125
- }
3126
- emitWarning(file, "", "ignoring invalid global metadata `" + s + "'");
3121
+ continue;
3122
+ }
3123
+ static const string pkgdirPrefix = "python:pkgdir:";
3124
+ if(s.find(pkgdirPrefix) == 0 && s.size() > pkgdirPrefix.size())
3125
+ {
3126
+ continue;
3127
3127
  }
3128
+
3129
+ dc->warning(InvalidMetaData, file, "", "ignoring invalid global metadata `" + s + "'");
3130
+ globalMetaData.remove(s);
3128
3131
  }
3129
3132
  }
3133
+ dc->setMetaData(globalMetaData);
3130
3134
  }
3131
3135
  return true;
3132
3136
  }
@@ -3134,7 +3138,31 @@ Slice::Python::MetaDataVisitor::visitUnitStart(const UnitPtr& p)
3134
3138
  bool
3135
3139
  Slice::Python::MetaDataVisitor::visitModuleStart(const ModulePtr& p)
3136
3140
  {
3137
- reject(p);
3141
+ static const string prefix = "python:package:";
3142
+
3143
+ StringList metaData = p->getMetaData();
3144
+ for(StringList::const_iterator r = metaData.begin(); r != metaData.end();)
3145
+ {
3146
+ string s = *r++;
3147
+ if(s.find(prefix) == 0)
3148
+ {
3149
+ //
3150
+ // Must be a top-level module.
3151
+ //
3152
+ if(UnitPtr::dynamicCast(p->container()))
3153
+ {
3154
+ continue;
3155
+ }
3156
+ }
3157
+
3158
+ if(s.find("python:") == 0)
3159
+ {
3160
+ p->definitionContext()->warning(InvalidMetaData, p->file(), "", "ignoring invalid metadata `" + s + "'");
3161
+ metaData.remove(s);
3162
+ }
3163
+ }
3164
+
3165
+ p->setMetaData(metaData);
3138
3166
  return true;
3139
3167
  }
3140
3168
 
@@ -3194,6 +3222,11 @@ Slice::Python::MetaDataVisitor::visitSequence(const SequencePtr& p)
3194
3222
  StringList metaData = p->getMetaData();
3195
3223
  const string file = p->file();
3196
3224
  const string line = p->line();
3225
+ StringList protobufMetaData;
3226
+ const UnitPtr ut = p->unit();
3227
+ const DefinitionContextPtr dc = ut->findDefinitionContext(file);
3228
+ assert(dc);
3229
+
3197
3230
  for(StringList::const_iterator q = metaData.begin(); q != metaData.end(); )
3198
3231
  {
3199
3232
  string s = *q++;
@@ -3203,17 +3236,22 @@ Slice::Python::MetaDataVisitor::visitSequence(const SequencePtr& p)
3203
3236
  // Remove from list so validateSequence does not try to handle as well.
3204
3237
  //
3205
3238
  metaData.remove(s);
3206
-
3207
3239
  BuiltinPtr builtin = BuiltinPtr::dynamicCast(p->type());
3208
3240
  if(!builtin || builtin->kind() != Builtin::KindByte)
3209
3241
  {
3210
- emitWarning(file, line, "ignoring invalid metadata `" + s + ": " +
3242
+ dc->warning(InvalidMetaData, file, line, "ignoring invalid metadata `" + s + ": " +
3211
3243
  "`protobuf' encoding must be a byte sequence");
3212
3244
  }
3245
+ else
3246
+ {
3247
+ protobufMetaData.push_back(s);
3248
+ }
3213
3249
  }
3214
3250
  }
3215
3251
 
3216
- validateSequence(file, line, p, metaData);
3252
+ metaData = validateSequence(file, line, p, metaData);
3253
+ metaData.insert(metaData.end(), protobufMetaData.begin(), protobufMetaData.end());
3254
+ p->setMetaData(metaData);
3217
3255
  }
3218
3256
 
3219
3257
  void
@@ -3234,33 +3272,75 @@ Slice::Python::MetaDataVisitor::visitConst(const ConstPtr& p)
3234
3272
  reject(p);
3235
3273
  }
3236
3274
 
3237
- void
3275
+ StringList
3238
3276
  Slice::Python::MetaDataVisitor::validateSequence(const string& file, const string& line,
3239
- const TypePtr& type, const StringList& meta)
3277
+ const TypePtr& type, const StringList& metaData)
3240
3278
  {
3241
- static const string prefix = "python:";
3279
+ const UnitPtr ut = type->unit();
3280
+ const DefinitionContextPtr dc = ut->findDefinitionContext(file);
3281
+ assert(dc);
3242
3282
 
3243
- for(StringList::const_iterator p = meta.begin(); p != meta.end(); ++p)
3283
+ static const string prefix = "python:";
3284
+ StringList newMetaData = metaData;
3285
+ for(StringList::const_iterator p = newMetaData.begin(); p != newMetaData.end();)
3244
3286
  {
3245
- string s = *p;
3287
+ string s = *p++;
3246
3288
  if(s.find(prefix) == 0)
3247
3289
  {
3248
- string::size_type pos = s.find(':', prefix.size());
3249
- if(pos != string::npos && s.substr(prefix.size(), pos - prefix.size()) == "seq")
3290
+ SequencePtr seq = SequencePtr::dynamicCast(type);
3291
+ if(seq)
3250
3292
  {
3251
3293
  static const string seqPrefix = "python:seq:";
3252
- string arg = s.substr(seqPrefix.size(), pos - seqPrefix.size());
3253
- if(SequencePtr::dynamicCast(type))
3294
+ if(s.find(seqPrefix) == 0)
3295
+ {
3296
+ string arg = s.substr(seqPrefix.size());
3297
+ if(arg == "tuple" || arg == "list" || arg == "default")
3298
+ {
3299
+ continue;
3300
+ }
3301
+ }
3302
+ else if(s.size() > prefix.size())
3254
3303
  {
3304
+ string arg = s.substr(prefix.size());
3255
3305
  if(arg == "tuple" || arg == "list" || arg == "default")
3256
3306
  {
3257
3307
  continue;
3258
3308
  }
3309
+ else if(arg == "array.array" || arg == "numpy.ndarray" || arg.find("memoryview:") == 0)
3310
+ {
3311
+ //
3312
+ // The memoryview sequence metadata is only valid for integral builtin
3313
+ // types excluding strings.
3314
+ //
3315
+ BuiltinPtr builtin = BuiltinPtr::dynamicCast(seq->type());
3316
+ if(builtin)
3317
+ {
3318
+ switch(builtin->kind())
3319
+ {
3320
+ case Builtin::KindBool:
3321
+ case Builtin::KindByte:
3322
+ case Builtin::KindShort:
3323
+ case Builtin::KindInt:
3324
+ case Builtin::KindLong:
3325
+ case Builtin::KindFloat:
3326
+ case Builtin::KindDouble:
3327
+ {
3328
+ continue;
3329
+ }
3330
+ default:
3331
+ {
3332
+ break;
3333
+ }
3334
+ }
3335
+ }
3336
+ }
3259
3337
  }
3260
3338
  }
3261
- emitWarning(file, line, "ignoring invalid metadata `" + s + "'");
3339
+ dc->warning(InvalidMetaData, file, line, "ignoring invalid metadata `" + s + "'");
3340
+ newMetaData.remove(s);
3262
3341
  }
3263
3342
  }
3343
+ return newMetaData;
3264
3344
  }
3265
3345
 
3266
3346
  void
@@ -3268,11 +3348,19 @@ Slice::Python::MetaDataVisitor::reject(const ContainedPtr& cont)
3268
3348
  {
3269
3349
  StringList localMetaData = cont->getMetaData();
3270
3350
  static const string prefix = "python:";
3271
- for(StringList::const_iterator p = localMetaData.begin(); p != localMetaData.end(); ++p)
3351
+
3352
+ const UnitPtr ut = cont->unit();
3353
+ const DefinitionContextPtr dc = ut->findDefinitionContext(cont->file());
3354
+ assert(dc);
3355
+
3356
+ for(StringList::const_iterator p = localMetaData.begin(); p != localMetaData.end();)
3272
3357
  {
3273
- if(p->find(prefix) == 0)
3358
+ string s = *p++;
3359
+ if(s.find(prefix) == 0)
3274
3360
  {
3275
- emitWarning(cont->file(), cont->line(), "ignoring invalid metadata `" + *p + "'");
3361
+ dc->warning(InvalidMetaData, cont->file(), cont->line(), "ignoring invalid metadata `" + s + "'");
3362
+ localMetaData.remove(s);
3276
3363
  }
3277
3364
  }
3365
+ cont->setMetaData(localMetaData);
3278
3366
  }