summaryrefslogtreecommitdiffstats
path: root/newlib/libc/machine/spu/printf.c
blob: bf3658ba6f43739a5dee4da3f6abe96faba2fecc (plain)
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
#include <_ansi.h>
#include <stdio.h>

#include "c99ppe.h"

#ifdef _HAVE_STDC
#include <stdarg.h>
#else
#include <varargs.h>
#endif

#ifdef INTEGER_ONLY
#  define printf iprintf
#endif

typedef struct
{
  _CONST char* fmt;
  unsigned int pad0[ 3 ];
  va_list ap;
} c99_printf_t;

#ifndef _REENT_ONLY

#ifdef _HAVE_STDC
int
_DEFUN (printf, (fmt,ap),
	_CONST char *fmt _AND
	...)
#else
int
#error
printf (fmt, va_alist)
     _CONST char *fmt;
     va_dcl
#endif
{
  int ret;
  c99_printf_t args;

  CHECK_STD_INIT(_REENT);

  args.fmt = fmt;
#ifdef _HAVE_STDC
  va_start (args.ap, fmt);
#else
  va_start (args.ap);
#endif

  ret = __send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VPRINTF, &args);

  va_end (args.ap);
  return ret;
}

#endif /* ! _REENT_ONLY */