/*
- * $RCSId: xc/lib/fontconfig/fc-lang/fc-lang.c,v 1.3 2002/08/22 07:36:43 keithp Exp $
+ * fontconfig/fc-lang/fc-lang.c
*
* Copyright © 2002 Keith Packard
*
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
-#include "fcint.h"
#include "fccharset.c"
#include "fcstr.c"
+#include "fcserialize.c"
/*
* fc-lang
{
}
+FcPrivate void
+FcCacheObjectReference (void *object)
+{
+}
+
+FcPrivate void
+FcCacheObjectDereference (void *object)
+{
+}
+
+int FcDebugVal;
+
FcChar8 *
FcConfigHome (void)
{
* Comments begin with '#'
*/
-static FcCharSet *
-scan (FILE *f, char *file)
+static const FcCharSet *
+scan (FILE *f, char *file, FcCharSetFreezer *freezer)
{
- FcCharSet *c = 0;
- FcCharSet *n;
- int start, end, ucs4;
- char line[1024];
- int lineno = 0;
+ FcCharSet *c = 0;
+ const FcCharSet *n;
+ int start, end, ucs4;
+ char line[1024];
+ int lineno = 0;
while (get_line (f, line, &lineno))
{
if (!strncmp (line, "include", 7))
{
- file = strchr (line, ' ');
- if (!file)
- fatal (line, lineno,
+ FILE *included_f;
+ char *included_file;
+ included_file = strchr (line, ' ');
+ if (!included_file)
+ fatal (file, lineno,
"invalid syntax, expected: include filename");
- while (isspace(*file))
- file++;
- f = scanopen (file);
- if (!f)
- fatal (file, 0, "can't open");
- c = scan (f, file);
- fclose (f);
- return c;
+ while (isspace(*included_file))
+ included_file++;
+ included_f = scanopen (included_file);
+ if (!included_f)
+ fatal (included_file, 0, "can't open");
+ n = scan (included_f, included_file, freezer);
+ fclose (included_f);
+ if (!c)
+ c = FcCharSetCreate ();
+ if (!FcCharSetMerge (c, n, NULL))
+ fatal (file, lineno, "out of memory");
+ FcCharSetDestroy (n);
+ continue;
}
if (strchr (line, '-'))
{
fatal (file, lineno, "out of memory");
}
}
- n = FcCharSetFreeze (c);
+ n = FcCharSetFreeze (freezer, c);
FcCharSetDestroy (c);
return n;
}
main (int argc, char **argv)
{
static char *files[MAX_LANG];
- static FcCharSet *sets[MAX_LANG];
+ static const FcCharSet *sets[MAX_LANG];
static int duplicate[MAX_LANG];
static int country[MAX_LANG];
static char *names[MAX_LANG];
int setRangeStart[26];
int setRangeEnd[26];
FcChar8 setRangeChar;
+ FcCharSetFreezer *freezer;
+ freezer = FcCharSetFreezerCreate ();
+ if (!freezer)
+ fatal (argv[0], 0, "out of memory");
argi = 1;
while (argv[argi])
{
f = scanopen (files[i]);
if (!f)
fatal (files[i], 0, strerror (errno));
- sets[i] = scan (f, files[i]);
+ sets[i] = scan (f, files[i], freezer);
names[i] = get_name (files[i]);
langs[i] = get_lang(names[i]);
if (strchr (langs[i], '-'))
if (j < 0)
j = i;
- printf (" { (FcChar8 *) \"%s\", "
+ printf (" { \"%s\", "
" { FC_REF_CONSTANT, %d, OFF(%d,%d), NUM(%d,%d) } }, /* %d */\n",
langs[i],
sets[j]->num, i, off[j], i, off[j], i);
for (d = c + 1; d < ncountry; d++)
{
int j = country[d];
- if (j >= 0 && !strncmp (langs[j], langs[i], l))
+ if (j >= 0 && !strncmp (langs[j], langs[i], lang + 1))
{
BitSet(map, j);
country[d] = -1;