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.

1306 lines
45 KiB

  1. /*++
  2. Copyright (c) 1991-1999, Microsoft Corporation All rights reserved.
  3. Module Name:
  4. nlstrans.h
  5. Abstract:
  6. This file contains the header information shared by all of the modules
  7. of the NLSTRANS utility.
  8. Revision History:
  9. 07-30-91 JulieB Created.
  10. 03-10-00 lguindon Began GEO API port.
  11. 09-12-00 JulieB Fixed buffer sizes from GEO port.
  12. --*/
  13. ////////////////////////////////////////////////////////////////////////////
  14. //
  15. // Includes Files.
  16. //
  17. ////////////////////////////////////////////////////////////////////////////
  18. #include <windows.h>
  19. #include <winnls.h>
  20. #include <string.h>
  21. #include <stdarg.h>
  22. #include <stdio.h>
  23. #include <stdlib.h>
  24. #include <malloc.h>
  25. ////////////////////////////////////////////////////////////////////////////
  26. //
  27. // Constant Declarations.
  28. //
  29. ////////////////////////////////////////////////////////////////////////////
  30. //
  31. // Define boolean constants.
  32. //
  33. #define FALSE 0
  34. #define TRUE 1
  35. //
  36. // Table Sizes.
  37. //
  38. #define MAX 256 // max buffer size
  39. #define MB_TABLE_SIZE 256 // size of MB table
  40. #define GLYPH_TABLE_SIZE MB_TABLE_SIZE // size of Glyph table
  41. #define DBCS_TABLE_SIZE 256 // size of DBCS table
  42. #define DBCS_OFFSET_SIZE 256 // size of DBCS offset area
  43. #define WC_TABLE_SIZE (64 * 1024) // size of WC table (char cnt)
  44. #define TABLE_SIZE_8 256 // size for 8:4:4 array (8)
  45. #define TABLE_SIZE_4 16 // size for 8:4:4 array (4)
  46. #define MAX_844_TBL_SIZE (64 * 1024) // max size of 8:4:4 table
  47. #define FILE_NAME_LEN 10 // max length of a file name
  48. #define MAX_NUM_LEADBYTE 12 // max number of DBCS lead bytes
  49. #define SKEY_TBL_SIZE (64 * 1024) // size of SORTKEY default table
  50. #define MAX_CT_MAP_TBL_SIZE 256 // max size of CTYPE Mapping table
  51. #define MAX_FONTSIGNATURE 16 // max size of font signature
  52. //
  53. // Geo Table Sizes.
  54. //
  55. #define MAX_SIGNATURE 4 // max size of signature
  56. #define MAX_LATITUDE 12 // max size of latitude
  57. #define MAX_LONGITUDE 12 // max size of longitude
  58. #define MAX_ISO_ABBREV 4 // max size of iso abbreviations
  59. //
  60. // Special Flags.
  61. //
  62. #define DUPLICATE_OFFSET TABLE_SIZE_4 // offset to duplicate flag (ctype)
  63. #define CP_ACP 0 // default to ANSI code page
  64. //
  65. // String Constants for Data Files.
  66. //
  67. #define CP_PREFIX "c_"
  68. #define DATA_FILE_SUFFIX ".nls"
  69. #define NLP_FILE_SUFFIX ".nlp"
  70. #define DATA_FILE_SUFFIX_W L".nls"
  71. #define NLP_FILE_SUFFIX_W L".nlp"
  72. #define LANGUAGE_FILE "l_intl.nls"
  73. #define LANG_EXCEPT_FILE "l_except.nls"
  74. #define LOCALE_FILE "locale.nls"
  75. #define UNICODE_FILE "unicode.nls"
  76. #define CTYPE_FILE "ctype.nls"
  77. #define SORTKEY_FILE "sortkey.nls"
  78. #define SORTTBLS_FILE "sorttbls.nls"
  79. #define SORTKEY_NLP_FILE "sortkey.nlp"
  80. #define SORTTBLS_NLP_FILE "sorttbls.nlp"
  81. #define GEOFILE "geo.nls"
  82. //
  83. // Flags denoting which tables to write to the output files.
  84. //
  85. #define F_CPINFO 0x80000000
  86. #define F_MB 0x00000001
  87. #define F_GLYPH 0x00000002
  88. #define F_DBCS 0x00000004
  89. #define F_WC 0x00000008
  90. #define F_UPPER 0x00000010
  91. #define F_LOWER 0x00000020
  92. #define F_ADIGIT 0x00000100
  93. #define F_CZONE 0x00000200
  94. #define F_COMP 0x00000400
  95. #define F_HIRAGANA 0x00001000
  96. #define F_KATAKANA 0x00002000
  97. #define F_HALFWIDTH 0x00004000
  98. #define F_FULLWIDTH 0x00008000
  99. #define F_TRADITIONAL 0x00010000
  100. #define F_SIMPLIFIED 0x00020000
  101. #define F_CTYPE_1 0x00010000
  102. #define F_CTYPE_2 0x00020000
  103. #define F_CTYPE_3 0x00040000
  104. #define F_DEFAULT_SORTKEY 0x00100000
  105. #define F_REVERSE_DW 0x00200000
  106. #define F_DOUBLE_COMPRESS 0x00400000
  107. #define F_MULTIPLE_WEIGHTS 0x00800000
  108. #define F_EXPANSION 0x01000000
  109. #define F_EXCEPTION 0x02000000
  110. #define F_COMPRESSION 0x04000000
  111. #define F_IDEOGRAPH_LCID 0x08000000
  112. #define F_JAMOSORT 0x10000000
  113. #define JAMO_INDEX_SIZE 0x100
  114. #define JAMO_INDEX_RANGE 0xffff
  115. #define FIRST_JAMO 0x1100
  116. #define LAST_JAMO 0x11ff
  117. ////////////////////////////////////////////////////////////////////////////
  118. //
  119. // Typedef Declarations.
  120. //
  121. ////////////////////////////////////////////////////////////////////////////
  122. typedef unsigned long DWORD;
  123. typedef unsigned short WORD;
  124. typedef unsigned char BYTE;
  125. typedef int BOOL;
  126. typedef void *PVOID;
  127. typedef unsigned int UINT;
  128. typedef char *PSZ;
  129. typedef DWORD LCID;
  130. typedef unsigned short WCHAR;
  131. typedef char CHAR;
  132. typedef WORD *PMB_TBL;
  133. typedef WORD *PGLYPH_TBL;
  134. typedef PVOID *PDBCS_TBL_ARRAY;
  135. typedef WORD *PDBCS_TBL;
  136. typedef WORD *PDBCS_OFFSETS;
  137. typedef struct dbcs_range_s
  138. {
  139. WORD LowRange;
  140. WORD HighRange;
  141. PDBCS_TBL_ARRAY pDBCSTbls;
  142. } DBCS_RANGE, *PDBCS_RANGE;
  143. typedef PDBCS_RANGE *PDBCS_ARRAY;
  144. typedef PVOID *P844_ARRAY;
  145. typedef PVOID PWC_ARRAY;
  146. typedef P844_ARRAY PCT_ARRAY;
  147. typedef P844_ARRAY PUP_ARRAY;
  148. typedef P844_ARRAY PLO_ARRAY;
  149. typedef P844_ARRAY PAD_ARRAY;
  150. typedef P844_ARRAY PCZ_ARRAY;
  151. typedef P844_ARRAY PHG_ARRAY;
  152. typedef P844_ARRAY PKK_ARRAY;
  153. typedef P844_ARRAY PHW_ARRAY;
  154. typedef P844_ARRAY PFW_ARRAY;
  155. typedef P844_ARRAY PTR_ARRAY;
  156. typedef P844_ARRAY PSP_ARRAY;
  157. typedef P844_ARRAY PPCOMP_ARRAY;
  158. typedef P844_ARRAY PCOMP_ARRAY;
  159. typedef WORD *PCOMP_GRID;
  160. ////////////////////////////////////////
  161. //
  162. // CODEPAGE File Structures.
  163. //
  164. ////////////////////////////////////////
  165. typedef struct codepage_s
  166. {
  167. PMB_TBL pMB; // ptr to MB array (1:1)
  168. PGLYPH_TBL pGlyph; // ptr to Glyph array (1:1)
  169. PDBCS_ARRAY pDBCS; // ptr to DBCS info
  170. PDBCS_OFFSETS pDBCSOff; // ptr to DBCS offset area
  171. PWC_ARRAY pWC; // ptr to WC 8:4:4 info
  172. DWORD WriteFlags; // which tables to write
  173. int NumDBCSRanges; // number of DBCS Ranges
  174. PSZ pszName; // ptr to codepage name (value)
  175. int CodePageValue; // code page value
  176. int MaxCharSize; // max character length
  177. WORD DefaultChar; // default character (mbcs)
  178. WORD UniDefaultChar; // unicode default char
  179. WORD TransDefChar; // translation of default char (unicode)
  180. WORD TransUniDefChar; // translation of uni def char (mbcs)
  181. BYTE LeadBytes[MAX_NUM_LEADBYTE];
  182. } CODEPAGE, *PCODEPAGE;
  183. #define CP_INFO_SIZE 13 // size of CPINFO + 1 (in words)
  184. ////////////////////////////////////////
  185. //
  186. // LANGUAGE File Structures.
  187. //
  188. ////////////////////////////////////////
  189. typedef struct language_s
  190. {
  191. PUP_ARRAY pUpper; // ptr to UPPERCASE 8:4:4 info
  192. PLO_ARRAY pLower; // ptr to LOWERCASE 8:4:4 info
  193. DWORD WriteFlags; // tables to write
  194. int IfDefault; // 1 for default file, 0 otherwise
  195. int UPBuf2; // number UPPERCASE Buffer 2
  196. int UPBuf3; // number UPPERCASE Buffer 3
  197. int LOBuf2; // number LOWERCASE Buffer 2
  198. int LOBuf3; // number LOWERCASE Buffer 3
  199. } LANGUAGE, *PLANGUAGE;
  200. typedef struct l_except_hdr_s
  201. {
  202. DWORD Locale; // locale id
  203. DWORD Offset; // offset to exception nodes
  204. DWORD NumUpEntries; // number of upper case entries
  205. DWORD NumLoEntries; // number of lower case entries
  206. } L_EXCEPT_HDR, *PL_EXCEPT_HDR;
  207. typedef struct l_except_node_s
  208. {
  209. WORD UCP; // unicode code point
  210. WORD AddAmount; // amount to add to initial code point
  211. } L_EXCEPT_NODE, *PL_EXCEPT_NODE;
  212. typedef PL_EXCEPT_NODE *PL_EXCEPT_TBL; // ptr to array of exception nodes
  213. #define NUM_L_EXCEPT_WORDS (sizeof(L_EXCEPT_NODE) / sizeof(WORD))
  214. typedef struct lang_except_s
  215. {
  216. int NumException; // number of EXCEPTION locales
  217. PL_EXCEPT_HDR pExceptHdr; // ptr to language exception header
  218. PL_EXCEPT_TBL pExceptTbl; // ptr to language exception table
  219. } LANG_EXCEPT, *PLANG_EXCEPT;
  220. ////////////////////////////////////////
  221. //
  222. // UNICODE File Structures.
  223. //
  224. ////////////////////////////////////////
  225. typedef struct unicode_s
  226. {
  227. PAD_ARRAY pADigit; // ptr to ASCIIDIGITS 8:4:4 info
  228. PCZ_ARRAY pCZone; // ptr to FOLDCZONE 8:4:4 info
  229. PHG_ARRAY pHiragana; // ptr to HIRAGANA 8:4:4 info
  230. PKK_ARRAY pKatakana; // ptr to KATAKANA 8:4:4 info
  231. PHW_ARRAY pHalfWidth; // ptr to HALFWIDTH 8:4:4 info
  232. PFW_ARRAY pFullWidth; // ptr to FULLWIDTH 8:4:4 info
  233. PTR_ARRAY pTraditional; // ptr to TRADITIONAL 8:4:4 info
  234. PSP_ARRAY pSimplified; // ptr to SIMPLIFIED 8:4:4 info
  235. PPCOMP_ARRAY pPreComp; // ptr to PRECOMPOSED 8:4:4 info
  236. PCOMP_ARRAY pBase; // ptr to COMPOSITE Base 8:4:4
  237. PCOMP_ARRAY pNonSp; // ptr to COMPOSITE NonSpace 8:4:4
  238. PCOMP_GRID pCompGrid; // ptr to COMPOSITE 2D Grid
  239. int NumBase; // total number of BASE characters
  240. int NumNonSp; // total number of NONSPACE characters
  241. DWORD WriteFlags; // tables to write
  242. int ADBuf2; // number ASCIIDIGITS Buffer 2
  243. int ADBuf3; // number ASCIIDIGITS Buffer 3
  244. int CZBuf2; // number FOLDCZONE Buffer 2
  245. int CZBuf3; // number FOLDCZONE Buffer 3
  246. int HGBuf2; // number HIRAGANA Buffer 2
  247. int HGBuf3; // number HIRAGANA Buffer 3
  248. int KKBuf2; // number KATAKANA Buffer 2
  249. int KKBuf3; // number KATAKANA Buffer 3
  250. int HWBuf2; // number HALFWIDTH Buffer 2
  251. int HWBuf3; // number HALFWIDTH Buffer 3
  252. int FWBuf2; // number FULLWIDTH Buffer 2
  253. int FWBuf3; // number FULLWIDTH Buffer 3
  254. int TRBuf2; // number TRADITIONAL Buffer 2
  255. int TRBuf3; // number TRADITIONAL Buffer 3
  256. int SPBuf2; // number SIMPLIFIED Buffer 2
  257. int SPBuf3; // number SIMPLIFIED Buffer 3
  258. int PCBuf2; // number PRECOMPOSED Buffer 2
  259. int PCBuf3; // number PRECOMPOSED Buffer 3
  260. int BSBuf2; // number COMPOSITE BASE Buffer 2
  261. int BSBuf3; // number COMPOSITE BASE Buffer 3
  262. int NSBuf2; // number COMPOSITE NONSPACE Buffer 2
  263. int NSBuf3; // number COMPOSITE NONSPACE Buffer 3
  264. } UNICODE, *PUNICODE;
  265. ////////////////////////////////////////
  266. //
  267. // CTYPE File Structures.
  268. //
  269. ////////////////////////////////////////
  270. typedef struct ct_values_s
  271. {
  272. WORD CType1; // ctype 1 value
  273. WORD CType2; // ctype 2 value
  274. WORD CType3; // ctype 3 value
  275. } CT_VALUES, *PCT_VALUES;
  276. typedef BYTE CT_MAP_VALUE, *PCT_MAP_VALUE;
  277. typedef struct ct_map_s
  278. {
  279. int Length; // length of mapping table
  280. PCT_VALUES pCTValues; // table of CTYPE values
  281. } CT_MAP, *PCT_MAP;
  282. typedef struct ctypes_s
  283. {
  284. PCT_ARRAY pCType; // ptr to CTYPE 8:4:4 info
  285. PCT_MAP pMap; // ptr to mapping table
  286. DWORD WriteFlags; // tables to write
  287. int CTBuf2; // number CTYPE Buffer 2
  288. int CTBuf3; // number CTYPE Buffer 3
  289. } CTYPES, *PCTYPES;
  290. ////////////////////////////////////////
  291. //
  292. // SORTKEY & SORTTBLS File Structures.
  293. //
  294. ////////////////////////////////////////
  295. typedef struct skey_s
  296. {
  297. BYTE Alpha; // alphanumeric weight
  298. BYTE Script; // script member
  299. BYTE Diacritic; // diacritic weight
  300. BYTE Case; // case weight (incl. compression)
  301. } SKEY, *PSKEY;
  302. typedef struct sortkey_s
  303. {
  304. PSKEY pDefault; // ptr to DEFAULT SORTKEY info
  305. DWORD WriteFlags; // tables to write
  306. } SORTKEY, *PSORTKEY;
  307. typedef DWORD REV_DW;
  308. typedef REV_DW *PREV_DW;
  309. typedef DWORD DBL_COMPRESS;
  310. typedef DBL_COMPRESS *PDBL_COMPRESS;
  311. typedef struct ideograph_lcid_s
  312. {
  313. DWORD Locale; // locale id
  314. WORD pFileName[14]; // ptr to file name
  315. } IDEOGRAPH_LCID, *PIDEOGRAPH_LCID;
  316. typedef struct expand_s
  317. {
  318. WORD CP1; // code point 1 - expansion
  319. WORD CP2; // code point 2 - expansion
  320. } EXPAND, *PEXPAND;
  321. typedef struct compress_hdr_s
  322. {
  323. DWORD Locale; // locale id
  324. DWORD Offset; // offset to compression nodes
  325. WORD Num2; // number of 2 entries for lang id
  326. WORD Num3; // number of 3 entries for lang id
  327. } COMPRESS_HDR, *PCOMPRESS_HDR;
  328. typedef struct compress_2_node_s
  329. {
  330. WORD UCP1; // unicode code point 1
  331. WORD UCP2; // unicode code point 2
  332. BYTE Alpha; // alphanumeric weight
  333. BYTE Script; // script member
  334. BYTE Diacritic; // diacritic weight
  335. BYTE Case; // case weight
  336. } COMPRESS_2_NODE, *PCOMPRESS_2_NODE;
  337. typedef struct compress_3_node_s
  338. {
  339. WORD UCP1; // unicode code point 1
  340. WORD UCP2; // unicode code point 2
  341. WORD UCP3; // unicode code point 3
  342. WORD Reserved; // dword alignment of structure
  343. BYTE Alpha; // alphanumeric weight
  344. BYTE Script; // script member
  345. BYTE Diacritic; // diacritic weight
  346. BYTE Case; // case weight
  347. } COMPRESS_3_NODE, *PCOMPRESS_3_NODE;
  348. typedef PCOMPRESS_2_NODE *PCOMPRESS_2_TBL; // ptr to array of compression 2 nodes
  349. typedef PCOMPRESS_3_NODE *PCOMPRESS_3_TBL; // ptr to array of compression 3 nodes
  350. #define NUM_COMPRESS_2_WORDS (sizeof(COMPRESS_2_NODE) / sizeof(WORD))
  351. #define NUM_COMPRESS_3_WORDS (sizeof(COMPRESS_3_NODE) / sizeof(WORD))
  352. typedef struct except_hdr_s
  353. {
  354. DWORD Locale; // locale id
  355. DWORD Offset; // offset to exception nodes
  356. DWORD NumEntries; // number of entries for locale id
  357. } EXCEPT_HDR, *PEXCEPT_HDR;
  358. typedef struct except_node_s
  359. {
  360. WORD UCP; // unicode code point
  361. BYTE Alpha; // alphanumeric weight
  362. BYTE Script; // script member
  363. BYTE Diacritic; // diacritic weight
  364. BYTE Case; // case weight
  365. } EXCEPT_NODE, *PEXCEPT_NODE;
  366. typedef PEXCEPT_NODE *PEXCEPT_TBL; // ptr to array of exception nodes
  367. #define NUM_EXCEPT_WORDS (sizeof(EXCEPT_NODE) / sizeof(WORD))
  368. typedef struct multi_wt_s
  369. {
  370. BYTE FirstSM; // value of first script member
  371. BYTE NumSM; // number of script members in range
  372. } MULTI_WT, *PMULTI_WT;
  373. // Jamo Sequence Sorting Info:
  374. typedef struct {
  375. BYTE IsOldHangul; // Sequence occurs only in old Hangul flag
  376. BYTE LeadingIndex; // Indices used to locate the prior modern Hangul syllable
  377. BYTE VowelIndex;
  378. BYTE TrailingIndex;
  379. BYTE ExtraWeight; // Extra weights that distinguish this from other old Hangul syllables,
  380. // depending on the jamo, this can be a weight for leading jamo,
  381. // vowel jamo, or trailing jamo.
  382. } JAMO_SORT_INFO, *PJAMO_SORT_INFO;
  383. // Jamo Index Table Entry:
  384. typedef struct {
  385. JAMO_SORT_INFO SortInfo; // Sequence sorting info
  386. BYTE Index; // Index into the composition array.
  387. BYTE TransitionCount; // Number of possible transitions from this state
  388. BYTE Reserved; // Reserved byte. To make this structure aligned with WORD.
  389. } JAMO_TABLE, *PJAMO_TABLE;
  390. // Jamo Composition Table Entry:
  391. typedef struct {
  392. WCHAR CodePoint; // Code point value that enters this state
  393. JAMO_SORT_INFO SortInfo; // Sequence sorting info
  394. BYTE TransitionCount; // Number of possible transitions from this state
  395. } JAMO_COMPOSE_STATE, *PJAMO_COMPOSE_STATE;
  396. typedef struct sort_tables_s
  397. {
  398. int NumReverseDW; // number of REVERSE DIACRITICS
  399. int NumDblCompression; // number of DOUBLE COMPRESSION locales
  400. int NumIdeographLcid; // number of IDEOGRAPH LCIDs
  401. int NumExpansion; // number of EXPANSIONS
  402. int NumException; // number of EXCEPTION locales
  403. int NumCompression; // number of COMPRESSION locales
  404. int NumMultiWeight; // number of MULTIPLE WEIGHTS
  405. int NumJamoIndex; // number of Jamo Index table
  406. int NumJamoComposition; // number of Jamo Composition table
  407. PREV_DW pReverseDW; // ptr to REVERSE DIACRITICS info
  408. PDBL_COMPRESS pDblCompression; // ptr to DOUBLE COMPRESSION info
  409. PIDEOGRAPH_LCID pIdeographLcid; // ptr to ideograph lcid table
  410. PEXPAND pExpansion; // ptr to EXPANSION info
  411. PEXCEPT_HDR pExceptHdr; // ptr to exception header
  412. PEXCEPT_TBL pExceptTbl; // ptr to exception table
  413. PCOMPRESS_HDR pCompressHdr; // ptr to compression header
  414. PCOMPRESS_2_TBL pCompress2Tbl; // ptr to compression 2 table
  415. PCOMPRESS_3_TBL pCompress3Tbl; // ptr to compression 3 table
  416. PMULTI_WT pMultiWeight; // ptr to MULTIPLE WEIGHTS info
  417. PJAMO_TABLE pJamoIndexTbl; // ptr to Jamo Index table
  418. PJAMO_COMPOSE_STATE pJamoComposeTbl; // ptr to Jamo Composition table
  419. DWORD WriteFlags; // tables to write
  420. } SORT_TABLES, *PSORT_TABLES;
  421. typedef struct ideograph_node_s
  422. {
  423. WORD UCP; // unicode code point
  424. BYTE Alpha; // alphanumeric weight
  425. BYTE Script; // script member
  426. } IDEOGRAPH_NODE, *PIDEOGRAPH_NODE;
  427. typedef struct ideograph_node_ex_s
  428. {
  429. WORD UCP; // unicode code point
  430. BYTE Alpha; // alphanumeric weight
  431. BYTE Script; // script member
  432. BYTE Diacritic; // diacritic weight
  433. BYTE Case; // case weight
  434. } IDEOGRAPH_NODE_EX, *PIDEOGRAPH_NODE_EX;
  435. typedef struct ideograph_except_s
  436. {
  437. DWORD NumEntries; // number of entries
  438. DWORD NumColumns; // number of columns in table
  439. BYTE pFileName[14]; // ptr to file name - ANSI
  440. PIDEOGRAPH_NODE pExcept; // ptr to except nodes
  441. PIDEOGRAPH_NODE_EX pExceptEx; // ptr to except nodes ex
  442. } IDEOGRAPH_EXCEPT, *PIDEOGRAPH_EXCEPT;
  443. typedef struct loc_cal_hdr_s
  444. {
  445. DWORD NumLocales; // number of locales
  446. DWORD NumCalendars; // number of calendars
  447. DWORD CalOffset; // offset to calendar info (words)
  448. } LOC_CAL_HDR, *PLOC_CAL_HDR;
  449. #define LOC_NUM_CAL_WORDS 2 // number of words to NumCalendars
  450. #define LOC_CAL_HDR_WORDS (sizeof(LOC_CAL_HDR) / sizeof(WORD))
  451. ////////////////////////////////////////
  452. //
  453. // LOCALE File Structures.
  454. //
  455. ////////////////////////////////////////
  456. typedef struct locale_hdr_s
  457. {
  458. DWORD Locale; // locale id
  459. DWORD Offset; // offset to locale info (words)
  460. } LOCALE_HDR, *PLOCALE_HDR;
  461. #define LOCALE_HDR_WORDS (sizeof(LOCALE_HDR) / sizeof(WORD))
  462. typedef struct locale_header_s
  463. {
  464. WORD SLanguage; // language name in English
  465. WORD SAbbrevLang; // abbreviated language name
  466. WORD SAbbrevLangISO; // ISO abbreviated language name
  467. WORD SNativeLang; // native language name
  468. WORD SCountry; // country name in English
  469. WORD SAbbrevCtry; // abbreviated country name
  470. WORD SAbbrevCtryISO; // ISO abbreviated country name
  471. WORD SNativeCtry; // native country name
  472. WORD SList; // list separator
  473. WORD SDecimal; // decimal separator
  474. WORD SThousand; // thousands separator
  475. WORD SGrouping; // grouping of digits
  476. WORD SNativeDigits; // native digits 0-9
  477. WORD SCurrency; // local monetary symbol
  478. WORD SIntlSymbol; // international monetary symbol
  479. WORD SEngCurrName; // currency name in English
  480. WORD SNativeCurrName; // native currency name
  481. WORD SMonDecSep; // monetary decimal separator
  482. WORD SMonThousSep; // monetary thousands separator
  483. WORD SMonGrouping; // monetary grouping of digits
  484. WORD SPositiveSign; // positive sign
  485. WORD SNegativeSign; // negative sign
  486. WORD STimeFormat; // time format
  487. WORD STime; // time separator
  488. WORD S1159; // AM designator
  489. WORD S2359; // PM designator
  490. WORD SShortDate; // short date format
  491. WORD SDate; // date separator
  492. WORD SYearMonth; // year month format
  493. WORD SLongDate; // long date format
  494. WORD IOptionalCalendar; // additional calendar type(s)
  495. WORD SDayName1; // day name 1
  496. WORD SDayName2; // day name 2
  497. WORD SDayName3; // day name 3
  498. WORD SDayName4; // day name 4
  499. WORD SDayName5; // day name 5
  500. WORD SDayName6; // day name 6
  501. WORD SDayName7; // day name 7
  502. WORD SAbbrevDayName1; // abbreviated day name 1
  503. WORD SAbbrevDayName2; // abbreviated day name 2
  504. WORD SAbbrevDayName3; // abbreviated day name 3
  505. WORD SAbbrevDayName4; // abbreviated day name 4
  506. WORD SAbbrevDayName5; // abbreviated day name 5
  507. WORD SAbbrevDayName6; // abbreviated day name 6
  508. WORD SAbbrevDayName7; // abbreviated day name 7
  509. WORD SMonthName1; // month name 1
  510. WORD SMonthName2; // month name 2
  511. WORD SMonthName3; // month name 3
  512. WORD SMonthName4; // month name 4
  513. WORD SMonthName5; // month name 5
  514. WORD SMonthName6; // month name 6
  515. WORD SMonthName7; // month name 7
  516. WORD SMonthName8; // month name 8
  517. WORD SMonthName9; // month name 9
  518. WORD SMonthName10; // month name 10
  519. WORD SMonthName11; // month name 11
  520. WORD SMonthName12; // month name 12
  521. WORD SMonthName13; // month name 13
  522. WORD SAbbrevMonthName1; // abbreviated month name 1
  523. WORD SAbbrevMonthName2; // abbreviated month name 2
  524. WORD SAbbrevMonthName3; // abbreviated month name 3
  525. WORD SAbbrevMonthName4; // abbreviated month name 4
  526. WORD SAbbrevMonthName5; // abbreviated month name 5
  527. WORD SAbbrevMonthName6; // abbreviated month name 6
  528. WORD SAbbrevMonthName7; // abbreviated month name 7
  529. WORD SAbbrevMonthName8; // abbreviated month name 8
  530. WORD SAbbrevMonthName9; // abbreviated month name 9
  531. WORD SAbbrevMonthName10; // abbreviated month name 10
  532. WORD SAbbrevMonthName11; // abbreviated month name 11
  533. WORD SAbbrevMonthName12; // abbreviated month name 12
  534. WORD SAbbrevMonthName13; // abbreviated month name 13
  535. WORD SEndOfLocale; // end of the locale info
  536. } LOCALE_HEADER, *PLOCALE_HEADER;
  537. typedef struct locale_static_s
  538. {
  539. WORD DefaultACP; // default ACP - integer format
  540. WORD szILanguage[5]; // language id
  541. WORD szICountry[6]; // country id
  542. WORD szIGeoId[8]; // Geographical Location Identifier
  543. WORD szIDefaultLang[5]; // default language ID
  544. WORD szIDefaultCtry[6]; // default country ID
  545. WORD szIDefaultACP[6]; // default ansi code page ID
  546. WORD szIDefaultOCP[6]; // default oem code page ID
  547. WORD szIDefaultMACCP[6]; // default mac code page ID
  548. WORD szIDefaultEBCDICCP[6]; // default ebcdic code page ID
  549. WORD szIMeasure[2]; // system of measurement
  550. WORD szIPaperSize[2]; // default paper size
  551. WORD szIDigits[3]; // number of fractional digits
  552. WORD szILZero[2]; // leading zeros for decimal
  553. WORD szINegNumber[2]; // negative number format
  554. WORD szIDigitSubstitution[2]; // digit substitution
  555. WORD szICurrDigits[3]; // # local monetary fractional digits
  556. WORD szIIntlCurrDigits[3]; // # intl monetary fractional digits
  557. WORD szICurrency[2]; // positive currency format
  558. WORD szINegCurr[3]; // negative currency format
  559. WORD szIPosSignPosn[2]; // format of positive sign
  560. WORD szIPosSymPrecedes[2]; // if mon symbol precedes positive
  561. WORD szIPosSepBySpace[2]; // if mon symbol separated by space
  562. WORD szINegSignPosn[2]; // format of negative sign
  563. WORD szINegSymPrecedes[2]; // if mon symbol precedes negative
  564. WORD szINegSepBySpace[2]; // if mon symbol separated by space
  565. WORD szITime[2]; // time format
  566. WORD szITLZero[2]; // leading zeros for time field
  567. WORD szITimeMarkPosn[2]; // time marker position
  568. WORD szIDate[2]; // short date order
  569. WORD szICentury[2]; // century format (short date)
  570. WORD szIDayLZero[2]; // leading zeros for day field (short date)
  571. WORD szIMonLZero[2]; // leading zeros for month field (short date)
  572. WORD szILDate[2]; // long date order
  573. WORD szICalendarType[3]; // type of calendar to use
  574. WORD szIFirstDayOfWeek[2]; // which day is first in week
  575. WORD szIFirstWeekOfYear[2]; // which week is first in year
  576. WORD szFontSignature[MAX_FONTSIGNATURE]; // font signature
  577. } LOCALE_STATIC, *PLOCALE_STATIC;
  578. typedef struct locale_variable_s
  579. {
  580. WORD szSLanguage[MAX]; // language name in English
  581. WORD szSAbbrevLang[MAX]; // abbreviated language name
  582. WORD szSAbbrevLangISO[MAX]; // ISO abbreviated language name
  583. WORD szSNativeLang[MAX]; // native language name
  584. WORD szSCountry[MAX]; // country name in English
  585. WORD szSAbbrevCtry[MAX]; // abbreviated country name
  586. WORD szSAbbrevCtryISO[MAX]; // ISO abbreviated country name
  587. WORD szSNativeCtry[MAX]; // native country name
  588. WORD szSList[MAX]; // list separator
  589. WORD szSDecimal[MAX]; // decimal separator
  590. WORD szSThousand[MAX]; // thousands separator
  591. WORD szSGrouping[MAX]; // grouping of digits
  592. WORD szSNativeDigits[MAX]; // native digits 0-9
  593. WORD szSCurrency[MAX]; // local monetary symbol
  594. WORD szSIntlSymbol[MAX]; // international monetary symbol
  595. WORD szSEngCurrName[MAX]; // currency name in English
  596. WORD szSNativeCurrName[MAX]; // native currency name
  597. WORD szSMonDecSep[MAX]; // monetary decimal separator
  598. WORD szSMonThousSep[MAX]; // monetary thousands separator
  599. WORD szSMonGrouping[MAX]; // monetary grouping of digits
  600. WORD szSPositiveSign[MAX]; // positive sign
  601. WORD szSNegativeSign[MAX]; // negative sign
  602. WORD szSTimeFormat[MAX]; // time format
  603. WORD szSTime[MAX]; // time separator
  604. WORD szS1159[MAX]; // AM designator
  605. WORD szS2359[MAX]; // PM designator
  606. WORD szSShortDate[MAX]; // short date format
  607. WORD szSDate[MAX]; // short date separator
  608. WORD szSYearMonth[MAX]; // year month format
  609. WORD szSLongDate[MAX]; // long date format
  610. WORD szIOptionalCalendar[MAX]; // additional calendar type(s)
  611. WORD szSDayName1[MAX]; // day name 1
  612. WORD szSDayName2[MAX]; // day name 2
  613. WORD szSDayName3[MAX]; // day name 3
  614. WORD szSDayName4[MAX]; // day name 4
  615. WORD szSDayName5[MAX]; // day name 5
  616. WORD szSDayName6[MAX]; // day name 6
  617. WORD szSDayName7[MAX]; // day name 7
  618. WORD szSAbbrevDayName1[MAX]; // abbreviated day name 1
  619. WORD szSAbbrevDayName2[MAX]; // abbreviated day name 2
  620. WORD szSAbbrevDayName3[MAX]; // abbreviated day name 3
  621. WORD szSAbbrevDayName4[MAX]; // abbreviated day name 4
  622. WORD szSAbbrevDayName5[MAX]; // abbreviated day name 5
  623. WORD szSAbbrevDayName6[MAX]; // abbreviated day name 6
  624. WORD szSAbbrevDayName7[MAX]; // abbreviated day name 7
  625. WORD szSMonthName1[MAX]; // month name 1
  626. WORD szSMonthName2[MAX]; // month name 2
  627. WORD szSMonthName3[MAX]; // month name 3
  628. WORD szSMonthName4[MAX]; // month name 4
  629. WORD szSMonthName5[MAX]; // month name 5
  630. WORD szSMonthName6[MAX]; // month name 6
  631. WORD szSMonthName7[MAX]; // month name 7
  632. WORD szSMonthName8[MAX]; // month name 8
  633. WORD szSMonthName9[MAX]; // month name 9
  634. WORD szSMonthName10[MAX]; // month name 10
  635. WORD szSMonthName11[MAX]; // month name 11
  636. WORD szSMonthName12[MAX]; // month name 12
  637. WORD szSMonthName13[MAX]; // month name 13
  638. WORD szSAbbrevMonthName1[MAX]; // abbreviated month name 1
  639. WORD szSAbbrevMonthName2[MAX]; // abbreviated month name 2
  640. WORD szSAbbrevMonthName3[MAX]; // abbreviated month name 3
  641. WORD szSAbbrevMonthName4[MAX]; // abbreviated month name 4
  642. WORD szSAbbrevMonthName5[MAX]; // abbreviated month name 5
  643. WORD szSAbbrevMonthName6[MAX]; // abbreviated month name 6
  644. WORD szSAbbrevMonthName7[MAX]; // abbreviated month name 7
  645. WORD szSAbbrevMonthName8[MAX]; // abbreviated month name 8
  646. WORD szSAbbrevMonthName9[MAX]; // abbreviated month name 9
  647. WORD szSAbbrevMonthName10[MAX]; // abbreviated month name 10
  648. WORD szSAbbrevMonthName11[MAX]; // abbreviated month name 11
  649. WORD szSAbbrevMonthName12[MAX]; // abbreviated month name 12
  650. WORD szSAbbrevMonthName13[MAX]; // abbreviated month name 13
  651. } LOCALE_VARIABLE, *PLOCALE_VARIABLE;
  652. typedef struct calendar_hdr_s
  653. {
  654. WORD Calendar; // calendar id
  655. WORD Offset; // offset to calendar info (words)
  656. } CALENDAR_HDR, *PCALENDAR_HDR;
  657. #define CALENDAR_HDR_WORDS (sizeof(CALENDAR_HDR) / sizeof(WORD))
  658. typedef struct calendar_header_s
  659. {
  660. WORD NumRanges; // number of era ranges
  661. WORD IfNames; // if any day or month names exist
  662. WORD SCalendar; // calendar id
  663. WORD STwoDigitYearMax; // two digit year max
  664. WORD SEraRanges; // era ranges
  665. WORD SShortDate; // short date format
  666. WORD SYearMonth; // year month format
  667. WORD SLongDate; // long date format
  668. WORD SDayName1; // day name 1
  669. WORD SDayName2; // day name 2
  670. WORD SDayName3; // day name 3
  671. WORD SDayName4; // day name 4
  672. WORD SDayName5; // day name 5
  673. WORD SDayName6; // day name 6
  674. WORD SDayName7; // day name 7
  675. WORD SAbbrevDayName1; // abbreviated day name 1
  676. WORD SAbbrevDayName2; // abbreviated day name 2
  677. WORD SAbbrevDayName3; // abbreviated day name 3
  678. WORD SAbbrevDayName4; // abbreviated day name 4
  679. WORD SAbbrevDayName5; // abbreviated day name 5
  680. WORD SAbbrevDayName6; // abbreviated day name 6
  681. WORD SAbbrevDayName7; // abbreviated day name 7
  682. WORD SMonthName1; // month name 1
  683. WORD SMonthName2; // month name 2
  684. WORD SMonthName3; // month name 3
  685. WORD SMonthName4; // month name 4
  686. WORD SMonthName5; // month name 5
  687. WORD SMonthName6; // month name 6
  688. WORD SMonthName7; // month name 7
  689. WORD SMonthName8; // month name 8
  690. WORD SMonthName9; // month name 9
  691. WORD SMonthName10; // month name 10
  692. WORD SMonthName11; // month name 11
  693. WORD SMonthName12; // month name 12
  694. WORD SMonthName13; // month name 13
  695. WORD SAbbrevMonthName1; // abbreviated month name 1
  696. WORD SAbbrevMonthName2; // abbreviated month name 2
  697. WORD SAbbrevMonthName3; // abbreviated month name 3
  698. WORD SAbbrevMonthName4; // abbreviated month name 4
  699. WORD SAbbrevMonthName5; // abbreviated month name 5
  700. WORD SAbbrevMonthName6; // abbreviated month name 6
  701. WORD SAbbrevMonthName7; // abbreviated month name 7
  702. WORD SAbbrevMonthName8; // abbreviated month name 8
  703. WORD SAbbrevMonthName9; // abbreviated month name 9
  704. WORD SAbbrevMonthName10; // abbreviated month name 10
  705. WORD SAbbrevMonthName11; // abbreviated month name 11
  706. WORD SAbbrevMonthName12; // abbreviated month name 12
  707. WORD SAbbrevMonthName13; // abbreviated month name 13
  708. WORD SEndOfCalendar; // end of the calendar info
  709. } CALENDAR_HEADER, *PCALENDAR_HEADER;
  710. // size of the name header portion
  711. #define CAL_NAME_HDR_SIZE ((sizeof(CALENDAR_HEADER) - \
  712. FIELD_OFFSET(CALENDAR_HEADER, SDayName2)) / \
  713. sizeof(WORD))
  714. typedef struct calendar_variable_s
  715. {
  716. WORD szSCalendar[MAX]; // calendar id
  717. WORD szSTwoDigitYearMax[MAX]; // two digit year max
  718. WORD szSEraRanges[MAX]; // era ranges
  719. WORD szSShortDate[MAX]; // short date format
  720. WORD szSYearMonth[MAX]; // year month format
  721. WORD szSLongDate[MAX]; // long date format
  722. WORD szSDayName1[MAX]; // day name 1
  723. WORD szSDayName2[MAX]; // day name 2
  724. WORD szSDayName3[MAX]; // day name 3
  725. WORD szSDayName4[MAX]; // day name 4
  726. WORD szSDayName5[MAX]; // day name 5
  727. WORD szSDayName6[MAX]; // day name 6
  728. WORD szSDayName7[MAX]; // day name 7
  729. WORD szSAbbrevDayName1[MAX]; // abbreviated day name 1
  730. WORD szSAbbrevDayName2[MAX]; // abbreviated day name 2
  731. WORD szSAbbrevDayName3[MAX]; // abbreviated day name 3
  732. WORD szSAbbrevDayName4[MAX]; // abbreviated day name 4
  733. WORD szSAbbrevDayName5[MAX]; // abbreviated day name 5
  734. WORD szSAbbrevDayName6[MAX]; // abbreviated day name 6
  735. WORD szSAbbrevDayName7[MAX]; // abbreviated day name 7
  736. WORD szSMonthName1[MAX]; // month name 1
  737. WORD szSMonthName2[MAX]; // month name 2
  738. WORD szSMonthName3[MAX]; // month name 3
  739. WORD szSMonthName4[MAX]; // month name 4
  740. WORD szSMonthName5[MAX]; // month name 5
  741. WORD szSMonthName6[MAX]; // month name 6
  742. WORD szSMonthName7[MAX]; // month name 7
  743. WORD szSMonthName8[MAX]; // month name 8
  744. WORD szSMonthName9[MAX]; // month name 9
  745. WORD szSMonthName10[MAX]; // month name 10
  746. WORD szSMonthName11[MAX]; // month name 11
  747. WORD szSMonthName12[MAX]; // month name 12
  748. WORD szSMonthName13[MAX]; // month name 13
  749. WORD szSAbbrevMonthName1[MAX]; // abbreviated month name 1
  750. WORD szSAbbrevMonthName2[MAX]; // abbreviated month name 2
  751. WORD szSAbbrevMonthName3[MAX]; // abbreviated month name 3
  752. WORD szSAbbrevMonthName4[MAX]; // abbreviated month name 4
  753. WORD szSAbbrevMonthName5[MAX]; // abbreviated month name 5
  754. WORD szSAbbrevMonthName6[MAX]; // abbreviated month name 6
  755. WORD szSAbbrevMonthName7[MAX]; // abbreviated month name 7
  756. WORD szSAbbrevMonthName8[MAX]; // abbreviated month name 8
  757. WORD szSAbbrevMonthName9[MAX]; // abbreviated month name 9
  758. WORD szSAbbrevMonthName10[MAX]; // abbreviated month name 10
  759. WORD szSAbbrevMonthName11[MAX]; // abbreviated month name 11
  760. WORD szSAbbrevMonthName12[MAX]; // abbreviated month name 12
  761. WORD szSAbbrevMonthName13[MAX]; // abbreviated month name 13
  762. } CALENDAR_VARIABLE, *PCALENDAR_VARIABLE;
  763. ////////////////////////////////////////
  764. //
  765. // GEO File Structures.
  766. //
  767. ////////////////////////////////////////
  768. typedef struct tagGeoData{
  769. long GeoId;
  770. WCHAR szLatitude[MAX_LATITUDE];
  771. WCHAR szLongitude[MAX_LONGITUDE];
  772. DWORD GeoClass;
  773. long ParentGeoId;
  774. WCHAR szISO3166Abbrev2[MAX_ISO_ABBREV];
  775. WCHAR szISO3166Abbrev3[MAX_ISO_ABBREV];
  776. WORD wISO3166;
  777. WORD Reserved; // dword alignment
  778. } GEODATA, *PGEODATA;
  779. typedef struct tagGEOIDLCID{
  780. LCID lcid;
  781. long GeoId;
  782. WORD LangId;
  783. WORD Reserved; // dword alignment
  784. } GEOLCID, *PGEOLCID;
  785. typedef struct tagGeoTableHdr{
  786. WCHAR szSig[MAX_SIGNATURE];
  787. unsigned long nFileSize;
  788. DWORD dwOffsetGeoInfo;
  789. unsigned long nGeoInfo;
  790. DWORD dwOffsetGeoLCID;
  791. unsigned long nGeoLCID;
  792. } GEOTABLEHDR;
  793. ////////////////////////////////////////////////////////////////////////////
  794. //
  795. // Macro Definitions.
  796. //
  797. ////////////////////////////////////////////////////////////////////////////
  798. //
  799. // Macro to make a DWORD from two WORDS.
  800. //
  801. #define MAKE_DWORD(a, b) ((long)(((WORD)(a)) | ((DWORD)((WORD)(b))) << 16))
  802. //
  803. // Macros For High and Low Nibbles of a BYTE.
  804. //
  805. #define LONIBBLE(b) ((BYTE)((BYTE)(b) & 0xF))
  806. #define HINIBBLE(b) ((BYTE)(((BYTE)(b) >> 4) & 0xF))
  807. //
  808. // Macros for Extracting the 8:4:4 Index Values.
  809. //
  810. #define GET8(w) (HIBYTE(w))
  811. #define GETHI4(w) (HINIBBLE(LOBYTE(w)))
  812. #define GETLO4(w) (LONIBBLE(LOBYTE(w)))
  813. //
  814. // Macro for getting the case weight and compression value byte.
  815. //
  816. #define MAKE_CASE_WT(cw, comp) ((BYTE)(((BYTE)(comp) << 6) | ((BYTE)(cw))))
  817. ////////////////////////////////////////////////////////////////////////////
  818. //
  819. // Function Prototypes.
  820. //
  821. ////////////////////////////////////////////////////////////////////////////
  822. //
  823. // CodePage Routines.
  824. //
  825. int
  826. ParseCodePage(
  827. PCODEPAGE pCP,
  828. PSZ pszKeyWord);
  829. int
  830. WriteCodePage(
  831. PCODEPAGE pCP);
  832. //
  833. // Language Routines.
  834. //
  835. int
  836. ParseLanguage(
  837. PLANGUAGE pLang,
  838. PSZ pszKeyWord);
  839. int
  840. WriteLanguage(
  841. PLANGUAGE pLang);
  842. int
  843. ParseLangException(
  844. PLANG_EXCEPT pLangExcept,
  845. PSZ pszKeyWord);
  846. int
  847. WriteLangException(
  848. PLANG_EXCEPT pLangExcept);
  849. //
  850. // Locale Routines.
  851. //
  852. int
  853. ParseWriteLocale(
  854. PLOCALE_HEADER pLocHdr,
  855. PLOCALE_STATIC pLocStat,
  856. PLOCALE_VARIABLE pLocVar,
  857. PSZ pszKeyWord);
  858. //
  859. // Locale Independent (Unicode) Routines.
  860. //
  861. int
  862. ParseUnicode(
  863. PUNICODE pUnic,
  864. PSZ pszKeyWord);
  865. int
  866. WriteUnicode(
  867. PUNICODE pUnic);
  868. //
  869. // GEO Routines.
  870. //
  871. int
  872. ParseWriteGEO(
  873. PSZ pszKeyWord);
  874. //
  875. // Character Type Routines.
  876. //
  877. int
  878. ParseCTypes(
  879. PCTYPES pCType);
  880. int
  881. WriteCTypes(
  882. PCTYPES pCType);
  883. //
  884. // Sorting Routines.
  885. //
  886. int
  887. ParseSortkey(
  888. PSORTKEY pSortkey,
  889. PSZ pszKeyWord);
  890. int
  891. ParseSortTables(
  892. PSORT_TABLES pSortTbls,
  893. PSZ pszKeyWord);
  894. int
  895. ParseIdeographExceptions(
  896. PIDEOGRAPH_EXCEPT pIdeographExcept);
  897. int
  898. WriteSortkey(
  899. PSORTKEY pSortkey, char* SortKeyFileName);
  900. int
  901. WriteSortTables(
  902. PSORT_TABLES pSortTbls, char* SortTblsFileName);
  903. int
  904. WriteIdeographExceptions(
  905. PIDEOGRAPH_EXCEPT pIdeographExcept);
  906. //
  907. // Allocation and Free Routines.
  908. //
  909. int
  910. AllocateMB(
  911. PCODEPAGE pCP);
  912. int
  913. AllocateGlyph(
  914. PCODEPAGE pCP);
  915. int
  916. AllocateTopDBCS(
  917. PCODEPAGE pCP,
  918. int Size);
  919. int
  920. AllocateDBCS(
  921. PCODEPAGE pCP,
  922. int Low,
  923. int High,
  924. int Index);
  925. int
  926. AllocateWCTable(
  927. PCODEPAGE pCP,
  928. int Size);
  929. int
  930. Allocate8(
  931. P844_ARRAY *pArr);
  932. int
  933. Insert844(
  934. P844_ARRAY pArr,
  935. WORD WChar,
  936. DWORD Value,
  937. int *cbBuf2,
  938. int *cbBuf3,
  939. int Size);
  940. int
  941. Insert844Map(
  942. P844_ARRAY pArr,
  943. PCT_MAP pMap,
  944. WORD WChar,
  945. WORD Value1,
  946. WORD Value2,
  947. WORD Value3,
  948. int *cbBuf2,
  949. int *cbBuf3);
  950. int
  951. AllocateTemp844(
  952. PVOID *ppArr,
  953. int TblSize,
  954. int Size);
  955. int
  956. AllocateCTMap(
  957. PCT_MAP *pMap);
  958. int
  959. AllocateGrid(
  960. PCOMP_GRID *pCompGrid,
  961. int TblSize);
  962. int
  963. AllocateLangException(
  964. PLANG_EXCEPT pLangExcept,
  965. int TblSize);
  966. int
  967. AllocateLangExceptionNodes(
  968. PLANG_EXCEPT pLangExcept,
  969. int TblSize,
  970. int Index);
  971. int
  972. AllocateSortDefault(
  973. PSORTKEY pSKey);
  974. int
  975. AllocateReverseDW(
  976. PSORT_TABLES pSTbl,
  977. int TblSize);
  978. int
  979. AllocateDoubleCompression(
  980. PSORT_TABLES pSTbl,
  981. int TblSize);
  982. int
  983. AllocateIdeographLcid(
  984. PSORT_TABLES pSTbl,
  985. int TblSize);
  986. int
  987. AllocateExpansion(
  988. PSORT_TABLES pSTbl,
  989. int TblSize);
  990. int
  991. AllocateCompression(
  992. PSORT_TABLES pSTbl,
  993. int TblSize);
  994. int
  995. AllocateCompression2Nodes(
  996. PSORT_TABLES pSTbl,
  997. int TblSize,
  998. int Index);
  999. int
  1000. AllocateCompression3Nodes(
  1001. PSORT_TABLES pSTbl,
  1002. int TblSize,
  1003. int Index);
  1004. int
  1005. AllocateException(
  1006. PSORT_TABLES pSTbl,
  1007. int TblSize);
  1008. int
  1009. AllocateExceptionNodes(
  1010. PSORT_TABLES pSTbl,
  1011. int TblSize,
  1012. int Index);
  1013. int
  1014. AllocateMultipleWeights(
  1015. PSORT_TABLES pSTbl,
  1016. int TblSize);
  1017. int
  1018. AllocateIdeographExceptions(
  1019. PIDEOGRAPH_EXCEPT pIdeographExcept,
  1020. int TblSize,
  1021. int NumColumns);
  1022. int AllocateJamoTables(
  1023. PSORT_TABLES pSTbl,
  1024. int TblSize);
  1025. void
  1026. Free844(
  1027. P844_ARRAY pArr);
  1028. void
  1029. FreeCTMap(
  1030. PCT_MAP pMap);
  1031. //
  1032. // Table Routines.
  1033. //
  1034. int
  1035. ComputeMBSize(
  1036. PCODEPAGE pCP);
  1037. int
  1038. Compute844Size(
  1039. int cbBuf2,
  1040. int cbBuf3,
  1041. int Size);
  1042. DWORD
  1043. ComputeCTMapSize(
  1044. PCT_MAP pMap);
  1045. int
  1046. Write844Table(
  1047. FILE *pOutputFile,
  1048. P844_ARRAY pArr,
  1049. int cbBuf2,
  1050. int TblSize,
  1051. int Size);
  1052. int
  1053. Write844TableMap(
  1054. FILE *pOutputFile,
  1055. P844_ARRAY pArr,
  1056. WORD TblSize);
  1057. int
  1058. WriteCTMapTable(
  1059. FILE *pOutputFile,
  1060. PCT_MAP pMap,
  1061. WORD MapSize);
  1062. int
  1063. WriteWords(
  1064. FILE *pOutputFile,
  1065. WORD Value,
  1066. int Num);
  1067. int
  1068. FileWrite(
  1069. FILE *pOutputFile,
  1070. void *Buffer,
  1071. int Size,
  1072. int Count,
  1073. char *ErrStr);
  1074. void
  1075. RemoveDuplicate844Levels(
  1076. P844_ARRAY pArr,
  1077. int *pBuf2,
  1078. int *pBuf3,
  1079. int Size);
  1080. //
  1081. // Utility Routines.
  1082. //
  1083. int
  1084. GetSize(
  1085. int *pSize);
  1086. ////////////////////////////////////////////////////////////////////////////
  1087. //
  1088. // Global Variables.
  1089. //
  1090. // Globals are included last because they may require some of the types
  1091. // being defined above.
  1092. //
  1093. ////////////////////////////////////////////////////////////////////////////
  1094. extern FILE *pInputFile; // pointer to Input File
  1095. extern BOOL Verbose; // verbose flag
  1096. extern WCHAR FileExtension[]; // The file extension for generated files. It can be ".nls" or ".nlp"