merge branches/phobos-1.x@261 through branches/phobos-1.x@263

This commit is contained in:
Brad Roberts 2007-09-10 07:27:04 +00:00
parent 35ef260fcd
commit 39927abf9e
7 changed files with 324 additions and 228 deletions

View file

@ -145,6 +145,7 @@ void gc_init()
void gc_term() void gc_term()
{ {
_gc.fullCollectNoStack(); _gc.fullCollectNoStack();
_gc.Dtor();
} }
Object _d_newclass(ClassInfo ci) Object _d_newclass(ClassInfo ci)
@ -157,6 +158,7 @@ Object _d_newclass(ClassInfo ci)
p = std.c.stdlib.malloc(ci.init.length); p = std.c.stdlib.malloc(ci.init.length);
if (!p) if (!p)
_d_OutOfMemory(); _d_OutOfMemory();
debug(PRINTF) printf(" COM object p = %p\n", p);
} }
else else
{ {

View file

@ -60,7 +60,7 @@ OBJS = asserterror.o deh2.o switch.o complex.o gcstats.o \
socket.o socketstream.o stdarg.o stdio.o format.o \ socket.o socketstream.o stdarg.o stdio.o format.o \
perf.o openrj.o uni.o trace.o boxer.o \ perf.o openrj.o uni.o trace.o boxer.o \
demangle.o cover.o bitarray.o bind.o aApplyR.o \ demangle.o cover.o bitarray.o bind.o aApplyR.o \
signals.o cpuid.o traits.o typetuple.o \ signals.o cpuid.o traits.o typetuple.o loader.o \
c_stdio.o \ c_stdio.o \
ti_wchar.o ti_uint.o ti_short.o ti_ushort.o \ ti_wchar.o ti_uint.o ti_short.o ti_ushort.o \
ti_byte.o ti_ubyte.o ti_long.o ti_ulong.o ti_ptr.o \ ti_byte.o ti_ubyte.o ti_long.o ti_ulong.o ti_ptr.o \
@ -357,6 +357,9 @@ format.o : std/format.d
gc.o : std/gc.d gc.o : std/gc.d
$(DMD) -c $(DFLAGS) std/gc.d $(DMD) -c $(DFLAGS) std/gc.d
loader.o : std/loader.d
$(DMD) -c $(DFLAGS) std/loader.d
math.o : std/math.d math.o : std/math.d
$(DMD) -c $(DFLAGS) std/math.d $(DMD) -c $(DFLAGS) std/math.d

View file

@ -1,4 +1,3 @@
// Written in the D programming language. // Written in the D programming language.
/* /*
@ -14,6 +13,7 @@
/* Authors: /* Authors:
* Walter Bright, Digital Mars, www.digitalmars.com * Walter Bright, Digital Mars, www.digitalmars.com
* Thomas Kuehne * Thomas Kuehne
* Frits van Bommel
*/ */
module std.demangle; module std.demangle;
@ -97,7 +97,7 @@ string demangle(string name)
error(); error();
return cast(ubyte) return cast(ubyte)
( (c >= 'a') ? c - 'a' + 10 : ( (c >= 'a') ? c - 'a' + 10 :
(c >= 'A') ? c - 'A' + 10 : (c >= 'A') ? c - 'A' + 10 :
c - '0' c - '0'
); );
} }
@ -172,6 +172,7 @@ string demangle(string name)
{ {
//writefln("parseType() %d", ni); //writefln("parseType() %d", ni);
int isdelegate = 0; int isdelegate = 0;
bool hasthisptr = false; /// For function/delegate types: expects a 'this' pointer as last argument
Lagain: Lagain:
if (ni >= name.length) if (ni >= name.length)
error(); error();
@ -179,8 +180,7 @@ string demangle(string name)
switch (name[ni++]) switch (name[ni++])
{ {
case 'v': p = "void"; goto L1; case 'v': p = "void"; goto L1;
case 'b': p = "bit"; goto L1; case 'b': p = "bool"; goto L1;
case 'x': p = "bool"; goto L1;
case 'g': p = "byte"; goto L1; case 'g': p = "byte"; goto L1;
case 'h': p = "ubyte"; goto L1; case 'h': p = "ubyte"; goto L1;
case 's': p = "short"; goto L1; case 's': p = "short"; goto L1;
@ -227,6 +227,10 @@ string demangle(string name)
isdelegate = 1; isdelegate = 1;
goto Lagain; goto Lagain;
case 'M':
hasthisptr = true;
goto Lagain;
case 'F': // D function case 'F': // D function
case 'U': // C function case 'U': // C function
case 'W': // Windows function case 'W': // Windows function
@ -244,7 +248,8 @@ string demangle(string name)
break; break;
if (c == 'X') if (c == 'X')
{ {
args ~= " ..."; if (!args.length) error();
args ~= " ...";
break; break;
} }
if (args.length) if (args.length)
@ -276,6 +281,12 @@ string demangle(string name)
} }
break; break;
} }
if (hasthisptr || isdelegate) {
// add implicit 'this'/context pointer
if (args.length)
args ~= ", ";
args ~= "void*";
}
ni++; ni++;
if (!isdelegate && identifier.length) if (!isdelegate && identifier.length)
{ {
@ -414,9 +425,8 @@ string demangle(string name)
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
{ char c; { char c;
c = cast(char) c = (ascii2hex(name[ni + i * 2]) << 4) +
((ascii2hex(name[ni + i * 2]) << 4) + ascii2hex(name[ni + i * 2 + 1]);
ascii2hex(name[ni + i * 2 + 1]));
result ~= c; result ~= c;
} }
ni += n * 2; ni += n * 2;
@ -461,6 +471,10 @@ string demangle(string name)
{ {
auto result = parseQualifiedName(); auto result = parseQualifiedName();
result = parseType(result); result = parseType(result);
while(ni < name.length){
result ~= " . " ~ parseType(parseQualifiedName());
}
if (ni != name.length) if (ni != name.length)
goto Lnot; goto Lnot;
return result; return result;
@ -505,3 +519,5 @@ unittest
} }

View file

@ -1,3 +1,6 @@
// Written in the D programming language.
/** /**
* This module implements the workhorse functionality for string and I/O formatting. * This module implements the workhorse functionality for string and I/O formatting.
* It's comparable to C99's vsprintf(). * It's comparable to C99's vsprintf().
@ -917,6 +920,8 @@ void doFormat(void delegate(dchar) putc, TypeInfo[] arguments, va_list argptr)
case Mangle.Tstruct: case Mangle.Tstruct:
{ TypeInfo_Struct tis = cast(TypeInfo_Struct)ti; { TypeInfo_Struct tis = cast(TypeInfo_Struct)ti;
if (tis.xtoString is null)
throw new FormatError("Can't convert " ~ tis.toString() ~ " to string: \"string toString()\" not defined");
s = tis.xtoString(argptr); s = tis.xtoString(argptr);
argptr += (tis.tsize() + 3) & ~3; argptr += (tis.tsize() + 3) & ~3;
goto Lputstr; goto Lputstr;

View file

@ -1,3 +1,6 @@
// Written in the D programming language.
/* ///////////////////////////////////////////////////////////////////////////// /* /////////////////////////////////////////////////////////////////////////////
* File: loader.d (originally from synsoft.win32.loader) * File: loader.d (originally from synsoft.win32.loader)
* *
@ -71,18 +74,11 @@ version(Windows)
} }
else version(linux) else version(linux)
{ {
private import std.c.linux.linux;
extern(C) extern(C)
{ {
const int RTLD_NOW = 0x00002; /* Correct for Red Hat 8 */ alias void* HModule_;
typedef void *HModule_;
HModule_ dlopen(char *path, int mode);
int dlclose(HModule_ handle);
void *dlsym(HModule_ handle, char *symbolName);
char *dlerror();
char* strerror(int);
} }
} }
else else
@ -312,7 +308,8 @@ else version(linux)
} }
body body
{ {
ExeModuleInfo mi = s_modules[moduleName]; ExeModuleInfo* mi_p = moduleName in s_modules;
ExeModuleInfo mi = mi_p is null ? null : *mi_p;
if(null !is mi) if(null !is mi)
{ {
@ -330,11 +327,11 @@ else version(linux)
} }
else else
{ {
ExeModuleInfo mi = new ExeModuleInfo(hmod, moduleName); ExeModuleInfo mi2 = new ExeModuleInfo(hmod, moduleName);
s_modules[moduleName] = mi; s_modules[moduleName] = mi2;
return cast(HXModule)mi; return cast(HXModule)mi2;
} }
} }
} }
@ -391,7 +388,7 @@ else version(linux)
{ {
record_error_(); record_error_();
} }
delete s_modules[name]; s_modules.remove(name);
delete mi; delete mi;
} }

