| author | |
| committer | |
| log | 20abc0caeeb8a9cc1cc1fe8c8ae318ec2906cc24 |
| tree | 6bfbd64047a372b333416bc0d9e56253cf351290 |
| parent | 47643cc5cc4db4c0fb2aaa7f37cedb049fce7def |
This creates `tc_oflag_t` even though such a type is not defined by
libc.
I also collected the missing flag bits from all the operating systems.6 files changed, 136 insertions(+), 74 deletions(-)
lib/std/c.zig+96-5| ... | ... | @@ -794,7 +794,7 @@ pub const termios = switch (native_os) { |
| 794 | 794 | .linux => std.os.linux.termios, |
| 795 | 795 | .macos, .ios, .tvos, .watchos => extern struct { |
| 796 | 796 | iflag: tc_iflag_t, |
| 797 | oflag: tcflag_t, | |
| 797 | oflag: tc_oflag_t, | |
| 798 | 798 | cflag: tcflag_t, |
| 799 | 799 | lflag: tcflag_t, |
| 800 | 800 | cc: [NCCS]cc_t, |
| ... | ... | @@ -803,7 +803,7 @@ pub const termios = switch (native_os) { |
| 803 | 803 | }, |
| 804 | 804 | .freebsd, .kfreebsd, .netbsd, .dragonfly, .openbsd => extern struct { |
| 805 | 805 | iflag: tc_iflag_t, |
| 806 | oflag: tcflag_t, | |
| 806 | oflag: tc_oflag_t, | |
| 807 | 807 | cflag: tcflag_t, |
| 808 | 808 | lflag: tcflag_t, |
| 809 | 809 | cc: [NCCS]cc_t, |
| ... | ... | @@ -812,7 +812,7 @@ pub const termios = switch (native_os) { |
| 812 | 812 | }, |
| 813 | 813 | .haiku => extern struct { |
| 814 | 814 | iflag: tc_iflag_t, |
| 815 | oflag: tcflag_t, | |
| 815 | oflag: tc_oflag_t, | |
| 816 | 816 | cflag: tcflag_t, |
| 817 | 817 | lflag: tcflag_t, |
| 818 | 818 | line: cc_t, |
| ... | ... | @@ -822,14 +822,14 @@ pub const termios = switch (native_os) { |
| 822 | 822 | }, |
| 823 | 823 | .solaris, .illumos => extern struct { |
| 824 | 824 | iflag: tc_iflag_t, |
| 825 | oflag: tcflag_t, | |
| 825 | oflag: tc_oflag_t, | |
| 826 | 826 | cflag: tcflag_t, |
| 827 | 827 | lflag: tcflag_t, |
| 828 | 828 | cc: [NCCS]cc_t, |
| 829 | 829 | }, |
| 830 | 830 | .emscripten, .wasi => extern struct { |
| 831 | 831 | iflag: tc_iflag_t, |
| 832 | oflag: tcflag_t, | |
| 832 | oflag: tc_oflag_t, | |
| 833 | 833 | cflag: tcflag_t, |
| 834 | 834 | lflag: tcflag_t, |
| 835 | 835 | line: std.c.cc_t, |
| ... | ... | @@ -950,6 +950,97 @@ pub const tc_iflag_t = switch (native_os) { |
| 950 | 950 | else => @compileError("target libc does not have tc_iflag_t"), |
| 951 | 951 | }; |
| 952 | 952 | |
| 953 | pub const tc_oflag_t = switch (native_os) { | |
| 954 | .linux => std.os.linux.tc_oflag_t, | |
| 955 | .macos, .ios, .tvos, .watchos => packed struct(u32) { | |
| 956 | OPOST: bool = false, | |
| 957 | ONLCR: bool = false, | |
| 958 | OXTABS: bool = false, | |
| 959 | ONOEOT: bool = false, | |
| 960 | OCRNL: bool = false, | |
| 961 | ONOCR: bool = false, | |
| 962 | ONLRET: bool = false, | |
| 963 | OFILL: bool = false, | |
| 964 | NLDLY: u2 = 0, | |
| 965 | TABDLY: u2 = 0, | |
| 966 | CRDLY: u2 = 0, | |
| 967 | FFDLY: u1 = 0, | |
| 968 | BSDLY: u1 = 0, | |
| 969 | VTDLY: u1 = 0, | |
| 970 | OFDEL: bool = false, | |
| 971 | _: u14 = 0, | |
| 972 | }, | |
| 973 | .netbsd => packed struct(u32) { | |
| 974 | OPOST: bool = false, | |
| 975 | ONLCR: bool = false, | |
| 976 | OXTABS: bool = false, | |
| 977 | ONOEOT: bool = false, | |
| 978 | OCRNL: bool = false, | |
| 979 | _5: u1 = 0, | |
| 980 | ONOCR: bool = false, | |
| 981 | ONLRET: bool = false, | |
| 982 | _: u24 = 0, | |
| 983 | }, | |
| 984 | .openbsd => packed struct(u32) { | |
| 985 | OPOST: bool = false, | |
| 986 | ONLCR: bool = false, | |
| 987 | OXTABS: bool = false, | |
| 988 | ONOEOT: bool = false, | |
| 989 | OCRNL: bool = false, | |
| 990 | OLCUC: bool = false, | |
| 991 | ONOCR: bool = false, | |
| 992 | ONLRET: bool = false, | |
| 993 | _: u24 = 0, | |
| 994 | }, | |
| 995 | .freebsd, .kfreebsd, .dragonfly => packed struct(u32) { | |
| 996 | OPOST: bool = false, | |
| 997 | ONLCR: bool = false, | |
| 998 | _2: u1 = 0, | |
| 999 | ONOEOT: bool = false, | |
| 1000 | OCRNL: bool = false, | |
| 1001 | ONOCR: bool = false, | |
| 1002 | ONLRET: bool = false, | |
| 1003 | _: u25 = 0, | |
| 1004 | }, | |
| 1005 | .solaris, .illumos => packed struct(u32) { | |
| 1006 | OPOST: bool = false, | |
| 1007 | OLCUC: bool = false, | |
| 1008 | ONLCR: bool = false, | |
| 1009 | OCRNL: bool = false, | |
| 1010 | ONOCR: bool = false, | |
| 1011 | ONLRET: bool = false, | |
| 1012 | OFILL: bool = false, | |
| 1013 | OFDEL: bool = false, | |
| 1014 | NLDLY: u1 = 0, | |
| 1015 | CRDLY: u2 = 0, | |
| 1016 | TABDLY: u2 = 0, | |
| 1017 | BSDLY: u1 = 0, | |
| 1018 | VTDLY: u1 = 0, | |
| 1019 | FFDLY: u1 = 0, | |
| 1020 | PAGEOUT: bool = false, | |
| 1021 | WRAP: bool = false, | |
| 1022 | _: u14 = 0, | |
| 1023 | }, | |
| 1024 | .haiku, .wasi, .emscripten => packed struct(u32) { | |
| 1025 | OPOST: bool = false, | |
| 1026 | OLCUC: bool = false, | |
| 1027 | ONLCR: bool = false, | |
| 1028 | OCRNL: bool = false, | |
| 1029 | ONOCR: bool = false, | |
| 1030 | ONLRET: bool = false, | |
| 1031 | OFILL: bool = false, | |
| 1032 | OFDEL: bool = false, | |
| 1033 | NLDLY: u1 = 0, | |
| 1034 | CRDLY: u2 = 0, | |
| 1035 | TABDLY: u2 = 0, | |
| 1036 | BSDLY: u1 = 0, | |
| 1037 | VTDLY: u1 = 0, | |
| 1038 | FFDLY: u1 = 0, | |
| 1039 | _: u16 = 0, | |
| 1040 | }, | |
| 1041 | else => @compileError("target libc does not have tc_oflag_t"), | |
| 1042 | }; | |
| 1043 | ||
| 953 | 1044 | pub const tcflag_t = switch (native_os) { |
| 954 | 1045 | .linux => std.os.linux.tcflag_t, |
| 955 | 1046 | .macos, .ios, .tvos, .watchos => u64, |
lib/std/c/darwin.zig-36| ... | ... | @@ -2692,42 +2692,6 @@ pub const SHUT = struct { |
| 2692 | 2692 | pub const RDWR = 2; |
| 2693 | 2693 | }; |
| 2694 | 2694 | |
| 2695 | pub const OPOST: tcflag_t = 0x00000001; //enable following output processing | |
| 2696 | pub const ONLCR: tcflag_t = 0x00000002; // map NL to CR-NL (ala CRMOD) | |
| 2697 | pub const OXTABS: tcflag_t = 0x00000004; // expand tabs to spaces | |
| 2698 | pub const ONOEOT: tcflag_t = 0x00000008; // discard EOT's (^D) on output) | |
| 2699 | ||
| 2700 | pub const OCRNL: tcflag_t = 0x00000010; // map CR to NL on output | |
| 2701 | pub const ONOCR: tcflag_t = 0x00000020; // no CR output at column 0 | |
| 2702 | pub const ONLRET: tcflag_t = 0x00000040; // NL performs CR function | |
| 2703 | pub const OFILL: tcflag_t = 0x00000080; // use fill characters for delay | |
| 2704 | pub const NLDLY: tcflag_t = 0x00000300; // \n delay | |
| 2705 | pub const TABDLY: tcflag_t = 0x00000c04; // horizontal tab delay | |
| 2706 | pub const CRDLY: tcflag_t = 0x00003000; // \r delay | |
| 2707 | pub const FFDLY: tcflag_t = 0x00004000; // form feed delay | |
| 2708 | pub const BSDLY: tcflag_t = 0x00008000; // \b delay | |
| 2709 | pub const VTDLY: tcflag_t = 0x00010000; // vertical tab delay | |
| 2710 | pub const OFDEL: tcflag_t = 0x00020000; // fill is DEL, else NUL | |
| 2711 | ||
| 2712 | pub const NL0: tcflag_t = 0x00000000; | |
| 2713 | pub const NL1: tcflag_t = 0x00000100; | |
| 2714 | pub const NL2: tcflag_t = 0x00000200; | |
| 2715 | pub const NL3: tcflag_t = 0x00000300; | |
| 2716 | pub const TAB0: tcflag_t = 0x00000000; | |
| 2717 | pub const TAB1: tcflag_t = 0x00000400; | |
| 2718 | pub const TAB2: tcflag_t = 0x00000800; | |
| 2719 | pub const TAB3: tcflag_t = 0x00000004; | |
| 2720 | pub const CR0: tcflag_t = 0x00000000; | |
| 2721 | pub const CR1: tcflag_t = 0x00001000; | |
| 2722 | pub const CR2: tcflag_t = 0x00002000; | |
| 2723 | pub const CR3: tcflag_t = 0x00003000; | |
| 2724 | pub const FF0: tcflag_t = 0x00000000; | |
| 2725 | pub const FF1: tcflag_t = 0x00004000; | |
| 2726 | pub const BS0: tcflag_t = 0x00000000; | |
| 2727 | pub const BS1: tcflag_t = 0x00008000; | |
| 2728 | pub const VT0: tcflag_t = 0x00000000; | |
| 2729 | pub const VT1: tcflag_t = 0x00010000; | |
| 2730 | ||
| 2731 | 2695 | pub const CIGNORE: tcflag_t = 0x00000001; // ignore control flags |
| 2732 | 2696 | pub const CSIZE: tcflag_t = 0x00000300; // character size mask |
| 2733 | 2697 | pub const CS5: tcflag_t = 0x00000000; // 5 bits (pseudo) |
lib/std/c/netbsd.zig-9| ... | ... | @@ -807,15 +807,6 @@ pub const T = struct { |
| 807 | 807 | }; |
| 808 | 808 | |
| 809 | 809 | |
| 810 | // Output flags - software output processing | |
| 811 | pub const OPOST: tcflag_t = 0x00000001; // enable following output processing | |
| 812 | pub const ONLCR: tcflag_t = 0x00000002; // map NL to CR-NL (ala CRMOD) | |
| 813 | pub const OXTABS: tcflag_t = 0x00000004; // expand tabs to spaces | |
| 814 | pub const ONOEOT: tcflag_t = 0x00000008; // discard EOT's (^D) on output | |
| 815 | pub const OCRNL: tcflag_t = 0x00000010; // map CR to NL | |
| 816 | pub const ONOCR: tcflag_t = 0x00000040; // discard CR's when on column 0 | |
| 817 | pub const ONLRET: tcflag_t = 0x00000080; // move to column 0 on CR | |
| 818 | ||
| 819 | 810 | // Control flags - hardware control of terminal |
| 820 | 811 | pub const CIGNORE: tcflag_t = 0x00000001; // ignore control flags |
| 821 | 812 | pub const CSIZE: tcflag_t = 0x00000300; // character size mask |
lib/std/c/openbsd.zig-9| ... | ... | @@ -769,15 +769,6 @@ pub const AUTH = struct { |
| 769 | 769 | }; |
| 770 | 770 | |
| 771 | 771 | |
| 772 | // Output flags - software output processing | |
| 773 | pub const OPOST: tcflag_t = 0x00000001; // enable following output processing | |
| 774 | pub const ONLCR: tcflag_t = 0x00000002; // map NL to CR-NL (ala CRMOD) | |
| 775 | pub const OXTABS: tcflag_t = 0x00000004; // expand tabs to spaces | |
| 776 | pub const ONOEOT: tcflag_t = 0x00000008; // discard EOT's (^D) on output | |
| 777 | pub const OCRNL: tcflag_t = 0x00000010; // map CR to NL | |
| 778 | pub const OLCUC: tcflag_t = 0x00000020; // translate lower case to upper case | |
| 779 | pub const ONOCR: tcflag_t = 0x00000040; // No CR output at column 0 | |
| 780 | pub const ONLRET: tcflag_t = 0x00000080; // NL performs the CR function | |
| 781 | 772 | |
| 782 | 773 | // Control flags - hardware control of terminal |
| 783 | 774 | pub const CIGNORE: tcflag_t = 0x00000001; // ignore control flags |
lib/std/os.zig+1| ... | ... | @@ -188,6 +188,7 @@ pub const NCCS = system.NCCS; |
| 188 | 188 | pub const speed_t = system.speed_t; |
| 189 | 189 | pub const tcflag_t = system.tcflag_t; |
| 190 | 190 | pub const tc_iflag_t = system.tc_iflag_t; |
| 191 | pub const tc_oflag_t = system.tc_oflag_t; | |
| 191 | 192 | |
| 192 | 193 | pub const F_OK = system.F_OK; |
| 193 | 194 | pub const R_OK = system.R_OK; |
lib/std/os/linux.zig+39-15| ... | ... | @@ -5083,6 +5083,43 @@ pub const tc_iflag_t = switch (native_arch) { |
| 5083 | 5083 | }, |
| 5084 | 5084 | }; |
| 5085 | 5085 | |
| 5086 | pub const tc_oflag_t = switch (native_arch) { | |
| 5087 | .powerpc, .powerpcle, .powerpc64, .powerpc64le => packed struct(u32) { | |
| 5088 | OPOST: bool = false, | |
| 5089 | ONLCR: bool = false, | |
| 5090 | OLCUC: bool = false, | |
| 5091 | OCRNL: bool = false, | |
| 5092 | ONOCR: bool = false, | |
| 5093 | ONLRET: bool = false, | |
| 5094 | OFILL: bool = false, | |
| 5095 | OFDEL: bool = false, | |
| 5096 | NLDLY: u2 = 0, | |
| 5097 | TABDLY: u2 = 0, | |
| 5098 | CRDLY: u2 = 0, | |
| 5099 | FFDLY: u1 = 0, | |
| 5100 | BSDLY: u1 = 0, | |
| 5101 | VTDLY: u1 = 0, | |
| 5102 | _: u15 = 0, | |
| 5103 | }, | |
| 5104 | else => packed struct(u32) { | |
| 5105 | OPOST: bool = false, | |
| 5106 | OLCUC: bool = false, | |
| 5107 | ONLCR: bool = false, | |
| 5108 | OCRNL: bool = false, | |
| 5109 | ONOCR: bool = false, | |
| 5110 | ONLRET: bool = false, | |
| 5111 | OFILL: bool = false, | |
| 5112 | OFDEL: bool = false, | |
| 5113 | NLDLY: u1 = 0, | |
| 5114 | CRDLY: u2 = 0, | |
| 5115 | TABDLY: u2 = 0, | |
| 5116 | BSDLY: u1 = 0, | |
| 5117 | VTDLY: u1 = 0, | |
| 5118 | FFDLY: u1 = 0, | |
| 5119 | _: u16 = 0, | |
| 5120 | }, | |
| 5121 | }; | |
| 5122 | ||
| 5086 | 5123 | pub const cc_t = switch (native_arch) { |
| 5087 | 5124 | .mips, .mipsel, .mips64, .mips64el => enum(u8) { |
| 5088 | 5125 | VINTR = 0, |
| ... | ... | @@ -5145,19 +5182,6 @@ pub const cc_t = switch (native_arch) { |
| 5145 | 5182 | |
| 5146 | 5183 | pub const tcflag_t = u32; |
| 5147 | 5184 | |
| 5148 | pub const OPOST: tcflag_t = 1; | |
| 5149 | pub const OLCUC: tcflag_t = 2; | |
| 5150 | pub const ONLCR: tcflag_t = 4; | |
| 5151 | pub const OCRNL: tcflag_t = 8; | |
| 5152 | pub const ONOCR: tcflag_t = 16; | |
| 5153 | pub const ONLRET: tcflag_t = 32; | |
| 5154 | pub const OFILL: tcflag_t = 64; | |
| 5155 | pub const OFDEL: tcflag_t = 128; | |
| 5156 | ||
| 5157 | pub const VTDLY: tcflag_t = 16384; | |
| 5158 | pub const VT0: tcflag_t = 0; | |
| 5159 | pub const VT1: tcflag_t = 16384; | |
| 5160 | ||
| 5161 | 5185 | pub const CSIZE: tcflag_t = 48; |
| 5162 | 5186 | pub const CS5: tcflag_t = 0; |
| 5163 | 5187 | pub const CS6: tcflag_t = 16; |
| ... | ... | @@ -5190,7 +5214,7 @@ pub const TCSA = enum(c_uint) { |
| 5190 | 5214 | pub const termios = switch (native_arch) { |
| 5191 | 5215 | .powerpc, .powerpcle, .powerpc64, .powerpc64le => extern struct { |
| 5192 | 5216 | iflag: tc_iflag_t, |
| 5193 | oflag: tcflag_t, | |
| 5217 | oflag: tc_oflag_t, | |
| 5194 | 5218 | cflag: tcflag_t, |
| 5195 | 5219 | lflag: tcflag_t, |
| 5196 | 5220 | cc: [NCCS]cc_t, |
| ... | ... | @@ -5200,7 +5224,7 @@ pub const termios = switch (native_arch) { |
| 5200 | 5224 | }, |
| 5201 | 5225 | else => extern struct { |
| 5202 | 5226 | iflag: tc_iflag_t, |
| 5203 | oflag: tcflag_t, | |
| 5227 | oflag: tc_oflag_t, | |
| 5204 | 5228 | cflag: tcflag_t, |
| 5205 | 5229 | lflag: tcflag_t, |
| 5206 | 5230 | line: cc_t, |