2009-04-19 17:13:29 +02:00
|
|
|
//***************************************************************************
|
|
|
|
// include/cxx/cstdlib
|
|
|
|
//
|
2020-04-11 19:17:55 +02:00
|
|
|
// Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
// contributor license agreements. See the NOTICE file distributed with
|
|
|
|
// this work for additional information regarding copyright ownership. The
|
|
|
|
// ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
// "License"); you may not use this file except in compliance with the
|
|
|
|
// License. You may obtain a copy of the License at
|
2009-04-19 17:13:29 +02:00
|
|
|
//
|
2020-04-11 19:17:55 +02:00
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
2009-04-19 17:13:29 +02:00
|
|
|
//
|
2020-04-11 19:17:55 +02:00
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
// License for the specific language governing permissions and limitations
|
|
|
|
// under the License.
|
2009-04-19 17:13:29 +02:00
|
|
|
//
|
|
|
|
//***************************************************************************
|
|
|
|
|
|
|
|
#ifndef __INCLUDE_CXX_CSTDLIB
|
|
|
|
#define __INCLUDE_CXX_CSTDLIB
|
|
|
|
|
|
|
|
//***************************************************************************
|
|
|
|
// Included Files
|
|
|
|
//***************************************************************************
|
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
//***************************************************************************
|
|
|
|
// Namespace
|
|
|
|
//***************************************************************************
|
|
|
|
|
|
|
|
namespace std
|
|
|
|
{
|
2014-11-06 14:00:23 +01:00
|
|
|
// Random number generation
|
|
|
|
|
2009-04-19 17:13:29 +02:00
|
|
|
using ::srand;
|
|
|
|
using ::rand;
|
2019-04-21 23:10:56 +02:00
|
|
|
using ::random;
|
2009-04-19 17:13:29 +02:00
|
|
|
|
2014-11-06 14:00:23 +01:00
|
|
|
// Environment variable support
|
|
|
|
|
|
|
|
using ::get_environ_ptr;
|
2009-04-19 17:13:29 +02:00
|
|
|
using ::getenv;
|
|
|
|
using ::putenv;
|
|
|
|
using ::clearenv;
|
|
|
|
using ::setenv;
|
|
|
|
using ::unsetenv;
|
|
|
|
|
2014-11-06 14:00:23 +01:00
|
|
|
// Process exit functions
|
|
|
|
|
2009-04-19 17:13:29 +02:00
|
|
|
using ::exit;
|
|
|
|
using ::abort;
|
|
|
|
using ::atexit;
|
2012-02-01 17:17:12 +01:00
|
|
|
using ::on_exit;
|
2009-04-19 17:13:29 +02:00
|
|
|
|
2016-08-25 23:06:46 +02:00
|
|
|
#ifndef __KERNEL__
|
|
|
|
// System command
|
|
|
|
|
|
|
|
using ::system;
|
|
|
|
#endif
|
|
|
|
|
2014-11-06 14:00:23 +01:00
|
|
|
// String to binary conversions
|
|
|
|
|
2020-06-17 22:09:06 +02:00
|
|
|
using ::atof;
|
|
|
|
using ::atoi;
|
|
|
|
using ::atol;
|
2009-04-19 17:13:29 +02:00
|
|
|
using ::strtol;
|
2012-12-07 17:00:56 +01:00
|
|
|
using ::strtoul;
|
2014-11-06 14:00:23 +01:00
|
|
|
#ifdef CONFIG_HAVE_LONG_LONG
|
|
|
|
using ::strtoll;
|
|
|
|
using ::strtoull;
|
|
|
|
#endif
|
2017-02-14 14:48:54 +01:00
|
|
|
using ::strtof;
|
|
|
|
#ifdef CONFIG_HAVE_DOUBLE
|
2009-04-19 17:13:29 +02:00
|
|
|
using ::strtod;
|
2017-02-14 14:48:54 +01:00
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_HAVE_LONG_DOUBLE
|
|
|
|
using ::strtold;
|
|
|
|
#endif
|
2009-04-19 17:13:29 +02:00
|
|
|
|
2014-11-06 14:00:23 +01:00
|
|
|
// Binary to string conversions
|
|
|
|
|
|
|
|
using ::itoa;
|
|
|
|
|
2017-02-14 14:48:54 +01:00
|
|
|
// Wide character operations
|
|
|
|
|
|
|
|
#ifdef CONFIG_LIBC_WCHAR
|
|
|
|
using ::mbtowc;
|
|
|
|
using ::wctomb;
|
|
|
|
#endif
|
|
|
|
|
2014-11-06 14:00:23 +01:00
|
|
|
// Memory Management
|
|
|
|
|
2009-04-19 17:13:29 +02:00
|
|
|
using ::malloc;
|
|
|
|
using ::free;
|
|
|
|
using ::realloc;
|
|
|
|
using ::memalign;
|
|
|
|
using ::zalloc;
|
|
|
|
using ::calloc;
|
2014-11-06 14:00:23 +01:00
|
|
|
|
2016-08-25 23:06:46 +02:00
|
|
|
#ifdef CONFIG_PSEUDOTERM
|
|
|
|
// Pseudo-Terminals
|
|
|
|
|
|
|
|
#ifdef CONFIG_PSEUDOTERM_SUSV1
|
|
|
|
using ::ptsname;
|
|
|
|
using ::ptsname_r;
|
|
|
|
#endif
|
|
|
|
using ::unlockpt;
|
|
|
|
#endif
|
|
|
|
|
2015-08-14 20:04:57 +02:00
|
|
|
// Arithmetic
|
2014-11-06 14:00:23 +01:00
|
|
|
|
|
|
|
using ::abs;
|
|
|
|
using ::labs;
|
|
|
|
#ifdef CONFIG_HAVE_LONG_LONG
|
|
|
|
using ::llabs;
|
|
|
|
#endif
|
2015-08-14 20:04:57 +02:00
|
|
|
|
|
|
|
using ::div;
|
|
|
|
using ::ldiv;
|
|
|
|
#ifdef CONFIG_HAVE_LONG_LONG
|
|
|
|
using ::lldiv;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// Temporary files
|
|
|
|
|
2014-11-06 14:00:23 +01:00
|
|
|
using ::mktemp;
|
|
|
|
using ::mkstemp;
|
2015-08-14 20:04:57 +02:00
|
|
|
|
|
|
|
// Sorting
|
|
|
|
|
2014-11-06 14:00:23 +01:00
|
|
|
using ::qsort;
|
2016-08-25 23:06:46 +02:00
|
|
|
|
|
|
|
// Binary search
|
|
|
|
|
|
|
|
using ::bsearch;
|
2009-04-19 17:13:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif // __INCLUDE_CXX_CSTDLIB
|