w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

gencnval.c
Go to the documentation of this file.
1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /*
4 *******************************************************************************
5 *
6 * Copyright (C) 1999-2016 International Business Machines
7 * Corporation and others. All Rights Reserved.
8 *
9 *******************************************************************************
10 * file name: gencnval.c
11 * encoding: UTF-8
12 * tab size: 8 (not used)
13 * indentation:4
14 *
15 * created on: 1999nov05
16 * created by: Markus W. Scherer
17 *
18 * This program reads convrtrs.txt and writes a memory-mappable
19 * converter name alias table to cnvalias.dat .
20 *
21 * This program currently writes version 2.1 of the data format. See
22 * ucnv_io.c for more details on the format. Note that version 2.1
23 * is written in such a way that a 2.0 reader will be able to use it,
24 * and a 2.1 reader will be able to read 2.0.
25 */
26 
27 #include "unicode/utypes.h"
28 #include "unicode/putil.h"
29 #include "unicode/ucnv.h" /* ucnv_compareNames() */
30 #include "ucnv_io.h"
31 #include "cmemory.h"
32 #include "cstring.h"
33 #include "uinvchar.h"
34 #include "filestrm.h"
35 #include "toolutil.h"
36 #include "unicode/uclean.h"
37 #include "unewdata.h"
38 #include "uoptions.h"
39 
40 #include <stdio.h>
41 #include <stdlib.h>
42 #include <ctype.h>
43 
44 /* TODO: Need to check alias name length is less than UCNV_MAX_CONVERTER_NAME_LENGTH */
45 
46 /* STRING_STORE_SIZE + TAG_STORE_SIZE <= ((2^16 - 1) * 2)
47  That is the maximum size for the string stores combined
48  because the strings are index at 16-bit boundries by a
49  16-bit index, and there is only one section for the
50  strings.
51  */
52 #define STRING_STORE_SIZE 0x1FBFE /* 130046 */
53 #define TAG_STORE_SIZE 0x400 /* 1024 */
54 
55 /* The combined tag and converter count can affect the number of lists
56  created. The size of all lists must be less than (2^17 - 1)
57  because the lists are indexed as a 16-bit array with a 16-bit index.
58  */
59 #define MAX_TAG_COUNT 0x3F /* 63 */
60 #define MAX_CONV_COUNT UCNV_CONVERTER_INDEX_MASK
61 #define MAX_ALIAS_COUNT 0xFFFF /* 65535 */
62 
63 /* The maximum number of aliases that a standard tag/converter combination can have.
64  At this moment 6/18/2002, IANA has 12 names for ASCII. Don't go below 15 for
65  this value. I don't recommend more than 31 for this value.
66  */
67 #define MAX_TC_ALIAS_COUNT 0x1F /* 31 */
68 
69 #define MAX_LINE_SIZE 0x7FFF /* 32767 */
70 #define MAX_LIST_SIZE 0xFFFF /* 65535 */
71 
72 #define DATA_NAME "cnvalias"
73 #define DATA_TYPE "icu" /* ICU alias table */
74 
75 #define ALL_TAG_STR "ALL"
76 #define ALL_TAG_NUM 1
77 #define EMPTY_TAG_NUM 0
78 
79 /* UDataInfo cf. udata.h */
80 static const UDataInfo dataInfo={
81  sizeof(UDataInfo),
82  0,
83 
86  sizeof(UChar),
87  0,
88 
89  {0x43, 0x76, 0x41, 0x6c}, /* dataFormat="CvAl" */
90  {3, 0, 1, 0}, /* formatVersion */
91  {1, 4, 2, 0} /* dataVersion */
92 };
93 
94 typedef struct {
95  char *store;
98 } StringBlock;
99 
102 
103 typedef struct {
105  uint16_t *aliases; /* Index into stringStore */
106 } AliasList;
107 
108 typedef struct {
109  uint16_t converter; /* Index into stringStore */
110  uint16_t totalAliasCount; /* Total aliases in this column */
111 } Converter;
112 
115 
118 
119 typedef struct {
120  uint16_t tag; /* Index into tagStore */
121  uint16_t totalAliasCount; /* Total aliases in this row */
123 } Tag;
124 
125 /* Think of this as a 3D array. It's tagCount by converterCount by aliasCount */
127 static uint16_t tagCount = 0;
128 
129 /* Used for storing all aliases */
132 /*static uint16_t duplicateKnownAliasesCount = 0;*/
133 
134 /* Used for storing the lists section that point to aliases */
137 
138 /* Were the standard tags declared before the aliases. */
140 static UBool verbose = FALSE;
141 static UBool quiet = FALSE;
142 static int lineNum = 1;
143 
146  1 /* containsCnvOptionInfo */
147 };
148 
149 
150 /**
151  * path to convrtrs.txt
152  */
153 const char *path;
154 
155 /* prototypes --------------------------------------------------------------- */
156 
157 static void
158 parseLine(const char *line);
159 
160 static void
162 
163 static int32_t
164 chomp(char *line);
165 
166 static void
167 addOfficialTaggedStandards(char *line, int32_t lineLen);
168 
169 static uint16_t
170 addAlias(const char *alias, uint16_t standard, uint16_t converter, UBool defaultName);
171 
172 static uint16_t
173 addConverter(const char *converter);
174 
175 static char *
176 allocString(StringBlock *block, const char *s, int32_t length);
177 
178 static uint16_t
179 addToKnownAliases(const char *alias);
180 
181 static int
182 compareAliases(const void *alias1, const void *alias2);
183 
184 static uint16_t
185 getTagNumber(const char *tag, uint16_t tagLen);
186 
187 /*static void
188 addTaggedAlias(uint16_t tag, const char *alias, uint16_t converter);*/
189 
190 static void
192 
193 /* -------------------------------------------------------------------------- */
194 
195 /* Presumes that you used allocString() */
196 #define GET_ALIAS_STR(index) (stringStore + ((size_t)(index) << 1))
197 #define GET_TAG_STR(index) (tagStore + ((size_t)(index) << 1))
198 
199 /* Presumes that you used allocString() */
200 #define GET_ALIAS_NUM(str) ((uint16_t)((str - stringStore) >> 1))
201 #define GET_TAG_NUM(str) ((uint16_t)((str - tagStore) >> 1))
202 
203 enum
204 {
211  QUIET
212 };
213 
214 static UOption options[]={
222 };
223 
224 extern int
225 main(int argc, char* argv[]) {
226  int i, n;
227  char pathBuf[512];
228  FileStream *in;
231 
233 
234  /* preset then read command line options */
237 
238  /* error handling, printing usage message */
239  if(argc<0) {
240  fprintf(stderr,
241  "error in command line argument \"%s\"\n",
242  argv[-argc]);
243  }
244  if(argc<0 || options[HELP1].doesOccur || options[HELP2].doesOccur) {
245  fprintf(stderr,
246  "usage: %s [-options] [convrtrs.txt]\n"
247  "\tread convrtrs.txt and create " U_ICUDATA_NAME "_" DATA_NAME "." DATA_TYPE "\n"
248  "options:\n"
249  "\t-h or -? or --help this usage text\n"
250  "\t-v or --verbose prints out extra information about the alias table\n"
251  "\t-q or --quiet do not display warnings and progress\n"
252  "\t-c or --copyright include a copyright notice\n"
253  "\t-d or --destdir destination directory, followed by the path\n"
254  "\t-s or --sourcedir source directory, followed by the path\n",
255  argv[0]);
257  }
258 
259  if(options[VERBOSE].doesOccur) {
260  verbose = TRUE;
261  }
262 
263  if(options[QUIET].doesOccur) {
264  quiet = TRUE;
265  }
266 
267  if (argc >= 2) {
268  path = argv[1];
269  } else {
270  path = "convrtrs.txt";
271  }
272 
273  const char* sourcedir = options[SOURCEDIR].value;
274  if (sourcedir != NULL && *sourcedir != 0) {
275  char *end;
276  uprv_strcpy(pathBuf, sourcedir);
277  end = uprv_strchr(pathBuf, 0);
278  if(*(end-1)!=U_FILE_SEP_CHAR) {
279  *(end++)=U_FILE_SEP_CHAR;
280  }
281  uprv_strcpy(end, path);
282  path = pathBuf;
283  }
284 
285  uprv_memset(stringStore, 0, sizeof(stringStore));
286  uprv_memset(tagStore, 0, sizeof(tagStore));
287  uprv_memset(converters, 0, sizeof(converters));
288  uprv_memset(tags, 0, sizeof(tags));
289  uprv_memset(aliasLists, 0, sizeof(aliasLists));
290  uprv_memset(knownAliases, 0, sizeof(aliasLists));
291 
292 
293  in=T_FileStream_open(path, "r");
294  if(in==NULL) {
295  fprintf(stderr, "gencnval: unable to open input file %s\n", path);
297  }
298  parseFile(in);
300 
301  /* create the output file */
304  if(U_FAILURE(errorCode)) {
305  fprintf(stderr, "gencnval: unable to open output file - error %s\n", u_errorName(errorCode));
306  exit(errorCode);
307  }
308 
309  /* write the table of aliases based on a tag/converter name combination */
311 
312  /* finish */
314  if(U_FAILURE(errorCode)) {
315  fprintf(stderr, "gencnval: error finishing output file - %s\n", u_errorName(errorCode));
316  exit(errorCode);
317  }
318 
319  /* clean up tags */
320  for (i = 0; i < MAX_TAG_COUNT; i++) {
321  for (n = 0; n < MAX_CONV_COUNT; n++) {
322  if (tags[i].aliasList[n].aliases!=NULL) {
323  uprv_free(tags[i].aliasList[n].aliases);
324  }
325  }
326  }
327 
328  return 0;
329 }
330 
331 static void
333  char line[MAX_LINE_SIZE];
334  char lastLine[MAX_LINE_SIZE];
335  int32_t lineSize = 0;
336  int32_t lastLineSize = 0;
337  UBool validParse = TRUE;
338 
339  lineNum = 0;
340 
341  /* Add the empty tag, which is for untagged aliases */
342  getTagNumber("", 0);
344  allocString(&stringBlock, "", 0);
345 
346  /* read the list of aliases */
347  while (validParse) {
348  validParse = FALSE;
349 
350  /* Read non-empty lines that don't start with a space character. */
351  while (T_FileStream_readLine(in, lastLine, MAX_LINE_SIZE) != NULL) {
352  lastLineSize = chomp(lastLine);
353  if (lineSize == 0 || (lastLineSize > 0 && isspace((int)*lastLine))) {
354  uprv_strcpy(line + lineSize, lastLine);
355  lineSize += lastLineSize;
356  } else if (lineSize > 0) {
357  validParse = TRUE;
358  break;
359  }
360  lineNum++;
361  }
362 
363  if (validParse || lineSize > 0) {
364  if (isspace((int)*line)) {
365  fprintf(stderr, "%s:%d: error: cannot start an alias with a space\n", path, lineNum-1);
367  } else if (line[0] == '{') {
368  if (!standardTagsUsed && line[lineSize - 1] != '}') {
369  fprintf(stderr, "%s:%d: error: alias needs to start with a converter name\n", path, lineNum);
371  }
372  addOfficialTaggedStandards(line, lineSize);
374  } else {
375  if (standardTagsUsed) {
376  parseLine(line);
377  }
378  else {
379  fprintf(stderr, "%s:%d: error: alias table needs to start a list of standard tags\n", path, lineNum);
381  }
382  }
383  /* Was the last line consumed */
384  if (lastLineSize > 0) {
385  uprv_strcpy(line, lastLine);
386  lineSize = lastLineSize;
387  }
388  else {
389  lineSize = 0;
390  }
391  }
392  lineNum++;
393  }
394 }
395 
396 /* This works almost like the Perl chomp.
397  It removes the newlines, comments and trailing whitespace (not preceding whitespace).
398 */
399 static int32_t
400 chomp(char *line) {
401  char *s = line;
402  char *lastNonSpace = line;
403  while(*s!=0) {
404  /* truncate at a newline or a comment */
405  if(*s == '\r' || *s == '\n' || *s == '#') {
406  *s = 0;
407  break;
408  }
409  if (!isspace((int)*s)) {
410  lastNonSpace = s;
411  }
412  ++s;
413  }
414  if (lastNonSpace++ > line) {
415  *lastNonSpace = 0;
416  s = lastNonSpace;
417  }
418  return (int32_t)(s - line);
419 }
420 
421 static void
422 parseLine(const char *line) {
424  char *converter, *alias;
425 
426  /* skip leading white space */
427  /* There is no whitespace at the beginning anymore */
428 /* while(line[pos]!=0 && isspace(line[pos])) {
429  ++pos;
430  }
431 */
432 
433  /* is there nothing on this line? */
434  if(line[pos]==0) {
435  return;
436  }
437 
438  /* get the converter name */
439  start=pos;
440  while(line[pos]!=0 && !isspace((int)line[pos])) {
441  ++pos;
442  }
443  limit=pos;
444 
445  /* store the converter name */
447  converter=allocString(&stringBlock, line+start, length);
448 
449  /* add the converter to the converter table */
450  cnv=addConverter(converter);
451 
452  /* The name itself may be tagged, so let's added it to the aliases list properly */
453  pos = start;
454 
455  /* get all the real aliases */
456  for(;;) {
457 
458  /* skip white space */
459  while(line[pos]!=0 && isspace((int)line[pos])) {
460  ++pos;
461  }
462 
463  /* is there no more alias name on this line? */
464  if(line[pos]==0) {
465  break;
466  }
467 
468  /* get an alias name */
469  start=pos;
470  while(line[pos]!=0 && line[pos]!='{' && !isspace((int)line[pos])) {
471  ++pos;
472  }
473  limit=pos;
474 
475  /* store the alias name */
477  if (start == 0) {
478  /* add the converter as its own alias to the alias table */
479  alias = converter;
481  }
482  else {
485  }
487 
488  /* add the alias/converter pair to the alias table */
489  /* addAlias(alias, 0, cnv, FALSE);*/
490 
491  /* skip whitespace */
492  while (line[pos] && isspace((int)line[pos])) {
493  ++pos;
494  }
495 
496  /* handle tags if they are present */
497  if (line[pos] == '{') {
498  ++pos;
499  do {
500  start = pos;
501  while (line[pos] && line[pos] != '}' && !isspace((int)line[pos])) {
502  ++pos;
503  }
504  limit = pos;
505 
506  if (start != limit) {
507  /* add the tag to the tag table */
509  addAlias(alias, tag, cnv, (UBool)(line[limit-1] == '*'));
510  }
511 
512  while (line[pos] && isspace((int)line[pos])) {
513  ++pos;
514  }
515  } while (line[pos] && line[pos] != '}');
516 
517  if (line[pos] == '}') {
518  ++pos;
519  } else {
520  fprintf(stderr, "%s:%d: Unterminated tag list\n", path, lineNum);
522  }
523  } else {
524  addAlias(alias, EMPTY_TAG_NUM, cnv, (UBool)(tags[0].aliasList[cnv].aliasCount == 0));
525  }
526  }
527 }
528 
529 static uint16_t
530 getTagNumber(const char *tag, uint16_t tagLen) {
531  char *atag;
532  uint16_t t;
533  UBool preferredName = ((tagLen > 0) ? (tag[tagLen - 1] == '*') : (FALSE));
534 
535  if (tagCount >= MAX_TAG_COUNT) {
536  fprintf(stderr, "%s:%d: too many tags\n", path, lineNum);
538  }
539 
540  if (preferredName) {
541 /* puts(tag);*/
542  tagLen--;
543  }
544 
545  for (t = 0; t < tagCount; ++t) {
546  const char *currTag = GET_TAG_STR(tags[t].tag);
547  if (uprv_strlen(currTag) == tagLen && !uprv_strnicmp(currTag, tag, tagLen)) {
548  return t;
549  }
550  }
551 
552  /* we need to add this tag */
553  if (tagCount >= MAX_TAG_COUNT) {
554  fprintf(stderr, "%s:%d: error: too many tags\n", path, lineNum);
556  }
557 
558  /* allocate a new entry in the tag table */
559  atag = allocString(&tagBlock, tag, tagLen);
560 
561  if (standardTagsUsed) {
562  fprintf(stderr, "%s:%d: error: Tag \"%s\" is not declared at the beginning of the alias table.\n",
563  path, lineNum, atag);
564  exit(1);
565  }
566  else if (tagLen > 0 && strcmp(tag, ALL_TAG_STR) != 0) {
567  fprintf(stderr, "%s:%d: warning: Tag \"%s\" was added to the list of standards because it was not declared at beginning of the alias table.\n",
568  path, lineNum, atag);
569  }
570 
571  /* add the tag to the tag table */
572  tags[tagCount].tag = GET_TAG_NUM(atag);
573  /* The aliasList should be set to 0's already */
574 
575  return tagCount++;
576 }
577 
578 /*static void
579 addTaggedAlias(uint16_t tag, const char *alias, uint16_t converter) {
580  tags[tag].aliases[converter] = alias;
581 }
582 */
583 
584 static void
586  (void) lineLen; // suppress compiler warnings about unused variable
587  char *atag;
588  char *endTagExp;
589  char *tag;
590  static const char WHITESPACE[] = " \t";
591 
593  fprintf(stderr, "%s:%d: error: official tags already added\n", path, lineNum);
595  }
596  tag = strchr(line, '{');
597  if (tag == NULL) {
598  /* Why were we called? */
599  fprintf(stderr, "%s:%d: error: Missing start of tag group\n", path, lineNum);
601  }
602  tag++;
603  endTagExp = strchr(tag, '}');
604  if (endTagExp == NULL) {
605  fprintf(stderr, "%s:%d: error: Missing end of tag group\n", path, lineNum);
607  }
608  endTagExp[0] = 0;
609 
610  tag = strtok(tag, WHITESPACE);
611  while (tag != NULL) {
612 /* printf("Adding original tag \"%s\"\n", tag);*/
613 
614  /* allocate a new entry in the tag table */
615  atag = allocString(&tagBlock, tag, -1);
616 
617  /* add the tag to the tag table */
618  tags[tagCount++].tag = (uint16_t)((atag - tagStore) >> 1);
619 
620  /* The aliasList should already be set to 0's */
621 
622  /* Get next tag */
623  tag = strtok(NULL, WHITESPACE);
624  }
625 }
626 
627 static uint16_t
628 addToKnownAliases(const char *alias) {
629 /* uint32_t idx; */
630  /* strict matching */
631 /* for (idx = 0; idx < knownAliasesCount; idx++) {
632  uint16_t num = GET_ALIAS_NUM(alias);
633  if (knownAliases[idx] != num
634  && uprv_strcmp(alias, GET_ALIAS_STR(knownAliases[idx])) == 0)
635  {
636  fprintf(stderr, "%s:%d: warning: duplicate alias %s and %s found\n", path,
637  lineNum, alias, GET_ALIAS_STR(knownAliases[idx]));
638  duplicateKnownAliasesCount++;
639  break;
640  }
641  else if (knownAliases[idx] != num
642  && ucnv_compareNames(alias, GET_ALIAS_STR(knownAliases[idx])) == 0)
643  {
644  if (verbose) {
645  fprintf(stderr, "%s:%d: information: duplicate alias %s and %s found\n", path,
646  lineNum, alias, GET_ALIAS_STR(knownAliases[idx]));
647  }
648  duplicateKnownAliasesCount++;
649  break;
650  }
651  }
652 */
654  fprintf(stderr, "%s:%d: warning: Too many aliases defined for all converters\n",
655  path, lineNum);
657  }
658  /* TODO: We could try to unlist exact duplicates. */
660 }
661 
662 /*
663 @param standard When standard is 0, then it's the "empty" tag.
664 */
665 static uint16_t
666 addAlias(const char *alias, uint16_t standard, uint16_t converter, UBool defaultName) {
667  uint32_t idx, idx2;
668  UBool startEmptyWithoutDefault = FALSE;
669  AliasList *aliasList;
670 
671  if(standard>=MAX_TAG_COUNT) {
672  fprintf(stderr, "%s:%d: error: too many standard tags\n", path, lineNum);
674  }
675  if(converter>=MAX_CONV_COUNT) {
676  fprintf(stderr, "%s:%d: error: too many converter names\n", path, lineNum);
678  }
679  aliasList = &tags[standard].aliasList[converter];
680 
681  if (strchr(alias, '}')) {
682  fprintf(stderr, "%s:%d: error: unmatched } found\n", path,
683  lineNum);
684  }
685 
686  if(aliasList->aliasCount + 1 >= MAX_TC_ALIAS_COUNT) {
687  fprintf(stderr, "%s:%d: error: too many aliases for alias %s and converter %s\n", path,
688  lineNum, alias, GET_ALIAS_STR(converters[converter].converter));
690  }
691 
692  /* Show this warning only once. All aliases are added to the "ALL" tag. */
693  if (standard == ALL_TAG_NUM && GET_ALIAS_STR(converters[converter].converter) != alias) {
694  /* Normally these option values are parsed at runtime, and they can
695  be discarded when the alias is a default converter. Options should
696  only be on a converter and not an alias. */
698  {
699  fprintf(stderr, "warning(line %d): alias %s contains a \""UCNV_OPTION_SEP_STRING"\". Options are parsed at run-time and do not need to be in the alias table.\n",
700  lineNum, alias);
701  }
703  {
704  fprintf(stderr, "warning(line %d): alias %s contains an \""UCNV_VALUE_SEP_STRING"\". Options are parsed at run-time and do not need to be in the alias table.\n",
705  lineNum, alias);
706  }
707  }
708 
709  if (standard != ALL_TAG_NUM) {
710  /* Check for duplicate aliases for this tag on all converters */
711  for (idx = 0; idx < converterCount; idx++) {
712  for (idx2 = 0; idx2 < tags[standard].aliasList[idx].aliasCount; idx2++) {
713  uint16_t aliasNum = tags[standard].aliasList[idx].aliases[idx2];
714  if (aliasNum
715  && ucnv_compareNames(alias, GET_ALIAS_STR(aliasNum)) == 0)
716  {
717  if (idx == converter) {
718  /*
719  * (alias, standard) duplicates are harmless if they map to the same converter.
720  * Only print a warning in verbose mode, or if the alias is a precise duplicate,
721  * not just a lenient-match duplicate.
722  */
723  if (verbose || 0 == uprv_strcmp(alias, GET_ALIAS_STR(aliasNum))) {
724  fprintf(stderr, "%s:%d: warning: duplicate aliases %s and %s found for standard %s and converter %s\n", path,
725  lineNum, alias, GET_ALIAS_STR(aliasNum),
726  GET_TAG_STR(tags[standard].tag),
727  GET_ALIAS_STR(converters[converter].converter));
728  }
729  } else {
730  fprintf(stderr, "%s:%d: warning: duplicate aliases %s and %s found for standard tag %s between converter %s and converter %s\n", path,
731  lineNum, alias, GET_ALIAS_STR(aliasNum),
732  GET_TAG_STR(tags[standard].tag),
733  GET_ALIAS_STR(converters[converter].converter),
734  GET_ALIAS_STR(converters[idx].converter));
735  }
736  break;
737  }
738  }
739  }
740 
741  /* Check for duplicate default aliases for this converter on all tags */
742  /* It's okay to have multiple standards prefer the same name */
743 /* if (verbose && !dupFound) {
744  for (idx = 0; idx < tagCount; idx++) {
745  if (tags[idx].aliasList[converter].aliases) {
746  uint16_t aliasNum = tags[idx].aliasList[converter].aliases[0];
747  if (aliasNum
748  && ucnv_compareNames(alias, GET_ALIAS_STR(aliasNum)) == 0)
749  {
750  fprintf(stderr, "%s:%d: warning: duplicate alias %s found for converter %s and standard tag %s\n", path,
751  lineNum, alias, GET_ALIAS_STR(converters[converter].converter), GET_TAG_STR(tags[standard].tag));
752  break;
753  }
754  }
755  }
756  }*/
757  }
758 
759  if (aliasList->aliasCount <= 0) {
760  aliasList->aliasCount++;
761  startEmptyWithoutDefault = TRUE;
762  }
763  aliasList->aliases = (uint16_t *)uprv_realloc(aliasList->aliases, (aliasList->aliasCount + 1) * sizeof(aliasList->aliases[0]));
764  if (startEmptyWithoutDefault) {
765  aliasList->aliases[0] = 0;
766  }
767  if (defaultName) {
768  if (aliasList->aliases[0] != 0) {
769  fprintf(stderr, "%s:%d: error: Alias %s and %s cannot both be the default alias for standard tag %s and converter %s\n", path,
770  lineNum,
771  alias,
772  GET_ALIAS_STR(aliasList->aliases[0]),
773  GET_TAG_STR(tags[standard].tag),
774  GET_ALIAS_STR(converters[converter].converter));
776  }
777  aliasList->aliases[0] = GET_ALIAS_NUM(alias);
778  } else {
779  aliasList->aliases[aliasList->aliasCount++] = GET_ALIAS_NUM(alias);
780  }
781 /* aliasList->converter = converter;*/
782 
783  converters[converter].totalAliasCount++; /* One more to the column */
784  tags[standard].totalAliasCount++; /* One more to the row */
785 
786  return aliasList->aliasCount;
787 }
788 
789 static uint16_t
790 addConverter(const char *converter) {
791  uint32_t idx;
793  fprintf(stderr, "%s:%d: error: too many converters\n", path, lineNum);
795  }
796 
797  for (idx = 0; idx < converterCount; idx++) {
798  if (ucnv_compareNames(converter, GET_ALIAS_STR(converters[idx].converter)) == 0) {
799  fprintf(stderr, "%s:%d: error: duplicate converter %s found!\n", path, lineNum, converter);
801  break;
802  }
803  }
804 
807 
808  return converterCount++;
809 }
810 
811 /* resolve this alias based on the prioritization of the standard tags. */
812 static void
814  uint16_t idx, idx2, idx3;
815 
816  for (idx = UCNV_NUM_RESERVED_TAGS; idx < tagCount; idx++) {
817  for (idx2 = 0; idx2 < converterCount; idx2++) {
818  for (idx3 = 0; idx3 < tags[idx].aliasList[idx2].aliasCount; idx3++) {
819  uint16_t aliasNum = tags[idx].aliasList[idx2].aliases[idx3];
820  if (aliasNum == alias) {
821  *tagNum = idx;
822  *converterNum = idx2;
823  return;
824  }
825  }
826  }
827  }
828  /* Do the leftovers last, just in case */
829  /* There is no need to do the ALL tag */
830  idx = 0;
831  for (idx2 = 0; idx2 < converterCount; idx2++) {
832  for (idx3 = 0; idx3 < tags[idx].aliasList[idx2].aliasCount; idx3++) {
833  uint16_t aliasNum = tags[idx].aliasList[idx2].aliases[idx3];
834  if (aliasNum == alias) {
835  *tagNum = idx;
836  *converterNum = idx2;
837  return;
838  }
839  }
840  }
841  *tagNum = UINT16_MAX;
842  *converterNum = UINT16_MAX;
843  fprintf(stderr, "%s: warning: alias %s not found\n",
844  path,
846  return;
847 }
848 
849 /* The knownAliases should be sorted before calling this function */
850 static uint32_t
851 resolveAliases(uint16_t *uniqueAliasArr, uint16_t *uniqueAliasToConverterArr, uint16_t aliasOffset) {
852  uint32_t uniqueAliasIdx = 0;
853  uint32_t idx;
854  uint16_t currTagNum, oldTagNum;
855  uint16_t currConvNum, oldConvNum;
856  const char *lastName;
857 
858  if (knownAliasesCount != 0) {
859  resolveAliasToConverter(knownAliases[0], &oldTagNum, &currConvNum);
860  uniqueAliasToConverterArr[uniqueAliasIdx] = currConvNum;
861  oldConvNum = currConvNum;
862  uniqueAliasArr[uniqueAliasIdx] = knownAliases[0] + aliasOffset;
863  uniqueAliasIdx++;
864  lastName = GET_ALIAS_STR(knownAliases[0]);
865 
866  for (idx = 1; idx < knownAliasesCount; idx++) {
867  resolveAliasToConverter(knownAliases[idx], &currTagNum, &currConvNum);
868  if (ucnv_compareNames(lastName, GET_ALIAS_STR(knownAliases[idx])) == 0) {
869  /* duplicate found */
870  if ((currTagNum < oldTagNum && currTagNum >= UCNV_NUM_RESERVED_TAGS)
871  || oldTagNum == 0) {
872  oldTagNum = currTagNum;
873  uniqueAliasToConverterArr[uniqueAliasIdx - 1] = currConvNum;
874  uniqueAliasArr[uniqueAliasIdx - 1] = knownAliases[idx] + aliasOffset;
875  if (verbose) {
876  printf("using %s instead of %s -> %s",
878  lastName,
879  GET_ALIAS_STR(converters[currConvNum].converter));
880  if (oldConvNum != currConvNum) {
881  printf(" (alias conflict)");
882  }
883  puts("");
884  }
885  }
886  else {
887  /* else ignore it */
888  if (verbose) {
889  printf("folding %s into %s -> %s",
891  lastName,
892  GET_ALIAS_STR(converters[oldConvNum].converter));
893  if (oldConvNum != currConvNum) {
894  printf(" (alias conflict)");
895  }
896  puts("");
897  }
898  }
899  if (oldConvNum != currConvNum) {
900  uniqueAliasToConverterArr[uniqueAliasIdx - 1] |= UCNV_AMBIGUOUS_ALIAS_MAP_BIT;
901  }
902  }
903  else {
904  uniqueAliasToConverterArr[uniqueAliasIdx] = currConvNum;
905  oldConvNum = currConvNum;
906  uniqueAliasArr[uniqueAliasIdx] = knownAliases[idx] + aliasOffset;
907  uniqueAliasIdx++;
908  lastName = GET_ALIAS_STR(knownAliases[idx]);
909  oldTagNum = currTagNum;
910  /*printf("%s -> %s\n", GET_ALIAS_STR(knownAliases[idx]), GET_ALIAS_STR(converters[currConvNum].converter));*/
911  }
912  if (uprv_strchr(GET_ALIAS_STR(converters[currConvNum].converter), UCNV_OPTION_SEP_CHAR) != NULL) {
913  uniqueAliasToConverterArr[uniqueAliasIdx-1] |= UCNV_CONTAINS_OPTION_BIT;
914  }
915  }
916  }
917  return uniqueAliasIdx;
918 }
919 
920 static void
922  uint32_t aliasNum;
923  AliasList *aliasList = &tags[tag].aliasList[converter];
924 
925  if (aliasList->aliasCount == 0) {
926  aliasArrLists[tag*converterCount + converter] = 0;
927  }
928  else {
929  aliasLists[aliasListsSize++] = aliasList->aliasCount;
930 
931  /* write into the array area a 1's based index. */
932  aliasArrLists[tag*converterCount + converter] = aliasListsSize;
933 
934 /* printf("tag %s converter %s\n",
935  GET_TAG_STR(tags[tag].tag),
936  GET_ALIAS_STR(converters[converter].converter));*/
937  for (aliasNum = 0; aliasNum < aliasList->aliasCount; aliasNum++) {
938  uint16_t value;
939 /* printf(" %s\n",
940  GET_ALIAS_STR(aliasList->aliases[aliasNum]));*/
941  if (aliasList->aliases[aliasNum]) {
942  value = aliasList->aliases[aliasNum] + offset;
943  } else {
944  value = 0;
945  if (tag != 0 && !quiet) { /* Only show the warning when it's not the leftover tag. */
946  fprintf(stderr, "%s: warning: tag %s does not have a default alias for %s\n",
947  path,
949  GET_ALIAS_STR(converters[converter].converter));
950  }
951  }
953  if (aliasListsSize >= MAX_LIST_SIZE) {
954  fprintf(stderr, "%s: error: Too many alias lists\n", path);
956  }
957 
958  }
959  }
960 }
961 
962 static void
963 createNormalizedAliasStrings(char *normalizedStrings, const char *origStringBlock, int32_t stringBlockLength) {
964  int32_t currStrLen;
965  uprv_memcpy(normalizedStrings, origStringBlock, stringBlockLength);
966  while ((currStrLen = (int32_t)uprv_strlen(origStringBlock)) < stringBlockLength) {
967  int32_t currStrSize = currStrLen + 1;
968  if (currStrLen > 0) {
969  int32_t normStrLen;
970  ucnv_io_stripForCompare(normalizedStrings, origStringBlock);
971  normStrLen = (int32_t)uprv_strlen(normalizedStrings);
972  if (normStrLen > 0) {
973  uprv_memset(normalizedStrings + normStrLen, 0, currStrSize - normStrLen);
974  }
975  }
976  stringBlockLength -= currStrSize;
977  normalizedStrings += currStrSize;
978  origStringBlock += currStrSize;
979  }
980 }
981 
982 static void
984  uint32_t i, j;
985  uint32_t uniqueAliasesSize;
986  uint16_t aliasOffset = (uint16_t)(tagBlock.top/sizeof(uint16_t));
987  uint16_t *aliasArrLists = (uint16_t *)uprv_malloc(tagCount * converterCount * sizeof(uint16_t));
988  uint16_t *uniqueAliases = (uint16_t *)uprv_malloc(knownAliasesCount * sizeof(uint16_t));
989  uint16_t *uniqueAliasesToConverter = (uint16_t *)uprv_malloc(knownAliasesCount * sizeof(uint16_t));
990 
992  uniqueAliasesSize = resolveAliases(uniqueAliases, uniqueAliasesToConverter, aliasOffset);
993 
994  /* Array index starts at 1. aliasLists[0] is the size of the lists section. */
995  aliasListsSize = 0;
996 
997  /* write the offsets of all the aliases lists in a 2D array, and create the lists. */
998  for (i = 0; i < tagCount; ++i) {
999  for (j = 0; j < converterCount; ++j) {
1000  createOneAliasList(aliasArrLists, i, j, aliasOffset);
1001  }
1002  }
1003 
1004  /* Write the size of the TOC */
1006  udata_write32(out, 8);
1007  }
1008  else {
1009  udata_write32(out, 9);
1010  }
1011 
1012  /* Write the sizes of each section */
1013  /* All sizes are the number of uint16_t units, not bytes */
1016  udata_write32(out, uniqueAliasesSize); /* list of aliases */
1017  udata_write32(out, uniqueAliasesSize); /* The preresolved form of mapping an untagged the alias to a converter */
1020  udata_write32(out, sizeof(tableOptions) / sizeof(uint16_t));
1024  }
1025 
1026  /* write the table of converters */
1027  /* Think of this as the column headers */
1028  for(i=0; i<converterCount; ++i) {
1029  udata_write16(out, (uint16_t)(converters[i].converter + aliasOffset));
1030  }
1031 
1032  /* write the table of tags */
1033  /* Think of this as the row headers */
1034  for(i=UCNV_NUM_RESERVED_TAGS; i<tagCount; ++i) {
1035  udata_write16(out, tags[i].tag);
1036  }
1037  /* The empty tag is considered the leftover list, and put that at the end of the priority list. */
1040 
1041  /* Write the unique list of aliases */
1042  udata_writeBlock(out, uniqueAliases, uniqueAliasesSize * sizeof(uint16_t));
1043 
1044  /* Write the unique list of aliases */
1045  udata_writeBlock(out, uniqueAliasesToConverter, uniqueAliasesSize * sizeof(uint16_t));
1046 
1047  /* Write the array to the lists */
1048  udata_writeBlock(out, (const void *)(aliasArrLists + (2*converterCount)), (((tagCount - 2) * converterCount) * sizeof(uint16_t)));
1049  /* Now write the leftover part of the array for the EMPTY and ALL lists */
1050  udata_writeBlock(out, (const void *)aliasArrLists, (2 * converterCount * sizeof(uint16_t)));
1051 
1052  /* Offset the next array to make the index start at 1. */
1053  udata_write16(out, 0xDEAD);
1054 
1055  /* Write the lists */
1056  udata_writeBlock(out, (const void *)aliasLists, aliasListsSize * sizeof(uint16_t));
1057 
1058  /* Write any options for the alias table. */
1059  udata_writeBlock(out, (const void *)&tableOptions, sizeof(tableOptions));
1060 
1061  /* write the tags strings */
1063 
1064  /* write the aliases strings */
1066 
1067  /* write the normalized aliases strings */
1069  char *normalizedStrings = (char *)uprv_malloc(tagBlock.top + stringBlock.top);
1072 
1073  /* Write out the complete normalized array. */
1074  udata_writeString(out, normalizedStrings, tagBlock.top + stringBlock.top);
1075  uprv_free(normalizedStrings);
1076  }
1077 
1078  uprv_free(uniqueAliasesToConverter);
1079  uprv_free(uniqueAliases);
1080  uprv_free(aliasArrLists);
1081 }
1082 
1083 static char *
1085  uint32_t top;
1086  char *p;
1087 
1088  if(length<0) {
1090  }
1091 
1092  /*
1093  * add 1 for the terminating NUL
1094  * and round up (+1 &~1)
1095  * to keep the addresses on a 16-bit boundary
1096  */
1097  top=block->top + (uint32_t)((length + 1 + 1) & ~1);
1098 
1099  if(top >= block->max) {
1100  fprintf(stderr, "%s:%d: error: out of memory\n", path, lineNum);
1102  }
1103 
1104  /* get the pointer and copy the string */
1105  p = block->store + block->top;
1106  uprv_memcpy(p, s, length);
1107  p[length] = 0; /* NUL-terminate it */
1108  if((length & 1) == 0) {
1109  p[length + 1] = 0; /* set the padding byte */
1110  }
1111 
1112  /* check for invariant characters now that we have a NUL-terminated string for easy output */
1114  fprintf(stderr, "%s:%d: error: the name %s contains not just invariant characters\n", path, lineNum, p);
1116  }
1117 
1118  block->top = top;
1119  return p;
1120 }
1121 
1122 static int
1123 compareAliases(const void *alias1, const void *alias2) {
1124  /* Names like IBM850 and ibm-850 need to be sorted together */
1125  int result = ucnv_compareNames(GET_ALIAS_STR(*(uint16_t*)alias1), GET_ALIAS_STR(*(uint16_t*)alias2));
1126  if (!result) {
1127  /* Sort the shortest first */
1128  return (int)uprv_strlen(GET_ALIAS_STR(*(uint16_t*)alias1)) - (int)uprv_strlen(GET_ALIAS_STR(*(uint16_t*)alias2));
1129  }
1130  return result;
1131 }
1132 
1133 /*
1134  * Hey, Emacs, please set the following:
1135  *
1136  * Local Variables:
1137  * indent-tabs-mode: nil
1138  * End:
1139  *
1140  */
1141 
#define UPRV_LENGTHOF(array)
Definition: cmemory.h:50
#define uprv_memcpy(dst, src, size)
Definition: cmemory.h:40
#define uprv_memset(buffer, mark, size)
Definition: cmemory.h:51
#define n
Definition: t4ht.c:1290
#define uprv_strcmp(s1, s2)
Definition: cstring.h:38
#define uprv_strchr(s, c)
Definition: cstring.h:40
#define uprv_strcpy(dst, src)
Definition: cstring.h:36
#define uprv_strlen(str)
Definition: cstring.h:37
UConverter * cnv
Definition: date.c:55
@ FALSE
Definition: dd.h:101
@ TRUE
Definition: dd.h:102
int strcmp()
Definition: coll.cpp:143
int printf()
char * strtok()
void T_FileStream_close(FileStream *fileStream)
Definition: filestrm.cpp:75
char * T_FileStream_readLine(FileStream *fileStream, char *buffer, int32_t length)
Definition: filestrm.cpp:153
FileStream * T_FileStream_open(const char *filename, const char *mode)
Definition: filestrm.cpp:33
static void
Definition: fpif.c:118
int main(int argc, char *argv[])
Definition: gencnval.c:225
#define DATA_NAME
Definition: gencnval.c:72
static UBool standardTagsUsed
Definition: gencnval.c:139
static UConverterAliasOptions tableOptions
Definition: gencnval.c:144
static int32_t chomp(char *line)
Definition: gencnval.c:400
#define MAX_TC_ALIAS_COUNT
Definition: gencnval.c:67
@ QUIET
Definition: gencnval.c:211
@ SOURCEDIR
Definition: gencnval.c:210
@ COPYRIGHT
Definition: gencnval.c:208
@ HELP1
Definition: gencnval.c:205
@ DESTDIR
Definition: gencnval.c:209
@ HELP2
Definition: gencnval.c:206
@ VERBOSE
Definition: gencnval.c:207
const char * path
Definition: gencnval.c:153
#define TAG_STORE_SIZE
Definition: gencnval.c:53
static Tag tags[0x3F]
Definition: gencnval.c:126
static uint16_t getTagNumber(const char *tag, uint16_t tagLen)
Definition: gencnval.c:530
#define GET_TAG_STR(index)
Definition: gencnval.c:197
static const UDataInfo dataInfo
Definition: gencnval.c:80
static void parseLine(const char *line)
Definition: gencnval.c:422
static void createOneAliasList(uint16_t *aliasArrLists, uint32_t tag, uint32_t converter, uint16_t offset)
Definition: gencnval.c:921
static uint16_t converterCount
Definition: gencnval.c:114
#define MAX_LIST_SIZE
Definition: gencnval.c:70
static char * allocString(StringBlock *block, const char *s, int32_t length)
Definition: gencnval.c:1084
static char tagStore[0x400]
Definition: gencnval.c:116
#define GET_ALIAS_STR(index)
Definition: gencnval.c:196
static void parseFile(FileStream *in)
Definition: gencnval.c:332
#define MAX_LINE_SIZE
Definition: gencnval.c:69
static uint16_t knownAliases[0xFFFF]
Definition: gencnval.c:130
static uint16_t knownAliasesCount
Definition: gencnval.c:131
static StringBlock tagBlock
Definition: gencnval.c:117
static void resolveAliasToConverter(uint16_t alias, uint16_t *tagNum, uint16_t *converterNum)
Definition: gencnval.c:813
static StringBlock stringBlock
Definition: gencnval.c:101
static uint16_t tagCount
Definition: gencnval.c:127
static void writeAliasTable(UNewDataMemory *out)
Definition: gencnval.c:983
static uint32_t resolveAliases(uint16_t *uniqueAliasArr, uint16_t *uniqueAliasToConverterArr, uint16_t aliasOffset)
Definition: gencnval.c:851
static uint16_t addAlias(const char *alias, uint16_t standard, uint16_t converter, UBool defaultName)
Definition: gencnval.c:666
static uint16_t aliasListsSize
Definition: gencnval.c:136
static void addOfficialTaggedStandards(char *line, int32_t lineLen)
Definition: gencnval.c:585
#define MAX_CONV_COUNT
Definition: gencnval.c:60
#define MAX_TAG_COUNT
Definition: gencnval.c:59
static uint16_t aliasLists[0xFFFF]
Definition: gencnval.c:135
#define ALL_TAG_NUM
Definition: gencnval.c:76
#define GET_ALIAS_NUM(str)
Definition: gencnval.c:200
static char stringStore[0x1FBFE]
Definition: gencnval.c:100
static uint16_t addToKnownAliases(const char *alias)
Definition: gencnval.c:628
static int lineNum
Definition: gencnval.c:142
#define ALL_TAG_STR
Definition: gencnval.c:75
static uint16_t addConverter(const char *converter)
Definition: gencnval.c:790
#define EMPTY_TAG_NUM
Definition: gencnval.c:77
#define STRING_STORE_SIZE
Definition: gencnval.c:52
static UBool quiet
Definition: gencnval.c:141
static void createNormalizedAliasStrings(char *normalizedStrings, const char *origStringBlock, int32_t stringBlockLength)
Definition: gencnval.c:963
#define MAX_ALIAS_COUNT
Definition: gencnval.c:61
static UBool verbose
Definition: gencnval.c:140
static int compareAliases(const void *alias1, const void *alias2)
Definition: gencnval.c:1123
#define DATA_TYPE
Definition: gencnval.c:73
#define GET_TAG_NUM(str)
Definition: gencnval.c:201
static Converter converters[0xFFF]
Definition: gencnval.c:113
#define s
Definition: afcover.h:80
#define t
Definition: afcover.h:96
#define strchr
Definition: gsftopk.c:59
FILE * out
Definition: hbf2gf.c:286
unsigned char UChar
Definition: bzip2.c:163
#define NULL
Definition: ftobjs.h:61
small capitals from c petite p
Definition: afcover.h:72
small capitals from c petite p scientific i
Definition: afcover.h:80
FT_UInt idx
Definition: cffcmap.c:135
void exit()
int int double double double char double char * top
Definition: gdfx.h:19
unsigned short uint16_t
Definition: stdint.h:79
#define UINT16_MAX
Definition: stdint.h:141
unsigned int uint32_t
Definition: stdint.h:80
signed int int32_t
Definition: stdint.h:77
#define fprintf
Definition: mendex.h:64
const char * alias
Definition: nkf.c:1121
#define length(c)
Definition: ctangleboot.c:65
#define U_IS_BIG_ENDIAN
Definition: platform.h:403
#define U_CHARSET_FAMILY
Definition: platform.h:632
#define qsort
Definition: includes.h:72
const int * pos
Definition: combiners.h:905
hb_tag_t Tag
Definition: luaharfbuzz.h:17
union value value
Definition: obx.h:44
static int offset
Definition: ppmtogif.c:642
char line[1024]
Definition: process_score.c:29
#define isspace(ch)
Definition: utype.h:87
C API: Platform Utilities.
#define U_FILE_SEP_CHAR
Definition: putil.h:130
alias_pair aliases[1000]
Definition: routines.c:52
struct AliasList AliasList
static FILE * in
Definition: squeeze.c:36
#define uint32_t
Definition: stdint.in.h:168
#define int32_t
Definition: stdint.in.h:167
#define uint16_t
Definition: stdint.in.h:161
Definition: sh.h:1594
uint16_t aliasCount
Definition: gencnval.c:104
uint16_t * aliases
Definition: gencnval.c:105
uint16_t converter
Definition: gencnval.c:109
uint16_t totalAliasCount
Definition: gencnval.c:110
uint32_t top
Definition: gencnval.c:96
uint32_t max
Definition: gencnval.c:97
char * store
Definition: gencnval.c:95
Definition: gencnval.c:119
uint16_t totalAliasCount
Definition: gencnval.c:121
uint16_t tag
Definition: gencnval.c:120
AliasList aliasList[0xFFF]
Definition: gencnval.c:122
uint16_t stringNormalizationType
Definition: ucnv_io.h:37
Definition: bdf.c:133
char * value
Definition: ppmtopjxl.c:57
Definition: tpic.c:45
Definition: dvips.h:235
Definition: xmlparse.c:179
int j
Definition: t4ht.c:1589
tag int tag
Definition: tex4ht.c:2554
return() int(((double) *(font_tbl[cur_fnt].wtbl+(int)(*(font_tbl[cur_fnt].char_wi+(int)(ch - font_tbl[cur_fnt].char_f)% 256)))/(double)(1L<< 20)) *(double) font_tbl[cur_fnt].scale)
C API: Initialize and clean up ICU.
C API: Character conversion.
#define UCNV_VALUE_SEP_STRING
Definition: ucnv.h:262
#define UCNV_OPTION_SEP_CHAR
Definition: ucnv.h:241
#define UCNV_OPTION_SEP_STRING
Definition: ucnv.h:248
#define UCNV_VALUE_SEP_CHAR
Definition: ucnv.h:255
#define UCNV_AMBIGUOUS_ALIAS_MAP_BIT
Definition: ucnv_io.h:24
#define ucnv_io_stripForCompare
Definition: ucnv_io.h:73
#define UCNV_CONTAINS_OPTION_BIT
Definition: ucnv_io.h:25
#define UCNV_NUM_RESERVED_TAGS
Definition: ucnv_io.h:27
@ UCNV_IO_STD_NORMALIZED
Definition: ucnv_io.h:32
@ UCNV_IO_UNNORMALIZED
Definition: ucnv_io.h:31
int8_t UBool
Definition: umachine.h:269
void udata_write16(UNewDataMemory *pData, uint16_t word)
Definition: unewdata.cpp:213
void udata_writeString(UNewDataMemory *pData, const char *s, int32_t length)
Definition: unewdata.cpp:255
uint32_t udata_finish(UNewDataMemory *pData, UErrorCode *pErrorCode)
Definition: unewdata.cpp:154
void udata_write32(UNewDataMemory *pData, uint32_t wyde)
Definition: unewdata.cpp:220
void udata_writeBlock(UNewDataMemory *pData, const void *s, int32_t length)
Definition: unewdata.cpp:227
UNewDataMemory * udata_create(const char *dir, const char *type, const char *name, const UDataInfo *pInfo, const char *comment, UErrorCode *pErrorCode)
Definition: unewdata.cpp:36
Definition: obx.h:51
int u_parseArgs(int argc, char *argv[], int optionCount, UOption options[])
Definition: uoptions.cpp:26
#define UOPTION_VERBOSE
Definition: uoptions.h:70
#define UOPTION_HELP_QUESTION_MARK
Definition: uoptions.h:69
#define UOPTION_DESTDIR
Definition: uoptions.h:75
#define UOPTION_QUIET
Definition: uoptions.h:71
#define UOPTION_HELP_H
Definition: uoptions.h:68
#define U_MAIN_INIT_ARGS(argc, argv)
Definition: uoptions.h:37
#define UOPTION_SOURCEDIR
Definition: uoptions.h:76
#define UOPTION_COPYRIGHT
Definition: uoptions.h:73
#define u_errorName
Definition: urename.h:226
#define uprv_realloc
Definition: urename.h:1447
#define ucnv_compareNames
Definition: urename.h:626
#define uprv_isInvariantString
Definition: urename.h:1428
#define u_getDataDirectory
Definition: urename.h:265
#define uprv_malloc
Definition: urename.h:1435
#define uprv_free
Definition: urename.h:1414
#define uprv_strnicmp
Definition: urename.h:1455
@ start
Definition: preamble.c:52
Basic definitions for ICU, for both C and C++ APIs.
#define U_ICUDATA_NAME
Definition: utypes.h:139
UErrorCode
Definition: utypes.h:431
@ U_MEMORY_ALLOCATION_ERROR
Definition: utypes.h:473
@ U_BUFFER_OVERFLOW_ERROR
Definition: utypes.h:481
@ U_ILLEGAL_ARGUMENT_ERROR
Definition: utypes.h:467
@ U_FILE_ACCESS_ERROR
Definition: utypes.h:470
@ U_ZERO_ERROR
Definition: utypes.h:465
@ U_UNMATCHED_BRACES
Definition: utypes.h:578
@ U_INVALID_TABLE_FORMAT
Definition: utypes.h:479
@ U_PARSE_ERROR
Definition: utypes.h:475
#define U_FAILURE(x)
Definition: utypes.h:735
#define U_COPYRIGHT_STRING
Definition: uvernum.h:56
#define argv
Definition: xmain.c:270
#define argc
Definition: xmain.c:269
#define errorCode
Definition: xmlparse.c:601
#define limit(x)
Definition: yuvsplittoppm.c:26
#define end(cp)
Definition: zic.c:71