* functions are also needed in slightly modified form
*/
+const FcChar16 langBankNumbers[1]; /* place holders so that externs resolve */
+const FcCharLeaf langBankLeaves[1];
+const int langBankLeafIdx[1];
+
void
FcMemAlloc (int kind, int size)
{
{
}
+int* _fcBankId = 0;
+int* _fcBankIdx = 0;
+FcValueList ** _fcValueLists = 0;
+FcPatternElt ** _fcPatternElts = 0;
+int FcDebugVal = 0;
+
int
-FcCacheBankToIndex (int bank)
+FcCacheBankToIndexMTF (int bank)
{
return -1;
}
if (lineno)
fprintf (stderr, "%s:%d: %s\n", file, lineno, msg);
else
- fprintf (stderr, "%s:%d: %s\n", file, lineno, msg);
+ fprintf (stderr, "%s: %s\n", file, msg);
exit (1);
}
get_line (FILE *f, char *line, int *lineno)
{
char *hash;
+ int end;
if (!fgets (line, 1024, f))
return 0;
++(*lineno);
hash = strchr (line, '#');
if (hash)
*hash = '\0';
+
+ end = strlen (line);
+ while (end > 0 && isspace (line[end-1]))
+ line[--end] = '\0';
+
if (line[0] == '\0' || line[0] == '\n' || line[0] == '\032' || line[0] == '\r')
return get_line (f, line, lineno);
return line;
}
-char *dir = 0;
+static char *dir = 0;
static FILE *
scanopen (char *file)
if (!strncmp (line, "include", 7))
{
file = strchr (line, ' ');
- while (*file == ' ')
+ while (isspace(*file))
file++;
- end = strlen (file);
- if (file[end-1] == '\n')
- file[end-1] = '\0';
f = scanopen (file);
if (!f)
fatal (file, 0, "can't open");
int
main (int argc, char **argv)
{
- char *files[MAX_LANG];
- FcCharSet *sets[MAX_LANG];
- int duplicate[MAX_LANG];
- int country[MAX_LANG];
- char *names[MAX_LANG];
- char *langs[MAX_LANG];
+ static char *files[MAX_LANG];
+ static FcCharSet *sets[MAX_LANG];
+ static int duplicate[MAX_LANG];
+ static int offsets[MAX_LANG];
+ static int country[MAX_LANG];
+ static char *names[MAX_LANG];
+ static char *langs[MAX_LANG];
FILE *f;
+ int offset = 0;
int ncountry = 0;
int i = 0;
int argi;
FcCharLeaf **leaves;
int total_leaves = 0;
+ int offset_count = 0;
int l, sl, tl;
- int c;
- char line[1024];
- FcChar32 map[MAX_LANG_SET_MAP];
+ static char line[1024];
+ static FcChar32 map[MAX_LANG_SET_MAP];
int num_lang_set_map;
int setRangeStart[26];
int setRangeEnd[26];
/*
* Dump leaves
*/
- printf ("static const FcCharLeaf leaves[%d] = {\n", tl);
+ printf ("const FcCharLeaf langBankLeaves[%d] = {\n", tl);
for (l = 0; l < tl; l++)
{
printf (" { { /* %d */", l);
printf ("\n } },\n");
}
printf ("};\n\n");
- printf ("#define L(n) ((FcCharLeaf *) &leaves[n])\n\n");
/*
* Find duplicate charsets
if (duplicate[i] >= 0)
continue;
- printf ("static const FcCharLeaf *leaves_%s[%d] = {\n",
- names[i], sets[i]->num);
+
+ for (n = 0; n < sets[i]->num; n++)
+ {
+ for (l = 0; l < tl; l++)
+ if (leaves[l] == FcCharSetGetLeaf(sets[i], n))
+ break;
+ if (l == tl)
+ fatal (names[i], 0, "can't find leaf");
+ offset_count++;
+ }
+ offsets[i] = offset;
+ offset += sets[i]->num;
+ }
+
+ printf ("const int langBankLeafIdx[%d] = {\n",
+ offset_count);
+ for (i = 0; sets[i]; i++)
+ {
+ int n;
+
+ if (duplicate[i] >= 0)
+ continue;
for (n = 0; n < sets[i]->num; n++)
{
if (n % 8 == 0)
break;
if (l == tl)
fatal (names[i], 0, "can't find leaf");
- printf (" L(%3d),", l);
+ printf (" %3d,", l);
if (n % 8 == 7)
printf ("\n");
}
if (n % 8 != 0)
printf ("\n");
- printf ("};\n\n");
-
+ }
+ printf ("};\n\n");
+
+ printf ("const FcChar16 langBankNumbers[%d] = {\n",
+ offset_count);
- printf ("static const FcChar16 numbers_%s[%d] = {\n",
- names[i], sets[i]->num);
+ for (i = 0; sets[i]; i++)
+ {
+ int n;
+
+ if (duplicate[i] >= 0)
+ continue;
for (n = 0; n < sets[i]->num; n++)
{
if (n % 8 == 0)
}
if (n % 8 != 0)
printf ("\n");
- printf ("};\n\n");
}
- printf ("#undef L\n\n");
+ printf ("};\n\n");
/*
* Dump sets
*/
- printf ("static const FcLangCharSet fcLangCharSets[] = {\n");
+ printf ("const FcLangCharSet fcLangCharSets[] = {\n");
for (i = 0; sets[i]; i++)
{
int j = duplicate[i];
if (j < 0)
j = i;
+
printf (" { (FcChar8 *) \"%s\",\n"
- " { FC_REF_CONSTANT, %d, FC_BANK_DYNAMIC, "
- "{ { (FcCharLeaf **) leaves_%s, "
- "(FcChar16 *) numbers_%s } } } },\n",
+ " { FC_REF_CONSTANT, %d, FC_BANK_LANGS, "
+ "{ { %d, %d } } } }, /* %d */\n",
langs[i],
- sets[j]->num, names[j], names[j]);
+ sets[j]->num, offsets[j], offsets[j], j);
}
printf ("};\n\n");
printf ("#define NUM_LANG_CHAR_SET %d\n", i);
*/
if (ncountry)
{
+ int c;
int ncountry_ent = 0;
printf ("\n");
printf ("static const FcChar32 fcLangCountrySets[][NUM_LANG_SET_MAP] = {\n");
i = country[c];
if (i >= 0)
{
- int l = strchr (langs[i], '-') - langs[i];
+ int lang = strchr (langs[i], '-') - langs[i];
int d, k;
for (k = 0; k < num_lang_set_map; k++)
for (k = 0; k < num_lang_set_map; k++)
printf (" 0x%08x,", map[k]);
printf (" }, /* %*.*s */\n",
- l, l, langs[i]);
+ lang, lang, langs[i]);
++ncountry_ent;
}
}