Source code of Windows XP (NT5)
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.

159 lines
5.0 KiB

  1. /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2. Copyright (c) 1989-1999 Microsoft Corporation
  3. Module Name:
  4. pickle.hxx
  5. Abstract:
  6. Header file for pickle code generation class.
  7. Notes:
  8. History:
  9. Mar-20-1994 VibhasC Created.
  10. ----------------------------------------------------------------------------*/
  11. #pragma warning ( disable : 4238 4239 )
  12. /****************************************************************************
  13. * include files
  14. ***************************************************************************/
  15. #include "nulldefs.h"
  16. extern "C"
  17. {
  18. #include <stdio.h>
  19. }
  20. #include "ndrcls.hxx"
  21. /****************************************************************************
  22. * local definitions
  23. ***************************************************************************/
  24. #define TYPE_ALIGN_SIZE_CODE 0
  25. #define TYPE_ENCODE_CODE 1
  26. #define TYPE_DECODE_CODE 2
  27. #define TYPE_FREE_CODE 3
  28. /****************************************************************************
  29. * local data
  30. ***************************************************************************/
  31. /****************************************************************************
  32. * externs
  33. ***************************************************************************/
  34. extern void GenStdMesPrototype( CCB * pCCB,
  35. PNAME pTypeName,
  36. int Code,
  37. BOOL fImpBin );
  38. /****************************************************************************/
  39. //
  40. // The pickle code generation class.
  41. //
  42. class CG_TYPE_ENCODE : public CG_TYPEDEF
  43. {
  44. private:
  45. BOOL fEncode;
  46. BOOL fDecode;
  47. BOOL fImplicitHandle;
  48. RESOURCE * pBindingResource;
  49. ulong TypeIndex;
  50. //
  51. // Keep a link to the actual specification of the type.
  52. //
  53. // Generate the sizing stub for the type.
  54. CG_STATUS GenTypeSize( CCB * pCCB );
  55. // Generate the encoding stub for the type.
  56. CG_STATUS GenTypeEncode( CCB * pCCB );
  57. // Generate the decoding stub for type.
  58. CG_STATUS GenTypeDecode( CCB * pCCB );
  59. // Generate the freeing stub for type.
  60. CG_STATUS GenTypeFree( CCB * pCCB );
  61. // Miscellaneous.
  62. void AllocateEncodeResources( CCB * pCCB );
  63. expr_proc_call * CreateStdMesEngineProc( CCB * pCCB,
  64. int Code );
  65. public:
  66. // The constructor.
  67. CG_TYPE_ENCODE( node_skl * pT,
  68. BOOL fE,
  69. BOOL fD)
  70. :CG_TYPEDEF(pT, XLAT_SIZE_INFO())
  71. {
  72. fEncode = fE;
  73. fDecode = fD;
  74. pBindingResource = 0;
  75. fImplicitHandle = FALSE;
  76. TypeIndex = 0;
  77. }
  78. // Identify encode or decode.
  79. BOOL IsEncode()
  80. {
  81. return (BOOL) fEncode;
  82. }
  83. BOOL IsDecode()
  84. {
  85. return (BOOL) fDecode;
  86. }
  87. ID_CG GetCGID()
  88. {
  89. return ID_CG_TYPE_ENCODE;
  90. }
  91. virtual
  92. void Visit( CG_VISITOR *pVisitor )
  93. {
  94. pVisitor->Visit( this );
  95. }
  96. void SetHasImplicitHandle()
  97. {
  98. fImplicitHandle = 1;
  99. }
  100. BOOL HasImplicitHandle()
  101. {
  102. return (BOOL) (fImplicitHandle == 1);
  103. }
  104. void SetBindingResource( RESOURCE * pRes )
  105. {
  106. pBindingResource = pRes;
  107. }
  108. RESOURCE * GetBindingResource()
  109. {
  110. return pBindingResource;
  111. }
  112. // Generate the pickling code.
  113. virtual
  114. CG_STATUS GenTypeEncodingStub( CCB * pCCB );
  115. };