zeroc-ice 3.6.5 → 3.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (752) hide show
  1. checksums.yaml +4 -4
  2. data/BZIP2_LICENSE +42 -0
  3. data/ICE_LICENSE +17 -17
  4. data/LICENSE +12 -12
  5. data/bin/slice2rb +1 -1
  6. data/ext/Communicator.cpp +150 -53
  7. data/ext/Communicator.h +1 -1
  8. data/ext/Config.h +2 -12
  9. data/ext/Connection.cpp +89 -68
  10. data/ext/Connection.h +1 -1
  11. data/ext/Endpoint.cpp +16 -45
  12. data/ext/Endpoint.h +1 -1
  13. data/ext/ImplicitContext.cpp +1 -5
  14. data/ext/ImplicitContext.h +1 -1
  15. data/ext/Init.cpp +4 -1
  16. data/ext/Logger.cpp +1 -1
  17. data/ext/Logger.h +1 -1
  18. data/ext/Operation.cpp +33 -44
  19. data/ext/Operation.h +1 -1
  20. data/ext/Properties.cpp +1 -1
  21. data/ext/Properties.h +1 -1
  22. data/ext/Proxy.cpp +22 -57
  23. data/ext/Proxy.h +1 -1
  24. data/ext/Slice.cpp +5 -5
  25. data/ext/Slice.h +1 -1
  26. data/ext/Types.cpp +244 -171
  27. data/ext/Types.h +118 -66
  28. data/ext/Util.cpp +13 -9
  29. data/ext/Util.h +10 -10
  30. data/ext/ValueFactoryManager.cpp +445 -0
  31. data/ext/ValueFactoryManager.h +100 -0
  32. data/ext/extconf.rb +47 -45
  33. data/ext/ice/bzip2/blocksort.c +1094 -0
  34. data/ext/ice/bzip2/bzlib.c +1572 -0
  35. data/ext/ice/bzip2/bzlib.h +282 -0
  36. data/ext/ice/bzip2/bzlib_private.h +509 -0
  37. data/ext/ice/bzip2/compress.c +672 -0
  38. data/ext/ice/bzip2/crctable.c +104 -0
  39. data/ext/ice/bzip2/decompress.c +646 -0
  40. data/ext/ice/bzip2/huffman.c +205 -0
  41. data/ext/ice/bzip2/randtable.c +84 -0
  42. data/ext/ice/cpp/include/Ice/Application.h +77 -60
  43. data/ext/ice/cpp/include/Ice/AsyncResult.h +34 -318
  44. data/ext/ice/cpp/include/Ice/AsyncResultF.h +4 -2
  45. data/ext/ice/cpp/include/Ice/BatchRequestInterceptor.h +5 -10
  46. data/ext/ice/cpp/include/Ice/BatchRequestQueueF.h +1 -1
  47. data/ext/ice/cpp/include/Ice/Buffer.h +10 -10
  48. data/ext/ice/cpp/include/Ice/CommunicatorAsync.h +14 -12
  49. data/ext/ice/cpp/include/Ice/Comparable.h +130 -0
  50. data/ext/ice/cpp/include/Ice/Config.h +7 -36
  51. data/ext/ice/cpp/include/Ice/ConnectionAsync.h +107 -11
  52. data/ext/ice/cpp/include/Ice/ConnectionIF.h +5 -1
  53. data/ext/ice/cpp/include/Ice/ConsoleUtil.h +28 -0
  54. data/ext/ice/cpp/include/Ice/{DefaultObjectFactory.h → DefaultValueFactory.h} +28 -14
  55. data/ext/ice/cpp/include/Ice/DispatchInterceptor.h +4 -6
  56. data/ext/ice/cpp/include/Ice/Dispatcher.h +14 -13
  57. data/ext/ice/cpp/include/Ice/DynamicLibrary.h +7 -5
  58. data/ext/ice/cpp/include/Ice/DynamicLibraryF.h +1 -1
  59. data/ext/ice/cpp/include/Ice/Exception.h +66 -56
  60. data/ext/ice/cpp/include/Ice/ExceptionHelpers.h +69 -0
  61. data/ext/ice/cpp/include/Ice/FactoryTable.h +11 -12
  62. data/ext/ice/cpp/include/Ice/FactoryTableInit.h +27 -25
  63. data/ext/ice/cpp/include/Ice/Format.h +6 -1
  64. data/ext/ice/cpp/include/Ice/Functional.h +33 -33
  65. data/ext/ice/cpp/include/Ice/GCObject.h +9 -5
  66. data/ext/ice/cpp/include/Ice/Handle.h +6 -11
  67. data/ext/ice/cpp/include/Ice/Ice.h +9 -5
  68. data/ext/ice/cpp/include/{IceUtil → Ice}/IconvStringConverter.h +108 -62
  69. data/ext/ice/cpp/include/Ice/Incoming.h +109 -33
  70. data/ext/ice/cpp/include/Ice/IncomingAsync.h +63 -23
  71. data/ext/ice/cpp/include/Ice/IncomingAsyncF.h +7 -1
  72. data/ext/ice/cpp/include/Ice/Initialize.h +178 -38
  73. data/ext/ice/cpp/include/Ice/InputStream.h +994 -0
  74. data/ext/ice/cpp/include/Ice/InstanceF.h +1 -2
  75. data/ext/ice/cpp/include/Ice/InterfaceByValue.h +46 -0
  76. data/ext/ice/cpp/include/Ice/LocalObject.h +9 -9
  77. data/ext/ice/cpp/include/Ice/LocalObjectF.h +1 -1
  78. data/ext/ice/cpp/include/Ice/LoggerUtil.h +20 -14
  79. data/ext/ice/cpp/include/Ice/MetricsAdminI.h +114 -65
  80. data/ext/ice/cpp/include/Ice/MetricsFunctional.h +23 -5
  81. data/ext/ice/cpp/include/Ice/MetricsObserverI.h +99 -26
  82. data/ext/ice/cpp/include/Ice/NativePropertiesAdmin.h +17 -4
  83. data/ext/ice/cpp/include/Ice/Object.h +105 -56
  84. data/ext/ice/cpp/include/Ice/ObjectF.h +8 -3
  85. data/ext/ice/cpp/include/Ice/ObserverHelper.h +18 -8
  86. data/ext/ice/cpp/include/Ice/Optional.h +1084 -0
  87. data/ext/ice/cpp/include/Ice/OutgoingAsync.h +655 -84
  88. data/ext/ice/cpp/include/Ice/OutgoingAsyncF.h +12 -6
  89. data/ext/ice/cpp/include/Ice/OutputStream.h +753 -0
  90. data/ext/ice/cpp/include/Ice/Protocol.h +19 -12
  91. data/ext/ice/cpp/include/Ice/Proxy.h +1329 -717
  92. data/ext/ice/cpp/include/Ice/ProxyF.h +11 -33
  93. data/ext/ice/cpp/include/Ice/ProxyFactoryF.h +1 -1
  94. data/ext/ice/cpp/include/Ice/ProxyHandle.h +34 -50
  95. data/ext/ice/cpp/include/Ice/ReferenceF.h +1 -1
  96. data/ext/ice/cpp/include/Ice/RegisterPlugins.h +22 -3
  97. data/ext/ice/cpp/include/Ice/RequestHandlerF.h +10 -4
  98. data/ext/ice/cpp/include/Ice/ResponseHandlerF.h +6 -1
  99. data/ext/ice/cpp/include/{IceUtil → Ice}/SHA1.h +16 -16
  100. data/ext/ice/cpp/include/Ice/ServantManagerF.h +1 -1
  101. data/ext/ice/cpp/include/Ice/Service.h +13 -18
  102. data/ext/ice/cpp/include/Ice/SliceChecksums.h +1 -1
  103. data/ext/ice/cpp/include/Ice/SlicedData.h +46 -20
  104. data/ext/ice/cpp/include/Ice/SlicedDataF.h +14 -6
  105. data/ext/ice/cpp/include/Ice/StreamHelpers.h +159 -49
  106. data/ext/ice/cpp/include/Ice/StringConverter.h +52 -0
  107. data/ext/ice/cpp/include/Ice/ThreadPoolF.h +1 -1
  108. data/{slice/Ice/ObjectFactoryF.ice → ext/ice/cpp/include/Ice/UUID.h} +9 -7
  109. data/ext/ice/cpp/include/{IceUtil → Ice}/UniquePtr.h +21 -22
  110. data/ext/ice/cpp/include/Ice/UniqueRef.h +98 -0
  111. data/ext/ice/cpp/include/Ice/UserExceptionFactory.h +40 -8
  112. data/ext/ice/cpp/include/Ice/Value.h +104 -0
  113. data/{slice/Freeze/ConnectionF.ice → ext/ice/cpp/include/Ice/ValueF.h} +11 -7
  114. data/ext/ice/cpp/include/IceSSL/Config.h +8 -23
  115. data/ext/ice/cpp/include/IceSSL/IceSSL.h +17 -6
  116. data/ext/ice/cpp/include/IceSSL/OpenSSL.h +130 -0
  117. data/ext/ice/cpp/include/IceSSL/Plugin.h +172 -259
  118. data/ext/ice/cpp/include/IceSSL/SChannel.h +66 -0
  119. data/ext/ice/cpp/include/IceSSL/SecureTransport.h +66 -0
  120. data/ext/ice/cpp/include/IceSSL/UWP.h +58 -0
  121. data/ext/ice/cpp/include/IceUtil/Atomic.h +8 -10
  122. data/ext/ice/cpp/include/IceUtil/Cond.h +17 -18
  123. data/ext/ice/cpp/include/IceUtil/Config.h +138 -39
  124. data/ext/ice/cpp/include/IceUtil/ConsoleUtil.h +97 -0
  125. data/ext/ice/cpp/include/IceUtil/CountDownLatch.h +5 -5
  126. data/ext/ice/cpp/include/IceUtil/CtrlCHandler.h +23 -17
  127. data/ext/ice/cpp/include/IceUtil/DisableWarnings.h +1 -3
  128. data/ext/ice/cpp/include/IceUtil/Exception.h +157 -67
  129. data/ext/ice/cpp/include/IceUtil/FileUtil.h +148 -0
  130. data/ext/ice/cpp/include/IceUtil/Functional.h +1 -2
  131. data/ext/ice/cpp/include/IceUtil/Handle.h +11 -11
  132. data/ext/ice/cpp/include/IceUtil/IceUtil.h +4 -10
  133. data/ext/ice/cpp/include/IceUtil/InputUtil.h +3 -3
  134. data/ext/ice/cpp/include/IceUtil/Iterator.h +2 -2
  135. data/ext/ice/cpp/include/IceUtil/Lock.h +8 -10
  136. data/ext/ice/cpp/include/IceUtil/Monitor.h +1 -2
  137. data/ext/ice/cpp/include/IceUtil/Mutex.h +17 -11
  138. data/ext/ice/cpp/include/IceUtil/MutexProtocol.h +2 -2
  139. data/ext/ice/cpp/include/IceUtil/MutexPtrLock.h +4 -4
  140. data/ext/ice/cpp/include/IceUtil/MutexPtrTryLock.h +4 -4
  141. data/ext/ice/cpp/include/IceUtil/Optional.h +32 -18
  142. data/ext/ice/cpp/include/IceUtil/Options.h +17 -18
  143. data/ext/ice/cpp/include/IceUtil/OutputUtil.h +55 -29
  144. data/ext/ice/cpp/include/IceUtil/PopDisableWarnings.h +6 -6
  145. data/ext/ice/cpp/include/IceUtil/PushDisableWarnings.h +11 -10
  146. data/ext/ice/cpp/include/IceUtil/Random.h +3 -3
  147. data/ext/ice/cpp/include/IceUtil/RecMutex.h +7 -8
  148. data/ext/ice/cpp/include/IceUtil/ResourceConfig.h +58 -0
  149. data/ext/ice/cpp/include/IceUtil/ScannerConfig.h +1 -9
  150. data/ext/ice/cpp/include/IceUtil/ScopedArray.h +8 -2
  151. data/ext/ice/cpp/include/IceUtil/Shared.h +5 -7
  152. data/ext/ice/cpp/{src → include}/IceUtil/StopWatch.h +2 -2
  153. data/ext/ice/cpp/include/IceUtil/StringConverter.h +77 -72
  154. data/ext/ice/cpp/include/IceUtil/StringUtil.h +32 -21
  155. data/ext/ice/cpp/include/IceUtil/Thread.h +10 -12
  156. data/ext/ice/cpp/include/IceUtil/ThreadException.h +33 -42
  157. data/ext/ice/cpp/include/IceUtil/Time.h +3 -3
  158. data/ext/ice/cpp/include/IceUtil/Timer.h +14 -13
  159. data/ext/ice/cpp/include/IceUtil/UUID.h +2 -2
  160. data/ext/ice/cpp/include/IceUtil/UndefSysMacros.h +1 -1
  161. data/ext/ice/cpp/include/{Ice → generated/Ice}/BuiltinSequences.h +41 -8
  162. data/ext/ice/cpp/include/generated/Ice/Communicator.h +364 -0
  163. data/ext/ice/cpp/include/{Ice → generated/Ice}/CommunicatorF.h +40 -8
  164. data/ext/ice/cpp/include/generated/Ice/Connection.h +872 -0
  165. data/ext/ice/cpp/include/{Ice → generated/Ice}/ConnectionF.h +46 -8
  166. data/ext/ice/cpp/include/{Ice → generated/Ice}/Current.h +71 -8
  167. data/ext/ice/cpp/include/generated/Ice/Endpoint.h +582 -0
  168. data/ext/ice/cpp/include/{Ice → generated/Ice}/EndpointF.h +62 -8
  169. data/ext/ice/cpp/include/{Ice → generated/Ice}/EndpointTypes.h +31 -16
  170. data/ext/ice/cpp/include/{Ice → generated/Ice}/FacetMap.h +23 -8
  171. data/ext/ice/cpp/include/generated/Ice/Identity.h +221 -0
  172. data/ext/ice/cpp/include/{Ice → generated/Ice}/ImplicitContext.h +72 -13
  173. data/ext/ice/cpp/include/{Ice → generated/Ice}/ImplicitContextF.h +40 -8
  174. data/ext/ice/cpp/include/generated/Ice/Instrumentation.h +602 -0
  175. data/ext/ice/cpp/include/{Ice → generated/Ice}/InstrumentationF.h +54 -8
  176. data/ext/ice/cpp/include/generated/Ice/LocalException.h +2802 -0
  177. data/ext/ice/cpp/include/generated/Ice/Locator.h +2036 -0
  178. data/ext/ice/cpp/include/{Ice → generated/Ice}/LocatorF.h +53 -12
  179. data/ext/ice/cpp/include/{Ice → generated/Ice}/Logger.h +71 -13
  180. data/ext/ice/cpp/include/{Ice → generated/Ice}/LoggerF.h +40 -8
  181. data/ext/ice/cpp/include/generated/Ice/Metrics.h +2649 -0
  182. data/ext/ice/cpp/include/generated/Ice/ObjectAdapter.h +302 -0
  183. data/ext/ice/cpp/include/{Ice → generated/Ice}/ObjectAdapterF.h +40 -8
  184. data/ext/ice/cpp/include/generated/Ice/ObjectFactory.h +142 -0
  185. data/ext/ice/cpp/include/generated/Ice/Plugin.h +197 -0
  186. data/ext/ice/cpp/include/{Ice → generated/Ice}/PluginF.h +43 -8
  187. data/ext/ice/cpp/include/generated/Ice/Process.h +536 -0
  188. data/ext/ice/cpp/include/{Ice → generated/Ice}/ProcessF.h +45 -10
  189. data/ext/ice/cpp/include/{Ice → generated/Ice}/Properties.h +88 -21
  190. data/ext/ice/cpp/include/generated/Ice/PropertiesAdmin.h +749 -0
  191. data/ext/ice/cpp/include/{Ice → generated/Ice}/PropertiesF.h +48 -10
  192. data/ext/ice/cpp/include/generated/Ice/RemoteLogger.h +1449 -0
  193. data/ext/ice/cpp/include/generated/Ice/Router.h +1032 -0
  194. data/ext/ice/cpp/include/{Ice → generated/Ice}/RouterF.h +45 -10
  195. data/ext/ice/cpp/include/{Ice → generated/Ice}/ServantLocator.h +65 -13
  196. data/ext/ice/cpp/include/{Ice → generated/Ice}/ServantLocatorF.h +40 -8
  197. data/ext/ice/cpp/include/{Ice → generated/Ice}/SliceChecksumDict.h +23 -8
  198. data/ext/ice/cpp/include/generated/Ice/ValueFactory.h +169 -0
  199. data/ext/ice/cpp/include/generated/Ice/Version.h +334 -0
  200. data/ext/ice/cpp/include/generated/IceSSL/ConnectionInfo.h +172 -0
  201. data/ext/ice/cpp/include/generated/IceSSL/ConnectionInfoF.h +98 -0
  202. data/ext/ice/cpp/include/generated/IceSSL/EndpointInfo.h +156 -0
  203. data/ext/ice/cpp/src/Ice/ACM.cpp +18 -14
  204. data/ext/ice/cpp/src/Ice/ACM.h +9 -2
  205. data/ext/ice/cpp/{include → src}/Ice/ACMF.h +10 -5
  206. data/ext/ice/cpp/src/Ice/Acceptor.cpp +6 -1
  207. data/ext/ice/cpp/src/Ice/Acceptor.h +4 -3
  208. data/ext/ice/cpp/src/Ice/AcceptorF.h +1 -1
  209. data/ext/ice/cpp/src/{IceUtil → Ice}/ArgVector.cpp +9 -9
  210. data/ext/ice/cpp/src/{IceUtil → Ice}/ArgVector.h +7 -7
  211. data/ext/ice/cpp/src/Ice/AsyncResult.cpp +15 -538
  212. data/ext/ice/cpp/src/Ice/Base64.cpp +11 -11
  213. data/ext/ice/cpp/src/Ice/Base64.h +1 -1
  214. data/ext/ice/cpp/src/Ice/BatchRequestQueue.cpp +40 -12
  215. data/ext/ice/cpp/src/Ice/BatchRequestQueue.h +15 -10
  216. data/ext/ice/cpp/src/Ice/Buffer.cpp +74 -12
  217. data/ext/ice/cpp/src/Ice/BuiltinSequences.cpp +20 -6
  218. data/ext/ice/cpp/src/Ice/CollocatedRequestHandler.cpp +85 -190
  219. data/ext/ice/cpp/src/Ice/CollocatedRequestHandler.h +17 -18
  220. data/ext/ice/cpp/src/Ice/Communicator.cpp +39 -8
  221. data/ext/ice/cpp/src/Ice/CommunicatorF.cpp +27 -5
  222. data/ext/ice/cpp/src/Ice/CommunicatorI.cpp +271 -104
  223. data/ext/ice/cpp/src/Ice/CommunicatorI.h +84 -28
  224. data/ext/ice/cpp/src/{IceUtil → Ice}/Cond.cpp +3 -3
  225. data/ext/ice/cpp/src/Ice/ConnectRequestHandler.cpp +58 -125
  226. data/ext/ice/cpp/src/Ice/ConnectRequestHandler.h +11 -22
  227. data/ext/ice/cpp/src/Ice/ConnectRequestHandlerF.h +6 -2
  228. data/ext/ice/cpp/src/Ice/Connection.cpp +88 -8
  229. data/ext/ice/cpp/src/Ice/ConnectionF.cpp +27 -5
  230. data/ext/ice/cpp/src/Ice/ConnectionFactory.cpp +158 -80
  231. data/ext/ice/cpp/src/Ice/ConnectionFactory.h +41 -23
  232. data/ext/ice/cpp/{include → src}/Ice/ConnectionFactoryF.h +8 -3
  233. data/ext/ice/cpp/src/Ice/ConnectionI.cpp +707 -653
  234. data/ext/ice/cpp/src/Ice/ConnectionI.h +97 -69
  235. data/ext/ice/cpp/src/Ice/ConnectionRequestHandler.cpp +2 -15
  236. data/ext/ice/cpp/src/Ice/ConnectionRequestHandler.h +4 -3
  237. data/ext/ice/cpp/src/Ice/Connector.cpp +6 -1
  238. data/ext/ice/cpp/src/Ice/Connector.h +4 -3
  239. data/ext/ice/cpp/src/Ice/ConnectorF.h +1 -1
  240. data/ext/ice/cpp/src/{IceUtil → Ice}/CountDownLatch.cpp +4 -4
  241. data/ext/ice/cpp/src/Ice/Current.cpp +29 -6
  242. data/ext/ice/cpp/src/Ice/DefaultsAndOverrides.cpp +6 -5
  243. data/ext/ice/cpp/src/Ice/DefaultsAndOverrides.h +1 -1
  244. data/ext/ice/cpp/src/Ice/DefaultsAndOverridesF.h +1 -1
  245. data/ext/ice/cpp/src/Ice/DispatchInterceptor.cpp +5 -25
  246. data/ext/ice/cpp/src/Ice/DynamicLibrary.cpp +29 -19
  247. data/ext/ice/cpp/src/Ice/Endpoint.cpp +85 -6
  248. data/ext/ice/cpp/src/Ice/EndpointF.cpp +27 -5
  249. data/ext/ice/cpp/src/Ice/EndpointFactory.cpp +152 -1
  250. data/ext/ice/cpp/src/Ice/EndpointFactory.h +72 -6
  251. data/ext/ice/cpp/src/Ice/EndpointFactoryF.h +1 -1
  252. data/ext/ice/cpp/src/Ice/EndpointFactoryManager.cpp +35 -19
  253. data/ext/ice/cpp/src/Ice/EndpointFactoryManager.h +10 -4
  254. data/ext/ice/cpp/src/Ice/EndpointFactoryManagerF.h +1 -1
  255. data/ext/ice/cpp/src/Ice/EndpointI.cpp +17 -1
  256. data/ext/ice/cpp/src/Ice/EndpointI.h +35 -9
  257. data/ext/ice/cpp/src/Ice/EndpointIF.h +18 -5
  258. data/ext/ice/cpp/src/Ice/EndpointTypes.cpp +18 -6
  259. data/ext/ice/cpp/src/Ice/EventHandler.cpp +6 -4
  260. data/ext/ice/cpp/src/Ice/EventHandler.h +13 -8
  261. data/ext/ice/cpp/src/Ice/EventHandlerF.h +5 -2
  262. data/ext/ice/cpp/src/Ice/Exception.cpp +95 -86
  263. data/ext/ice/cpp/src/Ice/FacetMap.cpp +20 -6
  264. data/ext/ice/cpp/src/Ice/FactoryTable.cpp +37 -28
  265. data/ext/ice/cpp/src/Ice/FactoryTableInit.cpp +2 -4
  266. data/ext/ice/cpp/src/Ice/GCObject.cpp +28 -25
  267. data/ext/ice/cpp/src/Ice/HashUtil.h +2 -3
  268. data/ext/ice/cpp/src/Ice/HttpParser.cpp +1 -2
  269. data/ext/ice/cpp/src/Ice/HttpParser.h +1 -1
  270. data/ext/ice/cpp/src/Ice/IPEndpointI.cpp +92 -53
  271. data/ext/ice/cpp/src/Ice/IPEndpointI.h +19 -10
  272. data/ext/ice/cpp/src/Ice/IPEndpointIF.h +6 -2
  273. data/ext/ice/cpp/src/Ice/IconvStringConverter.cpp +56 -0
  274. data/ext/ice/cpp/src/Ice/Identity.cpp +24 -10
  275. data/ext/ice/cpp/src/Ice/ImplicitContext.cpp +37 -6
  276. data/ext/ice/cpp/src/Ice/ImplicitContextF.cpp +27 -5
  277. data/ext/ice/cpp/src/Ice/ImplicitContextI.cpp +14 -14
  278. data/ext/ice/cpp/src/Ice/ImplicitContextI.h +7 -5
  279. data/ext/ice/cpp/src/Ice/Incoming.cpp +276 -245
  280. data/ext/ice/cpp/src/Ice/IncomingAsync.cpp +104 -209
  281. data/ext/ice/cpp/src/Ice/IncomingRequest.h +5 -4
  282. data/ext/ice/cpp/src/Ice/Initialize.cpp +299 -172
  283. data/ext/ice/cpp/src/Ice/InputStream.cpp +2773 -0
  284. data/ext/ice/cpp/src/Ice/Instance.cpp +191 -231
  285. data/ext/ice/cpp/src/Ice/Instance.h +30 -18
  286. data/ext/ice/cpp/src/Ice/Instrumentation.cpp +106 -7
  287. data/ext/ice/cpp/src/Ice/InstrumentationF.cpp +27 -5
  288. data/ext/ice/cpp/src/Ice/InstrumentationI.cpp +117 -99
  289. data/ext/ice/cpp/src/Ice/InstrumentationI.h +30 -31
  290. data/ext/ice/cpp/src/Ice/LocalException.cpp +1190 -416
  291. data/ext/ice/cpp/src/Ice/LocalObject.cpp +1 -2
  292. data/ext/ice/cpp/src/Ice/Locator.cpp +1167 -1215
  293. data/ext/ice/cpp/src/Ice/LocatorF.cpp +29 -6
  294. data/ext/ice/cpp/src/Ice/LocatorInfo.cpp +129 -163
  295. data/ext/ice/cpp/src/Ice/LocatorInfo.h +29 -29
  296. data/ext/ice/cpp/src/Ice/LocatorInfoF.h +1 -1
  297. data/ext/ice/cpp/src/Ice/Logger.cpp +35 -5
  298. data/ext/ice/cpp/src/Ice/LoggerAdminI.cpp +178 -73
  299. data/ext/ice/cpp/src/Ice/LoggerAdminI.h +4 -4
  300. data/ext/ice/cpp/src/Ice/LoggerF.cpp +27 -5
  301. data/ext/ice/cpp/src/Ice/LoggerI.cpp +14 -44
  302. data/ext/ice/cpp/src/Ice/LoggerI.h +7 -13
  303. data/ext/ice/cpp/src/Ice/LoggerUtil.cpp +10 -12
  304. data/ext/ice/cpp/src/Ice/Metrics.cpp +1059 -1069
  305. data/ext/ice/cpp/src/Ice/MetricsAdminI.cpp +49 -19
  306. data/ext/ice/cpp/src/Ice/MetricsObserverI.cpp +1 -2
  307. data/ext/ice/cpp/src/Ice/Network.cpp +534 -170
  308. data/ext/ice/cpp/src/Ice/Network.h +100 -23
  309. data/ext/ice/cpp/src/Ice/NetworkF.h +2 -2
  310. data/ext/ice/cpp/src/Ice/NetworkProxy.cpp +21 -14
  311. data/ext/ice/cpp/src/Ice/NetworkProxy.h +5 -2
  312. data/ext/ice/cpp/src/Ice/NetworkProxyF.h +1 -1
  313. data/ext/ice/cpp/src/Ice/Object.cpp +217 -221
  314. data/ext/ice/cpp/src/Ice/ObjectAdapter.cpp +41 -6
  315. data/ext/ice/cpp/src/Ice/ObjectAdapterF.cpp +27 -5
  316. data/ext/ice/cpp/src/Ice/ObjectAdapterFactory.cpp +35 -14
  317. data/ext/ice/cpp/src/Ice/ObjectAdapterFactory.h +13 -7
  318. data/ext/ice/cpp/{include → src}/Ice/ObjectAdapterFactoryF.h +5 -1
  319. data/ext/ice/cpp/src/Ice/ObjectAdapterI.cpp +184 -58
  320. data/ext/ice/cpp/src/Ice/ObjectAdapterI.h +32 -26
  321. data/ext/ice/cpp/src/Ice/ObjectFactory.cpp +37 -6
  322. data/ext/ice/cpp/src/Ice/ObserverHelper.cpp +9 -32
  323. data/ext/ice/cpp/src/Ice/OpaqueEndpointI.cpp +40 -18
  324. data/ext/ice/cpp/src/Ice/OpaqueEndpointI.h +14 -5
  325. data/ext/ice/cpp/src/Ice/OutgoingAsync.cpp +803 -365
  326. data/ext/ice/cpp/src/Ice/OutputStream.cpp +1399 -0
  327. data/ext/ice/cpp/src/Ice/Plugin.cpp +45 -6
  328. data/ext/ice/cpp/src/Ice/PluginF.cpp +27 -5
  329. data/ext/ice/cpp/src/Ice/PluginManagerI.cpp +13 -13
  330. data/ext/ice/cpp/src/Ice/PluginManagerI.h +5 -6
  331. data/ext/ice/cpp/src/Ice/Process.cpp +256 -114
  332. data/ext/ice/cpp/src/Ice/ProcessF.cpp +29 -6
  333. data/ext/ice/cpp/src/Ice/Properties.cpp +38 -8
  334. data/ext/ice/cpp/src/Ice/PropertiesAdmin.cpp +340 -328
  335. data/ext/ice/cpp/src/Ice/PropertiesAdminI.cpp +81 -17
  336. data/ext/ice/cpp/src/Ice/PropertiesAdminI.h +29 -5
  337. data/ext/ice/cpp/src/Ice/PropertiesF.cpp +29 -6
  338. data/ext/ice/cpp/src/Ice/PropertiesI.cpp +25 -26
  339. data/ext/ice/cpp/src/Ice/PropertiesI.h +8 -11
  340. data/ext/ice/cpp/src/Ice/PropertyNames.cpp +107 -50
  341. data/ext/ice/cpp/src/Ice/PropertyNames.h +4 -2
  342. data/ext/ice/cpp/src/Ice/Protocol.cpp +2 -2
  343. data/ext/ice/cpp/src/Ice/ProtocolInstance.cpp +37 -2
  344. data/ext/ice/cpp/src/Ice/ProtocolInstance.h +9 -20
  345. data/ext/ice/cpp/src/Ice/ProtocolInstanceF.h +1 -1
  346. data/ext/ice/cpp/src/Ice/ProtocolPluginFacade.cpp +6 -1
  347. data/ext/ice/cpp/src/Ice/ProtocolPluginFacade.h +3 -1
  348. data/ext/ice/cpp/src/Ice/ProtocolPluginFacadeF.h +1 -1
  349. data/ext/ice/cpp/src/Ice/Proxy.cpp +690 -964
  350. data/ext/ice/cpp/src/Ice/ProxyFactory.cpp +23 -32
  351. data/ext/ice/cpp/src/Ice/ProxyFactory.h +16 -11
  352. data/ext/ice/cpp/src/Ice/Reference.cpp +75 -69
  353. data/ext/ice/cpp/src/Ice/Reference.h +27 -22
  354. data/ext/ice/cpp/src/Ice/ReferenceFactory.cpp +18 -21
  355. data/ext/ice/cpp/src/Ice/ReferenceFactory.h +12 -12
  356. data/ext/ice/cpp/src/Ice/ReferenceFactoryF.h +1 -1
  357. data/ext/ice/cpp/src/Ice/RegisterPluginsInit.cpp +18 -4
  358. data/ext/ice/cpp/src/Ice/RegisterPluginsInit.h +1 -1
  359. data/ext/ice/cpp/src/Ice/RemoteLogger.cpp +672 -552
  360. data/ext/ice/cpp/src/Ice/ReplyStatus.h +1 -1
  361. data/ext/ice/cpp/src/Ice/RequestHandler.cpp +5 -3
  362. data/ext/ice/cpp/src/Ice/RequestHandler.h +10 -13
  363. data/ext/ice/cpp/src/Ice/RequestHandlerFactory.cpp +10 -6
  364. data/ext/ice/cpp/src/Ice/RequestHandlerFactory.h +2 -2
  365. data/ext/ice/cpp/src/Ice/ResponseHandler.cpp +3 -6
  366. data/ext/ice/cpp/src/Ice/ResponseHandler.h +16 -7
  367. data/ext/ice/cpp/src/Ice/RetryQueue.cpp +6 -12
  368. data/ext/ice/cpp/src/Ice/RetryQueue.h +7 -6
  369. data/ext/ice/cpp/src/Ice/RetryQueueF.h +1 -1
  370. data/ext/ice/cpp/src/Ice/Router.cpp +523 -474
  371. data/ext/ice/cpp/src/Ice/RouterF.cpp +29 -6
  372. data/ext/ice/cpp/src/Ice/RouterInfo.cpp +91 -70
  373. data/ext/ice/cpp/src/Ice/RouterInfo.h +43 -32
  374. data/ext/ice/cpp/src/Ice/RouterInfoF.h +1 -1
  375. data/ext/ice/cpp/src/{IceUtil → Ice}/SHA1.cpp +21 -21
  376. data/ext/ice/cpp/src/Ice/Selector.cpp +989 -923
  377. data/ext/ice/cpp/src/Ice/Selector.h +100 -147
  378. data/ext/ice/cpp/src/Ice/ServantLocator.cpp +37 -6
  379. data/ext/ice/cpp/src/Ice/ServantLocatorF.cpp +27 -5
  380. data/ext/ice/cpp/src/Ice/ServantManager.cpp +9 -9
  381. data/ext/ice/cpp/src/Ice/ServantManager.h +1 -1
  382. data/ext/ice/cpp/src/Ice/SharedContext.h +2 -2
  383. data/ext/ice/cpp/src/Ice/SliceChecksumDict.cpp +20 -6
  384. data/ext/ice/cpp/src/Ice/SliceChecksums.cpp +2 -2
  385. data/ext/ice/cpp/src/Ice/SlicedData.cpp +72 -20
  386. data/ext/ice/cpp/src/Ice/StreamSocket.cpp +173 -18
  387. data/ext/ice/cpp/src/Ice/StreamSocket.h +13 -4
  388. data/ext/ice/cpp/src/Ice/StringConverterPlugin.cpp +48 -17
  389. data/ext/ice/cpp/src/Ice/StringUtil.h +35 -0
  390. data/ext/ice/cpp/src/Ice/SysLoggerI.cpp +8 -4
  391. data/ext/ice/cpp/src/Ice/SysLoggerI.h +2 -3
  392. data/ext/ice/cpp/src/Ice/TcpAcceptor.cpp +158 -32
  393. data/ext/ice/cpp/src/Ice/TcpAcceptor.h +12 -5
  394. data/ext/ice/cpp/src/Ice/TcpConnector.cpp +1 -7
  395. data/ext/ice/cpp/src/Ice/TcpConnector.h +1 -2
  396. data/ext/ice/cpp/src/Ice/TcpEndpointI.cpp +40 -32
  397. data/ext/ice/cpp/src/Ice/TcpEndpointI.h +11 -8
  398. data/ext/ice/cpp/src/Ice/TcpTransceiver.cpp +12 -27
  399. data/ext/ice/cpp/src/Ice/TcpTransceiver.h +7 -10
  400. data/ext/ice/cpp/src/{IceUtil → Ice}/Thread.cpp +24 -41
  401. data/ext/ice/cpp/src/Ice/ThreadPool.cpp +175 -267
  402. data/ext/ice/cpp/src/Ice/ThreadPool.h +38 -43
  403. data/ext/ice/cpp/src/{IceUtil → Ice}/Timer.cpp +28 -21
  404. data/ext/ice/cpp/src/Ice/TraceLevels.cpp +2 -2
  405. data/ext/ice/cpp/src/Ice/TraceLevels.h +1 -1
  406. data/ext/ice/cpp/src/Ice/TraceLevelsF.h +2 -2
  407. data/ext/ice/cpp/src/Ice/TraceUtil.cpp +53 -31
  408. data/ext/ice/cpp/src/Ice/TraceUtil.h +13 -6
  409. data/ext/ice/cpp/src/Ice/Transceiver.cpp +1 -2
  410. data/ext/ice/cpp/src/Ice/Transceiver.h +8 -7
  411. data/ext/ice/cpp/src/Ice/TransceiverF.h +1 -1
  412. data/ext/ice/cpp/src/Ice/UdpConnector.cpp +2 -8
  413. data/ext/ice/cpp/src/Ice/UdpConnector.h +1 -2
  414. data/ext/ice/cpp/src/Ice/UdpEndpointI.cpp +92 -31
  415. data/ext/ice/cpp/src/Ice/UdpEndpointI.h +12 -4
  416. data/ext/ice/cpp/src/Ice/UdpTransceiver.cpp +150 -179
  417. data/ext/ice/cpp/src/Ice/UdpTransceiver.h +15 -17
  418. data/ext/ice/cpp/src/Ice/Value.cpp +81 -0
  419. data/ext/ice/cpp/src/Ice/ValueFactory.cpp +84 -0
  420. data/ext/ice/cpp/src/Ice/ValueFactoryManagerI.cpp +70 -0
  421. data/ext/ice/cpp/src/Ice/ValueFactoryManagerI.h +42 -0
  422. data/ext/ice/cpp/src/Ice/Version.cpp +24 -14
  423. data/ext/ice/cpp/src/Ice/VirtualShared.h +43 -0
  424. data/ext/ice/cpp/src/Ice/WSAcceptor.cpp +3 -9
  425. data/ext/ice/cpp/src/Ice/WSAcceptor.h +3 -7
  426. data/ext/ice/cpp/src/Ice/WSConnector.cpp +5 -11
  427. data/ext/ice/cpp/src/Ice/WSConnector.h +3 -6
  428. data/ext/ice/cpp/src/Ice/WSEndpoint.cpp +185 -80
  429. data/ext/ice/cpp/src/Ice/WSEndpoint.h +21 -31
  430. data/ext/ice/cpp/src/Ice/WSTransceiver.cpp +41 -37
  431. data/ext/ice/cpp/src/Ice/WSTransceiver.h +7 -21
  432. data/ext/ice/cpp/src/IceDiscovery/IceDiscovery.cpp +526 -264
  433. data/ext/ice/cpp/src/IceDiscovery/IceDiscovery.h +341 -455
  434. data/ext/ice/cpp/src/IceDiscovery/LocatorI.cpp +86 -26
  435. data/ext/ice/cpp/src/IceDiscovery/LocatorI.h +59 -23
  436. data/ext/ice/cpp/src/IceDiscovery/LookupI.cpp +315 -61
  437. data/ext/ice/cpp/src/IceDiscovery/LookupI.h +83 -36
  438. data/ext/ice/cpp/src/IceDiscovery/PluginI.cpp +57 -59
  439. data/ext/ice/cpp/src/IceDiscovery/PluginI.h +3 -3
  440. data/ext/ice/cpp/src/IceLocatorDiscovery/IceLocatorDiscovery.cpp +396 -159
  441. data/ext/ice/cpp/src/IceLocatorDiscovery/IceLocatorDiscovery.h +251 -355
  442. data/ext/ice/cpp/src/IceLocatorDiscovery/Plugin.h +52 -0
  443. data/ext/ice/cpp/src/IceLocatorDiscovery/PluginI.cpp +526 -131
  444. data/ext/ice/cpp/src/IceSSL/AcceptorI.cpp +19 -165
  445. data/ext/ice/cpp/src/IceSSL/AcceptorI.h +8 -17
  446. data/ext/ice/cpp/src/IceSSL/CertificateI.cpp +284 -0
  447. data/ext/ice/cpp/src/IceSSL/CertificateI.h +69 -0
  448. data/ext/ice/cpp/src/IceSSL/ConnectionInfo.cpp +39 -11
  449. data/ext/ice/cpp/src/{Ice/ObjectFactoryF.cpp → IceSSL/ConnectionInfoF.cpp} +31 -9
  450. data/ext/ice/cpp/src/IceSSL/ConnectorI.cpp +14 -56
  451. data/ext/ice/cpp/src/IceSSL/ConnectorI.h +6 -13
  452. data/ext/ice/cpp/src/IceSSL/EndpointI.cpp +205 -197
  453. data/ext/ice/cpp/src/IceSSL/EndpointI.h +41 -33
  454. data/ext/ice/cpp/src/IceSSL/EndpointInfo.cpp +39 -10
  455. data/ext/ice/cpp/src/IceSSL/Instance.cpp +1 -6
  456. data/ext/ice/cpp/src/IceSSL/Instance.h +7 -7
  457. data/ext/ice/cpp/src/IceSSL/InstanceF.h +11 -7
  458. data/ext/ice/cpp/src/IceSSL/OpenSSLCertificateI.cpp +588 -0
  459. data/ext/ice/cpp/src/IceSSL/OpenSSLEngine.cpp +117 -152
  460. data/ext/ice/cpp/src/IceSSL/OpenSSLEngine.h +64 -0
  461. data/ext/ice/cpp/src/IceSSL/OpenSSLEngineF.h +32 -0
  462. data/ext/ice/cpp/src/IceSSL/OpenSSLPluginI.cpp +132 -0
  463. data/ext/ice/cpp/src/IceSSL/OpenSSLTransceiverI.cpp +400 -89
  464. data/ext/ice/cpp/src/IceSSL/OpenSSLTransceiverI.h +36 -21
  465. data/ext/ice/cpp/src/IceSSL/OpenSSLUtil.cpp +291 -0
  466. data/ext/ice/cpp/src/IceSSL/OpenSSLUtil.h +63 -0
  467. data/ext/ice/cpp/src/IceSSL/PluginI.cpp +71 -41
  468. data/ext/ice/cpp/src/IceSSL/PluginI.h +13 -18
  469. data/ext/ice/cpp/src/IceSSL/RFC2253.cpp +9 -54
  470. data/ext/ice/cpp/src/IceSSL/RFC2253.h +7 -7
  471. data/ext/ice/cpp/src/IceSSL/SChannelCertificateI.cpp +585 -0
  472. data/ext/ice/cpp/src/IceSSL/SChannelEngine.cpp +491 -75
  473. data/ext/ice/cpp/src/IceSSL/SChannelEngine.h +126 -0
  474. data/ext/ice/cpp/src/IceSSL/SChannelEngineF.h +32 -0
  475. data/ext/ice/cpp/src/IceSSL/SChannelPluginI.cpp +78 -0
  476. data/ext/ice/cpp/src/IceSSL/SChannelTransceiverI.cpp +126 -169
  477. data/ext/ice/cpp/src/IceSSL/SChannelTransceiverI.h +19 -22
  478. data/ext/ice/cpp/src/IceSSL/SSLEngine.cpp +79 -74
  479. data/ext/ice/cpp/src/IceSSL/SSLEngine.h +24 -187
  480. data/ext/ice/cpp/src/IceSSL/SSLEngineF.h +4 -19
  481. data/ext/ice/cpp/src/IceSSL/SecureTransportCertificateI.cpp +862 -0
  482. data/ext/ice/cpp/src/IceSSL/SecureTransportEngine.cpp +56 -214
  483. data/ext/ice/cpp/src/IceSSL/SecureTransportEngine.h +60 -0
  484. data/ext/ice/cpp/src/IceSSL/SecureTransportEngineF.h +31 -0
  485. data/ext/ice/cpp/src/IceSSL/SecureTransportPluginI.cpp +80 -0
  486. data/ext/ice/cpp/src/IceSSL/SecureTransportTransceiverI.cpp +137 -144
  487. data/ext/ice/cpp/src/IceSSL/SecureTransportTransceiverI.h +25 -28
  488. data/ext/ice/cpp/src/IceSSL/SecureTransportUtil.cpp +857 -0
  489. data/ext/ice/cpp/src/IceSSL/SecureTransportUtil.h +46 -0
  490. data/ext/ice/cpp/src/IceSSL/TrustManager.cpp +9 -13
  491. data/ext/ice/cpp/src/IceSSL/TrustManager.h +4 -4
  492. data/ext/ice/cpp/src/IceSSL/TrustManagerF.h +3 -3
  493. data/ext/ice/cpp/src/IceSSL/UWPCertificateI.cpp +271 -0
  494. data/ext/ice/cpp/src/IceSSL/UWPEngine.cpp +343 -0
  495. data/ext/ice/cpp/src/IceSSL/UWPEngine.h +46 -0
  496. data/ext/ice/cpp/{include/Ice/ObjectFactoryManagerF.h → src/IceSSL/UWPEngineF.h} +13 -8
  497. data/ext/ice/cpp/src/IceSSL/UWPPluginI.cpp +94 -0
  498. data/ext/ice/cpp/src/IceSSL/UWPTransceiverI.cpp +388 -0
  499. data/ext/ice/cpp/src/IceSSL/UWPTransceiverI.h +76 -0
  500. data/ext/ice/cpp/src/IceSSL/Util.cpp +66 -1256
  501. data/ext/ice/cpp/src/IceSSL/Util.h +48 -137
  502. data/ext/ice/cpp/src/IceUtil/ConsoleUtil.cpp +162 -0
  503. data/ext/ice/cpp/src/IceUtil/ConvertUTF.cpp +22 -22
  504. data/ext/ice/cpp/src/IceUtil/ConvertUTF.h +34 -26
  505. data/ext/ice/cpp/src/IceUtil/CtrlCHandler.cpp +20 -31
  506. data/ext/ice/cpp/src/IceUtil/FileUtil.cpp +25 -116
  507. data/ext/ice/cpp/src/IceUtil/InputUtil.cpp +1 -1
  508. data/ext/ice/cpp/src/IceUtil/MutexProtocol.cpp +1 -1
  509. data/ext/ice/cpp/src/IceUtil/Options.cpp +23 -46
  510. data/ext/ice/cpp/src/IceUtil/OutputUtil.cpp +7 -6
  511. data/ext/ice/cpp/src/IceUtil/Random.cpp +13 -13
  512. data/ext/ice/cpp/src/IceUtil/RecMutex.cpp +3 -9
  513. data/ext/ice/cpp/src/IceUtil/Shared.cpp +8 -3
  514. data/ext/ice/cpp/src/IceUtil/StringConverter.cpp +501 -264
  515. data/ext/ice/cpp/src/IceUtil/StringUtil.cpp +540 -235
  516. data/ext/ice/cpp/src/IceUtil/ThreadException.cpp +37 -74
  517. data/ext/ice/cpp/src/IceUtil/Time.cpp +1 -1
  518. data/ext/ice/cpp/src/IceUtil/UUID.cpp +10 -10
  519. data/ext/ice/cpp/src/IceUtil/Unicode.cpp +98 -97
  520. data/ext/ice/cpp/src/IceUtil/Unicode.h +21 -35
  521. data/ext/ice/cpp/src/IceUtil/UtilException.cpp +838 -0
  522. data/ext/ice/cpp/src/Slice/CPlusPlusUtil.cpp +815 -163
  523. data/ext/ice/cpp/src/Slice/CPlusPlusUtil.h +76 -0
  524. data/ext/ice/cpp/src/Slice/Checksum.cpp +2 -2
  525. data/ext/ice/cpp/{include → src}/Slice/Checksum.h +2 -2
  526. data/ext/ice/cpp/src/Slice/FileTracker.cpp +25 -78
  527. data/ext/ice/cpp/{include → src}/Slice/FileTracker.h +9 -9
  528. data/ext/ice/cpp/src/Slice/Grammar.cpp +1994 -1943
  529. data/ext/ice/cpp/src/Slice/Grammar.h +44 -24
  530. data/ext/ice/cpp/src/Slice/GrammarUtil.h +14 -14
  531. data/ext/ice/cpp/src/Slice/JavaUtil.cpp +2658 -1927
  532. data/ext/ice/cpp/{include → src}/Slice/JavaUtil.h +178 -59
  533. data/ext/ice/cpp/src/Slice/MD5.cpp +1 -1
  534. data/ext/ice/cpp/src/Slice/MD5.h +1 -1
  535. data/ext/ice/cpp/src/Slice/MD5I.cpp +0 -1
  536. data/ext/ice/cpp/src/Slice/MD5I.h +1 -1
  537. data/ext/ice/cpp/src/Slice/PHPUtil.cpp +12 -15
  538. data/ext/ice/cpp/{include → src}/Slice/PHPUtil.h +6 -15
  539. data/ext/ice/cpp/src/Slice/Parser.cpp +802 -307
  540. data/ext/ice/cpp/{include → src}/Slice/Parser.h +76 -84
  541. data/ext/ice/cpp/src/Slice/Preprocessor.cpp +43 -21
  542. data/ext/ice/cpp/{include → src}/Slice/Preprocessor.h +7 -12
  543. data/ext/ice/cpp/src/Slice/Python.cpp +207 -86
  544. data/ext/ice/cpp/src/Slice/PythonUtil.cpp +683 -679
  545. data/ext/ice/cpp/{include → src}/Slice/PythonUtil.h +19 -8
  546. data/ext/ice/cpp/src/Slice/Ruby.cpp +38 -34
  547. data/ext/ice/cpp/src/Slice/RubyUtil.cpp +177 -445
  548. data/ext/ice/cpp/{include → src}/Slice/RubyUtil.h +6 -6
  549. data/ext/ice/cpp/src/Slice/Scanner.cpp +218 -306
  550. data/ext/ice/cpp/src/Slice/{Util.cpp → SliceUtil.cpp} +37 -64
  551. data/ext/ice/cpp/src/Slice/StringLiteralUtil.cpp +374 -0
  552. data/ext/ice/cpp/src/Slice/Util.h +54 -0
  553. data/ext/ice/mcpp/Makefile +5 -2
  554. data/ice.gemspec +2 -7
  555. data/lib/Glacier2.rb +1 -1
  556. data/lib/Glacier2/Metrics.rb +7 -46
  557. data/lib/Glacier2/PermissionsVerifier.rb +24 -95
  558. data/lib/Glacier2/PermissionsVerifierF.rb +3 -3
  559. data/lib/Glacier2/Router.rb +32 -74
  560. data/lib/Glacier2/RouterF.rb +3 -3
  561. data/lib/Glacier2/SSLInfo.rb +4 -7
  562. data/lib/Glacier2/Session.rb +88 -307
  563. data/lib/Ice.rb +83 -52
  564. data/lib/Ice/BuiltinSequences.rb +4 -4
  565. data/lib/Ice/Communicator.rb +56 -58
  566. data/lib/Ice/CommunicatorF.rb +3 -3
  567. data/lib/Ice/Connection.rb +153 -162
  568. data/lib/Ice/ConnectionF.rb +3 -3
  569. data/lib/Ice/Current.rb +4 -11
  570. data/lib/Ice/Endpoint.rb +57 -133
  571. data/lib/Ice/EndpointF.rb +3 -3
  572. data/lib/Ice/EndpointTypes.rb +3 -7
  573. data/lib/Ice/FacetMap.rb +4 -4
  574. data/lib/Ice/Identity.rb +5 -8
  575. data/lib/Ice/ImplicitContext.rb +5 -34
  576. data/lib/Ice/ImplicitContextF.rb +3 -3
  577. data/lib/Ice/Instrumentation.rb +23 -275
  578. data/lib/Ice/InstrumentationF.rb +3 -3
  579. data/lib/Ice/LocalException.rb +95 -141
  580. data/lib/Ice/Locator.rb +51 -165
  581. data/lib/Ice/LocatorF.rb +3 -3
  582. data/lib/Ice/Logger.rb +5 -34
  583. data/lib/Ice/LoggerF.rb +3 -3
  584. data/lib/Ice/Metrics.rb +61 -416
  585. data/lib/Ice/ObjectAdapter.rb +34 -0
  586. data/lib/Ice/ObjectAdapterF.rb +3 -3
  587. data/lib/Ice/ObjectFactory.rb +5 -30
  588. data/lib/Ice/Plugin.rb +7 -60
  589. data/lib/Ice/PluginF.rb +3 -3
  590. data/lib/Ice/Process.rb +16 -52
  591. data/lib/Ice/ProcessF.rb +3 -3
  592. data/lib/Ice/Properties.rb +5 -41
  593. data/lib/Ice/PropertiesAdmin.rb +19 -56
  594. data/lib/Ice/PropertiesF.rb +3 -3
  595. data/lib/Ice/RemoteLogger.rb +34 -115
  596. data/lib/Ice/Router.rb +29 -101
  597. data/lib/Ice/RouterF.rb +3 -3
  598. data/lib/Ice/ServantLocator.rb +31 -0
  599. data/lib/Ice/{ObjectFactoryF.rb → ServantLocatorF.rb} +6 -6
  600. data/lib/Ice/SliceChecksumDict.rb +3 -3
  601. data/lib/Ice/ValueFactory.rb +33 -0
  602. data/lib/Ice/Version.rb +5 -11
  603. data/lib/IceBox.rb +1 -1
  604. data/lib/IceBox/IceBox.rb +44 -148
  605. data/lib/IceGrid.rb +1 -4
  606. data/lib/IceGrid/Admin.rb +551 -427
  607. data/lib/IceGrid/Descriptor.rb +62 -529
  608. data/lib/IceGrid/Exception.rb +24 -45
  609. data/lib/IceGrid/FileParser.rb +14 -50
  610. data/lib/IceGrid/PluginFacade.rb +40 -0
  611. data/lib/IceGrid/Registry.rb +151 -58
  612. data/lib/IceGrid/Session.rb +25 -64
  613. data/lib/IceGrid/UserAccountMapper.rb +14 -50
  614. data/lib/IcePatch2.rb +1 -1
  615. data/lib/IcePatch2/FileInfo.rb +5 -11
  616. data/lib/IcePatch2/FileServer.rb +33 -76
  617. data/lib/IceStorm.rb +1 -1
  618. data/lib/IceStorm/IceStorm.rb +79 -206
  619. data/lib/IceStorm/Metrics.rb +11 -89
  620. data/slice/Glacier2/Metrics.ice +8 -4
  621. data/slice/Glacier2/PermissionsVerifier.ice +10 -7
  622. data/slice/Glacier2/PermissionsVerifierF.ice +7 -4
  623. data/slice/Glacier2/Router.ice +10 -8
  624. data/slice/Glacier2/RouterF.ice +7 -4
  625. data/slice/Glacier2/SSLInfo.ice +8 -5
  626. data/slice/Glacier2/Session.ice +15 -13
  627. data/slice/Ice/BuiltinSequences.ice +7 -4
  628. data/slice/Ice/Communicator.ice +141 -66
  629. data/slice/Ice/CommunicatorF.ice +7 -4
  630. data/slice/Ice/Connection.ice +183 -86
  631. data/slice/Ice/ConnectionF.ice +7 -4
  632. data/slice/Ice/Current.ice +13 -9
  633. data/slice/Ice/Endpoint.ice +63 -14
  634. data/slice/Ice/EndpointF.ice +7 -4
  635. data/slice/Ice/EndpointTypes.ice +8 -6
  636. data/slice/Ice/FacetMap.ice +7 -4
  637. data/slice/Ice/Identity.ice +13 -5
  638. data/slice/Ice/ImplicitContext.ice +20 -18
  639. data/slice/Ice/ImplicitContextF.ice +7 -4
  640. data/slice/Ice/Instrumentation.ice +20 -19
  641. data/slice/Ice/InstrumentationF.ice +8 -5
  642. data/slice/Ice/LocalException.ice +87 -87
  643. data/slice/Ice/Locator.ice +19 -18
  644. data/slice/Ice/LocatorF.ice +7 -4
  645. data/slice/Ice/Logger.ice +9 -7
  646. data/slice/Ice/LoggerF.ice +7 -4
  647. data/slice/Ice/Metrics.ice +18 -14
  648. data/slice/Ice/ObjectAdapter.ice +30 -13
  649. data/slice/Ice/ObjectAdapterF.ice +7 -4
  650. data/slice/Ice/ObjectFactory.ice +15 -12
  651. data/slice/Ice/Plugin.ice +9 -6
  652. data/slice/Ice/PluginF.ice +8 -5
  653. data/slice/Ice/Process.ice +9 -6
  654. data/slice/Ice/ProcessF.ice +7 -4
  655. data/slice/Ice/Properties.ice +15 -12
  656. data/slice/Ice/PropertiesAdmin.ice +9 -5
  657. data/slice/Ice/PropertiesF.ice +7 -4
  658. data/slice/Ice/RemoteLogger.ice +33 -24
  659. data/slice/Ice/Router.ice +16 -7
  660. data/slice/Ice/RouterF.ice +7 -4
  661. data/slice/Ice/ServantLocator.ice +13 -10
  662. data/slice/Ice/ServantLocatorF.ice +7 -4
  663. data/slice/Ice/SliceChecksumDict.ice +7 -4
  664. data/slice/Ice/ValueFactory.ice +127 -0
  665. data/slice/Ice/Version.ice +9 -5
  666. data/slice/IceBT/ConnectionInfo.ice +53 -0
  667. data/slice/IceBT/EndpointInfo.ice +51 -0
  668. data/slice/IceBT/Types.ice +39 -0
  669. data/slice/IceBox/IceBox.ice +20 -21
  670. data/slice/IceDiscovery/IceDiscovery.ice +9 -5
  671. data/slice/IceGrid/Admin.ice +390 -30
  672. data/slice/IceGrid/Descriptor.ice +37 -29
  673. data/slice/IceGrid/Exception.ice +33 -27
  674. data/slice/IceGrid/FileParser.ice +9 -6
  675. data/slice/IceGrid/PluginFacade.ice +11 -9
  676. data/slice/IceGrid/Registry.ice +139 -16
  677. data/slice/IceGrid/Session.ice +10 -8
  678. data/slice/IceGrid/UserAccountMapper.ice +9 -6
  679. data/slice/IceIAP/ConnectionInfo.ice +70 -0
  680. data/slice/IceIAP/EndpointInfo.ice +64 -0
  681. data/slice/IceLocatorDiscovery/IceLocatorDiscovery.ice +9 -7
  682. data/slice/IcePatch2/FileInfo.ice +9 -8
  683. data/slice/IcePatch2/FileServer.ice +17 -13
  684. data/slice/IceSSL/ConnectionInfo.ice +14 -17
  685. data/slice/IceSSL/ConnectionInfoF.ice +24 -0
  686. data/slice/IceSSL/EndpointInfo.ice +9 -30
  687. data/slice/IceStorm/IceStorm.ice +22 -18
  688. data/slice/IceStorm/Metrics.ice +9 -5
  689. metadata +154 -120
  690. data/ext/ObjectFactory.cpp +0 -140
  691. data/ext/ObjectFactory.h +0 -50
  692. data/ext/ice/cpp/include/Ice/BasicStream.h +0 -1335
  693. data/ext/ice/cpp/include/Ice/Communicator.h +0 -200
  694. data/ext/ice/cpp/include/Ice/Connection.h +0 -497
  695. data/ext/ice/cpp/include/Ice/DeprecatedStringConverter.h +0 -62
  696. data/ext/ice/cpp/include/Ice/Endpoint.h +0 -341
  697. data/ext/ice/cpp/include/Ice/Identity.h +0 -168
  698. data/ext/ice/cpp/include/Ice/Instrumentation.h +0 -365
  699. data/ext/ice/cpp/include/Ice/LocalException.h +0 -1030
  700. data/ext/ice/cpp/include/Ice/Locator.h +0 -2193
  701. data/ext/ice/cpp/include/Ice/Metrics.h +0 -2974
  702. data/ext/ice/cpp/include/Ice/ObjectAdapter.h +0 -168
  703. data/ext/ice/cpp/include/Ice/ObjectFactory.h +0 -92
  704. data/ext/ice/cpp/include/Ice/ObjectFactoryF.h +0 -66
  705. data/ext/ice/cpp/include/Ice/Outgoing.h +0 -225
  706. data/ext/ice/cpp/include/Ice/Plugin.h +0 -125
  707. data/ext/ice/cpp/include/Ice/Process.h +0 -574
  708. data/ext/ice/cpp/include/Ice/PropertiesAdmin.h +0 -830
  709. data/ext/ice/cpp/include/Ice/RemoteLogger.h +0 -1500
  710. data/ext/ice/cpp/include/Ice/Router.h +0 -1159
  711. data/ext/ice/cpp/include/Ice/Stream.h +0 -447
  712. data/ext/ice/cpp/include/Ice/StreamF.h +0 -30
  713. data/ext/ice/cpp/include/Ice/Version.h +0 -262
  714. data/ext/ice/cpp/include/IceSSL/ConnectionInfo.h +0 -158
  715. data/ext/ice/cpp/include/IceSSL/EndpointInfo.h +0 -142
  716. data/ext/ice/cpp/include/IceUtil/AbstractMutex.h +0 -119
  717. data/ext/ice/cpp/include/IceUtil/Cache.h +0 -362
  718. data/ext/ice/cpp/include/Slice/CPlusPlusUtil.h +0 -65
  719. data/ext/ice/cpp/include/Slice/CsUtil.h +0 -92
  720. data/ext/ice/cpp/include/Slice/DotNetNames.h +0 -34
  721. data/ext/ice/cpp/include/Slice/ObjCUtil.h +0 -127
  722. data/ext/ice/cpp/include/Slice/Util.h +0 -56
  723. data/ext/ice/cpp/src/Ice/BasicStream.cpp +0 -3428
  724. data/ext/ice/cpp/src/Ice/DeprecatedStringConverter.cpp +0 -62
  725. data/ext/ice/cpp/src/Ice/ObjectFactoryManager.cpp +0 -139
  726. data/ext/ice/cpp/src/Ice/ObjectFactoryManager.h +0 -43
  727. data/ext/ice/cpp/src/Ice/Outgoing.cpp +0 -694
  728. data/ext/ice/cpp/src/Ice/Stream.cpp +0 -53
  729. data/ext/ice/cpp/src/Ice/StreamI.cpp +0 -832
  730. data/ext/ice/cpp/src/Ice/StreamI.h +0 -198
  731. data/ext/ice/cpp/src/IceSSL/Certificate.cpp +0 -1336
  732. data/ext/ice/cpp/src/IceUtil/Exception.cpp +0 -792
  733. data/ext/ice/cpp/src/IceUtil/FileUtil.h +0 -185
  734. data/ext/ice/cpp/src/Slice/CsUtil.cpp +0 -2660
  735. data/ext/ice/cpp/src/Slice/DotNetNames.cpp +0 -146
  736. data/ext/ice/cpp/src/Slice/ObjCUtil.cpp +0 -1310
  737. data/lib/IceGrid/Locator.rb +0 -106
  738. data/lib/IceGrid/Observer.rb +0 -572
  739. data/lib/IceGrid/Query.rb +0 -169
  740. data/slice/Freeze/BackgroundSaveEvictor.ice +0 -111
  741. data/slice/Freeze/CatalogData.ice +0 -49
  742. data/slice/Freeze/Connection.ice +0 -121
  743. data/slice/Freeze/DB.ice +0 -37
  744. data/slice/Freeze/Evictor.ice +0 -346
  745. data/slice/Freeze/EvictorF.ice +0 -22
  746. data/slice/Freeze/EvictorStorage.ice +0 -72
  747. data/slice/Freeze/Exception.ice +0 -100
  748. data/slice/Freeze/Transaction.ice +0 -58
  749. data/slice/Freeze/TransactionalEvictor.ice +0 -50
  750. data/slice/IceGrid/Locator.ice +0 -57
  751. data/slice/IceGrid/Observer.ice +0 -395
  752. data/slice/IceGrid/Query.ice +0 -131
