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.

48 lines
1.9 KiB

  1. /*
  2. * Automatic language and codepage detection
  3. *
  4. * Bob Powell, 2/97
  5. * Copyright (C) 1996, 1997, Microsoft Corp. All rights reserved.
  6. */
  7. #if !defined( __LCDETECT_H__ )
  8. #define __LCDETECT_H__
  9. typedef struct LCDScore {
  10. UINT nLangID; // Win32 primary language ID
  11. UINT nCodePage; // Win32 code page (valid for SBCS input only!)
  12. int nDocPercent; // % of doc in this language, 0-100
  13. int nConfidence; // Relative confidence measure, approx 0-100
  14. } LCDScore;
  15. typedef struct LCDScore * PLCDScore;
  16. typedef struct LCDConfigure {
  17. int nMin7BitScore; // per-char score threshhold for 7-bit detection
  18. int nMin8BitScore; // " " for 8-bit
  19. int nMinUnicodeScore; // " " for Unicode
  20. int nRelativeThreshhold;// relative "" as % of the top scoring doc, 0-100
  21. int nDocPctThreshhold; // min % of doc in a language to score it, 0-100
  22. int nChunkSize; // # of chars to process at a time
  23. } LCDConfigure;
  24. typedef struct LCDConfigure *PLCDConfigure;
  25. typedef struct LCDConfigure const *PCLCDConfigure;
  26. // Pass in rough body text in pStr, length nChars
  27. // Pass in preallocated LCDScore array in paScores, array size in *pnScores.
  28. // On return, *pnScores is set to number of elements containing result data.
  29. //
  30. // If pLCDC is NULL, the default configuration is used.
  31. // To detect with a custom configuration, call LCD_GetConfig() to fill in
  32. // a copy of an LCDConfigure, and then pas it to LCD_Detect().
  33. extern "C" DWORD WINAPI LCD_Detect (LPCSTR pStr, int nChars,
  34. PLCDScore paScores, int *pnScores,
  35. PCLCDConfigure pLCDC);
  36. extern "C" DWORD WINAPI LCD_DetectW (LPCWSTR pwStr, int nChars,
  37. PLCDScore paScores, int *pnScores,
  38. PCLCDConfigure pLCDC);
  39. extern "C" void WINAPI LCD_GetConfig (PLCDConfigure pLCDC);
  40. #endif