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.

72 lines
1.8 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Copyright (C) Microsoft Corporation, 1991 - 1996
  4. //
  5. // File: occtable.cxx
  6. //
  7. // Contents: Occurrence table for wids
  8. //
  9. // History: 20-June-96 SitaramR Created
  10. //
  11. //----------------------------------------------------------------------------
  12. #include <pch.cxx>
  13. #pragma hdrstop
  14. #include <widtab.hxx>
  15. #include "occtable.hxx"
  16. //+---------------------------------------------------------------------------
  17. //
  18. // Member: CMaxOccTable::PutOcc
  19. //
  20. // Synopsis: Puts the max occurrence so far of (wid,pid) into the table
  21. //
  22. // Arguments: [wid] -- Workid
  23. // [pid] -- Property id
  24. // [occ] -- Occurrence
  25. //
  26. // History: 20-June-96 SitaramR Created
  27. //
  28. //----------------------------------------------------------------------------
  29. void CMaxOccTable::PutOcc( WORKID wid, PROPID pid, OCCURRENCE occ )
  30. {
  31. unsigned iIndex = FakeWidToIndex( wid );
  32. Win4Assert( iIndex < CI_MAX_DOCS_IN_WORDLIST );
  33. if ( occ > _aOccArray[iIndex].Get(pid) )
  34. _aOccArray[iIndex].Set( pid, occ );
  35. }
  36. //+---------------------------------------------------------------------------
  37. //
  38. // Member: CMaxOccTable::GetMaxOcc
  39. //
  40. // Synopsis: Returns the max occurrence of (wid,pid)
  41. //
  42. // Arguments: [wid] -- Workid
  43. // [pid] -- Property id
  44. //
  45. // History: 20-June-96 SitaramR Created
  46. //
  47. //----------------------------------------------------------------------------
  48. OCCURRENCE CMaxOccTable::GetMaxOcc( WORKID wid, PROPID pid )
  49. {
  50. unsigned iIndex = FakeWidToIndex( wid );
  51. Win4Assert( iIndex < CI_MAX_DOCS_IN_WORDLIST );
  52. OCCURRENCE occ = _aOccArray[iIndex].Get(pid) / OCCURRENCE_DIVISOR;
  53. if ( occ == 0 )
  54. return 1;
  55. return occ;
  56. }