-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharm_stdclib.h
43 lines (31 loc) · 1.59 KB
/
arm_stdclib.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*!\file arm_stdclib.h
** \author SMFSW
** \copyright MIT (c) 2017-2024, SMFSW
** \brief ARM common standard c library wrapper macros
*/
/****************************************************************/
#ifndef ARM_STDCLIB_H_
#define ARM_STDCLIB_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <string.h>
#include <stdio.h>
/****************************************************************/
/*** prints and strings ***/
#define str_clr(s) (s[0] = charNull) //!< clear string \p s (fast way)
#define str_clr_safe(s) (memset(s, charNull, sizeof(s))) //!< clear string \p s (safe way)
#define str_add_tab(s) (strcat(s, '\t')) //!< Adding tab to \p s string using strcat
#define str_add_cr(s) (strcat(s, '\r')) //!< Adding carriage return to \p s string using strcat
#define str_add_lf(s) (strcat(s, '\n')) //!< Adding line feed to \p s string using strcat
#define str_add_crlf(s) (strcat(s, '\r\n')) //!< Adding carriage return and line feed to \p s string using strcat
#define printExpr(e) (printf("%s = %d\r\n", STR(e), (e))) //!< Print expression \p e and it's result \p e using \c printf
#define verbInstr(i) (printf(STR(i)), (i)) //!< Print instruction \p i and execute it
#define verbInc(x) (puts("Incrementing " STR(x)), (x)++) //!< Increment example on \p x using \c puts
#define verbDec(x) (puts("Decrementing " STR(x)), (x)--) //!< Decrement example on \p x using \c puts
/****************************************************************/
#ifdef __cplusplus
}
#endif
#endif /* ARM_STDCLIB_H_ */
/****************************************************************/