@@ -1,6 +1,6 @@
1
1
  // **********************************************************************
2
2
  //
3
- // Copyright (c) 2003-2018 ZeroC, Inc. All rights reserved.
3
+ // Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
4
4
  //
5
5
  // This copy of Ice is licensed to you under the terms described in the
6
6
  // ICE_LICENSE file included in this distribution.
@@ -12,8 +12,6 @@
12
12
  #include <Slice/Util.h>
13
13
  #include <IceUtil/IceUtil.h>
14
14
  #include <IceUtil/StringUtil.h>
15
- #include <IceUtil/InputUtil.h>
16
- #include <IceUtil/Unicode.h>
17
15
  #include <climits>
18
16
  #include <iterator>
19
17
 
@@ -22,6 +20,26 @@ using namespace Slice;
22
20
  using namespace IceUtil;
23
21
  using namespace IceUtilInternal;
24
22
 
23
+ namespace
24
+ {
25
+
26
+ string
27
+ getEscapedParamName(const OperationPtr& p, const string& name)
28
+ {
29
+ ParamDeclList params = p->parameters();
30
+
31
+ for(ParamDeclList::const_iterator i = params.begin(); i != params.end(); ++i)
32
+ {
33
+ if((*i)->name() == name)
34
+ {
35
+ return name + "_";
36
+ }
37
+ }
38
+ return name;
39
+ }
40
+
41
+ }
42
+
25
43
  namespace Slice
