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.

251 lines
6.0 KiB

  1. /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2. Copyright (c) 1989-1999 Microsoft Corporation
  3. Module Name:
  4. ilbase.cxx
  5. Abstract:
  6. Intermediate Language translator for base types
  7. Notes:
  8. Author:
  9. GregJen Dec-24-1993 Created.
  10. Notes:
  11. ----------------------------------------------------------------------------*/
  12. /****************************************************************************
  13. * include files
  14. ***************************************************************************/
  15. #include "becls.hxx"
  16. #pragma hdrstop
  17. #include "ilxlat.hxx"
  18. #include "ilreg.hxx"
  19. /****************************************************************************
  20. * local data
  21. ***************************************************************************/
  22. /****************************************************************************
  23. * externs
  24. ***************************************************************************/
  25. extern CMD_ARG * pCommand;
  26. extern BOOL IsTempName( char *);
  27. extern REUSE_DICT * pReUseDict;
  28. /****************************************************************************
  29. * definitions
  30. ***************************************************************************/
  31. //--------------------------------------------------------------------
  32. //
  33. // node_skl::ILxlate
  34. //
  35. // Notes:
  36. //
  37. //
  38. //
  39. //--------------------------------------------------------------------
  40. CG_CLASS *
  41. node_skl::ILxlate( XLAT_CTXT* )
  42. {
  43. #ifdef trace_cg
  44. printf("..node_skl... kind is %d\n",NodeKind() );
  45. #endif
  46. return 0;
  47. };
  48. //--------------------------------------------------------------------
  49. //
  50. // node_base_type::ILxlate
  51. //
  52. // Notes:
  53. //
  54. //
  55. //
  56. //--------------------------------------------------------------------
  57. CG_CLASS *
  58. node_base_type::ILxlate( XLAT_CTXT * pContext )
  59. {
  60. CG_NDR * pCG;
  61. XLAT_CTXT MyContext(this, pContext);
  62. #ifdef trace_cg
  63. printf("..node_base_type,\t%s\n", GetSymName());
  64. #endif
  65. MyContext.BaseTypeSizes( this );
  66. // Note that these nodes are all preallocated so the modifiers
  67. // and this node can be ignored.
  68. // process any context_handle attributes from param nodes
  69. if ( pContext->ExtractAttribute( ATTR_CONTEXT ) )
  70. {
  71. MyContext.FixMemSizes( this );
  72. pCG = new CG_CONTEXT_HANDLE (
  73. this,
  74. 0,
  75. MyContext
  76. );
  77. }
  78. switch ( NodeKind() )
  79. {
  80. case NODE_HANDLE_T:
  81. {
  82. pCG = new CG_PRIMITIVE_HANDLE( this, NULL, MyContext );
  83. break;
  84. }
  85. case NODE_INT3264:
  86. {
  87. if ( pCommand->Is64BitEnv() )
  88. pCG = new CG_INT3264( this, MyContext );
  89. else
  90. pCG = new CG_BASETYPE( this, MyContext );
  91. break;
  92. }
  93. case NODE_VOID:
  94. {
  95. // VOID should only occur as as a single VOID param;
  96. // return NULL here, then the PARAM returns NULL as well
  97. if (!pContext->AnyAncestorBits(IL_IN_LIBRARY) )
  98. return NULL;
  99. }
  100. // this looks like a conditional fall through..
  101. default:
  102. {
  103. if ( pContext->AnyAncestorBits( IL_CS_STAG | IL_CS_DRTAG | IL_CS_RTAG ) )
  104. {
  105. pCG = new CG_CS_TAG(
  106. this,
  107. MyContext,
  108. pContext->AnyAncestorBits( IL_CS_STAG ),
  109. pContext->AnyAncestorBits( IL_CS_DRTAG ),
  110. pContext->AnyAncestorBits( IL_CS_RTAG ) );
  111. }
  112. else
  113. {
  114. pCG = new CG_BASETYPE( this, MyContext );
  115. node_range_attr* pRA = ( node_range_attr* ) pContext->ExtractAttribute( ATTR_RANGE );
  116. if ( pRA != 0 && pCommand->IsSwitchDefined( SWITCH_ROBUST ) )
  117. {
  118. pCG->SetRangeAttribute( pRA );
  119. }
  120. }
  121. break;
  122. }
  123. };
  124. pContext->ReturnSize( MyContext );
  125. #ifdef trace_cg
  126. printf("..node_base_type return \n");
  127. #endif
  128. return pCG;
  129. };
  130. //--------------------------------------------------------------------
  131. //
  132. // node_label::ILxlate
  133. //
  134. // Notes:
  135. //
  136. //
  137. //
  138. //--------------------------------------------------------------------
  139. CG_CLASS *
  140. node_label::ILxlate( XLAT_CTXT * pContext )
  141. {
  142. pContext->ExtractAttribute(ATTR_IDLDESCATTR);
  143. pContext->ExtractAttribute(ATTR_VARDESCATTR);
  144. pContext->ExtractAttribute(ATTR_ID);
  145. pContext->ExtractAttribute(ATTR_HIDDEN);
  146. #ifdef trace_cg
  147. printf("..node_label,\t%s\n", GetSymName());
  148. #endif
  149. return NULL;
  150. };
  151. //--------------------------------------------------------------------
  152. //
  153. // node_e_status_t::ILxlate
  154. //
  155. // Notes:
  156. //
  157. //
  158. //
  159. //--------------------------------------------------------------------
  160. CG_CLASS *
  161. node_e_status_t::ILxlate( XLAT_CTXT * pContext )
  162. {
  163. XLAT_CTXT MyContext( this, pContext );
  164. CG_ERROR_STATUS_T * pCG;
  165. #ifdef trace_cg
  166. printf("..node_e_status_t,\t%s\n", GetSymName());
  167. #endif
  168. MyContext.BaseTypeSizes( this );
  169. // gaj - do we need to see which we used ??
  170. MyContext.ExtractAttribute( ATTR_COMMSTAT );
  171. MyContext.ExtractAttribute( ATTR_FAULTSTAT );
  172. pContext->ReturnSize( MyContext );
  173. pCG = new CG_ERROR_STATUS_T( this, MyContext );
  174. return pCG;
  175. };
  176. //--------------------------------------------------------------------
  177. //
  178. // node_wchar_t::ILxlate
  179. //
  180. // Notes:
  181. //
  182. //
  183. //
  184. //--------------------------------------------------------------------
  185. CG_CLASS *
  186. node_wchar_t::ILxlate( XLAT_CTXT * pContext )
  187. {
  188. CG_BASETYPE * pCG;
  189. XLAT_CTXT MyContext( this, pContext );
  190. #ifdef trace_cg
  191. printf("..node_wchar_t,\t%s\n", GetSymName());
  192. #endif
  193. MyContext.BaseTypeSizes( this );
  194. pContext->ReturnSize( MyContext );
  195. pCG = new CG_BASETYPE( this, MyContext );
  196. return pCG;
  197. };