mescc: Mes C Library: Support gcc-4.6.4: Add math stubs.
* lib/math/ceil.c: New file. * lib/math/floor.c: New file. * lib/stub/atan2.c: New file. * lib/stub/cos.c: New file. * lib/stub/exp.c: New file. * lib/stub/log.c: New file. * lib/stub/modf.c: New file. * lib/stub/pow.c: New file. * lib/stub/sin.c: New file. * lib/stub/sqrt.c: New file. * lib/libc+gnu.c: Include them. * include/math.h (atan2, ceil, cos, exp, fabs, floor, log, modf, pow, sin, sqrt): Declare. * lib/math/fabs.c: Update. * lib/stub/ldexp.c: Update.
This commit is contained in:
parent
6bb225b403
commit
98b9ac8e98
|
@ -228,7 +228,9 @@ lib/dirent/__getdirentries.c
|
|||
lib/dirent/closedir.c
|
||||
lib/dirent/opendir.c
|
||||
lib/dirent/readdir.c
|
||||
lib/math/ceil.c
|
||||
lib/math/fabs.c
|
||||
lib/math/floor.c
|
||||
lib/mes/fdgets.c
|
||||
lib/posix/alarm.c
|
||||
lib/posix/execl.c
|
||||
|
@ -266,9 +268,12 @@ lib/string/strncat.c
|
|||
lib/string/strpbrk.c
|
||||
lib/string/strspn.c
|
||||
lib/stub/__cleanup.c
|
||||
lib/stub/atan2.c
|
||||
lib/stub/bsearch.c
|
||||
lib/stub/chown.c
|
||||
lib/stub/cos.c
|
||||
lib/stub/ctime.c
|
||||
lib/stub/exp.c
|
||||
lib/stub/fpurge.c
|
||||
lib/stub/freadahead.c
|
||||
lib/stub/frexp.c
|
||||
|
@ -280,9 +285,12 @@ lib/stub/getpgrp.c
|
|||
lib/stub/getpwnam.c
|
||||
lib/stub/getpwuid.c
|
||||
lib/stub/gmtime.c
|
||||
lib/stub/log.c
|
||||
lib/stub/mktime.c
|
||||
lib/stub/modf.c
|
||||
lib/stub/pclose.c
|
||||
lib/stub/popen.c
|
||||
lib/stub/pow.c
|
||||
lib/stub/rand.c
|
||||
lib/stub/rewind.c
|
||||
lib/stub/setbuf.c
|
||||
|
@ -293,6 +301,8 @@ lib/stub/sigaddset.c
|
|||
lib/stub/sigblock.c
|
||||
lib/stub/sigdelset.c
|
||||
lib/stub/sigsetmask.c
|
||||
lib/stub/sin.c
|
||||
lib/stub/sqrt.c
|
||||
lib/stub/strftime.c
|
||||
lib/stub/sys_siglist.c
|
||||
lib/stub/system.c
|
||||
|
|
|
@ -24,8 +24,20 @@
|
|||
#undef __MES_MATH_H
|
||||
#include_next <math.h>
|
||||
#else // ! SYSTEM_LIBC
|
||||
|
||||
double atan2 (double y, double x);
|
||||
double ceil (double x);
|
||||
double cos (double x);
|
||||
double exp (double x);
|
||||
double fabs (double number);
|
||||
double floor (double x);
|
||||
double ldexp (double value, int exponent);
|
||||
double log (double x);
|
||||
double modf (double value, double *integer_part);
|
||||
double pow (double base, double power);
|
||||
double sin (double x);
|
||||
double sqrt (double x);
|
||||
|
||||
#endif // ! SYSTEM_LIBC
|
||||
|
||||
#endif // __MES_MATH_H
|
||||
|
|
29
lib/math/ceil.c
Normal file
29
lib/math/ceil.c
Normal file
|
@ -0,0 +1,29 @@
|
|||
/* -*-comment-start: "//";comment-end:""-*-
|
||||
* GNU Mes --- Maxwell Equations of Software
|
||||
* Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
|
||||
double
|
||||
ceil (double number)
|
||||
{
|
||||
long i = number + 0.9999;
|
||||
number = i;
|
||||
return number;
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
/* -*-comment-start: "//";comment-end:""-*-
|
||||
* GNU Mes --- Maxwell Equations of Software
|
||||
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
*
|
||||
* This file is part of GNU Mes.
|
||||
*
|
||||
|
@ -18,7 +18,7 @@
|
|||
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
//#include <math.h>
|
||||
#include <math.h>
|
||||
|
||||
double
|
||||
fabs (double number)
|
||||
|
|
29
lib/math/floor.c
Normal file
29
lib/math/floor.c
Normal file
|
@ -0,0 +1,29 @@
|
|||
/* -*-comment-start: "//";comment-end:""-*-
|
||||
* GNU Mes --- Maxwell Equations of Software
|
||||
* Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
|
||||
double
|
||||
floor (double number)
|
||||
{
|
||||
long i = number;
|
||||
number = i;
|
||||
return number;
|
||||
}
|
32
lib/stub/atan2.c
Normal file
32
lib/stub/atan2.c
Normal file
|
@ -0,0 +1,32 @@
|
|||
/* -*-comment-start: "//";comment-end:""-*-
|
||||
* GNU Mes --- Maxwell Equations of Software
|
||||
* Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <mes/lib.h>
|
||||
#include <math.h>
|
||||
|
||||
double
|
||||
atan2 (double x, double y)
|
||||
{
|
||||
static int stub = 0;
|
||||
if (__mes_debug () && !stub)
|
||||
eputs ("atan2 stub\n");
|
||||
stub = 1;
|
||||
return 0;
|
||||
}
|
32
lib/stub/cos.c
Normal file
32
lib/stub/cos.c
Normal file
|
@ -0,0 +1,32 @@
|
|||
/* -*-comment-start: "//";comment-end:""-*-
|
||||
* GNU Mes --- Maxwell Equations of Software
|
||||
* Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <mes/lib.h>
|
||||
#include <math.h>
|
||||
|
||||
double
|
||||
cos (double x)
|
||||
{
|
||||
static int stub = 0;
|
||||
if (__mes_debug () && !stub)
|
||||
eputs ("cos stub\n");
|
||||
stub = 1;
|
||||
return 0;
|
||||
}
|
32
lib/stub/exp.c
Normal file
32
lib/stub/exp.c
Normal file
|
@ -0,0 +1,32 @@
|
|||
/* -*-comment-start: "//";comment-end:""-*-
|
||||
* GNU Mes --- Maxwell Equations of Software
|
||||
* Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <mes/lib.h>
|
||||
#include <math.h>
|
||||
|
||||
double
|
||||
exp (double x)
|
||||
{
|
||||
static int stub = 0;
|
||||
if (__mes_debug () && !stub)
|
||||
eputs ("exp stub\n");
|
||||
stub = 1;
|
||||
return 0;
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
/* -*-comment-start: "//";comment-end:""-*-
|
||||
* GNU Mes --- Maxwell Equations of Software
|
||||
* Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
* Copyright © 2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
*
|
||||
* This file is part of GNU Mes.
|
||||
*
|
||||
|
@ -22,7 +22,7 @@
|
|||
#include <math.h>
|
||||
|
||||
double
|
||||
ldexp (double x, int exp)
|
||||
ldexp (double value, int exponent)
|
||||
{
|
||||
static int stub = 0;
|
||||
if (__mes_debug () && !stub)
|
||||
|
|
32
lib/stub/log.c
Normal file
32
lib/stub/log.c
Normal file
|
@ -0,0 +1,32 @@
|
|||
/* -*-comment-start: "//";comment-end:""-*-
|
||||
* GNU Mes --- Maxwell Equations of Software
|
||||
* Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <mes/lib.h>
|
||||
#include <math.h>
|
||||
|
||||
double
|
||||
log (double x)
|
||||
{
|
||||
static int stub = 0;
|
||||
if (__mes_debug () && !stub)
|
||||
eputs ("log stub\n");
|
||||
stub = 1;
|
||||
return 0;
|
||||
}
|
32
lib/stub/modf.c
Normal file
32
lib/stub/modf.c
Normal file
|
@ -0,0 +1,32 @@
|
|||
/* -*-comment-start: "//";comment-end:""-*-
|
||||
* GNU Mes --- Maxwell Equations of Software
|
||||
* Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <mes/lib.h>
|
||||
#include <math.h>
|
||||
|
||||
double
|
||||
modf (double value, double *integer_part)
|
||||
{
|
||||
static int stub = 0;
|
||||
if (__mes_debug () && !stub)
|
||||
eputs ("modf stub\n");
|
||||
stub = 1;
|
||||
return 0;
|
||||
}
|
32
lib/stub/pow.c
Normal file
32
lib/stub/pow.c
Normal file
|
@ -0,0 +1,32 @@
|
|||
/* -*-comment-start: "//";comment-end:""-*-
|
||||
* GNU Mes --- Maxwell Equations of Software
|
||||
* Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <mes/lib.h>
|
||||
#include <math.h>
|
||||
|
||||
double
|
||||
pow (double base, double power)
|
||||
{
|
||||
static int stub = 0;
|
||||
if (__mes_debug () && !stub)
|
||||
eputs ("pow stub\n");
|
||||
stub = 1;
|
||||
return 0;
|
||||
}
|
32
lib/stub/sin.c
Normal file
32
lib/stub/sin.c
Normal file
|
@ -0,0 +1,32 @@
|
|||
/* -*-comment-start: "//";comment-end:""-*-
|
||||
* GNU Mes --- Maxwell Equations of Software
|
||||
* Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <mes/lib.h>
|
||||
#include <math.h>
|
||||
|
||||
double
|
||||
sin (double x)
|
||||
{
|
||||
static int stub = 0;
|
||||
if (__mes_debug () && !stub)
|
||||
eputs ("sin stub\n");
|
||||
stub = 1;
|
||||
return 0;
|
||||
}
|
32
lib/stub/sqrt.c
Normal file
32
lib/stub/sqrt.c
Normal file
|
@ -0,0 +1,32 @@
|
|||
/* -*-comment-start: "//";comment-end:""-*-
|
||||
* GNU Mes --- Maxwell Equations of Software
|
||||
* Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <mes/lib.h>
|
||||
#include <math.h>
|
||||
|
||||
double
|
||||
sqrt (double x)
|
||||
{
|
||||
static int stub = 0;
|
||||
if (__mes_debug () && !stub)
|
||||
eputs ("sqrt stub\n");
|
||||
stub = 1;
|
||||
return 0;
|
||||
}
|
Loading…
Reference in a new issue