source: trunk/include/incl_vac/STDIO.H@ 10366

Last change on this file since 10366 was 9707, checked in by sandervl, 23 years ago

Added changed VAC headers to rename memory and file functions; add include\incl_vac to include path (/I)

File size: 13.0 KB
Line 
1#if (defined(__IBMC__) || defined(__IBMCPP__))
2#pragma info( none )
3#ifndef __CHKHDR__
4 #pragma info( none )
5#endif
6#pragma info( restore )
7#endif
8
9#ifndef __stdio_h
10 #define __stdio_h
11
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15
16 #ifndef _LNK_CONV
17 #ifdef _M_I386
18 #define _LNK_CONV _Optlink
19 #else
20 #define _LNK_CONV
21 #endif
22 #endif
23
24 #ifndef _IMPORT
25 #ifdef __IMPORTLIB__
26 #define _IMPORT _Import
27 #else
28 #define _IMPORT
29 #endif
30 #endif
31
32 /********************************************************************/
33 /* <stdio.h> header file */
34 /* */
35 /* IBM VisualAge C++ for OS/2, Version 3.00 */
36 /* (C) Copyright IBM Corp. 1991, 1995. */
37 /* - Licensed Material - Program-Property of IBM */
38 /* - All rights reserved */
39 /* */
40 /********************************************************************/
41
42 #ifndef __size_t
43 #define __size_t
44 typedef unsigned int size_t;
45 #endif
46
47 enum _OPERATIONS { _IOINIT, _IOREAD, _IOWRITE, _IOREPOSITION,
48 _IOFLUSH, _IOUNDEFOP };
49
50 #define _MAX_UNGET 2
51
52 #if (defined(__IBMC__) || defined(__IBMCPP__))
53 #pragma pack( 1 )
54 typedef struct __file /* visible portion of the FILE struct */
55 {
56 unsigned char *_bufPtr;
57 unsigned long int _count;
58 unsigned long int _userFlags;
59 unsigned long int _bufLen;
60 unsigned long int _ungetCount;
61 int _tempStore;
62 unsigned char _ungetBuf[_MAX_UNGET];
63 enum _OPERATIONS _lastOp;
64 char _filler;
65 } FILE;
66 #pragma pack( )
67 #else
68 typedef struct __file /* visible portion of the FILE struct */
69 {
70 unsigned char *_bufPtr;
71 unsigned long int _count;
72 unsigned long int _userFlags;
73 unsigned long int _bufLen;
74 unsigned long int _ungetCount;
75 int _tempStore;
76 enum _OPERATIONS _lastOp;
77 unsigned char _ungetBuf[_MAX_UNGET];
78 char _filler;
79 } FILE;
80 #endif
81
82 typedef struct __fpos_t /* Definition of file positioning structure */
83 {
84 long int __fpos_elem[2];
85 } fpos_t;
86
87 #ifndef NULL
88 #if (defined(__EXTENDED__) || defined( __cplusplus ))
89 #define NULL 0
90 #else
91 #define NULL ((void *)0)
92 #endif
93 #endif
94
95 #define _IOFBF 1 /* Buffer modes */
96 #define _IOLBF 2
97 #define _IONBF 3
98 #define BUFSIZ 4096 /* Default buffer size */
99 #define EOF (-1)
100 #define L_tmpnam 260 /* Maximum length of temporary names */
101 #define FOPEN_MAX 20 /* Minimum number of open files guaranteed */
102 #define FILENAME_MAX 260 /* Maximum file name length */
103 #define SEEK_SET 0 /* fseek constants */
104 #define SEEK_CUR 1
105 #define SEEK_END 2
106 #define TMP_MAX 100000 /* Maximum guaranteed unique file names */
107
108 #define _IOEOF 0x0001 /* EOF flag mask */
109 #define _IOERR 0x0002 /* ERR flag mask */
110
111#ifdef _M_I386
112 typedef char *__va_list;
113#endif
114
115#ifdef __THW_PPC__
116 #include <stdarg.h>
117#endif
118
119 /* Standard stream pointers. */
120
121 extern FILE * const _IMPORT stdin;
122 extern FILE * const _IMPORT stdout;
123 extern FILE * const _IMPORT stderr;
124
125 #define stdin stdin
126 #define stdout stdout
127 #define stderr stderr
128
129 /* Function declarations. */
130
131 #ifndef CRTWRAP
132 #define CRTWRAP(a) odin_##a
133 #endif
134#ifndef ORIGINAL_VAC_FUNCTIONS
135//// #define fprintf CRTWRAP(fprintf)
136 #define fscanf CRTWRAP(fscanf)
137 #define printf CRTWRAP(printf)
138 #define scanf CRTWRAP(scanf)
139//// #define sprintf CRTWRAP(sprintf)
140//// #define sscanf CRTWRAP(sscanf)
141 #define clearerr CRTWRAP(clearerr)
142 #define fclose CRTWRAP(fclose)
143 #define feof CRTWRAP(feof)
144 #define ferror CRTWRAP(ferror)
145 #define fflush CRTWRAP(fflush)
146 #define fgetc CRTWRAP(fgetc)
147 #define fgetpos CRTWRAP(fgetpos)
148 #define fgets CRTWRAP(fgets)
149 #define fopen CRTWRAP(fopen)
150 #define fputc CRTWRAP(fputc)
151 #define fputs CRTWRAP(fputs)
152 #define fread CRTWRAP(fread)
153 #define freopen CRTWRAP(freopen)
154 #define fseek CRTWRAP(fseek)
155 #define fsetpos CRTWRAP(fsetpos)
156 #define ftell CRTWRAP(ftell)
157 #define fwrite CRTWRAP(fwrite)
158 #define getc CRTWRAP(getc)
159 #define getchar CRTWRAP(getchar)
160 #define gets CRTWRAP(gets)
161 #define perror CRTWRAP(perror)
162 #define putc CRTWRAP(putc)
163 #define putchar CRTWRAP(putchar)
164 #define puts CRTWRAP(puts)
165 #define remove CRTWRAP(remove)
166 #define rename CRTWRAP(rename)
167 #define rewind CRTWRAP(rewind)
168 #define setbuf CRTWRAP(setbuf)
169 #define setvbuf CRTWRAP(setvbuf)
170 #define tmpfile CRTWRAP(tmpfile)
171 #define tmpnam CRTWRAP(tmpnam)
172 #define ungetc CRTWRAP(ungetc)
173 #define vfprintf CRTWRAP(vfprintf)
174 #define vprintf CRTWRAP(vprintf)
175//// #define vsprintf CRTWRAP(vsprintf)
176#endif
177
178 int _IMPORT _LNK_CONV fprintf( FILE *, const char *, ... );
179 int _IMPORT _LNK_CONV fscanf( FILE *, const char *, ... );
180 int _IMPORT _LNK_CONV printf( const char *, ... );
181 int _IMPORT _LNK_CONV scanf( const char *, ... );
182 int _IMPORT _LNK_CONV sprintf( char *, const char *, ... );
183 int _IMPORT _LNK_CONV sscanf( const char *, const char *, ... );
184 void _IMPORT _LNK_CONV clearerr( FILE * );
185 int _IMPORT _LNK_CONV fclose( FILE * );
186 int _IMPORT _LNK_CONV feof( FILE * );
187 int _IMPORT _LNK_CONV ferror( FILE * );
188 int _IMPORT _LNK_CONV fflush( FILE * );
189 int _IMPORT _LNK_CONV fgetc( FILE * );
190 int _IMPORT _LNK_CONV fgetpos( FILE *, fpos_t * );
191 char * _IMPORT _LNK_CONV fgets( char *, int, FILE * );
192 FILE * _IMPORT _LNK_CONV fopen( const char *, const char * );
193 int _IMPORT _LNK_CONV fputc( int, FILE * );
194 int _IMPORT _LNK_CONV fputs( const char *, FILE * );
195 size_t _IMPORT _LNK_CONV fread( void *, size_t, size_t, FILE * );
196 FILE * _IMPORT _LNK_CONV freopen( const char *, const char *, FILE * );
197 int _IMPORT _LNK_CONV fseek( FILE *, long int, int );
198 int _IMPORT _LNK_CONV fsetpos( FILE *, const fpos_t * );
199 long int _IMPORT _LNK_CONV ftell( FILE * );
200 size_t _IMPORT _LNK_CONV fwrite( const void *, size_t, size_t, FILE * );
201 int _LNK_CONV getc( FILE * );
202 int _LNK_CONV getchar( void );
203 char * _IMPORT _LNK_CONV gets( char * );
204 void _IMPORT _LNK_CONV perror( const char * );
205 int _LNK_CONV putc( int, FILE * );
206 int _LNK_CONV putchar( int );
207 int _IMPORT _LNK_CONV puts( const char * );
208 int _IMPORT _LNK_CONV remove( const char * );
209 int _IMPORT _LNK_CONV rename( const char *, const char * );
210 void _IMPORT _LNK_CONV rewind( FILE * );
211 void _IMPORT _LNK_CONV setbuf( FILE *, char * );
212 int _IMPORT _LNK_CONV setvbuf( FILE *, char *, int, size_t );
213 FILE * _IMPORT _LNK_CONV tmpfile( void );
214 char * _IMPORT _LNK_CONV tmpnam( char * );
215 int _IMPORT _LNK_CONV ungetc( int, FILE * );
216 int _IMPORT _LNK_CONV vfprintf( FILE *, const char *, __va_list );
217 int _IMPORT _LNK_CONV vprintf( const char *, __va_list );
218 int _IMPORT _LNK_CONV vsprintf( char *, const char *, __va_list );
219
220 #define __getc(p) ( \
221 ( ((p)->_ungetCount==0) && ((p)->_count!=0))? \
222 (--(p)->_count, (int)(*(p)->_bufPtr++)) :\
223 fgetc((p)) )
224
225 #define __putc(c, p) ( \
226 ((((p)->_tempStore = (c)) != '\n') && \
227 ((p)->_lastOp == _IOWRITE) && ((p)->_count < (p)->_bufLen)) ? \
228 (++(p)->_count, *(p)->_bufPtr++ = (p)->_tempStore): \
229 fputc((p)->_tempStore,(p)) )
230
231 #ifndef __MULTI__
232 #ifdef __cplusplus
233 inline int getc( FILE * p ) { return __getc( p ); }
234 inline int putc( int c, FILE * p ) { return __putc( c, p ); }
235 #else
236 #define getc( p ) __getc( (p) )
237 #define putc( c, p ) __putc( (c), (p) )
238 #endif
239 #else
240 #ifdef __cplusplus
241 inline int getc( FILE * p ) { return fgetc( p ); }
242 inline int putc( int c, FILE * p ) { return fputc( c, p ); }
243 #else
244#ifndef ORIGINAL_VAC_FUNCTIONS
245 #undef getc
246 #undef putc
247#endif
248 #define getc( p ) fgetc( (p) )
249 #define putc( c, p ) fputc( (c), (p) )
250 #endif
251 #endif
252
253 #ifdef __cplusplus
254 inline int getchar( void ) { return getc( stdin ); }
255 inline int putchar( int c ) { return putc( c, stdout ); }
256 #else
257#ifndef ORIGINAL_VAC_FUNCTIONS
258 #undef getchar
259 #undef putchar
260#endif
261 #define getchar( ) getc( stdin )
262 #define putchar( c ) putc( (c), stdout )
263 #endif
264
265 /* clearerr, feof, and ferror macros - single threaded only */
266
267 #ifndef __MULTI__
268 #define clearerr( stream ) ( ( void )( (stream)->_userFlags = 0L ) )
269 #define feof( stream ) ( ( int )( (stream)->_userFlags & _IOEOF ) )
270 #define ferror( stream ) ( ( int )( (stream)->_userFlags & _IOERR ) )
271 #endif
272
273 #if (defined(__EXTENDED__) || defined( __cplusplus ))
274
275 #define _IO_WRITETHRU 0x0004 /* WRITETHRU mask */
276
277 #if (defined(__IBMC__) || defined(__IBMCPP__))
278 #if defined(_M_I386) || !defined(NO_PROTOTYPE)
279 #pragma map( fprintf, "_fprintfieee" )
280 #pragma map( printf , "_printfieee" )
281 #pragma map( sprintf, "_sprintfieee" )
282 #pragma map( fscanf , "_fscanfieee" )
283 #pragma map( scanf , "_scanfieee" )
284 #pragma map( sscanf , "_sscanfieee" )
285 #endif
286
287 #pragma map( vfprintf, "_vfprintfieee" )
288 #pragma map( vprintf , "_vprintfieee" )
289 #pragma map( vsprintf, "_vsprintfieee" )
290 #else
291 #ifndef NO_PROTOTYPE
292 #pragma Alias( fprintf, "_fprintfieee" )
293 #pragma Alias( printf , "_printfieee" )
294 #pragma Alias( sprintf, "_sprintfieee" )
295 #pragma Alias( fscanf , "_fscanfieee" )
296 #pragma Alias( scanf , "_scanfieee" )
297 #pragma Alias( sscanf , "_sscanfieee" )
298 #endif
299
300 #pragma Alias( vfprintf, "_vfprintfieee" )
301 #pragma Alias( vprintf , "_vprintfieee" )
302 #pragma Alias( vsprintf, "_vsprintfieee" )
303 #endif
304
305 int _LNK_CONV _fcloseall( void );
306 int _LNK_CONV _rmtmp( void );
307
308 #define P_tmpdir "\\"
309 FILE * _LNK_CONV fdopen( int, const char *);
310 int _LNK_CONV fgetchar( void );
311 int _LNK_CONV fileno( FILE * );
312 int _LNK_CONV flushall( void );
313 int _LNK_CONV fputchar( int );
314 char * _LNK_CONV tempnam( char *, char * );
315 int _LNK_CONV unlink( const char * );
316
317 FILE * _LNK_CONV _fdopen( int, const char *);
318 int _LNK_CONV _fgetchar( void );
319 int _LNK_CONV _fileno( FILE * );
320 int _LNK_CONV _flushall( void );
321 int _LNK_CONV _fputchar( int );
322 char * _LNK_CONV _tempnam( char *, char * );
323 int _LNK_CONV _unlink( const char * );
324
325 int _LNK_CONV _set_crt_msg_handle( int );
326
327 #if (defined(__IBMC__) || defined(__IBMCPP__))
328 #pragma map( fdopen , "_fdopen" )
329 #pragma map( fgetchar, "_fgetchar" )
330 #pragma map( fileno , "_fileno" )
331 #pragma map( flushall, "_flushall" )
332 #pragma map( fputchar, "_fputchar" )
333 #pragma map( tempnam , "_tempnam" )
334 #ifndef __unlink
335 #define __unlink
336 #pragma map( unlink , "_unlink" )
337 #endif
338 #else
339 #pragma Alias( fdopen , "_fdopen" )
340 #pragma Alias( fgetchar, "_fgetchar" )
341 #pragma Alias( fileno , "_fileno" )
342 #pragma Alias( flushall, "_flushall" )
343 #pragma Alias( fputchar, "_fputchar" )
344 #pragma Alias( tempnam , "_tempnam" )
345 #ifndef __unlink
346 #define __unlink
347 #pragma Alias( unlink , "_unlink" )
348 #endif
349 #endif
350
351 #else
352
353 #if defined(__IBMC__) || defined(__IBMCPP__)
354 #if defined(_M_I386) || !defined(NO_PROTOTYPE)
355 #pragma map( fprintf, "_fprintf_ansi" )
356 #pragma map( printf , "_printf_ansi" )
357 #pragma map( sprintf, "_sprintf_ansi" )
358 #pragma map( fscanf , "_fscanf_ansi" )
359 #pragma map( scanf , "_scanf_ansi" )
360 #pragma map( sscanf , "_sscanf_ansi" )
361 #endif
362 #else
363 #ifndef NO_PROTOTYPE
364 #pragma Alias( fprintf, "_fprintf_ansi" )
365 #pragma Alias( printf , "_printf_ansi" )
366 #pragma Alias( sprintf, "_sprintf_ansi" )
367 #pragma Alias( fscanf , "_fscanf_ansi" )
368 #pragma Alias( scanf , "_scanf_ansi" )
369 #pragma Alias( sscanf , "_sscanf_ansi" )
370 #endif
371 #endif
372
373 #endif
374
375 #ifdef __cplusplus
376 }
377 #endif
378
379#endif
380
381#if (defined(__IBMC__) || defined(__IBMCPP__))
382#pragma info( none )
383#ifndef __CHKHDR__
384 #pragma info( restore )
385#endif
386#pragma info( restore )
387#endif
Note: See TracBrowser for help on using the repository browser.