Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit fb27be9

Browse files
ibuclawdlang-bot
authored andcommitted
Issue 22689: core.sys.posix.termios: Separate OS-specific types and flags from C runtime functions
1 parent 1abbfde commit fb27be9

1 file changed

Lines changed: 96 additions & 185 deletions

File tree

src/core/sys/posix/termios.d

Lines changed: 96 additions & 185 deletions
Original file line numberDiff line numberDiff line change
@@ -129,20 +129,9 @@ TCIOFF
129129
TCION
130130
TCOOFF
131131
TCOON
132-
133-
speed_t cfgetispeed(const scope termios*);
134-
speed_t cfgetospeed(const scope termios*);
135-
int cfsetispeed(termios*, speed_t);
136-
int cfsetospeed(termios*, speed_t);
137-
int tcdrain(int);
138-
int tcflow(int, int);
139-
int tcflush(int, int);
140-
int tcgetattr(int, termios*);
141-
int tcsendbreak(int, int);
142-
int tcsetattr(int, int, const scope termios*);
143132
*/
144133

145-
version (CRuntime_Glibc)
134+
version (linux)
146135
{
147136
alias ubyte cc_t;
148137
alias uint speed_t;
@@ -239,17 +228,6 @@ version (CRuntime_Glibc)
239228
enum TCION = 3;
240229
enum TCOOFF = 0;
241230
enum TCOON = 1;
242-
243-
speed_t cfgetispeed(const scope termios*);
244-
speed_t cfgetospeed(const scope termios*);
245-
int cfsetispeed(termios*, speed_t);
246-
int cfsetospeed(termios*, speed_t);
247-
int tcdrain(int);
248-
int tcflow(int, int);
249-
int tcflush(int, int);
250-
int tcgetattr(int, termios*);
251-
int tcsendbreak(int, int);
252-
int tcsetattr(int, int, const scope termios*);
253231
}
254232
else version (Darwin)
255233
{
@@ -347,18 +325,6 @@ else version (Darwin)
347325
enum TCION = 4;
348326
enum TCOOFF = 1;
349327
enum TCOON = 2;
350-
351-
speed_t cfgetispeed(const scope termios*);
352-
speed_t cfgetospeed(const scope termios*);
353-
int cfsetispeed(termios*, speed_t);
354-
int cfsetospeed(termios*, speed_t);
355-
int tcdrain(int);
356-
int tcflow(int, int);
357-
int tcflush(int, int);
358-
int tcgetattr(int, termios*);
359-
int tcsendbreak(int, int);
360-
int tcsetattr(int, int, const scope termios*);
361-
362328
}
363329
else version (FreeBSD)
364330
{
@@ -456,17 +422,6 @@ else version (FreeBSD)
456422
enum TCION = 4;
457423
enum TCOOFF = 1;
458424
enum TCOON = 2;
459-
460-
speed_t cfgetispeed(const scope termios*);
461-
speed_t cfgetospeed(const scope termios*);
462-
int cfsetispeed(termios*, speed_t);
463-
int cfsetospeed(termios*, speed_t);
464-
int tcdrain(int);
465-
int tcflow(int, int);
466-
int tcflush(int, int);
467-
int tcgetattr(int, termios*);
468-
int tcsendbreak(int, int);
469-
int tcsetattr(int, int, const scope termios*);
470425
}
471426
else version (DragonFlyBSD)
472427
{
@@ -564,17 +519,6 @@ else version (DragonFlyBSD)
564519
enum TCION = 4;
565520
enum TCOOFF = 1;
566521
enum TCOON = 2;
567-
568-
speed_t cfgetispeed(const scope termios*);
569-
speed_t cfgetospeed(const scope termios*);
570-
int cfsetispeed(termios*, speed_t);
571-
int cfsetospeed(termios*, speed_t);
572-
int tcdrain(int);
573-
int tcflow(int, int);
574-
int tcflush(int, int);
575-
int tcgetattr(int, termios*);
576-
int tcsendbreak(int, int);
577-
int tcsetattr(int, int, const scope termios*);
578522
}
579523
else version (NetBSD)
580524
{
@@ -672,17 +616,6 @@ else version (NetBSD)
672616
enum TCION = 4;
673617
enum TCOOFF = 1;
674618
enum TCOON = 2;
675-
676-
speed_t cfgetispeed(const scope termios*);
677-
speed_t cfgetospeed(const scope termios*);
678-
int cfsetispeed(termios*, speed_t);
679-
int cfsetospeed(termios*, speed_t);
680-
int tcdrain(int);
681-
int tcflow(int, int);
682-
int tcflush(int, int);
683-
int tcgetattr(int, termios*);
684-
int tcsendbreak(int, int);
685-
int tcsetattr(int, int, const scope termios*);
686619
}
687620
else version (OpenBSD)
688621
{
@@ -780,17 +713,6 @@ else version (OpenBSD)
780713
enum TCION = 4;
781714
enum TCOOFF = 1;
782715
enum TCOON = 2;
783-
784-
speed_t cfgetispeed(const scope termios*);
785-
speed_t cfgetospeed(const scope termios*);
786-
int cfsetispeed(termios*, speed_t);
787-
int cfsetospeed(termios*, speed_t);
788-
int tcdrain(int);
789-
int tcflow(int, int);
790-
int tcflush(int, int);
791-
int tcgetattr(int, termios*);
792-
int tcsendbreak(int, int);
793-
int tcsetattr(int, int, const scope termios*);
794716
}
795717
else version (Solaris)
796718
{
@@ -909,11 +831,102 @@ else version (Solaris)
909831
enum B307200 = 21;
910832
enum B460800 = 22;
911833
enum B921600 = 23;
834+
}
835+
836+
/*
837+
speed_t cfgetispeed(const scope termios*);
838+
speed_t cfgetospeed(const scope termios*);
839+
int cfsetispeed(termios*, speed_t);
840+
int cfsetospeed(termios*, speed_t);
841+
int tcdrain(int);
842+
int tcflow(int, int);
843+
int tcflush(int, int);
844+
int tcgetattr(int, termios*);
845+
int tcsendbreak(int, int);
846+
int tcsetattr(int, int, const scope termios*);
847+
*/
912848

