From: Jan Nieuwenhuizen Date: Wed, 3 Jul 2019 09:22:57 +0000 (+0200) Subject: mescc: Mes C Library: Support GNU Awk: Implement atof. X-Git-Tag: v0.21~38 X-Git-Url: https://jxself.org/git/?p=mes.git;a=commitdiff_plain;h=8d45c6484f45db4b8125f7d07743a99caa7b6c5c mescc: Mes C Library: Support GNU Awk: Implement atof. * lib/stdlib/atoi.c: Update. * lib/stdlib/atof.c: Rename from stub/atof.c; Implement. * lib/libc+gnu.c: Update include. * lib/libg.c: Update include. --- diff --git a/build-aux/configure-lib.sh b/build-aux/configure-lib.sh index 0cecaccf..0831f210 100644 --- a/build-aux/configure-lib.sh +++ b/build-aux/configure-lib.sh @@ -249,6 +249,7 @@ lib/stdlib/abort.c lib/stdlib/abs.c lib/stdlib/alloca.c lib/stdlib/atexit.c +lib/stdlib/atof.c lib/stdlib/atol.c lib/stdlib/mbstowcs.c lib/string/bcmp.c diff --git a/lib/stdlib/atof.c b/lib/stdlib/atof.c new file mode 100644 index 00000000..8bcacfcf --- /dev/null +++ b/lib/stdlib/atof.c @@ -0,0 +1,28 @@ +/* -*-comment-start: "//";comment-end:""-*- + * GNU Mes --- Maxwell Equations of Software + * Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen + * + * This file is part of GNU Mes. + * + * GNU Mes is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * GNU Mes is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Mes. If not, see . + */ + +#include + +double +atof (char const *string) +{ + char const *p = string; + return abtod (&p, 0); +} diff --git a/lib/stdlib/atoi.c b/lib/stdlib/atoi.c index 3f113723..6699fbea 100644 --- a/lib/stdlib/atoi.c +++ b/lib/stdlib/atoi.c @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2016,2017,2018 Jan (janneke) Nieuwenhuizen + * Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -21,8 +21,8 @@ #include int -atoi (char const *s) +atoi (char const *string) { - char const *p = s; + char const *p = string; return abtol (&p, 0); } diff --git a/lib/stub/atof.c b/lib/stub/atof.c deleted file mode 100644 index 19f6771d..00000000 --- a/lib/stub/atof.c +++ /dev/null @@ -1,31 +0,0 @@ -/* -*-comment-start: "//";comment-end:""-*- - * GNU Mes --- Maxwell Equations of Software - * Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen - * - * This file is part of GNU Mes. - * - * GNU Mes is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * GNU Mes is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Mes. If not, see . - */ - -#include - -int -atof (int x) -{ - static int stub = 0; - if (__mes_debug () && !stub) - eputs ("atof stub\n"); - stub = 1; - return 0; -}