26
44
  {
27
45
  namespace Python
@@ -49,7 +67,7 @@ private:
49
67
  //
50
68
  // Validates sequence metadata.
51
69
  //
52
- void validateSequence(const string&, const string&, const TypePtr&, const StringList&);
70
+ StringList validateSequence(const string&, const string&, const TypePtr&, const StringList&);
53
71
 
54
72
  //
55
73
  // Checks a definition that doesn't currently support Python metadata.
@@ -104,10 +122,15 @@ public:
104
122
 
105
123
  private:
106
124
 
125
+ //
126
+ // Emit Python code for the class operations
127
+ //
128
+ void writeOperations(const ClassDefPtr&);
129
+
107
130
  //
108
131
  // Return a Python symbol for the given parser element.
109
132
  //
110
- string getSymbol(const ContainedPtr&, const string& = string());
133
+ string getSymbol(const ContainedPtr&, const string& = "", const string& = "");
111
134
 
112
135
  //
113
136
  // Emit Python code to assign the given symbol in the current module.
@@ -183,7 +206,7 @@ private:
183
206
  };
184
207
  bool parseOpComment(const string&, OpComment&);
185
208
 
186
- enum DocstringMode { DocSync, DocAsyncBegin, DocAsyncEnd, DocDispatch, DocAsyncDispatch };
209
+ enum DocstringMode { DocSync, DocAsync, DocAsyncBegin, DocAsyncEnd, DocDispatch, DocAsyncDispatch };
187
210
 