913-
/*
914-
* POSIX termios functions
915-
* These functions get mapped into ioctls.
916-
*/
849+
version (CRuntime_Glibc)
850+
{
851+
speed_t cfgetispeed(const scope termios*);
852+
speed_t cfgetospeed(const scope termios*);
853+
int cfsetispeed(termios*, speed_t);
854+
int cfsetospeed(termios*, speed_t);
855+
int tcdrain(int);
856+
int tcflow(int, int);
857+
int tcflush(int, int);
858+
int tcgetattr(int, termios*);
859+
int tcsendbreak(int, int);
860+
int tcsetattr(int, int, const scope termios*);
861+
}
862+
else version (Darwin)
863+
{
864+
speed_t cfgetispeed(const scope termios*);
865+
speed_t cfgetospeed(const scope termios*);
866+
int cfsetispeed(termios*, speed_t);
867+
int cfsetospeed(termios*, speed_t);
868+
int tcdrain(int);
869+
int tcflow(int, int);
870+
int tcflush(int, int);
871+
int tcgetattr(int, termios*);
872+
int tcsendbreak(int, int);
873+
int tcsetattr(int, int, const scope termios*);
874+
875+
}
876+
else version (FreeBSD)
877+
{
878+
speed_t cfgetispeed(const scope termios*);
879+
speed_t cfgetospeed(const scope termios*);
880+
int cfsetispeed(termios*, speed_t);
881+
int cfsetospeed(termios*, speed_t);
882+
int tcdrain(int);
883+
int tcflow(int, int);
884+
int tcflush(int, int);
885+
int tcgetattr(int, termios*);
886+
int tcsendbreak(int, int);
887+
int tcsetattr(int, int, const scope termios*);
888+
}
889+
else version (DragonFlyBSD)
890+
{
891+
speed_t cfgetispeed(const scope termios*);
892+
speed_t cfgetospeed(const scope termios*);
893+
int cfsetispeed(termios*, speed_t);
894+
int cfsetospeed(termios*, speed_t);
895+
int tcdrain(int);
896+
int tcflow(int, int);
897+
int tcflush(int, int);
898+
int tcgetattr(int, termios*);
899+
int tcsendbreak(int, int);
900+
int tcsetattr(int, int, const scope termios*);
901+
}
902+
else version (NetBSD)
903+
{
904+
speed_t cfgetispeed(const scope termios*);
905+
speed_t cfgetospeed(const scope termios*);
906+
int cfsetispeed(termios*, speed_t);
907+
int cfsetospeed(termios*, speed_t);
908+
int tcdrain(int);
909+
int tcflow(int, int);
910+
int tcflush(int, int);
911+
int tcgetattr(int, termios*);
912+
int tcsendbreak(int, int);
913+
int tcsetattr(int, int, const scope termios*);
914+
}
915+
else version (OpenBSD)
916+
{
917+
speed_t cfgetispeed(const scope termios*);
918+
speed_t cfgetospeed(const scope termios*);
919+
int cfsetispeed(termios*, speed_t);
920+
int cfsetospeed(termios*, speed_t);
921+
int tcdrain(int);
922+
int tcflow(int, int);
923+
int tcflush(int, int);
924+
int tcgetattr(int, termios*);
925+
int tcsendbreak(int, int);
926+
int tcsetattr(int, int, const scope termios*);
927+
}
928+
else version (Solaris)
929+
{
917930
speed_t cfgetospeed(const scope termios*);
918931
int cfsetospeed(termios*, speed_t);
919932
speed_t cfgetispeed(const scope termios*);
@@ -927,108 +940,6 @@ else version (Solaris)
927940
}
928941
else version (CRuntime_UClibc)
929942
{
930-
alias ubyte cc_t;
931-
alias uint speed_t;
932-
alias uint tcflag_t;
933-
934-
enum NCCS = 32;
935-
936-
struct termios
937-
{
938-
tcflag_t c_iflag;
939-
tcflag_t c_oflag;
940-
tcflag_t c_cflag;
941-
tcflag_t c_lflag;
942-
cc_t c_line;
943-
cc_t[NCCS] c_cc;
944-
speed_t c_ispeed;
945-
speed_t c_ospeed;
946-
}
947-
948-
enum VINTR = 0;
949-
enum VQUIT = 1;
950-
enum VERASE = 2;
951-
enum VKILL = 3;
952-
enum VEOF = 4;
953-
enum VTIME = 5;
954-
enum VMIN = 6;
955-
enum VSWTC = 7;
956-
enum VSTART = 8;
957-
enum VSTOP = 9;
958-
enum VSUSP = 10;
959-
enum VEOL = 11;
960-
enum VREPRINT = 12;
961-
enum VDISCARD = 13;
962-
enum VWERASE = 14;
963-
enum VLNEXT = 15;
964-
enum VEOL2 = 16;
965-
966-
enum BRKINT = 0x0000002; // 0000002
967-
enum ICRNL = 0x0000100; // 0000400
968-
enum IGNBRK = 0x0000001; // 0000001
969-
enum IGNCR = 0x0000080; // 0000200
970-
enum IGNPAR = 0x0000004; // 0000004
971-
enum INLCR = 0x0000040; // 0000100
972-
enum INPCK = 0x0000010; // 0000020
973-
enum ISTRIP = 0x0000020; // 0000040
974-
enum IXOFF = 0x0001000; // 0010000
975-
enum IXON = 0x0000400; // 0002000
976-
enum PARMRK = 0x0000008; // 0000010
977-
978-
enum OPOST = 0x0000001; // 0000001
979-
980-
enum B0 = 0x0000000; // 0000000
981-
enum B50 = 0x0000001; // 0000001
982-
enum B75 = 0x0000002; // 0000002
983-
enum B110 = 0x0000003; // 0000003
984-
enum B134 = 0x0000004; // 0000004
985-
enum B150 = 0x0000005; // 0000005
986-
enum B200 = 0x0000006; // 0000006
987-
enum B300 = 0x0000007; // 0000007
988-
enum B600 = 0x0000008; // 0000010
989-
enum B1200 = 0x0000009; // 0000011
990-
enum B1800 = 0x000000A; // 0000012
991-
enum B2400 = 0x000000B; // 0000013
992-
enum B4800 = 0x000000C; // 0000014
993-
enum B9600 = 0x000000D; // 0000015
994-
enum B19200 = 0x000000E; // 0000016
995-
enum B38400 = 0x000000F; // 0000017
996-
997-
enum CSIZE = 0x0000030; // 0000060
998-
enum CS5 = 0x0000000; // 0000000
999-
enum CS6 = 0x0000010; // 0000020
1000-
enum CS7 = 0x0000020; // 0000040
1001-
enum CS8 = 0x0000030; // 0000060
1002-
enum CSTOPB = 0x0000040; // 0000100
1003-
enum CREAD = 0x0000080; // 0000200
1004-
enum PARENB = 0x0000100; // 0000400
1005-
enum PARODD = 0x0000200; // 0001000
1006-
enum HUPCL = 0x0000400; // 0002000
1007-
enum CLOCAL = 0x0000800; // 0004000
1008-
1009-
enum ECHO = 0x0000008; // 0000010
1010-
enum ECHOE = 0x0000010; // 0000020
1011-
enum ECHOK = 0x0000020; // 0000040
1012-
enum ECHONL = 0x0000040; // 0000100
1013-
enum ICANON = 0x0000002; // 0000002
1014-
enum IEXTEN = 0x0008000; // 0100000
1015-
enum ISIG = 0x0000001; // 0000001
1016-
enum NOFLSH = 0x0000080; // 0000200
1017-
enum TOSTOP = 0x0000100; // 0000400
1018-
1019-
enum TCSANOW = 0;
1020-
enum TCSADRAIN = 1;
1021-
enum TCSAFLUSH = 2;
1022-
1023-
enum TCIFLUSH = 0;
1024-
enum TCOFLUSH = 1;
1025-
enum TCIOFLUSH = 2;
1026-
1027-
enum TCIOFF = 2;
1028-
enum TCION = 3;
1029-
enum TCOOFF = 0;
1030-
enum TCOON = 1;
1031-
1032943
speed_t cfgetispeed(const scope termios*);
1033944
speed_t cfgetospeed(const scope termios*);
1034945
int cfsetispeed(termios*, speed_t);

0 commit comments

Comments
 (0)