View file

@ -1,3 +1,5 @@
// Written in the D programming language
/* /*
Copyright (C) 2004-2005 Christopher E. Miller Copyright (C) 2004-2005 Christopher E. Miller
@ -752,44 +754,21 @@ extern(C) struct timeval
class SocketSet class SocketSet
{ {
private: private:
uint nbytes; // Win32: excludes uint.sizeof "count". uint maxsockets; /// max desired sockets, the fd_set might be capable of holding more
byte* buf; fd_set set;
version(Win32) version(Win32)
{ {
uint count() uint count()
{ {
return *(cast(uint*)buf); return set.fd_count;
}
void count(int setter)
{
*(cast(uint*)buf) = setter;
}
socket_t* first()
{
return cast(socket_t*)(buf + uint.sizeof);
} }
} }
else version(BsdSockets) else version(BsdSockets)
{ {
int maxfd = -1; int maxfd;
uint count;
socket_t* first()
{
return cast(socket_t*)buf;
}
}
fd_set* _fd_set()
{
return cast(fd_set*)buf;
} }
@ -798,19 +777,8 @@ class SocketSet
/// Set the maximum amount of sockets that may be added. /// Set the maximum amount of sockets that may be added.
this(uint max) this(uint max)
{ {
version(Win32) maxsockets = max;
{ reset();
nbytes = max * socket_t.sizeof;
buf = (new byte[nbytes + uint.sizeof]).ptr;
count = 0;
}
else version(BsdSockets)
{
nbytes = max / NFDBITS * socket_t.sizeof;
if(max % NFDBITS)
nbytes += socket_t.sizeof;
buf = (new byte[nbytes]).ptr; // new initializes to 0.
}
} }
/// Uses the default maximum for the system. /// Uses the default maximum for the system.
@ -822,14 +790,12 @@ class SocketSet
/// Reset the SocketSet so that there are 0 Sockets in the collection. /// Reset the SocketSet so that there are 0 Sockets in the collection.
void reset() void reset()
{ {
version(Win32) FD_ZERO(&set);
{
count = 0; version(BsdSockets)
}
else version(BsdSockets)
{ {
maxfd = -1; maxfd = -1;
buf[0 .. nbytes] = 0; count = 0;
} }
} }
@ -838,21 +804,19 @@ class SocketSet
in in
{ {
// Make sure too many sockets don't get added. // Make sure too many sockets don't get added.
version(Win32) assert(count < maxsockets);
version(BsdSockets)
{ {
assert(count < max); assert(FDELT(s) < (FD_SETSIZE / NFDBITS));
}
else version(BsdSockets)
{
assert(FDELT(s) < nbytes / socket_t.sizeof);
} }
} }
body body
{ {
FD_SET(s, _fd_set); FD_SET(s, &set);
version(BsdSockets) version(BsdSockets)
{ {
++count;
if(s > maxfd) if(s > maxfd)
maxfd = s; maxfd = s;
} }
@ -866,7 +830,12 @@ class SocketSet
void remove(socket_t s) void remove(socket_t s)
{ {
FD_CLR(s, _fd_set); FD_CLR(s, &set);
version(BsdSockets)
{
--count;
// note: adjusting maxfd would require scanning the set, not worth it
}
} }
@ -878,7 +847,7 @@ class SocketSet
int isSet(socket_t s) int isSet(socket_t s)
{ {
return FD_ISSET(s, _fd_set); return FD_ISSET(s, &set);
} }
@ -892,24 +861,13 @@ class SocketSet
/// Return maximum amount of sockets that can be added, like FD_SETSIZE. /// Return maximum amount of sockets that can be added, like FD_SETSIZE.
uint max() uint max()
{ {
version(Win32) return maxsockets;
{
return nbytes / socket_t.sizeof;
}
else version(BsdSockets)
{
return nbytes / socket_t.sizeof * NFDBITS;
}
else
{
static assert(0);
}
} }
fd_set* toFd_set() fd_set* toFd_set()
{ {
return _fd_set; return &set;
} }
@ -917,7 +875,7 @@ class SocketSet
{ {
version(Win32) version(Win32)
{ {
return 0; return count;
} }
else version(BsdSockets) else version(BsdSockets)
{ {

383
std/uni.d
View file

@ -180,91 +180,73 @@ dchar toUniUpper(dchar c)
/******************************* /*******************************
* Return !=0 if u is a Unicode alpha character. * Return !=0 if u is a Unicode alpha character.
* (general Unicode category: Lu, Ll, Lt, Lm and Lo)
*
* Standards: Unicode 5.0.0
*/ */
int isUniAlpha(dchar u) int isUniAlpha(dchar u)
{ {
static ushort table[][2] = static dchar table[][2] =
[ [
[ 'A', 'Z' ], [ 'A', 'Z' ],
[ 'a', 'z' ], [ 'a', 'z' ],
[ 0x00AA, 0x00AA ], [ 0x00AA, 0x00AA ],
[ 0x00B5, 0x00B5 ], [ 0x00B5, 0x00B5 ],
[ 0x00B7, 0x00B7 ],
[ 0x00BA, 0x00BA ], [ 0x00BA, 0x00BA ],
[ 0x00C0, 0x00D6 ], [ 0x00C0, 0x00D6 ],
[ 0x00D8, 0x00F6 ], [ 0x00D8, 0x00F6 ],
[ 0x00F8, 0x01F5 ], [ 0x00F8, 0x02C1 ],
[ 0x01FA, 0x0217 ], [ 0x02C6, 0x02D1 ],
[ 0x0250, 0x02A8 ],
[ 0x02B0, 0x02B8 ],
[ 0x02BB, 0x02BB ],
[ 0x02BD, 0x02C1 ],
[ 0x02D0, 0x02D1 ],
[ 0x02E0, 0x02E4 ], [ 0x02E0, 0x02E4 ],
[ 0x037A, 0x037A ], [ 0x02EE, 0x02EE ],
[ 0x037A, 0x037D ],
[ 0x0386, 0x0386 ], [ 0x0386, 0x0386 ],
[ 0x0388, 0x038A ], [ 0x0388, 0x038A ],
[ 0x038C, 0x038C ], [ 0x038C, 0x038C ],
[ 0x038E, 0x03A1 ], [ 0x038E, 0x03A1 ],
[ 0x03A3, 0x03CE ], [ 0x03A3, 0x03CE ],
[ 0x03D0, 0x03D6 ], [ 0x03D0, 0x03F5 ],
[ 0x03DA, 0x03DA ], [ 0x03F7, 0x0481 ],
[ 0x03DC, 0x03DC ], [ 0x048A, 0x0513 ],
[ 0x03DE, 0x03DE ],
[ 0x03E0, 0x03E0 ],
[ 0x03E2, 0x03F3 ],
[ 0x0401, 0x040C ],
[ 0x040E, 0x044F ],
[ 0x0451, 0x045C ],
[ 0x045E, 0x0481 ],
[ 0x0490, 0x04C4 ],
[ 0x04C7, 0x04C8 ],
[ 0x04CB, 0x04CC ],
[ 0x04D0, 0x04EB ],
[ 0x04EE, 0x04F5 ],
[ 0x04F8, 0x04F9 ],
[ 0x0531, 0x0556 ], [ 0x0531, 0x0556 ],
[ 0x0559, 0x0559 ], [ 0x0559, 0x0559 ],
[ 0x0561, 0x0587 ], [ 0x0561, 0x0587 ],
[ 0x05B0, 0x05B9 ],
[ 0x05BB, 0x05BD ],
[ 0x05BF, 0x05BF ],
[ 0x05C1, 0x05C2 ],
[ 0x05D0, 0x05EA ], [ 0x05D0, 0x05EA ],
[ 0x05F0, 0x05F2 ], [ 0x05F0, 0x05F2 ],
[ 0x0621, 0x063A ], [ 0x0621, 0x063A ],
[ 0x0640, 0x0652 ], [ 0x0640, 0x064A ],
[ 0x0660, 0x0669 ], [ 0x066E, 0x066F ],
[ 0x0670, 0x06B7 ], [ 0x0671, 0x06D3 ],
[ 0x06BA, 0x06BE ], [ 0x06D5, 0x06D5 ],
[ 0x06C0, 0x06CE ], [ 0x06E5, 0x06E6 ],
[ 0x06D0, 0x06DC ], [ 0x06EE, 0x06EF ],
[ 0x06E5, 0x06E8 ], [ 0x06FA, 0x06FC ],
[ 0x06EA, 0x06ED ], [ 0x06FF, 0x06FF ],
[ 0x06F0, 0x06F9 ], [ 0x0710, 0x0710 ],
[ 0x0901, 0x0903 ], [ 0x0712, 0x072F ],
[ 0x0905, 0x0939 ], [ 0x074D, 0x076D ],
[ 0x0780, 0x07A5 ],
[ 0x07B1, 0x07B1 ],
[ 0x07CA, 0x07EA ],
[ 0x07F4, 0x07F5 ],
[ 0x07FA, 0x07FA ],
[ 0x0904, 0x0939 ],
[ 0x093D, 0x093D ], [ 0x093D, 0x093D ],
[ 0x093E, 0x094D ], [ 0x0950, 0x0950 ],
[ 0x0950, 0x0952 ], [ 0x0958, 0x0961 ],
[ 0x0958, 0x0963 ], [ 0x097B, 0x097F ],
[ 0x0966, 0x096F ],
[ 0x0981, 0x0983 ],
[ 0x0985, 0x098C ], [ 0x0985, 0x098C ],
[ 0x098F, 0x0990 ], [ 0x098F, 0x0990 ],
[ 0x0993, 0x09A8 ], [ 0x0993, 0x09A8 ],
[ 0x09AA, 0x09B0 ], [ 0x09AA, 0x09B0 ],
[ 0x09B2, 0x09B2 ], [ 0x09B2, 0x09B2 ],
[ 0x09B6, 0x09B9 ], [ 0x09B6, 0x09B9 ],
[ 0x09BE, 0x09C4 ], [ 0x09BD, 0x09BD ],
[ 0x09C7, 0x09C8 ], [ 0x09CE, 0x09CE ],
[ 0x09CB, 0x09CD ],
[ 0x09DC, 0x09DD ], [ 0x09DC, 0x09DD ],
[ 0x09DF, 0x09E3 ], [ 0x09DF, 0x09E1 ],
[ 0x09E6, 0x09EF ],
[ 0x09F0, 0x09F1 ], [ 0x09F0, 0x09F1 ],
[ 0x0A02, 0x0A02 ],
[ 0x0A05, 0x0A0A ], [ 0x0A05, 0x0A0A ],
[ 0x0A0F, 0x0A10 ], [ 0x0A0F, 0x0A10 ],
[ 0x0A13, 0x0A28 ], [ 0x0A13, 0x0A28 ],
@ -272,42 +254,29 @@ int isUniAlpha(dchar u)
[ 0x0A32, 0x0A33 ], [ 0x0A32, 0x0A33 ],
[ 0x0A35, 0x0A36 ], [ 0x0A35, 0x0A36 ],
[ 0x0A38, 0x0A39 ], [ 0x0A38, 0x0A39 ],
[ 0x0A3E, 0x0A42 ],
[ 0x0A47, 0x0A48 ],
[ 0x0A4B, 0x0A4D ],
[ 0x0A59, 0x0A5C ], [ 0x0A59, 0x0A5C ],
[ 0x0A5E, 0x0A5E ], [ 0x0A5E, 0x0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C ],
[ 0x166F, 0x1676 ],
[ 0x1681, 0x169A ],
[ 0x16A0, 0x16EA ],
[ 0x1700, 0x170C ],
[ 0x170E, 0x1711 ],
[ 0x1720, 0x1731 ],
[ 0x1740, 0x1751 ],
[ 0x1760, 0x176C ],
[ 0x176E, 0x1770 ],
[ 0x1780, 0x17B3 ],
[ 0x17D7, 0x17D7 ],
[ 0x17DC, 0x17DC ],
[ 0x1820, 0x1877 ],
[ 0x1880, 0x18A8 ],
[ 0x1900, 0x191C ],
[ 0x1950, 0x196D ],
[ 0x1970, 0x1974 ],
[ 0x1980, 0x19A9 ],
[ 0x19C1, 0x19C7 ],
[ 0x1A00, 0x1A16 ],
[ 0x1B05, 0x1B33 ],
[ 0x1B45, 0x1B4B ],
[ 0x1D00, 0x1DBF ],
[ 0x1E00, 0x1E9B ], [ 0x1E00, 0x1E9B ],
[ 0x1EA0, 0x1EF9 ], [ 0x1EA0, 0x1EF9 ],
[ 0x1F00, 0x1F15 ], [ 0x1F00, 0x1F15 ],
@ -417,30 +407,145 @@ int isUniAlpha(dchar u)
[ 0x1FE0, 0x1FEC ], [ 0x1FE0, 0x1FEC ],
[ 0x1FF2, 0x1FF4 ], [ 0x1FF2, 0x1FF4 ],
[ 0x1FF6, 0x1FFC ], [ 0x1FF6, 0x1FFC ],
[ 0x203F, 0x2040 ], [ 0x2071, 0x2071 ],
[ 0x207F, 0x207F ], [ 0x207F, 0x207F ],
[ 0x2090, 0x2094 ],
[ 0x2102, 0x2102 ], [ 0x2102, 0x2102 ],
[ 0x2107, 0x2107 ], [ 0x2107, 0x2107 ],
[ 0x210A, 0x2113 ], [ 0x210A, 0x2113 ],
[ 0x2115, 0x2115 ], [ 0x2115, 0x2115 ],
[ 0x2118, 0x211D ], [ 0x2119, 0x211D ],
[ 0x2124, 0x2124 ], [ 0x2124, 0x2124 ],
[ 0x2126, 0x2126 ], [ 0x2126, 0x2126 ],
[ 0x2128, 0x2128 ], [ 0x2128, 0x2128 ],
[ 0x212A, 0x2131 ], [ 0x212A, 0x212D ],
[ 0x2133, 0x2138 ], [ 0x212F, 0x2139 ],
[ 0x2160, 0x2182 ], [ 0x213C, 0x213F ],
[ 0x3005, 0x3007 ], [ 0x2145, 0x2149 ],
[ 0x3021, 0x3029 ], [ 0x214E, 0x214E ],
[ 0x3041, 0x3093 ], [ 0x2183, 0x2184 ],
[ 0x309B, 0x309C ], [ 0x2C00, 0x2C2E ],
[ 0x30A1, 0x30F6 ], [ 0x2C30, 0x2C5E ],
[ 0x30FB, 0x30FC ], [ 0x2C60, 0x2C6C ],
[ 0x2C74, 0x2C77 ],
[ 0x2C80, 0x2CE4 ],
[ 0x2D00, 0x2D25 ],
[ 0x2D30, 0x2D65 ],
[ 0x2D6F, 0x2D6F ],
[ 0x2D80, 0x2D96 ],
[ 0x2DA0, 0x2DA6 ],
[ 0x2DA8, 0x2DAE ],
[ 0x2DB0, 0x2DB6 ],
[ 0x2DB8, 0x2DBE ],
[ 0x2DC0, 0x2DC6 ],
[ 0x2DC8, 0x2DCE ],
[ 0x2DD0, 0x2DD6 ],
[ 0x2DD8, 0x2DDE ],
[ 0x3005, 0x3006 ],
[ 0x3031, 0x3035 ],
[ 0x303B, 0x303C ],
[ 0x3041, 0x3096 ],
[ 0x309D, 0x309F ],
[ 0x30A1, 0x30FA ],
[ 0x30FC, 0x30FF ],
[ 0x3105, 0x312C ], [ 0x3105, 0x312C ],
[ 0x4E00, 0x9FA5 ], [ 0x3131, 0x318E ],
[ 0x31A0, 0x31B7 ],
[ 0x31F0, 0x31FF ],
[ 0x3400, 0x4DB5 ],
[ 0x4E00, 0x9FBB ],
[ 0xA000, 0xA48C ],
[ 0xA717, 0xA71A ],
[ 0xA800, 0xA801 ],
[ 0xA803, 0xA805 ],
[ 0xA807, 0xA80A ],
[ 0xA80C, 0xA822 ],
[ 0xA840, 0xA873 ],
[ 0xAC00, 0xD7A3 ], [ 0xAC00, 0xD7A3 ],
[ 0xF900, 0xFA2D ],
[ 0xFA30, 0xFA6A ],
[ 0xFA70, 0xFAD9 ],
[ 0xFB00, 0xFB06 ],
[ 0xFB13, 0xFB17 ],
[ 0xFB1D, 0xFB1D ],
[ 0xFB1F, 0xFB28 ],
[ 0xFB2A, 0xFB36 ],
[ 0xFB38, 0xFB3C ],
[ 0xFB3E, 0xFB3E ],
[ 0xFB40, 0xFB41 ],
[ 0xFB43, 0xFB44 ],
[ 0xFB46, 0xFBB1 ],
[ 0xFBD3, 0xFD3D ],
[ 0xFD50, 0xFD8F ],
[ 0xFD92, 0xFDC7 ],
[ 0xFDF0, 0xFDFB ],
[ 0xFE70, 0xFE74 ],
[ 0xFE76, 0xFEFC ],
[ 0xFF21, 0xFF3A ], [ 0xFF21, 0xFF3A ],
[ 0xFF41, 0xFF5A ], [ 0xFF41, 0xFF5A ],
[ 0xFF66, 0xFFBE ],
[ 0xFFC2, 0xFFC7 ],
[ 0xFFCA, 0xFFCF ],
[ 0xFFD2, 0xFFD7 ],
[ 0xFFDA, 0xFFDC ],
[ 0x10000, 0x1000B ],
[ 0x1000D, 0x10026 ],
[ 0x10028, 0x1003A ],
[ 0x1003C, 0x1003D ],
[ 0x1003F, 0x1004D ],
[ 0x10050, 0x1005D ],
[ 0x10080, 0x100FA ],
[ 0x10300, 0x1031E ],
[ 0x10330, 0x10340 ],
[ 0x10342, 0x10349 ],
[ 0x10380, 0x1039D ],
[ 0x103A0, 0x103C3 ],
[ 0x103C8, 0x103CF ],
[ 0x10400, 0x1049D ],
[ 0x10800, 0x10805 ],
[ 0x10808, 0x10808 ],
[ 0x1080A, 0x10835 ],
[ 0x10837, 0x10838 ],
[ 0x1083C, 0x1083C ],
[ 0x1083F, 0x1083F ],
[ 0x10900, 0x10915 ],
[ 0x10A00, 0x10A00 ],
[ 0x10A10, 0x10A13 ],
[ 0x10A15, 0x10A17 ],
[ 0x10A19, 0x10A33 ],
[ 0x12000, 0x1236E ],
[ 0x1D400, 0x1D454 ],
[ 0x1D456, 0x1D49C ],
[ 0x1D49E, 0x1D49F ],
[ 0x1D4A2, 0x1D4A2 ],
[ 0x1D4A5, 0x1D4A6 ],
[ 0x1D4A9, 0x1D4AC ],
[ 0x1D4AE, 0x1D4B9 ],
[ 0x1D4BB, 0x1D4BB ],
[ 0x1D4BD, 0x1D4C3 ],
[ 0x1D4C5, 0x1D505 ],
[ 0x1D507, 0x1D50A ],
[ 0x1D50D, 0x1D514 ],
[ 0x1D516, 0x1D51C ],
[ 0x1D51E, 0x1D539 ],
[ 0x1D53B, 0x1D53E ],
[ 0x1D540, 0x1D544 ],
[ 0x1D546, 0x1D546 ],
[ 0x1D54A, 0x1D550 ],
[ 0x1D552, 0x1D6A5 ],
[ 0x1D6A8, 0x1D6C0 ],
[ 0x1D6C2, 0x1D6DA ],
[ 0x1D6DC, 0x1D6FA ],
[ 0x1D6FC, 0x1D714 ],
[ 0x1D716, 0x1D734 ],
[ 0x1D736, 0x1D74E ],
[ 0x1D750, 0x1D76E ],
[ 0x1D770, 0x1D788 ],
[ 0x1D78A, 0x1D7A8 ],
[ 0x1D7AA, 0x1D7C2 ],
[ 0x1D7C4, 0x1D7CB ],
[ 0x20000, 0x2A6D6 ],
[ 0x2F800, 0x2FA1D ],
]; ];
debug debug
@ -457,8 +562,18 @@ int isUniAlpha(dchar u)
} }
} }
if (u > 0xD7A3 && u < 0xFF21) if (u < 0xAA)
{
if (u < 'A')
goto Lisnot;
if (u <= 'Z')
goto Lis;
if (u < 'a')
goto Lisnot;
if (u <= 'z')
goto Lis;
goto Lisnot; goto Lisnot;
}
// Binary search // Binary search
uint mid; uint mid;
@ -491,12 +606,12 @@ Lisnot:
Lis: Lis:
debug debug
{ {
for (int i = 0; 1; i++) for (int i = 0; i < table.length; i++)
{ {
assert(i < table.length); // should have been in table
if (u >= table[i][0] && u <= table[i][1]) if (u >= table[i][0] && u <= table[i][1])
break; return 1;
} }
assert(0); // should have been in table
} }
return 1; return 1;
} }