Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

120 lines
2.6 KiB

  1. /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2. Copyright (c) 1993-1999 Microsoft Corporation
  3. Module Name:
  4. ilreg.hxx
  5. Abstract:
  6. Type registry for structure/union reuse.
  7. Notes:
  8. This file defines reuse registry for types which may be reused later.
  9. History:
  10. Oct-25-1993 GregJen Created.
  11. ----------------------------------------------------------------------------*/
  12. /****************************************************************************
  13. * include files
  14. ***************************************************************************/
  15. #ifndef __ILREG_HXX__
  16. #define __ILREG_HXX__
  17. #include "nulldefs.h"
  18. extern "C"
  19. {
  20. #include <stdio.h>
  21. }
  22. #include "dict.hxx"
  23. #include "listhndl.hxx"
  24. #include "ilxlat.hxx"
  25. /****************************************************************************
  26. * externs
  27. ***************************************************************************/
  28. extern SSIZE_T CompareReUseKey( void *, void *);
  29. extern void PrintReUseKey( void * );
  30. /****************************************************************************
  31. * class definitions
  32. ***************************************************************************/
  33. class REUSE_INFO
  34. {
  35. public:
  36. node_skl * pType;
  37. CG_CLASS * pSavedCG;
  38. XLAT_SIZE_INFO SizeInfo;
  39. REUSE_INFO( node_skl * pT )
  40. {
  41. pType = pT;
  42. pSavedCG = NULL;
  43. }
  44. void SaveInfo( XLAT_CTXT * pCtxt, CG_CLASS * pCG )
  45. {
  46. SizeInfo.ReturnSize( *pCtxt );
  47. pSavedCG = pCG;
  48. }
  49. void FetchInfo( XLAT_CTXT * pCtxt, CG_CLASS * & pCG )
  50. {
  51. pCtxt->ReturnSize( SizeInfo );
  52. pCG = pSavedCG;
  53. }
  54. void * operator new ( size_t size )
  55. {
  56. return AllocateOnceNew( size );
  57. }
  58. void operator delete( void * ptr )
  59. {
  60. AllocateOnceDelete( ptr );
  61. }
  62. };
  63. class REUSE_DICT : public Dictionary
  64. {
  65. public:
  66. // The constructor and destructors.
  67. REUSE_DICT();
  68. ~REUSE_DICT()
  69. {
  70. }
  71. //
  72. // Register a type.
  73. //
  74. REUSE_INFO * Register( REUSE_INFO * pNode );
  75. // Search for a type.
  76. REUSE_INFO * IsRegistered( REUSE_INFO * pNode );
  77. // Given a type, add it to the dictionary or return existing entry
  78. // true signifies "found"
  79. BOOL GetReUseEntry( REUSE_INFO * & pRI, node_skl * pNode );
  80. void MakeIterator( ITERATOR& Iter );
  81. SSIZE_T Compare( pUserType pL, pUserType pR );
  82. void Print( pUserType )
  83. {
  84. }
  85. };
  86. #endif // __ILREG_HXX__