188
211
  void writeDocstring(const OperationPtr&, DocstringMode, bool);
189
212
 
@@ -196,44 +219,6 @@ private:
196
219
  }
197
220
  }
198
221
 
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
222
  static string
238
223
  lookupKwd(const string& name)
239
224
  {
@@ -288,7 +273,7 @@ splitScopedName(const string& scoped)
288
273
  }
289
274
 
290
275
  static string
291
- getDictLookup(const ContainedPtr& cont, const string& suffix = string())
276
+ getDictLookup(const ContainedPtr& cont, const string& suffix = "", const string& prefix = "")
292
277
  {
293
278
  string scope = Slice::Python::scopedToName(cont->scope());
294
279
  assert(!scope.empty());
@@ -299,7 +284,7 @@ getDictLookup(const ContainedPtr& cont, const string& suffix = string())
299
284
  scope = package + "." + scope;
300
285
  }
301
286
 
302
- return "'" + suffix + Slice::Python::fixIdent(cont->name()) + "' not in _M_" + scope + "__dict__";
287
+ return "'" + suffix + Slice::Python::fixIdent(cont->name() + prefix) + "' not in _M_" + scope + "__dict__";
303
288
  }
304
289
 
305
290
  //
@@ -356,7 +341,8 @@ Slice::Python::ModuleVisitor::visitModuleStart(const ModulePtr& p)
356
341
  // CodeVisitor implementation.
357
342
  //
358
343
  Slice::Python::CodeVisitor::CodeVisitor(Output& out, set<string>& moduleHistory) :
359
- _out(out), _moduleHistory(moduleHistory)
344
+ _out(out),
345
+ _moduleHistory(moduleHistory)
360
346
  {
361
347
  }
362
348
 
@@ -440,10 +426,15 @@ Slice::Python::CodeVisitor::visitClassDecl(const ClassDeclPtr& p)
440
426
  {
441
427
  _out << sp << nl << "if " << getDictLookup(p) << ':';
442
428
  _out.inc();
443
- string type = getAbsolute(p, "_t_");
444
- _out << nl << "_M_" << type << " = IcePy.declareClass('" << scoped << "')";
445
- if(!p->isLocal())
429
+
430
+ if(!p->isInterface() || p->isLocal())
431
+ {
432
+ _out << nl << "_M_" << getAbsolute(p, "_t_") << " = IcePy.declareValue('" << scoped << "')";
433
+ }
434
+
435
+ if(!p->isLocal() && (p->isInterface() || p->definition()->allOperations().size()))
446
436
  {
437
+ _out << nl << "_M_" << getAbsolute(p, "_t_", "Disp") << " = IcePy.declareClass('" << scoped << "')";
447
438
  _out << nl << "_M_" << getAbsolute(p, "_t_", "Prx") << " = IcePy.declareProxy('" << scoped << "')";
448
439
  }
449
440
  _out.dec();
@@ -451,150 +442,10 @@ Slice::Python::CodeVisitor::visitClassDecl(const ClassDeclPtr& p)
451
442
  }
452
443
  }
453
444
 
454
- bool
455
- Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
445
+ void
446
+ Slice::Python::CodeVisitor::writeOperations(const ClassDefPtr& p)
456
447
  {
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
448
  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
449
  if(!ops.empty())
599
450
  {
600
451
  //
@@ -603,9 +454,31 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
603
454
  for(OperationList::iterator oli = ops.begin(); oli != ops.end(); ++oli)
604
455
  {
605
456
  string fixedOpName = fixIdent((*oli)->name());
606
- if(!p->isLocal() && (p->hasMetaData("amd") || (*oli)->hasMetaData("amd")))
457
+ if(!p->isLocal())
607
458
  {
608
- _out << sp << nl << "def " << (*oli)->name() << "_async(self, _cb";
459
+ if((*oli)->hasMarshaledResult())
460
+ {
461
+ string name = (*oli)->name();
462
+ name[0] = toupper(static_cast<unsigned char>(name[0]));
463
+ _out << sp;
464
+ _out << nl << "\"\"\"";
465
+ _out << nl << "Immediately marshals the result of an invocation of " << (*oli)->name()
466
+ << nl << "and returns an object that the servant implementation must return"
467
+ << nl << "as its result."
468
+ << nl << "Arguments:"
469
+ << nl << "result -- The result (or result tuple) of the invocation."
470
+ << nl << "current -- The Current object passed to the invocation."
471
+ << nl << "Returns: An object containing the marshaled result.";
472
+ _out << nl << "\"\"\"";
473
+ _out << nl << "@staticmethod";
474
+ _out << nl << "def " << name << "MarshaledResult(result, current):";
475
+ _out.inc();
476
+ _out << nl << "return IcePy.MarshaledResult(result, _M_" << getAbsolute(p) << "._op_"
477
+ << (*oli)->name() << ", current.adapter.getCommunicator().getImpl(), current.encoding)";
478
+ _out.dec();
479
+ }
480
+
481
+ _out << sp << nl << "def " << fixedOpName << "(self";
609
482
 
610
483
  ParamDeclList params = (*oli)->parameters();
611
484
 
@@ -616,16 +489,18 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
616
489
  _out << ", " << fixIdent((*pli)->name());
617
490
  }
618
491
  }
492
+
619
493
  if(!p->isLocal())
620
494
  {
621
- _out << ", current=None";
495
+ const string currentParamName = getEscapedParamName(*oli, "current");
496
+ _out << ", " << currentParamName << "=None";
622
497
  }
623
498
  _out << "):";
624
499
  _out.inc();
625
500
 
626
501
  writeDocstring(*oli, DocAsyncDispatch, false);
627
502
 
628
- _out << nl << "pass";
503
+ _out << nl << "raise NotImplementedError(\"servant method '" << fixedOpName << "' not implemented\")";
629
504
  _out.dec();
630
505
  }
631
506
  else
@@ -643,54 +518,287 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
643
518
  }
644
519
  if(!p->isLocal())
645
520
  {
646
- _out << ", current=None";
521
+ const string currentParamName = getEscapedParamName(*oli, "current");
522
+ _out << ", " << currentParamName << "=None";
647
523
  }
648
524
  _out << "):";
649
525
  _out.inc();
650
526
  writeDocstring(*oli, DocDispatch, p->isLocal());
651
- _out << nl << "pass";
527
+ _out << nl << "raise NotImplementedError(\"method '" << fixedOpName << "' not implemented\")";
652
528
  _out.dec();
653
529
  }
654
530
  }
655
531
  }
