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.

77 lines
2.4 KiB

  1. /* File: D:\WACKER\htrn_jis\htrn_jis.hh (Created: 24-Aug-1994)
  2. *
  3. * Copyright 1994 by Hilgraeve Inc. -- Monroe, MI
  4. * All rights reserved
  5. *
  6. * $Revision: 1 $
  7. * $Date: 10/05/98 1:06p $
  8. */
  9. /*
  10. * The following are the currently defined modes for input and output
  11. * character translation
  12. */
  13. #define PASS_THRU_MODE 1
  14. #define JIS_TO_SHIFT_MODE 2
  15. #define SHIFT_TO_JIS_MODE 3
  16. #define SHIFT_TO_EUC_MODE 4
  17. #define EUC_TO_SHIFT_MODE 5
  18. /*
  19. * The following structures are used to translate the character stream
  20. * between Shift-JIS and JIS.
  21. */
  22. struct stShiftToJis
  23. {
  24. int nInTwoByteMode; /* already sent a mode shift sequence */
  25. int nLeadByteSeen; /* previous char was a lead byte */
  26. int nHalfWidthKanaSeen; /* previous char was a half width katakana */
  27. TCHAR chPrev; /* the previous char */
  28. };
  29. struct stJisToShift
  30. {
  31. int nInTwoByteMode; /* already seen a mode shift sequence */
  32. int nSeenFirstCharacter; /* already picked up one character */
  33. int nHalfWidthKanaSeen; /* previous char was a half width katakana */
  34. TCHAR chPrev; /* the character we picked up */
  35. int nSeenEscape; /* we are collecting an escape sequence */
  36. int nEscSeqCount; /* how many characters have we collected */
  37. TCHAR acBuffer[8]; /* if we exceed this, then we are lost */
  38. };
  39. union uConvert
  40. {
  41. struct stShiftToJis stSTJ;
  42. struct stJisToShift stJTS;
  43. };
  44. /*
  45. * The following in the internal data structure used to maintain state
  46. * information about the data stream and the translation mode
  47. */
  48. struct stInternalCharacterTranslation
  49. {
  50. HSESSION hSession; /* Needed by the load and dialog functions */
  51. int nInputMode;
  52. union uConvert uIn; /* State information for input conversion */
  53. int nOutputMode;
  54. union uConvert uOut; /* State information for output conversion */
  55. };
  56. typedef struct stInternalCharacterTranslation stICT;
  57. typedef stICT *pstICT;
  58. /*
  59. * The following macros come from the book "Understanding Japanese
  60. * Information Processing" by Ken Lunde.
  61. */
  62. #define SJIS1(A) (((A >= 129) && (A <= 159)) || ((A >= 224) && (A <= 239)))
  63. #define SJIS2(A) ((A >= 64) && (A <= 252))
  64. #define HANKATA(A) ((A >= 161) && (A <= 223))
  65. #define ISEUC(A) ((A >= 161) && (A <= 254))
  66. #define ISMARU(A) ((A >= 202) && (A <= 206))
  67. #define ISNIGORI(A) (((A >= 182) && (A <= 196)) || ((A >= 202) && (A <= 206)) || (A == 179))