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

Function decode_glyph

src/windows.c:1438–1463  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1436/* hexdd[] is defined in decl.c */
1437
1438int
1439decode_glyph(const char *str, int *glyph_ptr)
1440{
1441 int rndchk = 0, dcount = 0, retval = 0;
1442 const char *dp;
1443
1444 for (; *str && ++dcount <= 4; ++str) {
1445 if ((dp = strchr(hexdd, *str)) != 0) {
1446 retval++;
1447 rndchk = (rndchk * 16) + ((int) (dp - hexdd) / 2);
1448 } else
1449 break;
1450 }
1451 if (rndchk == svc.context.rndencode) {
1452 *glyph_ptr = dcount = 0;
1453 for (; *str && ++dcount <= 4; ++str) {
1454 if ((dp = strchr(hexdd, *str)) != 0) {
1455 retval++;
1456 *glyph_ptr = (*glyph_ptr * 16) + ((int) (dp - hexdd) / 2);
1457 } else
1458 break;
1459 }
1460 return retval;
1461 }
1462 return 0;
1463}
1464
1465char *
1466decode_mixed(char *buf, const char *str)

Callers 3

mixed_to_utf8Function · 0.85
decode_mixedFunction · 0.85
mixed_to_glyphinfoFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected