Contiki 3.x
sp-printf.c
1 /**
2  * \addtogroup stm32w-cpu
3  *
4  * @{
5  */
6 
7 #ifdef INTEGER_ONLY
8  #define _vfprintf_r _vfiprintf_r
9  #define _vfprintf _vfiprintf
10  #define vfprintf vfiprintf
11 #endif /* INTEGER_ONLY */
12 
13 #include <_ansi.h>
14 #include <stdio.h>
15 
16 #ifndef _SMALL_PRINTF
17  #include "local.h"
18 #endif /* _SMALL_PRINTF */
19 
20 #ifdef _HAVE_STDC
21 #include <stdarg.h>
22 #else /* _HAVE_STDC */
23 #include <varargs.h>
24 #endif /* _HAVE_STDC */
25 
26 /*--------------------------------------------------------------------------*/
27 #ifndef _SMALL_PRINTF
28 #ifdef _HAVE_STDC
29 int
30 _printf_r (struct _reent *ptr, const char *fmt, ...)
31 #else /* _HAVE_STDC */
32 int
33 _printf_r (ptr, fmt, va_alist)
34  struct _reent *ptr;
35  char *fmt;
36  va_dcl
37 #endif /* _HAVE_STDC */
38 {
39  int ret;
40  va_list ap;
41 
42  //_REENT_SMALL_CHECK_INIT(_stdout_r (ptr));
43 #ifdef _HAVE_STDC
44  va_start (ap, fmt);
45 #else /* _HAVE_STDC */
46  va_start (ap);
47 #endif /* _HAVE_STDC */
48  ret = _vfprintf_r (ptr, _stdout_r (ptr), fmt, ap);
49  va_end (ap);
50  return ret;
51 }
52 #endif /* _SMALL_PRINTF */
53 /*--------------------------------------------------------------------------*/
54 #ifndef _REENT_ONLY
55 #ifdef _HAVE_STDC
56 int
57 printf (const char *fmt, ...)
58 #else /* _HAVE_STDC */
59 int
60 printf (fmt, va_alist)
61  char *fmt;
62  va_dcl
63 #endif /* _HAVE_STDC */
64 {
65  int ret;
66  va_list ap;
67 
68  //_REENT_SMALL_CHECK_INIT(_stdout_r (_REENT));
69 #ifdef _HAVE_STDC
70  va_start (ap, fmt);
71 #else /* _HAVE_STDC */
72  va_start (ap);
73 #endif /* _HAVE_STDC */
74 
75 #ifndef _SMALL_PRINTF
76  ret = vfprintf (_stdout_r (_REENT), fmt, ap);
77 #else /* _SMALL_PRINTF */
78  ret = vfprintf (0, fmt, ap);
79 #endif /* _SMALL_PRINTF */
80  va_end (ap);
81  return ret;
82 }
83 #endif /* _REENT_ONLY */
84 /** @} */