1 /* ===-- 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 20 #if defined(__cplusplus) 21 extern "C" { 22 #endif 23 24 typedef struct __sFILE FILE; 25 typedef __SIZE_TYPE__ size_t; 26 27 /* Determine the appropriate fdopen, fopen(), and fwrite() functions. */ 28 #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) 29 # if defined(__i386) 30 # define __FDOPEN_NAME "_fdopen$UNIX2003" 31 # define __FOPEN_NAME "_fopen$UNIX2003" 32 # define __FWRITE_NAME "_fwrite$UNIX2003" 33 # elif defined(__x86_64__) 34 # define __FDOPEN_NAME "_fdopen" 35 # define __FOPEN_NAME "_fopen" 36 # define __FWRITE_NAME "_fwrite" 37 # elif defined(__arm) 38 # define __FDOPEN_NAME "_fdopen" 39 # define __FOPEN_NAME "_fopen" 40 # define __FWRITE_NAME "_fwrite" 41 # else 42 # error "unrecognized architecture for targeting OS X" 43 # endif 44 #elif defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) 45 # if defined(__i386) || defined (__x86_64) 46 # define __FDOPEN_NAME "_fdopen" 47 # define __FOPEN_NAME "_fopen" 48 # define __FWRITE_NAME "_fwrite" 49 # elif defined(__arm) 50 # define __FDOPEN_NAME "_fdopen" 51 # define __FOPEN_NAME "_fopen" 52 # define __FWRITE_NAME "_fwrite" 53 # else 54 # error "unrecognized architecture for targeting iOS" 55 # endif 56 #else 57 # error "unrecognized architecture for targeting Darwin" 58 #endif 59 60 # define stderr __stderrp 61 extern FILE *__stderrp; 62 63 #ifndef SEEK_SET 64 #define SEEK_SET 0 /* set file offset to offset */ 65 #endif 66 #ifndef SEEK_CUR 67 #define SEEK_CUR 1 /* set file offset to current plus offset */ 68 #endif 69 #ifndef SEEK_END 70 #define SEEK_END 2 /* set file offset to EOF plus offset */ 71 #endif 72 73 int fclose(FILE *); 74 int fflush(FILE *); 75 FILE *fopen(const char * __restrict, const char * __restrict) __asm(__FOPEN_NAME); 76 FILE *fdopen(int, const char *) __asm(__FDOPEN_NAME); 77 int fprintf(FILE * __restrict, const char * __restrict, ...); 78 int fputc(int, FILE *); 79 size_t fwrite(const void * __restrict, size_t, size_t, FILE * __restrict) 80 __asm(__FWRITE_NAME); 81 size_t fread(void * __restrict, size_t, size_t, FILE * __restrict); 82 long ftell(FILE *); 83 int fseek(FILE *, long, int); 84 int snprintf(char * __restrict, size_t, const char * __restrict, ...); 85 86 #if defined(__cplusplus) 87 } 88 #endif 89 90 #endif /* __STDIO_H__ */ 91