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.

234 lines
4.7 KiB

4 years ago
  1. /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2. Copyright (c) 1989 Microsoft Corporation
  3. Module Name:
  4. cgdump.cxx
  5. Abstract:
  6. A debug code generation object dumper.
  7. Notes:
  8. History:
  9. VibhasC Aug-13-1993 Created.
  10. ----------------------------------------------------------------------------*/
  11. #include "becls.hxx"
  12. #pragma hdrstop
  13. /****************************************************************************
  14. * include files
  15. ***************************************************************************/
  16. /****************************************************************************
  17. * local definitions
  18. ***************************************************************************/
  19. /****************************************************************************
  20. * local data
  21. ***************************************************************************/
  22. static NodeNum = 0;
  23. /****************************************************************************
  24. * externs
  25. ***************************************************************************/
  26. #ifdef MIDL_INTERNAL
  27. extern void FormatDump(
  28. ID_CG MyID,
  29. unsigned short Me,
  30. unsigned short Ch,
  31. unsigned short Sib,
  32. char * pAdditionalInfo );
  33. /****************************************************************************/
  34. unsigned short
  35. CG_CLASS::Dump( unsigned short xxx )
  36. {
  37. CG_CLASS * pChild = GetChild();
  38. CG_CLASS * pSibling= GetSibling();
  39. unsigned short Ch;
  40. unsigned short Si;
  41. unsigned short Me;
  42. ID_CG MyID;
  43. char * pAdditional;
  44. if ( Me = GetDumpNumber() )
  45. return Me;
  46. Me = NodeNum++;
  47. SetDumpNumber( Me );
  48. if( pChild )
  49. Ch = pChild->Dump( 0 );
  50. else
  51. Ch = 0;
  52. if( pSibling )
  53. Si = pSibling->Dump( 0 );
  54. else
  55. Si = 0;
  56. switch( MyID = GetCGID() )
  57. {
  58. case ID_CG_PROC:
  59. case ID_CG_CALLBACK_PROC:
  60. case ID_CG_OBJECT_PROC:
  61. case ID_CG_INHERITED_OBJECT_PROC:
  62. case ID_CG_LOCAL_OBJECT_PROC:
  63. case ID_CG_ENCODE_PROC:
  64. case ID_CG_TYPE_ENCODE_PROC:
  65. case ID_CG_TYPE_ENCODE:
  66. case ID_CG_PARAM:
  67. case ID_CG_BT:
  68. case ID_CG_ENUM:
  69. case ID_CG_STRUCT:
  70. case ID_CG_VAR_STRUCT:
  71. case ID_CG_CONF_STRUCT:
  72. case ID_CG_CONF_VAR_STRUCT:
  73. case ID_CG_ENCAP_STRUCT:
  74. case ID_CG_COMPLEX_STRUCT:
  75. case ID_CG_FIELD:
  76. case ID_CG_UNION:
  77. case ID_CG_UNION_FIELD:
  78. case ID_CG_TRANSMIT_AS:
  79. case ID_CG_REPRESENT_AS:
  80. case ID_CG_USER_MARSHAL:
  81. case ID_CG_ERROR_STATUS_T:
  82. case ID_CG_INTERFACE:
  83. case ID_CG_OBJECT_INTERFACE:
  84. case ID_CG_INHERITED_OBJECT_INTERFACE:
  85. case ID_CG_COM_CLASS:
  86. case ID_CG_COM_SERVER_DLL:
  87. case ID_CG_COM_SERVER_EXE:
  88. case ID_CG_HRESULT:
  89. case ID_CG_INTERFACE_PTR:
  90. case ID_CG_INTERFACE_REFERENCE:
  91. case ID_CG_MODULE:
  92. case ID_CG_DISPINTERFACE:
  93. case ID_CG_COCLASS:
  94. case ID_CG_LIBRARY:
  95. case ID_CG_SAFEARRAY:
  96. pAdditional = GetType()->GetSymName();
  97. break;
  98. case ID_CG_CONTEXT_HDL:
  99. case ID_CG_GENERIC_HDL:
  100. pAdditional = ( (CG_HANDLE *) this) ->
  101. GetHandleType()->GetSymName();
  102. break;
  103. case ID_CG_FILE:
  104. pAdditional = ( ( CG_FILE *) this) -> GetFileName();
  105. break;
  106. default:
  107. pAdditional = "";
  108. }
  109. FormatDump( MyID, Me, Ch, Si, pAdditional );
  110. return Me;
  111. }
  112. void
  113. FormatDump(
  114. ID_CG MyID,
  115. unsigned short Me,
  116. unsigned short MyChild,
  117. unsigned short MySibling,
  118. char * pAdditionalInfo )
  119. {
  120. static char * pArray[] =
  121. {
  122. "CG_NOT_IMPLEMENTED"
  123. ,"CG_SOURCE"
  124. ,"CG_FILE"
  125. ,"CG_BT"
  126. ,"CG_ENUM"
  127. ,"CG_ERROR_STATUS_T"
  128. ,"CG_PROC"
  129. ,"CG_CALLBACK_PROC"
  130. ,"CG_OBJECT_PROC"
  131. ,"CG_INH_OBJECT_PROC"
  132. ,"CG_LOCAL_OBJECT_PROC"
  133. ,"CG_TYPE_ENCODE"
  134. ,"CG_TYPE_ENCODE_PROC"
  135. ,"CG_ENCODE_PROC"
  136. ,"CG_PARAM"
  137. ,"CG_RETURN"
  138. ,"CG_PTR"
  139. ,"CG_IGNORED_PTR"
  140. ,"CG_BYTE_COUNT_PTR"
  141. ,"CG_STRING_PTR"
  142. ,"CG_STRUCT_STRING_PTR"
  143. ,"CG_SIZE_STRING_PTR"
  144. ,"CG_SIZE_PTR"
  145. ,"CG_LENGTH_PTR"
  146. ,"CG_SIZE_LENGTH_PTR"
  147. ,"CG_INTERFACE_PTR"
  148. ,"CG_STRUCT"
  149. ,"CG_VAR_STRUCT"
  150. ,"CG_CONF_STRUCT"
  151. ,"CG_CONF_VAR_STRUCT"
  152. ,"CG_COMPLEX_STRUCT"
  153. ,"CG_ENCAP_STRUCT"
  154. ,"CG_FIELD"
  155. ,"CG_UNION"
  156. ,"CG_UNION_FIELD"
  157. ,"CG_CASE"
  158. ,"CG_DEFAULT_CASE"
  159. ,"CG_ARRAY"
  160. ,"CG_CONF_ARRAY"
  161. ,"CG_VAR_ARRAY"
  162. ,"CG_CONF_VAR_ARRAY"
  163. ,"CG_STRING_ARRAY"
  164. ,"CG_CONF_STRING_ARRAY"
  165. ,"CG_PRIMITIVE_HDL"
  166. ,"CG_GENERIC_HDL"
  167. ,"CG_CONTEXT_HDL"
  168. ,"CG_TRANSMIT_AS"
  169. ,"CG_REPRESENT_AS"
  170. ,"CG_USER_MARSHAL"
  171. ,"CG_INTERFACE"
  172. ,"CG_OBJECT_INTERFACE"
  173. ,"CG_INH_OBJECT_INTERFACE"
  174. ,"CG_COM_CLASS"
  175. ,"CG_COM_SERVER_DLL"
  176. ,"CG_COM_SERVER_EXE"
  177. ,"CG_HRESULT"
  178. ,"CG_TYPELIBRARY_FILE"
  179. ,"CG_INTERFACE_REFERENCE"
  180. ,"CG_MODULE"
  181. ,"CG_DISPINTERFACE"
  182. ,"CG_COCLASS"
  183. ,"CG_LIBRARY"
  184. ,"CG_SAFEARRAY"
  185. };
  186. fprintf( stderr,
  187. "\n%25s : %.4d : Ch = %.4d, Si = %.4d %s",
  188. pArray[ MyID ],
  189. Me,
  190. MyChild,
  191. MySibling,
  192. pAdditionalInfo
  193. );
  194. if( Me == 0 )
  195. fprintf( stderr, "\n" );
  196. }
  197. #endif // MIDL_INTERNAL