zeroc-ice 3.6b1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (675) hide show
  1. checksums.yaml +7 -0
  2. data/ICE_LICENSE +54 -0
  3. data/LICENSE +339 -0
  4. data/bin/slice2rb +17 -0
  5. data/ext/Communicator.cpp +596 -0
  6. data/ext/Communicator.h +25 -0
  7. data/ext/Config.h +111 -0
  8. data/ext/Connection.cpp +381 -0
  9. data/ext/Connection.h +26 -0
  10. data/ext/Endpoint.cpp +311 -0
  11. data/ext/Endpoint.h +27 -0
  12. data/ext/ImplicitContext.cpp +152 -0
  13. data/ext/ImplicitContext.h +25 -0
  14. data/ext/Init.cpp +52 -0
  15. data/ext/Logger.cpp +151 -0
  16. data/ext/Logger.h +28 -0
  17. data/ext/ObjectFactory.cpp +140 -0
  18. data/ext/ObjectFactory.h +50 -0
  19. data/ext/Operation.cpp +676 -0
  20. data/ext/Operation.h +36 -0
  21. data/ext/Properties.cpp +369 -0
  22. data/ext/Properties.h +25 -0
  23. data/ext/Proxy.cpp +1354 -0
  24. data/ext/Proxy.h +27 -0
  25. data/ext/Slice.cpp +223 -0
  26. data/ext/Slice.h +22 -0
  27. data/ext/Types.cpp +3160 -0
  28. data/ext/Types.h +545 -0
  29. data/ext/Util.cpp +792 -0
  30. data/ext/Util.h +511 -0
  31. data/ext/extconf.rb +118 -0
  32. data/ext/ice/BZIP_LICENSE +42 -0
  33. data/ext/ice/MCPP_LICENSE +36 -0
  34. data/ext/ice/bzip2/blocksort.c +1094 -0
  35. data/ext/ice/bzip2/bzlib.c +1572 -0
  36. data/ext/ice/bzip2/bzlib.h +282 -0
  37. data/ext/ice/bzip2/bzlib_private.h +509 -0
  38. data/ext/ice/bzip2/compress.c +672 -0
  39. data/ext/ice/bzip2/crctable.c +104 -0
  40. data/ext/ice/bzip2/decompress.c +646 -0
  41. data/ext/ice/bzip2/huffman.c +205 -0
  42. data/ext/ice/bzip2/randtable.c +84 -0
  43. data/ext/ice/cpp/include/Ice/ACMF.h +30 -0
  44. data/ext/ice/cpp/include/Ice/Application.h +156 -0
  45. data/ext/ice/cpp/include/Ice/AsyncResult.h +363 -0
  46. data/ext/ice/cpp/include/Ice/AsyncResultF.h +26 -0
  47. data/ext/ice/cpp/include/Ice/BasicStream.h +1315 -0
  48. data/ext/ice/cpp/include/Ice/Buffer.h +159 -0
  49. data/ext/ice/cpp/include/Ice/BuiltinSequences.h +74 -0
  50. data/ext/ice/cpp/include/Ice/Communicator.h +194 -0
  51. data/ext/ice/cpp/include/Ice/CommunicatorAsync.h +115 -0
  52. data/ext/ice/cpp/include/Ice/CommunicatorF.h +60 -0
  53. data/ext/ice/cpp/include/Ice/Config.h +97 -0
  54. data/ext/ice/cpp/include/Ice/Connection.h +495 -0
  55. data/ext/ice/cpp/include/Ice/ConnectionAsync.h +115 -0
  56. data/ext/ice/cpp/include/Ice/ConnectionF.h +72 -0
  57. data/ext/ice/cpp/include/Ice/ConnectionFactoryF.h +30 -0
  58. data/ext/ice/cpp/include/Ice/ConnectionIF.h +37 -0
  59. data/ext/ice/cpp/include/Ice/Current.h +94 -0
  60. data/ext/ice/cpp/include/Ice/DefaultObjectFactory.h +48 -0
  61. data/ext/ice/cpp/include/Ice/DeprecatedStringConverter.h +62 -0
  62. data/ext/ice/cpp/include/Ice/DispatchInterceptor.h +33 -0
  63. data/ext/ice/cpp/include/Ice/Dispatcher.h +51 -0
  64. data/ext/ice/cpp/include/Ice/DynamicLibrary.h +105 -0
  65. data/ext/ice/cpp/include/Ice/DynamicLibraryF.h +29 -0
  66. data/ext/ice/cpp/include/Ice/Endpoint.h +350 -0
  67. data/ext/ice/cpp/include/Ice/EndpointF.h +97 -0
  68. data/ext/ice/cpp/include/Ice/EndpointTypes.h +74 -0
  69. data/ext/ice/cpp/include/Ice/Exception.h +114 -0
  70. data/ext/ice/cpp/include/Ice/FacetMap.h +56 -0
  71. data/ext/ice/cpp/include/Ice/FactoryTable.h +69 -0
  72. data/ext/ice/cpp/include/Ice/FactoryTableInit.h +87 -0
  73. data/ext/ice/cpp/include/Ice/Format.h +39 -0
  74. data/ext/ice/cpp/include/Ice/Functional.h +138 -0
  75. data/ext/ice/cpp/include/Ice/GCObject.h +73 -0
  76. data/ext/ice/cpp/include/Ice/Handle.h +192 -0
  77. data/ext/ice/cpp/include/Ice/Ice.h +54 -0
  78. data/ext/ice/cpp/include/Ice/Identity.h +160 -0
  79. data/ext/ice/cpp/include/Ice/ImplicitContext.h +96 -0
  80. data/ext/ice/cpp/include/Ice/ImplicitContextF.h +60 -0
  81. data/ext/ice/cpp/include/Ice/Incoming.h +131 -0
  82. data/ext/ice/cpp/include/Ice/IncomingAsync.h +108 -0
  83. data/ext/ice/cpp/include/Ice/IncomingAsyncF.h +35 -0
  84. data/ext/ice/cpp/include/Ice/Initialize.h +141 -0
  85. data/ext/ice/cpp/include/Ice/InstanceF.h +26 -0
  86. data/ext/ice/cpp/include/Ice/Instrumentation.h +377 -0
  87. data/ext/ice/cpp/include/Ice/InstrumentationF.h +71 -0
  88. data/ext/ice/cpp/include/Ice/LocalException.h +1022 -0
  89. data/ext/ice/cpp/include/Ice/LocalObject.h +36 -0
  90. data/ext/ice/cpp/include/Ice/LocalObjectF.h +26 -0
  91. data/ext/ice/cpp/include/Ice/Locator.h +2191 -0
  92. data/ext/ice/cpp/include/Ice/LocatorF.h +89 -0
  93. data/ext/ice/cpp/include/Ice/Logger.h +94 -0
  94. data/ext/ice/cpp/include/Ice/LoggerF.h +60 -0
  95. data/ext/ice/cpp/include/Ice/LoggerUtil.h +153 -0
  96. data/ext/ice/cpp/include/Ice/Makefile +26 -0
  97. data/ext/ice/cpp/include/Ice/Metrics.h +2989 -0
  98. data/ext/ice/cpp/include/Ice/MetricsAdminI.h +662 -0
  99. data/ext/ice/cpp/include/Ice/MetricsFunctional.h +144 -0
  100. data/ext/ice/cpp/include/Ice/MetricsObserverI.h +576 -0
  101. data/ext/ice/cpp/include/Ice/NativePropertiesAdmin.h +55 -0
  102. data/ext/ice/cpp/include/Ice/Object.h +165 -0
  103. data/ext/ice/cpp/include/Ice/ObjectAdapter.h +162 -0
  104. data/ext/ice/cpp/include/Ice/ObjectAdapterF.h +60 -0
  105. data/ext/ice/cpp/include/Ice/ObjectAdapterFactoryF.h +26 -0
  106. data/ext/ice/cpp/include/Ice/ObjectF.h +26 -0
  107. data/ext/ice/cpp/include/Ice/ObjectFactory.h +86 -0
  108. data/ext/ice/cpp/include/Ice/ObjectFactoryF.h +60 -0
  109. data/ext/ice/cpp/include/Ice/ObjectFactoryManagerF.h +26 -0
  110. data/ext/ice/cpp/include/Ice/ObserverHelper.h +177 -0
  111. data/ext/ice/cpp/include/Ice/Outgoing.h +197 -0
  112. data/ext/ice/cpp/include/Ice/OutgoingAsync.h +264 -0
  113. data/ext/ice/cpp/include/Ice/OutgoingAsyncF.h +38 -0
  114. data/ext/ice/cpp/include/Ice/Plugin.h +121 -0
  115. data/ext/ice/cpp/include/Ice/PluginF.h +66 -0
  116. data/ext/ice/cpp/include/Ice/Process.h +568 -0
  117. data/ext/ice/cpp/include/Ice/ProcessF.h +77 -0
  118. data/ext/ice/cpp/include/Ice/Properties.h +130 -0
  119. data/ext/ice/cpp/include/Ice/PropertiesAdmin.h +824 -0
  120. data/ext/ice/cpp/include/Ice/PropertiesF.h +83 -0
  121. data/ext/ice/cpp/include/Ice/Protocol.h +242 -0
  122. data/ext/ice/cpp/include/Ice/Proxy.h +2448 -0
  123. data/ext/ice/cpp/include/Ice/ProxyF.h +78 -0
  124. data/ext/ice/cpp/include/Ice/ProxyFactoryF.h +26 -0
  125. data/ext/ice/cpp/include/Ice/ProxyHandle.h +330 -0
  126. data/ext/ice/cpp/include/Ice/ReferenceF.h +34 -0
  127. data/ext/ice/cpp/include/Ice/RemoteLogger.h +1496 -0
  128. data/ext/ice/cpp/include/Ice/RequestHandlerF.h +29 -0
  129. data/ext/ice/cpp/include/Ice/ResponseHandlerF.h +25 -0
  130. data/ext/ice/cpp/include/Ice/Router.h +1155 -0
  131. data/ext/ice/cpp/include/Ice/RouterF.h +77 -0
  132. data/ext/ice/cpp/include/Ice/ServantLocator.h +90 -0
  133. data/ext/ice/cpp/include/Ice/ServantLocatorF.h +60 -0
  134. data/ext/ice/cpp/include/Ice/ServantManagerF.h +26 -0
  135. data/ext/ice/cpp/include/Ice/Service.h +260 -0
  136. data/ext/ice/cpp/include/Ice/SliceChecksumDict.h +56 -0
  137. data/ext/ice/cpp/include/Ice/SliceChecksums.h +34 -0
  138. data/ext/ice/cpp/include/Ice/SlicedData.h +103 -0
  139. data/ext/ice/cpp/include/Ice/SlicedDataF.h +34 -0
  140. data/ext/ice/cpp/include/Ice/Stream.h +449 -0
  141. data/ext/ice/cpp/include/Ice/StreamF.h +30 -0
  142. data/ext/ice/cpp/include/Ice/StreamHelpers.h +877 -0
  143. data/ext/ice/cpp/include/Ice/ThreadPoolF.h +28 -0
  144. data/ext/ice/cpp/include/Ice/UserExceptionFactory.h +56 -0
  145. data/ext/ice/cpp/include/Ice/Version.h +254 -0
  146. data/ext/ice/cpp/include/IceSSL/Config.h +23 -0
  147. data/ext/ice/cpp/include/IceSSL/ConnectionInfo.h +119 -0
  148. data/ext/ice/cpp/include/IceSSL/EndpointInfo.h +101 -0
  149. data/ext/ice/cpp/include/IceSSL/IceSSL.h +22 -0
  150. data/ext/ice/cpp/include/IceSSL/Makefile +26 -0
  151. data/ext/ice/cpp/include/IceSSL/Plugin.h +558 -0
  152. data/ext/ice/cpp/include/IceUtil/AbstractMutex.h +119 -0
  153. data/ext/ice/cpp/include/IceUtil/Cache.h +362 -0
  154. data/ext/ice/cpp/include/IceUtil/Cond.h +323 -0
  155. data/ext/ice/cpp/include/IceUtil/Config.h +234 -0
  156. data/ext/ice/cpp/include/IceUtil/CountDownLatch.h +50 -0
  157. data/ext/ice/cpp/include/IceUtil/CtrlCHandler.h +70 -0
  158. data/ext/ice/cpp/include/IceUtil/DisableWarnings.h +45 -0
  159. data/ext/ice/cpp/include/IceUtil/Exception.h +184 -0
  160. data/ext/ice/cpp/include/IceUtil/Functional.h +389 -0
  161. data/ext/ice/cpp/include/IceUtil/Handle.h +266 -0
  162. data/ext/ice/cpp/include/IceUtil/IceUtil.h +51 -0
  163. data/ext/ice/cpp/include/IceUtil/IconvStringConverter.h +302 -0
  164. data/ext/ice/cpp/include/IceUtil/InputUtil.h +47 -0
  165. data/ext/ice/cpp/include/IceUtil/Iterator.h +36 -0
  166. data/ext/ice/cpp/include/IceUtil/Lock.h +135 -0
  167. data/ext/ice/cpp/include/IceUtil/Makefile +26 -0
  168. data/ext/ice/cpp/include/IceUtil/Monitor.h +249 -0
  169. data/ext/ice/cpp/include/IceUtil/Mutex.h +357 -0
  170. data/ext/ice/cpp/include/IceUtil/MutexProtocol.h +28 -0
  171. data/ext/ice/cpp/include/IceUtil/MutexPtrLock.h +83 -0
  172. data/ext/ice/cpp/include/IceUtil/MutexPtrTryLock.h +82 -0
  173. data/ext/ice/cpp/include/IceUtil/Optional.h +322 -0
  174. data/ext/ice/cpp/include/IceUtil/Options.h +141 -0
  175. data/ext/ice/cpp/include/IceUtil/OutputUtil.h +362 -0
  176. data/ext/ice/cpp/include/IceUtil/PopDisableWarnings.h +19 -0
  177. data/ext/ice/cpp/include/IceUtil/PushDisableWarnings.h +26 -0
  178. data/ext/ice/cpp/include/IceUtil/Random.h +24 -0
  179. data/ext/ice/cpp/include/IceUtil/RecMutex.h +113 -0
  180. data/ext/ice/cpp/include/IceUtil/SHA1.h +65 -0
  181. data/ext/ice/cpp/include/IceUtil/ScannerConfig.h +44 -0
  182. data/ext/ice/cpp/include/IceUtil/ScopedArray.h +97 -0
  183. data/ext/ice/cpp/include/IceUtil/Shared.h +168 -0
  184. data/ext/ice/cpp/include/IceUtil/StringConverter.h +175 -0
  185. data/ext/ice/cpp/include/IceUtil/StringUtil.h +91 -0
  186. data/ext/ice/cpp/include/IceUtil/Thread.h +181 -0
  187. data/ext/ice/cpp/include/IceUtil/ThreadException.h +108 -0
  188. data/ext/ice/cpp/include/IceUtil/Time.h +209 -0
  189. data/ext/ice/cpp/include/IceUtil/Timer.h +143 -0
  190. data/ext/ice/cpp/include/IceUtil/UUID.h +22 -0
  191. data/ext/ice/cpp/include/IceUtil/UndefSysMacros.h +42 -0
  192. data/ext/ice/cpp/include/IceUtil/UniquePtr.h +101 -0
  193. data/ext/ice/cpp/include/Slice/CPlusPlusUtil.h +64 -0
  194. data/ext/ice/cpp/include/Slice/Checksum.h +26 -0
  195. data/ext/ice/cpp/include/Slice/CsUtil.h +92 -0
  196. data/ext/ice/cpp/include/Slice/DotNetNames.h +34 -0
  197. data/ext/ice/cpp/include/Slice/FileTracker.h +71 -0
  198. data/ext/ice/cpp/include/Slice/JavaUtil.h +277 -0
  199. data/ext/ice/cpp/include/Slice/Makefile +26 -0
  200. data/ext/ice/cpp/include/Slice/PHPUtil.h +50 -0
  201. data/ext/ice/cpp/include/Slice/Parser.h +1116 -0
  202. data/ext/ice/cpp/include/Slice/Preprocessor.h +68 -0
  203. data/ext/ice/cpp/include/Slice/PythonUtil.h +64 -0
  204. data/ext/ice/cpp/include/Slice/RubyUtil.h +54 -0
  205. data/ext/ice/cpp/include/Slice/Util.h +33 -0
  206. data/ext/ice/cpp/src/Ice/ACM.cpp +343 -0
  207. data/ext/ice/cpp/src/Ice/ACM.h +117 -0
  208. data/ext/ice/cpp/src/Ice/Acceptor.cpp +16 -0
  209. data/ext/ice/cpp/src/Ice/Acceptor.h +41 -0
  210. data/ext/ice/cpp/src/Ice/AcceptorF.h +30 -0
  211. data/ext/ice/cpp/src/Ice/Application.cpp +760 -0
  212. data/ext/ice/cpp/src/Ice/AsyncResult.cpp +599 -0
  213. data/ext/ice/cpp/src/Ice/Base64.cpp +269 -0
  214. data/ext/ice/cpp/src/Ice/Base64.h +36 -0
  215. data/ext/ice/cpp/src/Ice/BasicStream.cpp +3393 -0
  216. data/ext/ice/cpp/src/Ice/Buffer.cpp +98 -0
  217. data/ext/ice/cpp/src/Ice/BuiltinSequences.cpp +34 -0
  218. data/ext/ice/cpp/src/Ice/CollocatedRequestHandler.cpp +718 -0
  219. data/ext/ice/cpp/src/Ice/CollocatedRequestHandler.h +106 -0
  220. data/ext/ice/cpp/src/Ice/Communicator.cpp +45 -0
  221. data/ext/ice/cpp/src/Ice/CommunicatorF.cpp +38 -0
  222. data/ext/ice/cpp/src/Ice/CommunicatorI.cpp +386 -0
  223. data/ext/ice/cpp/src/Ice/CommunicatorI.h +112 -0
  224. data/ext/ice/cpp/src/Ice/ConnectRequestHandler.cpp +546 -0
  225. data/ext/ice/cpp/src/Ice/ConnectRequestHandler.h +97 -0
  226. data/ext/ice/cpp/src/Ice/Connection.cpp +58 -0
  227. data/ext/ice/cpp/src/Ice/ConnectionF.cpp +38 -0
  228. data/ext/ice/cpp/src/Ice/ConnectionFactory.cpp +1639 -0
  229. data/ext/ice/cpp/src/Ice/ConnectionFactory.h +236 -0
  230. data/ext/ice/cpp/src/Ice/ConnectionI.cpp +3876 -0
  231. data/ext/ice/cpp/src/Ice/ConnectionI.h +364 -0
  232. data/ext/ice/cpp/src/Ice/ConnectionRequestHandler.cpp +115 -0
  233. data/ext/ice/cpp/src/Ice/ConnectionRequestHandler.h +50 -0
  234. data/ext/ice/cpp/src/Ice/Connector.cpp +16 -0
  235. data/ext/ice/cpp/src/Ice/Connector.h +36 -0
  236. data/ext/ice/cpp/src/Ice/ConnectorF.h +26 -0
  237. data/ext/ice/cpp/src/Ice/Current.cpp +38 -0
  238. data/ext/ice/cpp/src/Ice/DefaultsAndOverrides.cpp +168 -0
  239. data/ext/ice/cpp/src/Ice/DefaultsAndOverrides.h +57 -0
  240. data/ext/ice/cpp/src/Ice/DefaultsAndOverridesF.h +26 -0
  241. data/ext/ice/cpp/src/Ice/DeprecatedStringConverter.cpp +60 -0
  242. data/ext/ice/cpp/src/Ice/DispatchInterceptor.cpp +49 -0
  243. data/ext/ice/cpp/src/Ice/DynamicLibrary.cpp +281 -0
  244. data/ext/ice/cpp/src/Ice/Endpoint.cpp +53 -0
  245. data/ext/ice/cpp/src/Ice/EndpointF.cpp +38 -0
  246. data/ext/ice/cpp/src/Ice/EndpointFactory.cpp +25 -0
  247. data/ext/ice/cpp/src/Ice/EndpointFactory.h +44 -0
  248. data/ext/ice/cpp/src/Ice/EndpointFactoryF.h +26 -0
  249. data/ext/ice/cpp/src/Ice/EndpointFactoryManager.cpp +208 -0
  250. data/ext/ice/cpp/src/Ice/EndpointFactoryManager.h +46 -0
  251. data/ext/ice/cpp/src/Ice/EndpointFactoryManagerF.h +26 -0
  252. data/ext/ice/cpp/src/Ice/EndpointI.cpp +87 -0
  253. data/ext/ice/cpp/src/Ice/EndpointI.h +165 -0
  254. data/ext/ice/cpp/src/Ice/EndpointIF.h +41 -0
  255. data/ext/ice/cpp/src/Ice/EndpointTypes.cpp +38 -0
  256. data/ext/ice/cpp/src/Ice/EventHandler.cpp +35 -0
  257. data/ext/ice/cpp/src/Ice/EventHandler.h +78 -0
  258. data/ext/ice/cpp/src/Ice/EventHandlerF.h +26 -0
  259. data/ext/ice/cpp/src/Ice/EventLoggerMsg.h +53 -0
  260. data/ext/ice/cpp/src/Ice/Exception.cpp +832 -0
  261. data/ext/ice/cpp/src/Ice/FacetMap.cpp +34 -0
  262. data/ext/ice/cpp/src/Ice/FactoryTable.cpp +158 -0
  263. data/ext/ice/cpp/src/Ice/FactoryTableInit.cpp +95 -0
  264. data/ext/ice/cpp/src/Ice/GCObject.cpp +444 -0
  265. data/ext/ice/cpp/src/Ice/HashUtil.h +59 -0
  266. data/ext/ice/cpp/src/Ice/HttpParser.cpp +680 -0
  267. data/ext/ice/cpp/src/Ice/HttpParser.h +124 -0
  268. data/ext/ice/cpp/src/Ice/IPEndpointI.cpp +733 -0
  269. data/ext/ice/cpp/src/Ice/IPEndpointI.h +157 -0
  270. data/ext/ice/cpp/src/Ice/IPEndpointIF.h +29 -0
  271. data/ext/ice/cpp/src/Ice/Identity.cpp +42 -0
  272. data/ext/ice/cpp/src/Ice/ImplicitContext.cpp +41 -0
  273. data/ext/ice/cpp/src/Ice/ImplicitContextF.cpp +38 -0
  274. data/ext/ice/cpp/src/Ice/ImplicitContextI.cpp +639 -0
  275. data/ext/ice/cpp/src/Ice/ImplicitContextI.h +51 -0
  276. data/ext/ice/cpp/src/Ice/Incoming.cpp +757 -0
  277. data/ext/ice/cpp/src/Ice/IncomingAsync.cpp +340 -0
  278. data/ext/ice/cpp/src/Ice/IncomingRequest.h +37 -0
  279. data/ext/ice/cpp/src/Ice/Initialize.cpp +401 -0
  280. data/ext/ice/cpp/src/Ice/Instance.cpp +1928 -0
  281. data/ext/ice/cpp/src/Ice/Instance.h +198 -0
  282. data/ext/ice/cpp/src/Ice/Instrumentation.cpp +68 -0
  283. data/ext/ice/cpp/src/Ice/InstrumentationF.cpp +43 -0
  284. data/ext/ice/cpp/src/Ice/InstrumentationI.cpp +1083 -0
  285. data/ext/ice/cpp/src/Ice/InstrumentationI.h +262 -0
  286. data/ext/ice/cpp/src/Ice/LocalException.cpp +2091 -0
  287. data/ext/ice/cpp/src/Ice/LocalObject.cpp +29 -0
  288. data/ext/ice/cpp/src/Ice/Locator.cpp +1946 -0
  289. data/ext/ice/cpp/src/Ice/LocatorF.cpp +39 -0
  290. data/ext/ice/cpp/src/Ice/LocatorInfo.cpp +917 -0
  291. data/ext/ice/cpp/src/Ice/LocatorInfo.h +193 -0
  292. data/ext/ice/cpp/src/Ice/LocatorInfoF.h +34 -0
  293. data/ext/ice/cpp/src/Ice/Logger.cpp +40 -0
  294. data/ext/ice/cpp/src/Ice/LoggerAdminI.cpp +862 -0
  295. data/ext/ice/cpp/src/Ice/LoggerAdminI.h +46 -0
  296. data/ext/ice/cpp/src/Ice/LoggerF.cpp +38 -0
  297. data/ext/ice/cpp/src/Ice/LoggerI.cpp +199 -0
  298. data/ext/ice/cpp/src/Ice/LoggerI.h +57 -0
  299. data/ext/ice/cpp/src/Ice/LoggerUtil.cpp +107 -0
  300. data/ext/ice/cpp/src/Ice/Makefile +190 -0
  301. data/ext/ice/cpp/src/Ice/Metrics.cpp +2159 -0
  302. data/ext/ice/cpp/src/Ice/MetricsAdminI.cpp +669 -0
  303. data/ext/ice/cpp/src/Ice/MetricsObserverI.cpp +14 -0
  304. data/ext/ice/cpp/src/Ice/Network.cpp +2694 -0
  305. data/ext/ice/cpp/src/Ice/Network.h +291 -0
  306. data/ext/ice/cpp/src/Ice/NetworkF.h +28 -0
  307. data/ext/ice/cpp/src/Ice/NetworkProxy.cpp +325 -0
  308. data/ext/ice/cpp/src/Ice/NetworkProxy.h +74 -0
  309. data/ext/ice/cpp/src/Ice/NetworkProxyF.h +26 -0
  310. data/ext/ice/cpp/src/Ice/Object.cpp +440 -0
  311. data/ext/ice/cpp/src/Ice/ObjectAdapter.cpp +41 -0
  312. data/ext/ice/cpp/src/Ice/ObjectAdapterF.cpp +38 -0
  313. data/ext/ice/cpp/src/Ice/ObjectAdapterFactory.cpp +241 -0
  314. data/ext/ice/cpp/src/Ice/ObjectAdapterFactory.h +52 -0
  315. data/ext/ice/cpp/src/Ice/ObjectAdapterI.cpp +1498 -0
  316. data/ext/ice/cpp/src/Ice/ObjectAdapterI.h +155 -0
  317. data/ext/ice/cpp/src/Ice/ObjectFactory.cpp +41 -0
  318. data/ext/ice/cpp/src/Ice/ObjectFactoryF.cpp +38 -0
  319. data/ext/ice/cpp/src/Ice/ObjectFactoryManager.cpp +140 -0
  320. data/ext/ice/cpp/src/Ice/ObjectFactoryManager.h +43 -0
  321. data/ext/ice/cpp/src/Ice/ObserverHelper.cpp +84 -0
  322. data/ext/ice/cpp/src/Ice/OpaqueEndpointI.cpp +407 -0
  323. data/ext/ice/cpp/src/Ice/OpaqueEndpointI.h +70 -0
  324. data/ext/ice/cpp/src/Ice/Outgoing.cpp +737 -0
  325. data/ext/ice/cpp/src/Ice/OutgoingAsync.cpp +874 -0
  326. data/ext/ice/cpp/src/Ice/Plugin.cpp +43 -0
  327. data/ext/ice/cpp/src/Ice/PluginF.cpp +38 -0
  328. data/ext/ice/cpp/src/Ice/PluginManagerI.cpp +503 -0
  329. data/ext/ice/cpp/src/Ice/PluginManagerI.h +67 -0
  330. data/ext/ice/cpp/src/Ice/Process.cpp +299 -0
  331. data/ext/ice/cpp/src/Ice/ProcessF.cpp +39 -0
  332. data/ext/ice/cpp/src/Ice/Properties.cpp +45 -0
  333. data/ext/ice/cpp/src/Ice/PropertiesAdmin.cpp +555 -0
  334. data/ext/ice/cpp/src/Ice/PropertiesAdminI.cpp +207 -0
  335. data/ext/ice/cpp/src/Ice/PropertiesAdminI.h +45 -0
  336. data/ext/ice/cpp/src/Ice/PropertiesF.cpp +39 -0
  337. data/ext/ice/cpp/src/Ice/PropertiesI.cpp +759 -0
  338. data/ext/ice/cpp/src/Ice/PropertiesI.h +78 -0
  339. data/ext/ice/cpp/src/Ice/PropertyNames.cpp +1293 -0
  340. data/ext/ice/cpp/src/Ice/PropertyNames.h +81 -0
  341. data/ext/ice/cpp/src/Ice/Protocol.cpp +137 -0
  342. data/ext/ice/cpp/src/Ice/ProtocolInstance.cpp +98 -0
  343. data/ext/ice/cpp/src/Ice/ProtocolInstance.h +91 -0
  344. data/ext/ice/cpp/src/Ice/ProtocolInstanceF.h +26 -0
  345. data/ext/ice/cpp/src/Ice/ProtocolPluginFacade.cpp +51 -0
  346. data/ext/ice/cpp/src/Ice/ProtocolPluginFacade.h +67 -0
  347. data/ext/ice/cpp/src/Ice/ProtocolPluginFacadeF.h +26 -0
  348. data/ext/ice/cpp/src/Ice/Proxy.cpp +1810 -0
  349. data/ext/ice/cpp/src/Ice/ProxyFactory.cpp +305 -0
  350. data/ext/ice/cpp/src/Ice/ProxyFactory.h +57 -0
  351. data/ext/ice/cpp/src/Ice/Reference.cpp +1947 -0
  352. data/ext/ice/cpp/src/Ice/Reference.h +305 -0
  353. data/ext/ice/cpp/src/Ice/ReferenceFactory.cpp +937 -0
  354. data/ext/ice/cpp/src/Ice/ReferenceFactory.h +81 -0
  355. data/ext/ice/cpp/src/Ice/ReferenceFactoryF.h +24 -0
  356. data/ext/ice/cpp/src/Ice/RemoteLogger.cpp +958 -0
  357. data/ext/ice/cpp/src/Ice/ReplyStatus.h +29 -0
  358. data/ext/ice/cpp/src/Ice/RequestHandler.cpp +40 -0
  359. data/ext/ice/cpp/src/Ice/RequestHandler.h +90 -0
  360. data/ext/ice/cpp/src/Ice/RequestHandlerFactory.cpp +70 -0
  361. data/ext/ice/cpp/src/Ice/RequestHandlerFactory.h +41 -0
  362. data/ext/ice/cpp/src/Ice/ResponseHandler.cpp +20 -0
  363. data/ext/ice/cpp/src/Ice/ResponseHandler.h +39 -0
  364. data/ext/ice/cpp/src/Ice/RetryQueue.cpp +154 -0
  365. data/ext/ice/cpp/src/Ice/RetryQueue.h +69 -0
  366. data/ext/ice/cpp/src/Ice/RetryQueueF.h +24 -0
  367. data/ext/ice/cpp/src/Ice/Router.cpp +849 -0
  368. data/ext/ice/cpp/src/Ice/RouterF.cpp +39 -0
  369. data/ext/ice/cpp/src/Ice/RouterInfo.cpp +381 -0
  370. data/ext/ice/cpp/src/Ice/RouterInfo.h +148 -0
  371. data/ext/ice/cpp/src/Ice/RouterInfoF.h +30 -0
  372. data/ext/ice/cpp/src/Ice/Selector.cpp +926 -0
  373. data/ext/ice/cpp/src/Ice/Selector.h +231 -0
  374. data/ext/ice/cpp/src/Ice/ServantLocator.cpp +41 -0
  375. data/ext/ice/cpp/src/Ice/ServantLocatorF.cpp +38 -0
  376. data/ext/ice/cpp/src/Ice/ServantManager.cpp +495 -0
  377. data/ext/ice/cpp/src/Ice/ServantManager.h +74 -0
  378. data/ext/ice/cpp/src/Ice/Service.cpp +1897 -0
  379. data/ext/ice/cpp/src/Ice/SharedContext.h +51 -0
  380. data/ext/ice/cpp/src/Ice/SliceChecksumDict.cpp +34 -0
  381. data/ext/ice/cpp/src/Ice/SliceChecksums.cpp +80 -0
  382. data/ext/ice/cpp/src/Ice/SlicedData.cpp +80 -0
  383. data/ext/ice/cpp/src/Ice/Stream.cpp +53 -0
  384. data/ext/ice/cpp/src/Ice/StreamI.cpp +832 -0
  385. data/ext/ice/cpp/src/Ice/StreamI.h +198 -0
  386. data/ext/ice/cpp/src/Ice/StreamSocket.cpp +521 -0
  387. data/ext/ice/cpp/src/Ice/StreamSocket.h +85 -0
  388. data/ext/ice/cpp/src/Ice/StringConverterPlugin.cpp +145 -0
  389. data/ext/ice/cpp/src/Ice/SysLoggerI.cpp +167 -0
  390. data/ext/ice/cpp/src/Ice/SysLoggerI.h +43 -0
  391. data/ext/ice/cpp/src/Ice/TcpAcceptor.cpp +235 -0
  392. data/ext/ice/cpp/src/Ice/TcpAcceptor.h +67 -0
  393. data/ext/ice/cpp/src/Ice/TcpConnector.cpp +133 -0
  394. data/ext/ice/cpp/src/Ice/TcpConnector.h +51 -0
  395. data/ext/ice/cpp/src/Ice/TcpEndpointI.cpp +397 -0
  396. data/ext/ice/cpp/src/Ice/TcpEndpointI.h +93 -0
  397. data/ext/ice/cpp/src/Ice/TcpTransceiver.cpp +127 -0
  398. data/ext/ice/cpp/src/Ice/TcpTransceiver.h +61 -0
  399. data/ext/ice/cpp/src/Ice/ThreadPool.cpp +1357 -0
  400. data/ext/ice/cpp/src/Ice/ThreadPool.h +399 -0
  401. data/ext/ice/cpp/src/Ice/TraceLevels.cpp +43 -0
  402. data/ext/ice/cpp/src/Ice/TraceLevels.h +50 -0
  403. data/ext/ice/cpp/src/Ice/TraceLevelsF.h +26 -0
  404. data/ext/ice/cpp/src/Ice/TraceUtil.cpp +452 -0
  405. data/ext/ice/cpp/src/Ice/TraceUtil.h +28 -0
  406. data/ext/ice/cpp/src/Ice/Transceiver.cpp +24 -0
  407. data/ext/ice/cpp/src/Ice/Transceiver.h +52 -0
  408. data/ext/ice/cpp/src/Ice/TransceiverF.h +38 -0
  409. data/ext/ice/cpp/src/Ice/UdpConnector.cpp +144 -0
  410. data/ext/ice/cpp/src/Ice/UdpConnector.h +51 -0
  411. data/ext/ice/cpp/src/Ice/UdpEndpointI.cpp +483 -0
  412. data/ext/ice/cpp/src/Ice/UdpEndpointI.h +95 -0
  413. data/ext/ice/cpp/src/Ice/UdpTransceiver.cpp +1156 -0
  414. data/ext/ice/cpp/src/Ice/UdpTransceiver.h +123 -0
  415. data/ext/ice/cpp/src/Ice/Version.cpp +46 -0
  416. data/ext/ice/cpp/src/Ice/WSAcceptor.cpp +103 -0
  417. data/ext/ice/cpp/src/Ice/WSAcceptor.h +61 -0
  418. data/ext/ice/cpp/src/Ice/WSConnector.cpp +113 -0
  419. data/ext/ice/cpp/src/Ice/WSConnector.h +51 -0
  420. data/ext/ice/cpp/src/Ice/WSEndpoint.cpp +441 -0
  421. data/ext/ice/cpp/src/Ice/WSEndpoint.h +97 -0
  422. data/ext/ice/cpp/src/Ice/WSTransceiver.cpp +1728 -0
  423. data/ext/ice/cpp/src/Ice/WSTransceiver.h +149 -0
  424. data/ext/ice/cpp/src/IceDiscovery/IceDiscovery.cpp +594 -0
  425. data/ext/ice/cpp/src/IceDiscovery/IceDiscovery.h +1035 -0
  426. data/ext/ice/cpp/src/IceDiscovery/LocatorI.cpp +208 -0
  427. data/ext/ice/cpp/src/IceDiscovery/LocatorI.h +78 -0
  428. data/ext/ice/cpp/src/IceDiscovery/LookupI.cpp +308 -0
  429. data/ext/ice/cpp/src/IceDiscovery/LookupI.h +183 -0
  430. data/ext/ice/cpp/src/IceDiscovery/Makefile +61 -0
  431. data/ext/ice/cpp/src/IceDiscovery/PluginI.cpp +148 -0
  432. data/ext/ice/cpp/src/IceDiscovery/PluginI.h +39 -0
  433. data/ext/ice/cpp/src/IceSSL/AcceptorI.cpp +258 -0
  434. data/ext/ice/cpp/src/IceSSL/AcceptorI.h +66 -0
  435. data/ext/ice/cpp/src/IceSSL/Certificate.cpp +1334 -0
  436. data/ext/ice/cpp/src/IceSSL/ConnectionInfo.cpp +42 -0
  437. data/ext/ice/cpp/src/IceSSL/ConnectorI.cpp +151 -0
  438. data/ext/ice/cpp/src/IceSSL/ConnectorI.h +56 -0
  439. data/ext/ice/cpp/src/IceSSL/EndpointI.cpp +397 -0
  440. data/ext/ice/cpp/src/IceSSL/EndpointI.h +96 -0
  441. data/ext/ice/cpp/src/IceSSL/EndpointInfo.cpp +41 -0
  442. data/ext/ice/cpp/src/IceSSL/Instance.cpp +38 -0
  443. data/ext/ice/cpp/src/IceSSL/Instance.h +42 -0
  444. data/ext/ice/cpp/src/IceSSL/InstanceF.h +34 -0
  445. data/ext/ice/cpp/src/IceSSL/Makefile +82 -0
  446. data/ext/ice/cpp/src/IceSSL/OpenSSLEngine.cpp +1001 -0
  447. data/ext/ice/cpp/src/IceSSL/OpenSSLTransceiverI.cpp +607 -0
  448. data/ext/ice/cpp/src/IceSSL/OpenSSLTransceiverI.h +75 -0
  449. data/ext/ice/cpp/src/IceSSL/PluginI.cpp +102 -0
  450. data/ext/ice/cpp/src/IceSSL/PluginI.h +56 -0
  451. data/ext/ice/cpp/src/IceSSL/RFC2253.cpp +541 -0
  452. data/ext/ice/cpp/src/IceSSL/RFC2253.h +67 -0
  453. data/ext/ice/cpp/src/IceSSL/SChannelEngine.cpp +729 -0
  454. data/ext/ice/cpp/src/IceSSL/SChannelTransceiverI.cpp +1062 -0
  455. data/ext/ice/cpp/src/IceSSL/SChannelTransceiverI.h +130 -0
  456. data/ext/ice/cpp/src/IceSSL/SSLEngine.cpp +291 -0
  457. data/ext/ice/cpp/src/IceSSL/SSLEngine.h +264 -0
  458. data/ext/ice/cpp/src/IceSSL/SSLEngineF.h +41 -0
  459. data/ext/ice/cpp/src/IceSSL/SecureTransportEngine.cpp +1514 -0
  460. data/ext/ice/cpp/src/IceSSL/SecureTransportTransceiverI.cpp +609 -0
  461. data/ext/ice/cpp/src/IceSSL/SecureTransportTransceiverI.h +91 -0
  462. data/ext/ice/cpp/src/IceSSL/TrustManager.cpp +246 -0
  463. data/ext/ice/cpp/src/IceSSL/TrustManager.h +51 -0
  464. data/ext/ice/cpp/src/IceSSL/TrustManagerF.h +26 -0
  465. data/ext/ice/cpp/src/IceSSL/Util.cpp +1423 -0
  466. data/ext/ice/cpp/src/IceSSL/Util.h +136 -0
  467. data/ext/ice/cpp/src/IceUtil/ArgVector.cpp +65 -0
  468. data/ext/ice/cpp/src/IceUtil/ArgVector.h +41 -0
  469. data/ext/ice/cpp/src/IceUtil/Cond.cpp +386 -0
  470. data/ext/ice/cpp/src/IceUtil/ConvertUTF.cpp +477 -0
  471. data/ext/ice/cpp/src/IceUtil/ConvertUTF.h +144 -0
  472. data/ext/ice/cpp/src/IceUtil/CountDownLatch.cpp +184 -0
  473. data/ext/ice/cpp/src/IceUtil/CtrlCHandler.cpp +273 -0
  474. data/ext/ice/cpp/src/IceUtil/Exception.cpp +782 -0
  475. data/ext/ice/cpp/src/IceUtil/FileUtil.cpp +532 -0
  476. data/ext/ice/cpp/src/IceUtil/FileUtil.h +159 -0
  477. data/ext/ice/cpp/src/IceUtil/InputUtil.cpp +41 -0
  478. data/ext/ice/cpp/src/IceUtil/Makefile +68 -0
  479. data/ext/ice/cpp/src/IceUtil/MutexProtocol.cpp +24 -0
  480. data/ext/ice/cpp/src/IceUtil/Options.cpp +1049 -0
  481. data/ext/ice/cpp/src/IceUtil/OutputUtil.cpp +591 -0
  482. data/ext/ice/cpp/src/IceUtil/Random.cpp +185 -0
  483. data/ext/ice/cpp/src/IceUtil/RecMutex.cpp +257 -0
  484. data/ext/ice/cpp/src/IceUtil/SHA1.cpp +126 -0
  485. data/ext/ice/cpp/src/IceUtil/Shared.cpp +200 -0
  486. data/ext/ice/cpp/src/IceUtil/StopWatch.h +54 -0
  487. data/ext/ice/cpp/src/IceUtil/StringConverter.cpp +450 -0
  488. data/ext/ice/cpp/src/IceUtil/StringUtil.cpp +842 -0
  489. data/ext/ice/cpp/src/IceUtil/Thread.cpp +809 -0
  490. data/ext/ice/cpp/src/IceUtil/ThreadException.cpp +172 -0
  491. data/ext/ice/cpp/src/IceUtil/Time.cpp +306 -0
  492. data/ext/ice/cpp/src/IceUtil/Timer.cpp +251 -0
  493. data/ext/ice/cpp/src/IceUtil/UUID.cpp +174 -0
  494. data/ext/ice/cpp/src/IceUtil/Unicode.cpp +131 -0
  495. data/ext/ice/cpp/src/IceUtil/Unicode.h +49 -0
  496. data/ext/ice/cpp/src/Slice/CPlusPlusUtil.cpp +1139 -0
  497. data/ext/ice/cpp/src/Slice/Checksum.cpp +452 -0
  498. data/ext/ice/cpp/src/Slice/CsUtil.cpp +2650 -0
  499. data/ext/ice/cpp/src/Slice/DotNetNames.cpp +146 -0
  500. data/ext/ice/cpp/src/Slice/FileTracker.cpp +203 -0
  501. data/ext/ice/cpp/src/Slice/Grammar.cpp +4755 -0
  502. data/ext/ice/cpp/src/Slice/Grammar.h +98 -0
  503. data/ext/ice/cpp/src/Slice/GrammarUtil.h +234 -0
  504. data/ext/ice/cpp/src/Slice/JavaUtil.cpp +4376 -0
  505. data/ext/ice/cpp/src/Slice/MD5.cpp +57 -0
  506. data/ext/ice/cpp/src/Slice/MD5.h +44 -0
  507. data/ext/ice/cpp/src/Slice/MD5I.cpp +385 -0
  508. data/ext/ice/cpp/src/Slice/MD5I.h +91 -0
  509. data/ext/ice/cpp/src/Slice/Makefile +65 -0
  510. data/ext/ice/cpp/src/Slice/PHPUtil.cpp +156 -0
  511. data/ext/ice/cpp/src/Slice/Parser.cpp +6386 -0
  512. data/ext/ice/cpp/src/Slice/Preprocessor.cpp +686 -0
  513. data/ext/ice/cpp/src/Slice/Python.cpp +675 -0
  514. data/ext/ice/cpp/src/Slice/PythonUtil.cpp +2614 -0
  515. data/ext/ice/cpp/src/Slice/Ruby.cpp +317 -0
  516. data/ext/ice/cpp/src/Slice/RubyUtil.cpp +1774 -0
  517. data/ext/ice/cpp/src/Slice/Scanner.cpp +2426 -0
  518. data/ext/ice/cpp/src/Slice/Util.cpp +325 -0
  519. data/ext/ice/mcpp/config.h.Darwin +227 -0
  520. data/ext/ice/mcpp/config.h.Linux +227 -0
  521. data/ext/ice/mcpp/config.h.MINGW +7 -0
  522. data/ext/ice/mcpp/configed.H +382 -0
  523. data/ext/ice/mcpp/directive.c +1699 -0
  524. data/ext/ice/mcpp/eval.c +1673 -0
  525. data/ext/ice/mcpp/expand.c +2980 -0
  526. data/ext/ice/mcpp/internal.H +564 -0
  527. data/ext/ice/mcpp/main.c +1131 -0
  528. data/ext/ice/mcpp/mbchar.c +869 -0
  529. data/ext/ice/mcpp/mcpp_lib.h +31 -0
  530. data/ext/ice/mcpp/mcpp_out.h +13 -0
  531. data/ext/ice/mcpp/support.c +2811 -0
  532. data/ext/ice/mcpp/system.H +396 -0
  533. data/ext/ice/mcpp/system.c +4940 -0
  534. data/ice.gemspec +41 -0
  535. data/lib/Glacier2.rb +12 -0
  536. data/lib/Glacier2/Metrics.rb +99 -0
  537. data/lib/Glacier2/PermissionsVerifier.rb +168 -0
  538. data/lib/Glacier2/PermissionsVerifierF.rb +34 -0
  539. data/lib/Glacier2/Router.rb +141 -0
  540. data/lib/Glacier2/RouterF.rb +29 -0
  541. data/lib/Glacier2/SSLInfo.rb +79 -0
  542. data/lib/Glacier2/Session.rb +470 -0
  543. data/lib/Ice.rb +659 -0
  544. data/lib/Ice/BuiltinSequences.rb +64 -0
  545. data/lib/Ice/Communicator.rb +93 -0
  546. data/lib/Ice/CommunicatorF.rb +28 -0
  547. data/lib/Ice/Connection.rb +414 -0
  548. data/lib/Ice/ConnectionF.rb +36 -0
  549. data/lib/Ice/Current.rb +152 -0
  550. data/lib/Ice/Endpoint.rb +265 -0
  551. data/lib/Ice/EndpointF.rb +52 -0
  552. data/lib/Ice/EndpointTypes.rb +77 -0
  553. data/lib/Ice/FacetMap.rb +28 -0
  554. data/lib/Ice/Identity.rb +70 -0
  555. data/lib/Ice/ImplicitContext.rb +59 -0
  556. data/lib/Ice/ImplicitContextF.rb +28 -0
  557. data/lib/Ice/Instrumentation.rb +425 -0
  558. data/lib/Ice/InstrumentationF.rb +35 -0
  559. data/lib/Ice/LocalException.rb +1081 -0
  560. data/lib/Ice/Locator.rb +314 -0
  561. data/lib/Ice/LocatorF.rb +34 -0
  562. data/lib/Ice/Logger.rb +57 -0
  563. data/lib/Ice/LoggerF.rb +28 -0
  564. data/lib/Ice/Metrics.rb +696 -0
  565. data/lib/Ice/ObjectAdapterF.rb +28 -0
  566. data/lib/Ice/ObjectFactory.rb +53 -0
  567. data/lib/Ice/ObjectFactoryF.rb +28 -0
  568. data/lib/Ice/Plugin.rb +87 -0
  569. data/lib/Ice/PluginF.rb +32 -0
  570. data/lib/Ice/Process.rb +93 -0
  571. data/lib/Ice/ProcessF.rb +29 -0
  572. data/lib/Ice/Properties.rb +65 -0
  573. data/lib/Ice/PropertiesAdmin.rb +104 -0
  574. data/lib/Ice/PropertiesF.rb +33 -0
  575. data/lib/Ice/Router.rb +163 -0
  576. data/lib/Ice/RouterF.rb +29 -0
  577. data/lib/Ice/SliceChecksumDict.rb +28 -0
  578. data/lib/Ice/Version.rb +100 -0
  579. data/lib/IceBox.rb +10 -0
  580. data/lib/IceBox/IceBox.rb +272 -0
  581. data/lib/IceGrid.rb +17 -0
  582. data/lib/IceGrid/Admin.rb +1076 -0
  583. data/lib/IceGrid/Descriptor.rb +1505 -0
  584. data/lib/IceGrid/Exception.rb +401 -0
  585. data/lib/IceGrid/FileParser.rb +105 -0
  586. data/lib/IceGrid/Locator.rb +105 -0
  587. data/lib/IceGrid/Observer.rb +571 -0
  588. data/lib/IceGrid/Query.rb +168 -0
  589. data/lib/IceGrid/Registry.rb +120 -0
  590. data/lib/IceGrid/Session.rb +114 -0
  591. data/lib/IceGrid/UserAccountMapper.rb +101 -0
  592. data/lib/IcePatch2.rb +10 -0
  593. data/lib/IcePatch2/FileInfo.rb +75 -0
  594. data/lib/IcePatch2/FileServer.rb +141 -0
  595. data/lib/IceStorm.rb +11 -0
  596. data/lib/IceStorm/IceStorm.rb +463 -0
  597. data/lib/IceStorm/Metrics.rb +155 -0
  598. data/slice/Freeze/BackgroundSaveEvictor.ice +111 -0
  599. data/slice/Freeze/CatalogData.ice +49 -0
  600. data/slice/Freeze/Connection.ice +111 -0
  601. data/slice/Freeze/ConnectionF.ice +20 -0
  602. data/slice/Freeze/DB.ice +37 -0
  603. data/slice/Freeze/Evictor.ice +339 -0
  604. data/slice/Freeze/EvictorF.ice +22 -0
  605. data/slice/Freeze/EvictorStorage.ice +72 -0
  606. data/slice/Freeze/Exception.ice +100 -0
  607. data/slice/Freeze/Transaction.ice +57 -0
  608. data/slice/Freeze/TransactionalEvictor.ice +50 -0
  609. data/slice/Glacier2/Metrics.ice +77 -0
  610. data/slice/Glacier2/PermissionsVerifier.ice +105 -0
  611. data/slice/Glacier2/PermissionsVerifierF.ice +21 -0
  612. data/slice/Glacier2/Router.ice +178 -0
  613. data/slice/Glacier2/RouterF.ice +20 -0
  614. data/slice/Glacier2/SSLInfo.ice +50 -0
  615. data/slice/Glacier2/Session.ice +273 -0
  616. data/slice/Ice/BuiltinSequences.ice +48 -0
  617. data/slice/Ice/Communicator.ice +567 -0
  618. data/slice/Ice/CommunicatorF.ice +20 -0
  619. data/slice/Ice/Connection.ice +323 -0
  620. data/slice/Ice/ConnectionF.ice +22 -0
  621. data/slice/Ice/Current.ice +160 -0
  622. data/slice/Ice/Endpoint.ice +227 -0
  623. data/slice/Ice/EndpointF.ice +32 -0
  624. data/slice/Ice/EndpointTypes.ice +38 -0
  625. data/slice/Ice/FacetMap.ice +25 -0
  626. data/slice/Ice/Identity.ice +59 -0
  627. data/slice/Ice/ImplicitContext.ice +109 -0
  628. data/slice/Ice/ImplicitContextF.ice +20 -0
  629. data/slice/Ice/Instrumentation.ice +499 -0
  630. data/slice/Ice/InstrumentationF.ice +26 -0
  631. data/slice/Ice/LocalException.ice +1015 -0
  632. data/slice/Ice/Locator.ice +227 -0
  633. data/slice/Ice/LocatorF.ice +21 -0
  634. data/slice/Ice/Logger.ice +86 -0
  635. data/slice/Ice/LoggerF.ice +20 -0
  636. data/slice/Ice/Metrics.ice +422 -0
  637. data/slice/Ice/ObjectAdapter.ice +673 -0
  638. data/slice/Ice/ObjectAdapterF.ice +20 -0
  639. data/slice/Ice/ObjectFactory.ice +60 -0
  640. data/slice/Ice/ObjectFactoryF.ice +20 -0
  641. data/slice/Ice/Plugin.ice +117 -0
  642. data/slice/Ice/PluginF.ice +21 -0
  643. data/slice/Ice/Process.ice +54 -0
  644. data/slice/Ice/ProcessF.ice +20 -0
  645. data/slice/Ice/Properties.ice +228 -0
  646. data/slice/Ice/PropertiesAdmin.ice +75 -0
  647. data/slice/Ice/PropertiesF.ice +21 -0
  648. data/slice/Ice/RemoteLogger.ice +232 -0
  649. data/slice/Ice/Router.ice +83 -0
  650. data/slice/Ice/RouterF.ice +20 -0
  651. data/slice/Ice/ServantLocator.ice +117 -0
  652. data/slice/Ice/ServantLocatorF.ice +20 -0
  653. data/slice/Ice/SliceChecksumDict.ice +25 -0
  654. data/slice/Ice/Version.ice +39 -0
  655. data/slice/IceBox/IceBox.ice +194 -0
  656. data/slice/IceDiscovery/IceDiscovery.ice +32 -0
  657. data/slice/IceGrid/Admin.ice +1578 -0
  658. data/slice/IceGrid/Descriptor.ice +1079 -0
  659. data/slice/IceGrid/Discovery.ice +73 -0
  660. data/slice/IceGrid/Exception.ice +383 -0
  661. data/slice/IceGrid/FileParser.ice +61 -0
  662. data/slice/IceGrid/Locator.ice +56 -0
  663. data/slice/IceGrid/Observer.ice +394 -0
  664. data/slice/IceGrid/PluginFacade.ice +316 -0
  665. data/slice/IceGrid/Query.ice +130 -0
  666. data/slice/IceGrid/Registry.ice +138 -0
  667. data/slice/IceGrid/Session.ice +124 -0
  668. data/slice/IceGrid/UserAccountMapper.ice +58 -0
  669. data/slice/IcePatch2/FileInfo.ice +49 -0
  670. data/slice/IcePatch2/FileServer.ice +129 -0
  671. data/slice/IceSSL/ConnectionInfo.ice +34 -0
  672. data/slice/IceSSL/EndpointInfo.ice +41 -0
  673. data/slice/IceStorm/IceStorm.ice +405 -0
  674. data/slice/IceStorm/Metrics.ice +71 -0
  675. metadata +737 -0
