From 73fb77c191301fbaf8f45d763f7dcbda71bcbe69 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Sat, 5 Jan 2019 10:22:57 +0100 Subject: [PATCH] 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. --- lib/libc+gnu.c | 2 +- lib/libg.c | 2 +- lib/{stub => stdlib}/atof.c | 13 +++++-------- lib/stdlib/atoi.c | 6 +++--- 4 files changed, 10 insertions(+), 13 deletions(-) rename lib/{stub => stdlib}/atof.c (80%) diff --git a/lib/libc+gnu.c b/lib/libc+gnu.c index 4a86d5a3..0c43f8ff 100644 --- a/lib/libc+gnu.c +++ b/lib/libc+gnu.c @@ -31,7 +31,7 @@ // m4 #include #include -#include +#include #include #include #include diff --git a/lib/libg.c b/lib/libg.c index 166b8a5f..d70f1555 100644 --- a/lib/libg.c +++ b/lib/libg.c @@ -48,7 +48,7 @@ // m4 #include -#include +#include #include #include #include diff --git a/lib/stub/atof.c b/lib/stdlib/atof.c similarity index 80% rename from lib/stub/atof.c rename to lib/stdlib/atof.c index 3cc951d9..91ceb9a0 100644 --- a/lib/stub/atof.c +++ b/lib/stdlib/atof.c @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2018 Jan (janneke) Nieuwenhuizen + * Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -20,12 +20,9 @@ #include -int -atof (int x) +double +atof (char const* string) { - static int stub = 0; - if (__mes_debug () && !stub) - eputs ("atof stub\n"); - stub = 1; - return 0; + char const *p = string; + return abtod (&p, 0); } diff --git a/lib/stdlib/atoi.c b/lib/stdlib/atoi.c index cc02dca4..49acfdd6 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); }