532
+ }
656
533
 
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__";
534
+ bool
535
+ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
536
+ {
537
+ bool isLocal = p->isLocal();
538
+ bool isInterface = p->isInterface();
539
+ bool isAbstract = isInterface || p->allOperations().size() > 0; // Don't use isAbstract() - see bug 3739
665
540
 
666
- _out.dec();
541
+ string scoped = p->scoped();
542
+ string type = getAbsolute(p, "_t_");
543
+ string classType = getAbsolute(p, "_t_", "Disp");
544
+ string abs = getAbsolute(p);
545
+ string className = isLocal || isInterface ? fixIdent(p->name()) : isAbstract ? fixIdent(p->name() + "Disp") : "None";
546
+ string classAbs = isInterface ? getAbsolute(p) : getAbsolute(p, "", "Disp");
547
+ string valueName = (isInterface && !isLocal) ? "Ice.Value" : fixIdent(p->name());
548
+ string prxAbs = getAbsolute(p, "", "Prx");
549
+ string prxName = fixIdent(p->name() + "Prx");
550
+ string prxType = getAbsolute(p, "_t_", "Prx");
551
+ ClassList bases = p->bases();
552
+ ClassDefPtr base;
553
+
554
+ if(!bases.empty() && !bases.front()->isInterface())
555
+ {
556
+ base = bases.front();
557
+ }
667
558
 
668
559
  //
669
- // Define the proxy class.
560
+ // Define a class type for Value types or local classes.
670
561
  //
671
- if(!p->isLocal())
562
+ if(isLocal || !isInterface)
672
563
  {
673
- _out << sp << nl << "_M_" << prxAbs << " = Ice.createTempClass()";
674
- _out << nl << "class " << prxName << "(";
675
- if(bases.empty())
564
+ _out << sp << nl << "if " << getDictLookup(p) << ':';
565
+ _out.inc();
566
+ _out << nl << "_M_" << abs << " = Ice.createTempClass()";
567
+ _out << nl << "class " << valueName << '(';
568
+ if(isLocal)
676
569
  {
677
- _out << "Ice.ObjectPrx";
570
+ if(bases.empty())
571
+ {
572
+ _out << "object";
573
+ }
574
+ else
575
+ {
576
+ for(ClassList::const_iterator q = bases.begin(); q != bases.end(); ++q)
577
+ {
578
+ if(q != bases.begin())
579
+ {
580
+ _out << ", ";
581
+ }
582
+ _out << getSymbol(*q);
583
+ }
584
+ }
678
585
  }
679
586
  else
680
587
  {
681
- ClassList::const_iterator q = bases.begin();
682
- while(q != bases.end())
588
+ if(bases.empty() || bases.front()->isInterface())
589
+ {
590
+ _out << "Ice.Value";
591
+ }
592
+ else
683
593
  {
684
- _out << getSymbol(*q, "Prx");
685
- if(++q != bases.end())
594
+ _out << getSymbol(bases.front());
595
+ }
596
+ }
597
+ _out << "):";
598
+
599
+ _out.inc();
600
+
601
+ writeDocstring(p->comment(), p->dataMembers());
602
+
603
+ //
604
+ // __init__
605
+ //
606
+ _out << nl << "def __init__(self";
607
+ MemberInfoList allMembers;
608
+ collectClassMembers(p, allMembers, false);
609
+ writeConstructorParams(allMembers);
610
+ _out << "):";
611
+ _out.inc();
612
+ if(!base && !p->hasDataMembers() && (!isAbstract || !isLocal))
613
+ {
614
+ _out << nl << "pass";
615
+ }
616
+ else
617
+ {
618
+ if(isAbstract && isLocal)
619
+ {
620
+ _out << nl << "if Ice.getType(self) == _M_" << abs << ':';
621
+ _out.inc();
622
+ _out << nl << "raise RuntimeError('" << abs << " is an abstract class')";
623
+ _out.dec();
624
+ }
625
+ if(base)
626
+ {
627
+ _out << nl << getSymbol(base) << ".__init__(self";
628
+ for(MemberInfoList::iterator q = allMembers.begin(); q != allMembers.end(); ++q)
686
629
  {
687
- _out << ", ";
630
+ if(q->inherited)
631
+ {
632
+ _out << ", " << q->fixedName;
633
+ }
634
+ }
635
+ _out << ')';
636
+ }
637
+ for(MemberInfoList::iterator q = allMembers.begin(); q != allMembers.end(); ++q)
638
+ {
639
+ if(!q->inherited)
640
+ {
641
+ writeAssign(*q);
642
+ }
643
+ }
644
+ }
645
+ _out.dec();
646
+
647
+ if(!isLocal)
648
+ {
649
+ //
650
+ // ice_id
651
+ //
652
+ _out << sp << nl << "def ice_id(self):";
653
+ _out.inc();
654
+ _out << nl << "return '" << scoped << "'";
655
+ _out.dec();
656
+
657
+ //
658
+ // ice_staticId
659
+ //
660
+ _out << sp << nl << "@staticmethod";
661
+ _out << nl << "def ice_staticId():";
662
+ _out.inc();
663
+ _out << nl << "return '" << scoped << "'";
664
+ _out.dec();
665
+ }
666
+ else
667
+ {
668
+ writeOperations(p);
669
+ }
670
+
671
+ //
672
+ // __str__
673
+ //
674
+ _out << sp << nl << "def __str__(self):";
675
+ _out.inc();
676
+ _out << nl << "return IcePy.stringify(self, _M_" << type << ")";
677
+ _out.dec();
678
+ _out << sp << nl << "__repr__ = __str__";
679
+
680
+ _out.dec();
681
+
682
+ if(_classHistory.count(scoped) == 0 && p->canBeCyclic())
683
+ {
684
+ //
685
+ // Emit a forward declaration for the class in case a data member refers to this type.
686
+ //
687
+ _out << sp << nl << "_M_" << type << " = IcePy.declareValue('" << scoped << "')";
688
+ }
689
+ DataMemberList members = p->dataMembers();
690
+ _out << sp << nl << "_M_" << type << " = IcePy.defineValue('" << scoped << "', " << valueName
691
+ << ", " << p->compactId() << ", ";
692
+ writeMetaData(p->getMetaData());
693
+ const bool preserved = p->hasMetaData("preserve-slice") || p->inheritsMetaData("preserve-slice");
694
+ _out << ", " << (preserved ? "True" : "False") << ", " << (isInterface ? "True" : "False") << ", ";
695
+ if(!base)
696
+ {
697
+ _out << "None";
698
+ }
699
+ else
700
+ {
701
+ _out << "_M_" << getAbsolute(base, "_t_");
702
+ }
703
+ _out << ", (";
704
+ //
705
+ // Members
706
+ //
707
+ // Data members are represented as a tuple:
708
+ //
709
+ // ('MemberName', MemberMetaData, MemberType, Optional, Tag)
710
+ //
711
+ // where MemberType is either a primitive type constant (T_INT, etc.) or the id of a constructed type.
712
+ //
713
+ if(members.size() > 1)
714
+ {
715
+ _out.inc();
716
+ _out << nl;
717
+ }
718
+ bool isProtected = p->hasMetaData("protected");
719
+ for(DataMemberList::iterator r = members.begin(); r != members.end(); ++r)
720
+ {
721
+ if(r != members.begin())
722
+ {
723
+ _out << ',' << nl;
724
+ }
725
+ _out << "('";
726
+ if(isProtected || (*r)->hasMetaData("protected"))
727
+ {
728
+ _out << '_';
729
+ }
730
+ _out << fixIdent((*r)->name()) << "', ";
731
+ writeMetaData((*r)->getMetaData());
732
+ _out << ", ";
733
+ writeType((*r)->type());
734
+ _out << ", " << ((*r)->optional() ? "True" : "False") << ", "
735
+ << ((*r)->optional() ? (*r)->tag() : 0) << ')';
736
+ }
737
+ if(members.size() == 1)
738
+ {
739
+ _out << ',';
740
+ }
741
+ else if(members.size() > 1)
742
+ {
743
+ _out.dec();
744
+ _out << nl;
745
+ }
746
+ _out << "))";
747
+ _out << nl << valueName << "._ice_type = _M_" << type;
748
+
749
+ registerName(valueName);
750
+
751
+ _out.dec();
752
+ }
753
+ else if(!isLocal && isInterface)
754
+ {
755
+ _out << sp << nl << "_M_" << type << " = IcePy.defineValue('" << scoped << "', Ice.Value, -1, ";
756
+ writeMetaData(p->getMetaData());
757
+ _out << ", False, True, None, ())";
758
+ }
759
+
760
+ if(!isLocal && isAbstract)
761
+ {
762
+ _out << sp << nl << "if " << getDictLookup(p, "", "Prx") << ':';
763
+ _out.inc();
764
+
765
+ // Define the proxy class
766
+ _out << nl << "_M_" << prxAbs << " = Ice.createTempClass()";
767
+ _out << nl << "class " << prxName << '(';
768
+
769
+ {
770
+ vector<string> baseClasses;
771
+ for(ClassList::const_iterator q = bases.begin(); q != bases.end(); ++q)
772
+ {
773
+ ClassDefPtr d = *q;
774
+ if(d->isInterface() || d->allOperations().size() > 0)
775
+ {
776
+ baseClasses.push_back(getSymbol(*q, "", "Prx"));
777
+ }
778
+ }
779
+
780
+ if(baseClasses.empty())
781
+ {
782
+ _out << "Ice.ObjectPrx";
783
+ }
784
+ else
785
+ {
786
+ vector<string>::const_iterator q = baseClasses.begin();
787
+ while(q != baseClasses.end())
788
+ {
789
+ _out << *q;
790
+
791
+ if(++q != baseClasses.end())
792
+ {
793
+ _out << ", ";
794
+ }
688
795
  }
689
796
  }
690
797
  }
691
798
  _out << "):";
692
799
  _out.inc();
693
800
 
801
+ OperationList ops = p->operations();
694
802
  for(OperationList::iterator oli = ops.begin(); oli != ops.end(); ++oli)
695
803
  {
696
804
  string fixedOpName = fixIdent((*oli)->name());
@@ -721,19 +829,37 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
721
829
  {
722
830
  _out << ", " << inParams;
723
831
  }
724
- _out << ", _ctx=None):";
832
+ const string contextParamName = getEscapedParamName(*oli, "context");
833
+ _out << ", " << contextParamName << "=None):";
725
834
  _out.inc();
726
- _out << nl << "return _M_" << abs << "._op_" << (*oli)->name() << ".invoke(self, ((" << inParams;
835
+ _out << nl << "return _M_" << classAbs << "._op_" << (*oli)->name() << ".invoke(self, ((" << inParams;
727
836
  if(!inParams.empty() && inParams.find(',') == string::npos)
728
837
  {
729
838
  _out << ", ";
730
839
  }
731
- _out << "), _ctx))";
840
+ _out << "), " << contextParamName << "))";
732
841
  _out.dec();
733
842
 
734
843
  //
735
844
  // Async operations.
736
845
  //
846
+ _out << sp;
847
+ writeDocstring(*oli, DocAsync, false);
848
+ _out << nl << "def " << (*oli)->name() << "Async(self";
849
+ if(!inParams.empty())
850
+ {
851
+ _out << ", " << inParams;
852
+ }
853
+ _out << ", " << contextParamName << "=None):";
854
+ _out.inc();
855
+ _out << nl << "return _M_" << classAbs << "._op_" << (*oli)->name() << ".invokeAsync(self, ((" << inParams;
856
+ if(!inParams.empty() && inParams.find(',') == string::npos)
857
+ {
858
+ _out << ", ";
859
+ }
860
+ _out << "), " << contextParamName << "))";
861
+ _out.dec();
862
+
737
863
  _out << sp;
738
864
  writeDocstring(*oli, DocAsyncBegin, false);
739
865
  _out << nl << "def begin_" << (*oli)->name() << "(self";
@@ -741,150 +867,187 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
741
867
  {
742
868
  _out << ", " << inParams;
743
869
  }
744
- _out << ", _response=None, _ex=None, _sent=None, _ctx=None):";
870
+ _out << ", _response=None, _ex=None, _sent=None, " << contextParamName << "=None):";
745
871
  _out.inc();
746
- _out << nl << "return _M_" << abs << "._op_" << (*oli)->name() << ".begin(self, ((" << inParams;
872
+ _out << nl << "return _M_" << classAbs << "._op_" << (*oli)->name() << ".begin(self, ((" << inParams;
747
873
  if(!inParams.empty() && inParams.find(',') == string::npos)
748
874
  {
749
875
  _out << ", ";
750
876
  }
751
- _out << "), _response, _ex, _sent, _ctx))";
752
- _out.dec();
753
-
754
- _out << sp;
755
- writeDocstring(*oli, DocAsyncEnd, false);
756
- _out << nl << "def end_" << (*oli)->name() << "(self, _r):";
757
- _out.inc();
758
- _out << nl << "return _M_" << abs << "._op_" << (*oli)->name() << ".end(self, _r)";
759
- _out.dec();
877
+ _out << "), _response, _ex, _sent, " << contextParamName << "))";
878
+ _out.dec();
879
+
880
+ _out << sp;
881
+ writeDocstring(*oli, DocAsyncEnd, false);
882
+ _out << nl << "def end_" << (*oli)->name() << "(self, _r):";
883
+ _out.inc();
884
+ _out << nl << "return _M_" << classAbs << "._op_" << (*oli)->name() << ".end(self, _r)";
885
+ _out.dec();
886
+ }
887
+
888
+ _out << sp << nl << "@staticmethod";
889
+ _out << nl << "def checkedCast(proxy, facetOrContext=None, context=None):";
890
+ _out.inc();
891
+ _out << nl << "return _M_" << prxAbs << ".ice_checkedCast(proxy, '" << scoped << "', facetOrContext, context)";
892
+ _out.dec();
893
+
894
+ _out << sp << nl << "@staticmethod";
895
+ _out << nl << "def uncheckedCast(proxy, facet=None):";
896
+ _out.inc();
897
+ _out << nl << "return _M_" << prxAbs << ".ice_uncheckedCast(proxy, facet)";
898
+ _out.dec();
899
+
900
+ //
901
+ // ice_staticId
902
+ //
903
+ _out << sp << nl << "@staticmethod";
904
+ _out << nl << "def ice_staticId():";
905
+ _out.inc();
906
+ _out << nl << "return '" << scoped << "'";
907
+ _out.dec();
908
+
909
+ _out.dec(); // end prx class
910
+
911
+ _out << nl << "_M_" << prxType << " = IcePy.defineProxy('" << scoped << "', " << prxName << ")";
912
+
913
+ registerName(prxName);
914
+
915
+ // Define the servant class
916
+ _out << sp << nl << "_M_" << classAbs << " = Ice.createTempClass()";
917
+ _out << nl << "class " << className << '(';
918
+ {
919
+ vector<string> baseClasses;
920
+ for(ClassList::const_iterator q = bases.begin(); q != bases.end(); ++q)
921
+ {
922
+ ClassDefPtr d = *q;
923
+ if(d->isInterface() || d->allOperations().size() > 0)
924
+ {
925
+ baseClasses.push_back(getSymbol(*q, "", d->isInterface() ? "" : "Disp"));
926
+ }
927
+ }
928
+
929
+ if(baseClasses.empty())
930
+ {
931
+ _out << "Ice.Object";
932
+ }
933
+ else
934
+ {
935
+ vector<string>::const_iterator q = baseClasses.begin();
936
+ while(q != baseClasses.end())
937
+ {
938
+ _out << *q;
939
+
940
+ if(++q != baseClasses.end())
941
+ {
942
+ _out << ", ";
943
+ }
944
+ }
945
+ }
946
+ }
947
+ _out << "):";
948
+
949
+ _out.inc();
950
+
951
+ //
952
+ // ice_ids
953
+ //
954
+ ClassList allBases = p->allBases();
955
+ StringList ids;
956
+ transform(allBases.begin(), allBases.end(), back_inserter(ids), IceUtil::constMemFun(&Contained::scoped));
957
+ StringList other;
958
+ other.push_back(scoped);
959
+ other.push_back("::Ice::Object");
960
+ other.sort();
961
+ ids.merge(other);
962
+ ids.unique();
963
+ _out << sp << nl << "def ice_ids(self, current=None):";
964
+ _out.inc();
965
+ _out << nl << "return (";
966
+ for(StringList::iterator q = ids.begin(); q != ids.end(); ++q)
967
+ {
968
+ if(q != ids.begin())
969
+ {
970
+ _out << ", ";
971
+ }
972
+ _out << "'" << *q << "'";
760
973
  }
761
-
762
- _out << sp << nl << "def checkedCast(proxy, facetOrCtx=None, _ctx=None):";
763
- _out.inc();
764
- _out << nl << "return _M_" << prxAbs << ".ice_checkedCast(proxy, '" << scoped << "', facetOrCtx, _ctx)";
974
+ _out << ')';
765
975
  _out.dec();
766
- _out << nl << "checkedCast = staticmethod(checkedCast)";
767
976
 
768
- _out << sp << nl << "def uncheckedCast(proxy, facet=None):";
977
+ //
978
+ // ice_id
979
+ //
980
+ _out << sp << nl << "def ice_id(self, current=None):";
769
981
  _out.inc();
770
- _out << nl << "return _M_" << prxAbs << ".ice_uncheckedCast(proxy, facet)";
982
+ _out << nl << "return '" << scoped << "'";
771
983
  _out.dec();
772
- _out << nl << "uncheckedCast = staticmethod(uncheckedCast)";
773
-
774
984
 
775
- //
985
+ //
776
986
  // ice_staticId
777
987
  //
778
- _out << sp << nl << "def ice_staticId():";
988
+ _out << sp << nl << "@staticmethod";
989
+ _out << nl << "def ice_staticId():";
779
990
  _out.inc();
780
991
  _out << nl << "return '" << scoped << "'";
781
992
  _out.dec();
782
- _out << nl << "ice_staticId = staticmethod(ice_staticId)";
783
-
784
- _out.dec();
785
993
 
786
- _out << sp << nl << "_M_" << prxType << " = IcePy.defineProxy('" << scoped << "', " << prxName << ")";
787
- }
994
+ writeOperations(p);
788
995
 
789
- if(_classHistory.count(scoped) == 0 && p->canBeCyclic())
790
- {
791
996
  //
792
- // Emit a forward declaration for the class in case a data member refers to this type.
997
+ // __str__
793
998
  //
794
- _out << sp << nl << "_M_" << type << " = IcePy.declareClass('" << scoped << "')";
795
- }
999
+ _out << sp << nl << "def __str__(self):";
1000
+ _out.inc();
1001
+ _out << nl << "return IcePy.stringify(self, _M_" << getAbsolute(p, "_t_", "Disp") << ")";
1002
+ _out.dec();
1003
+ _out << sp << nl << "__repr__ = __str__";
796
1004
 
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())
1005
+ _out.dec();
1006
+
1007
+ _out << sp << nl << "_M_" << classType << " = IcePy.defineClass('" << scoped << "', " << className
1008
+ << ", ";
1009
+ writeMetaData(p->getMetaData());
1010
+ _out << ", ";
1011
+ if(!base || (!base->isInterface() && base->allOperations().size() == 0))
819
1012
  {
820
- if(interfaceCount > 0)
821
- {
822
- _out << ", ";
823
- }
824
- _out << "_M_" << getAbsolute(*q, "_t_");
825
- ++interfaceCount;
1013
+ _out << "None";
826
1014
  }
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
- {
844
- _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())
1015
+ else
851
1016
  {
852
- _out << ',' << nl;
1017
+ _out << "_M_" << getAbsolute(base, "_t_", "Disp");
853
1018
  }
