Leaked source code of windows server 2003
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.

188 lines
5.2 KiB

  1. /*****************************************************************************/
  2. /** Microsoft LAN Manager **/
  3. /** Copyright(c) Microsoft Corp., 1987-1999 **/
  4. /*****************************************************************************/
  5. /*****************************************************************************
  6. File : procnode.cxx
  7. Title : proc / param semantic analyser routines
  8. History :
  9. 10-Aug-1991 VibhasC Created
  10. *****************************************************************************/
  11. #pragma warning ( disable : 4514 4710 )
  12. /****************************************************************************
  13. includes
  14. ****************************************************************************/
  15. #include "nulldefs.h"
  16. extern "C" {
  17. #include <stdio.h>
  18. #include <string.h>
  19. }
  20. #include "allnodes.hxx"
  21. #include "cmdana.hxx"
  22. #include "idict.hxx"
  23. /****************************************************************************
  24. local defines
  25. ****************************************************************************/
  26. /****************************************************************************
  27. externs
  28. ****************************************************************************/
  29. extern CMD_ARG * pCommand;
  30. extern node_e_status_t * pError_status_t;
  31. /****************************************************************************
  32. extern procedures
  33. ****************************************************************************/
  34. /****************************************************************************/
  35. /****************************************************************************
  36. proc node procedures
  37. ****************************************************************************/
  38. //
  39. // add extra "hidden" [comm_status] or [fault_status] parameter
  40. //
  41. void
  42. node_proc::AddStatusParam(
  43. char * pName,
  44. ATTRLIST AList )
  45. {
  46. // find error_status_t, make pointer, make param
  47. // add param to end of param list
  48. node_pointer * pPtr = new node_pointer;
  49. node_param * pParam = new node_param;
  50. pPtr->SetChild( pError_status_t );
  51. pParam->SetChild( pPtr );
  52. pParam->SetSymName( pName );
  53. // add param to end of MY param list
  54. AddLastMember( pParam );
  55. pParam->AddAttributes( AList );
  56. // Take note that the parameter is "invisible".
  57. SetHasExtraStatusParam();
  58. pParam->SetExtraStatusParam();
  59. }
  60. // force a proc to use -Os
  61. BOOL
  62. node_proc::ForceNonInterpret()
  63. {
  64. // ndr64 doesn't do -Os. In theory we've caught all the cases where
  65. // a switch to -Os is required. Just in case we missed one, catch it now
  66. if ( pCommand->NeedsNDR64Run() )
  67. RpcError( NULL, 0, UNEXPECTED_OS_IN_NDR64, GetSymName() );
  68. unsigned short NewOpt = GetOptimizationFlags();
  69. unsigned short OldOpt = NewOpt;
  70. // remove interpret, set size
  71. // zero all the possible interpreter flags
  72. NewOpt &= ~OPTIMIZE_ALL_I2_FLAGS;
  73. NewOpt |= OPTIMIZE_SIZE;
  74. // did anything change?
  75. BOOL fChanged = OldOpt != NewOpt;
  76. if (fChanged)
  77. SetOptimizationFlags( NewOpt );
  78. fForcedS = TRUE;
  79. return fChanged;
  80. }
  81. // force a proc to use -Oi2
  82. BOOL
  83. node_proc::ForceInterpret2()
  84. {
  85. unsigned short NewOpt = GetOptimizationFlags();
  86. unsigned short OldOpt = NewOpt;
  87. // remove interpret, set size
  88. NewOpt &= ~OPTIMIZE_SIZE;
  89. NewOpt |= OPTIMIZE_ALL_I2_FLAGS;
  90. // did anything change?
  91. BOOL fChanged = OldOpt != NewOpt;
  92. if (fChanged)
  93. SetOptimizationFlags( NewOpt );
  94. fForcedI2 = TRUE;
  95. return fChanged;
  96. }
  97. BOOL
  98. node_proc::HasAtLeastOneShipped()
  99. {
  100. MEM_ITER MemIter( this );
  101. node_skl * pNode;
  102. BOOL f = FALSE;
  103. while ( ( pNode = MemIter.GetNext() ) != 0 )
  104. {
  105. if( pNode->FInSummary( ATTR_IN ) )
  106. {
  107. node_skl * pT = pNode->GetBasicType();
  108. if( pT->NodeKind() == NODE_POINTER )
  109. pT = pT->GetBasicType();
  110. if( pT->GetBasicType()->NodeKind() != NODE_HANDLE_T )
  111. {
  112. f = TRUE;
  113. break; // from the while loop.
  114. }
  115. }
  116. }
  117. return f;
  118. }
  119. // returns ATTR_NONE if none explicitly specified
  120. BOOL
  121. node_proc::GetCallingConvention( ATTR_T & Attr )
  122. {
  123. Attr = ATTR_NONE;
  124. if ( FInSummary( ATTR_STDCALL ) )
  125. {
  126. Attr = ATTR_STDCALL;
  127. }
  128. if ( FInSummary( ATTR_CDECL ) )
  129. {
  130. if ( Attr != ATTR_NONE ) return FALSE;
  131. Attr = ATTR_CDECL;
  132. }
  133. if ( FInSummary( ATTR_FASTCALL ) )
  134. {
  135. if ( Attr != ATTR_NONE ) return FALSE;
  136. Attr = ATTR_FASTCALL;
  137. }
  138. if ( FInSummary( ATTR_PASCAL ) )
  139. {
  140. if ( Attr != ATTR_NONE ) return FALSE;
  141. Attr = ATTR_PASCAL;
  142. }
  143. if ( FInSummary( ATTR_FORTRAN ) )
  144. {
  145. if ( Attr != ATTR_NONE ) return FALSE;
  146. Attr = ATTR_FORTRAN;
  147. }
  148. return TRUE;
  149. }