Output more verbose debugging log to show where to insert the element into the value list

This commit is contained in:
Akira TAGOH 2012-05-01 20:18:41 +09:00
parent 7d65f9f514
commit d2718257f9
3 changed files with 64 additions and 25 deletions

View File

@ -1302,7 +1302,7 @@ FcConfigAdd (FcValueListPtr *head,
if (FcDebug () & FC_DBG_EDIT) if (FcDebug () & FC_DBG_EDIT)
{ {
printf ("%s list before ", append ? "Append" : "Prepend"); printf ("%s list before ", append ? "Append" : "Prepend");
FcValueListPrint (*head); FcValueListPrintWithPosition (*head, *prev);
printf ("\n"); printf ("\n");
} }

View File

@ -26,8 +26,8 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
void static void
FcValuePrint (const FcValue v) _FcValuePrint (const FcValue v)
{ {
switch (v.type) { switch (v.type) {
case FcTypeVoid: case FcTypeVoid:
@ -49,11 +49,9 @@ FcValuePrint (const FcValue v)
printf ("(%f %f; %f %f)", v.u.m->xx, v.u.m->xy, v.u.m->yx, v.u.m->yy); printf ("(%f %f; %f %f)", v.u.m->xx, v.u.m->xy, v.u.m->yx, v.u.m->yy);
break; break;
case FcTypeCharSet: /* XXX */ case FcTypeCharSet: /* XXX */
printf (" ");
FcCharSetPrint (v.u.c); FcCharSetPrint (v.u.c);
break; break;
case FcTypeLangSet: case FcTypeLangSet:
printf (" ");
FcLangSetPrint (v.u.l); FcLangSetPrint (v.u.l);
break; break;
case FcTypeFTFace: case FcTypeFTFace:
@ -63,11 +61,25 @@ FcValuePrint (const FcValue v)
} }
void void
FcValueListPrint (FcValueListPtr l) FcValuePrint (const FcValue v)
{ {
for (; l != NULL; l = FcValueListNext(l)) printf (" ");
_FcValuePrint (v);
}
void
FcValuePrintWithPosition (const FcValue v, FcBool show_pos_mark)
{
if (show_pos_mark)
printf (" [insert here] ");
else
printf (" ");
_FcValuePrint (v);
}
static void
FcValueBindingPrint (const FcValueListPtr l)
{ {
FcValuePrint (FcValueCanonicalize(&l->value));
switch (l->binding) { switch (l->binding) {
case FcValueBindingWeak: case FcValueBindingWeak:
printf ("(w)"); printf ("(w)");
@ -80,6 +92,27 @@ FcValueListPrint (FcValueListPtr l)
break; break;
} }
} }
void
FcValueListPrintWithPosition (FcValueListPtr l, const FcValueListPtr pos)
{
for (; l != NULL; l = FcValueListNext(l))
{
FcValuePrintWithPosition (FcValueCanonicalize (&l->value), pos != NULL && l == pos);
FcValueBindingPrint (l);
}
if (!pos)
printf (" [insert here]");
}
void
FcValueListPrint (FcValueListPtr l)
{
for (; l != NULL; l = FcValueListNext(l))
{
FcValuePrint (FcValueCanonicalize (&l->value));
FcValueBindingPrint (l);
}
} }
void void

View File

@ -701,7 +701,13 @@ FcCharSetGetNumbers(const FcCharSet *c);
/* fcdbg.c */ /* fcdbg.c */
FcPrivate void FcPrivate void
FcValueListPrint (const FcValueListPtr l); FcValuePrintWithPosition (const FcValue v, FcBool show_pos_mark);
FcPrivate void
FcValueListPrintWithPosition (FcValueListPtr l, const FcValueListPtr pos);
FcPrivate void
FcValueListPrint (FcValueListPtr l);
FcPrivate void FcPrivate void
FcLangSetPrint (const FcLangSet *ls); FcLangSetPrint (const FcLangSet *ls);