-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathh3rdparty_printf.c
63 lines (51 loc) · 1.14 KB
/
h3rdparty_printf.c
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/***************************************************************
* Name: h3rdparty_printf.c
* Purpose: 引入第三方源代码文件
* Author: HYH (hyhsystem.cn)
* Created: 2024-09-27
* Copyright: HYH (hyhsystem.cn)
* License: MIT
**************************************************************/
#include "h3rdparty.h"
#ifdef _putchar
#undef _putchar
#endif
#define _putchar hputchar
static void (*putchar_cb)(char c)=NULL;
void hprintf_set_callback(void (*cb)(char c))
{
putchar_cb=cb;
}
void _putchar(char c)
{
if(putchar_cb!=NULL)
{
putchar_cb(c);
}
}
#ifdef printf_
#undef printf_
#endif // printf_
#define printf_ hprintf
#ifdef sprintf_
#undef sprintf_
#endif // sprintf_
#define sprintf_ hsprintf
#ifdef snprintf_
#undef snprintf_
#endif // snprintf_
#define snprintf_ hsnprintf
#ifdef vsnprintf_
#undef vsnprintf_
#endif // vsnprintf_
#define vsnprintf_ hvsnprintf
#ifdef vprintf_
#undef vprintf_
#endif // vprintf_
#define vprintf_ hvprintf
#ifdef fctprintf
#undef fctprintf
#endif // fctprintf
#define fctprintf hfctprintf
#include "3rdparty/printf/printf.h"
#include "3rdparty/printf/printf.c"