MCPcopy Create free account
hub / github.com/NetHack/NetHack / unicode_val

Function unicode_val

src/utf8map.c:17–34  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15/* hexdd[] is defined in decl.c */
16
17int
18unicode_val(const char *cp)
19{
20 const char *dp;
21 int cval = 0, dcount;
22
23 if (cp && *cp) {
24 cval = dcount = 0;
25 if ((*cp == 'U' || *cp == 'u')
26 && cp[1] == '+' && cp[2] && (dp = strchr(hexdd, cp[2])) != 0) {
27 cp += 2; /* move past the 'U' and '+' */
28 do {
29 cval = (cval * 16) + ((int) (dp - hexdd) / 2);
30 } while (*++cp && (dp = strchr(hexdd, *cp)) != 0 && ++dcount < 7);
31 }
32 }
33 return cval;
34}
35
36int
37set_map_u(glyph_map *gmap, uint32 utf32ch, const uint8 *utf8str)

Callers 2

to_unicode_callbackFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected