PageRenderTime 119ms CodeModel.GetById 21ms RepoModel.GetById 1ms app.codeStats 0ms

/gecko_api/include/nsISupportsImpl.h

http://firefox-mac-pdf.googlecode.com/
C Header | 1346 lines | 960 code | 194 blank | 192 comment | 45 complexity | b99377a3e463a67cf34e0f8031c3901b MD5 | raw file
  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* ***** BEGIN LICENSE BLOCK *****
  3. * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4. *
  5. * The contents of this file are subject to the Mozilla Public License Version
  6. * 1.1 (the "License"); you may not use this file except in compliance with
  7. * the License. You may obtain a copy of the License at
  8. * http://www.mozilla.org/MPL/
  9. *
  10. * Software distributed under the License is distributed on an "AS IS" basis,
  11. * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12. * for the specific language governing rights and limitations under the
  13. * License.
  14. *
  15. * The Original Code is XPCOM.
  16. *
  17. * The Initial Developer of the Original Code is Netscape Communications Corp.
  18. * Portions created by the Initial Developer are Copyright (C) 2001
  19. * the Initial Developer. All Rights Reserved.
  20. *
  21. * Contributor(s):
  22. *
  23. * Alternatively, the contents of this file may be used under the terms of
  24. * either the GNU General Public License Version 2 or later (the "GPL"), or
  25. * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  26. * in which case the provisions of the GPL or the LGPL are applicable instead
  27. * of those above. If you wish to allow use of your version of this file only
  28. * under the terms of either the GPL or the LGPL, and not to allow others to
  29. * use your version of this file under the terms of the MPL, indicate your
  30. * decision by deleting the provisions above and replace them with the notice
  31. * and other provisions required by the GPL or the LGPL. If you do not delete
  32. * the provisions above, a recipient may use your version of this file under
  33. * the terms of any one of the MPL, the GPL or the LGPL.
  34. *
  35. * ***** END LICENSE BLOCK ***** */
  36. #ifndef nsISupportsImpl_h__
  37. #define nsISupportsImpl_h__
  38. #ifndef nscore_h___
  39. #include "nscore.h"
  40. #endif
  41. #ifndef nsISupportsBase_h__
  42. #include "nsISupportsBase.h"
  43. #endif
  44. #ifndef nsISupportsUtils_h__
  45. #include "nsISupportsUtils.h"
  46. #endif
  47. #if !defined(XPCOM_GLUE_AVOID_NSPR)
  48. #include "prthread.h" /* needed for thread-safety checks */
  49. #include "pratom.h" /* needed for PR_AtomicIncrement and PR_AtomicDecrement */
  50. #endif
  51. #include "nsDebug.h"
  52. #include "nsTraceRefcnt.h"
  53. #include "nsCycleCollector.h"
  54. ////////////////////////////////////////////////////////////////////////////////
  55. // Macros to help detect thread-safety:
  56. #if defined(NS_DEBUG) && !defined(XPCOM_GLUE_AVOID_NSPR)
  57. class nsAutoOwningThread {
  58. public:
  59. nsAutoOwningThread() { mThread = PR_GetCurrentThread(); }
  60. void *GetThread() const { return mThread; }
  61. private:
  62. void *mThread;
  63. };
  64. #define NS_DECL_OWNINGTHREAD nsAutoOwningThread _mOwningThread;
  65. #define NS_ASSERT_OWNINGTHREAD(_class) \
  66. NS_CheckThreadSafe(_mOwningThread.GetThread(), #_class " not thread-safe")
  67. #else // !NS_DEBUG
  68. #define NS_DECL_OWNINGTHREAD /* nothing */
  69. #define NS_ASSERT_OWNINGTHREAD(_class) ((void)0)
  70. #endif // NS_DEBUG
  71. #define NS_PURPLE_BIT ((PRUint32)(1 << 31))
  72. #define NS_PURPLE_MASK (~NS_PURPLE_BIT)
  73. #define NS_PURPLE_BIT_SET(x) ((x) & (NS_PURPLE_BIT))
  74. #define NS_CLEAR_PURPLE_BIT(x) ((x) &= (NS_PURPLE_MASK))
  75. #define NS_VALUE_WITHOUT_PURPLE_BIT(x) ((x) & (NS_PURPLE_MASK))
  76. // Support for ISupports classes which interact with cycle collector.
  77. class nsCycleCollectingAutoRefCnt {
  78. public:
  79. nsCycleCollectingAutoRefCnt()
  80. : mValue(0)
  81. {}
  82. nsCycleCollectingAutoRefCnt(nsrefcnt aValue)
  83. : mValue(aValue)
  84. {
  85. NS_CLEAR_PURPLE_BIT(mValue);
  86. }
  87. nsrefcnt incr(nsISupports *owner)
  88. {
  89. if (NS_UNLIKELY(mValue == NS_PURPLE_BIT)) {
  90. // The sentinel value "purple bit alone, refcount 0" means
  91. // that we're stabilized, during finalization. In this
  92. // state we lie about our actual refcount if anyone asks
  93. // and say it's 2, which is basically true: the caller who
  94. // is incrementing has a reference, as does the decr() frame
  95. // that stabilized-and-is-deleting us.
  96. return 2;
  97. }
  98. nsrefcnt tmp = get();
  99. PRBool purple = static_cast<PRBool>(NS_PURPLE_BIT_SET(mValue));
  100. if (NS_UNLIKELY(purple)) {
  101. NS_ASSERTION(tmp != 0, "purple ISupports pointer with zero refcnt");
  102. if (!NS_CycleCollectorForget(owner))
  103. tmp |= NS_PURPLE_BIT;
  104. }
  105. mValue = tmp + 1;
  106. return mValue;
  107. }
  108. void stabilizeForDeletion(nsISupports *owner)
  109. {
  110. mValue = NS_PURPLE_BIT;
  111. }
  112. nsrefcnt decr(nsISupports *owner)
  113. {
  114. if (NS_UNLIKELY(mValue == NS_PURPLE_BIT))
  115. return 1;
  116. nsrefcnt tmp = get();
  117. NS_ASSERTION(tmp >= 1, "decr() called with zero refcnt");
  118. PRBool purple = static_cast<PRBool>(NS_PURPLE_BIT_SET(mValue));
  119. PRBool shouldBePurple = tmp > 1;
  120. if (NS_UNLIKELY(shouldBePurple && !purple)) {
  121. if (!NS_CycleCollectorSuspect(owner))
  122. shouldBePurple = PR_FALSE;
  123. } else if (NS_UNLIKELY(tmp == 1 && purple)) {
  124. if (!NS_CycleCollectorForget(owner)) {
  125. NS_NOTREACHED("forget should not fail when reference count hits 0");
  126. }
  127. }
  128. --tmp;
  129. if (shouldBePurple)
  130. mValue = tmp | NS_PURPLE_BIT;
  131. else
  132. mValue = tmp;
  133. return tmp;
  134. }
  135. void unmarkPurple()
  136. {
  137. if (NS_LIKELY(mValue != NS_PURPLE_BIT))
  138. NS_CLEAR_PURPLE_BIT(mValue);
  139. }
  140. nsrefcnt get() const
  141. {
  142. if (NS_UNLIKELY(mValue == NS_PURPLE_BIT))
  143. return 1;
  144. return NS_VALUE_WITHOUT_PURPLE_BIT(mValue);
  145. }
  146. operator nsrefcnt() const
  147. {
  148. return get();
  149. }
  150. private:
  151. nsrefcnt mValue;
  152. };
  153. class nsAutoRefCnt {
  154. public:
  155. nsAutoRefCnt() : mValue(0) {}
  156. nsAutoRefCnt(nsrefcnt aValue) : mValue(aValue) {}
  157. // only support prefix increment/decrement
  158. nsrefcnt operator++() { return ++mValue; }
  159. nsrefcnt operator--() { return --mValue; }
  160. nsrefcnt operator=(nsrefcnt aValue) { return (mValue = aValue); }
  161. operator nsrefcnt() const { return mValue; }
  162. nsrefcnt get() const { return mValue; }
  163. private:
  164. // do not define these to enforce the faster prefix notation
  165. nsrefcnt operator++(int);
  166. nsrefcnt operator--(int);
  167. nsrefcnt mValue;
  168. };
  169. ///////////////////////////////////////////////////////////////////////////////
  170. /**
  171. * Declare the reference count variable and the implementations of the
  172. * AddRef and QueryInterface methods.
  173. */
  174. #define NS_DECL_ISUPPORTS \
  175. public: \
  176. NS_IMETHOD QueryInterface(REFNSIID aIID, \
  177. void** aInstancePtr); \
  178. NS_IMETHOD_(nsrefcnt) AddRef(void); \
  179. NS_IMETHOD_(nsrefcnt) Release(void); \
  180. protected: \
  181. nsAutoRefCnt mRefCnt; \
  182. NS_DECL_OWNINGTHREAD \
  183. public:
  184. #define NS_DECL_CYCLE_COLLECTING_ISUPPORTS \
  185. public: \
  186. NS_IMETHOD QueryInterface(REFNSIID aIID, \
  187. void** aInstancePtr); \
  188. NS_IMETHOD_(nsrefcnt) AddRef(void); \
  189. NS_IMETHOD_(nsrefcnt) Release(void); \
  190. void UnmarkPurple() \
  191. { \
  192. mRefCnt.unmarkPurple(); \
  193. } \
  194. protected: \
  195. nsCycleCollectingAutoRefCnt mRefCnt; \
  196. NS_DECL_OWNINGTHREAD \
  197. public:
  198. ///////////////////////////////////////////////////////////////////////////////
  199. /**
  200. * Previously used to initialize the reference count, but no longer needed.
  201. *
  202. * DEPRECATED.
  203. */
  204. #define NS_INIT_ISUPPORTS() ((void)0)
  205. /**
  206. * Use this macro to implement the AddRef method for a given <i>_class</i>
  207. * @param _class The name of the class implementing the method
  208. */
  209. #define NS_IMPL_ADDREF(_class) \
  210. NS_IMETHODIMP_(nsrefcnt) _class::AddRef(void) \
  211. { \
  212. NS_PRECONDITION(PRInt32(mRefCnt) >= 0, "illegal refcnt"); \
  213. NS_ASSERT_OWNINGTHREAD(_class); \
  214. ++mRefCnt; \
  215. NS_LOG_ADDREF(this, mRefCnt, #_class, sizeof(*this)); \
  216. return mRefCnt; \
  217. }
  218. /**
  219. * Use this macro to implement the AddRef method for a given <i>_class</i>
  220. * implemented as a wholly owned aggregated object intended to implement
  221. * interface(s) for its owner
  222. * @param _class The name of the class implementing the method
  223. * @param _aggregator the owning/containing object
  224. */
  225. #define NS_IMPL_ADDREF_USING_AGGREGATOR(_class, _aggregator) \
  226. NS_IMETHODIMP_(nsrefcnt) _class::AddRef(void) \
  227. { \
  228. NS_PRECONDITION(_aggregator, "null aggregator"); \
  229. return (_aggregator)->AddRef(); \
  230. }
  231. /**
  232. * Use this macro to implement the Release method for a given
  233. * <i>_class</i>.
  234. * @param _class The name of the class implementing the method
  235. * @param _destroy A statement that is executed when the object's
  236. * refcount drops to zero.
  237. *
  238. * For example,
  239. *
  240. * NS_IMPL_RELEASE_WITH_DESTROY(Foo, Destroy(this))
  241. *
  242. * will cause
  243. *
  244. * Destroy(this);
  245. *
  246. * to be invoked when the object's refcount drops to zero. This
  247. * allows for arbitrary teardown activity to occur (e.g., deallocation
  248. * of object allocated with placement new).
  249. */
  250. #define NS_IMPL_RELEASE_WITH_DESTROY(_class, _destroy) \
  251. NS_IMETHODIMP_(nsrefcnt) _class::Release(void) \
  252. { \
  253. NS_PRECONDITION(0 != mRefCnt, "dup release"); \
  254. NS_ASSERT_OWNINGTHREAD(_class); \
  255. --mRefCnt; \
  256. NS_LOG_RELEASE(this, mRefCnt, #_class); \
  257. if (mRefCnt == 0) { \
  258. mRefCnt = 1; /* stabilize */ \
  259. _destroy; \
  260. return 0; \
  261. } \
  262. return mRefCnt; \
  263. }
  264. /**
  265. * Use this macro to implement the Release method for a given <i>_class</i>
  266. * @param _class The name of the class implementing the method
  267. *
  268. * A note on the 'stabilization' of the refcnt to one. At that point,
  269. * the object's refcount will have gone to zero. The object's
  270. * destructor may trigger code that attempts to QueryInterface() and
  271. * Release() 'this' again. Doing so will temporarily increment and
  272. * decrement the refcount. (Only a logic error would make one try to
  273. * keep a permanent hold on 'this'.) To prevent re-entering the
  274. * destructor, we make sure that no balanced refcounting can return
  275. * the refcount to |0|.
  276. */
  277. #define NS_IMPL_RELEASE(_class) \
  278. NS_IMPL_RELEASE_WITH_DESTROY(_class, NS_DELETEXPCOM(this))
  279. /**
  280. * Use this macro to implement the Release method for a given <i>_class</i>
  281. * implemented as a wholly owned aggregated object intended to implement
  282. * interface(s) for its owner
  283. * @param _class The name of the class implementing the method
  284. * @param _aggregator the owning/containing object
  285. */
  286. #define NS_IMPL_RELEASE_USING_AGGREGATOR(_class, _aggregator) \
  287. NS_IMETHODIMP_(nsrefcnt) _class::Release(void) \
  288. { \
  289. NS_PRECONDITION(_aggregator, "null aggregator"); \
  290. return (_aggregator)->Release(); \
  291. }
  292. #define NS_IMPL_CYCLE_COLLECTING_ADDREF_AMBIGUOUS(_class, _basetype) \
  293. NS_IMETHODIMP_(nsrefcnt) _class::AddRef(void) \
  294. { \
  295. NS_PRECONDITION(PRInt32(mRefCnt) >= 0, "illegal refcnt"); \
  296. NS_ASSERT_OWNINGTHREAD(_class); \
  297. nsrefcnt count = \
  298. mRefCnt.incr(NS_CYCLE_COLLECTION_CLASSNAME(_class)::Upcast(this)); \
  299. NS_LOG_ADDREF(this, count, #_class, sizeof(*this)); \
  300. return count; \
  301. }
  302. #define NS_IMPL_CYCLE_COLLECTING_ADDREF(_class) \
  303. NS_IMPL_CYCLE_COLLECTING_ADDREF_AMBIGUOUS(_class, _class)
  304. #define NS_IMPL_CYCLE_COLLECTING_RELEASE_FULL(_class, _basetype, _destroy) \
  305. NS_IMETHODIMP_(nsrefcnt) _class::Release(void) \
  306. { \
  307. NS_PRECONDITION(0 != mRefCnt, "dup release"); \
  308. NS_ASSERT_OWNINGTHREAD(_class); \
  309. nsISupports *base = NS_CYCLE_COLLECTION_CLASSNAME(_class)::Upcast(this); \
  310. nsrefcnt count = mRefCnt.decr(base); \
  311. NS_LOG_RELEASE(this, count, #_class); \
  312. if (count == 0) { \
  313. mRefCnt.stabilizeForDeletion(base); \
  314. _destroy; \
  315. return 0; \
  316. } \
  317. return count; \
  318. }
  319. #define NS_IMPL_CYCLE_COLLECTING_RELEASE_WITH_DESTROY(_class, _destroy) \
  320. NS_IMPL_CYCLE_COLLECTING_RELEASE_FULL(_class, _class, _destroy)
  321. #define NS_IMPL_CYCLE_COLLECTING_RELEASE_AMBIGUOUS_WITH_DESTROY(_class, _basetype, _destroy) \
  322. NS_IMPL_CYCLE_COLLECTING_RELEASE_FULL(_class, _basetype, _destroy)
  323. #define NS_IMPL_CYCLE_COLLECTING_RELEASE_AMBIGUOUS(_class, _basetype) \
  324. NS_IMPL_CYCLE_COLLECTING_RELEASE_FULL(_class, _basetype, NS_DELETEXPCOM(this))
  325. #define NS_IMPL_CYCLE_COLLECTING_RELEASE(_class) \
  326. NS_IMPL_CYCLE_COLLECTING_RELEASE_FULL(_class, _class, NS_DELETEXPCOM(this))
  327. ///////////////////////////////////////////////////////////////////////////////
  328. /**
  329. * There are two ways of implementing QueryInterface, and we use both:
  330. *
  331. * Table-driven QueryInterface uses a static table of IID->offset mappings
  332. * and a shared helper function. Using it tends to reduce codesize and improve
  333. * runtime performance (due to processor cache hits).
  334. *
  335. * Macro-driven QueryInterface generates a QueryInterface function directly
  336. * using common macros. This is necessary if special QueryInterface features
  337. * are being used (such as tearoffs and conditional interfaces).
  338. *
  339. * These methods can be combined into a table-driven function call followed
  340. * by custom code for tearoffs and conditionals.
  341. */
  342. struct QITableEntry
  343. {
  344. const nsIID *iid; // null indicates end of the QITableEntry array
  345. PROffset32 offset;
  346. };
  347. NS_COM_GLUE nsresult NS_FASTCALL
  348. NS_TableDrivenQI(void* aThis, const QITableEntry* entries,
  349. REFNSIID aIID, void **aInstancePtr);
  350. /**
  351. * Implement table-driven queryinterface
  352. */
  353. #define NS_INTERFACE_TABLE_HEAD(_class) \
  354. NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \
  355. { \
  356. NS_ASSERTION(aInstancePtr, \
  357. "QueryInterface requires a non-NULL destination!"); \
  358. nsresult rv = NS_ERROR_FAILURE;
  359. #define NS_INTERFACE_TABLE_BEGIN \
  360. static const QITableEntry table[] = {
  361. #define NS_INTERFACE_TABLE_ENTRY(_class, _interface) \
  362. { &_interface::COMTypeInfo<int>::kIID, \
  363. PROffset32(reinterpret_cast<char*>( \
  364. static_cast<_interface*>((_class*) 0x1000)) - \
  365. reinterpret_cast<char*>((_class*) 0x1000)) \
  366. },
  367. #define NS_INTERFACE_TABLE_ENTRY_AMBIGUOUS(_class, _interface, _implClass) \
  368. { &_interface::COMTypeInfo<int>::kIID, \
  369. PROffset32(reinterpret_cast<char*>( \
  370. static_cast<_interface*>( \
  371. static_cast<_implClass*>( \
  372. (_class*) 0x1000))) - \
  373. reinterpret_cast<char*>((_class*) 0x1000)) \
  374. },
  375. #define NS_INTERFACE_TABLE_END_WITH_PTR(_ptr) \
  376. { nsnull, 0 } }; \
  377. rv = NS_TableDrivenQI(static_cast<void*>(_ptr), \
  378. table, aIID, aInstancePtr);
  379. #define NS_INTERFACE_TABLE_END \
  380. NS_INTERFACE_TABLE_END_WITH_PTR(this)
  381. #define NS_INTERFACE_TABLE_TAIL \
  382. return rv; \
  383. }
  384. #define NS_INTERFACE_TABLE_TAIL_INHERITING(_baseclass) \
  385. if (NS_SUCCEEDED(rv)) \
  386. return rv; \
  387. return _baseclass::QueryInterface(aIID, aInstancePtr); \
  388. }
  389. #define NS_INTERFACE_TABLE_TAIL_USING_AGGREGATOR(_aggregator) \
  390. if (NS_SUCCEEDED(rv)) \
  391. return rv; \
  392. NS_ASSERTION(_aggregator, "null aggregator"); \
  393. return _aggregator->QueryInterface(aIID, aInstancePtr) \
  394. }
  395. /**
  396. * This implements query interface with two assumptions: First, the
  397. * class in question implements nsISupports and its own interface and
  398. * nothing else. Second, the implementation of the class's primary
  399. * inheritance chain leads to its own interface.
  400. *
  401. * @param _class The name of the class implementing the method
  402. * @param _classiiddef The name of the #define symbol that defines the IID
  403. * for the class (e.g. NS_ISUPPORTS_IID)
  404. */
  405. #define NS_IMPL_QUERY_HEAD(_class) \
  406. NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \
  407. { \
  408. NS_ASSERTION(aInstancePtr, \
  409. "QueryInterface requires a non-NULL destination!"); \
  410. nsISupports* foundInterface;
  411. #define NS_IMPL_QUERY_BODY(_interface) \
  412. if ( aIID.Equals(NS_GET_IID(_interface)) ) \
  413. foundInterface = static_cast<_interface*>(this); \
  414. else
  415. #define NS_IMPL_QUERY_BODY_CONDITIONAL(_interface, condition) \
  416. if ( (condition) && aIID.Equals(NS_GET_IID(_interface))) \
  417. foundInterface = static_cast<_interface*>(this); \
  418. else
  419. #define NS_IMPL_QUERY_BODY_AMBIGUOUS(_interface, _implClass) \
  420. if ( aIID.Equals(NS_GET_IID(_interface)) ) \
  421. foundInterface = static_cast<_interface*>( \
  422. static_cast<_implClass*>(this)); \
  423. else
  424. #define NS_IMPL_QUERY_BODY_AGGREGATED(_interface, _aggregate) \
  425. if ( aIID.Equals(NS_GET_IID(_interface)) ) \
  426. foundInterface = static_cast<_interface*>(_aggregate); \
  427. else
  428. #define NS_IMPL_QUERY_TAIL_GUTS \
  429. foundInterface = 0; \
  430. nsresult status; \
  431. if ( !foundInterface ) \
  432. status = NS_NOINTERFACE; \
  433. else \
  434. { \
  435. NS_ADDREF(foundInterface); \
  436. status = NS_OK; \
  437. } \
  438. *aInstancePtr = foundInterface; \
  439. return status; \
  440. }
  441. #define NS_IMPL_QUERY_TAIL_INHERITING(_baseclass) \
  442. foundInterface = 0; \
  443. nsresult status; \
  444. if ( !foundInterface ) \
  445. status = _baseclass::QueryInterface(aIID, (void**)&foundInterface); \
  446. else \
  447. { \
  448. NS_ADDREF(foundInterface); \
  449. status = NS_OK; \
  450. } \
  451. *aInstancePtr = foundInterface; \
  452. return status; \
  453. }
  454. #define NS_IMPL_QUERY_TAIL_USING_AGGREGATOR(_aggregator) \
  455. foundInterface = 0; \
  456. nsresult status; \
  457. if ( !foundInterface ) { \
  458. NS_ASSERTION(_aggregator, "null aggregator"); \
  459. status = _aggregator->QueryInterface(aIID, (void**)&foundInterface); \
  460. } else \
  461. { \
  462. NS_ADDREF(foundInterface); \
  463. status = NS_OK; \
  464. } \
  465. *aInstancePtr = foundInterface; \
  466. return status; \
  467. }
  468. #define NS_IMPL_QUERY_TAIL(_supports_interface) \
  469. NS_IMPL_QUERY_BODY_AMBIGUOUS(nsISupports, _supports_interface) \
  470. NS_IMPL_QUERY_TAIL_GUTS
  471. /*
  472. This is the new scheme. Using this notation now will allow us to switch to
  473. a table driven mechanism when it's ready. Note the difference between this
  474. and the (currently) underlying NS_IMPL_QUERY_INTERFACE mechanism. You must
  475. explicitly mention |nsISupports| when using the interface maps.
  476. */
  477. #define NS_INTERFACE_MAP_BEGIN(_implClass) NS_IMPL_QUERY_HEAD(_implClass)
  478. #define NS_INTERFACE_MAP_ENTRY(_interface) NS_IMPL_QUERY_BODY(_interface)
  479. #define NS_INTERFACE_MAP_ENTRY_CONDITIONAL(_interface, condition) \
  480. NS_IMPL_QUERY_BODY_CONDITIONAL(_interface, condition)
  481. #define NS_INTERFACE_MAP_ENTRY_AGGREGATED(_interface,_aggregate) \
  482. NS_IMPL_QUERY_BODY_AGGREGATED(_interface,_aggregate)
  483. #define NS_INTERFACE_MAP_END NS_IMPL_QUERY_TAIL_GUTS
  484. #define NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(_interface, _implClass) \
  485. NS_IMPL_QUERY_BODY_AMBIGUOUS(_interface, _implClass)
  486. #define NS_INTERFACE_MAP_END_INHERITING(_baseClass) \
  487. NS_IMPL_QUERY_TAIL_INHERITING(_baseClass)
  488. #define NS_INTERFACE_MAP_END_AGGREGATED(_aggregator) \
  489. NS_IMPL_QUERY_TAIL_USING_AGGREGATOR(_aggregator)
  490. #define NS_INTERFACE_TABLE0(_class) \
  491. NS_INTERFACE_TABLE_BEGIN \
  492. NS_INTERFACE_TABLE_ENTRY(_class, nsISupports) \
  493. NS_INTERFACE_TABLE_END
  494. #define NS_INTERFACE_TABLE1(_class, _i1) \
  495. NS_INTERFACE_TABLE_BEGIN \
  496. NS_INTERFACE_TABLE_ENTRY(_class, _i1) \
  497. NS_INTERFACE_TABLE_ENTRY_AMBIGUOUS(_class, nsISupports, _i1) \
  498. NS_INTERFACE_TABLE_END
  499. #define NS_INTERFACE_TABLE2(_class, _i1, _i2) \
  500. NS_INTERFACE_TABLE_BEGIN \
  501. NS_INTERFACE_TABLE_ENTRY(_class, _i1) \
  502. NS_INTERFACE_TABLE_ENTRY(_class, _i2) \
  503. NS_INTERFACE_TABLE_ENTRY_AMBIGUOUS(_class, nsISupports, _i1) \
  504. NS_INTERFACE_TABLE_END
  505. #define NS_INTERFACE_TABLE3(_class, _i1, _i2, _i3) \
  506. NS_INTERFACE_TABLE_BEGIN \
  507. NS_INTERFACE_TABLE_ENTRY(_class, _i1) \
  508. NS_INTERFACE_TABLE_ENTRY(_class, _i2) \
  509. NS_INTERFACE_TABLE_ENTRY(_class, _i3) \
  510. NS_INTERFACE_TABLE_ENTRY_AMBIGUOUS(_class, nsISupports, _i1) \
  511. NS_INTERFACE_TABLE_END
  512. #define NS_INTERFACE_TABLE4(_class, _i1, _i2, _i3, _i4) \
  513. NS_INTERFACE_TABLE_BEGIN \
  514. NS_INTERFACE_TABLE_ENTRY(_class, _i1) \
  515. NS_INTERFACE_TABLE_ENTRY(_class, _i2) \
  516. NS_INTERFACE_TABLE_ENTRY(_class, _i3) \
  517. NS_INTERFACE_TABLE_ENTRY(_class, _i4) \
  518. NS_INTERFACE_TABLE_ENTRY_AMBIGUOUS(_class, nsISupports, _i1) \
  519. NS_INTERFACE_TABLE_END
  520. #define NS_INTERFACE_TABLE5(_class, _i1, _i2, _i3, _i4, _i5) \
  521. NS_INTERFACE_TABLE_BEGIN \
  522. NS_INTERFACE_TABLE_ENTRY(_class, _i1) \
  523. NS_INTERFACE_TABLE_ENTRY(_class, _i2) \
  524. NS_INTERFACE_TABLE_ENTRY(_class, _i3) \
  525. NS_INTERFACE_TABLE_ENTRY(_class, _i4) \
  526. NS_INTERFACE_TABLE_ENTRY(_class, _i5) \
  527. NS_INTERFACE_TABLE_ENTRY_AMBIGUOUS(_class, nsISupports, _i1) \
  528. NS_INTERFACE_TABLE_END
  529. #define NS_INTERFACE_TABLE6(_class, _i1, _i2, _i3, _i4, _i5, _i6) \
  530. NS_INTERFACE_TABLE_BEGIN \
  531. NS_INTERFACE_TABLE_ENTRY(_class, _i1) \
  532. NS_INTERFACE_TABLE_ENTRY(_class, _i2) \
  533. NS_INTERFACE_TABLE_ENTRY(_class, _i3) \
  534. NS_INTERFACE_TABLE_ENTRY(_class, _i4) \
  535. NS_INTERFACE_TABLE_ENTRY(_class, _i5) \
  536. NS_INTERFACE_TABLE_ENTRY(_class, _i6) \
  537. NS_INTERFACE_TABLE_ENTRY_AMBIGUOUS(_class, nsISupports, _i1) \
  538. NS_INTERFACE_TABLE_END
  539. #define NS_INTERFACE_TABLE7(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7) \
  540. NS_INTERFACE_TABLE_BEGIN \
  541. NS_INTERFACE_TABLE_ENTRY(_class, _i1) \
  542. NS_INTERFACE_TABLE_ENTRY(_class, _i2) \
  543. NS_INTERFACE_TABLE_ENTRY(_class, _i3) \
  544. NS_INTERFACE_TABLE_ENTRY(_class, _i4) \
  545. NS_INTERFACE_TABLE_ENTRY(_class, _i5) \
  546. NS_INTERFACE_TABLE_ENTRY(_class, _i6) \
  547. NS_INTERFACE_TABLE_ENTRY(_class, _i7) \
  548. NS_INTERFACE_TABLE_ENTRY_AMBIGUOUS(_class, nsISupports, _i1) \
  549. NS_INTERFACE_TABLE_END
  550. #define NS_INTERFACE_TABLE8(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8) \
  551. NS_INTERFACE_TABLE_BEGIN \
  552. NS_INTERFACE_TABLE_ENTRY(_class, _i1) \
  553. NS_INTERFACE_TABLE_ENTRY(_class, _i2) \
  554. NS_INTERFACE_TABLE_ENTRY(_class, _i3) \
  555. NS_INTERFACE_TABLE_ENTRY(_class, _i4) \
  556. NS_INTERFACE_TABLE_ENTRY(_class, _i5) \
  557. NS_INTERFACE_TABLE_ENTRY(_class, _i6) \
  558. NS_INTERFACE_TABLE_ENTRY(_class, _i7) \
  559. NS_INTERFACE_TABLE_ENTRY(_class, _i8) \
  560. NS_INTERFACE_TABLE_ENTRY_AMBIGUOUS(_class, nsISupports, _i1) \
  561. NS_INTERFACE_TABLE_END
  562. #define NS_INTERFACE_TABLE9(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, \
  563. _i8, _i9) \
  564. NS_INTERFACE_TABLE_BEGIN \
  565. NS_INTERFACE_TABLE_ENTRY(_class, _i1) \
  566. NS_INTERFACE_TABLE_ENTRY(_class, _i2) \
  567. NS_INTERFACE_TABLE_ENTRY(_class, _i3) \
  568. NS_INTERFACE_TABLE_ENTRY(_class, _i4) \
  569. NS_INTERFACE_TABLE_ENTRY(_class, _i5) \
  570. NS_INTERFACE_TABLE_ENTRY(_class, _i6) \
  571. NS_INTERFACE_TABLE_ENTRY(_class, _i7) \
  572. NS_INTERFACE_TABLE_ENTRY(_class, _i8) \
  573. NS_INTERFACE_TABLE_ENTRY(_class, _i9) \
  574. NS_INTERFACE_TABLE_ENTRY_AMBIGUOUS(_class, nsISupports, _i1) \
  575. NS_INTERFACE_TABLE_END
  576. #define NS_INTERFACE_TABLE10(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, \
  577. _i8, _i9, _i10) \
  578. NS_INTERFACE_TABLE_BEGIN \
  579. NS_INTERFACE_TABLE_ENTRY(_class, _i1) \
  580. NS_INTERFACE_TABLE_ENTRY(_class, _i2) \
  581. NS_INTERFACE_TABLE_ENTRY(_class, _i3) \
  582. NS_INTERFACE_TABLE_ENTRY(_class, _i4) \
  583. NS_INTERFACE_TABLE_ENTRY(_class, _i5) \
  584. NS_INTERFACE_TABLE_ENTRY(_class, _i6) \
  585. NS_INTERFACE_TABLE_ENTRY(_class, _i7) \
  586. NS_INTERFACE_TABLE_ENTRY(_class, _i8) \
  587. NS_INTERFACE_TABLE_ENTRY(_class, _i9) \
  588. NS_INTERFACE_TABLE_ENTRY(_class, _i10) \
  589. NS_INTERFACE_TABLE_ENTRY_AMBIGUOUS(_class, nsISupports, _i1) \
  590. NS_INTERFACE_TABLE_END
  591. #define NS_INTERFACE_TABLE11(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, \
  592. _i8, _i9, _i10, _i11) \
  593. NS_INTERFACE_TABLE_BEGIN \
  594. NS_INTERFACE_TABLE_ENTRY(_class, _i1) \
  595. NS_INTERFACE_TABLE_ENTRY(_class, _i2) \
  596. NS_INTERFACE_TABLE_ENTRY(_class, _i3) \
  597. NS_INTERFACE_TABLE_ENTRY(_class, _i4) \
  598. NS_INTERFACE_TABLE_ENTRY(_class, _i5) \
  599. NS_INTERFACE_TABLE_ENTRY(_class, _i6) \
  600. NS_INTERFACE_TABLE_ENTRY(_class, _i7) \
  601. NS_INTERFACE_TABLE_ENTRY(_class, _i8) \
  602. NS_INTERFACE_TABLE_ENTRY(_class, _i9) \
  603. NS_INTERFACE_TABLE_ENTRY(_class, _i10) \
  604. NS_INTERFACE_TABLE_ENTRY(_class, _i11) \
  605. NS_INTERFACE_TABLE_ENTRY_AMBIGUOUS(_class, nsISupports, _i1) \
  606. NS_INTERFACE_TABLE_END
  607. #define NS_IMPL_QUERY_INTERFACE0(_class) \
  608. NS_INTERFACE_TABLE_HEAD(_class) \
  609. NS_INTERFACE_TABLE0(_class) \
  610. NS_INTERFACE_TABLE_TAIL
  611. #define NS_IMPL_QUERY_INTERFACE1(_class, _i1) \
  612. NS_INTERFACE_TABLE_HEAD(_class) \
  613. NS_INTERFACE_TABLE1(_class, _i1) \
  614. NS_INTERFACE_TABLE_TAIL
  615. #define NS_IMPL_QUERY_INTERFACE2(_class, _i1, _i2) \
  616. NS_INTERFACE_TABLE_HEAD(_class) \
  617. NS_INTERFACE_TABLE2(_class, _i1, _i2) \
  618. NS_INTERFACE_TABLE_TAIL
  619. #define NS_IMPL_QUERY_INTERFACE3(_class, _i1, _i2, _i3) \
  620. NS_INTERFACE_TABLE_HEAD(_class) \
  621. NS_INTERFACE_TABLE3(_class, _i1, _i2, _i3) \
  622. NS_INTERFACE_TABLE_TAIL
  623. #define NS_IMPL_QUERY_INTERFACE4(_class, _i1, _i2, _i3, _i4) \
  624. NS_INTERFACE_TABLE_HEAD(_class) \
  625. NS_INTERFACE_TABLE4(_class, _i1, _i2, _i3, _i4) \
  626. NS_INTERFACE_TABLE_TAIL
  627. #define NS_IMPL_QUERY_INTERFACE5(_class, _i1, _i2, _i3, _i4, _i5) \
  628. NS_INTERFACE_TABLE_HEAD(_class) \
  629. NS_INTERFACE_TABLE5(_class, _i1, _i2, _i3, _i4, _i5) \
  630. NS_INTERFACE_TABLE_TAIL
  631. #define NS_IMPL_QUERY_INTERFACE6(_class, _i1, _i2, _i3, _i4, _i5, _i6) \
  632. NS_INTERFACE_TABLE_HEAD(_class) \
  633. NS_INTERFACE_TABLE6(_class, _i1, _i2, _i3, _i4, _i5, _i6) \
  634. NS_INTERFACE_TABLE_TAIL
  635. #define NS_IMPL_QUERY_INTERFACE7(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7) \
  636. NS_INTERFACE_TABLE_HEAD(_class) \
  637. NS_INTERFACE_TABLE7(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7) \
  638. NS_INTERFACE_TABLE_TAIL
  639. #define NS_IMPL_QUERY_INTERFACE8(_class, _i1, _i2, _i3, _i4, _i5, _i6, \
  640. _i7, _i8) \
  641. NS_INTERFACE_TABLE_HEAD(_class) \
  642. NS_INTERFACE_TABLE8(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8) \
  643. NS_INTERFACE_TABLE_TAIL
  644. #define NS_IMPL_QUERY_INTERFACE9(_class, _i1, _i2, _i3, _i4, _i5, _i6, \
  645. _i7, _i8, _i9) \
  646. NS_INTERFACE_TABLE_HEAD(_class) \
  647. NS_INTERFACE_TABLE9(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, _i9) \
  648. NS_INTERFACE_TABLE_TAIL
  649. #define NS_IMPL_QUERY_INTERFACE10(_class, _i1, _i2, _i3, _i4, _i5, _i6, \
  650. _i7, _i8, _i9, _i10) \
  651. NS_INTERFACE_TABLE_HEAD(_class) \
  652. NS_INTERFACE_TABLE10(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, \
  653. _i9, _i10) \
  654. NS_INTERFACE_TABLE_TAIL
  655. #define NS_IMPL_QUERY_INTERFACE11(_class, _i1, _i2, _i3, _i4, _i5, _i6, \
  656. _i7, _i8, _i9, _i10, _i11) \
  657. NS_INTERFACE_TABLE_HEAD(_class) \
  658. NS_INTERFACE_TABLE11(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, \
  659. _i9, _i10, _i11) \
  660. NS_INTERFACE_TABLE_TAIL
  661. #define NS_IMPL_THREADSAFE_QUERY_INTERFACE0 NS_IMPL_QUERY_INTERFACE0
  662. #define NS_IMPL_THREADSAFE_QUERY_INTERFACE1 NS_IMPL_QUERY_INTERFACE1
  663. #define NS_IMPL_THREADSAFE_QUERY_INTERFACE2 NS_IMPL_QUERY_INTERFACE2
  664. #define NS_IMPL_THREADSAFE_QUERY_INTERFACE3 NS_IMPL_QUERY_INTERFACE3
  665. #define NS_IMPL_THREADSAFE_QUERY_INTERFACE4 NS_IMPL_QUERY_INTERFACE4
  666. #define NS_IMPL_THREADSAFE_QUERY_INTERFACE5 NS_IMPL_QUERY_INTERFACE5
  667. #define NS_IMPL_THREADSAFE_QUERY_INTERFACE6 NS_IMPL_QUERY_INTERFACE6
  668. #define NS_IMPL_THREADSAFE_QUERY_INTERFACE7 NS_IMPL_QUERY_INTERFACE7
  669. #define NS_IMPL_THREADSAFE_QUERY_INTERFACE8 NS_IMPL_QUERY_INTERFACE8
  670. #define NS_IMPL_THREADSAFE_QUERY_INTERFACE9 NS_IMPL_QUERY_INTERFACE9
  671. #define NS_IMPL_THREADSAFE_QUERY_INTERFACE10 NS_IMPL_QUERY_INTERFACE10
  672. #define NS_IMPL_THREADSAFE_QUERY_INTERFACE11 NS_IMPL_QUERY_INTERFACE11
  673. /**
  674. * Declare that you're going to inherit from something that already
  675. * implements nsISupports, but also implements an additional interface, thus
  676. * causing an ambiguity. In this case you don't need another mRefCnt, you
  677. * just need to forward the definitions to the appropriate superclass. E.g.
  678. *
  679. * class Bar : public Foo, public nsIBar { // both provide nsISupports
  680. * public:
  681. * NS_DECL_ISUPPORTS_INHERITED
  682. * ...other nsIBar and Bar methods...
  683. * };
  684. */
  685. #define NS_DECL_ISUPPORTS_INHERITED \
  686. public: \
  687. NS_IMETHOD QueryInterface(REFNSIID aIID, \
  688. void** aInstancePtr); \
  689. NS_IMETHOD_(nsrefcnt) AddRef(void); \
  690. NS_IMETHOD_(nsrefcnt) Release(void); \
  691. /**
  692. * These macros can be used in conjunction with NS_DECL_ISUPPORTS_INHERITED
  693. * to implement the nsISupports methods, forwarding the invocations to a
  694. * superclass that already implements nsISupports.
  695. *
  696. * Note that I didn't make these inlined because they're virtual methods.
  697. */
  698. #define NS_IMPL_ADDREF_INHERITED(Class, Super) \
  699. NS_IMETHODIMP_(nsrefcnt) Class::AddRef(void) \
  700. { \
  701. nsrefcnt r = Super::AddRef(); \
  702. NS_LOG_ADDREF(this, r, #Class, sizeof(*this)); \
  703. return r; \
  704. } \
  705. #define NS_IMPL_RELEASE_INHERITED(Class, Super) \
  706. NS_IMETHODIMP_(nsrefcnt) Class::Release(void) \
  707. { \
  708. nsrefcnt r = Super::Release(); \
  709. NS_LOG_RELEASE(this, r, #Class); \
  710. return r; \
  711. } \
  712. #define NS_INTERFACE_TABLE_INHERITED0(Class) /* Nothing to do here */
  713. #define NS_INTERFACE_TABLE_INHERITED1(Class, i1) \
  714. NS_INTERFACE_TABLE_BEGIN \
  715. NS_INTERFACE_TABLE_ENTRY(Class, i1) \
  716. NS_INTERFACE_TABLE_END
  717. #define NS_INTERFACE_TABLE_INHERITED2(Class, i1, i2) \
  718. NS_INTERFACE_TABLE_BEGIN \
  719. NS_INTERFACE_TABLE_ENTRY(Class, i1) \
  720. NS_INTERFACE_TABLE_ENTRY(Class, i2) \
  721. NS_INTERFACE_TABLE_END
  722. #define NS_INTERFACE_TABLE_INHERITED3(Class, i1, i2, i3) \
  723. NS_INTERFACE_TABLE_BEGIN \
  724. NS_INTERFACE_TABLE_ENTRY(Class, i1) \
  725. NS_INTERFACE_TABLE_ENTRY(Class, i2) \
  726. NS_INTERFACE_TABLE_ENTRY(Class, i3) \
  727. NS_INTERFACE_TABLE_END
  728. #define NS_INTERFACE_TABLE_INHERITED4(Class, i1, i2, i3, i4) \
  729. NS_INTERFACE_TABLE_BEGIN \
  730. NS_INTERFACE_TABLE_ENTRY(Class, i1) \
  731. NS_INTERFACE_TABLE_ENTRY(Class, i2) \
  732. NS_INTERFACE_TABLE_ENTRY(Class, i3) \
  733. NS_INTERFACE_TABLE_ENTRY(Class, i4) \
  734. NS_INTERFACE_TABLE_END
  735. #define NS_INTERFACE_TABLE_INHERITED5(Class, i1, i2, i3, i4, i5) \
  736. NS_INTERFACE_TABLE_BEGIN \
  737. NS_INTERFACE_TABLE_ENTRY(Class, i1) \
  738. NS_INTERFACE_TABLE_ENTRY(Class, i2) \
  739. NS_INTERFACE_TABLE_ENTRY(Class, i3) \
  740. NS_INTERFACE_TABLE_ENTRY(Class, i4) \
  741. NS_INTERFACE_TABLE_ENTRY(Class, i5) \
  742. NS_INTERFACE_TABLE_END
  743. #define NS_INTERFACE_TABLE_INHERITED6(Class, i1, i2, i3, i4, i5, i6) \
  744. NS_INTERFACE_TABLE_BEGIN \
  745. NS_INTERFACE_TABLE_ENTRY(Class, i1) \
  746. NS_INTERFACE_TABLE_ENTRY(Class, i2) \
  747. NS_INTERFACE_TABLE_ENTRY(Class, i3) \
  748. NS_INTERFACE_TABLE_ENTRY(Class, i4) \
  749. NS_INTERFACE_TABLE_ENTRY(Class, i5) \
  750. NS_INTERFACE_TABLE_ENTRY(Class, i6) \
  751. NS_INTERFACE_TABLE_END
  752. #define NS_INTERFACE_TABLE_INHERITED7(Class, i1, i2, i3, i4, i5, i6, i7) \
  753. NS_INTERFACE_TABLE_BEGIN \
  754. NS_INTERFACE_TABLE_ENTRY(Class, i1) \
  755. NS_INTERFACE_TABLE_ENTRY(Class, i2) \
  756. NS_INTERFACE_TABLE_ENTRY(Class, i3) \
  757. NS_INTERFACE_TABLE_ENTRY(Class, i4) \
  758. NS_INTERFACE_TABLE_ENTRY(Class, i5) \
  759. NS_INTERFACE_TABLE_ENTRY(Class, i6) \
  760. NS_INTERFACE_TABLE_ENTRY(Class, i7) \
  761. NS_INTERFACE_TABLE_END
  762. #define NS_INTERFACE_TABLE_INHERITED8(Class, i1, i2, i3, i4, i5, i6, i7, i8) \
  763. NS_INTERFACE_TABLE_BEGIN \
  764. NS_INTERFACE_TABLE_ENTRY(Class, i1) \
  765. NS_INTERFACE_TABLE_ENTRY(Class, i2) \
  766. NS_INTERFACE_TABLE_ENTRY(Class, i3) \
  767. NS_INTERFACE_TABLE_ENTRY(Class, i4) \
  768. NS_INTERFACE_TABLE_ENTRY(Class, i5) \
  769. NS_INTERFACE_TABLE_ENTRY(Class, i6) \
  770. NS_INTERFACE_TABLE_ENTRY(Class, i7) \
  771. NS_INTERFACE_TABLE_ENTRY(Class, i8) \
  772. NS_INTERFACE_TABLE_END
  773. #define NS_INTERFACE_TABLE_INHERITED9(Class, i1, i2, i3, i4, i5, i6, i7, \
  774. i8, i9) \
  775. NS_INTERFACE_TABLE_BEGIN \
  776. NS_INTERFACE_TABLE_ENTRY(Class, i1) \
  777. NS_INTERFACE_TABLE_ENTRY(Class, i2) \
  778. NS_INTERFACE_TABLE_ENTRY(Class, i3) \
  779. NS_INTERFACE_TABLE_ENTRY(Class, i4) \
  780. NS_INTERFACE_TABLE_ENTRY(Class, i5) \
  781. NS_INTERFACE_TABLE_ENTRY(Class, i6) \
  782. NS_INTERFACE_TABLE_ENTRY(Class, i7) \
  783. NS_INTERFACE_TABLE_ENTRY(Class, i8) \
  784. NS_INTERFACE_TABLE_ENTRY(Class, i9) \
  785. NS_INTERFACE_TABLE_END
  786. #define NS_INTERFACE_TABLE_INHERITED10(Class, i1, i2, i3, i4, i5, i6, i7, \
  787. i8, i9, i10) \
  788. NS_INTERFACE_TABLE_BEGIN \
  789. NS_INTERFACE_TABLE_ENTRY(Class, i1) \
  790. NS_INTERFACE_TABLE_ENTRY(Class, i2) \
  791. NS_INTERFACE_TABLE_ENTRY(Class, i3) \
  792. NS_INTERFACE_TABLE_ENTRY(Class, i4) \
  793. NS_INTERFACE_TABLE_ENTRY(Class, i5) \
  794. NS_INTERFACE_TABLE_ENTRY(Class, i6) \
  795. NS_INTERFACE_TABLE_ENTRY(Class, i7) \
  796. NS_INTERFACE_TABLE_ENTRY(Class, i8) \
  797. NS_INTERFACE_TABLE_ENTRY(Class, i9) \
  798. NS_INTERFACE_TABLE_ENTRY(Class, i10) \
  799. NS_INTERFACE_TABLE_END
  800. #define NS_INTERFACE_TABLE_INHERITED11(Class, i1, i2, i3, i4, i5, i6, i7, \
  801. i8, i9, i10, i11) \
  802. NS_INTERFACE_TABLE_BEGIN \
  803. NS_INTERFACE_TABLE_ENTRY(Class, i1) \
  804. NS_INTERFACE_TABLE_ENTRY(Class, i2) \
  805. NS_INTERFACE_TABLE_ENTRY(Class, i3) \
  806. NS_INTERFACE_TABLE_ENTRY(Class, i4) \
  807. NS_INTERFACE_TABLE_ENTRY(Class, i5) \
  808. NS_INTERFACE_TABLE_ENTRY(Class, i6) \
  809. NS_INTERFACE_TABLE_ENTRY(Class, i7) \
  810. NS_INTERFACE_TABLE_ENTRY(Class, i8) \
  811. NS_INTERFACE_TABLE_ENTRY(Class, i9) \
  812. NS_INTERFACE_TABLE_ENTRY(Class, i10) \
  813. NS_INTERFACE_TABLE_ENTRY(Class, i11) \
  814. NS_INTERFACE_TABLE_END
  815. #define NS_INTERFACE_TABLE_INHERITED12(Class, i1, i2, i3, i4, i5, i6, i7, \
  816. i8, i9, i10, i11, i12) \
  817. NS_INTERFACE_TABLE_BEGIN \
  818. NS_INTERFACE_TABLE_ENTRY(Class, i1) \
  819. NS_INTERFACE_TABLE_ENTRY(Class, i2) \
  820. NS_INTERFACE_TABLE_ENTRY(Class, i3) \
  821. NS_INTERFACE_TABLE_ENTRY(Class, i4) \
  822. NS_INTERFACE_TABLE_ENTRY(Class, i5) \
  823. NS_INTERFACE_TABLE_ENTRY(Class, i6) \
  824. NS_INTERFACE_TABLE_ENTRY(Class, i7) \
  825. NS_INTERFACE_TABLE_ENTRY(Class, i8) \
  826. NS_INTERFACE_TABLE_ENTRY(Class, i9) \
  827. NS_INTERFACE_TABLE_ENTRY(Class, i10) \
  828. NS_INTERFACE_TABLE_ENTRY(Class, i11) \
  829. NS_INTERFACE_TABLE_ENTRY(Class, i12) \
  830. NS_INTERFACE_TABLE_END
  831. #define NS_INTERFACE_TABLE_INHERITED10(Class, i1, i2, i3, i4, i5, i6, i7, \
  832. i8, i9, i10) \
  833. NS_INTERFACE_TABLE_BEGIN \
  834. NS_INTERFACE_TABLE_ENTRY(Class, i1) \
  835. NS_INTERFACE_TABLE_ENTRY(Class, i2) \
  836. NS_INTERFACE_TABLE_ENTRY(Class, i3) \
  837. NS_INTERFACE_TABLE_ENTRY(Class, i4) \
  838. NS_INTERFACE_TABLE_ENTRY(Class, i5) \
  839. NS_INTERFACE_TABLE_ENTRY(Class, i6) \
  840. NS_INTERFACE_TABLE_ENTRY(Class, i7) \
  841. NS_INTERFACE_TABLE_ENTRY(Class, i8) \
  842. NS_INTERFACE_TABLE_ENTRY(Class, i9) \
  843. NS_INTERFACE_TABLE_ENTRY(Class, i10) \
  844. NS_INTERFACE_TABLE_END
  845. #define NS_IMPL_QUERY_INTERFACE_INHERITED0(Class, Super) \
  846. NS_INTERFACE_TABLE_HEAD(Class) \
  847. NS_INTERFACE_TABLE_INHERITED0(Class) \
  848. NS_INTERFACE_TABLE_TAIL_INHERITING(Super)
  849. #define NS_IMPL_QUERY_INTERFACE_INHERITED1(Class, Super, i1) \
  850. NS_INTERFACE_TABLE_HEAD(Class) \
  851. NS_INTERFACE_TABLE_INHERITED1(Class, i1) \
  852. NS_INTERFACE_TABLE_TAIL_INHERITING(Super)
  853. #define NS_IMPL_QUERY_INTERFACE_INHERITED2(Class, Super, i1, i2) \
  854. NS_INTERFACE_TABLE_HEAD(Class) \
  855. NS_INTERFACE_TABLE_INHERITED2(Class, i1, i2) \
  856. NS_INTERFACE_TABLE_TAIL_INHERITING(Super)
  857. #define NS_IMPL_QUERY_INTERFACE_INHERITED3(Class, Super, i1, i2, i3) \
  858. NS_INTERFACE_TABLE_HEAD(Class) \
  859. NS_INTERFACE_TABLE_INHERITED3(Class, i1, i2, i3) \
  860. NS_INTERFACE_TABLE_TAIL_INHERITING(Super)
  861. #define NS_IMPL_QUERY_INTERFACE_INHERITED4(Class, Super, i1, i2, i3, i4) \
  862. NS_INTERFACE_TABLE_HEAD(Class) \
  863. NS_INTERFACE_TABLE_INHERITED4(Class, i1, i2, i3, i4) \
  864. NS_INTERFACE_TABLE_TAIL_INHERITING(Super)
  865. #define NS_IMPL_QUERY_INTERFACE_INHERITED5(Class,Super,i1,i2,i3,i4,i5) \
  866. NS_INTERFACE_TABLE_HEAD(Class) \
  867. NS_INTERFACE_TABLE_INHERITED5(Class, i1, i2, i3, i4, i5) \
  868. NS_INTERFACE_TABLE_TAIL_INHERITING(Super)
  869. #define NS_IMPL_QUERY_INTERFACE_INHERITED6(Class,Super,i1,i2,i3,i4,i5,i6) \
  870. NS_INTERFACE_TABLE_HEAD(Class) \
  871. NS_INTERFACE_TABLE_INHERITED6(Class, i1, i2, i3, i4, i5, i6) \
  872. NS_INTERFACE_TABLE_TAIL_INHERITING(Super)
  873. #define NS_IMPL_QUERY_INTERFACE_INHERITED7(Class,Super,i1,i2,i3,i4,i5,i6,i7) \
  874. NS_INTERFACE_TABLE_HEAD(Class) \
  875. NS_INTERFACE_TABLE_INHERITED7(Class, i1, i2, i3, i4, i5, i6, i7) \
  876. NS_INTERFACE_TABLE_TAIL_INHERITING(Super)
  877. #define NS_IMPL_QUERY_INTERFACE_INHERITED8(Class,Super,i1,i2,i3,i4,i5,i6, \
  878. i7,i8) \
  879. NS_INTERFACE_TABLE_HEAD(Class) \
  880. NS_INTERFACE_TABLE_INHERITED8(Class, i1, i2, i3, i4, i5, i6, i7, i8) \
  881. NS_INTERFACE_TABLE_TAIL_INHERITING(Super)
  882. #define NS_IMPL_QUERY_INTERFACE_INHERITED9(Class,Super,i1,i2,i3,i4,i5,i6, \
  883. i7,i8,i9) \
  884. NS_INTERFACE_TABLE_HEAD(Class) \
  885. NS_INTERFACE_TABLE_INHERITED9(Class, i1, i2, i3, i4, i5, i6, i7, i8, i9) \
  886. NS_INTERFACE_TABLE_TAIL_INHERITING(Super)
  887. /**
  888. * Convenience macros for implementing all nsISupports methods for
  889. * a simple class.
  890. * @param _class The name of the class implementing the method
  891. * @param _classiiddef The name of the #define symbol that defines the IID
  892. * for the class (e.g. NS_ISUPPORTS_IID)
  893. */
  894. #define NS_IMPL_ISUPPORTS0(_class) \
  895. NS_IMPL_ADDREF(_class) \
  896. NS_IMPL_RELEASE(_class) \
  897. NS_IMPL_QUERY_INTERFACE0(_class)
  898. #define NS_IMPL_ISUPPORTS1(_class, _interface) \
  899. NS_IMPL_ADDREF(_class) \
  900. NS_IMPL_RELEASE(_class) \
  901. NS_IMPL_QUERY_INTERFACE1(_class, _interface)
  902. #define NS_IMPL_ISUPPORTS2(_class, _i1, _i2) \
  903. NS_IMPL_ADDREF(_class) \
  904. NS_IMPL_RELEASE(_class) \
  905. NS_IMPL_QUERY_INTERFACE2(_class, _i1, _i2)
  906. #define NS_IMPL_ISUPPORTS3(_class, _i1, _i2, _i3) \
  907. NS_IMPL_ADDREF(_class) \
  908. NS_IMPL_RELEASE(_class) \
  909. NS_IMPL_QUERY_INTERFACE3(_class, _i1, _i2, _i3)
  910. #define NS_IMPL_ISUPPORTS4(_class, _i1, _i2, _i3, _i4) \
  911. NS_IMPL_ADDREF(_class) \
  912. NS_IMPL_RELEASE(_class) \
  913. NS_IMPL_QUERY_INTERFACE4(_class, _i1, _i2, _i3, _i4)
  914. #define NS_IMPL_ISUPPORTS5(_class, _i1, _i2, _i3, _i4, _i5) \
  915. NS_IMPL_ADDREF(_class) \
  916. NS_IMPL_RELEASE(_class) \
  917. NS_IMPL_QUERY_INTERFACE5(_class, _i1, _i2, _i3, _i4, _i5)
  918. #define NS_IMPL_ISUPPORTS6(_class, _i1, _i2, _i3, _i4, _i5, _i6) \
  919. NS_IMPL_ADDREF(_class) \
  920. NS_IMPL_RELEASE(_class) \
  921. NS_IMPL_QUERY_INTERFACE6(_class, _i1, _i2, _i3, _i4, _i5, _i6)
  922. #define NS_IMPL_ISUPPORTS7(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7) \
  923. NS_IMPL_ADDREF(_class) \
  924. NS_IMPL_RELEASE(_class) \
  925. NS_IMPL_QUERY_INTERFACE7(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7)
  926. #define NS_IMPL_ISUPPORTS8(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8) \
  927. NS_IMPL_ADDREF(_class) \
  928. NS_IMPL_RELEASE(_class) \
  929. NS_IMPL_QUERY_INTERFACE8(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8)
  930. #define NS_IMPL_ISUPPORTS9(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, \
  931. _i9) \
  932. NS_IMPL_ADDREF(_class) \
  933. NS_IMPL_RELEASE(_class) \
  934. NS_IMPL_QUERY_INTERFACE9(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, _i9)
  935. #define NS_IMPL_ISUPPORTS10(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, \
  936. _i9, _i10) \
  937. NS_IMPL_ADDREF(_class) \
  938. NS_IMPL_RELEASE(_class) \
  939. NS_IMPL_QUERY_INTERFACE10(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, \
  940. _i9, _i10)
  941. #define NS_IMPL_ISUPPORTS11(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, \
  942. _i9, _i10, _i11) \
  943. NS_IMPL_ADDREF(_class) \
  944. NS_IMPL_RELEASE(_class) \
  945. NS_IMPL_QUERY_INTERFACE11(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, \
  946. _i9, _i10, _i11)
  947. #define NS_IMPL_ISUPPORTS_INHERITED0(Class, Super) \
  948. NS_IMPL_QUERY_INTERFACE_INHERITED0(Class, Super) \
  949. NS_IMPL_ADDREF_INHERITED(Class, Super) \
  950. NS_IMPL_RELEASE_INHERITED(Class, Super) \
  951. #define NS_IMPL_ISUPPORTS_INHERITED1(Class, Super, i1) \
  952. NS_IMPL_QUERY_INTERFACE_INHERITED1(Class, Super, i1) \
  953. NS_IMPL_ADDREF_INHERITED(Class, Super) \
  954. NS_IMPL_RELEASE_INHERITED(Class, Super) \
  955. #define NS_IMPL_ISUPPORTS_INHERITED2(Class, Super, i1, i2) \
  956. NS_IMPL_QUERY_INTERFACE_INHERITED2(Class, Super, i1, i2) \
  957. NS_IMPL_ADDREF_INHERITED(Class, Super) \
  958. NS_IMPL_RELEASE_INHERITED(Class, Super) \
  959. #define NS_IMPL_ISUPPORTS_INHERITED3(Class, Super, i1, i2, i3) \
  960. NS_IMPL_QUERY_INTERFACE_INHERITED3(Class, Super, i1, i2, i3) \
  961. NS_IMPL_ADDREF_INHERITED(Class, Super) \
  962. NS_IMPL_RELEASE_INHERITED(Class, Super) \
  963. #define NS_IMPL_ISUPPORTS_INHERITED4(Class, Super, i1, i2, i3, i4) \
  964. NS_IMPL_QUERY_INTERFACE_INHERITED4(Class, Super, i1, i2, i3, i4) \
  965. NS_IMPL_ADDREF_INHERITED(Class, Super) \
  966. NS_IMPL_RELEASE_INHERITED(Class, Super) \
  967. #define NS_IMPL_ISUPPORTS_INHERITED5(Class, Super, i1, i2, i3, i4, i5) \
  968. NS_IMPL_QUERY_INTERFACE_INHERITED5(Class, Super, i1, i2, i3, i4, i5) \
  969. NS_IMPL_ADDREF_INHERITED(Class, Super) \
  970. NS_IMPL_RELEASE_INHERITED(Class, Super) \
  971. #define NS_IMPL_ISUPPORTS_INHERITED6(Class, Super, i1, i2, i3, i4, i5, i6) \
  972. NS_IMPL_QUERY_INTERFACE_INHERITED6(Class, Super, i1, i2, i3, i4, i5, i6) \
  973. NS_IMPL_ADDREF_INHERITED(Class, Super) \
  974. NS_IMPL_RELEASE_INHERITED(Class, Super) \
  975. #define NS_IMPL_ISUPPORTS_INHERITED7(Class, Super, i1, i2, i3, i4, i5, i6, i7) \
  976. NS_IMPL_QUERY_INTERFACE_INHERITED7(Class, Super, i1, i2, i3, i4, i5, i6, i7) \
  977. NS_IMPL_ADDREF_INHERITED(Class, Super) \
  978. NS_IMPL_RELEASE_INHERITED(Class, Super) \
  979. /*
  980. * Macro to glue together a QI that starts with an interface table
  981. * and segues into an interface map (e.g. it uses singleton classinfo
  982. * or tearoffs).
  983. */
  984. #define NS_INTERFACE_TABLE_TO_MAP_SEGUE \
  985. if (rv == NS_OK) return rv; \
  986. nsISupports* foundInterface;
  987. ///////////////////////////////////////////////////////////////////////////////
  988. /**
  989. *
  990. * Threadsafe implementations of the ISupports convenience macros.
  991. *
  992. * @note These are not available when linking against the standalone glue,
  993. * because the implementation requires PR_ symbols.
  994. */
  995. #if !defined(XPCOM_GLUE_AVOID_NSPR)
  996. /**
  997. * Use this macro to implement the AddRef method for a given <i>_class</i>
  998. * @param _class The name of the class implementing the method
  999. */
  1000. #define NS_IMPL_THREADSAFE_ADDREF(_class) \
  1001. NS_IMETHODIMP_(nsrefcnt) _class::AddRef(void) \
  1002. { \
  1003. NS_PRECONDITION(PRInt32(mRefCnt) >= 0, "illegal refcnt"); \
  1004. nsrefcnt count; \
  1005. count = PR_AtomicIncrement((PRInt32*)&mRefCnt); \
  1006. NS_LOG_ADDREF(this, count, #_class, sizeof(*this)); \
  1007. return count; \
  1008. }
  1009. /**
  1010. * Use this macro to implement the Release method for a given <i>_class</i>
  1011. * @param _class The name of the class implementing the method
  1012. */
  1013. #define NS_IMPL_THREADSAFE_RELEASE(_class) \
  1014. NS_IMETHODIMP_(nsrefcnt) _class::Release(void) \
  1015. { \
  1016. nsrefcnt count; \
  1017. NS_PRECONDITION(0 != mRefCnt, "dup release"); \
  1018. count = PR_AtomicDecrement((PRInt32 *)&mRefCnt); \
  1019. NS_LOG_RELEASE(this, count, #_class); \
  1020. if (0 == count) { \
  1021. mRefCnt = 1; /* stabilize */ \
  1022. /* enable this to find non-threadsafe destructors: */ \
  1023. /* NS_ASSERT_OWNINGTHREAD(_class); */ \
  1024. NS_DELETEXPCOM(this); \
  1025. return 0; \
  1026. } \
  1027. return count; \
  1028. }
  1029. #else // XPCOM_GLUE_AVOID_NSPR
  1030. #define NS_IMPL_THREADSAFE_ADDREF(_class) \
  1031. THREADSAFE_ISUPPORTS_NOT_AVAILABLE_IN_STANDALONE_GLUE;
  1032. #define NS_IMPL_THREADSAFE_RELEASE(_class) \
  1033. THREADSAFE_ISUPPORTS_NOT_AVAILABLE_IN_STANDALONE_GLUE;
  1034. #endif
  1035. #define NS_IMPL_THREADSAFE_ISUPPORTS0(_class) \
  1036. NS_IMPL_THREADSAFE_ADDREF(_class) \
  1037. NS_IMPL_THREADSAFE_RELEASE(_class) \
  1038. NS_IMPL_THREADSAFE_QUERY_INTERFACE0(_class)
  1039. #define NS_IMPL_THREADSAFE_ISUPPORTS1(_class, _interface) \
  1040. NS_IMPL_THREADSAFE_ADDREF(_class) \
  1041. NS_IMPL_THREADSAFE_RELEASE(_class) \
  1042. NS_IMPL_THREADSAFE_QUERY_INTERFACE1(_class, _interface)
  1043. #define NS_IMPL_THREADSAFE_ISUPPORTS2(_class, _i1, _i2) \
  1044. NS_IMPL_THREADSAFE_ADDREF(_class) \
  1045. NS_IMPL_THREADSAFE_RELEASE(_class) \
  1046. NS_IMPL_THREADSAFE_QUERY_INTERFACE2(_class, _i1, _i2)
  1047. #define NS_IMPL_THREADSAFE_ISUPPORTS3(_class, _i1, _i2, _i3) \
  1048. NS_IMPL_THREADSAFE_ADDREF(_class) \
  1049. NS_IMPL_THREADSAFE_RELEASE(_class) \
  1050. NS_IMPL_THREADSAFE_QUERY_INTERFACE3(_class, _i1, _i2, _i3)
  1051. #define NS_IMPL_THREADSAFE_ISUPPORTS4(_class, _i1, _i2, _i3, _i4) \
  1052. NS_IMPL_THREADSAFE_ADDREF(_class) \
  1053. NS_IMPL_THREADSAFE_RELEASE(_class) \
  1054. NS_IMPL_THREADSAFE_QUERY_INTERFACE4(_class, _i1, _i2, _i3, _i4)
  1055. #define NS_IMPL_THREADSAFE_ISUPPORTS5(_class, _i1, _i2, _i3, _i4, _i5) \
  1056. NS_IMPL_THREADSAFE_ADDREF(_class) \
  1057. NS_IMPL_THREADSAFE_RELEASE(_class) \
  1058. NS_IMPL_THREADSAFE_QUERY_INTERFACE5(_class, _i1, _i2, _i3, _i4, _i5)
  1059. #define NS_IMPL_THREADSAFE_ISUPPORTS6(_class, _i1, _i2, _i3, _i4, _i5, _i6) \
  1060. NS_IMPL_THREADSAFE_ADDREF(_class) \
  1061. NS_IMPL_THREADSAFE_RELEASE(_class) \
  1062. NS_IMPL_THREADSAFE_QUERY_INTERFACE6(_class, _i1, _i2, _i3, _i4, _i5, _i6)
  1063. #define NS_IMPL_THREADSAFE_ISUPPORTS7(_class, _i1, _i2, _i3, _i4, _i5, _i6, \
  1064. _i7) \
  1065. NS_IMPL_THREADSAFE_ADDREF(_class) \
  1066. NS_IMPL_THREADSAFE_RELEASE(_class) \
  1067. NS_IMPL_THREADSAFE_QUERY_INTERFACE7(_class, _i1, _i2, _i3, _i4, _i5, _i6, \
  1068. _i7)
  1069. #define NS_IMPL_THREADSAFE_ISUPPORTS8(_class, _i1, _i2, _i3, _i4, _i5, _i6, \
  1070. _i7, _i8) \
  1071. NS_IMPL_THREADSAFE_ADDREF(_class) \
  1072. NS_IMPL_THREADSAFE_RELEASE(_class) \
  1073. NS_IMPL_THREADSAFE_QUERY_INTERFACE8(_class, _i1, _i2, _i3, _i4, _i5, _i6, \
  1074. _i7, _i8)
  1075. #define NS_IMPL_THREADSAFE_ISUPPORTS9(_class, _i1, _i2, _i3, _i4, _i5, _i6, \
  1076. _i7, _i8, _i9) \
  1077. NS_IMPL_THREADSAFE_ADDREF(_class) \
  1078. NS_IMPL_THREADSAFE_RELEASE(_class) \
  1079. NS_IMPL_THREADSAFE_QUERY_INTERFACE9(_class, _i1, _i2, _i3, _i4, _i5, _i6, \
  1080. _i7, _i8, _i9)
  1081. #define NS_IMPL_THREADSAFE_ISUPPORTS10(_class, _i1, _i2, _i3, _i4, _i5, _i6, \
  1082. _i7, _i8, _i9, _i10) \
  1083. NS_IMPL_THREADSAFE_ADDREF(_class) \
  1084. NS_IMPL_THREADSAFE_RELEASE(_class) \
  1085. NS_IMPL_THREADSAFE_QUERY_INTERFACE10(_class, _i1, _i2, _i3, _i4, _i5, _i6, \
  1086. _i7, _i8, _i9, _i10)
  1087. #define NS_IMPL_THREADSAFE_ISUPPORTS11(_class, _i1, _i2, _i3, _i4, _i5, _i6, \
  1088. _i7, _i8, _i9, _i10, _i11) \
  1089. NS_IMPL_THREADSAFE_ADDREF(_class) \
  1090. NS_IMPL_THREADSAFE_RELEASE(_class) \
  1091. NS_IMPL_THREADSAFE_QUERY_INTERFACE11(_class, _i1, _i2, _i3, _i4, _i5, _i6, \
  1092. _i7, _i8, _i9, _i10, _i11)
  1093. #define NS_INTERFACE_MAP_END_THREADSAFE NS_IMPL_QUERY_TAIL_GUTS
  1094. /**
  1095. * Macro to generate nsIClassInfo methods for classes which do not have
  1096. * corresponding nsIFactory implementations.
  1097. */
  1098. #define NS_IMPL_THREADSAFE_CI(_class) \
  1099. NS_IMETHODIMP \
  1100. _class::GetInterfaces(PRUint32* _count, nsIID*** _array) \
  1101. { \
  1102. return NS_CI_INTERFACE_GETTER_NAME(_class)(_count, _array); \
  1103. } \
  1104. \
  1105. NS_IMETHODIMP \
  1106. _class::GetHelperForLanguage(PRUint32 _language, nsISupports** _retval) \
  1107. { \
  1108. *_retval = nsnull; \
  1109. return NS_OK; \
  1110. } \
  1111. \
  1112. NS_IMETHODIMP \
  1113. _class::GetContractID(char** _contractID) \
  1114. { \
  1115. *_contractID = nsnull; \
  1116. return NS_OK; \
  1117. } \
  1118. \
  1119. NS_IMETHODIMP \
  1120. _class::GetClassDescription(char** _classDescription) \
  1121. { \
  1122. *_classDescription = nsnull; \
  1123. return NS_OK; \
  1124. } \
  1125. \
  1126. NS_IMETHODIMP \
  1127. _class::GetClassID(nsCID** _classID) \
  1128. { \
  1129. *_classID = nsnull; \
  1130. return NS_OK; \
  1131. } \
  1132. \
  1133. NS_IMETHODIMP \
  1134. _class::GetImplementationLanguage(PRUint32* _language) \
  1135. { \
  1136. *_language = nsIProgrammingLanguage::CPLUSPLUS; \
  1137. return NS_OK; \
  1138. } \
  1139. \
  1140. NS_IMETHODIMP \
  1141. _class::GetFlags(PRUint32* _flags) \
  1142. { \
  1143. *_flags = nsIClassInfo::THREADSAFE; \
  1144. return NS_OK; \
  1145. } \
  1146. \
  1147. NS_IMETHODIMP \
  1148. _class::GetClassIDNoAlloc(nsCID* _classIDNoAlloc) \
  1149. { \
  1150. return NS_ERROR_NOT_AVAILABLE; \
  1151. }
  1152. #endif