1 /*
2 * Copyright (c) 1999
3 * Boris Fomitchev
4 *
5 * This material is provided "as is", with absolutely no warranty expressed
6 * or implied. Any use is at your own risk.
7 *
8 * Permission to use or copy this software for any purpose is hereby granted
9 * without fee, provided the above notices are retained on all copies.
10 * Permission to modify the code and to distribute modified code is granted,
11 * provided the above notices are retained, and a notice that the code was
12 * modified is included with the above copyright notice.
13 *
14 */
15
16 #ifndef _STLP_INTERNAL_CSTDIO
17 #define _STLP_INTERNAL_CSTDIO
18
19 #if defined (__Lynx__)
20 # if defined (_STLP_HAS_INCLUDE_NEXT)
21 # include_next <stdarg.h>
22 # else
23 # include _STLP_NATIVE_C_HEADER(stdarg.h)
24 # endif
25 #endif
26
27 #if defined (_STLP_USE_NEW_C_HEADERS)
28 # if defined (_STLP_HAS_INCLUDE_NEXT)
29 # include_next <cstdio>
30 # else
31 # include _STLP_NATIVE_CPP_C_HEADER(cstdio)
32 # endif
33 #else
34 # include <stdio.h>
35 #endif
36
37 #if defined (__MWERKS__)
38 # undef stdin
39 # undef stdout
40 # undef stderr
41 # define stdin (&_STLP_VENDOR_CSTD::__files[0])
42 # define stdout (&_STLP_VENDOR_CSTD::__files[1])
43 # define stderr (&_STLP_VENDOR_CSTD::__files[2])
44 #endif
45
46 #if defined (_STLP_MSVC_LIB) && (_STLP_MSVC_LIB < 1400) || defined (_STLP_USING_PLATFORM_SDK_COMPILER)
vsnprintf(char * s1,size_t n,const char * s2,va_list v)47 inline int vsnprintf(char *s1, size_t n, const char *s2, va_list v)
48 { return _STLP_VENDOR_CSTD::_vsnprintf(s1, n, s2, v); }
49 #endif
50
51 #if defined (_STLP_IMPORT_VENDOR_CSTD )
52 _STLP_BEGIN_NAMESPACE
53 using _STLP_VENDOR_CSTD::FILE;
54 using _STLP_VENDOR_CSTD::fpos_t;
55 using _STLP_VENDOR_CSTD::size_t;
56
57 // undef obsolete macros
58 # undef putc
59 # undef getc
60 # undef getchar
61 # undef putchar
62 # undef feof
63 # undef ferror
64
65 # if !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS)
66 using _STLP_VENDOR_CSTD::clearerr;
67 using _STLP_VENDOR_CSTD::fclose;
68 using _STLP_VENDOR_CSTD::feof;
69 using _STLP_VENDOR_CSTD::ferror;
70 using _STLP_VENDOR_CSTD::fflush;
71 using _STLP_VENDOR_CSTD::fgetc;
72 using _STLP_VENDOR_CSTD::fgetpos;
73 using _STLP_VENDOR_CSTD::fgets;
74 using _STLP_VENDOR_CSTD::fopen;
75 using _STLP_VENDOR_CSTD::fprintf;
76 using _STLP_VENDOR_CSTD::fputc;
77 using _STLP_VENDOR_CSTD::fputs;
78 using _STLP_VENDOR_CSTD::fread;
79 # if !defined (_WIN32_WCE) || (_WIN32_WCE < 400)
80 using _STLP_VENDOR_CSTD::freopen;
81 # endif
82 using _STLP_VENDOR_CSTD::fscanf;
83 using _STLP_VENDOR_CSTD::fseek;
84 using _STLP_VENDOR_CSTD::fsetpos;
85 using _STLP_VENDOR_CSTD::ftell;
86 using _STLP_VENDOR_CSTD::fwrite;
87
88 # if !(defined (__IBMCPP__) && (__IBMCPP__ >= 500))
89 # if !defined (_WIN32_WCE) || (_WIN32_WCE < 400) // Supplied as macros, TODO: use inline function to redirect to the macros?
90 using _STLP_VENDOR_CSTD::getc;
91 using _STLP_VENDOR_CSTD::putc;
92 # endif
93 using _STLP_VENDOR_CSTD::getchar;
94 using _STLP_VENDOR_CSTD::putchar;
95 # endif
96
97 using _STLP_VENDOR_CSTD::gets;
98 # if !defined (_WIN32_WCE) || (_WIN32_WCE < 400)
99 using _STLP_VENDOR_CSTD::perror;
100 # endif
101 using _STLP_VENDOR_CSTD::printf;
102 using _STLP_VENDOR_CSTD::puts;
103 # if !defined (_WIN32_WCE) || (_WIN32_WCE < 400)
104 using _STLP_VENDOR_CSTD::remove;
105 using _STLP_VENDOR_CSTD::rename;
106 using _STLP_VENDOR_CSTD::rewind;
107 using _STLP_VENDOR_CSTD::setbuf;
108 using _STLP_VENDOR_CSTD::tmpfile;
109 using _STLP_VENDOR_CSTD::tmpnam;
110 # endif
111 using _STLP_VENDOR_CSTD::scanf;
112 using _STLP_VENDOR_CSTD::setvbuf;
113 using _STLP_VENDOR_CSTD::sprintf;
114 using _STLP_VENDOR_CSTD::sscanf;
115 using _STLP_VENDOR_CSTD::ungetc;
116 using _STLP_VENDOR_CSTD::vfprintf;
117 using _STLP_VENDOR_CSTD::vprintf;
118 using _STLP_VENDOR_CSTD::vsprintf;
119 # if (defined (__MWERKS__) || (defined (_STLP_MSVC_LIB) && (_STLP_MSVC_LIB < 1400)) || \
120 (defined (__BORLANDC__)))
121 using _STLP_VENDOR_CSTD::vsnprintf;
122 # endif
123 # endif /* _STLP_NO_CSTD_FUNCTION_IMPORTS */
124 _STLP_END_NAMESPACE
125 #endif /* _STLP_IMPORT_VENDOR_CSTD */
126
127 #endif /* _STLP_INTERNAL_CSTDIO */
128