Mercurial > projects > ldc
comparison druntime/import/core/sys/posix/termios.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.termios; | |
15 | |
16 private import core.sys.posix.config; | |
17 public import core.sys.posix.sys.types; // for pid_t | |
18 | |
19 extern (C): | |
20 | |
21 // | |
22 // Required | |
23 // | |
24 /* | |
25 cc_t | |
26 speed_t | |
27 tcflag_t | |
28 | |
29 NCCS | |
30 | |
31 struct termios | |
32 { | |
33 tcflag_t c_iflag; | |
34 tcflag_t c_oflag; | |
35 tcflag_t c_cflag; | |
36 tcflag_t c_lflag; | |
37 cc_t[NCCS] c_cc; | |
38 } | |
39 | |
40 VEOF | |
41 VEOL | |
42 VERASE | |
43 VINTR | |
44 VKILL | |
45 VMIN | |
46 VQUIT | |
47 VSTART | |
48 VSTOP | |
49 VSUSP | |
50 VTIME | |
51 | |
52 BRKINT | |
53 ICRNL | |
54 IGNBRK | |
55 IGNCR | |
56 IGNPAR | |
57 INLCR | |
58 INPCK | |
59 ISTRIP | |
60 IXOFF | |
61 IXON | |
62 PARMRK | |
63 | |
64 OPOST | |
65 | |
66 B0 | |
67 B50 | |
68 B75 | |
69 B110 | |
70 B134 | |
71 B150 | |
72 B200 | |
73 B300 | |
74 B600 | |
75 B1200 | |
76 B1800 | |
77 B2400 | |
78 B4800 | |
79 B9600 | |
80 B19200 | |
81 B38400 | |
82 | |
83 CSIZE | |
84 CS5 | |
85 CS6 | |
86 CS7 | |
87 CS8 | |
88 CSTOPB | |
89 CREAD | |
90 PARENB | |
91 PARODD | |
92 HUPCL | |
93 CLOCAL | |
94 | |
95 ECHO | |
96 ECHOE | |
97 ECHOK | |
98 ECHONL | |
99 ICANON | |
100 IEXTEN | |
101 ISIG | |
102 NOFLSH | |
103 TOSTOP | |
104 | |
105 TCSANOW | |
106 TCSADRAIN | |
107 TCSAFLUSH | |
108 | |
109 TCIFLUSH | |
110 TCIOFLUSH | |
111 TCOFLUSH | |
112 | |
113 TCIOFF | |
114 TCION | |
115 TCOOFF | |
116 TCOON | |
117 | |
118 speed_t cfgetispeed(in termios*); | |
119 speed_t cfgetospeed(in termios*); | |
120 int cfsetispeed(termios*, speed_t); | |
121 int cfsetospeed(termios*, speed_t); | |
122 int tcdrain(int); | |
123 int tcflow(int, int); | |
124 int tcflush(int, int); | |
125 int tcgetattr(int, termios*); | |
126 int tcsendbreak(int, int); | |
127 int tcsetattr(int, int, in termios*); | |
128 */ | |
129 | |
130 version( OSX ) | |
131 { | |
132 alias ubyte cc_t; | |
133 alias uint speed_t; | |
134 alias uint tcflag_t; | |
135 | |
136 enum NCCS = 20; | |
137 | |
138 struct termios | |
139 { | |
140 tcflag_t c_iflag; | |
141 tcflag_t c_oflag; | |
142 tcflag_t c_cflag; | |
143 tcflag_t c_lflag; | |
144 cc_t[NCCS] c_cc; | |
145 speed_t c_ispeed; | |
146 speed_t c_ospeed; | |
147 } | |
148 | |
149 enum VEOF = 0; | |
150 enum VEOL = 1; | |
151 enum VERASE = 3; | |
152 enum VINTR = 8; | |
153 enum VKILL = 5; | |
154 enum VMIN = 16; | |
155 enum VQUIT = 9; | |
156 enum VSTART = 12; | |
157 enum VSTOP = 13; | |
158 enum VSUSP = 10; | |
159 enum VTIME = 17; | |
160 | |
161 enum BRKINT = 0x0000002; | |
162 enum ICRNL = 0x0000100; | |
163 enum IGNBRK = 0x0000001; | |
164 enum IGNCR = 0x0000080; | |
165 enum IGNPAR = 0x0000004; | |
166 enum INLCR = 0x0000040; | |
167 enum INPCK = 0x0000010; | |
168 enum ISTRIP = 0x0000020; | |
169 enum IXOFF = 0x0000400; | |
170 enum IXON = 0x0000200; | |
171 enum PARMRK = 0x0000008; | |
172 | |
173 enum OPOST = 0x0000001; | |
174 | |
175 enum B0 = 0; | |
176 enum B50 = 50; | |
177 enum B75 = 75; | |
178 enum B110 = 110; | |
179 enum B134 = 134; | |
180 enum B150 = 150; | |
181 enum B200 = 200; | |
182 enum B300 = 300; | |
183 enum B600 = 600; | |
184 enum B1200 = 1200; | |
185 enum B1800 = 1800; | |
186 enum B2400 = 2400; | |
187 enum B4800 = 4800; | |
188 enum B9600 = 9600; | |
189 enum B19200 = 19200; | |
190 enum B38400 = 38400; | |
191 | |
192 enum CSIZE = 0x0000300; | |
193 enum CS5 = 0x0000000; | |
194 enum CS6 = 0x0000100; | |
195 enum CS7 = 0x0000200; | |
196 enum CS8 = 0x0000300; | |
197 enum CSTOPB = 0x0000400; | |
198 enum CREAD = 0x0000800; | |
199 enum PARENB = 0x0001000; | |
200 enum PARODD = 0x0002000; | |
201 enum HUPCL = 0x0004000; | |
202 enum CLOCAL = 0x0008000; | |
203 | |
204 enum ECHO = 0x00000008; | |
205 enum ECHOE = 0x00000002; | |
206 enum ECHOK = 0x00000004; | |
207 enum ECHONL = 0x00000010; | |
208 enum ICANON = 0x00000100; | |
209 enum IEXTEN = 0x00000400; | |
210 enum ISIG = 0x00000080; | |
211 enum NOFLSH = 0x80000000; | |
212 enum TOSTOP = 0x00400000; | |
213 | |
214 enum TCSANOW = 0; | |
215 enum TCSADRAIN = 1; | |
216 enum TCSAFLUSH = 2; | |
217 | |
218 enum TCIFLUSH = 1; | |
219 enum TCOFLUSH = 2; | |
220 enum TCIOFLUSH = 3; | |
221 | |
222 enum TCIOFF = 3; | |
223 enum TCION = 4; | |
224 enum TCOOFF = 1; | |
225 enum TCOON = 2; | |
226 | |
227 speed_t cfgetispeed(in termios*); | |
228 speed_t cfgetospeed(in termios*); | |
229 int cfsetispeed(termios*, speed_t); | |
230 int cfsetospeed(termios*, speed_t); | |
231 int tcdrain(int); | |
232 int tcflow(int, int); | |
233 int tcflush(int, int); | |
234 int tcgetattr(int, termios*); | |
235 int tcsendbreak(int, int); | |
236 int tcsetattr(int, int, in termios*); | |
237 | |
238 } | |
239 else version( linux ) | |
240 { | |
241 alias ubyte cc_t; | |
242 alias uint speed_t; | |
243 alias uint tcflag_t; | |
244 | |
245 enum NCCS = 32; | |
246 | |
247 struct termios | |
248 { | |
249 tcflag_t c_iflag; | |
250 tcflag_t c_oflag; | |
251 tcflag_t c_cflag; | |
252 tcflag_t c_lflag; | |
253 cc_t c_line; | |
254 cc_t[NCCS] c_cc; | |
255 speed_t c_ispeed; | |
256 speed_t c_ospeed; | |
257 } | |
258 | |
259 enum VEOF = 4; | |
260 enum VEOL = 11; | |
261 enum VERASE = 2; | |
262 enum VINTR = 0; | |
263 enum VKILL = 3; | |
264 enum VMIN = 6; | |
265 enum VQUIT = 1; | |
266 enum VSTART = 8; | |
267 enum VSTOP = 9; | |
268 enum VSUSP = 10; | |
269 enum VTIME = 5; | |
270 | |
271 enum BRKINT = 0000002; | |
272 enum ICRNL = 0000400; | |
273 enum IGNBRK = 0000001; | |
274 enum IGNCR = 0000200; | |
275 enum IGNPAR = 0000004; | |
276 enum INLCR = 0000100; | |
277 enum INPCK = 0000020; | |
278 enum ISTRIP = 0000040; | |
279 enum IXOFF = 0010000; | |
280 enum IXON = 0002000; | |
281 enum PARMRK = 0000010; | |
282 | |
283 enum OPOST = 0000001; | |
284 | |
285 enum B0 = 0000000; | |
286 enum B50 = 0000001; | |
287 enum B75 = 0000002; | |
288 enum B110 = 0000003; | |
289 enum B134 = 0000004; | |
290 enum B150 = 0000005; | |
291 enum B200 = 0000006; | |
292 enum B300 = 0000007; | |
293 enum B600 = 0000010; | |
294 enum B1200 = 0000011; | |
295 enum B1800 = 0000012; | |
296 enum B2400 = 0000013; | |
297 enum B4800 = 0000014; | |
298 enum B9600 = 0000015; | |
299 enum B19200 = 0000016; | |
300 enum B38400 = 0000017; | |
301 | |
302 enum CSIZE = 0000060; | |
303 enum CS5 = 0000000; | |
304 enum CS6 = 0000020; | |
305 enum CS7 = 0000040; | |
306 enum CS8 = 0000060; | |
307 enum CSTOPB = 0000100; | |
308 enum CREAD = 0000200; | |
309 enum PARENB = 0000400; | |
310 enum PARODD = 0001000; | |
311 enum HUPCL = 0002000; | |
312 enum CLOCAL = 0004000; | |
313 | |
314 enum ECHO = 0000010; | |
315 enum ECHOE = 0000020; | |
316 enum ECHOK = 0000040; | |
317 enum ECHONL = 0000100; | |
318 enum ICANON = 0000002; | |
319 enum IEXTEN = 0100000; | |
320 enum ISIG = 0000001; | |
321 enum NOFLSH = 0000200; | |
322 enum TOSTOP = 0000400; | |
323 | |
324 enum TCSANOW = 0; | |
325 enum TCSADRAIN = 1; | |
326 enum TCSAFLUSH = 2; | |
327 | |
328 enum TCIFLUSH = 0; | |
329 enum TCOFLUSH = 1; | |
330 enum TCIOFLUSH = 2; | |
331 | |
332 enum TCIOFF = 2; | |
333 enum TCION = 3; | |
334 enum TCOOFF = 0; | |
335 enum TCOON = 1; | |
336 | |
337 speed_t cfgetispeed(in termios*); | |
338 speed_t cfgetospeed(in termios*); | |
339 int cfsetispeed(termios*, speed_t); | |
340 int cfsetospeed(termios*, speed_t); | |
341 int tcdrain(int); | |
342 int tcflow(int, int); | |
343 int tcflush(int, int); | |
344 int tcgetattr(int, termios*); | |
345 int tcsendbreak(int, int); | |
346 int tcsetattr(int, int, in termios*); | |
347 } | |
348 else version ( freebsd ) | |
349 { | |
350 alias ubyte cc_t; | |
351 alias uint speed_t; | |
352 alias uint tcflag_t; | |
353 | |
354 enum NCCS = 20; | |
355 | |
356 struct termios | |
357 { | |
358 tcflag_t c_iflag; | |
359 tcflag_t c_oflag; | |
360 tcflag_t c_cflag; | |
361 tcflag_t c_lflag; | |
362 cc_t[NCCS] c_cc; | |
363 speed_t c_ispeed; | |
364 speed_t c_ospeed; | |
365 } | |
366 | |
367 enum VEOF = 0; | |
368 enum VEOL = 1; | |
369 enum VERASE = 3; | |
370 enum VINTR = 8; | |
371 enum VKILL = 5; | |
372 enum VMIN = 16; | |
373 enum VQUIT = 9; | |
374 enum VSTART = 12; | |
375 enum VSTOP = 13; | |
376 enum VSUSP = 10; | |
377 enum VTIME = 17; | |
378 | |
379 enum BRKINT = 0x0000002; | |
380 enum ICRNL = 0x0000100; | |
381 enum IGNBRK = 0x0000001; | |
382 enum IGNCR = 0x0000080; | |
383 enum IGNPAR = 0x0000004; | |
384 enum INLCR = 0x0000040; | |
385 enum INPCK = 0x0000010; | |
386 enum ISTRIP = 0x0000020; | |
387 enum IXOFF = 0x0000400; | |
388 enum IXON = 0x0000200; | |
389 enum PARMRK = 0x0000008; | |
390 | |
391 enum OPOST = 0x0000001; | |
392 | |
393 enum B0 = 0; | |
394 enum B50 = 50; | |
395 enum B75 = 75; | |
396 enum B110 = 110; | |
397 enum B134 = 134; | |
398 enum B150 = 150; | |
399 enum B200 = 200; | |
400 enum B300 = 300; | |
401 enum B600 = 600; | |
402 enum B1200 = 1200; | |
403 enum B1800 = 1800; | |
404 enum B2400 = 2400; | |
405 enum B4800 = 4800; | |
406 enum B9600 = 9600; | |
407 enum B19200 = 19200; | |
408 enum B38400 = 38400; | |
409 | |
410 enum CSIZE = 0x0000300; | |
411 enum CS5 = 0x0000000; | |
412 enum CS6 = 0x0000100; | |
413 enum CS7 = 0x0000200; | |
414 enum CS8 = 0x0000300; | |
415 enum CSTOPB = 0x0000400; | |
416 enum CREAD = 0x0000800; | |
417 enum PARENB = 0x0001000; | |
418 enum PARODD = 0x0002000; | |
419 enum HUPCL = 0x0004000; | |
420 enum CLOCAL = 0x0008000; | |
421 | |
422 enum ECHO = 0x00000008; | |
423 enum ECHOE = 0x00000002; | |
424 enum ECHOK = 0x00000004; | |
425 enum ECHONL = 0x00000010; | |
426 enum ICANON = 0x00000100; | |
427 enum IEXTEN = 0x00000400; | |
428 enum ISIG = 0x00000080; | |
429 enum NOFLSH = 0x80000000; | |
430 enum TOSTOP = 0x00400000; | |
431 | |
432 enum TCSANOW = 0; | |
433 enum TCSADRAIN = 1; | |
434 enum TCSAFLUSH = 2; | |
435 | |
436 enum TCIFLUSH = 1; | |
437 enum TCOFLUSH = 2; | |
438 enum TCIOFLUSH = 3; | |
439 | |
440 enum TCIOFF = 3; | |
441 enum TCION = 4; | |
442 enum TCOOFF = 1; | |
443 enum TCOON = 2; | |
444 | |
445 speed_t cfgetispeed(in termios*); | |
446 speed_t cfgetospeed(in termios*); | |
447 int cfsetispeed(termios*, speed_t); | |
448 int cfsetospeed(termios*, speed_t); | |
449 int tcdrain(int); | |
450 int tcflow(int, int); | |
451 int tcflush(int, int); | |
452 int tcgetattr(int, termios*); | |
453 int tcsendbreak(int, int); | |
454 int tcsetattr(int, int, in termios*); | |
455 | |
456 } | |
457 | |
458 // | |
459 // XOpen (XSI) | |
460 // | |
461 /* | |
462 IXANY | |
463 | |
464 ONLCR | |
465 OCRNL | |
466 ONOCR | |
467 ONLRET | |
468 OFILL | |
469 NLDLY | |
470 NL0 | |
471 NL1 | |
472 CRDLY | |
473 CR0 | |
474 CR1 | |
475 CR2 | |
476 CR3 | |
477 TABDLY | |
478 TAB0 | |
479 TAB1 | |
480 TAB2 | |
481 TAB3 | |
482 BSDLY | |
483 BS0 | |
484 BS1 | |
485 VTDLY | |
486 VT0 | |
487 VT1 | |
488 FFDLY | |
489 FF0 | |
490 FF1 | |
491 | |
492 pid_t tcgetsid(int); | |
493 */ | |
494 | |
495 version( linux ) | |
496 { | |
497 enum IXANY = 0004000; | |
498 | |
499 enum ONLCR = 0000004; | |
500 enum OCRNL = 0000010; | |
501 enum ONOCR = 0000020; | |
502 enum ONLRET = 0000040; | |
503 enum OFILL = 0000100; | |
504 enum NLDLY = 0000400; | |
505 enum NL0 = 0000000; | |
506 enum NL1 = 0000400; | |
507 enum CRDLY = 0003000; | |
508 enum CR0 = 0000000; | |
509 enum CR1 = 0001000; | |
510 enum CR2 = 0002000; | |
511 enum CR3 = 0003000; | |
512 enum TABDLY = 0014000; | |
513 enum TAB0 = 0000000; | |
514 enum TAB1 = 0004000; | |
515 enum TAB2 = 0010000; | |
516 enum TAB3 = 0014000; | |
517 enum BSDLY = 0020000; | |
518 enum BS0 = 0000000; | |
519 enum BS1 = 0020000; | |
520 enum VTDLY = 0040000; | |
521 enum VT0 = 0000000; | |
522 enum VT1 = 0040000; | |
523 enum FFDLY = 0100000; | |
524 enum FF0 = 0000000; | |
525 enum FF1 = 0100000; | |
526 | |
527 pid_t tcgetsid(int); | |
528 } |