authorgravatar for kappaloris@gmail.comLoris Cro <kappaloris@gmail.com> 2020-12-15 07:56:59+01:00
committergravatar for kappaloris@gmail.comLoris Cro <kappaloris@gmail.com> 2020-12-23 17:28:59+01:00
log8c00c7473c72a18e22666ee6bfb0f4ffdad63695
treefd05639f57bbdf280a7dd3a5e931f5602b6298f5
parent49ca51fc3ac35ee3ab25cdad9747c9c0719ffe5e

add termios bits for darwin


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

lib/std/os/bits/darwin.zig+183
...@@ -1554,3 +1554,186 @@ pub const rlimit = extern struct {...@@ -1554,3 +1554,186 @@ pub const rlimit = extern struct {
1554pub const SHUT_RD = 0;1554pub const SHUT_RD = 0;
1555pub const SHUT_WR = 1;1555pub const SHUT_WR = 1;
1556pub const SHUT_RDWR = 2;1556pub const SHUT_RDWR = 2;
1557
1558// Term
1559pub const VEOF = 0;
1560pub const VEOL = 1;
1561pub const VEOL2 = 2;
1562pub const VERASE = 3;
1563pub const VWERASE = 4;
1564pub const VKILL = 5;
1565pub const VREPRINT = 6;
1566pub const VINTR = 8;
1567pub const VQUIT = 9;
1568pub const VSUSP = 10;
1569pub const VDSUSP = 11;
1570pub const VSTART = 12;
1571pub const VSTOP = 13;
1572pub const VLNEXT = 14;
1573pub const VDISCARD = 15;
1574pub const VMIN = 16;
1575pub const VTIME = 17;
1576pub const VSTATUS = 18;
1577pub const NCCS = 20; // 2 spares (7, 19)
1578
1579pub const IGNBRK = 0x00000001;
1580pub const BRKINT = 0x00000002;
1581pub const IGNPAR = 0x00000004;
1582pub const PARMRK = 0x00000008;
1583pub const INPCK = 0x00000010;
1584pub const ISTRIP = 0x00000020;
1585pub const INLCR = 0x00000040;
1586pub const IGNCR = 0x00000080;
1587pub const ICRNL = 0x00000100;
1588pub const IXON = 0x00000200;
1589pub const IXOFF = 0x00000400;
1590pub const IXANY = 0x00000800;
1591pub const IMAXBEL = 0x00002000;
1592pub const IUTF8 = 0x00004000;
1593
1594pub const OPOST = 0x00000001;
1595pub const ONLCR = 0x00000002;
1596pub const OXTABS = 0x00000004;
1597pub const ONOEOT = 0x00000008;
1598
1599pub const OCRNL = 0x00000010;
1600pub const ONOCR = 0x00000020;
1601pub const ONLRET = 0x00000040;
1602pub const OFILL = 0x00000080;
1603pub const NLDLY = 0x00000300;
1604pub const TABDLY = 0x00000c04;
1605pub const CRDLY = 0x00003000;
1606pub const FFDLY = 0x00004000;
1607pub const BSDLY = 0x00008000;
1608pub const VTDLY = 0x00010000;
1609pub const OFDEL = 0x00020000;
1610
1611pub const NL0 = 0x00000000;
1612pub const NL1 = 0x00000100;
1613pub const NL2 = 0x00000200;
1614pub const NL3 = 0x00000300;
1615pub const TAB0 = 0x00000000;
1616pub const TAB1 = 0x00000400;
1617pub const TAB2 = 0x00000800;
1618pub const TAB3 = 0x00000004;
1619pub const CR0 = 0x00000000;
1620pub const CR1 = 0x00001000;
1621pub const CR2 = 0x00002000;
1622pub const CR3 = 0x00003000;
1623pub const FF0 = 0x00000000;
1624pub const FF1 = 0x00004000;
1625pub const BS0 = 0x00000000;
1626pub const BS1 = 0x00008000;
1627pub const VT0 = 0x00000000;
1628pub const VT1 = 0x00010000;
1629
1630pub const CIGNORE = 0x00000001;
1631pub const CSIZE = 0x00000300;
1632pub const CS5 = 0x00000000;
1633pub const CS6 = 0x00000100;
1634pub const CS7 = 0x00000200;
1635pub const CS8 = 0x00000300;
1636pub const CSTOPB = 0x00000400;
1637pub const CREAD = 0x00000800;
1638pub const PARENB = 0x00001000;
1639pub const PARODD = 0x00002000;
1640pub const HUPCL = 0x00004000;
1641pub const CLOCAL = 0x00008000;
1642pub const CCTS_OFLOW = 0x00010000;
1643pub const CRTSCTS = (CCTS_OFLOW | CRTS_IFLOW);
1644pub const CRTS_IFLOW = 0x00020000;
1645pub const CDTR_IFLOW = 0x00040000;
1646pub const CDSR_OFLOW = 0x00080000;
1647pub const CCAR_OFLOW = 0x00100000;
1648pub const MDMBUF = 0x00100000;
1649
1650pub const ECHOKE = 0x00000001;
1651pub const ECHOE = 0x00000002;
1652pub const ECHOK = 0x00000004;
1653pub const ECHO = 0x00000008;
1654pub const ECHONL = 0x00000010;
1655pub const ECHOPRT = 0x00000020;
1656pub const ECHOCTL = 0x00000040;
1657pub const ISIG = 0x00000080;
1658pub const ICANON = 0x00000100;
1659pub const ALTWERASE = 0x00000200;
1660pub const IEXTEN = 0x00000400;
1661pub const EXTPROC = 0x00000800;
1662pub const TOSTOP = 0x00400000;
1663pub const FLUSHO = 0x00800000;
1664pub const NOKERNINFO = 0x02000000;
1665pub const PENDIN = 0x20000000;
1666pub const NOFLSH = 0x80000000;
1667
1668pub const TCSANOW = 0;
1669pub const TCSADRAIN = 1;
1670pub const TCSAFLUSH = 2;
1671pub const TCSASOFT = 0x10;
1672pub const TCSA = extern enum(c_uint) {
1673 NOW,
1674 DRAIN,
1675 FLUSH,
1676 _,
1677};
1678
1679pub const B0 = 0;
1680pub const B50 = 50;
1681pub const B75 = 75;
1682pub const B110 = 110;
1683pub const B134 = 134;
1684pub const B150 = 150;
1685pub const B200 = 200;
1686pub const B300 = 300;
1687pub const B600 = 600;
1688pub const B1200 = 1200;
1689pub const B1800 = 1800;
1690pub const B2400 = 2400;
1691pub const B4800 = 4800;
1692pub const B9600 = 9600;
1693pub const B19200 = 19200;
1694pub const B38400 = 38400;
1695pub const B7200 = 7200;
1696pub const B14400 = 14400;
1697pub const B28800 = 28800;
1698pub const B57600 = 57600;
1699pub const B76800 = 76800;
1700pub const B115200 = 115200;
1701pub const B230400 = 230400;
1702pub const EXTA = 19200;
1703pub const EXTB = 38400;
1704
1705pub const TCIFLUSH = 1;
1706pub const TCOFLUSH = 2;
1707pub const TCIOFLUSH = 3;
1708pub const TCOOFF = 1;
1709pub const TCOON = 2;
1710pub const TCIOFF = 3;
1711pub const TCION = 4;
1712
1713pub const cc_t = u8;
1714pub const speed_t = u64;
1715pub const tcflag_t = u64;
1716
1717pub const termios = extern struct {
1718 iflag: tcflag_t,
1719 oflag: tcflag_t,
1720 cflag: tcflag_t,
1721 lflag: tcflag_t,
1722 cc: [NCCS]cc_t,
1723 ispeed: speed_t align(8),
1724 ospeed: speed_t,
1725};
1726
1727pub const winsize = extern struct {
1728 ws_row: u16,
1729 ws_col: u16,
1730 ws_xpixel: u16,
1731 ws_ypixel: u16,
1732};
1733
1734pub const TIOCGWINSZ = comptime ior(0x40000000, 't', 104, @sizeOf(winsize));
1735pub const IOCPARM_MASK = 0x1fff;
1736
1737fn ior(comptime inout: u32, comptime group: usize, comptime num: usize, comptime len: usize) usize {
1738 return (inout | ((len & IOCPARM_MASK) << 16) | ((group) << 8) | (num));
1739}