Fix ucnumber behavior

This commit is contained in:
Howard Chu 2004-05-31 06:25:25 +00:00
parent 6a41ca53ad
commit 23f3214f5e
4 changed files with 47 additions and 27 deletions

View file

@ -6,6 +6,18 @@
-------------------
####
NOTE: This library has been customized for use with OpenLDAP. The character
data tables are hardcoded into the library and the load/unload/reload
functions are no-ops. Also, the MUTT API claimed to be compatible with
John Cowan's library but its ucnumber behavior was broken. This has been
fixed in the OpenLDAP release.
By default, the implementation specific properties in MUTTUCData.txt are
not incorporated into the OpenLDAP build. You can supply them to ucgendat
and recreate uctable.h if you need them.
-- hyc@openldap.org
####
-----------------------------------------------------------------------------
@ -153,7 +165,15 @@ int ucnumber_lookup(unsigned long code, struct ucnumber *num)
This function determines if the code is a number and fills in the `num'
field with the numerator and denominator. If the code happens to be a
single digit, the numerator and denominator fields will be the same.
single digit, the denominator field will be 1.
####
The original code would set numerator = denominator for regular digits.
However, the Readme also claimed to be compatible with John Cowan's uctype
library, but this behavior is both nonsensical and incompatible with the
Cowan library. As such, it has been fixed here as described above.
-- hyc@openldap.org
####
If the function returns 0, the code is not a number. Any other return
value means the code is a number.

View file

@ -1432,7 +1432,7 @@ main(void)
printf("0x10000 NOT DEFINED\n");
if (ucnumber_lookup(0x30, &num)) {
if (num.numerator != num.denominator)
if (num.denominator != 1)
printf("UCNUMBER: 0x30 = %d/%d\n", num.numerator, num.denominator);
else
printf("UCNUMBER: 0x30 = %d\n", num.numerator);
@ -1440,7 +1440,7 @@ main(void)
printf("UCNUMBER: 0x30 NOT A NUMBER\n");
if (ucnumber_lookup(0xbc, &num)) {
if (num.numerator != num.denominator)
if (num.denominator != 1)
printf("UCNUMBER: 0xbc = %d/%d\n", num.numerator, num.denominator);
else
printf("UCNUMBER: 0xbc = %d\n", num.numerator);
@ -1449,7 +1449,7 @@ main(void)
if (ucnumber_lookup(0xff19, &num)) {
if (num.numerator != num.denominator)
if (num.denominator != 1)
printf("UCNUMBER: 0xff19 = %d/%d\n", num.numerator, num.denominator);
else
printf("UCNUMBER: 0xff19 = %d\n", num.numerator);
@ -1457,7 +1457,7 @@ main(void)
printf("UCNUMBER: 0xff19 NOT A NUMBER\n");
if (ucnumber_lookup(0x4e00, &num)) {
if (num.numerator != num.denominator)
if (num.denominator != 1)
printf("UCNUMBER: 0x4e00 = %d/%d\n", num.numerator, num.denominator);
else
printf("UCNUMBER: 0x4e00 = %d\n", num.numerator);
@ -1473,19 +1473,19 @@ main(void)
printf("UCGETDIGIT: 0x969 = %d\n", dig);
num = ucgetnumber(0x30);
if (num.numerator != num.denominator)
if (num.denominator != 1)
printf("UCGETNUMBER: 0x30 = %d/%d\n", num.numerator, num.denominator);
else
printf("UCGETNUMBER: 0x30 = %d\n", num.numerator);
num = ucgetnumber(0xbc);
if (num.numerator != num.denominator)
if (num.denominator != 1)
printf("UCGETNUMBER: 0xbc = %d/%d\n", num.numerator, num.denominator);
else
printf("UCGETNUMBER: 0xbc = %d\n", num.numerator);
num = ucgetnumber(0xff19);
if (num.numerator != num.denominator)
if (num.denominator != 1)
printf("UCGETNUMBER: 0xff19 = %d/%d\n", num.numerator, num.denominator);
else
printf("UCGETNUMBER: 0xff19 = %d\n", num.numerator);

View file

@ -1077,7 +1077,7 @@ read_cdata(FILE *in)
* Adjust the denominator in case of integers and add the number.
*/
if (wnum == 0)
number[1] = number[0];
number[1] = 1;
add_number(code, number[0], number[1]);
}

View file

@ -14292,26 +14292,26 @@ static const ac_uint4 _ucnum_nodes[] = {
};
static const short _ucnum_vals[] = {
0x0000, 0x0000, 0x0001, 0x0001, 0x0002, 0x0002, 0x0003, 0x0003,
0x0004, 0x0004, 0x0005, 0x0005, 0x0006, 0x0006, 0x0007, 0x0007,
0x0008, 0x0008, 0x0009, 0x0009, 0x0001, 0x0004, 0x0001, 0x0002,
0x0003, 0x0004, 0x0010, 0x0010, 0x000a, 0x000a, 0x0064, 0x0064,
0x03e8, 0x03e8, 0x0003, 0x0002, 0x0005, 0x0002, 0x0007, 0x0002,
0x0000, 0x0001, 0x0001, 0x0001, 0x0002, 0x0001, 0x0003, 0x0001,
0x0004, 0x0001, 0x0005, 0x0001, 0x0006, 0x0001, 0x0007, 0x0001,
0x0008, 0x0001, 0x0009, 0x0001, 0x0001, 0x0004, 0x0001, 0x0002,
0x0003, 0x0004, 0x0010, 0x0001, 0x000a, 0x0001, 0x0064, 0x0001,
0x03e8, 0x0001, 0x0003, 0x0002, 0x0005, 0x0002, 0x0007, 0x0002,
0x0009, 0x0002, 0x000b, 0x0002, 0x000d, 0x0002, 0x000f, 0x0002,
0x0011, 0x0002, -1, 0x0002, 0x0014, 0x0014, 0x001e, 0x001e,
0x0028, 0x0028, 0x0032, 0x0032, 0x003c, 0x003c, 0x0046, 0x0046,
0x0050, 0x0050, 0x005a, 0x005a, 0x2710, 0x2710, 0x0011, 0x0011,
0x0012, 0x0012, 0x0013, 0x0013, 0x0001, 0x0003, 0x0002, 0x0003,
0x0011, 0x0002, -1, 0x0002, 0x0014, 0x0001, 0x001e, 0x0001,
0x0028, 0x0001, 0x0032, 0x0001, 0x003c, 0x0001, 0x0046, 0x0001,
0x0050, 0x0001, 0x005a, 0x0001, 0x2710, 0x0001, 0x0011, 0x0001,
0x0012, 0x0001, 0x0013, 0x0001, 0x0001, 0x0003, 0x0002, 0x0003,
0x0001, 0x0005, 0x0002, 0x0005, 0x0003, 0x0005, 0x0004, 0x0005,
0x0001, 0x0006, 0x0005, 0x0006, 0x0001, 0x0008, 0x0003, 0x0008,
0x0005, 0x0008, 0x0007, 0x0008, 0x000b, 0x000b, 0x000c, 0x000c,
0x01f4, 0x01f4, 0x1388, 0x1388, 0x000d, 0x000d, 0x000e, 0x000e,
0x000f, 0x000f, 0x0015, 0x0015, 0x0016, 0x0016, 0x0017, 0x0017,
0x0018, 0x0018, 0x0019, 0x0019, 0x001a, 0x001a, 0x001b, 0x001b,
0x001c, 0x001c, 0x001d, 0x001d, 0x001f, 0x001f, 0x0020, 0x0020,
0x0021, 0x0021, 0x0022, 0x0022, 0x0023, 0x0023, 0x0024, 0x0024,
0x0025, 0x0025, 0x0026, 0x0026, 0x0027, 0x0027, 0x0029, 0x0029,
0x002a, 0x002a, 0x002b, 0x002b, 0x002c, 0x002c, 0x002d, 0x002d,
0x002e, 0x002e, 0x002f, 0x002f, 0x0030, 0x0030, 0x0031, 0x0031
0x0005, 0x0008, 0x0007, 0x0008, 0x000b, 0x0001, 0x000c, 0x0001,
0x01f4, 0x0001, 0x1388, 0x0001, 0x000d, 0x0001, 0x000e, 0x0001,
0x000f, 0x0001, 0x0015, 0x0001, 0x0016, 0x0001, 0x0017, 0x0001,
0x0018, 0x0001, 0x0019, 0x0001, 0x001a, 0x0001, 0x001b, 0x0001,
0x001c, 0x0001, 0x001d, 0x0001, 0x001f, 0x0001, 0x0020, 0x0001,
0x0021, 0x0001, 0x0022, 0x0001, 0x0023, 0x0001, 0x0024, 0x0001,
0x0025, 0x0001, 0x0026, 0x0001, 0x0027, 0x0001, 0x0029, 0x0001,
0x002a, 0x0001, 0x002b, 0x0001, 0x002c, 0x0001, 0x002d, 0x0001,
0x002e, 0x0001, 0x002f, 0x0001, 0x0030, 0x0001, 0x0031, 0x0001
};