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.

154 lines
3.5 KiB

4 years ago
  1. /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2. Copyright (c) 1989 Microsoft Corporation
  3. Module Name:
  4. dtable.hxx
  5. Abstract:
  6. Dispatch table manager defintions.
  7. Notes:
  8. History:
  9. Oct-01-1993 VibhasC Created.
  10. ----------------------------------------------------------------------------*/
  11. /****************************************************************************
  12. * include files
  13. ***************************************************************************/
  14. #ifndef __DTABLE_HXX__
  15. #define __DTABLE_HXX__
  16. #include "nulldefs.h"
  17. extern "C"
  18. {
  19. #include <stdio.h>
  20. #include <assert.h>
  21. }
  22. #include "cgcommon.hxx"
  23. #include "idict.hxx"
  24. #include "listhndl.hxx"
  25. #include "nodeskl.hxx"
  26. //
  27. // This is the dispatch table manager class. We chose to do this using a class
  28. // derived from a simple array dictionary, because for MIDL's mixed model
  29. // of stub generation, mop dispatch table generation needs to know a little
  30. // more info about a procedure during dispatch table generation than normal
  31. // stubs.
  32. //
  33. // Each entry in the this class is a pointer to a special structure that
  34. // keeps the name of the function, along with some other information. This is
  35. // used by MIDL's code generator to register procedures for final emission into
  36. // the dispatch table. This class is NOT responsible for mangling names of the
  37. // procedures. It is the responsibility of the code generator to mangle names
  38. // before registering with the dispatch table.
  39. //
  40. #define INITIAL_SIZE_FOR_DISPATCH_TABLE 10
  41. #define INCREMENT_FOR_DISPATCH_TABLE 10
  42. //
  43. // Additional info about dispatch table entries.
  44. // These may overlap in the table: Read the comment about GetProcList.
  45. typedef enum
  46. {
  47. DTF_NONE = 0x0000
  48. ,DTF_INTERPRETER = 0x0001
  49. ,DTF_PICKLING_PROC = 0x0008
  50. } DISPATCH_TABLE_FLAGS;
  51. //
  52. // A dispatch table entry. The dispatch table class owns the structure, but
  53. // does not own the name pointer. therefore while destroying the contents
  54. // of this structure, DONT free the procedure name.
  55. //
  56. typedef struct
  57. {
  58. //
  59. // The name of the procedure to be registered.
  60. //
  61. PNAME pName;
  62. //
  63. // The node_skl of the procedure.
  64. //
  65. node_skl * pNode;
  66. //
  67. // Additional info that qualifies the procedure entry.
  68. //
  69. DISPATCH_TABLE_FLAGS Flags;
  70. } DISPATCH_TABLE_ENTRY;
  71. //
  72. // The actual dispatch table class.
  73. //
  74. class DISPATCH_TABLE : public IDICT
  75. {
  76. private:
  77. public:
  78. //
  79. // The constructor.
  80. //
  81. DISPATCH_TABLE() : IDICT(
  82. INITIAL_SIZE_FOR_DISPATCH_TABLE,
  83. INCREMENT_FOR_DISPATCH_TABLE
  84. )
  85. {
  86. }
  87. //
  88. // The destructor.
  89. //
  90. ~DISPATCH_TABLE();
  91. //
  92. // Register the procedure.
  93. //
  94. void RegisterProcedure( node_skl * pProcName,
  95. DISPATCH_TABLE_FLAGS Flags );
  96. //
  97. // Return the count of number of procedures in the table.
  98. //
  99. unsigned short GetCount()
  100. {
  101. return GetNumberOfElements();
  102. }
  103. //
  104. // Get a list of procedures which conform to the specified flags. Return
  105. // the count of such procedures. The flags field allows the caller to
  106. // select a set of procedures which have certain properties. For example,
  107. // the caller may want all procedures which are either mops procedures or
  108. // normal procedures. The flags field should specify all the necessary
  109. // flags which identify a mops dispatch table entry. This function will
  110. // use the flags param as a filter for the dispatch table entries.
  111. //
  112. unsigned short GetProcList( ITERATOR& ProcList,
  113. DISPATCH_TABLE_FLAGS );
  114. };
  115. #endif // __DTABLE_HXX__