/* Copyright 07/20/98 Sun Microsystems, Inc. All Rights Reserved */ #if !defined(__STD_CSTDIO) && !defined(__STD_STDIO_H) #define __STD_CSTDIO #include #include #ifndef NULL #define NULL 0 #endif #define BUFSIZ 1024 #if !defined(_LP64) && (_FILE_OFFSET_BITS == 64 || defined(_LARGEFILE64_SOURCE)) /* * The following typedefs are adopted from ones in (with leading * underscores added to avoid polluting the ANSI C name space). See the * commentary there for further explanation. */ #if !defined(_NO_LONGLONG) typedef long long __longlong_t; #else /* used to reserve space and generate alignment */ typedef union { double _d; int _l[2]; } __longlong_t; #endif #endif /* !_LP64 && _FILE_OFFSET_BITS == 64 || defined(_LARGEFILE64_SOURCE) */ #if defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 >= 4) && !defined(_VA_LIST) #define _VA_LIST typedef __va_list va_list; #endif /* defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 >= 4) && ... */ #if #machine(i386) || defined(__i386) #define _NFILE 60 /* initial number of streams: Intel x86 ABI */ #else #define _NFILE 20 /* initial number of streams: SPARC ABI and default */ #endif #if defined(i386) || defined(__i386) #define _NFILE 60 /* initial number of streams: Intel x86 ABI */ #else #define _NFILE 20 /* initial number of streams: SPARC ABI and default */ #endif #define _SBFSIZ 8 /* compatibility with shared libs */ #define _IOFBF 0000 /* full buffered */ #define _IOLBF 0100 /* line buffered */ #define _IONBF 0004 /* not buffered */ #define _IOEOF 0020 /* EOF reached on read */ #define _IOERR 0040 /* I/O error from system */ #define _IOREAD 0001 /* currently reading */ #define _IOWRT 0002 /* currently writing */ #define _IORW 0200 /* opened for reading and writing */ #define _IOMYBUF 0010 /* stdio malloc()'d buffer */ #ifndef EOF #define EOF (-1) #endif #define FOPEN_MAX _NFILE #define FILENAME_MAX 1024 /* max # of characters in a path name */ #define SEEK_SET 0 #define SEEK_CUR 1 #define SEEK_END 2 #define TMP_MAX 17576 /* 26 * 26 * 26 */ #define L_tmpnam 25 /* (sizeof(P_tmpdir) + 15) */ #define stdin (&__iob[0]) #define stdout (&__iob[1]) #define stderr (&__iob[2]) #ifndef _STRUCT_FILE // needed for cwchar #define _STRUCT_FILE #if !defined(__SunOS_5_4) && !defined(__SunOS_5_5) && !defined(__SunOS_5_5_1) && !defined(__SunOS_5_6) #include #include #else struct __FILE /* needs to be binary-compatible with old versions */ { #ifdef _STDIO_REVERSE unsigned char *_ptr; /* next character from/to here in buffer */ int _cnt; /* number of available characters in buffer */ #else int _cnt; /* number of available characters in buffer */ unsigned char *_ptr; /* next character from/to here in buffer */ #endif unsigned char *_base; /* the buffer */ unsigned char _flag; /* the state of the stream */ unsigned char _file; /* UNIX System file descriptor */ }; #endif /* _STDIO_REVERSE */ #endif /* !defined(__SunOS_5_4) ... !defined(__SunOS_5_6) */ extern "C" __FILE __iob[_NFILE]; namespace std { typedef __FILE FILE; // C++ Standard functions and types #if defined(_LP64) || defined(_I32LPx) typedef unsigned long size_t; /* size of something in bytes */ #else typedef unsigned int size_t; /* (historical version) */ #endif #if defined(_LP64) || _FILE_OFFSET_BITS == 32 || defined(__SunOS_5_5_1) typedef long fpos_t; #else typedef __longlong_t fpos_t; #endif #ifndef _STDIO_ALLOCATE extern "C" unsigned char _sibuf[], _sobuf[]; #endif #ifndef _LP64 extern "C" unsigned char *_bufendtab[]; extern "C" FILE *_lastbuf; #endif #ifndef _LP64 extern "C" int __filbuf(FILE *); extern "C" int __flsbuf(int, FILE *); #endif /* _LP64 */ extern "C" { int remove(const char *); int rename(const char *, const char *); FILE *tmpfile(void); char *tmpnam(char *); int fclose(FILE *); int fflush(FILE *); FILE *fopen(const char *, const char *); FILE *freopen(const char *, const char *, FILE *); void setbuf(FILE *, char *); int setvbuf(FILE *, char *, int, size_t); int fprintf(FILE *, const char *, ...); int fscanf(FILE *, const char *, ...); int printf(const char *, ...); int scanf(const char *, ...); int sprintf(char *, const char *, ...); int sscanf(const char *, const char *, ...); int vfprintf(FILE *, const char *, __va_list); int vprintf(const char *, __va_list); int vsprintf(char *, const char *, __va_list); int fgetc(FILE *); char *fgets(char *, int, FILE *); int fputc(int, FILE *); int fputs(const char *, FILE *); int getc(FILE *); int getchar(void); char *gets(char *); int putc(int, FILE *); int putchar(int); int puts(const char *); int ungetc(int, FILE *); size_t fread(void *, size_t, size_t, FILE *); size_t fwrite(const void *, size_t, size_t, FILE *); int fgetpos(FILE *, fpos_t *); int fseek(FILE *, long, int); int fsetpos(FILE *, const fpos_t *); long ftell(FILE *); void rewind(FILE *); void clearerr(FILE *); int feof(FILE *); int ferror(FILE *); void perror(const char *); } /* extern C */ } /* namespace std */ #endif /* __STD_stdio */