854
- _out << "('";
855
- if(isProtected || (*r)->hasMetaData("protected"))
1019
+ _out << ", (";
1020
+ //
1021
+ // Interfaces
1022
+ //
1023
+ int interfaceCount = 0;
1024
+ for(ClassList::const_iterator q = bases.begin(); q != bases.end(); ++q)
856
1025
  {
857
- _out << '_';
1026
+ if((*q)->isInterface())
1027
+ {
1028
+ if(interfaceCount > 0)
1029
+ {
1030
+ _out << ", ";
1031
+ }
1032
+ _out << "_M_" << getAbsolute(*q, "_t_", "Disp");
1033
+ ++interfaceCount;
1034
+ }
858
1035
  }
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;
1036
+ if(interfaceCount == 1)
1037
+ {
1038
+ _out << ',';
1039
+ }
1040
+ _out << "))";
1041
+ _out << nl << className << "._ice_type = _M_" << classType;
877
1042
 
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
- {
1043
+ //
1044
+ // Define each operation. The arguments to the IcePy.Operation constructor are:
1045
+ //
1046
+ // 'opName', Mode, SendMode, AMD, Format, MetaData, (InParams), (OutParams), ReturnParam, (Exceptions)
1047
+ //
1048
+ // where InParams and OutParams are tuples of type descriptions, and Exceptions
1049
+ // is a tuple of exception type ids.
1050
+ //
888
1051
  if(!ops.empty())
889
1052
  {
890
1053
  _out << sp;
@@ -908,10 +1071,10 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
908
1071
  break;
909
1072
  }
910
1073
 
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 << ", ";
1074
+ _out << nl << className << "._op_" << (*s)->name() << " = IcePy.Operation('" << (*s)->name() << "', "
1075
+ << getOperationMode((*s)->mode()) << ", " << getOperationMode((*s)->sendMode()) << ", "
1076
+ << ((p->hasMetaData("amd") || (*s)->hasMetaData("amd")) ? "True" : "False") << ", "
1077
+ << format << ", ";
915
1078
  writeMetaData((*s)->getMetaData());
916
1079
  _out << ", (";
917
1080
  for(t = params.begin(), count = 0; t != params.end(); ++t)
@@ -949,7 +1112,7 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
949
1112
  _out << ", ";
950
1113
  writeType((*t)->type());
951
1114
  _out << ", " << ((*t)->optional() ? "True" : "False") << ", "
952
- << ((*t)->optional() ? (*t)->tag() : 0) << ')';
1115
+ << ((*t)->optional() ? (*t)->tag() : 0) << ')';
953
1116
  ++count;
954
1117
  }
955
1118
  }
@@ -1000,20 +1163,14 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
1000
1163
  {
1001
1164
  msg = deprecateMetadata.substr(pos + 1);
1002
1165
  }
1003
- _out << nl << name << "._op_" << (*s)->name() << ".deprecate(\"" << msg << "\")";
1166
+ _out << nl << className << "._op_" << (*s)->name() << ".deprecate(\"" << msg << "\")";
1004
1167
  }
1005
1168
  }
1006
- }
1007
-
1008
- registerName(name);
1009
1169
 
1010
- if(!p->isLocal())
1011
- {
1012
- registerName(prxName);
1170
+ registerName(className);
1171
+ _out.dec();
1013
1172
  }
1014
1173
 
1015
- _out.dec();
1016
-
1017
1174
  if(_classHistory.count(scoped) == 0)
1018
1175
  {
1019
1176
  _classHistory.insert(scoped); // Avoid redundant declarations.
@@ -1102,9 +1259,9 @@ Slice::Python::CodeVisitor::visitExceptionStart(const ExceptionPtr& p)
1102
1259
  _out << sp << nl << "__repr__ = __str__";
1103
1260
 
1104
1261
  //
1105
- // _ice_name
1262
+ // _ice_id
1106
1263
  //
1107
- _out << sp << nl << "_ice_name = '" << scoped.substr(2) << "'";
1264
+ _out << sp << nl << "_ice_id = '" << scoped << "'";
1108
1265
 
1109
1266
  _out.dec();
1110
1267
 
@@ -1515,7 +1672,7 @@ Slice::Python::CodeVisitor::visitEnum(const EnumPtr& p)
1515
1672
  string scoped = p->scoped();
1516
1673
  string abs = getAbsolute(p);
1517
1674
  string name = fixIdent(p->name());
1518
- EnumeratorList enums = p->getEnumerators();
1675
+ EnumeratorList enums = p->enumerators();
1519
1676
  EnumeratorList::iterator q;
1520
1677
 
1521
1678
  _out << sp << nl << "if " << getDictLookup(p) << ':';
@@ -1586,12 +1743,12 @@ Slice::Python::CodeVisitor::visitConst(const ConstPtr& p)
1586
1743
  }
1587
1744
 
1588
1745
  string
1589
- Slice::Python::CodeVisitor::getSymbol(const ContainedPtr& p, const string& nameSuffix)
1746
+ Slice::Python::CodeVisitor::getSymbol(const ContainedPtr& p, const string& prefix, const string& suffix)
1590
1747
  {
1591
1748
  //
1592
1749
  // An explicit reference to another type must always be prefixed with "_M_".
1593
1750
  //
1594
- return "_M_" + getAbsolute(p, "", nameSuffix);
1751
+ return "_M_" + getAbsolute(p, prefix, suffix);
1595
1752
  }
1596
1753
 
1597
1754
  void
@@ -1651,8 +1808,9 @@ Slice::Python::CodeVisitor::writeType(const TypePtr& p)
1651
1808
  break;
1652
1809
  }
1653
1810
  case Builtin::KindObject:
1811
+ case Builtin::KindValue:
1654
1812
  {
1655
- _out << "IcePy._t_Object";
1813
+ _out << "IcePy._t_Value";
1656
1814
  break;
1657
1815
  }
1658
1816
  case Builtin::KindObjectProxy:
@@ -1672,7 +1830,15 @@ Slice::Python::CodeVisitor::writeType(const TypePtr& p)
1672
1830
  ProxyPtr prx = ProxyPtr::dynamicCast(p);
1673
1831
  if(prx)
1674
1832
  {
1675
- _out << "_M_" << getAbsolute(prx->_class(), "_t_", "Prx");
1833
+ ClassDefPtr def = prx->_class()->definition();
1834
+ if(def->isInterface() || def->allOperations().size() > 0)
1835
+ {
1836
+ _out << "_M_" << getAbsolute(prx->_class(), "_t_", "Prx");
1837
+ }
1838
+ else
1839
+ {
1840
+ _out << "IcePy._t_ObjectPrx";
1841
+ }
1676
1842
  return;
1677
1843
  }
1678
1844
 
@@ -1714,6 +1880,7 @@ Slice::Python::CodeVisitor::writeInitializer(const DataMemberPtr& m)
1714
1880
  _out << "''";
1715
1881
  break;
1716
1882
  }
1883
+ case Builtin::KindValue:
1717
1884
  case Builtin::KindObject:
1718
1885
  case Builtin::KindObjectProxy:
1719
1886
  case Builtin::KindLocalObject:
@@ -1728,7 +1895,7 @@ Slice::Python::CodeVisitor::writeInitializer(const DataMemberPtr& m)
1728
1895
  EnumPtr en = EnumPtr::dynamicCast(p);
1729
1896
  if(en)
1730
1897
  {
1731
- EnumeratorList enums = en->getEnumerators();
1898
+ EnumeratorList enums = en->enumerators();
1732
1899
  _out << getSymbol(en) << "." << fixIdent(enums.front()->name());
1733
1900
  return;
1734
1901
  }
@@ -1875,274 +2042,17 @@ Slice::Python::CodeVisitor::writeConstantValue(const TypePtr& type, const Syntax
1875
2042
  }
1876
2043
  case Slice::Builtin::KindString:
