Commit 1580593e authored by Behdad Esfahbod's avatar Behdad Esfahbod
parents 052115aa 01f781a9
......@@ -40,11 +40,11 @@
<match target="font">
<!-- check to see if the font is just regular -->
<test name="weight" compare="less_eq">
<const>medium</const>
<const>regular</const>
</test>
<!-- check to see if the pattern requests bold -->
<test target="pattern" name="weight" compare="more">
<const>medium</const>
<test target="pattern" name="weight" compare="more_eq">
<const>bold</const>
</test>
<!--
set the embolden flag
......
......@@ -49,6 +49,7 @@
#include <getopt.h>
const struct option longopts[] = {
{"verbose", 0, 0, 'v'},
{"brief", 0, 0, 'b'},
{"format", 1, 0, 'f'},
{"quiet", 0, 0, 'q'},
{"version", 0, 0, 'V'},
......@@ -67,22 +68,24 @@ usage (char *program, int error)
{
FILE *file = error ? stderr : stdout;
#if HAVE_GETOPT_LONG
fprintf (file, "usage: %s [-vqVh] [-f FORMAT] [--verbose] [--format=FORMAT] [--quiet] [--version] [--help] [pattern] {element ...} \n",
fprintf (file, "usage: %s [-vbqVh] [-f FORMAT] [--verbose] [--brief] [--format=FORMAT] [--quiet] [--version] [--help] [pattern] {element ...} \n",
program);
#else
fprintf (file, "usage: %s [-vqVh] [-f FORMAT] [pattern] {element ...} \n",
fprintf (file, "usage: %s [-vbqVh] [-f FORMAT] [pattern] {element ...} \n",
program);
#endif
fprintf (file, "List fonts matching [pattern]\n");
fprintf (file, "\n");
#if HAVE_GETOPT_LONG
fprintf (file, " -v, --verbose display entire font pattern verbosely\n");
fprintf (file, " -b, --brief display entire font pattern briefly\n");
fprintf (file, " -f, --format=FORMAT use the given output format\n");
fprintf (file, " -q, --quiet suppress all normal output, exit 1 if no fonts matched\n");
fprintf (file, " -V, --version display font config version and exit\n");
fprintf (file, " -h, --help display this help and exit\n");
#else
fprintf (file, " -v (verbose) display entire font pattern verbosely\n");
fprintf (file, " -b (brief) display entire font pattern briefly\n");
fprintf (file, " -f FORMAT (format) use the given output format\n");
fprintf (file, " -q, (quiet) suppress all normal output, exit 1 if no fonts matched\n");
fprintf (file, " -V (version) display font config version and exit\n");
......@@ -95,6 +98,7 @@ int
main (int argc, char **argv)
{
int verbose = 0;
int brief = 0;
int quiet = 0;
const FcChar8 *format = NULL;
int nfont = 0;
......@@ -106,15 +110,18 @@ main (int argc, char **argv)
int c;
#if HAVE_GETOPT_LONG
while ((c = getopt_long (argc, argv, "vf:qVh", longopts, NULL)) != -1)
while ((c = getopt_long (argc, argv, "vbf:qVh", longopts, NULL)) != -1)
#else
while ((c = getopt (argc, argv, "vf:qVh")) != -1)
while ((c = getopt (argc, argv, "vbf:qVh")) != -1)
#endif
{
switch (c) {
case 'v':
verbose = 1;
break;
case 'b':
brief = 1;
break;
case 'f':
format = (FcChar8 *) strdup (optarg);
break;
......@@ -155,7 +162,7 @@ main (int argc, char **argv)
pat = FcPatternCreate ();
if (quiet && !os)
os = FcObjectSetCreate ();
if (!verbose && !format && !os)
if (!verbose && !brief && !format && !os)
os = FcObjectSetBuild (FC_FAMILY, FC_STYLE, FC_FILE, (char *) 0);
if (!format)
format = (const FcChar8 *) "%{=fclist}\n";
......@@ -171,8 +178,13 @@ main (int argc, char **argv)
for (j = 0; j < fs->nfont; j++)
{
if (verbose)
if (verbose || brief)
{
if (brief)
{
FcPatternDel (fs->fonts[j], FC_CHARSET);
FcPatternDel (fs->fonts[j], FC_LANG);
}
FcPatternPrint (fs->fonts[j]);
}
else
......
......@@ -52,6 +52,7 @@ static const struct option longopts[] = {
{"sort", 0, 0, 's'},
{"all", 0, 0, 'a'},
{"verbose", 0, 0, 'v'},
{"brief", 0, 0, 'b'},
{"format", 1, 0, 'f'},
{"version", 0, 0, 'V'},
{"help", 0, 0, 'h'},
......@@ -69,7 +70,7 @@ usage (char *program, int error)
{
FILE *file = error ? stderr : stdout;
#if HAVE_GETOPT_LONG
fprintf (file, "usage: %s [-savVh] [-f FORMAT] [--sort] [--all] [--verbose] [--format=FORMAT] [--version] [--help] [pattern] {element...}\n",
fprintf (file, "usage: %s [-savbVh] [-f FORMAT] [--sort] [--all] [--verbose] [--brief] [--format=FORMAT] [--version] [--help] [pattern] {element...}\n",
program);
#else
fprintf (file, "usage: %s [-savVh] [-f FORMAT] [pattern] {element...}\n",
......@@ -81,6 +82,7 @@ usage (char *program, int error)
fprintf (file, " -s, --sort display sorted list of matches\n");
fprintf (file, " -a, --all display unpruned sorted list of matches\n");
fprintf (file, " -v, --verbose display entire font pattern verbosely\n");
fprintf (file, " -b, --brief display entire font pattern briefly\n");
fprintf (file, " -f, --format=FORMAT use the given output format\n");
fprintf (file, " -V, --version display font config version and exit\n");
fprintf (file, " -h, --help display this help and exit\n");
......@@ -88,6 +90,7 @@ usage (char *program, int error)
fprintf (file, " -s, (sort) display sorted list of matches\n");
fprintf (file, " -a (all) display unpruned sorted list of matches\n");
fprintf (file, " -v (verbose) display entire font pattern verbosely\n");
fprintf (file, " -b (brief) display entire font pattern briefly\n");
fprintf (file, " -f FORMAT (format) use the given output format\n");
fprintf (file, " -V (version) display font config version and exit\n");
fprintf (file, " -h (help) display this help and exit\n");
......@@ -99,6 +102,7 @@ int
main (int argc, char **argv)
{
int verbose = 0;
int brief = 0;
int sort = 0, all = 0;
const FcChar8 *format = NULL;
int i;
......@@ -110,9 +114,9 @@ main (int argc, char **argv)
int c;
#if HAVE_GETOPT_LONG
while ((c = getopt_long (argc, argv, "asvf:Vh", longopts, NULL)) != -1)
while ((c = getopt_long (argc, argv, "asvbf:Vh", longopts, NULL)) != -1)
#else
while ((c = getopt (argc, argv, "asvf:Vh")) != -1)
while ((c = getopt (argc, argv, "asvbf:Vh")) != -1)
#endif
{
switch (c) {
......@@ -125,6 +129,9 @@ main (int argc, char **argv)
case 'v':
verbose = 1;
break;
case 'b':
brief = 1;
break;
case 'f':
format = (FcChar8 *) strdup (optarg);
break;
......@@ -218,8 +225,13 @@ main (int argc, char **argv)
font = FcPatternFilter (fs->fonts[j], os);
if (verbose)
if (verbose || brief)
{
if (brief)
{
FcPatternDel (font, FC_CHARSET);
FcPatternDel (font, FC_LANG);
}
FcPatternPrint (font);
}
else
......
......@@ -52,8 +52,8 @@
#define _GNU_SOURCE
#include <getopt.h>
static const struct option longopts[] = {
{"ignore-blanks", 0, 0, 'b'},
{"index", 1, 0, 'i'},
{"brief", 0, 0, 'b'},
{"format", 1, 0, 'f'},
{"version", 0, 0, 'V'},
{"help", 0, 0, 'h'},
......@@ -71,23 +71,23 @@ usage (char *program, int error)
{
FILE *file = error ? stderr : stdout;
#if HAVE_GETOPT_LONG
fprintf (file, "usage: %s [-Vbh] [-i index] [-f FORMAT] [--ignore-blanks] [--index index] [--format FORMAT] [--version] [--help] font-file...\n",
fprintf (file, "usage: %s [-bVh] [-i index] [-f FORMAT] [--index index] [--brief] [--format FORMAT] [--version] [--help] font-file...\n",
program);
#else
fprintf (file, "usage: %s [-Vbh] [-i index] [-f FORMAT] font-file...\n",
fprintf (file, "usage: %s [-bVh] [-i index] [-f FORMAT] font-file...\n",
program);
#endif
fprintf (file, "Query font files and print resulting pattern(s)\n");
fprintf (file, "\n");
#if HAVE_GETOPT_LONG
fprintf (file, " -b, --ignore-blanks ignore blanks to compute langauges\n");
fprintf (file, " -i, --index INDEX display the INDEX face of each font file only\n");
fprintf (file, " -b, --brief display font pattern briefly\n");
fprintf (file, " -f, --format=FORMAT use the given output format\n");
fprintf (file, " -V, --version display font config version and exit\n");
fprintf (file, " -h, --help display this help and exit\n");
#else
fprintf (file, " -b (ignore-blanks) ignore blanks to compute languages\n");
fprintf (file, " -i INDEX (index) display the INDEX face of each font file only\n");
fprintf (file, " -b (brief) display font pattern briefly\n");
fprintf (file, " -f FORMAT (format) use the given output format\n");
fprintf (file, " -V (version) display font config version and exit\n");
fprintf (file, " -h (help) display this help and exit\n");
......@@ -98,28 +98,27 @@ usage (char *program, int error)
int
main (int argc, char **argv)
{
int id = -1;
int ignore_blanks = 0;
unsigned int id = (unsigned int) -1;
int brief = 0;
FcFontSet *fs;
FcChar8 *format = NULL;
FcBlanks *blanks = NULL;
int err = 0;
int i;
#if HAVE_GETOPT_LONG || HAVE_GETOPT
int c;
#if HAVE_GETOPT_LONG
while ((c = getopt_long (argc, argv, "bi:f:Vh", longopts, NULL)) != -1)
while ((c = getopt_long (argc, argv, "i:bf:Vh", longopts, NULL)) != -1)
#else
while ((c = getopt (argc, argv, "bi:f:Vh")) != -1)
while ((c = getopt (argc, argv, "i:bf:Vh")) != -1)
#endif
{
switch (c) {
case 'b':
ignore_blanks = 1;
break;
case 'i':
id = atoi (optarg);
id = (unsigned int) strtol (optarg, NULL, 0); /* strtol() To handle -1. */
break;
case 'b':
brief = 1;
break;
case 'f':
format = (FcChar8 *) strdup (optarg);
......@@ -143,14 +142,12 @@ main (int argc, char **argv)
usage (argv[0], 1);
fs = FcFontSetCreate ();
if (!ignore_blanks)
blanks = FcConfigGetBlanks (NULL);
for (; i < argc; i++)
{
if (!FcFreeTypeQueryAll ((FcChar8*) argv[i], id, blanks, NULL, fs))
if (!FcFreeTypeQueryAll ((FcChar8*) argv[i], id, NULL, NULL, fs))
{
fprintf (stderr, "Can't query face %d of font file %s\n", id, argv[i]);
fprintf (stderr, "Can't query face %u of font file %s\n", id, argv[i]);
err = 1;
}
}
......@@ -159,6 +156,12 @@ main (int argc, char **argv)
{
FcPattern *pat = fs->fonts[i];
if (brief)
{
FcPatternDel (pat, FC_CHARSET);
FcPatternDel (pat, FC_LANG);
}
if (format)
{
FcChar8 *s;
......
......@@ -52,6 +52,7 @@
#define _GNU_SOURCE
#include <getopt.h>
static const struct option longopts[] = {
{"brief", 0, 0, 'b'},
{"format", 1, 0, 'f'},
{"version", 0, 0, 'V'},
{"help", 0, 0, 'h'},
......@@ -69,19 +70,21 @@ usage (char *program, int error)
{
FILE *file = error ? stderr : stdout;
#if HAVE_GETOPT_LONG
fprintf (file, "usage: %s [-Vh] [-f FORMAT] [--format FORMAT] [--version] [--help] font-file...\n",
fprintf (file, "usage: %s [-bVh] [-f FORMAT] [--brief] [--format FORMAT] [--version] [--help] font-file...\n",
program);
#else
fprintf (file, "usage: %s [-Vh] [-f FORMAT] font-file...\n",
fprintf (file, "usage: %s [-bVh] [-f FORMAT] font-file...\n",
program);
#endif
fprintf (file, "Scan font files and directories, and print resulting pattern(s)\n");
fprintf (file, "\n");
#if HAVE_GETOPT_LONG
fprintf (file, " -b, --brief display font pattern briefly\n");
fprintf (file, " -f, --format=FORMAT use the given output format\n");
fprintf (file, " -V, --version display font config version and exit\n");
fprintf (file, " -h, --help display this help and exit\n");
#else
fprintf (file, " -b (brief) display font pattern briefly\n");
fprintf (file, " -f FORMAT (format) use the given output format\n");
fprintf (file, " -V (version) display font config version and exit\n");
fprintf (file, " -h (help) display this help and exit\n");
......@@ -92,6 +95,7 @@ usage (char *program, int error)
int
main (int argc, char **argv)
{
int brief = 0;
FcChar8 *format = NULL;
int i;
FcFontSet *fs;
......@@ -105,6 +109,9 @@ main (int argc, char **argv)
#endif
{
switch (c) {
case 'b':
brief = 1;
break;
case 'f':
format = (FcChar8 *) strdup (optarg);
break;
......@@ -152,6 +159,12 @@ main (int argc, char **argv)
{
FcPattern *pat = fs->fonts[i];
if (brief)
{
FcPatternDel (pat, FC_CHARSET);
FcPatternDel (pat, FC_LANG);
}
if (format)
{
FcChar8 *s;
......
......@@ -51,7 +51,7 @@ FcPatternAddFTFace (FcPattern *p, const char *object, const FT_Face f);
FcPublic FcPattern *
FcFreeTypeQueryFace (const FT_Face face,
const FcChar8 *file,
int id,
unsigned int id,
FcBlanks *blanks);
_FCFUNCPROTOEND
......
......@@ -72,8 +72,9 @@ typedef int FcBool;
#define _FC_STRINGIFY(s) _FC_STRINGIFY_(s)
#define FC_CACHE_VERSION _FC_STRINGIFY(FC_CACHE_VERSION_NUMBER)
#define FcTrue 1
#define FcFalse 0
#define FcTrue 1
#define FcDontCare 2
#define FC_FAMILY "family" /* String */
#define FC_STYLE "style" /* String */
......@@ -99,6 +100,7 @@ typedef int FcBool;
#define FC_OUTLINE "outline" /* Bool */
#define FC_SCALABLE "scalable" /* Bool */
#define FC_COLOR "color" /* Bool */
#define FC_VARIABLE "variable" /* Bool */
#define FC_SCALE "scale" /* double (deprecated) */
#define FC_SYMBOL "symbol" /* Bool */
#define FC_DPI "dpi" /* double */
......@@ -119,6 +121,7 @@ typedef int FcBool;
#define FC_DECORATIVE "decorative" /* Bool - true if style is a decorative variant */
#define FC_LCD_FILTER "lcdfilter" /* Int */
#define FC_FONT_FEATURES "fontfeatures" /* String */
#define FC_FONT_VARIATIONS "fontvariations" /* String */
#define FC_NAMELANG "namelang" /* String RFC 3866 langs */
#define FC_PRGNAME "prgname" /* String */
#define FC_HASH "hash" /* String (deprecated) */
......@@ -575,10 +578,10 @@ FcDirCacheUnload (FcCache *cache);
/* fcfreetype.c */
FcPublic FcPattern *
FcFreeTypeQuery (const FcChar8 *file, int id, FcBlanks *blanks, int *count);
FcFreeTypeQuery (const FcChar8 *file, unsigned int id, FcBlanks *blanks, int *count);
FcPublic unsigned int
FcFreeTypeQueryAll(const FcChar8 *file, int id, FcBlanks *blanks, int *count, FcFontSet *set);
FcFreeTypeQueryAll(const FcChar8 *file, unsigned int id, FcBlanks *blanks, int *count, FcFontSet *set);
/* fcfs.c */
......
......@@ -796,14 +796,30 @@ FcConfigCompareValue (const FcValue *left_o,
case FcTypeBool:
switch ((int) op) {
case FcOpEqual:
ret = left.u.b == right.u.b;
break;
case FcOpContains:
case FcOpListing:
ret = left.u.b == right.u.b;
ret = left.u.b == right.u.b || left.u.b == FcDontCare;
break;
case FcOpNotEqual:
case FcOpNotContains:
ret = left.u.b != right.u.b;
break;
case FcOpNotContains:
ret = !(left.u.b == right.u.b || left.u.b == FcDontCare);
break;
case FcOpLess:
ret = left.u.b != right.u.b && right.u.b == FcDontCare;
break;
case FcOpLessEqual:
ret = left.u.b == right.u.b || right.u.b == FcDontCare;
break;
case FcOpMore:
ret = left.u.b != right.u.b && left.u.b == FcDontCare;
break;
case FcOpMoreEqual:
ret = left.u.b == right.u.b || left.u.b == FcDontCare;
break;
default:
break;
}
......
......@@ -46,7 +46,10 @@ _FcValuePrintFile (FILE *f, const FcValue v)
fprintf (f, "\"%s\"", v.u.s);
break;
case FcTypeBool:
fprintf (f, "%s", v.u.b ? "True" : "False");
fprintf (f,
v.u.b == FcTrue ? (FcChar8 *) "True" :
v.u.b == FcFalse ? (FcChar8 *) "False" :
(FcChar8 *) "DontCare", 0);
break;
case FcTypeMatrix:
fprintf (f, "[%g %g; %g %g]", v.u.m->xx, v.u.m->xy, v.u.m->yx, v.u.m->yy);
......@@ -62,7 +65,7 @@ _FcValuePrintFile (FILE *f, const FcValue v)
fprintf (f, "face");
break;
case FcTypeRange:
fprintf (f, "[%g %g)", v.u.r->begin, v.u.r->end);
fprintf (f, "[%g %g]", v.u.r->begin, v.u.r->end);
break;
}
}
......
......@@ -39,6 +39,7 @@ static const struct {
{ FC_EMBEDDED_BITMAP_OBJECT, FcTrue }, /* !FC_LOAD_NO_BITMAP */
{ FC_DECORATIVE_OBJECT, FcFalse },
{ FC_SYMBOL_OBJECT, FcFalse },
{ FC_VARIABLE_OBJECT, FcFalse },
};
#define NUM_FC_BOOL_DEFAULTS (int) (sizeof FcBoolDefaults / sizeof FcBoolDefaults[0])
......@@ -255,7 +256,14 @@ FcDefaultSubstitute (FcPattern *pattern)
FcPatternObjectAddBool (pattern, FcBoolDefaults[i].field, FcBoolDefaults[i].value);
if (FcPatternObjectGetDouble (pattern, FC_SIZE_OBJECT, 0, &size) != FcResultMatch)
size = 12.0L;
{
FcRange *r;
double b, e;
if (FcPatternObjectGetRange (pattern, FC_SIZE_OBJECT, 0, &r) == FcResultMatch && FcRangeGetDouble (r, &b, &e))
size = (b + e) * .5;
else
size = 12.0L;
}
if (FcPatternObjectGetDouble (pattern, FC_SCALE_OBJECT, 0, &scale) != FcResultMatch)
scale = 1.0;
if (FcPatternObjectGetDouble (pattern, FC_DPI_OBJECT, 0, &dpi) != FcResultMatch)
......
This diff is collapsed.
......@@ -485,6 +485,9 @@ FcLangSetCreate (void)
void
FcLangSetDestroy (FcLangSet *ls)
{
if (!ls)
return;
if (ls->extra)
FcStrSetDestroy (ls->extra);
free (ls);
......@@ -495,6 +498,9 @@ FcLangSetCopy (const FcLangSet *ls)
{
FcLangSet *new;
if (!ls)
return NULL;
new = FcLangSetCreate ();
if (!new)
goto bail0;
......
......@@ -25,7 +25,7 @@
#include "fcint.h"
static double
FcCompareNumber (FcValue *value1, FcValue *value2)
FcCompareNumber (const FcValue *value1, const FcValue *value2, FcValue *bestValue)
{
double v1, v2, v;
......@@ -52,23 +52,27 @@ FcCompareNumber (FcValue *value1, FcValue *value2)
v = v2 - v1;
if (v < 0)
v = -v;
*bestValue = FcValueCanonicalize (value2);
return v;
}
static double
FcCompareString (FcValue *v1, FcValue *v2)
FcCompareString (const FcValue *v1, const FcValue *v2, FcValue *bestValue)
{
*bestValue = FcValueCanonicalize (v2);
return (double) FcStrCmpIgnoreCase (FcValueString(v1), FcValueString(v2)) != 0;
}
static double
FcCompareFamily (FcValue *v1, FcValue *v2)
FcCompareFamily (const FcValue *v1, const FcValue *v2, FcValue *bestValue)
{
/* rely on the guarantee in FcPatternObjectAddWithBinding that
* families are always FcTypeString. */
const FcChar8* v1_string = FcValueString(v1);
const FcChar8* v2_string = FcValueString(v2);
*bestValue = FcValueCanonicalize (v2);
if (FcToLower(*v1_string) != FcToLower(*v2_string) &&
*v1_string != ' ' && *v2_string != ' ')
return 1.0;
......@@ -77,13 +81,15 @@ FcCompareFamily (FcValue *v1, FcValue *v2)
}
static double
FcComparePostScript (FcValue *v1, FcValue *v2)
FcComparePostScript (const FcValue *v1, const FcValue *v2, FcValue *bestValue)
{
const FcChar8 *v1_string = FcValueString (v1);
const FcChar8 *v2_string = FcValueString (v2);
int n;
size_t len;
*bestValue = FcValueCanonicalize (v2);
if (FcToLower (*v1_string) != FcToLower (*v2_string) &&
*v1_string != ' ' && *v2_string != ' ')
return 1.0;
......@@ -95,7 +101,7 @@ FcComparePostScript (FcValue *v1, FcValue *v2)
}
static double
FcCompareLang (FcValue *v1, FcValue *v2)
FcCompareLang (const FcValue *v1, const FcValue *v2, FcValue *bestValue)
{
FcLangResult result;
FcValue value1 = FcValueCanonicalize(v1), value2 = FcValueCanonicalize(v2);
......@@ -130,6 +136,7 @@ FcCompareLang (FcValue *v1, FcValue *v2)
default:
return -1.0;
}
*bestValue = FcValueCanonicalize (v2);
switch (result) {
case FcLangEqual:
return 0;
......@@ -142,99 +149,134 @@ FcCompareLang (FcValue *v1, FcValue *v2)
}
static double
FcCompareBool (FcValue *v1, FcValue *v2)
FcCompareBool (const FcValue *v1, const FcValue *v2, FcValue *bestValue)
{
if (v2->type != FcTypeBool || v1->type != FcTypeBool)
return -1.0;
return (double) v2->u.b != v1->u.b;
if (v2->u.b != FcDontCare)
*bestValue = FcValueCanonicalize (v2);
else
*bestValue = FcValueCanonicalize (v1);
return (double) ((v2->u.b ^ v1->u.b) == 1);
}
static double
FcCompareCharSet (FcValue *v1, FcValue *v2)
FcCompareCharSet (const FcValue *v1, const FcValue *v2, FcValue *bestValue)
{
*bestValue = FcValueCanonicalize (v2); /* TODO Improve. */
return (double) FcCharSetSubtractCount (FcValueCharSet(v1), FcValueCharSet(v2));
}
static double
FcCompareSize (FcValue *value1, FcValue *value2)
FcCompareRange (const FcValue *v1, const FcValue *v2, FcValue *bestValue)
{
double v1, v2, v;
FcValue value1 = FcValueCanonicalize (v1);
FcValue value2 = FcValueCanonicalize (v2);
double b1, e1, b2, e2, d;
switch ((int) value1->type) {
switch ((int) value1.type) {
case FcTypeInteger:
v1 = value1->u.i;
b1 = e1 = value1.u.i;
break;
case FcTypeDouble:
v1 = value1->u.d;
b1 = e1 = value1.u.d;
break;
case FcTypeRange:
abort();
b1 = value1.u.r->begin;
e1 = value1.u.r->end;
break;
default:
return -1;
}
switch ((int) value2->type) {
switch ((int) value2.type) {
case FcTypeInteger:
v2 = value2->u.i;
b2 = e2 = value2.u.i;
break;
case FcTypeDouble:
v2 = value2->u.d;
b2 = e2 = value2.u.d;
break;
case FcTypeRange:
b2 = value2.u.r->begin;
e2 = value2.u.r->end;
break;
default:
return -1;
}
if (v2 == 0)
return 0;
v = v2 - v1;
if (v < 0)
v = -v;
return v;
if (e1 < b2)