@@ -0,0 +1,1699 @@
1
+ /*-
2
+ * Copyright (c) 1998, 2002-2008 Kiyoshi Matsui <kmatsui@t3.rim.or.jp>
3
+ * All rights reserved.
4
+ *
5
+ * Some parts of this code are derived from the public domain software
6
+ * DECUS cpp (1984,1985) written by Martin Minow.
7
+ *
8
+ * Redistribution and use in source and binary forms, with or without
9
+ * modification, are permitted provided that the following conditions
10
+ * are met:
11
+ * 1. Redistributions of source code must retain the above copyright
12
+ * notice, this list of conditions and the following disclaimer.
13
+ * 2. Redistributions in binary form must reproduce the above copyright
14
+ * notice, this list of conditions and the following disclaimer in the
15
+ * documentation and/or other materials provided with the distribution.
16
+ *
17
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
18
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
21
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27
+ * SUCH DAMAGE.
28
+ */
29
+
30
+ /*
31
+ * D I R E C T I V E . C
32
+ * P r o c e s s D i r e c t i v e L i n e s
33
+ *
34
+ * The routines to handle directives other than #include and #pragma
35
+ * are placed here.
36
+ */
37
+
38
+ #if PREPROCESSED
39
+ #include "mcpp.H"
40
+ #else
41
+ #include "system.H"
42
+ #include "internal.H"
43
+ #endif
44
+
45
+ static int do_if( int hash, const char * directive_name);
46
+ /* #if, #elif, #ifdef, #ifndef */
47
+ static void sync_linenum( void);
48
+ /* Synchronize number of newlines */
49
+ static long do_line( void);
50
+ /* Process #line directive */
51
+ static int get_parm( void);
52
+ /* Get parameters of macro, its nargs, names, lengths */
53
+ static int get_repl( const char * macroname);
54
+ /* Get replacement text embedding parameter number */
55
+ static char * is_formal( const char * name, int conv);
56
+ /* If formal parameter, save the number */
57
+ static char * def_stringization( char * repl_cur);
58
+ /* Define stringization */
59
+ static char * mgtoken_save( const char * macroname);
60
+ /* Prefix DEF_MAGIC to macro name in repl-text */
61
+ static char * str_parm_scan( char * string_end);
62
+ /* Scan the parameter in quote */
63
+ static void do_undef( void);
64
+ /* Process #undef directive */
65
+ static void dump_repl( const DEFBUF * dp, FILE * fp, int gcc2_va);
66
+ /* Dump replacement text */
67
+
68
+ /*
69
+ * Generate (by hand-inspection) a set of unique values for each directive.
70
+ * MCPP won't compile if there are hash conflicts.
71
+ */
72
+ #define L_if ('i' ^ (EOS << 1))
73
+ #define L_ifdef ('i' ^ ('d' << 1))
74
+ #define L_ifndef ('i' ^ ('n' << 1))
75
+ #define L_elif ('e' ^ ('i' << 1))
76
+ #define L_else ('e' ^ ('s' << 1))
77
+ #define L_endif ('e' ^ ('d' << 1))
78
+ #define L_define ('d' ^ ('f' << 1))
79
+ #define L_undef ('u' ^ ('d' << 1))
80
+ #define L_line ('l' ^ ('n' << 1))
81
+ #define L_include ('i' ^ ('c' << 1))
82
+ #if COMPILER == GNUC
83
+ #define L_include_next ('i' ^ ('c' << 1) ^ ('_' << 1))
84
+ #endif
85
+ #if SYSTEM == SYS_MAC
86
+ #define L_import ('i' ^ ('p' << 1))
87
+ #endif
88
+ #define L_error ('e' ^ ('r' << 1))
89
+ #define L_pragma ('p' ^ ('a' << 1))
90
+
91
+ static const char * const not_ident
92
+ = "Not an identifier \"%s\""; /* _E_ */
93
+ static const char * const no_arg = "No argument"; /* _E_ */
94
+ static const char * const excess
95
+ = "Excessive token sequence \"%s\""; /* _E_ _W1_ */
96
+
97
+ void directive( void)
98
+ /*
99
+ * Process #directive lines. Each directive have their own subroutines.
100
+ */
101
+ {
102
+ const char * const many_nesting =
103
+ "More than %.0s%ld nesting of #if (#ifdef) sections%s"; /* _F_ _W4_ _W8_ */
104
+ const char * const not_in_section
105
+ = "Not in a #if (#ifdef) section in a source file"; /* _E_ _W1_ */
106
+ const char * const illeg_dir
107
+ = "Illegal #directive \"%s%.0ld%s\""; /* _E_ _W1_ _W8_ */
108
+ const char * const in_skipped = " (in skipped block)"; /* _W8_ */
109
+ FILEINFO * file;
110
+ int token_type;
111
+ int hash;
112
+ int c;
113
+ char * tp;
114
+
115
+ in_directive = TRUE;
116
+ if (keep_comments) {
117
+ mcpp_fputc( '\n', OUT); /* Possibly flush out comments */
118
+ newlines--;
119
+ }
120
+ c = skip_ws();
121
+ if (c == '\n') /* 'null' directive */
122
+ goto ret;
123
+ token_type = scan_token( c, (workp = work_buf, &workp), work_end);
124
+ if (in_asm && (token_type != NAM
125
+ || (! str_eq( identifier, "asm")
126
+ && ! str_eq( identifier, "endasm"))))
127
+ /* In #asm block, ignore #anything other than #asm or #endasm */
128
+ goto skip_line;
129
+ if (token_type != NAM) {
130
+ if (mcpp_mode == OLD_PREP && token_type == NUM) { /* # 123 [fname]*/
131
+ strcpy( identifier, "line");
132
+ } else {
133
+ if (compiling) {
134
+ if (option_flags.lang_asm) {
135
+ if (warn_level & 1)
136
+ cwarn( illeg_dir, work_buf, 0L, NULL);
137
+ } else {
138
+ cerror( illeg_dir, work_buf, 0L, NULL);
139
+ }
140
+ } else if (warn_level & 8) {
141
+ cwarn( illeg_dir, work_buf, 0L, in_skipped);
142
+ }
143
+ goto skip_line;
144
+ }
145
+ }
146
+ hash = (identifier[ 1] == EOS) ? identifier[ 0]
147
+ : (identifier[ 0] ^ (identifier[ 2] << 1));
148
+ if (strlen( identifier) > 7)
149
+ hash ^= (identifier[ 7] << 1);
150
+
151
+ /* hash is set to a unique value corresponding to the directive.*/
152
+ switch (hash) {
153
+ case L_if: tp = "if"; break;
154
+ case L_ifdef: tp = "ifdef"; break;
155
+ case L_ifndef: tp = "ifndef"; break;
156
+ case L_elif: tp = "elif"; break;
157
+ case L_else: tp = "else"; break;
158
+ case L_endif: tp = "endif"; break;
159
+ case L_define: tp = "define"; break;
160
+ case L_undef: tp = "undef"; break;
161
+ case L_line: tp = "line"; break;
162
+ case L_include: tp = "include"; break;
163
+ #if COMPILER == GNUC
164
+ case L_include_next: tp = "include_next"; break;
165
+ #endif
166
+ #if SYSTEM == SYS_MAC
167
+ case L_import: tp = "import"; break;
168
+ #endif
169
+ case L_error: tp = "error"; break;
170
+ case L_pragma: tp = "pragma"; break;
171
+ default: tp = NULL; break;
172
+ }
173
+
174
+ if (tp != NULL && ! str_eq( identifier, tp)) { /* Hash conflict*/
175
+ hash = 0; /* Unknown directive, will */
176
+ tp = NULL; /* be handled by do_old() */
177
+ }
178
+
179
+ if (! compiling) { /* Not compiling now */
180
+ switch (hash) {
181
+ case L_elif :
182
+ if (! standard) {
183
+ if (warn_level & 8)
184
+ do_old(); /* Unknown directive */
185
+ goto skip_line; /* Skip the line */
186
+ } /* Else fall through */
187
+ case L_else : /* Test the #if's nest, if 0, compile */
188
+ case L_endif: /* Un-nest #if */
189
+ break;
190
+ case L_if : /* These can't turn */
191
+ case L_ifdef: /* compilation on, but */
192
+ case L_ifndef : /* we must nest #if's.*/
193
+ if (&ifstack[ BLK_NEST] < ++ifptr)
194
+ goto if_nest_err;
195
+ if (standard && (warn_level & 8)
196
+ && &ifstack[ std_limits.blk_nest + 1] == ifptr)
197
+ cwarn( many_nesting, NULL, (long) std_limits.blk_nest
198
+ , in_skipped);
199
+ ifptr->stat = 0; /* !WAS_COMPILING */
200
+ ifptr->ifline = src_line; /* Line at section start*/
201
+ goto skip_line;
202
+ default : /* Other directives */
203
+ if (tp == NULL && (warn_level & 8))
204
+ do_old(); /* Unknown directive ? */
205
+ goto skip_line; /* Skip the line */
206
+ }
207
+ }
208
+
209
+ macro_line = 0; /* Reset error flag */
210
+ file = infile; /* Remember the current file */
211
+
212
+ switch (hash) {
213
+
214
+ case L_if:
215
+ case L_ifdef:
216
+ case L_ifndef:
217
+ if (&ifstack[ BLK_NEST] < ++ifptr)
218
+ goto if_nest_err;
219
+ if (standard && (warn_level & 4) &&
220
+ &ifstack[ std_limits.blk_nest + 1] == ifptr)
221
+ cwarn( many_nesting, NULL , (long) std_limits.blk_nest, NULL);
222
+ ifptr->stat = WAS_COMPILING;
223
+ ifptr->ifline = src_line;
224
+ goto ifdo;
225
+
226
+ case L_elif:
227
+ if (! standard) {
228
+ do_old(); /* Unrecognized directive */
229
+ break;
230
+ }
231
+ if (ifptr == &ifstack[0])
232
+ goto nest_err;
233
+ if (ifptr == infile->initif) {
234
+ goto in_file_nest_err;
235
+ }
236
+ if (ifptr->stat & ELSE_SEEN)
237
+ goto else_seen_err;
238
+ if ((ifptr->stat & (WAS_COMPILING | TRUE_SEEN)) != WAS_COMPILING) {
239
+ compiling = FALSE; /* Done compiling stuff */
240
+ goto skip_line; /* Skip this group */
241
+ }
242
+ hash = L_if;
243
+ ifdo:
244
+ c = do_if( hash, tp);
245
+ if (mcpp_debug & IF) {
246
+ mcpp_fprintf( DBG
247
+ , "#if (#elif, #ifdef, #ifndef) evaluate to %s.\n"
248
+ , compiling ? "TRUE" : "FALSE");
249
+ mcpp_fprintf( DBG, "line %ld: %s", src_line, infile->buffer);
250
+ }
251
+ if (c == FALSE) { /* Error */
252
+ compiling = FALSE; /* Skip this group */
253
+ goto skip_line; /* Prevent an extra error message */
254
+ }
255
+ break;
256
+
257
+ case L_else:
258
+ if (ifptr == &ifstack[0])
259
+ goto nest_err;
260
+ if (ifptr == infile->initif) {
261
+ if (standard)
262
+ goto in_file_nest_err;
263
+ else if (warn_level & 1)
264
+ cwarn( not_in_section, NULL, 0L, NULL);
265
+ }
266
+ if (ifptr->stat & ELSE_SEEN)
267
+ goto else_seen_err;
268
+ ifptr->stat |= ELSE_SEEN;
269
+ ifptr->elseline = src_line;
270
+ if (ifptr->stat & WAS_COMPILING) {
271
+ if (compiling || (ifptr->stat & TRUE_SEEN) != 0)
272
+ compiling = FALSE;
273
+ else
274
+ compiling = TRUE;
275
+ }
276
+ if ((mcpp_debug & MACRO_CALL) && (ifptr->stat & WAS_COMPILING)) {
277
+ sync_linenum();
278
+ mcpp_fprintf( OUT, "/*else %ld:%c*/\n", src_line
279
+ , compiling ? 'T' : 'F'); /* Show that #else is seen */
280
+ }
281
+ break;
282
+
283
+ case L_endif:
284
+ if (ifptr == &ifstack[0])
285
+ goto nest_err;
286
+ if (ifptr <= infile->initif) {
287
+ if (standard)
288
+ goto in_file_nest_err;
289
+ else if (warn_level & 1)
290
+ cwarn( not_in_section, NULL, 0L, NULL);
291
+ }
292
+ if (! compiling && (ifptr->stat & WAS_COMPILING))
293
+ wrong_line = TRUE;
294
+ compiling = (ifptr->stat & WAS_COMPILING);
295
+ if ((mcpp_debug & MACRO_CALL) && compiling) {
296
+ sync_linenum();
297
+ mcpp_fprintf( OUT, "/*endif %ld*/\n", src_line);
298
+ /* Show that #if block has ended */
299
+ }
300
+ --ifptr;
301
+ break;
302
+
303
+ case L_define:
304
+ do_define( FALSE, 0);
305
+ break;
306
+
307
+ case L_undef:
308
+ do_undef();
309
+ break;
310
+
311
+ case L_line:
312
+ if ((c = do_line()) > 0) {
313
+ src_line = c;
314
+ sharp( NULL, 0); /* Putout the new line number and file name */
315
+ infile->line = --src_line; /* Next line number is 'src_line' */
316
+ newlines = -1;
317
+ } else { /* Error already diagnosed by do_line() */
318
+ skip_nl();
319
+ }
320
+ break;
321
+
322
+ case L_include:
323
+ in_include = TRUE;
324
+ if (do_include( FALSE) == TRUE && file != infile)
325
+ newlines = -1; /* File has been included. Clear blank lines */
326
+ in_include = FALSE;
327
+ break;
328
+
329
+ case L_error:
330
+ if (! standard) {
331
+ do_old(); /* Unrecognized directive */
332
+ break;
333
+ }
334
+ cerror( infile->buffer, NULL, 0L, NULL); /* _E_ */
335
+ break;
336
+
337
+ case L_pragma:
338
+ if (! standard) {
339
+ do_old(); /* Unrecognized directive */
340
+ break;
341
+ }
342
+ do_pragma();
343
+ newlines = -1; /* Do not putout excessive '\n' */
344
+ break;
345
+
346
+ default: /* Non-Standard or unknown directives */
347
+ do_old();
348
+ break;
349
+ }
350
+
351
+ switch (hash) {
352
+ case L_if :
353
+ case L_elif :
354
+ case L_define :
355
+ case L_line :
356
+ goto skip_line; /* To prevent duplicate error message */
357
+ #if COMPILER == GNUC
358
+ case L_include_next :
359
+ if (file != infile) /* File has been included */
360
+ newlines = -1;
361
+ #endif
362
+ #if SYSTEM == SYS_MAC
363
+ case L_import :
364
+ if (file != infile) /* File has been included */
365
+ newlines = -1;
366
+ #endif
367
+ case L_error :
368
+ if (standard)
369
+ goto skip_line;
370
+ /* Else fall through */
371
+ case L_include :
372
+ case L_pragma :
373
+ if (standard)
374
+ break; /* Already read over the line */
375
+ /* Else fall through */
376
+ default : /* L_else, L_endif, L_undef, etc. */
377
+ if (mcpp_mode == OLD_PREP) {
378
+ /*
379
+ * Ignore the rest of the #directive line so you can write
380
+ * #if foo
381
+ * #endif foo
382
+ */
383
+ ;
384
+ } else if (skip_ws() != '\n') {
385
+ #if COMPILER == GNUC
386
+ if (standard && hash != L_endif)
387
+ #else
388
+ if (standard)
389
+ #endif
390
+ cerror( excess, infile->bptr-1, 0L, NULL);
391
+ else if (warn_level & 1)
392
+ cwarn( excess, infile->bptr-1, 0L, NULL);
393
+ }
394
+ skip_nl();
395
+ }
396
+ goto ret;
397
+
398
+ in_file_nest_err:
399
+ cerror( not_in_section, NULL, 0L, NULL);
400
+ goto skip_line;
401
+ nest_err:
402
+ cerror( "Not in a #if (#ifdef) section", NULL, 0L, NULL); /* _E_ */
403
+ goto skip_line;
404
+ else_seen_err:
405
+ cerror( "Already seen #else at line %.0s%ld" /* _E_ */
406
+ , NULL, ifptr->elseline, NULL);
407
+ skip_line:
408
+ skip_nl(); /* Ignore rest of line */
409
+ goto ret;
410
+
411
+ if_nest_err:
412
+ cfatal( many_nesting, NULL, (long) BLK_NEST, NULL);
413
+
414
+ ret:
415
+ in_directive = FALSE;
416
+ keep_comments = option_flags.c && compiling && !no_output;
417
+ keep_spaces = option_flags.k && compiling;
418
+ /* keep_spaces is on for #define line even if no_output is TRUE */
419
+ if (! wrong_line)
420
+ newlines++;
421
+ }
422
+
423
+ static int do_if( int hash, const char * directive_name)
424
+ /*
425
+ * Process an #if (#elif), #ifdef or #ifndef. The latter two are straight-
426
+ * forward, while #if needs a subroutine to evaluate the expression.
427
+ * do_if() is called only if compiling is TRUE. If false, compilation is
428
+ * always supressed, so we don't need to evaluate anything. This supresses
429
+ * unnecessary warnings.
430
+ */
431
+ {
432
+ int c;
433
+ int found;
434
+ DEFBUF * defp;
435
+
436
+ if ((c = skip_ws()) == '\n') {
437
+ unget_ch();
438
+ cerror( no_arg, NULL, 0L, NULL);
439
+ return FALSE;
440
+ }
441
+ if (mcpp_debug & MACRO_CALL) {
442
+ sync_linenum();
443
+ mcpp_fprintf( OUT, "/*%s %ld*/", directive_name, src_line);
444
+ }
445
+ if (hash == L_if) { /* #if or #elif */
446
+ unget_ch();
447
+ found = (eval_if() != 0L); /* Evaluate expression */
448
+ if (mcpp_debug & MACRO_CALL)
449
+ in_if = FALSE; /* 'in_if' is dynamically set in eval_lex() */
450
+ hash = L_ifdef; /* #if is now like #ifdef */
451
+ } else { /* #ifdef or #ifndef */
452
+ if (scan_token( c, (workp = work_buf, &workp), work_end) != NAM) {
453
+ cerror( not_ident, work_buf, 0L, NULL);
454
+ return FALSE; /* Next token is not an identifier */
455
+ }
456
+ found = ((defp = look_id( identifier)) != NULL); /* Look in table*/
457
+ if (mcpp_debug & MACRO_CALL) {
458
+ if (found)
459
+ mcpp_fprintf( OUT, "/*%s*/", defp->name);
460
+ }
461
+ }
462
+ if (found == (hash == L_ifdef)) {
463
+ compiling = TRUE;
464
+ ifptr->stat |= TRUE_SEEN;
465
+ } else {
466
+ compiling = FALSE;
467
+ }
468
+ if (mcpp_debug & MACRO_CALL) {
469
+ mcpp_fprintf( OUT, "/*i %c*/\n", compiling ? 'T' : 'F');
470
+ /* Report wheather the directive is evaluated TRUE or FALSE */
471
+ }
472
+ return TRUE;
473
+ }
474
+
475
+ static void sync_linenum( void)
476
+ /*
477
+ * Put out newlines or #line line to synchronize line number with the
478
+ * annotations about #if, #elif, #ifdef, #ifndef, #else or #endif on -K option.
479
+ */
480
+ {
481
+ if (wrong_line || newlines > 10) {
482
+ sharp( NULL, 0);
483
+ } else {
484
+ while (newlines-- > 0)
485
+ mcpp_fputc('\n', OUT);
486
+ }
487
+ newlines = -1;
488
+ }
489
+
490
+ static long do_line( void)
491
+ /*
492
+ * Parse the line to update the line number and "filename" field for the next
493
+ * input line.
494
+ * Values returned are as follows:
495
+ * -1: syntax error or out-of-range error (diagnosed by do_line(),
496
+ * eval_num()).
497
+ * [1,32767]: legal line number for C90, [1,2147483647] for C99.
498
+ * Line number [32768,2147483647] in C90 mode is only warned (not an error).
499
+ * do_line() always absorbs the line (except the <newline>).
500
+ */
501
+ {
502
+ const char * const not_digits
503
+ = "Line number \"%s\" isn't a decimal digits sequence"; /* _E_ _W1_ */
504
+ const char * const out_of_range
505
+ = "Line number \"%s\" is out of range of [1,%ld]"; /* _E_ _W1_ */
506
+ int token_type;
507
+ VAL_SIGN * valp;
508
+ char * save;
509
+ int c;
510
+
511
+ if ((c = skip_ws()) == '\n') {
512
+ cerror( no_arg, NULL, 0L, NULL);
513
+ unget_ch(); /* Push back <newline> */
514
+ return -1L; /* Line number is not changed */
515
+ }
516
+
517
+ if (standard) {
518
+ token_type = get_unexpandable( c, FALSE);
519
+ if (macro_line == MACRO_ERROR) /* Unterminated macro */
520
+ return -1L; /* already diagnosed. */
521
+ if (token_type == NO_TOKEN) /* Macro expanded to 0 token */
522
+ goto no_num;
523
+ if (token_type != NUM)
524
+ goto illeg_num;
525
+ } else if (scan_token( c, (workp = work_buf, &workp), work_end) != NUM) {
526
+ goto illeg_num;
527
+ }
528
+ for (workp = work_buf; *workp != EOS; workp++) {
529
+ if (! isdigit( *workp & UCHARMAX)) {
530
+ if (standard) {
531
+ cerror( not_digits, work_buf, 0L, NULL);
532
+ return -1L;
533
+ } else if (warn_level & 1) {
534
+ cwarn( not_digits, work_buf, 0L, NULL);
535
+ }
536
+ }
537
+ }
538
+ valp = eval_num( work_buf); /* Evaluate number */
539
+ if (valp->sign == VAL_ERROR) { /* Error diagnosed by eval_num()*/
540
+ return -1;
541
+ } else if (standard
542
+ && (std_limits.line_num < valp->val || valp->val <= 0L)) {
543
+ if (valp->val < LINE99LIMIT && valp->val > 0L) {
544
+ if (warn_level & 1)
545
+ cwarn( out_of_range, work_buf, std_limits.line_num, NULL);
546
+ } else {
547
+ cerror( out_of_range, work_buf, std_limits.line_num, NULL);
548
+ return -1L;
549
+ }
550
+ }
551
+
552
+ if (standard) {
553
+ token_type = get_unexpandable( skip_ws(), FALSE);
554
+ if (macro_line == MACRO_ERROR)
555
+ return -1L;
556
+ if (token_type != STR) {
557
+ if (token_type == NO_TOKEN) { /* Filename is absent */
558
+ return (long) valp->val;
559
+ } else { /* Expanded macro should be a quoted string */
560
+ goto not_fname;
561
+ }
562
+ }
563
+ } else {
564
+ if ((c = skip_ws()) == '\n') {
565
+ unget_ch();
566
+ return (long) valp->val;
567
+ }
568
+ if (scan_token( c, (workp = work_buf, &workp), work_end) != STR)
569
+ goto not_fname;
570
+ }
571
+ #if COMPILER == GNUC
572
+ if (memcmp( workp - 3, "//", 2) == 0) { /* "/cur-dir//" */
573
+ save = infile->filename; /* Do not change the file name */
574
+ } else
575
+ #endif
576
+ {
577
+ *(workp - 1) = EOS; /* Ignore right '"' */
578
+ save = save_string( &work_buf[ 1]); /* Ignore left '"' */
579
+ }
580
+
581
+ if (standard) {
582
+ if (get_unexpandable( skip_ws(), FALSE) != NO_TOKEN) {
583
+ cerror( excess, work_buf, 0L, NULL);
584
+ free( save);
585
+ return -1L;
586
+ }
587
+ } else if (mcpp_mode == OLD_PREP) {
588
+ skip_nl();
589
+ unget_ch();
590
+ } else if ((c = skip_ws()) == '\n') {
591
+ unget_ch();
592
+ } else {
593
+ if (warn_level & 1) {
594
+ scan_token( c, (workp = work_buf, &workp), work_end);
595
+ cwarn( excess, work_buf, 0, NULL);
596
+ }
597
+ skip_nl();
598
+ unget_ch();
599
+ }
600
+
601
+ if (infile->filename)
602
+ free( infile->filename);
603
+ infile->filename = save; /* New file name */
604
+ /* Note that this does not change infile->real_fname */
605
+ return (long) valp->val; /* New line number */
606
+
607
+ no_num:
608
+ cerror( "No line number", NULL, 0L, NULL); /* _E_ */
609
+ return -1L;
610
+ illeg_num:
611
+ cerror( "Not a line number \"%s\"", work_buf, 0L, NULL); /* _E_ */
612
+ return -1L;
613
+ not_fname:
614
+ cerror( "Not a file name \"%s\"", work_buf, 0L, NULL); /* _E_ */
615
+ return -1L;
616
+ }
617
+
618
+ /*
619
+ * M a c r o D e f i n i t i o n s
620
+ */
621
+
622
+ /*
623
+ * look_id() Looks for the name in the defined symbol table. Returns a
624
+ * pointer to the definition if found, or NULL if not present.
625
+ * install_macro() Installs the definition. Updates the symbol table.
626
+ * undefine() Deletes the definition from the symbol table.
627
+ */
628
+
629
+ /*
630
+ * Global work_buf[] are used to store #define parameter lists and
631
+ * parms[].name point to them.
632
+ * 'nargs' contains the actual number of parameters stored.
633
+ */
634
+ typedef struct {
635
+ char * name; /* -> Start of each parameter */
636
+ size_t len; /* Length of parameter name */
637
+ } PARM;
638
+ static PARM parms[ NMACPARS];
639
+ static int nargs; /* Number of parameters */
640
+ static char * token_p; /* Pointer to the token scanned */
641
+ static char * repl_base; /* Base of buffer for repl-text */
642
+ static char * repl_end; /* End of buffer for repl-text */
643
+ static const char * const no_ident = "No identifier"; /* _E_ */
644
+ #if COMPILER == GNUC
645
+ static int gcc2_va_arg; /* GCC2-spec variadic macro */
646
+ #endif
647
+
648
+ DEFBUF * do_define(
649
+ int ignore_redef, /* Do not redefine */
650
+ int predefine /* Predefine compiler-specific name */
651
+ /*
652
+ * Note: The value of 'predefine' should be one of 0, DEF_NOARGS_PREDEF
653
+ * or DEF_NOARGS_PREDEF_OLD, the other values cause errors.
654
+ */
655
+ )
656
+ /*
657
+ * Called from directive() when a #define is scanned or called from
658
+ * do_options() when a -D option is scanned. This module parses formal
659
+ * parameters by get_parm() and the replacement text by get_repl().
660
+ *
661
+ * There is some special case code to distinguish
662
+ * #define foo bar -- object-like macro
663
+ * from #define foo() bar -- function-like macro with no parameter
664
+ *
665
+ * Also, we make sure that
666
+ * #define foo foo
667
+ * expands to "foo" but doesn't put MCPP into an infinite loop.
668
+ *
669
+ * A warning is printed if you redefine a symbol with a non-identical
670
+ * text. I.e,
671
+ * #define foo 123
672
+ * #define foo 123
673
+ * is ok, but
674
+ * #define foo 123
675
+ * #define foo +123
676
+ * is not.
677
+ *
678
+ * The following subroutines are called from do_define():
679
+ * get_parm() parsing and remembering parameter names.
680
+ * get_repl() parsing and remembering replacement text.
681
+ *
682
+ * The following subroutines are called from get_repl():
683
+ * is_formal() is called when an identifier is scanned. It checks through
684
+ * the array of formal parameters. If a match is found, the
685
+ * identifier is replaced by a control byte which will be used
686
+ * to locate the parameter when the macro is expanded.
687
+ * def_stringization() is called when '#' operator is scanned. It surrounds
688
+ * the token to stringize with magic-codes.
689
+ *
690
+ * modes other than STD ignore difference of parameter names in macro
691
+ * redefinition.
692
+ */
693
+ {
694
+ const char * const predef = "\"%s\" shouldn't be redefined"; /* _E_ */
695
+ char repl_list[ NMACWORK + IDMAX]; /* Replacement text */
696
+ char macroname[ IDMAX + 1]; /* Name of the macro defining */
697
+ DEFBUF * defp; /* -> Old definition */
698
+ DEFBUF ** prevp; /* -> Pointer to previous def in list */
699
+ int c;
700
+ int redefined; /* TRUE if redefined */
701
+ int dnargs = 0; /* defp->nargs */
702
+ int cmp; /* Result of name comparison */
703
+ size_t def_start, def_end; /* Column of macro definition */
704
+
705
+ repl_base = repl_list;
706
+ repl_end = & repl_list[ NMACWORK];
707
+ c = skip_ws();
708
+ if ((mcpp_debug & MACRO_CALL) && src_line) /* Start of definition */
709
+ def_start = infile->bptr - infile->buffer - 1;
710
+ if (c == '\n') {
711
+ cerror( no_ident, NULL, 0L, NULL);
712
+ unget_ch();
713
+ return NULL;
714
+ } else if (scan_token( c, (workp = work_buf, &workp), work_end) != NAM) {
715
+ cerror( not_ident, work_buf, 0L, NULL);
716
+ return NULL;
717
+ } else {
718
+ prevp = look_prev( identifier, &cmp);
719
+ /* Find place in the macro list to insert the definition */
720
+ defp = *prevp;
721
+ if (standard) {
722
+ if (cmp || defp->push) { /* Not known or 'pushed' macro */
723
+ if (str_eq( identifier, "defined")
724
+ || ((stdc_val || cplus_val)
725
+ && str_eq( identifier, "__VA_ARGS__"))) {
726
+ cerror(
727
+ "\"%s\" shouldn't be defined", identifier, 0L, NULL); /* _E_ */
728
+ return NULL;
729
+ }
730
+ redefined = FALSE; /* Quite new definition */
731
+ } else { /* It's known: */
732
+ if (ignore_redef)
733
+ return defp;
734
+ dnargs = (defp->nargs == DEF_NOARGS_STANDARD
735
+ || defp->nargs == DEF_NOARGS_PREDEF
736
+ || defp->nargs == DEF_NOARGS_PREDEF_OLD)
737
+ ? DEF_NOARGS : defp->nargs;
738
+ if (dnargs <= DEF_NOARGS_DYNAMIC /* __FILE__ and such */
739
+ || dnargs == DEF_PRAGMA /* _Pragma() pseudo-macro */
740
+ ) {
741
+ cerror( predef, identifier, 0L, NULL);
742
+ return NULL;
743
+ } else {
744
+ redefined = TRUE; /* Remember this fact */
745
+ }
746
+ }
747
+ } else {
748
+ if (cmp) {
749
+ redefined = FALSE; /* Quite new definition */
750
+ } else { /* It's known: */
751
+ if (ignore_redef)
752
+ return defp;
753
+ dnargs = (defp->nargs == DEF_NOARGS_STANDARD
754
+ || defp->nargs == DEF_NOARGS_PREDEF
755
+ || defp->nargs == DEF_NOARGS_PREDEF_OLD)
756
+ ? DEF_NOARGS : defp->nargs;
757
+ redefined = TRUE;
758
+ }
759
+ }
760
+ }
761
+ strcpy( macroname, identifier); /* Remember the name */
762
+
763
+ in_define = TRUE; /* Recognize '#', '##' */
764
+ if (get_parm() == FALSE) { /* Get parameter list */
765
+ in_define = FALSE;
766
+ return NULL; /* Syntax error */
767
+ }
768
+ if (get_repl( macroname) == FALSE) { /* Get replacement text */
769
+ in_define = FALSE;
770
+ return NULL; /* Syntax error */
771
+ }
772
+ if ((mcpp_debug & MACRO_CALL) && src_line) {
773
+ /* Remember location on source */
774
+ char * cp;
775
+ cp = infile->bptr - 1; /* Before '\n' */
776
+ while (char_type[ *cp & UCHARMAX] & HSP)
777
+ cp--; /* Trailing space */
778
+ cp++; /* Just after the last token */
779
+ def_end = cp - infile->buffer; /* End of definition */
780
+ }
781
+
782
+ in_define = FALSE;
783
+ if (redefined) {
784
+ if (dnargs != nargs || ! str_eq( defp->repl, repl_list)
785
+ || (mcpp_mode == STD && ! str_eq( defp->parmnames, work_buf))
786
+ ) { /* Warn if differently redefined */
787
+ if (warn_level & 1) {
788
+ cwarn(
789
+ "The macro is redefined", NULL, 0L, NULL); /* _W1_ */
790
+ if (! option_flags.no_source_line)
791
+ dump_a_def( " previously macro", defp, FALSE, TRUE
792
+ , fp_err);
793
+ }
794
+ } else { /* Identical redefinition */
795
+ return defp;
796
+ }
797
+ } /* Else new or re-definition*/
798
+ defp = install_macro( macroname, nargs, work_buf, repl_list, prevp, cmp
799
+ , predefine);
800
+ if ((mcpp_debug & MACRO_CALL) && src_line) {
801
+ /* Get location on source file */
802
+ LINE_COL s_line_col, e_line_col;
803
+ s_line_col.line = src_line;
804
+ s_line_col.col = def_start;
805
+ get_src_location( & s_line_col);
806
+ /* Convert to pre-line-splicing data */
807
+ e_line_col.line = src_line;
808
+ e_line_col.col = def_end;
809
+ get_src_location( & e_line_col);
810
+ /* Putout the macro definition information embedded in comment */
811
+ mcpp_fprintf( OUT, "/*m%s %ld:%d-%ld:%d*/\n", defp->name
812
+ , s_line_col.line, s_line_col.col
813
+ , e_line_col.line, e_line_col.col);
814
+ wrong_line = TRUE; /* Need #line later */
815
+ }
816
+ if (mcpp_mode == STD && cplus_val && id_operator( macroname)
817
+ && (warn_level & 1))
818
+ /* These are operators, not identifiers, in C++98 */
819
+ cwarn( "\"%s\" is defined as macro", macroname /* _W1_ */
820
+ , 0L, NULL);
821
+ return defp;
822
+ }
823
+
824
+ static int get_parm( void)
825
+ /*
826
+ * Get parameters i.e. numbers into nargs, name into work_buf[], name-length
827
+ * into parms[].len. parms[].name point into work_buf.
828
+ * Return TRUE if the parameters are legal, else return FALSE.
829
+ * In STD mode preprocessor must remember the parameter names, only for
830
+ * checking the validity of macro redefinitions. This is required by the
831
+ * Standard (what an overhead !).
832
+ */
833
+ {
834
+ const char * const many_parms
835
+ = "More than %.0s%ld parameters"; /* _E_ _W4_ */
836
+ const char * const illeg_parm
837
+ = "Illegal parameter \"%s\""; /* _E_ */
838
+ const char * const misplaced_ellip
839
+ = "\"...\" isn't the last parameter"; /* _E_ */
840
+ int token_type;
841
+ int c;
842
+
843
+ parms[ 0].name = workp = work_buf;
844
+ work_buf[ 0] = EOS;
845
+ #if COMPILER == GNUC
846
+ gcc2_va_arg = FALSE;
847
+ #endif
848
+
849
+ /* POST_STD mode */
850
+ insert_sep = NO_SEP; /* Clear the inserted token separator */
851
+ c = get_ch();
852
+
853
+ if (c == '(') { /* With arguments? */
854
+ nargs = 0; /* Init parms counter */
855
+ if (skip_ws() == ')')
856
+ return TRUE; /* Macro with 0 parm */
857
+ else
858
+ unget_ch();
859
+
860
+ do { /* Collect parameters */
861
+ if (nargs >= NMACPARS) {
862
+ cerror( many_parms, NULL, (long) NMACPARS, NULL);
863
+ return FALSE;
864
+ }
865
+ parms[ nargs].name = workp; /* Save its start */
866
+ if ((token_type = scan_token( c = skip_ws(), &workp, work_end))
867
+ != NAM) {
868
+ if (c == '\n') {
869
+ break;
870
+ } else if (c == ',' || c == ')') {
871
+ cerror( "Empty parameter", NULL, 0L, NULL); /* _E_ */
872
+ return FALSE;
873
+ } else if (standard && (stdc_val || cplus_val)
874
+ && token_type == OPE && openum == OP_ELL) {
875
+ /*
876
+ * Enable variable argument macro which is a feature of
877
+ * C99. We enable this even on C90 or C++ for GCC
878
+ * compatibility.
879
+ */
880
+ if (skip_ws() != ')') {
881
+ cerror( misplaced_ellip, NULL, 0L, NULL);
882
+ return FALSE;
883
+ }
884
+ parms[ nargs++].len = 3;
885
+ nargs |= VA_ARGS;
886
+ goto ret;
887
+ } else {
888
+ cerror( illeg_parm, parms[ nargs].name, 0L, NULL);
889
+ return FALSE; /* Bad parameter syntax */
890
+ }
891
+ }
892
+ if (standard && (stdc_val || cplus_val)
893
+ && str_eq( identifier, "__VA_ARGS__")) {
894
+ cerror( illeg_parm, parms[ nargs].name, 0L, NULL);
895
+ return FALSE;
896
+ /* __VA_ARGS__ should not be used as a parameter */
897
+ }
898
+ if (is_formal( parms[ nargs].name, FALSE)) {
899
+ cerror( "Duplicate parameter name \"%s\"" /* _E_ */
900
+ , parms[ nargs].name, 0L, NULL);
901
+ return FALSE;
902
+ }
903
+ parms[ nargs].len = (size_t) (workp - parms[ nargs].name);
904
+ /* Save length of param */
905
+ *workp++ = ',';
906
+ nargs++;
907
+ } while ((c = skip_ws()) == ','); /* Get another parameter*/
908
+
909
+ *--workp = EOS; /* Remove excessive ',' */
910
+ if (c != ')') { /* Must end at ) */
911
+ #if COMPILER == GNUC
912
+ /* Handle GCC2 variadic params like par... */
913
+ char * tp = workp;
914
+ if (mcpp_mode == STD
915
+ &&(token_type = scan_token( c, &workp, work_end)) == OPE
916
+ && openum == OP_ELL) {
917
+ if ((c = skip_ws()) != ')') {
918
+ cerror( misplaced_ellip, NULL, 0L, NULL);
919
+ return FALSE;
920
+ }
921
+ *tp = EOS; /* Remove "..." */
922
+ nargs |= VA_ARGS;
923
+ gcc2_va_arg = TRUE;
924
+ goto ret;
925
+ }
926
+ #endif
927
+ unget_ch(); /* Push back '\n' */
928
+ cerror(
929
+ "Missing \",\" or \")\" in parameter list \"(%s\"" /* _E_ */
930
+ , work_buf, 0L, NULL);
931
+ return FALSE;
932
+ }
933
+ } else {
934
+ /*
935
+ * DEF_NOARGS is needed to distinguish between
936
+ * "#define foo" and "#define foo()".
937
+ */
938
+ nargs = DEF_NOARGS; /* Object-like macro */
939
+ unget_ch();
940
+ }
941
+ ret:
942
+ #if NMACPARS > NMACPARS90MIN
943
+ if ((warn_level & 4) && (nargs & ~AVA_ARGS) > std_limits.n_mac_pars)
944
+ cwarn( many_parms, NULL , (long) std_limits.n_mac_pars, NULL);
945
+ #endif
946
+ return TRUE;
947
+ }
948
+
949
+ static int get_repl(
950
+ const char * macroname
951
+ )
952
+ /*
953
+ * Get replacement text i.e. names of formal parameters are converted to
954
+ * the magic numbers, and operators #, ## is converted to magic characters.
955
+ * Return TRUE if replacement list is legal, else return FALSE.
956
+ * Any token separator in the text is converted to a single space, no token
957
+ * sepatator is inserted by MCPP. Those are required by the Standard for
958
+ * stringizing of an argument by # operator.
959
+ * In POST_STD mode, inserts a space between any tokens in source (except a
960
+ * macro name and the next '(' in macro definition), hence presence or absence
961
+ * of token separator makes no difference.
962
+ */
963
+ {
964
+ const char * const mixed_ops
965
+ = "Macro with mixing of ## and # operators isn't portable"; /* _W4_ */
966
+ const char * const multiple_cats
967
+ = "Macro with multiple ## operators isn't portable"; /* _W4_ */
968
+ char * prev_token = NULL; /* Preceding token */
969
+ char * prev_prev_token = NULL; /* Pre-preceding token */
970
+ int multi_cats = FALSE; /* Multiple ## operators*/
971
+ int c;
972
+ int token_type; /* Type of token */
973
+ char * temp;
974
+ char * repl_cur = repl_base; /* Pointer into repl-text buffer*/
975
+
976
+ *repl_cur = EOS;
977
+ token_p = NULL;
978
+ if (mcpp_mode == STD) {
979
+ c = get_ch();
980
+ unget_ch();
981
+ if (((char_type[ c] & SPA) == 0) && (nargs < 0) && (warn_level & 1))
982
+ cwarn( "No space between macro name \"%s\" and repl-text"/* _W1_ */
983
+ , macroname, 0L, NULL);
984
+ }
985
+ c = skip_ws(); /* Get to the body */
986
+
987
+ while (c != '\n') {
988
+ if (standard) {
989
+ prev_prev_token = prev_token;
990
+ prev_token = token_p;
991
+ }
992
+ token_p = repl_cur; /* Remember the pointer */
993
+ token_type = scan_token( c, &repl_cur, repl_end);
994
+
995
+ switch (token_type) {
996
+ case OPE: /* Operator or punctuator */
997
+ if (! standard)
998
+ break;
999
+ switch (openum) {
1000
+ case OP_CAT: /* ## */
1001
+ if (prev_token == NULL) {
1002
+ cerror( "No token before ##" /* _E_ */
1003
+ , NULL, 0L, NULL);
1004
+ return FALSE;
1005
+ } else if (*prev_token == CAT) {
1006
+ cerror( "## after ##", NULL, 0L, NULL); /* _E_ */
1007
+ return FALSE;
1008
+ } else if (prev_prev_token && *prev_prev_token == CAT) {
1009
+ multi_cats = TRUE;
1010
+ } else if (prev_prev_token && *prev_prev_token == ST_QUOTE
1011
+ && (warn_level & 4)) { /* # parm ## */
1012
+ cwarn( mixed_ops, NULL, 0L, NULL);
1013
+ }
1014
+ repl_cur = token_p;
1015
+ *repl_cur++ = CAT; /* Convert to CAT */
1016
+ break;
1017
+ case OP_STR: /* # */
1018
+ if (nargs < 0) /* In object-like macro */
1019
+ break; /* '#' is an usual char */
1020
+ if (prev_token && *prev_token == CAT
1021
+ && (warn_level & 4)) /* ## # */
1022
+ cwarn( mixed_ops, NULL, 0L, NULL);
1023
+ repl_cur = token_p; /* Overwrite on # */
1024
+ if ((temp = def_stringization( repl_cur)) == NULL) {
1025
+ return FALSE; /* Error */
1026
+ } else {
1027
+ repl_cur = temp;
1028
+ }
1029
+ break;
1030
+ default: /* Any operator as it is */
1031
+ break;
1032
+ }
1033
+ break;
1034
+ case NAM:
1035
+ /*
1036
+ * Replace this name if it's a parm. Note that the macro name is a
1037
+ * possible replacement token. We stuff DEF_MAGIC in front of the
1038
+ * token which is treated as a LETTER by the token scanner and eaten
1039
+ * by the macro expanding routine. This prevents the macro expander
1040
+ * from looping if someone writes "#define foo foo".
1041
+ */
1042
+ temp = is_formal( identifier, TRUE);
1043
+ if (temp == NULL) { /* Not a parameter name */
1044
+ if (! standard)
1045
+ break;
1046
+ if ((stdc_val || cplus_val)
1047
+ && str_eq( identifier, "__VA_ARGS__")) {
1048
+ #if COMPILER == GNUC
1049
+ if (gcc2_va_arg) {
1050
+ cerror( "\"%s\" cannot be used in GCC2-spec variadic macro" /* _E_ */
1051
+ , identifier, 0L, NULL);
1052
+ return FALSE;
1053
+ }
1054
+ #endif
1055
+ cerror( "\"%s\" without corresponding \"...\"" /* _E_ */
1056
+ , identifier, 0L, NULL);
1057
+ return FALSE;
1058
+ }
1059
+ if ((temp = mgtoken_save( macroname)) != NULL)
1060
+ repl_cur = temp; /* Macro name */
1061
+ } else { /* Parameter name */
1062
+ repl_cur = temp;
1063
+ #if COMPILER == GNUC
1064
+ if (mcpp_mode == STD && (nargs & VA_ARGS)
1065
+ && *(repl_cur - 1) == (nargs & ~AVA_ARGS)) {
1066
+ if (! str_eq( identifier, "__VA_ARGS__")
1067
+ && (warn_level & 2))
1068
+ cwarn(
1069
+ "GCC2-spec variadic macro is defined" /* _W2_ */
1070
+ , NULL, 0L, NULL);
1071
+ if (prev_token && *prev_token == CAT
1072
+ && prev_prev_token && *prev_prev_token == ',')
1073
+ /* ", ## __VA_ARGS__" is sequence peculiar */
1074
+ /* to GCC3-spec variadic macro. */
1075
+ /* Or ", ## last_arg" is sequence peculiar */
1076
+ /* to GCC2-spec variadic macro. */
1077
+ nargs |= GVA_ARGS;
1078
+ /* Mark as sequence peculiar to GCC */
1079
+ /* This will be warned at expansion time */
1080
+ }
1081
+ #endif
1082
+ }
1083
+ break;
1084
+
1085
+ case STR: /* String in mac. body */
1086
+ case CHR: /* Character constant */
1087
+ if (mcpp_mode == OLD_PREP)
1088
+ repl_cur = str_parm_scan( repl_cur);
1089
+ break;
1090
+ case SEP:
1091
+ if (mcpp_mode == OLD_PREP && c == COM_SEP)
1092
+ repl_cur--; /* Skip comment now */
1093
+ break;
1094
+ default: /* Any token as it is */
1095
+ break;
1096
+ }
1097
+
1098
+ if ((c = get_ch()) == ' ' || c == '\t') {
1099
+ *repl_cur++ = ' '; /* Space */
1100
+ while ((c = get_ch()) == ' ' || c == '\t')
1101
+ ; /* Skip excessive spaces */
1102
+ }
1103
+ }
1104
+
1105
+ while (repl_base < repl_cur
1106
+ && (*(repl_cur - 1) == ' ' || *(repl_cur - 1) == '\t'))
1107
+ repl_cur--; /* Remove trailing spaces */
1108
+ *repl_cur = EOS; /* Terminate work */
1109
+
1110
+ unget_ch(); /* For syntax check */
1111
+ if (standard) {
1112
+ if (token_p && *token_p == CAT) {
1113
+ cerror( "No token after ##", NULL, 0L, NULL); /* _E_ */
1114
+ return FALSE;
1115
+ }
1116
+ if (multi_cats && (warn_level & 4))
1117
+ cwarn( multiple_cats, NULL, 0L, NULL);
1118
+ if ((nargs & VA_ARGS) && stdc_ver < 199901L && (warn_level & 2))
1119
+ /* Variable arg macro is the spec of C99, not C90 nor C++98 */
1120
+ cwarn( "Variable argument macro is defined", /* _W2_ */
1121
+ NULL, 0L, NULL);
1122
+ }
1123
+
1124
+ return TRUE;
1125
+ }
1126
+
1127
+ static char * is_formal(
1128
+ const char * name,
1129
+ int conv /* Convert to magic number? */
1130
+ )
1131
+ /*
1132
+ * If the identifier is a formal parameter, save the MAC_PARM and formal
1133
+ * offset, returning the advanced pointer into the replacement text.
1134
+ * Else, return NULL.
1135
+ */
1136
+ {
1137
+ char * repl_cur;
1138
+ const char * va_arg = "__VA_ARGS__";
1139
+ PARM parm;
1140
+ size_t len;
1141
+ int i;
1142
+
1143
+ len = strlen( name);
1144
+ for (i = 0; i < (nargs & ~AVA_ARGS); i++) { /* For each parameter */
1145
+ parm = parms[ i];
1146
+ if ((len == parm.len
1147
+ /* Note: parms[].name are comma separated */
1148
+ && memcmp( name, parm.name, parm.len) == 0)
1149
+ || (standard && (nargs & VA_ARGS)
1150
+ && i == (nargs & ~AVA_ARGS) - 1 && conv
1151
+ && str_eq( name, va_arg))) { /* __VA_ARGS__ */
1152
+ /* If it's known */
1153
+ #if COMPILER == GNUC
1154
+ if (gcc2_va_arg && str_eq( name, va_arg))
1155
+ return NULL; /* GCC2 variadic macro */
1156
+ #endif
1157
+ if (conv) {
1158
+ repl_cur = token_p; /* Overwrite on the name*/
1159
+ *repl_cur++ = MAC_PARM; /* Save the signal */
1160
+ *repl_cur++ = i + 1; /* Save the parm number */
1161
+ return repl_cur; /* Return "gotcha" */
1162
+ } else {
1163
+ return parm.name; /* Duplicate parm name */
1164
+ }
1165
+ }
1166
+ }
1167
+
1168
+ return NULL; /* Not a formal param */
1169
+ }
1170
+
1171
+ static char * def_stringization( char * repl_cur)
1172
+ /*
1173
+ * Define token stringization.
1174
+ * We store a magic cookie (which becomes surrouding " on expansion) preceding
1175
+ * the parameter as an operand of # operator.
1176
+ * Return the current pointer into replacement text if the token following #
1177
+ * is a parameter name, else return NULL.
1178
+ */
1179
+ {
1180
+ int c;
1181
+ char * temp;
1182
+
1183
+ *repl_cur++ = ST_QUOTE; /* Prefix */
1184
+ if (char_type[ c = get_ch()] & HSP) { /* There is a space */
1185
+ *repl_cur++ = ' ';
1186
+ while (char_type[ c = get_ch()] & HSP) /* Skip excessive spaces*/
1187
+ ;
1188
+ }
1189
+ token_p = repl_cur; /* Remember the pointer */
1190
+ if (scan_token( c, &repl_cur, repl_end) == NAM) {
1191
+ if ((temp = is_formal( identifier, TRUE)) != NULL) {
1192
+ repl_cur = temp;
1193
+ return repl_cur;
1194
+ }
1195
+ }
1196
+ cerror( "Not a formal parameter \"%s\"", token_p, 0L, NULL); /* _E_ */
1197
+ return NULL;
1198
+ }
1199
+
1200
+ static char * mgtoken_save( const char * macroname)
1201
+ /*
1202
+ * A magic cookie is inserted if the token is identical to the macro name,
1203
+ * so the expansion doesn't recurse.
1204
+ * Return the advanced pointer into the replacement text or NULL.
1205
+ */
1206
+ {
1207
+ char * repl_cur;
1208
+
1209
+ if (str_eq( macroname, identifier)) { /* Macro name in body */
1210
+ repl_cur = token_p; /* Overwrite on token */
1211
+ *repl_cur++ = DEF_MAGIC; /* Save magic marker */
1212
+ repl_cur = stpcpy( repl_cur, identifier);
1213
+ /* And save the token */
1214
+ return repl_cur;
1215
+ } else {
1216
+ return NULL;
1217
+ }
1218
+ }
1219
+
1220
+ static char * str_parm_scan( char * string_end)
1221
+ /*
1222
+ * String parameter scan.
1223
+ * This code -- if enabled -- recognizes a formal parameter in a string
1224
+ * literal or in a character constant.
1225
+ * #define foo(bar, v) printf("%bar\n", v)
1226
+ * foo( d, i)
1227
+ * expands to:
1228
+ * printf("%d\n", i)
1229
+ * str_parm_scan() return the advanced pointer into the replacement text.
1230
+ * This has been superceded by # stringizing and string concatenation.
1231
+ * This routine is called only in OLD_PREP mode.
1232
+ */
1233
+ {
1234
+ int delim;
1235
+ int c;
1236
+ char * tp;
1237
+ char * wp; /* Pointer into the quoted literal */
1238
+
1239
+ delim = *token_p;
1240
+ unget_string( ++token_p, NULL);
1241
+ /* Pseudo-token-parsing in a string literal */
1242
+ wp = token_p;
1243
+ while ((c = get_ch()) != delim) {
1244
+ token_p = wp;
1245
+ if (scan_token( c, &wp, string_end) != NAM)
1246
+ continue;
1247
+ if ((tp = is_formal( token_p, TRUE)) != NULL)
1248
+ wp = tp;
1249
+ }
1250
+ *wp++ = delim;
1251
+ return wp;
1252
+ }
1253
+
1254
+ static void do_undef( void)
1255
+ /*
1256
+ * Remove the symbol from the defined list.
1257
+ * Called from directive().
1258
+ */
1259
+ {
1260
+ DEFBUF * defp;
1261
+ int c;
1262
+
1263
+ if ((c = skip_ws()) == '\n') {
1264
+ cerror( no_ident, NULL, 0L, NULL);
1265
+ unget_ch();
1266
+ return;
1267
+ }
1268
+ if (scan_token( c, (workp = work_buf, &workp), work_end) != NAM) {
1269
+ cerror( not_ident, work_buf, 0L, NULL);
1270
+ skip_nl();
1271
+ unget_ch();
1272
+ } else {
1273
+ if ((defp = look_id( identifier)) == NULL) {
1274
+ if (warn_level & 8)
1275
+ cwarn( "\"%s\" wasn't defined" /* _W8_ */
1276
+ , identifier, 0L, NULL);
1277
+ } else if (standard && (defp->nargs <= DEF_NOARGS_STANDARD
1278
+ /* Standard predef */
1279
+ || defp->nargs == DEF_PRAGMA)) {
1280
+ /* _Pragma() pseudo-macro */
1281
+ cerror( "\"%s\" shouldn't be undefined" /* _E_ */
1282
+ , identifier, 0L, NULL);
1283
+ } else if (standard) {
1284
+ c = skip_ws();
1285
+ unget_ch();
1286
+ if (c != '\n') /* Trailing junk */
1287
+ return;
1288
+ else
1289
+ undefine( identifier);
1290
+ } else {
1291
+ undefine( identifier);
1292
+ }
1293
+ }
1294
+ }
1295
+
1296
+ /*
1297
+ * C P P S y m b o l T a b l e s
1298
+ *
1299
+ * SBSIZE defines the number of hash-table slots for the symbol table.
1300
+ * It must be a power of 2.
1301
+ */
1302
+
1303
+ /* Symbol table queue headers. */
1304
+ static DEFBUF * symtab[ SBSIZE];
1305
+ static long num_of_macro = 0;
1306
+
1307
+ #if MCPP_LIB
1308
+ void init_directive( void)
1309
+ /* Initialize static variables. */
1310
+ {
1311
+ num_of_macro = 0;
1312
+ }
1313
+ #endif
1314
+
1315
+ DEFBUF * look_id( const char * name)
1316
+ /*
1317
+ * Look for the identifier in the symbol table.
1318
+ * If found, return the table pointer; Else return NULL.
1319
+ */
1320
+ {
1321
+ DEFBUF ** prevp;
1322
+ int cmp;
1323
+
1324
+ prevp = look_prev( name, &cmp);
1325
+
1326
+ if (standard)
1327
+ return ((cmp == 0 && (*prevp)->push == 0) ? *prevp : NULL);
1328
+ else
1329
+ return ((cmp == 0) ? *prevp : NULL);
1330
+ }
1331
+
1332
+ DEFBUF ** look_prev(
1333
+ const char * name, /* Name of the macro */
1334
+ int * cmp /* Result of comparison */
1335
+ )
1336
+ /*
1337
+ * Look for the place to insert the macro definition.
1338
+ * Return a pointer to the previous member in the linked list.
1339
+ */
1340
+ {
1341
+ const char * np;
1342
+ DEFBUF ** prevp;
1343
+ DEFBUF * dp;
1344
+ size_t s_name;
1345
+ int hash;
1346
+
1347
+ for (hash = 0, np = name; *np != EOS; )
1348
+ hash += *np++;
1349
+ hash += s_name = (size_t)(np - name);
1350
+ s_name++;
1351
+ prevp = & symtab[ hash & SBMASK];
1352
+ *cmp = -1; /* Initialize */
1353
+
1354
+ while ((dp = *prevp) != NULL) {
1355
+ if ((*cmp = memcmp( dp->name, name, s_name)) >= 0)
1356
+ break;
1357
+ prevp = &dp->link;
1358
+ }
1359
+
1360
+ return prevp;
1361
+ }
1362
+
1363
+ DEFBUF * look_and_install(
1364
+ const char * name, /* Name of the macro */
1365
+ int numargs, /* The numbers of parms */
1366
+ const char * parmnames, /* Names of parameters concatenated */
1367
+ const char * repl /* Replacement text */
1368
+ )
1369
+ /*
1370
+ * Look for the name and (re)define it.
1371
+ * Returns a pointer to the definition block.
1372
+ * Returns NULL if the symbol was Standard-predefined.
1373
+ */
1374
+ {
1375
+ DEFBUF ** prevp; /* Place to insert definition */
1376
+ DEFBUF * defp; /* New definition block */
1377
+ int cmp; /* Result of comparison of new name and old */
1378
+
1379
+ prevp = look_prev( name, &cmp);
1380
+ defp = install_macro( name, numargs, parmnames, repl, prevp, cmp, 0);
1381
+ return defp;
1382
+ }
1383
+
1384
+ DEFBUF * install_macro(
1385
+ const char * name, /* Name of the macro */
1386
+ int numargs, /* The numbers of parms */
1387
+ const char * parmnames, /* Names of parameters concatenated */
1388
+ const char * repl, /* Replacement text */
1389
+ DEFBUF ** prevp, /* The place to insert definition */
1390
+ int cmp, /* Result of comparison of new name and old */
1391
+ int predefine /* Predefined macro without leading '_' */
1392
+ )
1393
+ /*
1394
+ * Enter this name in the lookup table.
1395
+ * Returns a pointer to the definition block.
1396
+ * Returns NULL if the symbol was Standard-predefined.
1397
+ * Note that predefinedness can be specified by either of 'numargs' or
1398
+ * 'predefine'.
1399
+ */
1400
+ {
1401
+ DEFBUF * dp;
1402
+ DEFBUF * defp;
1403
+ size_t s_name, s_parmnames, s_repl;
1404
+
1405
+ defp = *prevp; /* Old definition, if cmp == 0 */
1406
+ if (cmp == 0 && defp->nargs < DEF_NOARGS - 1)
1407
+ return NULL; /* Standard predefined */
1408
+ if (parmnames == NULL || repl == NULL || (predefine && numargs > 0)
1409
+ || (predefine && predefine != DEF_NOARGS_PREDEF
1410
+ && predefine != DEF_NOARGS_PREDEF_OLD))
1411
+ /* Shouldn't happen */
1412
+ cfatal( "Bug: Illegal macro installation of \"%s\"" /* _F_ */
1413
+ , name, 0L, NULL); /* Use "" instead of NULL */
1414
+ s_name = strlen( name);
1415
+ if (mcpp_mode == STD)
1416
+ s_parmnames = strlen( parmnames) + 1;
1417
+ else
1418
+ s_parmnames = 0;
1419
+ s_repl = strlen( repl) + 1;
1420
+ dp = (DEFBUF *)
1421
+ xmalloc( sizeof (DEFBUF) + s_name + s_parmnames + s_repl);
1422
+ if (cmp || (standard && (*prevp)->push)) { /* New definition */
1423
+ dp->link = defp; /* Insert to linked list */
1424
+ *prevp = dp;
1425
+ } else { /* Redefinition */
1426
+ dp->link = defp->link; /* Replace old def with new */
1427
+ *prevp = dp;
1428
+ free( defp);
1429
+ }
1430
+ dp->nargs = predefine ? predefine : numargs;
1431
+ if (standard) {
1432
+ dp->push = 0;
1433
+ dp->parmnames = (char *)dp + sizeof (DEFBUF) + s_name;
1434
+ dp->repl = dp->parmnames + s_parmnames;
1435
+ if (mcpp_mode == STD)
1436
+ memcpy( dp->parmnames, parmnames, s_parmnames);
1437
+ } else {
1438
+ dp->repl = (char *)dp + sizeof (DEFBUF) + s_name;
1439
+ }
1440
+ memcpy( dp->name, name, s_name + 1);
1441
+ memcpy( dp->repl, repl, s_repl);
1442
+ /* Remember where the macro is defined */
1443
+ dp->fname = cur_fullname; /* Full-path-list of current file */
1444
+ dp->mline = src_line;
1445
+ if (standard && cmp && ++num_of_macro == std_limits.n_macro + 1
1446
+ && std_limits.n_macro && (warn_level & 4))
1447
+ /* '&& std_limits.n_macro' to avoid warning before initialization */
1448
+ cwarn( "More than %.0s%ld macros defined" /* _W4_ */
1449
+ , NULL , std_limits.n_macro, NULL);
1450
+ return dp;
1451
+ }
1452
+
1453
+ int undefine(
1454
+ const char * name /* Name of the macro */
1455
+ )
1456
+ /*
1457
+ * Delete the macro definition from the symbol table.
1458
+ * Returns TRUE, if deleted;
1459
+ * Else returns FALSE (when the macro was not defined or was Standard
1460
+ * predefined).
1461
+ */
1462
+ {
1463
+ DEFBUF ** prevp; /* Preceding definition in list */
1464
+ DEFBUF * dp; /* Definition to delete */
1465
+ int cmp; /* 0 if defined, else not defined */
1466
+
1467
+ prevp = look_prev( name, &cmp);
1468
+ dp = *prevp; /* Definition to delete */
1469
+ if (cmp || dp->nargs <= DEF_NOARGS_STANDARD)
1470
+ return FALSE; /* Not defined or Standard predefined */
1471
+ if (standard && dp->push)
1472
+ return FALSE; /* 'Pushed' macro */
1473
+ *prevp = dp->link; /* Link the previous and the next */
1474
+ if ((mcpp_debug & MACRO_CALL) && dp->mline) {
1475
+ /* Notice this directive unless the macro is predefined */
1476
+ mcpp_fprintf( OUT, "/*undef %ld*//*%s*/\n", src_line, dp->name);
1477
+ wrong_line = TRUE;
1478
+ }
1479
+ free( dp); /* Delete the definition */
1480
+ if (standard)
1481
+ num_of_macro--;
1482
+ return TRUE;
1483
+ }
1484
+
1485
+ static void dump_repl(
1486
+ const DEFBUF * dp,
1487
+ FILE * fp,
1488
+ int gcc2_va
1489
+ )
1490
+ /*
1491
+ * Dump replacement text.
1492
+ */
1493
+ {
1494
+ int numargs = dp->nargs;
1495
+ char * cp1;
1496
+ size_t i;
1497
+ int c;
1498
+ const char * cp;
1499
+
1500
+ for (cp = dp->repl; (c = *cp++ & UCHARMAX) != EOS; ) {
1501
+
1502
+ switch (c) {
1503
+ case MAC_PARM: /* Parameter */
1504
+ c = (*cp++ & UCHARMAX) - 1;
1505
+ if (standard) {
1506
+ PARM parm = parms[ c];
1507
+ if ((numargs & VA_ARGS) && c == (numargs & ~AVA_ARGS) - 1) {
1508
+ mcpp_fputs( gcc2_va ? parm.name : "__VA_ARGS__"
1509
+ , FP2DEST( fp));
1510
+ /* gcc2_va is possible only in STD mode */
1511
+ } else {
1512
+ if (mcpp_mode == STD) {
1513
+ for (i = 0, cp1 = parm.name; i < parm.len; i++)
1514
+ mcpp_fputc( *cp1++, FP2DEST( fp));
1515
+ } else {
1516
+ mcpp_fputc( 'a' + c % 26, FP2DEST( fp));
1517
+ if (c > 26)
1518
+ mcpp_fputc( '0' + c / 26, FP2DEST( fp));
1519
+ }
1520
+ }
1521
+ } else {
1522
+ mcpp_fputc( 'a' + c % 26, FP2DEST( fp));
1523
+ if (c > 26)
1524
+ mcpp_fputc( '0' + c / 26, FP2DEST( fp));
1525
+ }
1526
+ break;
1527
+ case DEF_MAGIC:
1528
+ if (! standard)
1529
+ mcpp_fputc( c, FP2DEST( fp));
1530
+ /* Else skip */
1531
+ break;
1532
+ case CAT:
1533
+ if (standard)
1534
+ mcpp_fputs( "##", FP2DEST( fp));
1535
+ else
1536
+ mcpp_fputc( c, FP2DEST( fp));
1537
+ break;
1538
+ case ST_QUOTE:
1539
+ if (standard)
1540
+ mcpp_fputs( "#", FP2DEST( fp));
1541
+ else
1542
+ mcpp_fputc( c, FP2DEST( fp));
1543
+ break;
1544
+ case COM_SEP:
1545
+ /*
1546
+ * Though TOK_SEP coincides to COM_SEP, this cannot appear in
1547
+ * Standard mode.
1548
+ */
1549
+ if (mcpp_mode == OLD_PREP)
1550
+ mcpp_fputs( "/**/", FP2DEST( fp));
1551
+ break;
1552
+ default:
1553
+ mcpp_fputc( c, FP2DEST( fp));
1554
+ break;
1555
+ }
1556
+ }
1557
+ }
1558
+
1559
+ /*
1560
+ * If the compiler is so-called "one-pass" compiler, compiler-predefined
1561
+ * macros are commented out to avoid redefinition.
1562
+ */
1563
+ #if ONE_PASS
1564
+ #define CAN_REDEF DEF_NOARGS
1565
+ #else
1566
+ #define CAN_REDEF DEF_NOARGS_PREDEF
1567
+ #endif
1568
+
1569
+ void dump_a_def(
1570
+ const char * why,
1571
+ const DEFBUF * dp,
1572
+ int newdef, /* TRUE if parmnames are currently in parms[] */
1573
+ int comment, /* Show location of the definition in comment */
1574
+ FILE * fp
1575
+ )
1576
+ /*
1577
+ * Dump a macro definition.
1578
+ */
1579
+ {
1580
+ char * cp, * cp1;
1581
+ int numargs = dp->nargs & ~AVA_ARGS;
1582
+ int commented; /* To be commented out */
1583
+ int gcc2_va = FALSE; /* GCC2-spec variadic */
1584
+ int i;
1585
+
1586
+ if (standard && numargs == DEF_PRAGMA) /* _Pragma pseudo-macro */
1587
+ return;
1588
+ if ((numargs < CAN_REDEF) || (standard && dp->push))
1589
+ commented = TRUE;
1590
+ else
1591
+ commented = FALSE;
1592
+ if (! comment && commented) /* For -dM option */
1593
+ return;
1594
+ if (why)
1595
+ mcpp_fprintf( FP2DEST( fp), "%s \"%s\" defined as: ", why, dp->name);
1596
+ mcpp_fprintf( FP2DEST( fp), "%s#define %s", commented ? "/* " : "",
1597
+ dp->name); /* Macro name */
1598
+ if (numargs >= 0) { /* Parameter list */
1599
+ if (mcpp_mode == STD) {
1600
+ const char * appendix = null;
1601
+ if (! newdef) {
1602
+ /* Make parms[] for dump_repl() */
1603
+ for (i = 0, cp = dp->parmnames; i < numargs;
1604
+ i++, cp = cp1 + 1) {
1605
+ if ((cp1 = strchr( cp, ',')) == NULL) /* The last arg */
1606
+ parms[ i].len = strlen( cp);
1607
+ else
1608
+ parms[ i].len = (size_t) (cp1 - cp);
1609
+ parms[ i].name = cp;
1610
+ }
1611
+ }
1612
+ #if COMPILER == GNUC
1613
+ if ((dp->nargs & VA_ARGS)
1614
+ && memcmp( parms[ numargs - 1].name, "...", 3) != 0) {
1615
+ appendix = "..."; /* Append ... so as to become 'args...' */
1616
+ gcc2_va = TRUE;
1617
+ }
1618
+ #endif
1619
+ mcpp_fprintf( FP2DEST( fp), "(%s%s)", dp->parmnames, appendix);
1620
+ } else {
1621
+ if (newdef) {
1622
+ mcpp_fprintf( FP2DEST( fp), "(%s)", parms[ 0].name);
1623
+ } else if (numargs == 0) {
1624
+ mcpp_fputs( "()", FP2DEST( fp));
1625
+ } else {
1626
+ /* Print parameter list automatically made as: */
1627
+ /* a, b, c, ..., a0, b0, c0, ..., a1, b1, c1, ... */
1628
+ mcpp_fputc( '(', FP2DEST( fp));
1629
+ for (i = 0; i < numargs; i++) { /* Make parameter list */
1630
+ mcpp_fputc( 'a' + i % 26, FP2DEST( fp));
1631
+ if (i >= 26)
1632
+ mcpp_fputc( '0' + i / 26, FP2DEST( fp));
1633
+ if (i + 1 < numargs)
1634
+ mcpp_fputc( ',', FP2DEST( fp));
1635
+ }
1636
+ mcpp_fputc( ')', FP2DEST( fp));
1637
+ }
1638
+ }
1639
+ }
1640
+ if (*dp->repl) {
1641
+ mcpp_fputc( ' ', FP2DEST( fp));
1642
+ dump_repl( dp, fp, gcc2_va); /* Replacement text */
1643
+ }
1644
+ if (commented)
1645
+ /* Standard predefined or one-pass-compiler-predefined */
1646
+ mcpp_fputs( " */", FP2DEST( fp));
1647
+ if (comment) /* Not -dM option */
1648
+ mcpp_fprintf( FP2DEST( fp), " \t/* %s:%ld\t*/", dp->fname, dp->mline);
1649
+ mcpp_fputc( '\n', FP2DEST( fp));
1650
+ }
1651
+
1652
+ void dump_def(
1653
+ int comment, /* Location of definition in comment */
1654
+ int K_opt /* -K option is specified */
1655
+ )
1656
+ /*
1657
+ * Dump all the current macro definitions to output stream.
1658
+ */
1659
+ {
1660
+ DEFBUF * dp;
1661
+ DEFBUF ** symp;
1662
+
1663
+ sharp( NULL, 0); /* Report the current source file & line */
1664
+ if (comment)
1665
+ mcpp_fputs( "/* Currently defined macros. */\n", OUT);
1666
+ for (symp = symtab; symp < &symtab[ SBSIZE]; symp++) {
1667
+ if ((dp = *symp) != NULL) {
1668
+ do {
1669
+ if (K_opt)
1670
+ mcpp_fprintf( OUT, "/*m%s*/\n", dp->name);
1671
+ else
1672
+ dump_a_def( NULL, dp, FALSE, comment, fp_out);
1673
+ } while ((dp = dp->link) != NULL);
1674
+ }
1675
+ }
1676
+ wrong_line = TRUE; /* Line number is out of sync */
1677
+ }
1678
+
1679
+ #if MCPP_LIB
1680
+ void clear_symtable( void)
1681
+ /*
1682
+ * Free all the macro definitions.
1683
+ */
1684
+ {
1685
+ DEFBUF * next;
1686
+ DEFBUF * dp;
1687
+ DEFBUF ** symp;
1688
+
1689
+ for (symp = symtab; symp < &symtab[ SBSIZE]; symp++) {
1690
+ for (next = *symp; next != NULL; ) {
1691
+ dp = next;
1692
+ next = dp->link;
1693
+ free( dp); /* Free the symbol */
1694
+ }
1695
+ *symp = NULL;
1696
+ }
1697
+ }
1698
+ #endif
1699
+