6.0.0
*/
+#include <assert.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
continue;
/* Now value should contain exactly one bit. */
- if (value == 0 || ((value & (value - 1)) != 0))
- abort ();
+ assert (value != 0 && (value & (value - 1)) == 0);
for (log2_value = 0; value > 1; value >>= 1, log2_value++);
if (unicode_attributes[ch].name != NULL)
{
int value = atoi (unicode_attributes[ch].combining);
- if (!(value >= 0 && value <= 255))
- abort ();
+ assert (value >= 0 && value <= 255);
combclass_table_add (&t, ch, value);
}
{
int value = get_decdigit_value (ch);
- if (!(value >= -1 && value < 10))
- abort ();
+ assert (value >= -1 && value < 10);
if (value >= 0)
{
{
int value = 1 + get_decdigit_value (ch);
- if (!(value >= 0 && value <= 10))
- abort ();
+ assert (value >= 0 && value <= 10);
decdigit_table_add (&t, ch, value);
}
{
int value = get_digit_value (ch);
- if (!(value >= -1 && value < 10))
- abort ();
+ assert (value >= -1 && value < 10);
if (value >= 0)
{
{
int value = 1 + get_digit_value (ch);
- if (!(value >= 0 && value <= 10))
- abort ();
+ assert (value >= 0 && value <= 10);
decdigit_table_add (&t, ch, value);
}
break;
if (i == nfractions)
{
- if (nfractions == 128)
- abort ();
+ assert (nfractions != 128);
for (i = 0; i < nfractions; i++)
if (value.denominator < fractions[i].denominator
|| (value.denominator == fractions[i].denominator
if (value.numerator == fractions[i].numerator
&& value.denominator == fractions[i].denominator)
break;
- if (i == nfractions)
- abort ();
+ assert (i != nfractions);
numeric_table_add (&t, ch, i);
}
return (int) mirror_char - (int) ch;
else
{
- if (mirror_char != 0xfffd)
- abort ();
+ assert (mirror_char == 0xfffd);
return 0;
}
}
proplist_filename);
exit (1);
}
- if (!(i1 <= i2 && i2 < 0x110000))
- abort ();
+ assert (i1 <= i2 && i2 < 0x110000);
for (i = i1; i <= i2; i++)
unicode_properties[i] |= 1ULL << propvalue;
proplist_filename);
exit (1);
}
- if (!(i1 <= i2 && i2 < 0x110000))
- abort ();
+ assert (i1 <= i2 && i2 < 0x110000);
for (i = i1; i <= i2; i++)
array[i] = 1;
}
bool result2 =
((unicode_properties[ch] & (1ULL << PROP_ALPHABETIC)) != 0);
- if (result1 != result2)
- abort ();
+ assert (result1 == result2);
return result1;
}
bool result2 =
((unicode_properties[ch] & (1ULL << PROP_DEFAULT_IGNORABLE_CODE_POINT)) != 0);
- if (result1 != result2)
- abort ();
+ assert (result1 == result2);
return result1;
}
bool result2 =
((unicode_properties[ch] & (1ULL << PROP_UPPERCASE)) != 0);
- if (result1 != result2)
- abort ();
+ assert (result1 == result2);
return result1;
}
bool result2 =
((unicode_properties[ch] & (1ULL << PROP_LOWERCASE)) != 0);
- if (result1 != result2)
- abort ();
+ assert (result1 == result2);
return result1;
}
|| is_category_Lt (ch));
bool result2 = ((unicode_properties[ch] & (1ULL << PROP_CASED)) != 0);
- if (result1 != result2)
- abort ();
+ assert (result1 == result2);
return result1;
}
|| is_category_Sk (ch));
bool result2 = ((unicode_properties[ch] & (1ULL << PROP_CASE_IGNORABLE)) != 0);
- if (result1 != result2)
- abort ();
+ assert (result1 == result2);
return result1;
}
&& unicode_attributes[ch].lower != NONE
&& unicode_attributes[ch].lower != ch);
- if (result1 != result2)
- abort ();
+ assert (result1 == result2);
return result1;
}
bool result2 =
is_category_Cc (ch);
- if (result1 != result2)
- abort ();
+ assert (result1 == result2);
return result1;
}
bool result2 =
((unicode_properties[ch] & (1ULL << PROP_MATH)) != 0);
- if (result1 != result2)
- abort ();
+ assert (result1 == result2);
return result1;
}
arabicshaping_filename, lineno);
exit (1);
}
- if (i >= 0x110000)
- abort ();
+ assert (i < 0x110000);
#define TRY(name) else if (strcmp (joining_type_name, #name + 16) == 0) joining_type = name;
if (false) {}
break;
}
- if (!(ch_min <= ch_max))
- abort ();
+ assert (ch_min <= ch_max);
/* If the interval [ch_min, ch_max] is too large, we should better use a
3-level table. */
- if (!(ch_max - ch_min < 0x200))
- abort ();
+ assert (ch_max - ch_min < 0x200);
fprintf (stream, "#define joining_group_header_0 0x%x\n", ch_min);
fprintf (stream, "static const unsigned char u_joining_group[0x%x - 0x%x] =\n",
}
i2 = i1;
}
- if (i2 < i1)
- abort ();
- if (i2 >= 0x110000)
- abort ();
+ assert (i2 >= i1);
+ assert (i2 < 0x110000);
for (script = numscripts - 1; script >= 0; script--)
if (strcmp (scripts[script], scriptname) == 0)
scripts[numscripts] = strdup (scriptname);
script = numscripts;
numscripts++;
- if (numscripts == 256)
- abort ();
+ assert (numscripts != 256);
}
for (i = i1; i <= i2; i++)
blocks[numblocks].end = i2;
blocks[numblocks].name = strdup (blockname);
/* It must be sorted. */
- if (numblocks > 0 && !(blocks[numblocks-1].end < blocks[numblocks].start))
- abort ();
+ assert (numblocks == 0 || blocks[numblocks-1].end < blocks[numblocks].start);
numblocks++;
- if (numblocks == 256)
- abort ();
+ assert (numblocks != 256);
}
if (ferror (stream) || fclose (stream))
int64_t attr = get_lbp (i);
/* Now attr should contain exactly one bit. */
- if (attr == 0 || ((attr & (attr - 1)) != 0))
- abort ();
+ assert (attr != 0 && (attr & (attr - 1)) == 0);
if (attr != (int64_t) 1 << LBP_XX)
{
wordbreakproperty_filename);
exit (1);
}
- if (!(i1 <= i2 && i2 < 0x110000))
- abort ();
+ assert (i1 <= i2 && i2 < 0x110000);
for (i = i1; i <= i2; i++)
unicode_org_wbp[i] = propvalue;
int attr = get_wbp (i);
/* Now attr should contain exactly one bit. */
- if (attr == 0 || ((attr & (attr - 1)) != 0))
- abort ();
+ assert (attr != 0 && (attr & (attr - 1)) == 0);
if (attr != 1 << WBP_OTHER)
{
graphemebreakproperty_filename, lineno);
exit (1);
}
- if (!(i1 <= i2 && i2 < 0x110000))
- abort ();
+ assert (i1 <= i2 && i2 < 0x110000);
for (i = i1; i <= i2; i++)
unicode_org_gbp[i] = propvalue;
size_t typelen;
rangle = strchr (decomposition + 1, '>');
- if (rangle == NULL)
- abort ();
+ assert (rangle != NULL);
typelen = rangle + 1 - decomposition;
#define TYPE(t1,t2) \
if (typelen == (sizeof (t1) - 1) && memcmp (decomposition, t1, typelen) == 0) \
if (decomposition[0] == ' ')
decomposition++;
}
- if (*decomposition != '\0')
- /* MAX_DECOMP_LENGTH is too small. */
- abort ();
+ /* Make sure that *DECOMPOSITION is not NULL-terminated.
+ Otherwise MAX_DECOMP_LENGTH is too small. */
+ assert (*decomposition == '\0');
*lengthp = length;
return type;
if (type >= 0)
{
- if (!(offset < (1 << 15)))
- abort ();
+ assert (offset < (1 << 15));
decomp_table_add (&t, ch, ((type == UC_DECOMP_CANONICAL ? 0 : 1) << 15) | offset);
/* Produce length 3-bytes entries. */
- if (length == 0)
- /* We would need a special representation of zero-length entries. */
- abort ();
+ /* We would need a special representation of zero-length entries. */
+ assert (length != 0);
for (i = 0; i < length; i++)
{
if (offset > 0)
fprintf (stream2, ",");
if ((offset % 4) == 0)
fprintf (stream2, "\n ");
- if (!(decomposed[i] < (1 << 18)))
- abort ();
+ assert (decomposed[i] < (1 << 18));
fprintf (stream2, " 0x%02X, 0x%02X, 0x%02X",
(((i+1 < length ? (1 << 23) : 0)
| (i == 0 ? (type << 18) : 0)
fprintf (stderr, "parse error in '%s'\n", compositionexclusions_filename);
exit (1);
}
- if (!(i < 0x110000))
- abort ();
+ assert (i < 0x110000);
unicode_composition_exclusions[i] = 1;
}
{
/* The combined character must now also be a starter.
Verify this. */
- if (strcmp (unicode_attributes[combined].combining, "0") != 0)
- abort ();
+ assert (strcmp (unicode_attributes[combined].combining, "0") == 0);
fprintf (stream, "0x%04X\t0x%04X\t0x%04X\t%s\n",
code1,
{
/* The combined character must now also be a starter.
Verify this. */
- if (strcmp (unicode_attributes[combined].combining, "0") != 0)
- abort ();
+ assert (strcmp (unicode_attributes[combined].combining, "0") == 0);
fprintf (stream, "\"\\x%02x\\x%02x\\x%02x\\x%02x\\x%02x\\x%02x\", 0x%04x\n",
(code1 >> 16) & 0xff, (code1 >> 8) & 0xff, code1 & 0xff,
if (cfrule->language == NULL && cfrule->mapping[1] == 0)
{
ch = cfrule->code;
- if (!(ch < 0x110000))
- abort ();
+ assert (ch < 0x110000);
unicode_casefold[ch] = cfrule->mapping[0];
}
}
if (rule->language != NULL)
{
- if (strlen (rule->language) != 2)
- abort ();
+ assert (strlen (rule->language) == 2);
fprintf (stream, "{ '%c', '%c' }, ", rule->language[0], rule->language[1]);
}
else