| ... | @@ -703,6 +703,133 @@ pub const T = struct { | ... | @@ -703,6 +703,133 @@ pub const T = struct { |
| 703 | pub const IOCXMTFRAME = 0x80087444; | 703 | pub const IOCXMTFRAME = 0x80087444; |
| 704 | }; | 704 | }; |
| 705 | | 705 | |
| | 706 | // Term |
| | 707 | const V = struct { |
| | 708 | pub const EOF = 0; // ICANON |
| | 709 | pub const EOL = 1; // ICANON |
| | 710 | pub const EOL2 = 2; // ICANON |
| | 711 | pub const ERASE = 3; // ICANON |
| | 712 | pub const WERASE = 4; // ICANON |
| | 713 | pub const KILL = 5; // ICANON |
| | 714 | pub const REPRINT = 6; // ICANON |
| | 715 | // 7 spare 1 |
| | 716 | pub const INTR = 8; // ISIG |
| | 717 | pub const QUIT = 9; // ISIG |
| | 718 | pub const SUSP = 10; // ISIG |
| | 719 | pub const DSUSP = 11; // ISIG |
| | 720 | pub const START = 12; // IXON, IXOFF |
| | 721 | pub const STOP = 13; // IXON, IXOFF |
| | 722 | pub const LNEXT = 14; // IEXTEN |
| | 723 | pub const DISCARD = 15; // IEXTEN |
| | 724 | pub const MIN = 16; // !ICANON |
| | 725 | pub const TIME = 17; // !ICANON |
| | 726 | pub const STATUS = 18; // ICANON |
| | 727 | // 19 spare 2 |
| | 728 | }; |
| | 729 | pub const NCCS = 20; |
| | 730 | |
| | 731 | // Input flags - software input processing |
| | 732 | pub const IGNBRK = 0x00000001; // ignore BREAK condition |
| | 733 | pub const BRKINT = 0x00000002; // map BREAK to SIGINT |
| | 734 | pub const IGNPAR = 0x00000004; // ignore (discard) parity errors |
| | 735 | pub const PARMRK = 0x00000008; // mark parity and framing errors |
| | 736 | pub const INPCK = 0x00000010; // enable checking of parity errors |
| | 737 | pub const ISTRIP = 0x00000020; // strip 8th bit off chars |
| | 738 | pub const INLCR = 0x00000040; // map NL into CR |
| | 739 | pub const IGNCR = 0x00000080; // ignore CR |
| | 740 | pub const ICRNL = 0x00000100; // map CR to NL (ala CRMOD) |
| | 741 | pub const IXON = 0x00000200; // enable output flow control |
| | 742 | pub const IXOFF = 0x00000400; // enable input flow control |
| | 743 | pub const IXANY = 0x00000800; // any char will restart after stop |
| | 744 | pub const IUCLC = 0x00001000; // translate upper to lower case |
| | 745 | pub const IMAXBEL = 0x00002000; // ring bell on input queue full |
| | 746 | |
| | 747 | // Output flags - software output processing |
| | 748 | pub const OPOST = 0x00000001; // enable following output processing |
| | 749 | pub const ONLCR = 0x00000002; // map NL to CR-NL (ala CRMOD) |
| | 750 | pub const OXTABS = 0x00000004; // expand tabs to spaces |
| | 751 | pub const ONOEOT = 0x00000008; // discard EOT's (^D) on output |
| | 752 | pub const OCRNL = 0x00000010; // map CR to NL |
| | 753 | pub const OLCUC = 0x00000020; // translate lower case to upper case |
| | 754 | pub const ONOCR = 0x00000040; // No CR output at column 0 |
| | 755 | pub const ONLRET = 0x00000080; // NL performs the CR function |
| | 756 | |
| | 757 | // Control flags - hardware control of terminal |
| | 758 | pub const CIGNORE = 0x00000001; // ignore control flags |
| | 759 | pub const CSIZE = 0x00000300; // character size mask |
| | 760 | pub const CS5 = 0x00000000; // 5 bits (pseudo) |
| | 761 | pub const CS6 = 0x00000100; // 6 bits |
| | 762 | pub const CS7 = 0x00000200; // 7 bits |
| | 763 | pub const CS8 = 0x00000300; // 8 bits |
| | 764 | pub const CSTOPB = 0x00000400; // send 2 stop bits |
| | 765 | pub const CREAD = 0x00000800; // enable receiver |
| | 766 | pub const PARENB = 0x00001000; // parity enable |
| | 767 | pub const PARODD = 0x00002000; // odd parity, else even |
| | 768 | pub const HUPCL = 0x00004000; // hang up on last close |
| | 769 | pub const CLOCAL = 0x00008000; // ignore modem status lines |
| | 770 | pub const CRTSCTS = 0x00010000; // RTS/CTS full-duplex flow control |
| | 771 | pub const CRTS_IFLOW = CRTSCTS; // XXX compat |
| | 772 | pub const CCTS_OFLOW = CRTSCTS; // XXX compat |
| | 773 | pub const MDMBUF = 0x00100000; // DTR/DCD hardware flow control |
| | 774 | pub const CHWFLOW = (MDMBUF | CRTSCTS); // all types of hw flow control |
| | 775 | |
| | 776 | pub const tcflag_t = c_uint; |
| | 777 | pub const speed_t = c_uint; |
| | 778 | pub const cc_t = u8; |
| | 779 | |
| | 780 | pub const termios = extern struct { |
| | 781 | iflag: tcflag_t, // input flags |
| | 782 | oflag: tcflag_t, // output flags |
| | 783 | cflag: tcflag_t, // control flags |
| | 784 | lflag: tcflag_t, // local flags |
| | 785 | cc: [NCCS]cc_t, // control chars |
| | 786 | ispeed: c_int, // input speed |
| | 787 | ospeed: c_int, // output speed |
| | 788 | }; |
| | 789 | |
| | 790 | // Commands passed to tcsetattr() for setting the termios structure. |
| | 791 | pub const TCSA = struct { |
| | 792 | pub const NOW = 0; // make change immediate |
| | 793 | pub const DRAIN = 1; // drain output, then change |
| | 794 | pub const FLUSH = 2; // drain output, flush input |
| | 795 | pub const SOFT = 0x10; // flag - don't alter h.w. state |
| | 796 | }; |
| | 797 | |
| | 798 | // Standard speeds |
| | 799 | pub const B0 = 0; |
| | 800 | pub const B50 = 50; |
| | 801 | pub const B75 = 75; |
| | 802 | pub const B110 = 110; |
| | 803 | pub const B134 = 134; |
| | 804 | pub const B150 = 150; |
| | 805 | pub const B200 = 200; |
| | 806 | pub const B300 = 300; |
| | 807 | pub const B600 = 600; |
| | 808 | pub const B1200 = 1200; |
| | 809 | pub const B1800 = 1800; |
| | 810 | pub const B2400 = 2400; |
| | 811 | pub const B4800 = 4800; |
| | 812 | pub const B9600 = 9600; |
| | 813 | pub const B19200 = 19200; |
| | 814 | pub const B38400 = 38400; |
| | 815 | pub const B7200 = 7200; |
| | 816 | pub const B14400 = 14400; |
| | 817 | pub const B28800 = 28800; |
| | 818 | pub const B57600 = 57600; |
| | 819 | pub const B76800 = 76800; |
| | 820 | pub const B115200 = 115200; |
| | 821 | pub const B230400 = 230400; |
| | 822 | pub const EXTA = 19200; |
| | 823 | pub const EXTB = 38400; |
| | 824 | |
| | 825 | pub const TCIFLUSH = 1; |
| | 826 | pub const TCOFLUSH = 2; |
| | 827 | pub const TCIOFLUSH = 3; |
| | 828 | pub const TCOOFF = 1; |
| | 829 | pub const TCOON = 2; |
| | 830 | pub const TCIOFF = 3; |
| | 831 | pub const TCION = 4; |
| | 832 | |
| 706 | pub const winsize = extern struct { | 833 | pub const winsize = extern struct { |
| 707 | ws_row: c_ushort, | 834 | ws_row: c_ushort, |
| 708 | ws_col: c_ushort, | 835 | ws_col: c_ushort, |