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