lib: Support uppercase hex conversions.
Uppercase hex number conversions fail for abtol, strtol, strtoul, strtoull, atoi, and abtod. The following patch fixes it. This allows tcc to handle assembly language, which is necessary to build the Fiwix kernel as part of the kernel bootstrapping in progress for the live-bootstrap project. * lib/ctype/isxdigit.c (isxdigit): Also allow A-F. * lib/mes/abtol.c (abtol): Also cater for A-F.
This commit is contained in:
parent
1e14c26305
commit
b28f42de07
|
@ -1,6 +1,7 @@
|
||||||
/* -*-comment-start: "//";comment-end:""-*-
|
/* -*-comment-start: "//";comment-end:""-*-
|
||||||
* GNU Mes --- Maxwell Equations of Software
|
* GNU Mes --- Maxwell Equations of Software
|
||||||
* Copyright © 2016,2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
* Copyright © 2016,2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||||
|
* Copyright © 2023 Rick Masters <grick23@gmail.com>
|
||||||
*
|
*
|
||||||
* This file is part of GNU Mes.
|
* This file is part of GNU Mes.
|
||||||
*
|
*
|
||||||
|
|
|
@ -24,5 +24,5 @@
|
||||||
int
|
int
|
||||||
isxdigit (int c)
|
isxdigit (int c)
|
||||||
{
|
{
|
||||||
return isdigit (c) || (c >= 'a' && c <= 'f');
|
return isdigit (c) || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F');
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* -*-comment-start: "//";comment-end:""-*-
|
/* -*-comment-start: "//";comment-end:""-*-
|
||||||
* GNU Mes --- Maxwell Equations of Software
|
* GNU Mes --- Maxwell Equations of Software
|
||||||
* Copyright © 2016,2017,2018,2019,2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
* Copyright © 2016,2017,2018,2019,2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||||
* Copyright © 2022 Rick Masters <grick23@gmail.com>
|
* Copyright © 2022,2023 Rick Masters <grick23@gmail.com>
|
||||||
*
|
*
|
||||||
* This file is part of GNU Mes.
|
* This file is part of GNU Mes.
|
||||||
*
|
*
|
||||||
|
@ -43,10 +43,15 @@ abtol (char const **p, int base)
|
||||||
while (isnumber (s[0], base) != 0)
|
while (isnumber (s[0], base) != 0)
|
||||||
{
|
{
|
||||||
i = i * base;
|
i = i * base;
|
||||||
if (s[0] > '9')
|
if (s[0] >= 'a')
|
||||||
m = 'a' - 10;
|
m = 'a' - 10;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (s[0] >= 'A')
|
||||||
|
m = 'A' - 10;
|
||||||
else
|
else
|
||||||
m = '0';
|
m = '0';
|
||||||
|
}
|
||||||
i = i + s[0] - m;
|
i = i + s[0] - m;
|
||||||
s = s + 1;
|
s = s + 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue