authorgravatar for nikita@NetBSD.orgNikita Ronja <nikita@NetBSD.org> 2023-03-30 21:57:37+02:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2023-04-06 03:46:44+03:00
logd92b5fcfb00a5adc2442bd39fe33c72037bb0c6a
tree903db5055ee1883ea8875da00de06554978d12ee
parent66520c8342193827f703274aabfff6ad8656aee1

Add NetBSD termios constants to std.c.netbsd


1 files changed, 137 insertions(+), 0 deletions(-)

lib/std/c/netbsd.zig+137
...@@ -915,6 +915,143 @@ pub const T = struct {...@@ -915,6 +915,143 @@ pub const T = struct {
915 pub const IOCXMTFRAME = 0x80087444;915 pub const IOCXMTFRAME = 0x80087444;
916};916};
917917
918// Term
919const V = struct {
920 pub const EOF = 0; // ICANON
921 pub const EOL = 1; // ICANON
922 pub const EOL2 = 2; // ICANON
923 pub const ERASE = 3; // ICANON
924 pub const WERASE = 4; // ICANON
925 pub const KILL = 5; // ICANON
926 pub const REPRINT = 6; // ICANON
927 // 7 spare 1
928 pub const INTR = 8; // ISIG
929 pub const QUIT = 9; // ISIG
930 pub const SUSP = 10; // ISIG
931 pub const DSUSP = 11; // ISIG
932 pub const START = 12; // IXON, IXOFF
933 pub const STOP = 13; // IXON, IXOFF
934 pub const LNEXT = 14; // IEXTEN
935 pub const DISCARD = 15; // IEXTEN
936 pub const MIN = 16; // !ICANON
937 pub const TIME = 17; // !ICANON
938 pub const STATUS = 18; // ICANON
939 // 19 spare 2
940};
941
942// Input flags - software input processing
943pub const IGNBRK: tcflag_t = 0x00000001; // ignore BREAK condition
944pub const BRKINT: tcflag_t = 0x00000002; // map BREAK to SIGINT
945pub const IGNPAR: tcflag_t = 0x00000004; // ignore (discard) parity errors
946pub const PARMRK: tcflag_t = 0x00000008; // mark parity and framing errors
947pub const INPCK: tcflag_t = 0x00000010; // enable checking of parity errors
948pub const ISTRIP: tcflag_t = 0x00000020; // strip 8th bit off chars
949pub const INLCR: tcflag_t = 0x00000040; // map NL into CR
950pub const IGNCR: tcflag_t = 0x00000080; // ignore CR
951pub const ICRNL: tcflag_t = 0x00000100; // map CR to NL (ala CRMOD)
952pub const IXON: tcflag_t = 0x00000200; // enable output flow control
953pub const IXOFF: tcflag_t = 0x00000400; // enable input flow control
954pub const IXANY: tcflag_t = 0x00000800; // any char will restart after stop
955pub const IMAXBEL: tcflag_t = 0x00002000; // ring bell on input queue full
956
957// Output flags - software output processing
958pub const OPOST: tcflag_t = 0x00000001; // enable following output processing
959pub const ONLCR: tcflag_t = 0x00000002; // map NL to CR-NL (ala CRMOD)
960pub const OXTABS: tcflag_t = 0x00000004; // expand tabs to spaces
961pub const ONOEOT: tcflag_t = 0x00000008; // discard EOT's (^D) on output
962pub const OCRNL: tcflag_t = 0x00000010; // map CR to NL
963pub const ONOCR: tcflag_t = 0x00000040; // discard CR's when on column 0
964pub const ONLRET: tcflag_t = 0x00000080; // move to column 0 on CR
965
966// Control flags - hardware control of terminal
967pub const CIGNORE: tcflag_t = 0x00000001; // ignore control flags
968pub const CSIZE: tcflag_t = 0x00000300; // character size mask
969pub const CS5: tcflag_t = 0x00000000; // 5 bits (pseudo)
970pub const CS6: tcflag_t = 0x00000100; // 6 bits
971pub const CS7: tcflag_t = 0x00000200; // 7 bits
972pub const CS8: tcflag_t = 0x00000300; // 8 bits
973pub const CSTOPB: tcflag_t = 0x00000400; // send 2 stop bits
974pub const CREAD: tcflag_t = 0x00000800; // enable receiver
975pub const PARENB: tcflag_t = 0x00001000; // parity enable
976pub const PARODD: tcflag_t = 0x00002000; // odd parity, else even
977pub const HUPCL: tcflag_t = 0x00004000; // hang up on last close
978pub const CLOCAL: tcflag_t = 0x00008000; // ignore modem status lines
979pub const CRTSCTS: tcflag_t = 0x00010000; // RTS/CTS full-duplex flow control
980pub const CRTS_IFLOW: tcflag_t = CRTSCTS; // XXX compat
981pub const CCTS_OFLOW: tcflag_t = CRTSCTS; // XXX compat
982pub const CDTRCTS: tcflag_t = 0x00020000; // DTR/CTS full-duplex flow control
983pub const MDMBUF: tcflag_t = 0x00100000; // DTR/DCD hardware flow control
984pub const CHWFLOW: tcflag_t = (MDMBUF | CRTSCTS | CDTRCTS); // all types of hw flow control
985
986pub const tcflag_t = c_uint;
987pub const speed_t = c_uint;
988pub const cc_t = u8;
989
990pub const NCCS = 20;
991
992pub const termios = extern struct {
993 iflag: tcflag_t, // input flags
994 oflag: tcflag_t, // output flags
995 cflag: tcflag_t, // control flags
996 lflag: tcflag_t, // local flags
997 cc: [NCCS]cc_t, // control chars
998 ispeed: c_int, // input speed
999 ospeed: c_int, // output speed
1000};
1001
1002// Commands passed to tcsetattr() for setting the termios structure.
1003pub const TCSA = struct {
1004 pub const NOW = 0; // make change immediate
1005 pub const DRAIN = 1; // drain output, then chage
1006 pub const FLUSH = 2; // drain output, flush input
1007 pub const SOFT = 0x10; // flag - don't alter h.w. state
1008};
1009
1010// Standard speeds
1011pub const B0: c_uint = 0;
1012pub const B50: c_uint = 50;
1013pub const B75: c_uint = 75;
1014pub const B110: c_uint = 110;
1015pub const B134: c_uint = 134;
1016pub const B150: c_uint = 150;
1017pub const B200: c_uint = 200;
1018pub const B300: c_uint = 300;
1019pub const B600: c_uint = 600;
1020pub const B1200: c_uint = 1200;
1021pub const B1800: c_uint = 1800;
1022pub const B2400: c_uint = 2400;
1023pub const B4800: c_uint = 4800;
1024pub const B9600: c_uint = 9600;
1025pub const B19200: c_uint = 19200;
1026pub const B38400: c_uint = 38400;
1027pub const B7200: c_uint = 7200;
1028pub const B14400: c_uint = 14400;
1029pub const B28800: c_uint = 28800;
1030pub const B57600: c_uint = 57600;
1031pub const B76800: c_uint = 76800;
1032pub const B115200: c_uint = 115200;
1033pub const B230400: c_uint = 230400;
1034pub const B460800: c_uint = 460800;
1035pub const B500000: c_uint = 500000;
1036pub const B921600: c_uint = 921600;
1037pub const B1000000: c_uint = 1000000;
1038pub const B1500000: c_uint = 1500000;
1039pub const B2000000: c_uint = 2000000;
1040pub const B2500000: c_uint = 2500000;
1041pub const B3000000: c_uint = 3000000;
1042pub const B3500000: c_uint = 3500000;
1043pub const B4000000: c_uint = 4000000;
1044pub const EXTA: c_uint = 19200;
1045pub const EXTB: c_uint = 38400;
1046
1047pub const TCIFLUSH = 1;
1048pub const TCOFLUSH = 2;
1049pub const TCIOFLUSH = 3;
1050pub const TCOOFF = 1;
1051pub const TCOON = 2;
1052pub const TCIOFF = 3;
1053pub const TCION = 4;
1054
918pub const winsize = extern struct {1055pub const winsize = extern struct {
919 ws_row: u16,1056 ws_row: u16,
920 ws_col: u16,1057 ws_col: u16,