blob: 5bbd8a55bf3b71823ad520e03272ef310adda526 [file] [log] [blame]
Daniel Dunbar67588922011-11-16 22:40:57 +00001/* ===-- stdio.h - stub SDK header for compiler-rt --------------------------===
2 *
3 * The LLVM Compiler Infrastructure
4 *
5 * This file is dual licensed under the MIT and the University of Illinois Open
6 * Source Licenses. See LICENSE.TXT for details.
7 *
8 * ===-----------------------------------------------------------------------===
9 *
10 * This is a stub SDK header file. This file is not part of the interface of
11 * this library nor an official version of the appropriate SDK header. It is
12 * intended only to stub the features of this header required by compiler-rt.
13 *
14 * ===-----------------------------------------------------------------------===
15 */
16
17#ifndef __STDIO_H__
18#define __STDIO_H__
19
Richard Smith4a4ef702012-11-13 23:55:06 +000020#if defined(__cplusplus)
21extern "C" {
22#endif
23
Daniel Dunbar67588922011-11-16 22:40:57 +000024typedef struct __sFILE FILE;
25typedef __SIZE_TYPE__ size_t;
26
27/* Determine the appropriate fopen() and fwrite() functions. */
28#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
29# if defined(__i386)
30# define __FOPEN_NAME "_fopen$UNIX2003"
31# define __FWRITE_NAME "_fwrite$UNIX2003"
32# elif defined(__x86_64__)
33# define __FOPEN_NAME "_fopen"
34# define __FWRITE_NAME "_fwrite"
35# elif defined(__arm)
36# define __FOPEN_NAME "_fopen"
37# define __FWRITE_NAME "_fwrite"
38# else
39# error "unrecognized architecture for targetting OS X"
40# endif
41#elif defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__)
42# if defined(__i386) || defined (__x86_64)
43# define __FOPEN_NAME "_fopen"
44# define __FWRITE_NAME "_fwrite"
45# elif defined(__arm)
46# define __FOPEN_NAME "_fopen"
47# define __FWRITE_NAME "_fwrite"
48# else
49# error "unrecognized architecture for targetting iOS"
50# endif
51#else
52# error "unrecognized architecture for targetting Darwin"
53#endif
54
55# define stderr __stderrp
56extern FILE *__stderrp;
57
Bill Wendling843f3592012-09-14 18:55:32 +000058#ifndef SEEK_SET
59#define SEEK_SET 0 /* set file offset to offset */
60#endif
61#ifndef SEEK_CUR
62#define SEEK_CUR 1 /* set file offset to current plus offset */
63#endif
64#ifndef SEEK_END
65#define SEEK_END 2 /* set file offset to EOF plus offset */
66#endif
67
Daniel Dunbar67588922011-11-16 22:40:57 +000068int fclose(FILE *);
69int fflush(FILE *);
Richard Smith4a4ef702012-11-13 23:55:06 +000070FILE *fopen(const char * __restrict, const char * __restrict) __asm(__FOPEN_NAME);
71int fprintf(FILE * __restrict, const char * __restrict, ...);
72size_t fwrite(const void * __restrict, size_t, size_t, FILE * __restrict)
Daniel Dunbar67588922011-11-16 22:40:57 +000073 __asm(__FWRITE_NAME);
Bill Wendling843f3592012-09-14 18:55:32 +000074size_t fread(void * __restrict, size_t, size_t, FILE * __restrict);
75long ftell(FILE *);
76int fseek(FILE *, long, int);
Bill Wendling2a46a602013-05-15 21:31:22 +000077void setbuf(FILE * __restrict, char * __restrict);
Daniel Dunbar67588922011-11-16 22:40:57 +000078
Richard Smith4a4ef702012-11-13 23:55:06 +000079int snprintf(char * __restrict, size_t, const char * __restrict, ...);
80
81#if defined(__cplusplus)
82}
83#endif
84
Daniel Dunbar67588922011-11-16 22:40:57 +000085#endif /* __STDIO_H__ */