Windows NT 4.0 source code leak
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.

243 lines
6.5 KiB

4 years ago
  1. /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2. Copyright (c) 1989 Microsoft Corporation
  3. Module Name:
  4. paddict.hxx
  5. Abstract:
  6. Implements a dictionary for handling padding expressions for unknown
  7. represent as data types.
  8. Notes:
  9. History:
  10. Jan 25, 1994 RyszardK Created
  11. ----------------------------------------------------------------------------*/
  12. #ifndef __PADDICT_HXX__
  13. #define __PADDICT_HXX__
  14. #include "nulldefs.h"
  15. extern "C"
  16. {
  17. #include <stdio.h>
  18. #include <assert.h>
  19. #include <string.h>
  20. }
  21. #include "cgcommon.hxx"
  22. #include "dict.hxx"
  23. /////////////////////////////////////////////////////////////////////////////
  24. //
  25. // This class defines a dictionary with members for counting and traversing.
  26. //
  27. /////////////////////////////////////////////////////////////////////////////
  28. class CountedDictionary : public Dictionary
  29. {
  30. private:
  31. unsigned short CurrentIndex;
  32. public:
  33. CountedDictionary() : Dictionary()
  34. {
  35. CurrentIndex = 0;
  36. }
  37. ~CountedDictionary() {}
  38. unsigned short GetCount()
  39. {
  40. return CurrentIndex;
  41. }
  42. void IncrementCount()
  43. {
  44. CurrentIndex++;
  45. }
  46. unsigned short GetListOfItems( ITERATOR& ListIter );
  47. void * GetFirst();
  48. void * GetNext();
  49. virtual
  50. int Compare( pUserType pL, pUserType pR );
  51. };
  52. /////////////////////////////////////////////////////////////////////////////
  53. //
  54. // This class defines a dictionary for handling padding related to
  55. // unknown represent as types.
  56. //
  57. /////////////////////////////////////////////////////////////////////////////
  58. typedef struct _RepAsPadDictElem
  59. {
  60. unsigned long KeyOffset;
  61. node_skl * pStructType;
  62. char * pFieldName;
  63. node_skl * pPrevFieldType;
  64. } REP_AS_PAD_EXPR_DESC;
  65. class RepAsPadExprDict : public Dictionary
  66. {
  67. private:
  68. unsigned short EntryCount;
  69. public:
  70. RepAsPadExprDict() : Dictionary()
  71. {
  72. EntryCount = 0;
  73. }
  74. ~RepAsPadExprDict() {}
  75. // Register an entry.
  76. void Register( unsigned long Offset,
  77. node_skl * pStructType,
  78. char * pFieldName,
  79. node_skl * pPrevFieldType );
  80. unsigned short GetCount()
  81. {
  82. return EntryCount;
  83. }
  84. REP_AS_PAD_EXPR_DESC * GetFirst();
  85. REP_AS_PAD_EXPR_DESC * GetNext();
  86. void WriteCurrentPadDesc( ISTREAM * pStream );
  87. int Compare( pUserType pL, pUserType pR );
  88. };
  89. /////////////////////////////////////////////////////////////////////////////
  90. //
  91. // This class defines a dictionary for handling padding related to
  92. // unknown represent as types.
  93. //
  94. /////////////////////////////////////////////////////////////////////////////
  95. typedef struct _RepAsSizeDictElem
  96. {
  97. unsigned long KeyOffset;
  98. char * pTypeName;
  99. } REP_AS_SIZE_DESC;
  100. class RepAsSizeDict : public Dictionary
  101. {
  102. private:
  103. unsigned short EntryCount;
  104. public:
  105. RepAsSizeDict() : Dictionary()
  106. {
  107. EntryCount = 0;
  108. }
  109. ~RepAsSizeDict() {}
  110. // Register an entry.
  111. void Register( unsigned long Offset,
  112. char * pTypeName );
  113. unsigned short GetCount()
  114. {
  115. return EntryCount;
  116. }
  117. REP_AS_SIZE_DESC * GetFirst();
  118. REP_AS_SIZE_DESC * GetNext();
  119. void WriteCurrentSizeDesc( ISTREAM * pStream );
  120. int Compare( pUserType pL, pUserType pR );
  121. };
  122. /////////////////////////////////////////////////////////////////////////////
  123. //
  124. // This class defines a dictionary for handling quintuple routines.
  125. // I.e. this is a support needed for transmit_as represent_as table,
  126. // that is called the Quintuple table for historical reasons.
  127. //
  128. /////////////////////////////////////////////////////////////////////////////
  129. class QuintupleDict : public Dictionary
  130. {
  131. private:
  132. unsigned short CurrentIndex;
  133. public:
  134. QuintupleDict() : Dictionary()
  135. {
  136. CurrentIndex = 0;
  137. }
  138. ~QuintupleDict() {}
  139. // Register an entry.
  140. BOOL Add( void * pContext );
  141. unsigned short GetCount()
  142. {
  143. return CurrentIndex;
  144. }
  145. void * GetFirst();
  146. void * GetNext();
  147. int Compare( pUserType pL, pUserType pR );
  148. };
  149. /////////////////////////////////////////////////////////////////////////////
  150. //
  151. // This class defines a dictionary for Quadruples (usr_marshall support).
  152. //
  153. /////////////////////////////////////////////////////////////////////////////
  154. class QuadrupleDict : public CountedDictionary
  155. {
  156. public:
  157. QuadrupleDict() : CountedDictionary()
  158. {}
  159. ~QuadrupleDict() {}
  160. //
  161. // Try to Add an entry.
  162. //
  163. BOOL Add( void * pContext );
  164. int Compare( pUserType pL, pUserType pR );
  165. };
  166. #endif // __PADDICT_HXX__