home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / include / snanls.h < prev    next >
C/C++ Source or Header  |  1998-04-25  |  5KB  |  142 lines

  1. #ifdef __cplusplus
  2. extern "C"
  3. {
  4. #endif
  5.  
  6. #if !defined __SNANLS_INC__
  7.  
  8. #define __SNANLS_INC__
  9.  
  10. /* ********************* Constants ******************** */
  11.  
  12. #define    CP_37        37        /* EBCDIC Lower English    */
  13.  
  14. #define    CP_273        273        
  15. #define    CP_277        277        
  16. #define    CP_278        278    
  17. #define    CP_280        280    
  18. #define    CP_284        284    
  19. #define    CP_285        285    
  20.  
  21.  
  22. #define    CP_290        290        /* EBCDIC Katakana    */
  23.  
  24. #define    CP_297        297
  25. #define CP_423        423
  26. #define CP_500        500
  27. #define CP_875        875    
  28.  
  29. #define    CP_930        930        /* EBCDIC Katakana + Kanji    */
  30. #define    CP_931        931        /* EBCDIC Lower English + Kanji    */
  31. #define    CP_932        932     /* Japanese    */
  32.  
  33. #define    CP_933        933        /* EBCDIC Korean    */
  34.  
  35. #define CP_935        935        /* EBCDIC Simplified Chinese */
  36. #define CP_936        936        /* Chinese */
  37. #define    CP_937        937        /* EBCDIC Traditional Chinese    */
  38.  
  39. #define    CP_939        939        /* EBCDIC Extended Lower English + Kanji    */
  40. #define    CP_949        949        /* Korean    */
  41. #define    CP_950        950        /* Taiwanese    */
  42. #define    CP_1027        1027    /* EBCDIC Extended Lower English    */
  43.  
  44.  
  45. #define SNA_UNICODE   1  /* Result of Conversion is Unicode */
  46. #define SNA_MULTIBYTE 2  /* Result of Conversion is MultiByte */
  47.  
  48. /* ********************* Functions ******************** */
  49.  
  50. /* ***************************************************************** */
  51. /*        Initialization Routine : Local Machine                         */
  52. /*            CodePage : The CodePage which we need to support         */
  53. /*            return   : 1 if CodePage Translations are Supported      */
  54. /*                     0 otherwise                                     */
  55. /* ***************************************************************** */
  56.  
  57. int WINAPI SnaNlsInit(UINT CodePage);
  58.  
  59. /* ***************************************************************** */
  60. /*                                                                     */
  61. /* Translation Routine                                                 */
  62. /*                                                                     */
  63. /*        Input                                                         */
  64. /*                                                                     */
  65. /*            lpSrcStr   : Input, Source String                         */
  66. /*                                                                     */
  67. /*            lpDestStr  : Output, Translated String                     */
  68. /*                            maybe NULL if out_length is 0             */
  69. /*                                                                     */
  70. /*            inCodePage : CodePage of incoming string                 */
  71. /*                            ignored if input is in unicode             */
  72. /*                                                                     */
  73. /*            outCodePage: CodePage of translated string.                 */
  74. /*                            ignored if output is in unicode             */
  75. /*                                                                     */
  76. /*            in_length  : Length of input string                         */
  77. /*                            in characters if input is multibyte      */
  78. /*                            in wide chars if input is unicode        */
  79. /*                                                                     */
  80. /*          out_length : Length of output string                     */
  81. /*                            in characters if output is multibyte     */
  82. /*                            in wide chars if output is unicode       */
  83. /*                                                                     */
  84. /*            in_type    : SNA_UNICODE - Unicode Input                 */
  85. /*                         SNA_MULTIBYTE - MultiByte Input             */
  86. /*                                                                     */
  87. /*            out_type   : SNA_UNICODE - Unicode Output                 */
  88. /*                         SNA_MULTIBYTE - MultiByte Output             */
  89. /*                                                                     */
  90. /*            Options    : Multiple usage                                 */
  91. /*                            Trnsdt Options                             */
  92. /*                            Default Character for Translation (NLS)  */
  93. /*                                                                     */
  94. /*        Output                                                         */
  95. /*                                                                     */
  96. /*            return val : 0 - Failure                                 */
  97. /*                            Use GetLastError to retrieve error         */
  98. /*                         Else                                         */
  99. /*                            Num of chars(wide) written to lpDestStr  */
  100. /*                                                                     */
  101. /*            lpDestStr  : Translated String                             */
  102. /*                                                                     */
  103. /*             Options    : Required buffer length if call failed         */
  104. /*                                                                     */
  105. /*            Errors       : (Retrieved by using GetLastError)           */
  106. /*                                                                     */
  107. /*                          ERROR_NOT_SUPPORTED                         */
  108. /*                            Possible Reasons:                           */
  109. /*                                NLS is not available                  */
  110. /*                                Input & Output are not of same type     */
  111. /*                                                                     */
  112. /*                         ERROR_BUFFER_OVERFLOW                         */
  113. /*                            Possible Reasons:                         */
  114. /*                                Output buffer is too small           */
  115. /*                                                                     */
  116. /*                         ERROR_INVALID_PARAMETER                     */
  117. /*                            Possible Reasons:                         */
  118. /*                                in_type or out_type is faulty        */
  119. /*                                                                     */
  120. /*                         ERROR_INVALID_DATA                             */
  121. /*                            Possible Reasons:                         */
  122. /*                                input data has a lead byte at end    */
  123. /*                                                                     */
  124. /*                         ERROR_OUTOFMEMORY                             */
  125. /*                            Possible Reasons:                         */
  126. /*                                malloc failed                         */
  127. /*                                                                     */
  128. /*                                                                     */
  129. /* ***************************************************************** */
  130.  
  131. int WINAPI SnaNlsMapString (LPCTSTR lpSrcStr, LPTSTR lpDestStr,
  132.                      UINT inCodePage, UINT outCodePage,
  133.                      int in_length,   int out_length, 
  134.                      UINT in_type, UINT out_type,  WORD * Options);
  135.  
  136.  
  137.  
  138. #endif
  139.  
  140. #ifdef __cplusplus
  141. }
  142. #endif