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.

114 lines
2.4 KiB

  1. /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2. Copyright (c) 1989-1999 Microsoft Corporation
  3. Module Name:
  4. cgcls.cxx
  5. Abstract:
  6. Routines for the cgcls code generation class.
  7. Notes:
  8. History:
  9. Aug-31-1993 VibhasC Created.
  10. ----------------------------------------------------------------------------*/
  11. /****************************************************************************
  12. * include files
  13. ***************************************************************************/
  14. #include "becls.hxx"
  15. #pragma hdrstop
  16. /****************************************************************************
  17. * local definitions
  18. ***************************************************************************/
  19. /****************************************************************************
  20. * local data
  21. ***************************************************************************/
  22. /****************************************************************************
  23. * externs
  24. ***************************************************************************/
  25. /****************************************************************************/
  26. short
  27. CG_CLASS::GetMembers(
  28. ITERATOR& I )
  29. /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  30. Routine Description:
  31. GetMembers (list of child+its siblings) of the code generation class.
  32. Arguments:
  33. I - An iterator for the member list.
  34. Return Value:
  35. Count of number of members.
  36. Notes:
  37. ----------------------------------------------------------------------------*/
  38. {
  39. CG_CLASS * pC;
  40. short Count = 0;
  41. if( ( pC = GetChild() ) != 0 )
  42. {
  43. ITERATOR_INSERT( I, pC );
  44. Count++;
  45. while( ( pC = pC->GetSibling() ) != 0 )
  46. {
  47. ITERATOR_INSERT( I, pC );
  48. Count++;
  49. }
  50. }
  51. return Count;
  52. }
  53. CG_CLASS *
  54. CG_CLASS::GetLastSibling()
  55. {
  56. CG_CLASS * pLast = this;
  57. CG_CLASS * pS;
  58. while ( ( pS = pLast->GetSibling() ) != 0 )
  59. pLast = pS;
  60. return pLast;
  61. }
  62. // Set the member list on a class
  63. void CG_CLASS::SetMembers( ITERATOR & I )
  64. {
  65. CG_CLASS *pHead = NULL;
  66. ITERATOR_INIT( I );
  67. ITERATOR_GETNEXT( I, pHead );
  68. if (pHead)
  69. {
  70. CG_CLASS *pCurrent = pHead;
  71. CG_CLASS *pNext = NULL;
  72. while( ITERATOR_GETNEXT( I, pNext ) )
  73. {
  74. pCurrent->SetSibling( pNext );
  75. pCurrent = pNext;
  76. }
  77. pCurrent->SetSibling( NULL );
  78. }
  79. SetChild( pHead );
  80. return;
  81. }