2009-04-19 23:13:29 +08:00
|
|
|
//***************************************************************************
|
|
|
|
// include/cxx/cstdlib
|
|
|
|
//
|
2020-04-12 01:17:55 +08: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 23:13:29 +08:00
|
|
|
//
|
2020-04-12 01:17:55 +08:00
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
2009-04-19 23:13:29 +08:00
|
|
|
//
|
2020-04-12 01:17:55 +08: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 23:13:29 +08:00
|
|
|
//
|
|
|
|
//***************************************************************************
|
|
|
|
|
|
|
|
#ifndef __INCLUDE_CXX_CSTDLIB
|
|
|
|
#define __INCLUDE_CXX_CSTDLIB
|
|
|
|
|
|
|
|
//***************************************************************************
|
|
|
|
// Included Files
|
|
|
|
//***************************************************************************
|
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
//***************************************************************************
|
|
|
|
// Namespace
|
|
|
|
//***************************************************************************
|
|
|
|
|
|
|
|
namespace std
|
|
|
|
{
|
2014-11-06 21:00:23 +08:00
|
|
|
// Random number generation
|
|
|
|
|
2009-04-19 23:13:29 +08:00
|
|
|
using ::srand;
|
|
|
|
using ::rand;
|
2019-04-22 05:10:56 +08:00
|
|
|
using ::random;
|
2009-04-19 23:13:29 +08:00
|
|
|
|
2014-11-06 21:00:23 +08:00
|
|
|
// Environment variable support
|
|
|
|
|
2009-04-19 23:13:29 +08:00
|
|
|
using ::getenv;
|
|
|
|
using ::putenv;
|
|
|
|
using ::clearenv;
|
|
|
|
using ::setenv;
|
|
|
|
using ::unsetenv;
|
|
|
|
|
2014-11-06 21:00:23 +08:00
|
|
|
// Process exit functions
|
|
|
|
|
2009-04-19 23:13:29 +08:00
|
|
|
using ::exit;
|
2023-01-21 00:23:16 +08:00
|
|
|
using ::quick_exit;
|
2009-04-19 23:13:29 +08:00
|
|
|
using ::abort;
|
|
|
|
using ::atexit;
|
2023-01-21 00:23:16 +08:00
|
|
|
using ::at_quick_exit;
|
2012-02-02 00:17:12 +08:00
|
|
|
using ::on_exit;
|
2009-04-19 23:13:29 +08:00
|
|
|
|
2016-08-26 05:06:46 +08:00
|
|
|
#ifndef __KERNEL__
|
|
|
|
// System command
|
|
|
|
|
|
|
|
using ::system;
|
|
|
|
#endif
|
|
|
|
|
2014-11-06 21:00:23 +08:00
|
|
|
// String to binary conversions
|
|
|
|
|
2020-06-18 04:09:06 +08:00
|
|
|
using ::atof;
|
|
|
|
using ::atoi;
|
|
|
|
using ::atol;
|
2009-04-19 23:13:29 +08:00
|
|
|
using ::strtol;
|
2012-12-08 00:00:56 +08:00
|
|
|
using ::strtoul;
|
2014-11-06 21:00:23 +08:00
|
|
|
#ifdef CONFIG_HAVE_LONG_LONG
|
|
|
|
using ::strtoll;
|
|
|
|
using ::strtoull;
|
|
|
|
#endif
|
2017-02-14 21:48:54 +08:00
|
|
|
using ::strtof;
|
|
|
|
#ifdef CONFIG_HAVE_DOUBLE
|
2009-04-19 23:13:29 +08:00
|
|
|
using ::strtod;
|
2017-02-14 21:48:54 +08:00
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_HAVE_LONG_DOUBLE
|
|
|
|
using ::strtold;
|
|
|
|
#endif
|
2009-04-19 23:13:29 +08:00
|
|
|
|
2014-11-06 21:00:23 +08:00
|
|
|
// Binary to string conversions
|
|
|
|
|
|
|
|
using ::itoa;
|
|
|
|
|
2017-02-14 21:48:54 +08:00
|
|
|
// Wide character operations
|
|
|
|
|
|
|
|
using ::mbtowc;
|
|
|
|
using ::wctomb;
|
|
|
|
|
2014-11-06 21:00:23 +08:00
|
|
|
// Memory Management
|
|
|
|
|
2009-04-19 23:13:29 +08:00
|
|
|
using ::malloc;
|
|
|
|
using ::free;
|
|
|
|
using ::realloc;
|
|
|
|
using ::memalign;
|
|
|
|
using ::zalloc;
|
|
|
|
using ::calloc;
|
2014-11-06 21:00:23 +08:00
|
|
|
|
2016-08-26 05:06:46 +08:00
|
|
|
#ifdef CONFIG_PSEUDOTERM
|
|
|
|
// Pseudo-Terminals
|
|
|
|
|
|
|
|
using ::ptsname;
|
|
|
|
using ::ptsname_r;
|
|
|
|
using ::unlockpt;
|
|
|
|
#endif
|
|
|
|
|
2015-08-15 02:04:57 +08:00
|
|
|
// Arithmetic
|
2014-11-06 21:00:23 +08:00
|
|
|
|
|
|
|
using ::abs;
|
|
|
|
using ::labs;
|
|
|
|
#ifdef CONFIG_HAVE_LONG_LONG
|
|
|
|
using ::llabs;
|
|
|
|
#endif
|
2015-08-15 02:04:57 +08:00
|
|
|
|
|
|
|
using ::div;
|
|
|
|
using ::ldiv;
|
|
|
|
#ifdef CONFIG_HAVE_LONG_LONG
|
|
|
|
using ::lldiv;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// Temporary files
|
|
|
|
|
2014-11-06 21:00:23 +08:00
|
|
|
using ::mktemp;
|
|
|
|
using ::mkstemp;
|
2015-08-15 02:04:57 +08:00
|
|
|
|
|
|
|
// Sorting
|
|
|
|
|
2014-11-06 21:00:23 +08:00
|
|
|
using ::qsort;
|
2016-08-26 05:06:46 +08:00
|
|
|
|
|
|
|
// Binary search
|
|
|
|
|
|
|
|
using ::bsearch;
|
2009-04-19 23:13:29 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif // __INCLUDE_CXX_CSTDLIB
|