1877
2044
  {
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
2023
-
2024
- for(size_t i = 0; i < value.size();)
2025
- {
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
-
2045
+ string sv2 = toStringLiteral(value, "\a\b\f\n\r\t\v", "", Octal, 0);
2046
+ string sv3 = toStringLiteral(value, "\a\b\f\n\r\t\v", "", UCN, 0);
2138
2047
 
2139
- _out << "\"" << sv2.str() << "\"";
2140
- if(sv2.str() != sv3.str())
2048
+ _out << "\"" << sv2<< "\"";
2049
+ if(sv2 != sv3)
2141
2050
  {
2142
- _out << " if _version_info_[0] < 3 else \"" << sv3.str() << "\"";
2051
+ _out << " if _version_info_[0] < 3 else \"" << sv3 << "\"";
2143
2052
  }
2144
2053
  break;
2145
2054
  }
2055
+ case Slice::Builtin::KindValue:
2146
2056
  case Slice::Builtin::KindObject:
2147
2057
  case Slice::Builtin::KindObjectProxy:
2148
2058
  case Slice::Builtin::KindLocalObject:
@@ -2151,18 +2061,9 @@ Slice::Python::CodeVisitor::writeConstantValue(const TypePtr& type, const Syntax
2151
2061
  }
2152
2062
  else if(en)
2153
2063
  {
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;
2064
+ EnumeratorPtr lte = EnumeratorPtr::dynamicCast(valueType);
2065
+ assert(lte);
2066
+ _out << getSymbol(lte);
2166
2067
  }
2167
2068
  else
2168
2069
  {
@@ -2419,6 +2320,15 @@ Slice::Python::CodeVisitor::stripMarkup(const string& comment)
2419
2320
  start = text.size();
2420
2321
  }
2421
2322
 
2323
+ //
2324
+ // Remove trailing whitespace
2325
+ //
2326
+ pos = line.find_last_not_of(" \t");
2327
+ if(pos != string::npos)
2328
+ {
2329
+ line.erase(pos + 1, line.size() - pos - 1);
2330
+ }
2331
+
2422
2332
  lines.push_back(line);
2423
2333
 
2424
2334
  start = text.find_first_not_of("\r\n", start);
@@ -2781,7 +2691,7 @@ Slice::Python::CodeVisitor::writeDocstring(const OperationPtr& op, DocstringMode
2781
2691
  {
2782
2692
  return;
2783
2693
  }
2784
- else if(mode == DocAsyncBegin && inParams.empty())
2694
+ else if((mode == DocAsync || mode == DocAsyncBegin) && inParams.empty())
2785
2695
  {
2786
2696
  return;
2787
2697
  }
@@ -2814,6 +2724,7 @@ Slice::Python::CodeVisitor::writeDocstring(const OperationPtr& op, DocstringMode
2814
2724
  switch(mode)
2815
2725
  {
2816
2726
  case DocSync:
2727
+ case DocAsync:
2817
2728
  case DocAsyncBegin:
2818
2729
  case DocDispatch:
2819
2730
  needArgs = !local || !inParams.empty();
@@ -2827,10 +2738,6 @@ Slice::Python::CodeVisitor::writeDocstring(const OperationPtr& op, DocstringMode
2827
2738
  if(needArgs)
2828
2739
  {
2829
2740
  _out << nl << "Arguments:";
2830
- if(mode == DocAsyncDispatch)
2831
- {
2832
- _out << nl << "_cb -- The asynchronous callback object.";
2833
- }
2834
2741
  for(vector<string>::iterator q = inParams.begin(); q != inParams.end(); ++q)
2835
2742
  {
2836
2743
  string fixed = fixIdent(*q);
@@ -2851,13 +2758,15 @@ Slice::Python::CodeVisitor::writeDocstring(const OperationPtr& op, DocstringMode
2851
2758
  << nl << "_ex -- The asynchronous exception callback."
2852
2759
  << nl << "_sent -- The asynchronous sent callback.";
2853
2760
  }
2854
- if(!local && (mode == DocSync || mode == DocAsyncBegin))
2761
+ if(!local && (mode == DocSync || mode == DocAsync || mode == DocAsyncBegin))
2855
2762
  {
2856
- _out << nl << "_ctx -- The request context for the invocation.";
2763
+ const string contextParamName = getEscapedParamName(op, "context");
2764
+ _out << nl << contextParamName << " -- The request context for the invocation.";
2857
2765
  }
2858
2766
  if(!local && (mode == DocDispatch || mode == DocAsyncDispatch))
2859
2767
  {
2860
- _out << nl << "current -- The Current object for the invocation.";
2768
+ const string currentParamName = getEscapedParamName(op, "current");
2769
+ _out << nl << currentParamName << " -- The Current object for the invocation.";
2861
2770
  }
2862
2771
  }
2863
2772
  else if(mode == DocAsyncEnd)
@@ -2869,6 +2778,10 @@ Slice::Python::CodeVisitor::writeDocstring(const OperationPtr& op, DocstringMode
2869
2778
  //
2870
2779
  // Emit return value(s).
2871
2780
  //
2781
+ if(mode == DocAsync || mode == DocAsyncDispatch)
2782
+ {
2783
+ _out << nl << "Returns: A future object for the invocation.";
2784
+ }
2872
2785
  if(mode == DocAsyncBegin)
2873
2786
  {
2874
2787
  _out << nl << "Returns: An asynchronous result object for the invocation.";
@@ -2935,8 +2848,81 @@ Slice::Python::CodeVisitor::writeDocstring(const OperationPtr& op, DocstringMode
2935
2848
  _out << nl << "\"\"\"";
2936
2849
  }
2937
2850
 
2851
+ string
2852
+ Slice::Python::getPackageDirectory(const string& file, const UnitPtr& unit)
2853
+ {
2854
+ //
2855
+ // file must be a fully-qualified path name.
2856
+ //
2857
+
2858
+ //
2859
+ // Check if the file contains the python:pkgdir global metadata.
2860
+ //
2861
+ DefinitionContextPtr dc = unit->findDefinitionContext(file);
2862
+ assert(dc);
2863
+ const string prefix = "python:pkgdir:";
2864
+ string pkgdir = dc->findMetaData(prefix);
2865
+ if(!pkgdir.empty())
2866
+ {
2867
+ //
2868
+ // The metadata is present, so the generated file was placed in the specified directory.
2869
+ //
2870
+ pkgdir = pkgdir.substr(prefix.size());
2871
+ assert(!pkgdir.empty()); // This situation should have been caught by MetaDataVisitor.
2872
+ }
2873
+ return pkgdir;
2874
+ }
2875
+
2876
+ string
2877
+ Slice::Python::getImportFileName(const string& file, const UnitPtr& unit, const vector<string>& includePaths)
2878
+ {
2879
+ //
2880
+ // The file and includePaths arguments must be fully-qualified path names.
2881
+ //
2882
+
2883
+ //
2884
+ // Check if the file contains the python:pkgdir global metadata.
2885
+ //
2886
+ string pkgdir = getPackageDirectory(file, unit);
2887
+ if(!pkgdir.empty())
2888
+ {
2889
+ //
2890
+ // The metadata is present, so the generated file was placed in the specified directory.
2891
+ //
2892
+ vector<string> names;
2893
+ IceUtilInternal::splitString(pkgdir, "/", names);
2894
+ assert(!names.empty());
2895
+ pkgdir = "";
2896
+ for(vector<string>::iterator p = names.begin(); p != names.end(); ++p)
2897
+ {
2898
+ if(p != names.begin())
2899
+ {
2900
+ pkgdir += ".";
2901
+ }
2902
+ pkgdir += fixIdent(*p);
2903
+ }
2904
+ string::size_type pos = file.rfind('/');
2905
+ assert(pos != string::npos);
2906
+ string name = file.substr(pos + 1); // Get the name of the file without the leading path.
2907
+ assert(!name.empty());
2908
+ replace(name.begin(), name.end(), '.', '_'); // Convert .ice to _ice
2909
+ return pkgdir + "." + name;
2910
+ }
2911
+ else
2912
+ {
2913
+ //
2914
+ // The metadata is not present, so we transform the file name using the include paths (-I)
2915
+ // given to the compiler.
2916
+ //
2917
+ string name = changeInclude(file, includePaths);
2918
+ replace(name.begin(), name.end(), '/', '_');
2919
+ return name + "_ice";
2920
+ }
2921
+ }
2922
+
2938
2923
  void
2939
- Slice::Python::generate(const UnitPtr& un, bool all, bool checksum, const vector<string>& includePaths, Output& out)
2924
+ Slice::Python::generate(const UnitPtr& un, bool all, bool checksum, const vector<string>& includePaths,
2925
+ Output& out)
2940
2926
  {
2941
2927
  Slice::Python::MetaDataVisitor visitor;
2942
2928
  un->visit(&visitor, false);
@@ -2955,9 +2941,7 @@ Slice::Python::generate(const UnitPtr& un, bool all, bool checksum, const vector
2955
2941
  StringList includes = un->includeFiles();
2956
2942
  for(StringList::const_iterator q = includes.begin(); q != includes.end(); ++q)
2957
2943
  {
2958
- string file = changeInclude(*q, paths);
2959
- replace(file.begin(), file.end(), '/', '_');
2960
- out << nl << "import " << file << "_ice";
2944
+ out << nl << "import " << getImportFileName(*q, un, paths);
2961
2945
  }
2962
2946
  }
2963
2947
 
@@ -3064,14 +3048,7 @@ Slice::Python::getAbsolute(const ContainedPtr& cont, const string& suffix, const
3064
3048
  }
3065
3049
  }
3066
3050
 
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
- }
3051
+ return scope + suffix + fixIdent(cont->name() + nameSuffix);
3075
3052
  }
3076
3053
 
3077
3054
  void
@@ -3080,7 +3057,7 @@ Slice::Python::printHeader(IceUtilInternal::Output& out)
3080
3057
  static const char* header =
3081
3058
  "# **********************************************************************\n"
3082
3059
  "#\n"
3083
- "# Copyright (c) 2003-2018 ZeroC, Inc. All rights reserved.\n"
3060
+ "# Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.\n"
3084
3061
  "#\n"
3085
3062
  "# This copy of Ice is licensed to you under the terms described in the\n"
3086
3063
  "# ICE_LICENSE file included in this distribution.\n"
@@ -3103,30 +3080,33 @@ Slice::Python::MetaDataVisitor::visitUnitStart(const UnitPtr& p)
3103
3080
  // Validate global metadata in the top-level file and all included files.
3104
3081
  //
3105
3082
  StringList files = p->allFiles();
3106
-
3107
3083
  for(StringList::iterator q = files.begin(); q != files.end(); ++q)
3108
3084
  {
3109
3085
  string file = *q;
3110
3086
  DefinitionContextPtr dc = p->findDefinitionContext(file);
3111
3087
  assert(dc);
3112
3088
  StringList globalMetaData = dc->getMetaData();
3113
- for(StringList::const_iterator r = globalMetaData.begin(); r != globalMetaData.end(); ++r)
3089
+ for(StringList::const_iterator r = globalMetaData.begin(); r != globalMetaData.end();)
3114
3090
  {
3115
- string s = *r;
3116
- if(_history.count(s) == 0)
3091
+ string s = *r++;
3092
+ if(s.find(prefix) == 0)
3117
3093
  {
3118
- _history.insert(s);
3119
- if(s.find(prefix) == 0)
3094
+ static const string packagePrefix = "python:package:";
3095
+ if(s.find(packagePrefix) == 0 && s.size() > packagePrefix.size())
3120
3096
  {
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 + "'");
3097
+ continue;
3098
+ }
3099
+ static const string pkgdirPrefix = "python:pkgdir:";
3100
+ if(s.find(pkgdirPrefix) == 0 && s.size() > pkgdirPrefix.size())
3101
+ {
3102
+ continue;
3127
3103
  }
3104
+
3105
+ dc->warning(InvalidMetaData, file, "", "ignoring invalid global metadata `" + s + "'");
3106
+ globalMetaData.remove(s);
3128
3107
  }
3129
3108
  }
3109
+ dc->setMetaData(globalMetaData);
3130
3110
  }
3131
3111
  return true;
3132
3112
  }
@@ -3194,6 +3174,11 @@ Slice::Python::MetaDataVisitor::visitSequence(const SequencePtr& p)
3194
3174
  StringList metaData = p->getMetaData();
3195
3175
  const string file = p->file();
3196
3176
  const string line = p->line();
3177
+ StringList protobufMetaData;
3178
+ const UnitPtr unit = p->unit();
3179
+ const DefinitionContextPtr dc = unit->findDefinitionContext(file);
3180
+ assert(dc);
3181
+
3197
3182
  for(StringList::const_iterator q = metaData.begin(); q != metaData.end(); )
3198
3183
  {
3199
3184
  string s = *q++;
@@ -3203,17 +3188,22 @@ Slice::Python::MetaDataVisitor::visitSequence(const SequencePtr& p)
3203
3188
  // Remove from list so validateSequence does not try to handle as well.
3204
3189
  //
3205
3190
  metaData.remove(s);
3206
-
3207
3191
  BuiltinPtr builtin = BuiltinPtr::dynamicCast(p->type());
3208
3192
  if(!builtin || builtin->kind() != Builtin::KindByte)
3209
3193
  {
3210
- emitWarning(file, line, "ignoring invalid metadata `" + s + ": " +
3194
+ dc->warning(InvalidMetaData, file, line, "ignoring invalid metadata `" + s + ": " +
3211
3195
  "`protobuf' encoding must be a byte sequence");
3212
3196
  }
3197
+ else
3198
+ {
3199
+ protobufMetaData.push_back(s);
3200
+ }
3213
3201
  }
3214
3202
  }
3215
3203
 
3216
- validateSequence(file, line, p, metaData);
3204
+ metaData = validateSequence(file, line, p, metaData);
3205
+ metaData.insert(metaData.end(), protobufMetaData.begin(), protobufMetaData.end());
3206
+ p->setMetaData(metaData);
3217
3207
  }
3218
3208
 
3219
3209
  void
@@ -3234,15 +3224,19 @@ Slice::Python::MetaDataVisitor::visitConst(const ConstPtr& p)
3234
3224
  reject(p);
3235
3225
  }
3236
3226
 
3237
- void
3227
+ StringList
3238
3228
  Slice::Python::MetaDataVisitor::validateSequence(const string& file, const string& line,
3239
- const TypePtr& type, const StringList& meta)
3229
+ const TypePtr& type, const StringList& metaData)
3240
3230
  {
3241
- static const string prefix = "python:";
3231
+ const UnitPtr unit = type->unit();
3232
+ const DefinitionContextPtr dc = unit->findDefinitionContext(file);
3233
+ assert(dc);
3242
3234
 
3243
- for(StringList::const_iterator p = meta.begin(); p != meta.end(); ++p)
3235
+ static const string prefix = "python:";
3236
+ StringList newMetaData = metaData;
3237
+ for(StringList::const_iterator p = newMetaData.begin(); p != newMetaData.end();)
3244
3238
  {
3245
- string s = *p;
3239
+ string s = *p++;
3246
3240
  if(s.find(prefix) == 0)
3247
3241
  {
3248
3242
  string::size_type pos = s.find(':', prefix.size());
@@ -3258,9 +3252,11 @@ Slice::Python::MetaDataVisitor::validateSequence(const string& file, const strin
3258
3252
  }
3259
3253
  }
3260
3254
  }
3261
- emitWarning(file, line, "ignoring invalid metadata `" + s + "'");
3255
+ dc->warning(InvalidMetaData, file, line, "ignoring invalid metadata `" + s + "'");
3256
+ newMetaData.remove(s);
3262
3257
  }
3263
3258
  }
3259
+ return newMetaData;
3264
3260
  }
3265
3261
 
3266
3262
  void
@@ -3268,11 +3264,19 @@ Slice::Python::MetaDataVisitor::reject(const ContainedPtr& cont)
3268
3264
  {
3269
3265
  StringList localMetaData = cont->getMetaData();
3270
3266
  static const string prefix = "python:";
3271
- for(StringList::const_iterator p = localMetaData.begin(); p != localMetaData.end(); ++p)
3267
+
3268
+ const UnitPtr unit = cont->unit();
3269
+ const DefinitionContextPtr dc = unit->findDefinitionContext(cont->file());
3270
+ assert(dc);
3271
+
3272
+ for(StringList::const_iterator p = localMetaData.begin(); p != localMetaData.end();)
3272
3273
  {
3273
- if(p->find(prefix) == 0)
3274
+ string s = *p++;
3275
+ if(s.find(prefix) == 0)
3274
3276
  {
3275
- emitWarning(cont->file(), cont->line(), "ignoring invalid metadata `" + *p + "'");
3277
+ dc->warning(InvalidMetaData, cont->file(), cont->line(), "ignoring invalid metadata `" + s + "'");
3278
+ localMetaData.remove(s);
3276
3279
  }
3277
3280
  }
3281
+ cont->setMetaData(localMetaData);
3278
3282
  }