sl@0
|
1 |
/* STDIO.H
|
sl@0
|
2 |
*
|
sl@0
|
3 |
* Portions Copyright (c) 1990-1999 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
4 |
* All rights reserved.
|
sl@0
|
5 |
*/
|
sl@0
|
6 |
|
sl@0
|
7 |
/** @file
|
sl@0
|
8 |
@publishedAll
|
sl@0
|
9 |
@released
|
sl@0
|
10 |
*/
|
sl@0
|
11 |
|
sl@0
|
12 |
/*
|
sl@0
|
13 |
* Copyright (c) 1990 The Regents of the University of California.
|
sl@0
|
14 |
* All rights reserved.
|
sl@0
|
15 |
*
|
sl@0
|
16 |
* Redistribution and use in source and binary forms are permitted
|
sl@0
|
17 |
* provided that the above copyright notice and this paragraph are
|
sl@0
|
18 |
* duplicated in all such forms and that any documentation,
|
sl@0
|
19 |
* advertising materials, and other materials related to such
|
sl@0
|
20 |
* distribution and use acknowledge that the software was developed
|
sl@0
|
21 |
* by the University of California, Berkeley. The name of the
|
sl@0
|
22 |
* University may not be used to endorse or promote products derived
|
sl@0
|
23 |
* from this software without specific prior written permission.
|
sl@0
|
24 |
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
sl@0
|
25 |
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
sl@0
|
26 |
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
sl@0
|
27 |
*
|
sl@0
|
28 |
* @(#)stdio.h 5.3 (Berkeley) 3/15/86
|
sl@0
|
29 |
*/
|
sl@0
|
30 |
|
sl@0
|
31 |
/*
|
sl@0
|
32 |
* NB: to fit things in six character monocase externals, the
|
sl@0
|
33 |
* stdio code uses the prefix `__s' for stdio objects, typically
|
sl@0
|
34 |
* followed by a three-character attempt at a mnemonic.
|
sl@0
|
35 |
*/
|
sl@0
|
36 |
|
sl@0
|
37 |
#ifndef _STDIO_H_
|
sl@0
|
38 |
#define _STDIO_H_
|
sl@0
|
39 |
|
sl@0
|
40 |
#ifdef __cplusplus
|
sl@0
|
41 |
extern "C" {
|
sl@0
|
42 |
#endif
|
sl@0
|
43 |
|
sl@0
|
44 |
#include "_ansi.h"
|
sl@0
|
45 |
|
sl@0
|
46 |
#define _FSTDIO /* ``function stdio'' */
|
sl@0
|
47 |
|
sl@0
|
48 |
#define __need_size_t
|
sl@0
|
49 |
#include <stddef.h>
|
sl@0
|
50 |
|
sl@0
|
51 |
#include <stdarg_e.h> /* defines __e32_va_list */
|
sl@0
|
52 |
|
sl@0
|
53 |
#include <sys/stdio_t.h> /* Definition of _fpos_t and struct __sFILE */
|
sl@0
|
54 |
|
sl@0
|
55 |
typedef _fpos_t fpos_t;
|
sl@0
|
56 |
typedef struct __sFILE FILE;
|
sl@0
|
57 |
|
sl@0
|
58 |
#define __SLBF 0x0001 /* line buffered */
|
sl@0
|
59 |
#define __SNBF 0x0002 /* unbuffered */
|
sl@0
|
60 |
#define __SRD 0x0004 /* OK to read */
|
sl@0
|
61 |
#define __SWR 0x0008 /* OK to write */
|
sl@0
|
62 |
/* RD and WR are never simultaneously asserted */
|
sl@0
|
63 |
#define __SRW 0x0010 /* open for reading & writing */
|
sl@0
|
64 |
#define __SEOF 0x0020 /* found EOF */
|
sl@0
|
65 |
#define __SERR 0x0040 /* found error */
|
sl@0
|
66 |
#define __SMBF 0x0080 /* _buf is from malloc */
|
sl@0
|
67 |
#define __SAPP 0x0100 /* fdopen()ed in append mode - so must write to end */
|
sl@0
|
68 |
#define __SSTR 0x0200 /* this is an sprintf/snprintf string */
|
sl@0
|
69 |
#define __SOPT 0x0400 /* do fseek() optimisation */
|
sl@0
|
70 |
#define __SNPT 0x0800 /* do not do fseek() optimisation */
|
sl@0
|
71 |
#define __SOFF 0x1000 /* set iff _offset is in fact correct */
|
sl@0
|
72 |
#define __SMOD 0x2000 /* true => fgetline modified _p text */
|
sl@0
|
73 |
|
sl@0
|
74 |
/**
|
sl@0
|
75 |
The following three definitions are for ANSI C, which took them
|
sl@0
|
76 |
from System V, which stupidly took internal interface macros and
|
sl@0
|
77 |
made them official arguments to setvbuf(), without renaming them.
|
sl@0
|
78 |
Hence, these ugly _IOxxx names are *supposed* to appear in user code.
|
sl@0
|
79 |
|
sl@0
|
80 |
Although these happen to match their counterparts above, the
|
sl@0
|
81 |
implementation does not rely on that (so these could be renumbered).
|
sl@0
|
82 |
*/
|
sl@0
|
83 |
#define _IOFBF 0 /* setvbuf should set fully buffered */
|
sl@0
|
84 |
#define _IOLBF 1 /* setvbuf should set line buffered */
|
sl@0
|
85 |
#define _IONBF 2 /* setvbuf should set unbuffered */
|
sl@0
|
86 |
|
sl@0
|
87 |
#ifndef NULL
|
sl@0
|
88 |
#define NULL 0L
|
sl@0
|
89 |
#endif
|
sl@0
|
90 |
|
sl@0
|
91 |
#define BUFSIZ 1024
|
sl@0
|
92 |
#define EOF (-1)
|
sl@0
|
93 |
|
sl@0
|
94 |
#define FOPEN_MAX 20 /* must be <= OPEN_MAX <sys/syslimits.h> */
|
sl@0
|
95 |
#define FILENAME_MAX 256 /* must be <= PATH_MAX <sys/syslimits.h> */
|
sl@0
|
96 |
#define P_tmpdir "/System/temp/"
|
sl@0
|
97 |
#define WIDEP_tmpdir L"/System/temp/"
|
sl@0
|
98 |
#define L_tmpnam 34 /* ?:/System/temp/t%x.%x */
|
sl@0
|
99 |
|
sl@0
|
100 |
#ifndef SEEK_SET
|
sl@0
|
101 |
#define SEEK_SET 0 /* set file offset to offset */
|
sl@0
|
102 |
#endif
|
sl@0
|
103 |
#ifndef SEEK_CUR
|
sl@0
|
104 |
#define SEEK_CUR 1 /* set file offset to current plus offset */
|
sl@0
|
105 |
#endif
|
sl@0
|
106 |
#ifndef SEEK_END
|
sl@0
|
107 |
#define SEEK_END 2 /* set file offset to EOF plus offset */
|
sl@0
|
108 |
#endif
|
sl@0
|
109 |
|
sl@0
|
110 |
#define TMP_MAX 26
|
sl@0
|
111 |
|
sl@0
|
112 |
/**
|
sl@0
|
113 |
Function interface to the "constants" stdin, stdout and stderr.
|
sl@0
|
114 |
These functions guarantee to return a fixed value, so that it
|
sl@0
|
115 |
will be possible to use expressions such as
|
sl@0
|
116 |
if (fp != stdout)
|
sl@0
|
117 |
fclose(fp);
|
sl@0
|
118 |
|
sl@0
|
119 |
with complete confidence. Unfortunately it will rule out initialising
|
sl@0
|
120 |
global variables with stdin/stdout/stderr, as in the common idiom:
|
sl@0
|
121 |
|
sl@0
|
122 |
static FILE *log = stderr;
|
sl@0
|
123 |
|
sl@0
|
124 |
This isn't currently possible with EPOC32.
|
sl@0
|
125 |
*/
|
sl@0
|
126 |
IMPORT_C FILE *__stdin (void);
|
sl@0
|
127 |
IMPORT_C FILE *__stdout (void);
|
sl@0
|
128 |
IMPORT_C FILE *__stderr (void);
|
sl@0
|
129 |
|
sl@0
|
130 |
#define stdin (__stdin())
|
sl@0
|
131 |
#define stdout (__stdout())
|
sl@0
|
132 |
#define stderr (__stderr())
|
sl@0
|
133 |
|
sl@0
|
134 |
/**
|
sl@0
|
135 |
Functions defined in ANSI C standard.
|
sl@0
|
136 |
*/
|
sl@0
|
137 |
IMPORT_C FILE * tmpfile (void);
|
sl@0
|
138 |
IMPORT_C char * tmpnam (char *);
|
sl@0
|
139 |
IMPORT_C wchar_t * wtmpnam (wchar_t *);
|
sl@0
|
140 |
IMPORT_C int fclose (FILE *);
|
sl@0
|
141 |
IMPORT_C int fflush (FILE *);
|
sl@0
|
142 |
IMPORT_C FILE * freopen (const char *, const char *, FILE *);
|
sl@0
|
143 |
IMPORT_C FILE * wfreopen (const wchar_t *, const wchar_t *, FILE *);
|
sl@0
|
144 |
IMPORT_C void setbuf (FILE *, char *);
|
sl@0
|
145 |
IMPORT_C int setvbuf (FILE *, char *, int, size_t);
|
sl@0
|
146 |
IMPORT_C int fprintf (FILE *, const char *, ...);
|
sl@0
|
147 |
IMPORT_C int fscanf (FILE *, const char *, ...);
|
sl@0
|
148 |
IMPORT_C int printf (const char *, ...);
|
sl@0
|
149 |
IMPORT_C int scanf (const char *, ...);
|
sl@0
|
150 |
IMPORT_C int sscanf (const char *, const char *, ...);
|
sl@0
|
151 |
IMPORT_C int vfprintf (FILE *, const char *, __e32_va_list);
|
sl@0
|
152 |
IMPORT_C int vprintf (const char *, __e32_va_list);
|
sl@0
|
153 |
IMPORT_C int vsprintf (char *, const char *, __e32_va_list);
|
sl@0
|
154 |
IMPORT_C int fgetc (FILE *);
|
sl@0
|
155 |
IMPORT_C char * fgets (char *, int, FILE *);
|
sl@0
|
156 |
IMPORT_C int fputc (int, FILE *);
|
sl@0
|
157 |
IMPORT_C int fputs (const char *, FILE *);
|
sl@0
|
158 |
IMPORT_C int getc (FILE *);
|
sl@0
|
159 |
IMPORT_C int getchar (void);
|
sl@0
|
160 |
IMPORT_C char * gets (char *);
|
sl@0
|
161 |
IMPORT_C int putc (int, FILE *);
|
sl@0
|
162 |
IMPORT_C int putchar (int);
|
sl@0
|
163 |
IMPORT_C int puts (const char *);
|
sl@0
|
164 |
IMPORT_C int ungetc (int, FILE *);
|
sl@0
|
165 |
IMPORT_C size_t fread (void*, size_t _size, size_t _n, FILE *);
|
sl@0
|
166 |
IMPORT_C size_t fwrite (const void* , size_t _size, size_t _n, FILE *);
|
sl@0
|
167 |
IMPORT_C int fgetpos (FILE *, fpos_t *);
|
sl@0
|
168 |
IMPORT_C int fseek (FILE *, long, int);
|
sl@0
|
169 |
IMPORT_C int fsetpos (FILE *, const fpos_t *);
|
sl@0
|
170 |
IMPORT_C long ftell (FILE *);
|
sl@0
|
171 |
IMPORT_C void rewind (FILE *);
|
sl@0
|
172 |
IMPORT_C void clearerr (FILE *);
|
sl@0
|
173 |
IMPORT_C int feof (FILE *);
|
sl@0
|
174 |
IMPORT_C int ferror (FILE *);
|
sl@0
|
175 |
IMPORT_C void perror (const char *);
|
sl@0
|
176 |
#ifndef _REENT_ONLY
|
sl@0
|
177 |
IMPORT_C FILE * fopen (const char *_name, const char *_type);
|
sl@0
|
178 |
IMPORT_C FILE * wfopen (const wchar_t *_name, const wchar_t *_type);
|
sl@0
|
179 |
IMPORT_C int sprintf (char *, const char *, ...);
|
sl@0
|
180 |
#endif
|
sl@0
|
181 |
|
sl@0
|
182 |
/**
|
sl@0
|
183 |
Routines in POSIX 1003.1.
|
sl@0
|
184 |
*/
|
sl@0
|
185 |
IMPORT_C int fileno (FILE *);
|
sl@0
|
186 |
|
sl@0
|
187 |
#ifndef _REENT_ONLY
|
sl@0
|
188 |
IMPORT_C FILE * fdopen (int, const char *);
|
sl@0
|
189 |
IMPORT_C FILE * wfdopen (int, const wchar_t *);
|
sl@0
|
190 |
#endif
|
sl@0
|
191 |
|
sl@0
|
192 |
/**
|
sl@0
|
193 |
The name _cleanup is rather well-known...
|
sl@0
|
194 |
*/
|
sl@0
|
195 |
IMPORT_C void _cleanup (void);
|
sl@0
|
196 |
|
sl@0
|
197 |
/**
|
sl@0
|
198 |
EPOC32 support for multiple processes
|
sl@0
|
199 |
*/
|
sl@0
|
200 |
IMPORT_C int popen3 (const char *cmd, const char *mode, char** envp, int fids[3]);
|
sl@0
|
201 |
IMPORT_C int wpopen3 (const wchar_t *cmd, const wchar_t *mode, wchar_t** envp, int fids[3]);
|
sl@0
|
202 |
|
sl@0
|
203 |
#ifndef _STRICT_ANSI
|
sl@0
|
204 |
int getw (FILE *);
|
sl@0
|
205 |
int putw (int, FILE *);
|
sl@0
|
206 |
void setbuffer (FILE *, char *, int);
|
sl@0
|
207 |
int setlinebuf (FILE *);
|
sl@0
|
208 |
|
sl@0
|
209 |
/**
|
sl@0
|
210 |
Stdio function-access interface.
|
sl@0
|
211 |
*/
|
sl@0
|
212 |
FILE *funopen (const void* _cookie,
|
sl@0
|
213 |
int (*readfn) (void* _cookie, char *_buf, int _n),
|
sl@0
|
214 |
int (*writefn)(void* _cookie, const char *_buf, int _n),
|
sl@0
|
215 |
fpos_t (*seekfn) (void* _cookie, fpos_t _off, int _whence),
|
sl@0
|
216 |
int (*closefn)(void* _cookie));
|
sl@0
|
217 |
|
sl@0
|
218 |
#define fropen(cookie, fn) funopen(cookie, fn, (int (*)())0, (fpos_t (*)())0, (int (*)())0)
|
sl@0
|
219 |
#define fwopen(cookie, fn) funopen(cookie, (int (*)())0, fn, (fpos_t (*)())0, (int (*)())0)
|
sl@0
|
220 |
#define getchar() getc(stdin)
|
sl@0
|
221 |
#define putchar(x) putc(x, stdout)
|
sl@0
|
222 |
#define L_cuserid 9 /* posix says it goes in stdio.h :( */
|
sl@0
|
223 |
|
sl@0
|
224 |
#endif /* _STRICT_ANSI */
|
sl@0
|
225 |
|
sl@0
|
226 |
#ifdef __cplusplus
|
sl@0
|
227 |
}
|
sl@0
|
228 |
#endif
|
sl@0
|
229 |
#endif /* _STDIO_H_ */
|