mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
cpu/esp*: move common headers to cpu/esp_common
This commit is contained in:
parent
53a3756e0c
commit
7d701f6fa8
@ -1,47 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Gunar Schorcht
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup cpu_esp32
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief CPU common functions
|
||||
*
|
||||
* @author Gunar Schorcht <gunar@schorcht.net>
|
||||
*/
|
||||
|
||||
#ifndef CPU_H
|
||||
#define CPU_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include "irq.h"
|
||||
|
||||
#define PROVIDES_PM_SET_LOWEST
|
||||
|
||||
/**
|
||||
* @brief Print the last instruction's address
|
||||
*
|
||||
* @todo: Not supported
|
||||
*/
|
||||
static inline void cpu_print_last_instruction(void)
|
||||
{
|
||||
/* This function must exist else RIOT won't compile */
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CPU_H */
|
||||
/** @} */
|
@ -1,128 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Gunar Schorcht
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup cpu_esp32
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Common helper macros
|
||||
*
|
||||
* @author Gunar Schorcht <gunar@schorcht.net>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef ESP_COMMON_H
|
||||
#define ESP_COMMON_H
|
||||
|
||||
#ifndef DOXYGEN
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "log.h"
|
||||
#include "esp_common_log.h"
|
||||
|
||||
#define asm __asm__
|
||||
|
||||
/** string representation of x */
|
||||
#ifndef XTSTR
|
||||
#define _XTSTR(x) # x
|
||||
#define XTSTR(x) _XTSTR(x)
|
||||
#endif /* XSTR */
|
||||
|
||||
#if !defined(ICACHE_FLASH)
|
||||
#ifndef ICACHE_RAM_ATTR
|
||||
/** Places the code with this attribute in the IRAM. */
|
||||
#define ICACHE_RAM_ATTR __attribute__((section(".iram0.text")))
|
||||
#endif
|
||||
#else /* ICACHE_FLASH */
|
||||
#ifndef ICACHE_RAM_ATTR
|
||||
#define ICACHE_RAM_ATTR
|
||||
#endif
|
||||
#endif /* ICACHE_FLASH */
|
||||
|
||||
/** Print out a message that function is not yet implementd */
|
||||
#define NOT_YET_IMPLEMENTED() LOG_INFO("%s not yet implemented\n", __func__)
|
||||
/** Print out a message that function is not supported */
|
||||
#define NOT_SUPPORTED() LOG_INFO("%s not supported\n", __func__)
|
||||
|
||||
#if ENABLE_DEBUG
|
||||
/**
|
||||
* @brief Parameter check with return a value.
|
||||
*
|
||||
* If ENABLE_DEBUG is true, the macro checks a condition and returns with a value
|
||||
* if the condition is not fulfilled.
|
||||
* @param cond the condition
|
||||
* @param err the return value in the case the condition is not fulfilled.
|
||||
*/
|
||||
#define CHECK_PARAM_RET(cond,err) if (!(cond)) \
|
||||
{ \
|
||||
DEBUG("%s parameter condition (" #cond ") " \
|
||||
"not fulfilled\n", __func__); \
|
||||
return err; \
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Parameter check without return value.
|
||||
*
|
||||
* If ENABLE_DEBUG is true, the macro checks a condition and returns without a
|
||||
* value if the condition is not fulfilled.
|
||||
* @param cond the condition
|
||||
*/
|
||||
#define CHECK_PARAM(cond) if (!(cond)) \
|
||||
{ \
|
||||
DEBUG("%s parameter condition (" #cond ") " \
|
||||
"not fulfilled\n", __func__); \
|
||||
return; \
|
||||
}
|
||||
|
||||
#else /* ENABLE_DEBUG */
|
||||
|
||||
#define CHECK_PARAM_RET(cond,err) if (!(cond)) return err;
|
||||
#define CHECK_PARAM(cond) if (!(cond)) return;
|
||||
|
||||
#endif /* ENABLE_DEBUG */
|
||||
|
||||
/** gives the minimum of a and b */
|
||||
#ifndef MIN
|
||||
#define MIN(a,b) ((a) < (b) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
/** gives the maximum of a and b */
|
||||
#ifndef MAX
|
||||
#define MAX(a,b) ((a) > (b) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief function name mappings for source code compatibility with ESP8266 port
|
||||
* @{
|
||||
*/
|
||||
#define system_get_cpu_freq ets_get_cpu_frequency
|
||||
#define system_update_cpu_freq ets_update_cpu_frequency
|
||||
/** @} */
|
||||
|
||||
/** @} */
|
||||
|
||||
/** microseconds per millisecond */
|
||||
#ifndef USEC_PER_MSEC
|
||||
#define USEC_PER_MSEC 1000UL
|
||||
#endif
|
||||
|
||||
#ifndef MSEC_PER_SEC
|
||||
#define MSEC_PER_SEC 1000UL
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* DOXYGEN */
|
||||
|
||||
#endif /* ESP_COMMON_H */
|
@ -1,151 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Gunar Schorcht
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup cpu_esp32
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Common log macros
|
||||
*
|
||||
* @author Gunar Schorcht <gunar@schorcht.net>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef ESP_COMMON_LOG_H
|
||||
#define ESP_COMMON_LOG_H
|
||||
|
||||
#ifndef DOXYGEN
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "log.h"
|
||||
|
||||
extern uint32_t system_get_time_ms (void);
|
||||
extern int ets_printf(const char *fmt, ...);
|
||||
|
||||
#if MODULE_ESP_LOG_COLORED
|
||||
|
||||
#define LOG_RESET_COLOR "\033[0m"
|
||||
#define LOG_COLOR_E "\033[1;31m"
|
||||
#define LOG_COLOR_W "\033[1;33m"
|
||||
#define LOG_COLOR_I "\033[1m"
|
||||
#define LOG_COLOR_D "\033[0;32m"
|
||||
#define LOG_COLOR_V
|
||||
|
||||
#else /* MODULE_ESP_LOG_COLORED */
|
||||
|
||||
#define LOG_COLOR_E
|
||||
#define LOG_COLOR_W
|
||||
#define LOG_COLOR_I
|
||||
#define LOG_COLOR_D
|
||||
#define LOG_COLOR_V
|
||||
#define LOG_RESET_COLOR
|
||||
|
||||
#endif /* MODULE_ESP_LOG_COLORED */
|
||||
|
||||
#if MODULE_ESP_LOG_TAGGED
|
||||
|
||||
#define LOG_FORMAT(letter, format) LOG_COLOR_ ## letter #letter " (%d) [%s] " format LOG_RESET_COLOR
|
||||
|
||||
#define LOG_TAG(level, letter, tag, format, ...) \
|
||||
do { \
|
||||
if ((unsigned)level <= (unsigned)LOG_LEVEL) { \
|
||||
printf(LOG_FORMAT(letter, format), system_get_time_ms(), tag, ##__VA_ARGS__); \
|
||||
fflush(stdout); \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define LOG_TAG_EARLY(level, letter, tag, format, ...) \
|
||||
do { \
|
||||
if (LOG_LEVEL >= level) { \
|
||||
ets_printf(LOG_FORMAT(letter, format), system_get_time_ms(), tag, ##__VA_ARGS__); \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#else /* MODULE_ESP_LOG_TAGGED */
|
||||
|
||||
#define LOG_FORMAT(letter, format) LOG_COLOR_ ## letter format LOG_RESET_COLOR
|
||||
|
||||
#define LOG_TAG(level, letter, tag, format, ...) \
|
||||
do { \
|
||||
(void)tag; \
|
||||
if ((unsigned)level <= (unsigned)LOG_LEVEL) { \
|
||||
printf(LOG_FORMAT(letter, format), ##__VA_ARGS__); \
|
||||
fflush(stdout); \
|
||||
} \
|
||||
} while (0U)
|
||||
|
||||
#define LOG_TAG_EARLY(level, letter, tag, format, ...) \
|
||||
do { \
|
||||
(void)tag; \
|
||||
if ((unsigned)level <= (unsigned)LOG_LEVEL) { \
|
||||
ets_printf(LOG_FORMAT(letter, format), ##__VA_ARGS__); \
|
||||
} \
|
||||
} while (0U)
|
||||
|
||||
#endif /* MODULE_ESP_LOG_TAGGED */
|
||||
|
||||
/**
|
||||
* Override LOG_* definitions with a tagged version. By default the function
|
||||
* name is used as tag.
|
||||
*/
|
||||
#ifndef MODULE_LOG_PRINTFNOFORMAT
|
||||
#undef LOG_ERROR
|
||||
#undef LOG_INFO
|
||||
#undef LOG_WARNING
|
||||
#undef LOG_DEBUG
|
||||
#define LOG_ERROR(format, ...) LOG_TAG(LOG_ERROR , E, __func__, format, ##__VA_ARGS__)
|
||||
#define LOG_WARNING(format, ...) LOG_TAG(LOG_WARNING, W, __func__, format, ##__VA_ARGS__)
|
||||
#define LOG_INFO(format, ...) LOG_TAG(LOG_INFO , I, __func__, format, ##__VA_ARGS__)
|
||||
#define LOG_DEBUG(format, ...) LOG_TAG(LOG_DEBUG , D, __func__, format, ##__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
/** Tagged LOG_* definitions */
|
||||
#define LOG_TAG_ERROR(tag, format, ...) LOG_TAG(LOG_ERROR , E, tag, format, ##__VA_ARGS__)
|
||||
#define LOG_TAG_WARNING(tag, format, ...) LOG_TAG(LOG_WARNING, W, tag, format, ##__VA_ARGS__)
|
||||
#define LOG_TAG_INFO(tag, format, ...) LOG_TAG(LOG_INFO , I, tag, format, ##__VA_ARGS__)
|
||||
#define LOG_TAG_DEBUG(tag, format, ...) LOG_TAG(LOG_DEBUG , D, tag, format, ##__VA_ARGS__)
|
||||
#define LOG_TAG_ALL(tag, format, ...) LOG_TAG(LOG_ALL , V, tag, format, ##__VA_ARGS__)
|
||||
|
||||
/** definitions for source code compatibility with ESP-IDF */
|
||||
#define ESP_EARLY_LOGE(tag, format, ...) LOG_TAG_EARLY(LOG_ERROR , E, tag, format "\n", ##__VA_ARGS__)
|
||||
#define ESP_EARLY_LOGW(tag, format, ...) LOG_TAG_EARLY(LOG_WARNING, W, tag, format "\n", ##__VA_ARGS__)
|
||||
#define ESP_EARLY_LOGI(tag, format, ...) LOG_TAG_EARLY(LOG_INFO , I, tag, format "\n", ##__VA_ARGS__)
|
||||
#define ESP_LOGE(tag, format, ...) LOG_TAG(LOG_ERROR , E, tag, format "\n", ##__VA_ARGS__)
|
||||
#define ESP_LOGW(tag, format, ...) LOG_TAG(LOG_WARNING, W, tag, format "\n", ##__VA_ARGS__)
|
||||
#define ESP_LOGI(tag, format, ...) LOG_TAG(LOG_INFO , I, tag, format "\n", ##__VA_ARGS__)
|
||||
|
||||
#if ENABLE_DEBUG
|
||||
|
||||
#define ESP_EARLY_LOGD(tag, format, ...) LOG_TAG_EARLY(LOG_DEBUG, D, tag, format "\n", ##__VA_ARGS__)
|
||||
#define ESP_EARLY_LOGV(tag, format, ...) LOG_TAG_EARLY(LOG_ALL , V, tag, format "\n", ##__VA_ARGS__)
|
||||
#define ESP_LOGD(tag, format, ...) LOG_TAG(LOG_DEBUG, D, tag, format "\n", ##__VA_ARGS__)
|
||||
#define ESP_LOGV(tag, format, ...) LOG_TAG(LOG_ALL , V, tag, format "\n", ##__VA_ARGS__)
|
||||
|
||||
#else /* ENABLE_DEBUG */
|
||||
|
||||
#define ESP_EARLY_LOGD( tag, format, ... ) (void)tag
|
||||
#define ESP_EARLY_LOGV( tag, format, ... ) (void)tag
|
||||
#define ESP_LOGD( tag, format, ... ) (void)tag
|
||||
#define ESP_LOGV( tag, format, ... ) (void)tag
|
||||
|
||||
#endif /* ENABLE_DEBUG */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* DOXYGEN */
|
||||
|
||||
#endif /* ESP_COMMON_LOG_H */
|
@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Gunar Schorcht
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup cpu_esp32
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief ESP32 exception handling
|
||||
*
|
||||
* @author Gunar Schorcht <gunar@schorcht.net>
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifndef EXCEPTIONS_H
|
||||
#define EXCEPTIONS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** Initialize exception handler */
|
||||
extern void init_exceptions(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* EXCEPTIONS_H */
|
@ -1,60 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Gunar Schorcht
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup cpu_esp32
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Log module to realize consistent log messages
|
||||
*
|
||||
* @author Gunar Schorcht <gunar@schorcht.net>
|
||||
*/
|
||||
|
||||
#ifndef LOG_MODULE_H
|
||||
#define LOG_MODULE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include "esp_common_log.h"
|
||||
|
||||
#ifdef MODULE_LOG_PRINTFNOFORMAT
|
||||
|
||||
static inline void log_write(unsigned level, const char *format, ...) {
|
||||
(void)level;
|
||||
puts(format);
|
||||
}
|
||||
|
||||
#else /* MODULE_LOG_PRINTFNOFORMAT */
|
||||
|
||||
#define log_write(level, ...) \
|
||||
do { \
|
||||
if (level == LOG_ERROR) { \
|
||||
LOG_TAG(LOG_ERROR, E, __func__, ##__VA_ARGS__); \
|
||||
} \
|
||||
else if (level == LOG_WARNING) { \
|
||||
LOG_TAG(LOG_WARNING, W, __func__, ##__VA_ARGS__); \
|
||||
} \
|
||||
else if (level == LOG_INFO) { \
|
||||
LOG_TAG(LOG_INFO, D, __func__, ##__VA_ARGS__); \
|
||||
} \
|
||||
else if (level == LOG_DEBUG) { \
|
||||
LOG_TAG(LOG_DEBUG, E, __func__, ##__VA_ARGS__); \
|
||||
} \
|
||||
} while (0U);
|
||||
|
||||
#endif /* MODULE_LOG_PRINTFNOFORMAT */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
/**@}*/
|
||||
#endif /* LOG_MODULE_H */
|
@ -1,748 +0,0 @@
|
||||
/**
|
||||
* This file is a modification of the original file to overwrite the *putchar*
|
||||
* and *getchar* macros in the case the *uart_stdio* module is used. If the
|
||||
* *uart_stdio* module is used, *putchar* and *getchar* are redirections to
|
||||
* according *uart_stdio_* functions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
* provided that the above copyright notice and this paragraph are
|
||||
* duplicated in all such forms and that any documentation,
|
||||
* advertising materials, and other materials related to such
|
||||
* distribution and use acknowledge that the software was developed
|
||||
* by the University of California, Berkeley. The name of the
|
||||
* University may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* @(#)stdio.h 5.3 (Berkeley) 3/15/86
|
||||
*/
|
||||
|
||||
/*
|
||||
* NB: to fit things in six character monocase externals, the
|
||||
* stdio code uses the prefix `__s' for stdio objects, typically
|
||||
* followed by a three-character attempt at a mnemonic.
|
||||
*/
|
||||
|
||||
#ifndef STDIO_H
|
||||
#define STDIO_H
|
||||
|
||||
#ifndef DOXYGEN
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "_ansi.h"
|
||||
|
||||
#define _FSTDIO /* ``function stdio'' */
|
||||
|
||||
#define __need_size_t
|
||||
#define __need_NULL
|
||||
#include <sys/cdefs.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#define __need___va_list
|
||||
#include <stdarg.h>
|
||||
|
||||
/*
|
||||
* <sys/reent.h> defines __FILE, _fpos_t.
|
||||
* They must be defined there because struct _reent needs them (and we don't
|
||||
* want reent.h to include this file.
|
||||
*/
|
||||
|
||||
#include <sys/reent.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
_BEGIN_STD_C
|
||||
|
||||
typedef __FILE FILE;
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
typedef _fpos64_t fpos_t;
|
||||
#else
|
||||
typedef _fpos_t fpos_t;
|
||||
#ifdef __LARGE64_FILES
|
||||
typedef _fpos64_t fpos64_t;
|
||||
#endif
|
||||
#endif /* !__CYGWIN__ */
|
||||
|
||||
#include <sys/stdio.h>
|
||||
|
||||
#define __SLBF 0x0001 /* line buffered */
|
||||
#define __SNBF 0x0002 /* unbuffered */
|
||||
#define __SRD 0x0004 /* OK to read */
|
||||
#define __SWR 0x0008 /* OK to write */
|
||||
/* RD and WR are never simultaneously asserted */
|
||||
#define __SRW 0x0010 /* open for reading & writing */
|
||||
#define __SEOF 0x0020 /* found EOF */
|
||||
#define __SERR 0x0040 /* found error */
|
||||
#define __SMBF 0x0080 /* _buf is from malloc */
|
||||
#define __SAPP 0x0100 /* fdopen()ed in append mode - so must write to end */
|
||||
#define __SSTR 0x0200 /* this is an sprintf/snprintf string */
|
||||
#define __SOPT 0x0400 /* do fseek() optimisation */
|
||||
#define __SNPT 0x0800 /* do not do fseek() optimisation */
|
||||
#define __SOFF 0x1000 /* set iff _offset is in fact correct */
|
||||
#define __SORD 0x2000 /* true => stream orientation (byte/wide) decided */
|
||||
#if defined(__CYGWIN__)
|
||||
#define __SCLE 0x4000 /* convert line endings CR/LF <-> NL */
|
||||
#endif
|
||||
#define __SL64 0x8000 /* is 64-bit offset large file */
|
||||
|
||||
/* _flags2 flags */
|
||||
#define __SNLK 0x0001 /* stdio functions do not lock streams themselves */
|
||||
#define __SWID 0x2000 /* true => stream orientation wide, false => byte, only valid if __SORD in _flags is true */
|
||||
|
||||
/*
|
||||
* The following three definitions are for ANSI C, which took them
|
||||
* from System V, which stupidly took internal interface macros and
|
||||
* made them official arguments to setvbuf(), without renaming them.
|
||||
* Hence, these ugly _IOxxx names are *supposed* to appear in user code.
|
||||
*
|
||||
* Although these happen to match their counterparts above, the
|
||||
* implementation does not rely on that (so these could be renumbered).
|
||||
*/
|
||||
#define _IOFBF 0 /* setvbuf should set fully buffered */
|
||||
#define _IOLBF 1 /* setvbuf should set line buffered */
|
||||
#define _IONBF 2 /* setvbuf should set unbuffered */
|
||||
|
||||
#define EOF (-1)
|
||||
|
||||
#ifdef __BUFSIZ__
|
||||
#define BUFSIZ __BUFSIZ__
|
||||
#else
|
||||
#define BUFSIZ 1024
|
||||
#endif
|
||||
|
||||
#ifdef __FOPEN_MAX__
|
||||
#define FOPEN_MAX __FOPEN_MAX__
|
||||
#else
|
||||
#define FOPEN_MAX 20
|
||||
#endif
|
||||
|
||||
#ifdef __FILENAME_MAX__
|
||||
#define FILENAME_MAX __FILENAME_MAX__
|
||||
#else
|
||||
#define FILENAME_MAX 1024
|
||||
#endif
|
||||
|
||||
#ifdef __L_tmpnam__
|
||||
#define L_tmpnam __L_tmpnam__
|
||||
#else
|
||||
#define L_tmpnam FILENAME_MAX
|
||||
#endif
|
||||
|
||||
#ifndef __STRICT_ANSI__
|
||||
#define P_tmpdir "/tmp"
|
||||
#endif
|
||||
|
||||
#ifndef SEEK_SET
|
||||
#define SEEK_SET 0 /* set file offset to offset */
|
||||
#endif
|
||||
#ifndef SEEK_CUR
|
||||
#define SEEK_CUR 1 /* set file offset to current plus offset */
|
||||
#endif
|
||||
#ifndef SEEK_END
|
||||
#define SEEK_END 2 /* set file offset to EOF plus offset */
|
||||
#endif
|
||||
|
||||
#define TMP_MAX 26
|
||||
|
||||
#define stdin (_REENT->_stdin)
|
||||
#define stdout (_REENT->_stdout)
|
||||
#define stderr (_REENT->_stderr)
|
||||
|
||||
#define _stdin_r(x) ((x)->_stdin)
|
||||
#define _stdout_r(x) ((x)->_stdout)
|
||||
#define _stderr_r(x) ((x)->_stderr)
|
||||
|
||||
/*
|
||||
* Functions defined in ANSI C standard.
|
||||
*/
|
||||
|
||||
#ifndef __VALIST
|
||||
#ifdef __GNUC__
|
||||
#define __VALIST __gnuc_va_list
|
||||
#else
|
||||
#define __VALIST char*
|
||||
#endif
|
||||
#endif
|
||||
|
||||
FILE * _EXFUN(tmpfile, (void));
|
||||
char * _EXFUN(tmpnam, (char *));
|
||||
#if __BSD_VISIBLE || __XSI_VISIBLE || __POSIX_VISIBLE >= 200112
|
||||
char * _EXFUN(tempnam, (const char *, const char *));
|
||||
#endif
|
||||
int _EXFUN(fclose, (FILE *));
|
||||
int _EXFUN(fflush, (FILE *));
|
||||
FILE * _EXFUN(freopen, (const char *__restrict, const char *__restrict, FILE *__restrict));
|
||||
void _EXFUN(setbuf, (FILE *__restrict, char *__restrict));
|
||||
int _EXFUN(setvbuf, (FILE *__restrict, char *__restrict, int, size_t));
|
||||
int _EXFUN(fprintf, (FILE *__restrict, const char *__restrict, ...)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 2, 3))));
|
||||
int _EXFUN(fscanf, (FILE *__restrict, const char *__restrict, ...)
|
||||
_ATTRIBUTE ((__format__ (__scanf__, 2, 3))));
|
||||
int _EXFUN(printf, (const char *__restrict, ...)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 1, 2))));
|
||||
int _EXFUN(scanf, (const char *__restrict, ...)
|
||||
_ATTRIBUTE ((__format__ (__scanf__, 1, 2))));
|
||||
int _EXFUN(sscanf, (const char *__restrict, const char *__restrict, ...)
|
||||
_ATTRIBUTE ((__format__ (__scanf__, 2, 3))));
|
||||
int _EXFUN(vfprintf, (FILE *__restrict, const char *__restrict, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 2, 0))));
|
||||
int _EXFUN(vprintf, (const char *, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 1, 0))));
|
||||
int _EXFUN(vsprintf, (char *__restrict, const char *__restrict, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 2, 0))));
|
||||
int _EXFUN(fgetc, (FILE *));
|
||||
char * _EXFUN(fgets, (char *__restrict, int, FILE *__restrict));
|
||||
int _EXFUN(fputc, (int, FILE *));
|
||||
int _EXFUN(fputs, (const char *__restrict, FILE *__restrict));
|
||||
int _EXFUN(getc, (FILE *));
|
||||
int _EXFUN(getchar, (void));
|
||||
char * _EXFUN(gets, (char *));
|
||||
int _EXFUN(putc, (int, FILE *));
|
||||
int _EXFUN(putchar, (int));
|
||||
int _EXFUN(puts, (const char *));
|
||||
int _EXFUN(ungetc, (int, FILE *));
|
||||
size_t _EXFUN(fread, (_PTR __restrict, size_t _size, size_t _n, FILE *__restrict));
|
||||
size_t _EXFUN(fwrite, (const _PTR __restrict , size_t _size, size_t _n, FILE *));
|
||||
#ifdef _COMPILING_NEWLIB
|
||||
int _EXFUN(fgetpos, (FILE *, _fpos_t *));
|
||||
#else
|
||||
int _EXFUN(fgetpos, (FILE *__restrict, fpos_t *__restrict));
|
||||
#endif
|
||||
int _EXFUN(fseek, (FILE *, long, int));
|
||||
#ifdef _COMPILING_NEWLIB
|
||||
int _EXFUN(fsetpos, (FILE *, const _fpos_t *));
|
||||
#else
|
||||
int _EXFUN(fsetpos, (FILE *, const fpos_t *));
|
||||
#endif
|
||||
long _EXFUN(ftell, ( FILE *));
|
||||
void _EXFUN(rewind, (FILE *));
|
||||
void _EXFUN(clearerr, (FILE *));
|
||||
int _EXFUN(feof, (FILE *));
|
||||
int _EXFUN(ferror, (FILE *));
|
||||
void _EXFUN(perror, (const char *));
|
||||
#ifndef _REENT_ONLY
|
||||
FILE * _EXFUN(fopen, (const char *__restrict _name, const char *__restrict _type));
|
||||
int _EXFUN(sprintf, (char *__restrict, const char *__restrict, ...)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 2, 3))));
|
||||
int _EXFUN(remove, (const char *));
|
||||
int _EXFUN(rename, (const char *, const char *));
|
||||
#ifdef _COMPILING_NEWLIB
|
||||
int _EXFUN(_rename, (const char *, const char *));
|
||||
#endif
|
||||
#endif
|
||||
#if !defined(__STRICT_ANSI__) || defined(__USE_XOPEN2K)
|
||||
#ifdef _COMPILING_NEWLIB
|
||||
int _EXFUN(fseeko, (FILE *, _off_t, int));
|
||||
_off_t _EXFUN(ftello, ( FILE *));
|
||||
#else
|
||||
int _EXFUN(fseeko, (FILE *, off_t, int));
|
||||
off_t _EXFUN(ftello, ( FILE *));
|
||||
#endif
|
||||
#endif
|
||||
#if __GNU_VISIBLE
|
||||
int _EXFUN(fcloseall, (_VOID));
|
||||
#endif
|
||||
#if !defined(__STRICT_ANSI__) || (__STDC_VERSION__ >= 199901L) || (__cplusplus >= 201103L)
|
||||
#ifndef _REENT_ONLY
|
||||
int _EXFUN(asiprintf, (char **, const char *, ...)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 2, 3))));
|
||||
char * _EXFUN(asniprintf, (char *, size_t *, const char *, ...)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 3, 4))));
|
||||
char * _EXFUN(asnprintf, (char *__restrict, size_t *__restrict, const char *__restrict, ...)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 3, 4))));
|
||||
int _EXFUN(asprintf, (char **__restrict, const char *__restrict, ...)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 2, 3))));
|
||||
#ifndef diprintf
|
||||
int _EXFUN(diprintf, (int, const char *, ...)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 2, 3))));
|
||||
#endif
|
||||
int _EXFUN(fiprintf, (FILE *, const char *, ...)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 2, 3))));
|
||||
int _EXFUN(fiscanf, (FILE *, const char *, ...)
|
||||
_ATTRIBUTE ((__format__ (__scanf__, 2, 3))));
|
||||
int _EXFUN(iprintf, (const char *, ...)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 1, 2))));
|
||||
int _EXFUN(iscanf, (const char *, ...)
|
||||
_ATTRIBUTE ((__format__ (__scanf__, 1, 2))));
|
||||
int _EXFUN(siprintf, (char *, const char *, ...)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 2, 3))));
|
||||
int _EXFUN(siscanf, (const char *, const char *, ...)
|
||||
_ATTRIBUTE ((__format__ (__scanf__, 2, 3))));
|
||||
int _EXFUN(snprintf, (char *__restrict, size_t, const char *__restrict, ...)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 3, 4))));
|
||||
int _EXFUN(sniprintf, (char *, size_t, const char *, ...)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 3, 4))));
|
||||
int _EXFUN(vasiprintf, (char **, const char *, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 2, 0))));
|
||||
char * _EXFUN(vasniprintf, (char *, size_t *, const char *, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 3, 0))));
|
||||
char * _EXFUN(vasnprintf, (char *, size_t *, const char *, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 3, 0))));
|
||||
int _EXFUN(vasprintf, (char **, const char *, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 2, 0))));
|
||||
int _EXFUN(vdiprintf, (int, const char *, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 2, 0))));
|
||||
int _EXFUN(vfiprintf, (FILE *, const char *, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 2, 0))));
|
||||
int _EXFUN(vfiscanf, (FILE *, const char *, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__scanf__, 2, 0))));
|
||||
int _EXFUN(vfscanf, (FILE *__restrict, const char *__restrict, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__scanf__, 2, 0))));
|
||||
int _EXFUN(viprintf, (const char *, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 1, 0))));
|
||||
int _EXFUN(viscanf, (const char *, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__scanf__, 1, 0))));
|
||||
int _EXFUN(vscanf, (const char *, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__scanf__, 1, 0))));
|
||||
int _EXFUN(vsiprintf, (char *, const char *, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 2, 0))));
|
||||
int _EXFUN(vsiscanf, (const char *, const char *, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__scanf__, 2, 0))));
|
||||
int _EXFUN(vsniprintf, (char *, size_t, const char *, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 3, 0))));
|
||||
int _EXFUN(vsnprintf, (char *__restrict, size_t, const char *__restrict, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 3, 0))));
|
||||
int _EXFUN(vsscanf, (const char *__restrict, const char *__restrict, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__scanf__, 2, 0))));
|
||||
#endif /* !_REENT_ONLY */
|
||||
#endif /* !__STRICT_ANSI__ */
|
||||
|
||||
/*
|
||||
* Routines in POSIX 1003.1:2001.
|
||||
*/
|
||||
|
||||
#ifndef __STRICT_ANSI__
|
||||
#ifndef _REENT_ONLY
|
||||
FILE * _EXFUN(fdopen, (int, const char *));
|
||||
#endif
|
||||
int _EXFUN(fileno, (FILE *));
|
||||
int _EXFUN(getw, (FILE *));
|
||||
int _EXFUN(pclose, (FILE *));
|
||||
FILE * _EXFUN(popen, (const char *, const char *));
|
||||
int _EXFUN(putw, (int, FILE *));
|
||||
void _EXFUN(setbuffer, (FILE *, char *, int));
|
||||
int _EXFUN(setlinebuf, (FILE *));
|
||||
int _EXFUN(getc_unlocked, (FILE *));
|
||||
int _EXFUN(getchar_unlocked, (void));
|
||||
void _EXFUN(flockfile, (FILE *));
|
||||
int _EXFUN(ftrylockfile, (FILE *));
|
||||
void _EXFUN(funlockfile, (FILE *));
|
||||
int _EXFUN(putc_unlocked, (int, FILE *));
|
||||
int _EXFUN(putchar_unlocked, (int));
|
||||
#endif /* ! __STRICT_ANSI__ */
|
||||
|
||||
/*
|
||||
* Routines in POSIX 1003.1:200x.
|
||||
*/
|
||||
|
||||
#ifndef __STRICT_ANSI__
|
||||
# ifndef _REENT_ONLY
|
||||
# ifndef dprintf
|
||||
int _EXFUN(dprintf, (int, const char *__restrict, ...)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 2, 3))));
|
||||
# endif
|
||||
FILE * _EXFUN(fmemopen, (void *__restrict, size_t, const char *__restrict));
|
||||
/* getdelim - see __getdelim for now */
|
||||
/* getline - see __getline for now */
|
||||
FILE * _EXFUN(open_memstream, (char **, size_t *));
|
||||
#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200809
|
||||
int _EXFUN(renameat, (int, const char *, int, const char *));
|
||||
#endif
|
||||
int _EXFUN(vdprintf, (int, const char *__restrict, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 2, 0))));
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Recursive versions of the above.
|
||||
*/
|
||||
|
||||
int _EXFUN(_asiprintf_r, (struct _reent *, char **, const char *, ...)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 3, 4))));
|
||||
char * _EXFUN(_asniprintf_r, (struct _reent *, char *, size_t *, const char *, ...)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 4, 5))));
|
||||
char * _EXFUN(_asnprintf_r, (struct _reent *, char *__restrict, size_t *__restrict, const char *__restrict, ...)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 4, 5))));
|
||||
int _EXFUN(_asprintf_r, (struct _reent *, char **__restrict, const char *__restrict, ...)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 3, 4))));
|
||||
int _EXFUN(_diprintf_r, (struct _reent *, int, const char *, ...)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 3, 4))));
|
||||
int _EXFUN(_dprintf_r, (struct _reent *, int, const char *__restrict, ...)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 3, 4))));
|
||||
int _EXFUN(_fclose_r, (struct _reent *, FILE *));
|
||||
int _EXFUN(_fcloseall_r, (struct _reent *));
|
||||
FILE * _EXFUN(_fdopen_r, (struct _reent *, int, const char *));
|
||||
int _EXFUN(_fflush_r, (struct _reent *, FILE *));
|
||||
int _EXFUN(_fgetc_r, (struct _reent *, FILE *));
|
||||
int _EXFUN(_fgetc_unlocked_r, (struct _reent *, FILE *));
|
||||
char * _EXFUN(_fgets_r, (struct _reent *, char *__restrict, int, FILE *__restrict));
|
||||
char * _EXFUN(_fgets_unlocked_r, (struct _reent *, char *__restrict, int, FILE *__restrict));
|
||||
#ifdef _COMPILING_NEWLIB
|
||||
int _EXFUN(_fgetpos_r, (struct _reent *, FILE *__restrict, _fpos_t *__restrict));
|
||||
int _EXFUN(_fsetpos_r, (struct _reent *, FILE *, const _fpos_t *));
|
||||
#else
|
||||
int _EXFUN(_fgetpos_r, (struct _reent *, FILE *, fpos_t *));
|
||||
int _EXFUN(_fsetpos_r, (struct _reent *, FILE *, const fpos_t *));
|
||||
#endif
|
||||
int _EXFUN(_fiprintf_r, (struct _reent *, FILE *, const char *, ...)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 3, 4))));
|
||||
int _EXFUN(_fiscanf_r, (struct _reent *, FILE *, const char *, ...)
|
||||
_ATTRIBUTE ((__format__ (__scanf__, 3, 4))));
|
||||
FILE * _EXFUN(_fmemopen_r, (struct _reent *, void *__restrict, size_t, const char *__restrict));
|
||||
FILE * _EXFUN(_fopen_r, (struct _reent *, const char *__restrict, const char *__restrict));
|
||||
FILE * _EXFUN(_freopen_r, (struct _reent *, const char *__restrict, const char *__restrict, FILE *__restrict));
|
||||
int _EXFUN(_fprintf_r, (struct _reent *, FILE *__restrict, const char *__restrict, ...)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 3, 4))));
|
||||
int _EXFUN(_fpurge_r, (struct _reent *, FILE *));
|
||||
int _EXFUN(_fputc_r, (struct _reent *, int, FILE *));
|
||||
int _EXFUN(_fputc_unlocked_r, (struct _reent *, int, FILE *));
|
||||
int _EXFUN(_fputs_r, (struct _reent *, const char *__restrict, FILE *__restrict));
|
||||
int _EXFUN(_fputs_unlocked_r, (struct _reent *, const char *__restrict, FILE *__restrict));
|
||||
size_t _EXFUN(_fread_r, (struct _reent *, _PTR __restrict, size_t _size, size_t _n, FILE *__restrict));
|
||||
size_t _EXFUN(_fread_unlocked_r, (struct _reent *, _PTR __restrict, size_t _size, size_t _n, FILE *__restrict));
|
||||
int _EXFUN(_fscanf_r, (struct _reent *, FILE *__restrict, const char *__restrict, ...)
|
||||
_ATTRIBUTE ((__format__ (__scanf__, 3, 4))));
|
||||
int _EXFUN(_fseek_r, (struct _reent *, FILE *, long, int));
|
||||
int _EXFUN(_fseeko_r,(struct _reent *, FILE *, _off_t, int));
|
||||
long _EXFUN(_ftell_r, (struct _reent *, FILE *));
|
||||
_off_t _EXFUN(_ftello_r,(struct _reent *, FILE *));
|
||||
void _EXFUN(_rewind_r, (struct _reent *, FILE *));
|
||||
size_t _EXFUN(_fwrite_r, (struct _reent *, const _PTR __restrict, size_t _size, size_t _n, FILE *__restrict));
|
||||
size_t _EXFUN(_fwrite_unlocked_r, (struct _reent *, const _PTR __restrict, size_t _size, size_t _n, FILE *__restrict));
|
||||
int _EXFUN(_getc_r, (struct _reent *, FILE *));
|
||||
int _EXFUN(_getc_unlocked_r, (struct _reent *, FILE *));
|
||||
int _EXFUN(_getchar_r, (struct _reent *));
|
||||
int _EXFUN(_getchar_unlocked_r, (struct _reent *));
|
||||
char * _EXFUN(_gets_r, (struct _reent *, char *));
|
||||
int _EXFUN(_iprintf_r, (struct _reent *, const char *, ...)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 2, 3))));
|
||||
int _EXFUN(_iscanf_r, (struct _reent *, const char *, ...)
|
||||
_ATTRIBUTE ((__format__ (__scanf__, 2, 3))));
|
||||
FILE * _EXFUN(_open_memstream_r, (struct _reent *, char **, size_t *));
|
||||
void _EXFUN(_perror_r, (struct _reent *, const char *));
|
||||
int _EXFUN(_printf_r, (struct _reent *, const char *__restrict, ...)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 2, 3))));
|
||||
int _EXFUN(_putc_r, (struct _reent *, int, FILE *));
|
||||
int _EXFUN(_putc_unlocked_r, (struct _reent *, int, FILE *));
|
||||
int _EXFUN(_putchar_unlocked_r, (struct _reent *, int));
|
||||
int _EXFUN(_putchar_r, (struct _reent *, int));
|
||||
int _EXFUN(_puts_r, (struct _reent *, const char *));
|
||||
int _EXFUN(_remove_r, (struct _reent *, const char *));
|
||||
int _EXFUN(_rename_r, (struct _reent *,
|
||||
const char *_old, const char *_new));
|
||||
int _EXFUN(_scanf_r, (struct _reent *, const char *__restrict, ...)
|
||||
_ATTRIBUTE ((__format__ (__scanf__, 2, 3))));
|
||||
int _EXFUN(_siprintf_r, (struct _reent *, char *, const char *, ...)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 3, 4))));
|
||||
int _EXFUN(_siscanf_r, (struct _reent *, const char *, const char *, ...)
|
||||
_ATTRIBUTE ((__format__ (__scanf__, 3, 4))));
|
||||
int _EXFUN(_sniprintf_r, (struct _reent *, char *, size_t, const char *, ...)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 4, 5))));
|
||||
int _EXFUN(_snprintf_r, (struct _reent *, char *__restrict, size_t, const char *__restrict, ...)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 4, 5))));
|
||||
int _EXFUN(_sprintf_r, (struct _reent *, char *__restrict, const char *__restrict, ...)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 3, 4))));
|
||||
int _EXFUN(_sscanf_r, (struct _reent *, const char *__restrict, const char *__restrict, ...)
|
||||
_ATTRIBUTE ((__format__ (__scanf__, 3, 4))));
|
||||
char * _EXFUN(_tempnam_r, (struct _reent *, const char *, const char *));
|
||||
FILE * _EXFUN(_tmpfile_r, (struct _reent *));
|
||||
char * _EXFUN(_tmpnam_r, (struct _reent *, char *));
|
||||
int _EXFUN(_ungetc_r, (struct _reent *, int, FILE *));
|
||||
int _EXFUN(_vasiprintf_r, (struct _reent *, char **, const char *, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 3, 0))));
|
||||
char * _EXFUN(_vasniprintf_r, (struct _reent*, char *, size_t *, const char *, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 4, 0))));
|
||||
char * _EXFUN(_vasnprintf_r, (struct _reent*, char *, size_t *, const char *, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 4, 0))));
|
||||
int _EXFUN(_vasprintf_r, (struct _reent *, char **, const char *, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 3, 0))));
|
||||
int _EXFUN(_vdiprintf_r, (struct _reent *, int, const char *, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 3, 0))));
|
||||
int _EXFUN(_vdprintf_r, (struct _reent *, int, const char *__restrict, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 3, 0))));
|
||||
int _EXFUN(_vfiprintf_r, (struct _reent *, FILE *, const char *, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 3, 0))));
|
||||
int _EXFUN(_vfiscanf_r, (struct _reent *, FILE *, const char *, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__scanf__, 3, 0))));
|
||||
int _EXFUN(_vfprintf_r, (struct _reent *, FILE *__restrict, const char *__restrict, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 3, 0))));
|
||||
int _EXFUN(_vfscanf_r, (struct _reent *, FILE *__restrict, const char *__restrict, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__scanf__, 3, 0))));
|
||||
int _EXFUN(_viprintf_r, (struct _reent *, const char *, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 2, 0))));
|
||||
int _EXFUN(_viscanf_r, (struct _reent *, const char *, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__scanf__, 2, 0))));
|
||||
int _EXFUN(_vprintf_r, (struct _reent *, const char *__restrict, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 2, 0))));
|
||||
int _EXFUN(_vscanf_r, (struct _reent *, const char *__restrict, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__scanf__, 2, 0))));
|
||||
int _EXFUN(_vsiprintf_r, (struct _reent *, char *, const char *, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 3, 0))));
|
||||
int _EXFUN(_vsiscanf_r, (struct _reent *, const char *, const char *, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__scanf__, 3, 0))));
|
||||
int _EXFUN(_vsniprintf_r, (struct _reent *, char *, size_t, const char *, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 4, 0))));
|
||||
int _EXFUN(_vsnprintf_r, (struct _reent *, char *__restrict, size_t, const char *__restrict, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 4, 0))));
|
||||
int _EXFUN(_vsprintf_r, (struct _reent *, char *__restrict, const char *__restrict, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 3, 0))));
|
||||
int _EXFUN(_vsscanf_r, (struct _reent *, const char *__restrict, const char *__restrict, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__scanf__, 3, 0))));
|
||||
|
||||
/* Other extensions. */
|
||||
|
||||
int _EXFUN(fpurge, (FILE *));
|
||||
ssize_t _EXFUN(__getdelim, (char **, size_t *, int, FILE *));
|
||||
ssize_t _EXFUN(__getline, (char **, size_t *, FILE *));
|
||||
|
||||
#if __BSD_VISIBLE
|
||||
void _EXFUN(clearerr_unlocked, (FILE *));
|
||||
int _EXFUN(feof_unlocked, (FILE *));
|
||||
int _EXFUN(ferror_unlocked, (FILE *));
|
||||
int _EXFUN(fileno_unlocked, (FILE *));
|
||||
int _EXFUN(fflush_unlocked, (FILE *));
|
||||
int _EXFUN(fgetc_unlocked, (FILE *));
|
||||
int _EXFUN(fputc_unlocked, (int, FILE *));
|
||||
size_t _EXFUN(fread_unlocked, (_PTR __restrict, size_t _size, size_t _n, FILE *__restrict));
|
||||
size_t _EXFUN(fwrite_unlocked, (const _PTR __restrict , size_t _size, size_t _n, FILE *));
|
||||
#endif
|
||||
|
||||
#if __GNU_VISIBLE
|
||||
char * _EXFUN(fgets_unlocked, (char *__restrict, int, FILE *__restrict));
|
||||
int _EXFUN(fputs_unlocked, (const char *__restrict, FILE *__restrict));
|
||||
#endif
|
||||
|
||||
#ifdef __LARGE64_FILES
|
||||
#if !defined(__CYGWIN__) || defined(_COMPILING_NEWLIB)
|
||||
FILE * _EXFUN(fdopen64, (int, const char *));
|
||||
FILE * _EXFUN(fopen64, (const char *, const char *));
|
||||
FILE * _EXFUN(freopen64, (_CONST char *, _CONST char *, FILE *));
|
||||
_off64_t _EXFUN(ftello64, (FILE *));
|
||||
_off64_t _EXFUN(fseeko64, (FILE *, _off64_t, int));
|
||||
int _EXFUN(fgetpos64, (FILE *, _fpos64_t *));
|
||||
int _EXFUN(fsetpos64, (FILE *, const _fpos64_t *));
|
||||
FILE * _EXFUN(tmpfile64, (void));
|
||||
|
||||
FILE * _EXFUN(_fdopen64_r, (struct _reent *, int, const char *));
|
||||
FILE * _EXFUN(_fopen64_r, (struct _reent *,const char *, const char *));
|
||||
FILE * _EXFUN(_freopen64_r, (struct _reent *, _CONST char *, _CONST char *, FILE *));
|
||||
_off64_t _EXFUN(_ftello64_r, (struct _reent *, FILE *));
|
||||
_off64_t _EXFUN(_fseeko64_r, (struct _reent *, FILE *, _off64_t, int));
|
||||
int _EXFUN(_fgetpos64_r, (struct _reent *, FILE *, _fpos64_t *));
|
||||
int _EXFUN(_fsetpos64_r, (struct _reent *, FILE *, const _fpos64_t *));
|
||||
FILE * _EXFUN(_tmpfile64_r, (struct _reent *));
|
||||
#endif /* !__CYGWIN__ */
|
||||
#endif /* __LARGE64_FILES */
|
||||
|
||||
/*
|
||||
* Routines internal to the implementation.
|
||||
*/
|
||||
|
||||
int _EXFUN(__srget_r, (struct _reent *, FILE *));
|
||||
int _EXFUN(__swbuf_r, (struct _reent *, int, FILE *));
|
||||
|
||||
/*
|
||||
* Stdio function-access interface.
|
||||
*/
|
||||
|
||||
#ifndef __STRICT_ANSI__
|
||||
# ifdef __LARGE64_FILES
|
||||
FILE *_EXFUN(funopen,(const _PTR __cookie,
|
||||
int (*__readfn)(_PTR __c, char *__buf,
|
||||
_READ_WRITE_BUFSIZE_TYPE __n),
|
||||
int (*__writefn)(_PTR __c, const char *__buf,
|
||||
_READ_WRITE_BUFSIZE_TYPE __n),
|
||||
_fpos64_t (*__seekfn)(_PTR __c, _fpos64_t __off, int __whence),
|
||||
int (*__closefn)(_PTR __c)));
|
||||
FILE *_EXFUN(_funopen_r,(struct _reent *, const _PTR __cookie,
|
||||
int (*__readfn)(_PTR __c, char *__buf,
|
||||
_READ_WRITE_BUFSIZE_TYPE __n),
|
||||
int (*__writefn)(_PTR __c, const char *__buf,
|
||||
_READ_WRITE_BUFSIZE_TYPE __n),
|
||||
_fpos64_t (*__seekfn)(_PTR __c, _fpos64_t __off, int __whence),
|
||||
int (*__closefn)(_PTR __c)));
|
||||
# else
|
||||
FILE *_EXFUN(funopen,(const _PTR __cookie,
|
||||
int (*__readfn)(_PTR __cookie, char *__buf,
|
||||
_READ_WRITE_BUFSIZE_TYPE __n),
|
||||
int (*__writefn)(_PTR __cookie, const char *__buf,
|
||||
_READ_WRITE_BUFSIZE_TYPE __n),
|
||||
fpos_t (*__seekfn)(_PTR __cookie, fpos_t __off, int __whence),
|
||||
int (*__closefn)(_PTR __cookie)));
|
||||
FILE *_EXFUN(_funopen_r,(struct _reent *, const _PTR __cookie,
|
||||
int (*__readfn)(_PTR __cookie, char *__buf,
|
||||
_READ_WRITE_BUFSIZE_TYPE __n),
|
||||
int (*__writefn)(_PTR __cookie, const char *__buf,
|
||||
_READ_WRITE_BUFSIZE_TYPE __n),
|
||||
fpos_t (*__seekfn)(_PTR __cookie, fpos_t __off, int __whence),
|
||||
int (*__closefn)(_PTR __cookie)));
|
||||
# endif /* !__LARGE64_FILES */
|
||||
|
||||
# define fropen(__cookie, __fn) funopen(__cookie, __fn, (int (*)())0, \
|
||||
(fpos_t (*)())0, (int (*)())0)
|
||||
# define fwopen(__cookie, __fn) funopen(__cookie, (int (*)())0, __fn, \
|
||||
(fpos_t (*)())0, (int (*)())0)
|
||||
|
||||
typedef ssize_t cookie_read_function_t(void *__cookie, char *__buf, size_t __n);
|
||||
typedef ssize_t cookie_write_function_t(void *__cookie, const char *__buf,
|
||||
size_t __n);
|
||||
# ifdef __LARGE64_FILES
|
||||
typedef int cookie_seek_function_t(void *__cookie, _off64_t *__off,
|
||||
int __whence);
|
||||
# else
|
||||
typedef int cookie_seek_function_t(void *__cookie, off_t *__off, int __whence);
|
||||
# endif /* !__LARGE64_FILES */
|
||||
typedef int cookie_close_function_t(void *__cookie);
|
||||
typedef struct
|
||||
{
|
||||
/* These four struct member names are dictated by Linux; hopefully,
|
||||
they don't conflict with any macros. */
|
||||
cookie_read_function_t *read;
|
||||
cookie_write_function_t *write;
|
||||
cookie_seek_function_t *seek;
|
||||
cookie_close_function_t *close;
|
||||
} cookie_io_functions_t;
|
||||
FILE *_EXFUN(fopencookie,(void *__cookie,
|
||||
const char *__mode, cookie_io_functions_t __functions));
|
||||
FILE *_EXFUN(_fopencookie_r,(struct _reent *, void *__cookie,
|
||||
const char *__mode, cookie_io_functions_t __functions));
|
||||
#endif /* ! __STRICT_ANSI__ */
|
||||
|
||||
#ifndef __CUSTOM_FILE_IO__
|
||||
/*
|
||||
* The __sfoo macros are here so that we can
|
||||
* define function versions in the C library.
|
||||
*/
|
||||
#define __sgetc_raw_r(__ptr, __f) (--(__f)->_r < 0 ? __srget_r(__ptr, __f) : (int)(*(__f)->_p++))
|
||||
|
||||
#ifdef __SCLE
|
||||
/* For a platform with CR/LF, additional logic is required by
|
||||
__sgetc_r which would otherwise simply be a macro; therefore we
|
||||
use an inlined function. The function is only meant to be inlined
|
||||
in place as used and the function body should never be emitted.
|
||||
|
||||
There are two possible means to this end when compiling with GCC,
|
||||
one when compiling with a standard C99 compiler, and for other
|
||||
compilers we're just stuck. At the moment, this issue only
|
||||
affects the Cygwin target, so we'll most likely be using GCC. */
|
||||
|
||||
_ELIDABLE_INLINE int __sgetc_r(struct _reent *__ptr, FILE *__p);
|
||||
|
||||
_ELIDABLE_INLINE int __sgetc_r(struct _reent *__ptr, FILE *__p)
|
||||
{
|
||||
int __c = __sgetc_raw_r(__ptr, __p);
|
||||
if ((__p->_flags & __SCLE) && (__c == '\r'))
|
||||
{
|
||||
int __c2 = __sgetc_raw_r(__ptr, __p);
|
||||
if (__c2 == '\n')
|
||||
__c = __c2;
|
||||
else
|
||||
ungetc(__c2, __p);
|
||||
}
|
||||
return __c;
|
||||
}
|
||||
#else
|
||||
#define __sgetc_r(__ptr, __p) __sgetc_raw_r(__ptr, __p)
|
||||
#endif
|
||||
|
||||
#ifdef _never /* __GNUC__ */
|
||||
/* If this inline is actually used, then systems using coff debugging
|
||||
info get hopelessly confused. 21sept93 rich@cygnus.com. */
|
||||
_ELIDABLE_INLINE int __sputc_r(struct _reent *_ptr, int _c, FILE *_p) {
|
||||
if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n'))
|
||||
return (*_p->_p++ = _c);
|
||||
else
|
||||
return (__swbuf_r(_ptr, _c, _p));
|
||||
}
|
||||
#else
|
||||
/*
|
||||
* This has been tuned to generate reasonable code on the vax using pcc
|
||||
*/
|
||||
#define __sputc_raw_r(__ptr, __c, __p) \
|
||||
(--(__p)->_w < 0 ? \
|
||||
(__p)->_w >= (__p)->_lbfsize ? \
|
||||
(*(__p)->_p = (__c)), *(__p)->_p != '\n' ? \
|
||||
(int)*(__p)->_p++ : \
|
||||
__swbuf_r(__ptr, '\n', __p) : \
|
||||
__swbuf_r(__ptr, (int)(__c), __p) : \
|
||||
(*(__p)->_p = (__c), (int)*(__p)->_p++))
|
||||
#ifdef __SCLE
|
||||
#define __sputc_r(__ptr, __c, __p) \
|
||||
((((__p)->_flags & __SCLE) && ((__c) == '\n')) \
|
||||
? __sputc_raw_r(__ptr, '\r', (__p)) : 0 , \
|
||||
__sputc_raw_r((__ptr), (__c), (__p)))
|
||||
#else
|
||||
#define __sputc_r(__ptr, __c, __p) __sputc_raw_r(__ptr, __c, __p)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define __sfeof(p) ((int)(((p)->_flags & __SEOF) != 0))
|
||||
#define __sferror(p) ((int)(((p)->_flags & __SERR) != 0))
|
||||
#define __sclearerr(p) ((void)((p)->_flags &= ~(__SERR|__SEOF)))
|
||||
#define __sfileno(p) ((p)->_file)
|
||||
|
||||
#ifndef _REENT_SMALL
|
||||
#define feof(p) __sfeof(p)
|
||||
#define ferror(p) __sferror(p)
|
||||
#define clearerr(p) __sclearerr(p)
|
||||
|
||||
#if __BSD_VISIBLE
|
||||
#define feof_unlocked(p) __sfeof(p)
|
||||
#define ferror_unlocked(p) __sferror(p)
|
||||
#define clearerr_unlocked(p) __sclearerr(p)
|
||||
#endif /* __BSD_VISIBLE */
|
||||
#endif /* _REENT_SMALL */
|
||||
|
||||
#if 0 /*ndef __STRICT_ANSI__ - FIXME: must initialize stdio first, use fn */
|
||||
#define fileno(p) __sfileno(p)
|
||||
#endif
|
||||
|
||||
#ifndef __CYGWIN__
|
||||
#ifndef lint
|
||||
#define getc(fp) __sgetc_r(_REENT, fp)
|
||||
#define putc(x, fp) __sputc_r(_REENT, x, fp)
|
||||
#endif /* lint */
|
||||
#endif /* __CYGWIN__ */
|
||||
|
||||
#ifndef __STRICT_ANSI__
|
||||
/* fast always-buffered version, true iff error */
|
||||
#define fast_putc(x,p) (--(p)->_w < 0 ? \
|
||||
__swbuf_r(_REENT, (int)(x), p) == EOF : (*(p)->_p = (x), (p)->_p++, 0))
|
||||
|
||||
#define L_cuserid 9 /* posix says it goes in stdio.h :( */
|
||||
#ifdef __CYGWIN__
|
||||
#define L_ctermid 16
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* !__CUSTOM_FILE_IO__ */
|
||||
|
||||
#define getchar() getc(stdin)
|
||||
#define putchar(x) putc(x, stdout)
|
||||
|
||||
#ifndef __STRICT_ANSI__
|
||||
#define getchar_unlocked() getc_unlocked(stdin)
|
||||
#define putchar_unlocked(x) putc_unlocked(x, stdout)
|
||||
#endif
|
||||
|
||||
_END_STD_C
|
||||
|
||||
#undef putchar
|
||||
#undef getchar
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* DOXYGEN */
|
||||
#endif /* STDIO_H */
|
@ -1,336 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Gunar Schorcht
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup cpu_esp32
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief This file is a modification of original sys/types.h
|
||||
*
|
||||
* @author Gunar Schorcht <gunar@schorcht.net>
|
||||
*
|
||||
* This file is just a wrapper around sys/types.h to fix missing types
|
||||
* fsblkcnt_t and fsfilcnt_t needed in statvfs.h
|
||||
*/
|
||||
|
||||
|
||||
/* unified sys/types.h:
|
||||
start with sef's sysvi386 version.
|
||||
merge go32 version -- a few ifdefs.
|
||||
h8300hms, h8300xray, and sysvnecv70 disagree on the following types:
|
||||
|
||||
typedef int gid_t;
|
||||
typedef int uid_t;
|
||||
typedef int dev_t;
|
||||
typedef int ino_t;
|
||||
typedef int mode_t;
|
||||
typedef int caddr_t;
|
||||
|
||||
however, these aren't "reasonable" values, the sysvi386 ones make far
|
||||
more sense, and should work sufficiently well (in particular, h8300
|
||||
doesn't have a stat, and the necv70 doesn't matter.) -- eichin
|
||||
*/
|
||||
|
||||
#ifndef SYS_TYPES_H
|
||||
#define SYS_TYPES_H
|
||||
|
||||
#ifndef DOXYGEN
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef _FSBLKCNT_T_DECLARED
|
||||
#include <stdint.h>
|
||||
typedef uint32_t fsblkcnt_t;
|
||||
typedef uint32_t fsfilcnt_t;
|
||||
#define _FSBLKCNT_T_DECLARED
|
||||
#endif
|
||||
|
||||
#ifndef _SYS_TYPES_H
|
||||
|
||||
#include <_ansi.h>
|
||||
|
||||
#ifndef __INTTYPES_DEFINED__
|
||||
#define __INTTYPES_DEFINED__
|
||||
|
||||
#include <machine/_types.h>
|
||||
|
||||
#if defined(__rtems__) || defined(__XMK__)
|
||||
/*
|
||||
* The following section is RTEMS specific and is needed to more
|
||||
* closely match the types defined in the BSD sys/types.h.
|
||||
* This is needed to let the RTEMS/BSD TCP/IP stack compile.
|
||||
*/
|
||||
|
||||
/* deprecated */
|
||||
#if ___int8_t_defined
|
||||
typedef __uint8_t u_int8_t;
|
||||
#endif
|
||||
#if ___int16_t_defined
|
||||
typedef __uint16_t u_int16_t;
|
||||
#endif
|
||||
#if ___int32_t_defined
|
||||
typedef __uint32_t u_int32_t;
|
||||
#endif
|
||||
|
||||
#if ___int64_t_defined
|
||||
typedef __uint64_t u_int64_t;
|
||||
|
||||
/* deprecated */
|
||||
typedef __uint64_t u_quad_t;
|
||||
typedef __int64_t quad_t;
|
||||
typedef quad_t * qaddr_t;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* ! __INTTYPES_DEFINED */
|
||||
|
||||
#ifndef __need_inttypes
|
||||
|
||||
#define _SYS_TYPES_H
|
||||
#include <sys/_types.h>
|
||||
|
||||
#ifdef __i386__
|
||||
#if defined (GO32) || defined (__MSDOS__)
|
||||
#define __MS_types__
|
||||
#endif
|
||||
#endif
|
||||
|
||||
# include <stddef.h>
|
||||
# include <machine/types.h>
|
||||
|
||||
/* To ensure the stat struct's layout doesn't change when sizeof(int), etc.
|
||||
changes, we assume sizeof short and long never change and have all types
|
||||
used to define struct stat use them and not int where possible.
|
||||
Where not possible, _ST_INTxx are used. It would be preferable to not have
|
||||
such assumptions, but until the extra fluff is necessary, it's avoided.
|
||||
No 64 bit targets use stat yet. What to do about them is postponed
|
||||
until necessary. */
|
||||
#ifdef __GNUC__
|
||||
#define _ST_INT32 __attribute__ ((__mode__ (__SI__)))
|
||||
#else
|
||||
#define _ST_INT32
|
||||
#endif
|
||||
|
||||
# ifndef _POSIX_SOURCE
|
||||
|
||||
# define physadr physadr_t
|
||||
# define quad quad_t
|
||||
|
||||
#ifndef _BSDTYPES_DEFINED
|
||||
/* also defined in mingw/gmon.h and in w32api/winsock[2].h */
|
||||
#ifndef __u_char_defined
|
||||
typedef unsigned char u_char;
|
||||
#define __u_char_defined
|
||||
#endif
|
||||
#ifndef __u_short_defined
|
||||
typedef unsigned short u_short;
|
||||
#define __u_short_defined
|
||||
#endif
|
||||
#ifndef __u_int_defined
|
||||
typedef unsigned int u_int;
|
||||
#define __u_int_defined
|
||||
#endif
|
||||
#ifndef __u_long_defined
|
||||
typedef unsigned long u_long;
|
||||
#define __u_long_defined
|
||||
#endif
|
||||
#define _BSDTYPES_DEFINED
|
||||
#endif
|
||||
|
||||
typedef unsigned short ushort; /* System V compatibility */
|
||||
typedef unsigned int uint; /* System V compatibility */
|
||||
typedef unsigned long ulong; /* System V compatibility */
|
||||
# endif /*!_POSIX_SOURCE */
|
||||
|
||||
#ifndef __clock_t_defined
|
||||
typedef _CLOCK_T_ clock_t;
|
||||
#define __clock_t_defined
|
||||
#endif
|
||||
|
||||
#ifndef __time_t_defined
|
||||
typedef _TIME_T_ time_t;
|
||||
#define __time_t_defined
|
||||
#endif
|
||||
|
||||
#ifndef __timespec_defined
|
||||
#define __timespec_defined
|
||||
/* Time Value Specification Structures, P1003.1b-1993, p. 261 */
|
||||
|
||||
struct timespec {
|
||||
time_t tv_sec; /* Seconds */
|
||||
long tv_nsec; /* Nanoseconds */
|
||||
};
|
||||
#endif
|
||||
|
||||
struct itimerspec {
|
||||
struct timespec it_interval; /* Timer period */
|
||||
struct timespec it_value; /* Timer expiration */
|
||||
};
|
||||
|
||||
#ifndef __daddr_t_defined
|
||||
typedef long daddr_t;
|
||||
#define __daddr_t_defined
|
||||
#endif
|
||||
#ifndef __caddr_t_defined
|
||||
typedef char * caddr_t;
|
||||
#define __caddr_t_defined
|
||||
#endif
|
||||
|
||||
#ifndef __CYGWIN__
|
||||
#if defined(__MS_types__) || defined(__rtems__) || \
|
||||
defined(__sparc__) || defined(__SPU__)
|
||||
typedef unsigned long ino_t;
|
||||
#else
|
||||
typedef unsigned short ino_t;
|
||||
#endif
|
||||
#endif /*__CYGWIN__*/
|
||||
|
||||
#ifdef __MS_types__
|
||||
typedef unsigned long vm_offset_t;
|
||||
typedef unsigned long vm_size_t;
|
||||
|
||||
#define __BIT_TYPES_DEFINED__
|
||||
|
||||
typedef signed char int8_t;
|
||||
typedef unsigned char u_int8_t;
|
||||
typedef short int16_t;
|
||||
typedef unsigned short u_int16_t;
|
||||
typedef int int32_t;
|
||||
typedef unsigned int u_int32_t;
|
||||
typedef long long int64_t;
|
||||
typedef unsigned long long u_int64_t;
|
||||
typedef int32_t register_t;
|
||||
#endif /* __MS_types__ */
|
||||
|
||||
/*
|
||||
* All these should be machine specific - right now they are all broken.
|
||||
* However, for all of Cygnus' embedded targets, we want them to all be
|
||||
* the same. Otherwise things like sizeof (struct stat) might depend on
|
||||
* how the file was compiled (e.g. -mint16 vs -mint32, etc.).
|
||||
*/
|
||||
|
||||
#ifndef __CYGWIN__ /* which defines these types in it's own types.h. */
|
||||
typedef _off_t off_t;
|
||||
typedef __dev_t dev_t;
|
||||
typedef __uid_t uid_t;
|
||||
typedef __gid_t gid_t;
|
||||
#endif
|
||||
|
||||
#if defined(__XMK__)
|
||||
typedef signed char pid_t;
|
||||
#else
|
||||
typedef int pid_t;
|
||||
#endif
|
||||
|
||||
#if defined(__rtems__)
|
||||
typedef _mode_t mode_t;
|
||||
#endif
|
||||
|
||||
#ifndef __CYGWIN__
|
||||
typedef long key_t;
|
||||
#endif
|
||||
typedef _ssize_t ssize_t;
|
||||
|
||||
#if !defined(__CYGWIN__) && !defined(__rtems__)
|
||||
#ifdef __MS_types__
|
||||
typedef char * addr_t;
|
||||
typedef int mode_t;
|
||||
#else
|
||||
#if defined (__sparc__) && !defined (__sparc_v9__)
|
||||
#ifdef __svr4__
|
||||
typedef unsigned long mode_t;
|
||||
#else
|
||||
typedef unsigned short mode_t;
|
||||
#endif
|
||||
#else
|
||||
typedef unsigned int mode_t _ST_INT32;
|
||||
#endif
|
||||
#endif /* ! __MS_types__ */
|
||||
#endif /*__CYGWIN__*/
|
||||
|
||||
typedef unsigned short nlink_t;
|
||||
|
||||
/* We don't define fd_set and friends if we are compiling POSIX
|
||||
source, or if we have included (or may include as indicated
|
||||
by __USE_W32_SOCKETS) the W32api winsock[2].h header which
|
||||
defines Windows versions of them. Note that a program which
|
||||
includes the W32api winsock[2].h header must know what it is doing;
|
||||
it must not call the cygwin32 select function.
|
||||
*/
|
||||
# if !(defined (_POSIX_SOURCE) || defined (_WINSOCK_H) || defined (_WINSOCKAPI_) || defined (__USE_W32_SOCKETS))
|
||||
# define _SYS_TYPES_FD_SET
|
||||
# define NBBY 8 /* number of bits in a byte */
|
||||
/*
|
||||
* Select uses bit masks of file descriptors in longs.
|
||||
* These macros manipulate such bit fields (the filesystem macros use chars).
|
||||
* FD_SETSIZE may be defined by the user, but the default here
|
||||
* should be >= NOFILE (param.h).
|
||||
*/
|
||||
# ifndef FD_SETSIZE
|
||||
# define FD_SETSIZE 64
|
||||
# endif
|
||||
|
||||
typedef long fd_mask;
|
||||
# define NFDBITS (sizeof (fd_mask) * NBBY) /* bits per mask */
|
||||
# ifndef howmany
|
||||
# define howmany(x,y) (((x)+((y)-1))/(y))
|
||||
# endif
|
||||
|
||||
/* We use a macro for fd_set so that including Sockets.h afterwards
|
||||
can work. */
|
||||
typedef struct _types_fd_set {
|
||||
fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)];
|
||||
} _types_fd_set;
|
||||
|
||||
#define fd_set _types_fd_set
|
||||
|
||||
# define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1L << ((n) % NFDBITS)))
|
||||
# define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1L << ((n) % NFDBITS)))
|
||||
# define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1L << ((n) % NFDBITS)))
|
||||
# define FD_ZERO(p) (__extension__ (void)({ \
|
||||
size_t __i; \
|
||||
char *__tmp = (char *)p; \
|
||||
for (__i = 0; __i < sizeof (*(p)); ++__i) \
|
||||
*__tmp++ = 0; \
|
||||
}))
|
||||
|
||||
# endif /* !(defined (_POSIX_SOURCE) || defined (_WINSOCK_H) || defined (_WINSOCKAPI_) || defined (__USE_W32_SOCKETS)) */
|
||||
|
||||
#undef __MS_types__
|
||||
#undef _ST_INT32
|
||||
|
||||
|
||||
#ifndef __clockid_t_defined
|
||||
typedef _CLOCKID_T_ clockid_t;
|
||||
#define __clockid_t_defined
|
||||
#endif
|
||||
|
||||
#ifndef __timer_t_defined
|
||||
typedef _TIMER_T_ timer_t;
|
||||
#define __timer_t_defined
|
||||
#endif
|
||||
|
||||
typedef unsigned long useconds_t;
|
||||
typedef long suseconds_t;
|
||||
|
||||
#endif /* !__need_inttypes */
|
||||
|
||||
#undef __need_inttypes
|
||||
|
||||
#endif /* _SYS_TYPES_H */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* DOXYGEN */
|
||||
#endif /* SYS_TYPES_H */
|
@ -1,39 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Gunar Schorcht
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup cpu_esp32
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Implementation of the kernel's architecture dependent thread interface
|
||||
*
|
||||
* @author Gunar Schorcht <gunar@schorcht.net>
|
||||
*
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifndef THREAD_ARCH_H
|
||||
#define THREAD_ARCH_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Initializes the ISR stack
|
||||
* Initializes the ISR stack with predefined values (address value) to be able to
|
||||
* measure used ISR stack size.
|
||||
*/
|
||||
extern void thread_isr_stack_init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* THREAD_ARCH_H */
|
@ -1,37 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Gunar Schorcht
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup cpu_esp32
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Xtensa ASM code specific configuration options
|
||||
*
|
||||
* @author Gunar Schorcht <gunar@schorcht.net>
|
||||
*/
|
||||
|
||||
#ifndef XTENSA_CONF_H
|
||||
#define XTENSA_CONF_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Xtensa ASM code specific default stack sizes
|
||||
* @{
|
||||
*/
|
||||
#define ISR_STACKSIZE (2048)
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* XTENSA_CONF_H */
|
||||
/** @} */
|
@ -76,7 +76,6 @@ extern "C" {
|
||||
#define CONFIG_SCAN_AP_MAX (32)
|
||||
|
||||
#define CONFIG_USING_NEW_ETS_VPRINTF
|
||||
#define CONFIG_NEWLIB_STDOUT_LINE_ENDING_CRLF
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -1,748 +0,0 @@
|
||||
/**
|
||||
* This file is a modification of the original file to overwrite the *putchar*
|
||||
* and *getchar* macros in the case the *uart_stdio* module is used. If the
|
||||
* *uart_stdio* module is used, *putchar* and *getchar* are redirections to
|
||||
* according *uart_stdio_* functions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted
|
||||
* provided that the above copyright notice and this paragraph are
|
||||
* duplicated in all such forms and that any documentation,
|
||||
* advertising materials, and other materials related to such
|
||||
* distribution and use acknowledge that the software was developed
|
||||
* by the University of California, Berkeley. The name of the
|
||||
* University may not be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* @(#)stdio.h 5.3 (Berkeley) 3/15/86
|
||||
*/
|
||||
|
||||
/*
|
||||
* NB: to fit things in six character monocase externals, the
|
||||
* stdio code uses the prefix `__s' for stdio objects, typically
|
||||
* followed by a three-character attempt at a mnemonic.
|
||||
*/
|
||||
|
||||
#ifndef STDIO_H
|
||||
#define STDIO_H
|
||||
|
||||
#ifndef DOXYGEN
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "_ansi.h"
|
||||
|
||||
#define _FSTDIO /* ``function stdio'' */
|
||||
|
||||
#define __need_size_t
|
||||
#define __need_NULL
|
||||
#include <sys/cdefs.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#define __need___va_list
|
||||
#include <stdarg.h>
|
||||
|
||||
/*
|
||||
* <sys/reent.h> defines __FILE, _fpos_t.
|
||||
* They must be defined there because struct _reent needs them (and we don't
|
||||
* want reent.h to include this file.
|
||||
*/
|
||||
|
||||
#include <sys/reent.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
_BEGIN_STD_C
|
||||
|
||||
typedef __FILE FILE;
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
typedef _fpos64_t fpos_t;
|
||||
#else
|
||||
typedef _fpos_t fpos_t;
|
||||
#ifdef __LARGE64_FILES
|
||||
typedef _fpos64_t fpos64_t;
|
||||
#endif
|
||||
#endif /* !__CYGWIN__ */
|
||||
|
||||
#include <sys/stdio.h>
|
||||
|
||||
#define __SLBF 0x0001 /* line buffered */
|
||||
#define __SNBF 0x0002 /* unbuffered */
|
||||
#define __SRD 0x0004 /* OK to read */
|
||||
#define __SWR 0x0008 /* OK to write */
|
||||
/* RD and WR are never simultaneously asserted */
|
||||
#define __SRW 0x0010 /* open for reading & writing */
|
||||
#define __SEOF 0x0020 /* found EOF */
|
||||
#define __SERR 0x0040 /* found error */
|
||||
#define __SMBF 0x0080 /* _buf is from malloc */
|
||||
#define __SAPP 0x0100 /* fdopen()ed in append mode - so must write to end */
|
||||
#define __SSTR 0x0200 /* this is an sprintf/snprintf string */
|
||||
#define __SOPT 0x0400 /* do fseek() optimisation */
|
||||
#define __SNPT 0x0800 /* do not do fseek() optimisation */
|
||||
#define __SOFF 0x1000 /* set iff _offset is in fact correct */
|
||||
#define __SORD 0x2000 /* true => stream orientation (byte/wide) decided */
|
||||
#if defined(__CYGWIN__)
|
||||
#define __SCLE 0x4000 /* convert line endings CR/LF <-> NL */
|
||||
#endif
|
||||
#define __SL64 0x8000 /* is 64-bit offset large file */
|
||||
|
||||
/* _flags2 flags */
|
||||
#define __SNLK 0x0001 /* stdio functions do not lock streams themselves */
|
||||
#define __SWID 0x2000 /* true => stream orientation wide, false => byte, only valid if __SORD in _flags is true */
|
||||
|
||||
/*
|
||||
* The following three definitions are for ANSI C, which took them
|
||||
* from System V, which stupidly took internal interface macros and
|
||||
* made them official arguments to setvbuf(), without renaming them.
|
||||
* Hence, these ugly _IOxxx names are *supposed* to appear in user code.
|
||||
*
|
||||
* Although these happen to match their counterparts above, the
|
||||
* implementation does not rely on that (so these could be renumbered).
|
||||
*/
|
||||
#define _IOFBF 0 /* setvbuf should set fully buffered */
|
||||
#define _IOLBF 1 /* setvbuf should set line buffered */
|
||||
#define _IONBF 2 /* setvbuf should set unbuffered */
|
||||
|
||||
#define EOF (-1)
|
||||
|
||||
#ifdef __BUFSIZ__
|
||||
#define BUFSIZ __BUFSIZ__
|
||||
#else
|
||||
#define BUFSIZ 1024
|
||||
#endif
|
||||
|
||||
#ifdef __FOPEN_MAX__
|
||||
#define FOPEN_MAX __FOPEN_MAX__
|
||||
#else
|
||||
#define FOPEN_MAX 20
|
||||
#endif
|
||||
|
||||
#ifdef __FILENAME_MAX__
|
||||
#define FILENAME_MAX __FILENAME_MAX__
|
||||
#else
|
||||
#define FILENAME_MAX 1024
|
||||
#endif
|
||||
|
||||
#ifdef __L_tmpnam__
|
||||
#define L_tmpnam __L_tmpnam__
|
||||
#else
|
||||
#define L_tmpnam FILENAME_MAX
|
||||
#endif
|
||||
|
||||
#ifndef __STRICT_ANSI__
|
||||
#define P_tmpdir "/tmp"
|
||||
#endif
|
||||
|
||||
#ifndef SEEK_SET
|
||||
#define SEEK_SET 0 /* set file offset to offset */
|
||||
#endif
|
||||
#ifndef SEEK_CUR
|
||||
#define SEEK_CUR 1 /* set file offset to current plus offset */
|
||||
#endif
|
||||
#ifndef SEEK_END
|
||||
#define SEEK_END 2 /* set file offset to EOF plus offset */
|
||||
#endif
|
||||
|
||||
#define TMP_MAX 26
|
||||
|
||||
#define stdin (_REENT->_stdin)
|
||||
#define stdout (_REENT->_stdout)
|
||||
#define stderr (_REENT->_stderr)
|
||||
|
||||
#define _stdin_r(x) ((x)->_stdin)
|
||||
#define _stdout_r(x) ((x)->_stdout)
|
||||
#define _stderr_r(x) ((x)->_stderr)
|
||||
|
||||
/*
|
||||
* Functions defined in ANSI C standard.
|
||||
*/
|
||||
|
||||
#ifndef __VALIST
|
||||
#ifdef __GNUC__
|
||||
#define __VALIST __gnuc_va_list
|
||||
#else
|
||||
#define __VALIST char*
|
||||
#endif
|
||||
#endif
|
||||
|
||||
FILE * _EXFUN(tmpfile, (void));
|
||||
char * _EXFUN(tmpnam, (char *));
|
||||
#if __BSD_VISIBLE || __XSI_VISIBLE || __POSIX_VISIBLE >= 200112
|
||||
char * _EXFUN(tempnam, (const char *, const char *));
|
||||
#endif
|
||||
int _EXFUN(fclose, (FILE *));
|
||||
int _EXFUN(fflush, (FILE *));
|
||||
FILE * _EXFUN(freopen, (const char *__restrict, const char *__restrict, FILE *__restrict));
|
||||
void _EXFUN(setbuf, (FILE *__restrict, char *__restrict));
|
||||
int _EXFUN(setvbuf, (FILE *__restrict, char *__restrict, int, size_t));
|
||||
int _EXFUN(fprintf, (FILE *__restrict, const char *__restrict, ...)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 2, 3))));
|
||||
int _EXFUN(fscanf, (FILE *__restrict, const char *__restrict, ...)
|
||||
_ATTRIBUTE ((__format__ (__scanf__, 2, 3))));
|
||||
int _EXFUN(printf, (const char *__restrict, ...)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 1, 2))));
|
||||
int _EXFUN(scanf, (const char *__restrict, ...)
|
||||
_ATTRIBUTE ((__format__ (__scanf__, 1, 2))));
|
||||
int _EXFUN(sscanf, (const char *__restrict, const char *__restrict, ...)
|
||||
_ATTRIBUTE ((__format__ (__scanf__, 2, 3))));
|
||||
int _EXFUN(vfprintf, (FILE *__restrict, const char *__restrict, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 2, 0))));
|
||||
int _EXFUN(vprintf, (const char *, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 1, 0))));
|
||||
int _EXFUN(vsprintf, (char *__restrict, const char *__restrict, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 2, 0))));
|
||||
int _EXFUN(fgetc, (FILE *));
|
||||
char * _EXFUN(fgets, (char *__restrict, int, FILE *__restrict));
|
||||
int _EXFUN(fputc, (int, FILE *));
|
||||
int _EXFUN(fputs, (const char *__restrict, FILE *__restrict));
|
||||
int _EXFUN(getc, (FILE *));
|
||||
int _EXFUN(getchar, (void));
|
||||
char * _EXFUN(gets, (char *));
|
||||
int _EXFUN(putc, (int, FILE *));
|
||||
int _EXFUN(putchar, (int));
|
||||
int _EXFUN(puts, (const char *));
|
||||
int _EXFUN(ungetc, (int, FILE *));
|
||||
size_t _EXFUN(fread, (_PTR __restrict, size_t _size, size_t _n, FILE *__restrict));
|
||||
size_t _EXFUN(fwrite, (const _PTR __restrict , size_t _size, size_t _n, FILE *));
|
||||
#ifdef _COMPILING_NEWLIB
|
||||
int _EXFUN(fgetpos, (FILE *, _fpos_t *));
|
||||
#else
|
||||
int _EXFUN(fgetpos, (FILE *__restrict, fpos_t *__restrict));
|
||||
#endif
|
||||
int _EXFUN(fseek, (FILE *, long, int));
|
||||
#ifdef _COMPILING_NEWLIB
|
||||
int _EXFUN(fsetpos, (FILE *, const _fpos_t *));
|
||||
#else
|
||||
int _EXFUN(fsetpos, (FILE *, const fpos_t *));
|
||||
#endif
|
||||
long _EXFUN(ftell, ( FILE *));
|
||||
void _EXFUN(rewind, (FILE *));
|
||||
void _EXFUN(clearerr, (FILE *));
|
||||
int _EXFUN(feof, (FILE *));
|
||||
int _EXFUN(ferror, (FILE *));
|
||||
void _EXFUN(perror, (const char *));
|
||||
#ifndef _REENT_ONLY
|
||||
FILE * _EXFUN(fopen, (const char *__restrict _name, const char *__restrict _type));
|
||||
int _EXFUN(sprintf, (char *__restrict, const char *__restrict, ...)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 2, 3))));
|
||||
int _EXFUN(remove, (const char *));
|
||||
int _EXFUN(rename, (const char *, const char *));
|
||||
#ifdef _COMPILING_NEWLIB
|
||||
int _EXFUN(_rename, (const char *, const char *));
|
||||
#endif
|
||||
#endif
|
||||
#if !defined(__STRICT_ANSI__) || defined(__USE_XOPEN2K)
|
||||
#ifdef _COMPILING_NEWLIB
|
||||
int _EXFUN(fseeko, (FILE *, _off_t, int));
|
||||
_off_t _EXFUN(ftello, ( FILE *));
|
||||
#else
|
||||
int _EXFUN(fseeko, (FILE *, off_t, int));
|
||||
off_t _EXFUN(ftello, ( FILE *));
|
||||
#endif
|
||||
#endif
|
||||
#if __GNU_VISIBLE
|
||||
int _EXFUN(fcloseall, (_VOID));
|
||||
#endif
|
||||
#if !defined(__STRICT_ANSI__) || (__STDC_VERSION__ >= 199901L) || (__cplusplus >= 201103L)
|
||||
#ifndef _REENT_ONLY
|
||||
int _EXFUN(asiprintf, (char **, const char *, ...)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 2, 3))));
|
||||
char * _EXFUN(asniprintf, (char *, size_t *, const char *, ...)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 3, 4))));
|
||||
char * _EXFUN(asnprintf, (char *__restrict, size_t *__restrict, const char *__restrict, ...)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 3, 4))));
|
||||
int _EXFUN(asprintf, (char **__restrict, const char *__restrict, ...)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 2, 3))));
|
||||
#ifndef diprintf
|
||||
int _EXFUN(diprintf, (int, const char *, ...)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 2, 3))));
|
||||
#endif
|
||||
int _EXFUN(fiprintf, (FILE *, const char *, ...)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 2, 3))));
|
||||
int _EXFUN(fiscanf, (FILE *, const char *, ...)
|
||||
_ATTRIBUTE ((__format__ (__scanf__, 2, 3))));
|
||||
int _EXFUN(iprintf, (const char *, ...)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 1, 2))));
|
||||
int _EXFUN(iscanf, (const char *, ...)
|
||||
_ATTRIBUTE ((__format__ (__scanf__, 1, 2))));
|
||||
int _EXFUN(siprintf, (char *, const char *, ...)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 2, 3))));
|
||||
int _EXFUN(siscanf, (const char *, const char *, ...)
|
||||
_ATTRIBUTE ((__format__ (__scanf__, 2, 3))));
|
||||
int _EXFUN(snprintf, (char *__restrict, size_t, const char *__restrict, ...)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 3, 4))));
|
||||
int _EXFUN(sniprintf, (char *, size_t, const char *, ...)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 3, 4))));
|
||||
int _EXFUN(vasiprintf, (char **, const char *, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 2, 0))));
|
||||
char * _EXFUN(vasniprintf, (char *, size_t *, const char *, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 3, 0))));
|
||||
char * _EXFUN(vasnprintf, (char *, size_t *, const char *, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 3, 0))));
|
||||
int _EXFUN(vasprintf, (char **, const char *, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 2, 0))));
|
||||
int _EXFUN(vdiprintf, (int, const char *, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 2, 0))));
|
||||
int _EXFUN(vfiprintf, (FILE *, const char *, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 2, 0))));
|
||||
int _EXFUN(vfiscanf, (FILE *, const char *, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__scanf__, 2, 0))));
|
||||
int _EXFUN(vfscanf, (FILE *__restrict, const char *__restrict, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__scanf__, 2, 0))));
|
||||
int _EXFUN(viprintf, (const char *, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 1, 0))));
|
||||
int _EXFUN(viscanf, (const char *, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__scanf__, 1, 0))));
|
||||
int _EXFUN(vscanf, (const char *, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__scanf__, 1, 0))));
|
||||
int _EXFUN(vsiprintf, (char *, const char *, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 2, 0))));
|
||||
int _EXFUN(vsiscanf, (const char *, const char *, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__scanf__, 2, 0))));
|
||||
int _EXFUN(vsniprintf, (char *, size_t, const char *, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 3, 0))));
|
||||
int _EXFUN(vsnprintf, (char *__restrict, size_t, const char *__restrict, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 3, 0))));
|
||||
int _EXFUN(vsscanf, (const char *__restrict, const char *__restrict, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__scanf__, 2, 0))));
|
||||
#endif /* !_REENT_ONLY */
|
||||
#endif /* !__STRICT_ANSI__ */
|
||||
|
||||
/*
|
||||
* Routines in POSIX 1003.1:2001.
|
||||
*/
|
||||
|
||||
#ifndef __STRICT_ANSI__
|
||||
#ifndef _REENT_ONLY
|
||||
FILE * _EXFUN(fdopen, (int, const char *));
|
||||
#endif
|
||||
int _EXFUN(fileno, (FILE *));
|
||||
int _EXFUN(getw, (FILE *));
|
||||
int _EXFUN(pclose, (FILE *));
|
||||
FILE * _EXFUN(popen, (const char *, const char *));
|
||||
int _EXFUN(putw, (int, FILE *));
|
||||
void _EXFUN(setbuffer, (FILE *, char *, int));
|
||||
int _EXFUN(setlinebuf, (FILE *));
|
||||
int _EXFUN(getc_unlocked, (FILE *));
|
||||
int _EXFUN(getchar_unlocked, (void));
|
||||
void _EXFUN(flockfile, (FILE *));
|
||||
int _EXFUN(ftrylockfile, (FILE *));
|
||||
void _EXFUN(funlockfile, (FILE *));
|
||||
int _EXFUN(putc_unlocked, (int, FILE *));
|
||||
int _EXFUN(putchar_unlocked, (int));
|
||||
#endif /* ! __STRICT_ANSI__ */
|
||||
|
||||
/*
|
||||
* Routines in POSIX 1003.1:200x.
|
||||
*/
|
||||
|
||||
#ifndef __STRICT_ANSI__
|
||||
# ifndef _REENT_ONLY
|
||||
# ifndef dprintf
|
||||
int _EXFUN(dprintf, (int, const char *__restrict, ...)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 2, 3))));
|
||||
# endif
|
||||
FILE * _EXFUN(fmemopen, (void *__restrict, size_t, const char *__restrict));
|
||||
/* getdelim - see __getdelim for now */
|
||||
/* getline - see __getline for now */
|
||||
FILE * _EXFUN(open_memstream, (char **, size_t *));
|
||||
#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200809
|
||||
int _EXFUN(renameat, (int, const char *, int, const char *));
|
||||
#endif
|
||||
int _EXFUN(vdprintf, (int, const char *__restrict, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 2, 0))));
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Recursive versions of the above.
|
||||
*/
|
||||
|
||||
int _EXFUN(_asiprintf_r, (struct _reent *, char **, const char *, ...)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 3, 4))));
|
||||
char * _EXFUN(_asniprintf_r, (struct _reent *, char *, size_t *, const char *, ...)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 4, 5))));
|
||||
char * _EXFUN(_asnprintf_r, (struct _reent *, char *__restrict, size_t *__restrict, const char *__restrict, ...)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 4, 5))));
|
||||
int _EXFUN(_asprintf_r, (struct _reent *, char **__restrict, const char *__restrict, ...)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 3, 4))));
|
||||
int _EXFUN(_diprintf_r, (struct _reent *, int, const char *, ...)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 3, 4))));
|
||||
int _EXFUN(_dprintf_r, (struct _reent *, int, const char *__restrict, ...)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 3, 4))));
|
||||
int _EXFUN(_fclose_r, (struct _reent *, FILE *));
|
||||
int _EXFUN(_fcloseall_r, (struct _reent *));
|
||||
FILE * _EXFUN(_fdopen_r, (struct _reent *, int, const char *));
|
||||
int _EXFUN(_fflush_r, (struct _reent *, FILE *));
|
||||
int _EXFUN(_fgetc_r, (struct _reent *, FILE *));
|
||||
int _EXFUN(_fgetc_unlocked_r, (struct _reent *, FILE *));
|
||||
char * _EXFUN(_fgets_r, (struct _reent *, char *__restrict, int, FILE *__restrict));
|
||||
char * _EXFUN(_fgets_unlocked_r, (struct _reent *, char *__restrict, int, FILE *__restrict));
|
||||
#ifdef _COMPILING_NEWLIB
|
||||
int _EXFUN(_fgetpos_r, (struct _reent *, FILE *__restrict, _fpos_t *__restrict));
|
||||
int _EXFUN(_fsetpos_r, (struct _reent *, FILE *, const _fpos_t *));
|
||||
#else
|
||||
int _EXFUN(_fgetpos_r, (struct _reent *, FILE *, fpos_t *));
|
||||
int _EXFUN(_fsetpos_r, (struct _reent *, FILE *, const fpos_t *));
|
||||
#endif
|
||||
int _EXFUN(_fiprintf_r, (struct _reent *, FILE *, const char *, ...)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 3, 4))));
|
||||
int _EXFUN(_fiscanf_r, (struct _reent *, FILE *, const char *, ...)
|
||||
_ATTRIBUTE ((__format__ (__scanf__, 3, 4))));
|
||||
FILE * _EXFUN(_fmemopen_r, (struct _reent *, void *__restrict, size_t, const char *__restrict));
|
||||
FILE * _EXFUN(_fopen_r, (struct _reent *, const char *__restrict, const char *__restrict));
|
||||
FILE * _EXFUN(_freopen_r, (struct _reent *, const char *__restrict, const char *__restrict, FILE *__restrict));
|
||||
int _EXFUN(_fprintf_r, (struct _reent *, FILE *__restrict, const char *__restrict, ...)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 3, 4))));
|
||||
int _EXFUN(_fpurge_r, (struct _reent *, FILE *));
|
||||
int _EXFUN(_fputc_r, (struct _reent *, int, FILE *));
|
||||
int _EXFUN(_fputc_unlocked_r, (struct _reent *, int, FILE *));
|
||||
int _EXFUN(_fputs_r, (struct _reent *, const char *__restrict, FILE *__restrict));
|
||||
int _EXFUN(_fputs_unlocked_r, (struct _reent *, const char *__restrict, FILE *__restrict));
|
||||
size_t _EXFUN(_fread_r, (struct _reent *, _PTR __restrict, size_t _size, size_t _n, FILE *__restrict));
|
||||
size_t _EXFUN(_fread_unlocked_r, (struct _reent *, _PTR __restrict, size_t _size, size_t _n, FILE *__restrict));
|
||||
int _EXFUN(_fscanf_r, (struct _reent *, FILE *__restrict, const char *__restrict, ...)
|
||||
_ATTRIBUTE ((__format__ (__scanf__, 3, 4))));
|
||||
int _EXFUN(_fseek_r, (struct _reent *, FILE *, long, int));
|
||||
int _EXFUN(_fseeko_r,(struct _reent *, FILE *, _off_t, int));
|
||||
long _EXFUN(_ftell_r, (struct _reent *, FILE *));
|
||||
_off_t _EXFUN(_ftello_r,(struct _reent *, FILE *));
|
||||
void _EXFUN(_rewind_r, (struct _reent *, FILE *));
|
||||
size_t _EXFUN(_fwrite_r, (struct _reent *, const _PTR __restrict, size_t _size, size_t _n, FILE *__restrict));
|
||||
size_t _EXFUN(_fwrite_unlocked_r, (struct _reent *, const _PTR __restrict, size_t _size, size_t _n, FILE *__restrict));
|
||||
int _EXFUN(_getc_r, (struct _reent *, FILE *));
|
||||
int _EXFUN(_getc_unlocked_r, (struct _reent *, FILE *));
|
||||
int _EXFUN(_getchar_r, (struct _reent *));
|
||||
int _EXFUN(_getchar_unlocked_r, (struct _reent *));
|
||||
char * _EXFUN(_gets_r, (struct _reent *, char *));
|
||||
int _EXFUN(_iprintf_r, (struct _reent *, const char *, ...)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 2, 3))));
|
||||
int _EXFUN(_iscanf_r, (struct _reent *, const char *, ...)
|
||||
_ATTRIBUTE ((__format__ (__scanf__, 2, 3))));
|
||||
FILE * _EXFUN(_open_memstream_r, (struct _reent *, char **, size_t *));
|
||||
void _EXFUN(_perror_r, (struct _reent *, const char *));
|
||||
int _EXFUN(_printf_r, (struct _reent *, const char *__restrict, ...)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 2, 3))));
|
||||
int _EXFUN(_putc_r, (struct _reent *, int, FILE *));
|
||||
int _EXFUN(_putc_unlocked_r, (struct _reent *, int, FILE *));
|
||||
int _EXFUN(_putchar_unlocked_r, (struct _reent *, int));
|
||||
int _EXFUN(_putchar_r, (struct _reent *, int));
|
||||
int _EXFUN(_puts_r, (struct _reent *, const char *));
|
||||
int _EXFUN(_remove_r, (struct _reent *, const char *));
|
||||
int _EXFUN(_rename_r, (struct _reent *,
|
||||
const char *_old, const char *_new));
|
||||
int _EXFUN(_scanf_r, (struct _reent *, const char *__restrict, ...)
|
||||
_ATTRIBUTE ((__format__ (__scanf__, 2, 3))));
|
||||
int _EXFUN(_siprintf_r, (struct _reent *, char *, const char *, ...)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 3, 4))));
|
||||
int _EXFUN(_siscanf_r, (struct _reent *, const char *, const char *, ...)
|
||||
_ATTRIBUTE ((__format__ (__scanf__, 3, 4))));
|
||||
int _EXFUN(_sniprintf_r, (struct _reent *, char *, size_t, const char *, ...)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 4, 5))));
|
||||
int _EXFUN(_snprintf_r, (struct _reent *, char *__restrict, size_t, const char *__restrict, ...)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 4, 5))));
|
||||
int _EXFUN(_sprintf_r, (struct _reent *, char *__restrict, const char *__restrict, ...)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 3, 4))));
|
||||
int _EXFUN(_sscanf_r, (struct _reent *, const char *__restrict, const char *__restrict, ...)
|
||||
_ATTRIBUTE ((__format__ (__scanf__, 3, 4))));
|
||||
char * _EXFUN(_tempnam_r, (struct _reent *, const char *, const char *));
|
||||
FILE * _EXFUN(_tmpfile_r, (struct _reent *));
|
||||
char * _EXFUN(_tmpnam_r, (struct _reent *, char *));
|
||||
int _EXFUN(_ungetc_r, (struct _reent *, int, FILE *));
|
||||
int _EXFUN(_vasiprintf_r, (struct _reent *, char **, const char *, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 3, 0))));
|
||||
char * _EXFUN(_vasniprintf_r, (struct _reent*, char *, size_t *, const char *, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 4, 0))));
|
||||
char * _EXFUN(_vasnprintf_r, (struct _reent*, char *, size_t *, const char *, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 4, 0))));
|
||||
int _EXFUN(_vasprintf_r, (struct _reent *, char **, const char *, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 3, 0))));
|
||||
int _EXFUN(_vdiprintf_r, (struct _reent *, int, const char *, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 3, 0))));
|
||||
int _EXFUN(_vdprintf_r, (struct _reent *, int, const char *__restrict, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 3, 0))));
|
||||
int _EXFUN(_vfiprintf_r, (struct _reent *, FILE *, const char *, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 3, 0))));
|
||||
int _EXFUN(_vfiscanf_r, (struct _reent *, FILE *, const char *, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__scanf__, 3, 0))));
|
||||
int _EXFUN(_vfprintf_r, (struct _reent *, FILE *__restrict, const char *__restrict, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 3, 0))));
|
||||
int _EXFUN(_vfscanf_r, (struct _reent *, FILE *__restrict, const char *__restrict, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__scanf__, 3, 0))));
|
||||
int _EXFUN(_viprintf_r, (struct _reent *, const char *, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 2, 0))));
|
||||
int _EXFUN(_viscanf_r, (struct _reent *, const char *, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__scanf__, 2, 0))));
|
||||
int _EXFUN(_vprintf_r, (struct _reent *, const char *__restrict, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 2, 0))));
|
||||
int _EXFUN(_vscanf_r, (struct _reent *, const char *__restrict, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__scanf__, 2, 0))));
|
||||
int _EXFUN(_vsiprintf_r, (struct _reent *, char *, const char *, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 3, 0))));
|
||||
int _EXFUN(_vsiscanf_r, (struct _reent *, const char *, const char *, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__scanf__, 3, 0))));
|
||||
int _EXFUN(_vsniprintf_r, (struct _reent *, char *, size_t, const char *, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 4, 0))));
|
||||
int _EXFUN(_vsnprintf_r, (struct _reent *, char *__restrict, size_t, const char *__restrict, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 4, 0))));
|
||||
int _EXFUN(_vsprintf_r, (struct _reent *, char *__restrict, const char *__restrict, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__printf__, 3, 0))));
|
||||
int _EXFUN(_vsscanf_r, (struct _reent *, const char *__restrict, const char *__restrict, __VALIST)
|
||||
_ATTRIBUTE ((__format__ (__scanf__, 3, 0))));
|
||||
|
||||
/* Other extensions. */
|
||||
|
||||
int _EXFUN(fpurge, (FILE *));
|
||||
ssize_t _EXFUN(__getdelim, (char **, size_t *, int, FILE *));
|
||||
ssize_t _EXFUN(__getline, (char **, size_t *, FILE *));
|
||||
|
||||
#if __BSD_VISIBLE
|
||||
void _EXFUN(clearerr_unlocked, (FILE *));
|
||||
int _EXFUN(feof_unlocked, (FILE *));
|
||||
int _EXFUN(ferror_unlocked, (FILE *));
|
||||
int _EXFUN(fileno_unlocked, (FILE *));
|
||||
int _EXFUN(fflush_unlocked, (FILE *));
|
||||
int _EXFUN(fgetc_unlocked, (FILE *));
|
||||
int _EXFUN(fputc_unlocked, (int, FILE *));
|
||||
size_t _EXFUN(fread_unlocked, (_PTR __restrict, size_t _size, size_t _n, FILE *__restrict));
|
||||
size_t _EXFUN(fwrite_unlocked, (const _PTR __restrict , size_t _size, size_t _n, FILE *));
|
||||
#endif
|
||||
|
||||
#if __GNU_VISIBLE
|
||||
char * _EXFUN(fgets_unlocked, (char *__restrict, int, FILE *__restrict));
|
||||
int _EXFUN(fputs_unlocked, (const char *__restrict, FILE *__restrict));
|
||||
#endif
|
||||
|
||||
#ifdef __LARGE64_FILES
|
||||
#if !defined(__CYGWIN__) || defined(_COMPILING_NEWLIB)
|
||||
FILE * _EXFUN(fdopen64, (int, const char *));
|
||||
FILE * _EXFUN(fopen64, (const char *, const char *));
|
||||
FILE * _EXFUN(freopen64, (_CONST char *, _CONST char *, FILE *));
|
||||
_off64_t _EXFUN(ftello64, (FILE *));
|
||||
_off64_t _EXFUN(fseeko64, (FILE *, _off64_t, int));
|
||||
int _EXFUN(fgetpos64, (FILE *, _fpos64_t *));
|
||||
int _EXFUN(fsetpos64, (FILE *, const _fpos64_t *));
|
||||
FILE * _EXFUN(tmpfile64, (void));
|
||||
|
||||
FILE * _EXFUN(_fdopen64_r, (struct _reent *, int, const char *));
|
||||
FILE * _EXFUN(_fopen64_r, (struct _reent *,const char *, const char *));
|
||||
FILE * _EXFUN(_freopen64_r, (struct _reent *, _CONST char *, _CONST char *, FILE *));
|
||||
_off64_t _EXFUN(_ftello64_r, (struct _reent *, FILE *));
|
||||
_off64_t _EXFUN(_fseeko64_r, (struct _reent *, FILE *, _off64_t, int));
|
||||
int _EXFUN(_fgetpos64_r, (struct _reent *, FILE *, _fpos64_t *));
|
||||
int _EXFUN(_fsetpos64_r, (struct _reent *, FILE *, const _fpos64_t *));
|
||||
FILE * _EXFUN(_tmpfile64_r, (struct _reent *));
|
||||
#endif /* !__CYGWIN__ */
|
||||
#endif /* __LARGE64_FILES */
|
||||
|
||||
/*
|
||||
* Routines internal to the implementation.
|
||||
*/
|
||||
|
||||
int _EXFUN(__srget_r, (struct _reent *, FILE *));
|
||||
int _EXFUN(__swbuf_r, (struct _reent *, int, FILE *));
|
||||
|
||||
/*
|
||||
* Stdio function-access interface.
|
||||
*/
|
||||
|
||||
#ifndef __STRICT_ANSI__
|
||||
# ifdef __LARGE64_FILES
|
||||
FILE *_EXFUN(funopen,(const _PTR __cookie,
|
||||
int (*__readfn)(_PTR __c, char *__buf,
|
||||
_READ_WRITE_BUFSIZE_TYPE __n),
|
||||
int (*__writefn)(_PTR __c, const char *__buf,
|
||||
_READ_WRITE_BUFSIZE_TYPE __n),
|
||||
_fpos64_t (*__seekfn)(_PTR __c, _fpos64_t __off, int __whence),
|
||||
int (*__closefn)(_PTR __c)));
|
||||
FILE *_EXFUN(_funopen_r,(struct _reent *, const _PTR __cookie,
|
||||
int (*__readfn)(_PTR __c, char *__buf,
|
||||
_READ_WRITE_BUFSIZE_TYPE __n),
|
||||
int (*__writefn)(_PTR __c, const char *__buf,
|
||||
_READ_WRITE_BUFSIZE_TYPE __n),
|
||||
_fpos64_t (*__seekfn)(_PTR __c, _fpos64_t __off, int __whence),
|
||||
int (*__closefn)(_PTR __c)));
|
||||
# else
|
||||
FILE *_EXFUN(funopen,(const _PTR __cookie,
|
||||
int (*__readfn)(_PTR __cookie, char *__buf,
|
||||
_READ_WRITE_BUFSIZE_TYPE __n),
|
||||
int (*__writefn)(_PTR __cookie, const char *__buf,
|
||||
_READ_WRITE_BUFSIZE_TYPE __n),
|
||||
fpos_t (*__seekfn)(_PTR __cookie, fpos_t __off, int __whence),
|
||||
int (*__closefn)(_PTR __cookie)));
|
||||
FILE *_EXFUN(_funopen_r,(struct _reent *, const _PTR __cookie,
|
||||
int (*__readfn)(_PTR __cookie, char *__buf,
|
||||
_READ_WRITE_BUFSIZE_TYPE __n),
|
||||
int (*__writefn)(_PTR __cookie, const char *__buf,
|
||||
_READ_WRITE_BUFSIZE_TYPE __n),
|
||||
fpos_t (*__seekfn)(_PTR __cookie, fpos_t __off, int __whence),
|
||||
int (*__closefn)(_PTR __cookie)));
|
||||
# endif /* !__LARGE64_FILES */
|
||||
|
||||
# define fropen(__cookie, __fn) funopen(__cookie, __fn, (int (*)())0, \
|
||||
(fpos_t (*)())0, (int (*)())0)
|
||||
# define fwopen(__cookie, __fn) funopen(__cookie, (int (*)())0, __fn, \
|
||||
(fpos_t (*)())0, (int (*)())0)
|
||||
|
||||
typedef ssize_t cookie_read_function_t(void *__cookie, char *__buf, size_t __n);
|
||||
typedef ssize_t cookie_write_function_t(void *__cookie, const char *__buf,
|
||||
size_t __n);
|
||||
# ifdef __LARGE64_FILES
|
||||
typedef int cookie_seek_function_t(void *__cookie, _off64_t *__off,
|
||||
int __whence);
|
||||
# else
|
||||
typedef int cookie_seek_function_t(void *__cookie, off_t *__off, int __whence);
|
||||
# endif /* !__LARGE64_FILES */
|
||||
typedef int cookie_close_function_t(void *__cookie);
|
||||
typedef struct
|
||||
{
|
||||
/* These four struct member names are dictated by Linux; hopefully,
|
||||
they don't conflict with any macros. */
|
||||
cookie_read_function_t *read;
|
||||
cookie_write_function_t *write;
|
||||
cookie_seek_function_t *seek;
|
||||
cookie_close_function_t *close;
|
||||
} cookie_io_functions_t;
|
||||
FILE *_EXFUN(fopencookie,(void *__cookie,
|
||||
const char *__mode, cookie_io_functions_t __functions));
|
||||
FILE *_EXFUN(_fopencookie_r,(struct _reent *, void *__cookie,
|
||||
const char *__mode, cookie_io_functions_t __functions));
|
||||
#endif /* ! __STRICT_ANSI__ */
|
||||
|
||||
#ifndef __CUSTOM_FILE_IO__
|
||||
/*
|
||||
* The __sfoo macros are here so that we can
|
||||
* define function versions in the C library.
|
||||
*/
|
||||
#define __sgetc_raw_r(__ptr, __f) (--(__f)->_r < 0 ? __srget_r(__ptr, __f) : (int)(*(__f)->_p++))
|
||||
|
||||
#ifdef __SCLE
|
||||
/* For a platform with CR/LF, additional logic is required by
|
||||
__sgetc_r which would otherwise simply be a macro; therefore we
|
||||
use an inlined function. The function is only meant to be inlined
|
||||
in place as used and the function body should never be emitted.
|
||||
|
||||
There are two possible means to this end when compiling with GCC,
|
||||
one when compiling with a standard C99 compiler, and for other
|
||||
compilers we're just stuck. At the moment, this issue only
|
||||
affects the Cygwin target, so we'll most likely be using GCC. */
|
||||
|
||||
_ELIDABLE_INLINE int __sgetc_r(struct _reent *__ptr, FILE *__p);
|
||||
|
||||
_ELIDABLE_INLINE int __sgetc_r(struct _reent *__ptr, FILE *__p)
|
||||
{
|
||||
int __c = __sgetc_raw_r(__ptr, __p);
|
||||
if ((__p->_flags & __SCLE) && (__c == '\r'))
|
||||
{
|
||||
int __c2 = __sgetc_raw_r(__ptr, __p);
|
||||
if (__c2 == '\n')
|
||||
__c = __c2;
|
||||
else
|
||||
ungetc(__c2, __p);
|
||||
}
|
||||
return __c;
|
||||
}
|
||||
#else
|
||||
#define __sgetc_r(__ptr, __p) __sgetc_raw_r(__ptr, __p)
|
||||
#endif
|
||||
|
||||
#ifdef _never /* __GNUC__ */
|
||||
/* If this inline is actually used, then systems using coff debugging
|
||||
info get hopelessly confused. 21sept93 rich@cygnus.com. */
|
||||
_ELIDABLE_INLINE int __sputc_r(struct _reent *_ptr, int _c, FILE *_p) {
|
||||
if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n'))
|
||||
return (*_p->_p++ = _c);
|
||||
else
|
||||
return (__swbuf_r(_ptr, _c, _p));
|
||||
}
|
||||
#else
|
||||
/*
|
||||
* This has been tuned to generate reasonable code on the vax using pcc
|
||||
*/
|
||||
#define __sputc_raw_r(__ptr, __c, __p) \
|
||||
(--(__p)->_w < 0 ? \
|
||||
(__p)->_w >= (__p)->_lbfsize ? \
|
||||
(*(__p)->_p = (__c)), *(__p)->_p != '\n' ? \
|
||||
(int)*(__p)->_p++ : \
|
||||
__swbuf_r(__ptr, '\n', __p) : \
|
||||
__swbuf_r(__ptr, (int)(__c), __p) : \
|
||||
(*(__p)->_p = (__c), (int)*(__p)->_p++))
|
||||
#ifdef __SCLE
|
||||
#define __sputc_r(__ptr, __c, __p) \
|
||||
((((__p)->_flags & __SCLE) && ((__c) == '\n')) \
|
||||
? __sputc_raw_r(__ptr, '\r', (__p)) : 0 , \
|
||||
__sputc_raw_r((__ptr), (__c), (__p)))
|
||||
#else
|
||||
#define __sputc_r(__ptr, __c, __p) __sputc_raw_r(__ptr, __c, __p)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define __sfeof(p) ((int)(((p)->_flags & __SEOF) != 0))
|
||||
#define __sferror(p) ((int)(((p)->_flags & __SERR) != 0))
|
||||
#define __sclearerr(p) ((void)((p)->_flags &= ~(__SERR|__SEOF)))
|
||||
#define __sfileno(p) ((p)->_file)
|
||||
|
||||
#ifndef _REENT_SMALL
|
||||
#define feof(p) __sfeof(p)
|
||||
#define ferror(p) __sferror(p)
|
||||
#define clearerr(p) __sclearerr(p)
|
||||
|
||||
#if __BSD_VISIBLE
|
||||
#define feof_unlocked(p) __sfeof(p)
|
||||
#define ferror_unlocked(p) __sferror(p)
|
||||
#define clearerr_unlocked(p) __sclearerr(p)
|
||||
#endif /* __BSD_VISIBLE */
|
||||
#endif /* _REENT_SMALL */
|
||||
|
||||
#if 0 /*ndef __STRICT_ANSI__ - FIXME: must initialize stdio first, use fn */
|
||||
#define fileno(p) __sfileno(p)
|
||||
#endif
|
||||
|
||||
#ifndef __CYGWIN__
|
||||
#ifndef lint
|
||||
#define getc(fp) __sgetc_r(_REENT, fp)
|
||||
#define putc(x, fp) __sputc_r(_REENT, x, fp)
|
||||
#endif /* lint */
|
||||
#endif /* __CYGWIN__ */
|
||||
|
||||
#ifndef __STRICT_ANSI__
|
||||
/* fast always-buffered version, true iff error */
|
||||
#define fast_putc(x,p) (--(p)->_w < 0 ? \
|
||||
__swbuf_r(_REENT, (int)(x), p) == EOF : (*(p)->_p = (x), (p)->_p++, 0))
|
||||
|
||||
#define L_cuserid 9 /* posix says it goes in stdio.h :( */
|
||||
#ifdef __CYGWIN__
|
||||
#define L_ctermid 16
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* !__CUSTOM_FILE_IO__ */
|
||||
|
||||
#define getchar() getc(stdin)
|
||||
#define putchar(x) putc(x, stdout)
|
||||
|
||||
#ifndef __STRICT_ANSI__
|
||||
#define getchar_unlocked() getc_unlocked(stdin)
|
||||
#define putchar_unlocked(x) putc_unlocked(x, stdout)
|
||||
#endif
|
||||
|
||||
_END_STD_C
|
||||
|
||||
#undef putchar
|
||||
#undef getchar
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* DOXYGEN */
|
||||
#endif /* STDIO_H */
|
@ -1,48 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Gunar Schorcht
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup cpu_esp8266
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Implementation of some tools
|
||||
*
|
||||
* @author Gunar Schorcht <gunar@schorcht.net>
|
||||
*
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifndef TOOLS_H
|
||||
#define TOOLS_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Hexdump of memory
|
||||
* @param[in] addr start address in memory
|
||||
* @param[in] num number of items to dump
|
||||
* @param[in] width format of the items
|
||||
* @param[in] per_line number of items per line
|
||||
*/
|
||||
void esp_hexdump (const void* addr, uint32_t num, char width, uint8_t per_line);
|
||||
|
||||
/**
|
||||
* @brief Print heap and system memory information
|
||||
*/
|
||||
void print_meminfo (void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* TOOLS_H */
|
@ -73,7 +73,6 @@ void esp_riot_init(void)
|
||||
ets_printf("CPU clock frequency: %d MHz\n", system_get_cpu_freq());
|
||||
extern void heap_stats(void);
|
||||
heap_stats();
|
||||
ets_printf("\n");
|
||||
#endif
|
||||
|
||||
/* set exception handlers */
|
||||
@ -96,7 +95,9 @@ void esp_riot_init(void)
|
||||
#endif
|
||||
|
||||
/* initialize stdio*/
|
||||
extern int stdio_is_initialized;
|
||||
stdio_init();
|
||||
stdio_is_initialized = 1;
|
||||
|
||||
/* trigger static peripheral initialization */
|
||||
periph_init();
|
||||
@ -107,6 +108,9 @@ void esp_riot_init(void)
|
||||
#ifdef MODULE_ESP_LOG_STARTUP
|
||||
/* print the board config */
|
||||
board_print_config();
|
||||
#else
|
||||
/* to have an empty line after the unreadable characters from ROM loader */
|
||||
puts("");
|
||||
#endif
|
||||
|
||||
/* initialize ESP system event loop */
|
||||
|
@ -25,15 +25,24 @@
|
||||
|
||||
#ifdef RIOT_VERSION
|
||||
|
||||
/* RIOT has its own putchar function which writes to UART */
|
||||
extern int putchar(int c);
|
||||
#define uart_putc putchar
|
||||
/* the putchar definition from stdio.h can't be used here */
|
||||
#undef putchar
|
||||
|
||||
#else /* RIOT_VERSION */
|
||||
/* inidicator is true when stdio is initialized */
|
||||
int stdio_is_initialized = 0;
|
||||
|
||||
#endif /* RIOT_VERSION */
|
||||
|
||||
#ifndef CONFIG_CONSOLE_UART_NONE
|
||||
static void uart_putc(int c)
|
||||
{
|
||||
#ifdef RIOT_VERSION
|
||||
if (stdio_is_initialized) {
|
||||
putchar(c);
|
||||
return;
|
||||
}
|
||||
#endif /* RIOT_VERSION */
|
||||
|
||||
while (1) {
|
||||
uint32_t fifo_cnt = READ_PERI_REG(UART_STATUS(CONFIG_CONSOLE_UART_NUM)) & (UART_TXFIFO_CNT << UART_TXFIFO_CNT_S);
|
||||
|
||||
@ -47,8 +56,6 @@ static void uart_putc(int c)
|
||||
#define uart_putc(_c) { }
|
||||
#endif
|
||||
|
||||
#endif /* RIOT_VERSION */
|
||||
|
||||
int __attribute__ ((weak)) ets_putc(int c)
|
||||
{
|
||||
#ifdef CONFIG_NEWLIB_STDOUT_LINE_ENDING_CRLF
|
||||
|
@ -38,6 +38,7 @@ PSEUDOMODULES += esp_wifi_any
|
||||
|
||||
# Modules used by ESP*
|
||||
|
||||
USEMODULE += esp_common
|
||||
USEMODULE += esp_freertos
|
||||
USEMODULE += esp_idf
|
||||
USEMODULE += log
|
||||
@ -54,6 +55,7 @@ USEMODULE += xtensa
|
||||
|
||||
INCLUDES += -I$(RIOTBOARD)/common/$(CPU)/include
|
||||
INCLUDES += -I$(RIOTCPU)/esp_common
|
||||
INCLUDES += -I$(RIOTCPU)/esp_common/include
|
||||
INCLUDES += -I$(RIOTCPU)/esp_common/vendor/
|
||||
|
||||
# Flags
|
||||
|
@ -7,11 +7,11 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup cpu_esp8266
|
||||
* @ingroup cpu_esp_common
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief CPU common functions
|
||||
* @brief CPU common functions for ESP SoCs
|
||||
*
|
||||
* @author Gunar Schorcht <gunar@schorcht.net>
|
||||
*/
|
@ -7,11 +7,11 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup cpu_esp8266
|
||||
* @ingroup cpu_esp_common
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Common helper macros
|
||||
* @brief Common helper macros for ESP SoCs
|
||||
*
|
||||
* @author Gunar Schorcht <gunar@schorcht.net>
|
||||
*
|
@ -7,11 +7,11 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup cpu_esp8266
|
||||
* @ingroup cpu_esp_common
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Common log macros
|
||||
* @brief Common log macros for ESP SoCs
|
||||
*
|
||||
* @author Gunar Schorcht <gunar@schorcht.net>
|
||||
*
|
@ -7,11 +7,11 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup cpu_esp8266
|
||||
* @ingroup cpu_esp_common
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief ESP8266 exception handling
|
||||
* @brief Exception handling for ESP SoCs
|
||||
*
|
||||
* @author Gunar Schorcht <gunar@schorcht.net>
|
||||
* @}
|
@ -7,11 +7,11 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup cpu_esp8266
|
||||
* @ingroup cpu_esp_common
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Log module to realize consistent log messages
|
||||
* @brief Log module to realize consistent log messages for ESP SoCs
|
||||
*
|
||||
* @author Gunar Schorcht <gunar@schorcht.net>
|
||||
*/
|
||||
@ -49,7 +49,7 @@ static inline void log_write(unsigned level, const char *format, ...) {
|
||||
else if (level == LOG_DEBUG) { \
|
||||
LOG_TAG(LOG_DEBUG, E, __func__, ##__VA_ARGS__); \
|
||||
} \
|
||||
} while (0)
|
||||
} while (0U)
|
||||
|
||||
#endif /* MODULE_LOG_PRINTFNOFORMAT */
|
||||
|
@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup cpu_esp8266
|
||||
* @ingroup cpu_esp_common
|
||||
* @{
|
||||
*
|
||||
* @file
|
@ -7,11 +7,12 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup cpu_esp8266
|
||||
* @ingroup cpu_esp_common
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Implementation of the kernel's architecture dependent thread interface
|
||||
* @brief Implementation of the kernel's architecture dependent thread
|
||||
* interface for ESP SoCS
|
||||
*
|
||||
* @author Gunar Schorcht <gunar@schorcht.net>
|
||||
*
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Gunar Schorcht
|
||||
* Copyright (C) 2019 Gunar Schorcht
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
@ -7,11 +7,11 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup cpu_esp32
|
||||
* @ingroup cpu_esp_common
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Implementation of some tools
|
||||
* @brief Implementation of some tools for ESP SoCs
|
||||
*
|
||||
* @author Gunar Schorcht <gunar@schorcht.net>
|
||||
*
|
@ -7,11 +7,11 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup cpu_esp8266
|
||||
* @ingroup cpu_esp_common
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Xtensa ASM code specific configuration options
|
||||
* @brief Xtensa ASM code specific configuration options for ESP SoCs
|
||||
*
|
||||
* @author Gunar Schorcht <gunar@schorcht.net>
|
||||
*/
|
Loading…
Reference in New Issue
Block a user