Mercurial > projects > ldc
comparison druntime/import/core/sys/posix/stdio.d @ 1458:e0b2d67cfe7c
Added druntime (this should be removed once it works).
author | Robert Clipsham <robert@octarineparrot.com> |
---|---|
date | Tue, 02 Jun 2009 17:43:06 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
1456:7b218ec1044f | 1458:e0b2d67cfe7c |
---|---|
1 /** | |
2 * D header file for POSIX. | |
3 * | |
4 * Copyright: Copyright Sean Kelly 2005 - 2009. | |
5 * License: <a href="http://www.boost.org/LICENSE_1_0.txt>Boost License 1.0</a>. | |
6 * Authors: Sean Kelly | |
7 * Standards: The Open Group Base Specifications Issue 6, IEEE Std 1003.1, 2004 Edition | |
8 * | |
9 * Copyright Sean Kelly 2005 - 2009. | |
10 * Distributed under the Boost Software License, Version 1.0. | |
11 * (See accompanying file LICENSE_1_0.txt or copy at | |
12 * http://www.boost.org/LICENSE_1_0.txt) | |
13 */ | |
14 module core.sys.posix.stdio; | |
15 | |
16 private import core.sys.posix.config; | |
17 public import core.stdc.stdio; | |
18 public import core.sys.posix.sys.types; // for off_t | |
19 | |
20 extern (C): | |
21 | |
22 // | |
23 // Required (defined in core.stdc.stdio) | |
24 // | |
25 /* | |
26 BUFSIZ | |
27 _IOFBF | |
28 _IOLBF | |
29 _IONBF | |
30 L_tmpnam | |
31 SEEK_CUR | |
32 SEEK_END | |
33 SEEK_SET | |
34 FILENAME_MAX | |
35 FOPEN_MAX | |
36 TMP_MAX | |
37 EOF | |
38 NULL | |
39 stderr | |
40 stdin | |
41 stdout | |
42 FILE | |
43 fpos_t | |
44 size_t | |
45 | |
46 void clearerr(FILE*); | |
47 int fclose(FILE*); | |
48 int feof(FILE*); | |
49 int ferror(FILE*); | |
50 int fflush(FILE*); | |
51 int fgetc(FILE*); | |
52 int fgetpos(FILE*, fpos_t *); | |
53 char* fgets(char*, int, FILE*); | |
54 FILE* fopen(in char*, in char*); | |
55 int fprintf(FILE*, in char*, ...); | |
56 int fputc(int, FILE*); | |
57 int fputs(in char*, FILE*); | |
58 size_t fread(void *, size_t, size_t, FILE*); | |
59 FILE* freopen(in char*, in char*, FILE*); | |
60 int fscanf(FILE*, in char*, ...); | |
61 int fseek(FILE*, c_long, int); | |
62 int fsetpos(FILE*, in fpos_t*); | |
63 c_long ftell(FILE*); | |
64 size_t fwrite(in void *, size_t, size_t, FILE*); | |
65 int getc(FILE*); | |
66 int getchar(); | |
67 char* gets(char*); | |
68 void perror(in char*); | |
69 int printf(in char*, ...); | |
70 int putc(int, FILE*); | |
71 int putchar(int); | |
72 int puts(in char*); | |
73 int remove(in char*); | |
74 int rename(in char*, in char*); | |
75 void rewind(FILE*); | |
76 int scanf(in char*, ...); | |
77 void setbuf(FILE*, char*); | |
78 int setvbuf(FILE*, char*, int, size_t); | |
79 int snprintf(char*, size_t, in char*, ...); | |
80 int sprintf(char*, in char*, ...); | |
81 int sscanf(in char*, in char*, int ...); | |
82 FILE* tmpfile(); | |
83 char* tmpnam(char*); | |
84 int ungetc(int, FILE*); | |
85 int vfprintf(FILE*, in char*, va_list); | |
86 int vfscanf(FILE*, in char*, va_list); | |
87 int vprintf(in char*, va_list); | |
88 int vscanf(in char*, va_list); | |
89 int vsnprintf(char*, size_t, in char*, va_list); | |
90 int vsprintf(char*, in char*, va_list); | |
91 int vsscanf(in char*, in char*, va_list arg); | |
92 */ | |
93 | |
94 version( linux ) | |
95 { | |
96 static if( __USE_LARGEFILE64 ) | |
97 { | |
98 int fgetpos64(FILE*, fpos_t *); | |
99 alias fgetpos64 fgetpos; | |
100 | |
101 FILE* fopen64(in char*, in char*); | |
102 alias fopen64 fopen; | |
103 | |
104 FILE* freopen64(in char*, in char*, FILE*); | |
105 alias freopen64 freopen; | |
106 | |
107 int fseek64(FILE*, c_long, int); | |
108 alias fseek64 fseek; | |
109 | |
110 int fsetpos64(FILE*, in fpos_t*); | |
111 alias fsetpos64 fsetpos; | |
112 | |
113 FILE* tmpfile64(); | |
114 alias tmpfile64 tmpfile; | |
115 } | |
116 else | |
117 { | |
118 int fgetpos(FILE*, fpos_t *); | |
119 FILE* fopen(in char*, in char*); | |
120 FILE* freopen(in char*, in char*, FILE*); | |
121 int fseek(FILE*, c_long, int); | |
122 int fsetpos(FILE*, in fpos_t*); | |
123 FILE* tmpfile(); | |
124 } | |
125 } | |
126 | |
127 // | |
128 // C Extension (CX) | |
129 // | |
130 /* | |
131 L_ctermid | |
132 | |
133 char* ctermid(char*); | |
134 FILE* fdopen(int, in char*); | |
135 int fileno(FILE*); | |
136 int fseeko(FILE*, off_t, int); | |
137 off_t ftello(FILE*); | |
138 char* gets(char*); | |
139 FILE* popen(in char*, in char*); | |
140 */ | |
141 | |
142 version( linux ) | |
143 { | |
144 enum L_ctermid = 9; | |
145 | |
146 static if( __USE_FILE_OFFSET64 ) | |
147 { | |
148 int fseeko64(FILE*, off_t, int); | |
149 alias fseeko64 fseeko; | |
150 } | |
151 else | |
152 { | |
153 int fseeko(FILE*, off_t, int); | |
154 } | |
155 | |
156 static if( __USE_LARGEFILE64 ) | |
157 { | |
158 off_t ftello64(FILE*); | |
159 alias ftello64 ftello; | |
160 } | |
161 else | |
162 { | |
163 off_t ftello(FILE*); | |
164 } | |
165 } | |
166 else | |
167 { | |
168 int fseeko(FILE*, off_t, int); | |
169 off_t ftello(FILE*); | |
170 } | |
171 | |
172 char* ctermid(char*); | |
173 FILE* fdopen(int, in char*); | |
174 int fileno(FILE*); | |
175 //int fseeko(FILE*, off_t, int); | |
176 //off_t ftello(FILE*); | |
177 char* gets(char*); | |
178 FILE* popen(in char*, in char*); | |
179 | |
180 // | |
181 // Thread-Safe Functions (TSF) | |
182 // | |
183 /* | |
184 void flockfile(FILE*); | |
185 int ftrylockfile(FILE*); | |
186 void funlockfile(FILE*); | |
187 int getc_unlocked(FILE*); | |
188 int getchar_unlocked(); | |
189 int putc_unlocked(int, FILE*); | |
190 int putchar_unlocked(int); | |
191 */ | |
192 | |
193 version( linux ) | |
194 { | |
195 void flockfile(FILE*); | |
196 int ftrylockfile(FILE*); | |
197 void funlockfile(FILE*); | |
198 int getc_unlocked(FILE*); | |
199 int getchar_unlocked(); | |
200 int putc_unlocked(int, FILE*); | |
201 int putchar_unlocked(int); | |
202 } | |
203 | |
204 // | |
205 // XOpen (XSI) | |
206 // | |
207 /* | |
208 P_tmpdir | |
209 va_list (defined in core.stdc.stdarg) | |
210 | |
211 char* tempnam(in char*, in char*); | |
212 */ | |
213 | |
214 version( linux ) | |
215 { | |
216 enum P_tmpdir = "/tmp"; | |
217 | |
218 char* tempnam(in char*, in char*); | |
219 } |