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.

52 lines
1.4 KiB

  1. //////////////////////////////////////////////////
  2. // Copyright (C) 1997 - 1998, Microsoft Corporation. All Rights Reserved.
  3. //
  4. // File : DICTTYPE.CPP
  5. // Project : project SIK
  6. //////////////////////////////////////////////////
  7. #include <io.h>
  8. #include <stdlib.h>
  9. #include <string.h>
  10. #include "basecore.hpp"
  11. #include "stemkor.h"
  12. ////////////////////////////////////////////////////////////////////////
  13. int LenDict::FindWord(char *stem,
  14. int &ulspos,
  15. int startindex)
  16. {
  17. for(int i = startindex; i < WORDNUM; i++) // Check the length of stem
  18. {
  19. if(__IsDefStem(ulspos, dict[(i+1)*BUCKETSIZE-1]) == 1)
  20. {
  21. if(strcmp(stem+(ulspos-dict[(i+1)*BUCKETSIZE-1]),
  22. dict+i*BUCKETSIZE) == 0)
  23. {
  24. // remove the rear of stem in the LenDict
  25. __DelStemN(stem, ulspos, dict[(i+1)*BUCKETSIZE-1]+1);
  26. return i;
  27. }
  28. }
  29. }
  30. return -1;
  31. }
  32. // Restore the part of stem which is removed in FindWord
  33. void LenDict::RestWord(char *stem,
  34. int &ulspos,
  35. int restindex)
  36. {
  37. for (int i=0; ;i++)
  38. {
  39. if (dict[restindex*BUCKETSIZE+i] == 0)
  40. {
  41. break;
  42. }
  43. ulspos++;
  44. stem[ulspos] = dict[restindex*BUCKETSIZE+i];
  45. }
  46. stem[ulspos+1] = NULLCHAR;
  47. }