move string conversion functions to stdlib.h
This commit is contained in:
parent
9e8509a1c1
commit
dcf3f79e9b
2 changed files with 31 additions and 25 deletions
|
@ -37,33 +37,13 @@ extern "C" {
|
|||
|
||||
#define NULL ((void*) 0)
|
||||
|
||||
/*
|
||||
* macros, which are later used to determine the core id
|
||||
* and their "private" data
|
||||
*/
|
||||
#define per_core(name) name
|
||||
#define CORE_ID 0
|
||||
|
||||
/** @brief String to long
|
||||
*
|
||||
* @return Long value of the parsed numerical string
|
||||
*/
|
||||
long strtol(const char* str, char** endptr, int base);
|
||||
|
||||
/** @brief String to unsigned long
|
||||
*
|
||||
* @return Unsigned long value of the parsed numerical string
|
||||
*/
|
||||
unsigned long strtoul(const char* nptr, char** endptr, int base);
|
||||
|
||||
/** @brief ASCII to integer
|
||||
*
|
||||
* Convenience function using strtol().
|
||||
*
|
||||
* @return Integer value of the parsed numerical string
|
||||
*/
|
||||
static inline int atoi(const char *str)
|
||||
{
|
||||
return (int)strtol(str, (char **)NULL, 10);
|
||||
}
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -38,13 +38,39 @@
|
|||
#define __STDLIB_H__
|
||||
|
||||
#include <eduos/config.h>
|
||||
#include <eduos/tasks_types.h>
|
||||
#include <asm/stddef.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** @brief String to long
|
||||
*
|
||||
* Convert a string value to a long
|
||||
*
|
||||
* @return Long value of the parsed numerical string
|
||||
*/
|
||||
long strtol(const char* str, char** endptr, int base);
|
||||
|
||||
/** @brief String to unsigned long
|
||||
*
|
||||
* Convert a string value to a unsigned long
|
||||
*
|
||||
* @return Unsigned long value of the parsed numerical string
|
||||
*/
|
||||
unsigned long strtoul(const char* nptr, char** endptr, int base);
|
||||
|
||||
/** @brief ASCII to integer
|
||||
*
|
||||
* Convert ASCII string to integer
|
||||
*
|
||||
* @return Integer value of the parsed numerical string
|
||||
*/
|
||||
static inline int atoi(const char *str)
|
||||
{
|
||||
return (int)strtol(str, (char **)NULL, 10);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue