Mercurial > projects > ddmd
annotate dmd/Utf.d @ 191:52188e7e3fb5
Fixed deprecated features, now compiles with DMD2.058
Also changed Array allocation policy:
Now doesn't reallocate but malloc's, followed by a memcpy (no free).
(this fixes a crash while compiling druntime. Same bug in dmd)
author | korDen@korDen-pc |
---|---|
date | Sun, 25 Mar 2012 03:11:12 +0400 |
parents | e28b18c23469 |
children |
rev | line source |
---|---|
0 | 1 module dmd.Utf; |
2 | |
114 | 3 import dmd.common; |
0 | 4 import dmd.Dchar; |
5 | |
6 import std.utf; | |
7 | |
8 string utf_decodeChar(const(char)[] s, size_t* pidx, dchar* presult) | |
9 { | |
10 try { | |
11 *presult = decode(s, *pidx); | |
12 } catch (Exception e) { | |
13 return e.toString(); | |
14 } | |
15 | |
16 return null; | |
17 } | |
18 | |
19 string utf_decodeWchar(const(wchar)[] s, size_t* pidx, dchar* presult) | |
20 { | |
20
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
21 try { |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
22 *presult = decode(s, *pidx); |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
23 } catch (Exception e) { |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
24 return e.toString(); |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
25 } |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
26 |
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
27 return null; |
0 | 28 } |
29 | |
30 bool utf_isValidDchar(uint c) | |
31 { | |
32 return isValidDchar(c); | |
33 } | |
34 | |
20
1628b221808d
Fleshed out more unimplemented methods.
Robert Clipsham <robert@octarineparrot.com>
parents:
0
diff
changeset
|
35 extern (C++) extern int HtmlNamedEntity(ubyte* p, int length); |