mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-27 18:02:17 +03:00
Migrate from astyle to clang-format (#8464)
This commit is contained in:
committed by
Max Prokhorov
parent
46190b61f1
commit
19b7a29720
@ -30,7 +30,8 @@
|
||||
*/
|
||||
|
||||
#define CORE_MOCK 1
|
||||
#define MOCK "(mock) " // TODO: provide common logging API instead of adding this string everywhere?
|
||||
#define MOCK \
|
||||
"(mock) " // TODO: provide common logging API instead of adding this string everywhere?
|
||||
|
||||
//
|
||||
|
||||
@ -57,15 +58,15 @@
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
// TODO: #include <stdlib_noniso.h> ?
|
||||
char* itoa (int val, char *s, int radix);
|
||||
char* ltoa (long val, char *s, int radix);
|
||||
// TODO: #include <stdlib_noniso.h> ?
|
||||
char* itoa(int val, char* s, int radix);
|
||||
char* ltoa(long val, char* s, int radix);
|
||||
|
||||
|
||||
size_t strlcat(char *dst, const char *src, size_t size);
|
||||
size_t strlcpy(char *dst, const char *src, size_t size);
|
||||
size_t strlcat(char* dst, const char* src, size_t size);
|
||||
size_t strlcpy(char* dst, const char* src, size_t size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
@ -74,7 +75,7 @@ size_t strlcpy(char *dst, const char *src, size_t size);
|
||||
// exotic typedefs used in the sdk
|
||||
|
||||
#include <stdint.h>
|
||||
typedef uint8_t uint8;
|
||||
typedef uint8_t uint8;
|
||||
typedef uint32_t uint32;
|
||||
|
||||
//
|
||||
@ -97,26 +98,30 @@ uint32_t esp_get_cycle_count();
|
||||
//
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
#include <osapi.h>
|
||||
int ets_printf (const char* fmt, ...) __attribute__ ((format (printf, 1, 2)));
|
||||
int ets_printf(const char* fmt, ...) __attribute__((format(printf, 1, 2)));
|
||||
#define os_printf_plus printf
|
||||
#define ets_vsnprintf vsnprintf
|
||||
inline void ets_putc (char c) { putchar(c); }
|
||||
inline void ets_putc(char c)
|
||||
{
|
||||
putchar(c);
|
||||
}
|
||||
|
||||
int mockverbose (const char* fmt, ...) __attribute__ ((format (printf, 1, 2)));
|
||||
int mockverbose(const char* fmt, ...) __attribute__((format(printf, 1, 2)));
|
||||
|
||||
extern const char* host_interface; // cmdline parameter
|
||||
extern bool serial_timestamp;
|
||||
extern int mock_port_shifter;
|
||||
extern bool blocking_uart;
|
||||
extern uint32_t global_source_address; // 0 = INADDR_ANY by default
|
||||
extern const char* host_interface; // cmdline parameter
|
||||
extern bool serial_timestamp;
|
||||
extern int mock_port_shifter;
|
||||
extern bool blocking_uart;
|
||||
extern uint32_t global_source_address; // 0 = INADDR_ANY by default
|
||||
|
||||
#define NO_GLOBAL_BINDING 0xffffffff
|
||||
extern uint32_t global_ipv4_netfmt; // selected interface addresse to bind to
|
||||
extern uint32_t global_ipv4_netfmt; // selected interface addresse to bind to
|
||||
|
||||
void loop_end();
|
||||
void loop_end();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
@ -132,41 +137,48 @@ void loop_end();
|
||||
|
||||
// uart
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
void uart_new_data(const int uart_nr, uint8_t data);
|
||||
void uart_new_data(const int uart_nr, uint8_t data);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
// tcp
|
||||
int mockSockSetup (int sock);
|
||||
int mockConnect (uint32_t addr, int& sock, int port);
|
||||
ssize_t mockFillInBuf (int sock, char* ccinbuf, size_t& ccinbufsize);
|
||||
ssize_t mockPeekBytes (int sock, char* dst, size_t size, int timeout_ms, char* buf, size_t& bufsize);
|
||||
ssize_t mockRead (int sock, char* dst, size_t size, int timeout_ms, char* buf, size_t& bufsize);
|
||||
ssize_t mockWrite (int sock, const uint8_t* data, size_t size, int timeout_ms);
|
||||
int serverAccept (int sock);
|
||||
int mockSockSetup(int sock);
|
||||
int mockConnect(uint32_t addr, int& sock, int port);
|
||||
ssize_t mockFillInBuf(int sock, char* ccinbuf, size_t& ccinbufsize);
|
||||
ssize_t mockPeekBytes(int sock, char* dst, size_t size, int timeout_ms, char* buf, size_t& bufsize);
|
||||
ssize_t mockRead(int sock, char* dst, size_t size, int timeout_ms, char* buf, size_t& bufsize);
|
||||
ssize_t mockWrite(int sock, const uint8_t* data, size_t size, int timeout_ms);
|
||||
int serverAccept(int sock);
|
||||
|
||||
// udp
|
||||
void check_incoming_udp ();
|
||||
int mockUDPSocket ();
|
||||
bool mockUDPListen (int sock, uint32_t dstaddr, uint16_t port, uint32_t mcast = 0);
|
||||
size_t mockUDPFillInBuf (int sock, char* ccinbuf, size_t& ccinbufsize, uint8_t& addrsize, uint8_t addr[16], uint16_t& port);
|
||||
size_t mockUDPPeekBytes (int sock, char* dst, size_t usersize, int timeout_ms, char* ccinbuf, size_t& ccinbufsize);
|
||||
size_t mockUDPRead (int sock, char* dst, size_t size, int timeout_ms, char* ccinbuf, size_t& ccinbufsize);
|
||||
size_t mockUDPWrite (int sock, const uint8_t* data, size_t size, int timeout_ms, uint32_t ipv4, uint16_t port);
|
||||
void mockUDPSwallow (size_t copied, char* ccinbuf, size_t& ccinbufsize);
|
||||
void check_incoming_udp();
|
||||
int mockUDPSocket();
|
||||
bool mockUDPListen(int sock, uint32_t dstaddr, uint16_t port, uint32_t mcast = 0);
|
||||
size_t mockUDPFillInBuf(int sock, char* ccinbuf, size_t& ccinbufsize, uint8_t& addrsize,
|
||||
uint8_t addr[16], uint16_t& port);
|
||||
size_t mockUDPPeekBytes(int sock, char* dst, size_t usersize, int timeout_ms, char* ccinbuf,
|
||||
size_t& ccinbufsize);
|
||||
size_t mockUDPRead(int sock, char* dst, size_t size, int timeout_ms, char* ccinbuf,
|
||||
size_t& ccinbufsize);
|
||||
size_t mockUDPWrite(int sock, const uint8_t* data, size_t size, int timeout_ms, uint32_t ipv4,
|
||||
uint16_t port);
|
||||
void mockUDPSwallow(size_t copied, char* ccinbuf, size_t& ccinbufsize);
|
||||
|
||||
class UdpContext;
|
||||
void register_udp (int sock, UdpContext* udp = nullptr);
|
||||
void register_udp(int sock, UdpContext* udp = nullptr);
|
||||
|
||||
//
|
||||
|
||||
void mock_start_spiffs (const String& fname, size_t size_kb, size_t block_kb = 8, size_t page_b = 512);
|
||||
void mock_stop_spiffs ();
|
||||
void mock_start_littlefs (const String& fname, size_t size_kb, size_t block_kb = 8, size_t page_b = 512);
|
||||
void mock_stop_littlefs ();
|
||||
void mock_start_spiffs(const String& fname, size_t size_kb, size_t block_kb = 8,
|
||||
size_t page_b = 512);
|
||||
void mock_stop_spiffs();
|
||||
void mock_start_littlefs(const String& fname, size_t size_kb, size_t block_kb = 8,
|
||||
size_t page_b = 512);
|
||||
void mock_stop_littlefs();
|
||||
|
||||
//
|
||||
|
||||
@ -174,4 +186,4 @@ void mock_stop_littlefs ();
|
||||
|
||||
//
|
||||
|
||||
#endif // __cplusplus
|
||||
#endif // __cplusplus
|
||||
|
Reference in New Issue
Block a user