devela/sys/os/linux/io/term/
flags.rs1#[cfg(doc)]
4use crate::LinuxTermios;
5use crate::{
6 LINUX_TERMIOS_CFLAG as C, LINUX_TERMIOS_IFLAG as I, LINUX_TERMIOS_LFLAG as L,
7 LINUX_TERMIOS_OFLAG as O,
8};
9use crate::{c_uint, set};
10
11set! {
12 #[doc = crate::_tags!(linux term set)]
13 #[doc = crate::_doc_meta!{
15 location("sys/os/term/session"),
16 test_size_of(LinuxTermiosInputFlags = 2|16),
17 }]
18 pub struct LinuxTermiosInputFlags(u16) {
20 IGNBRK = 0;
22 BRKINT = 1;
24 IGNPAR = 2;
26 PARMRK = 3;
28 INPCK = 4;
30 ISTRIP = 5;
32 INLCR = 6;
34 IGNCR = 7;
36 ICRNL = 8;
38 IUCLC = 9;
40 IXON = 10;
42 IXANY = 11;
44 IXOFF = 12;
46 IMAXBEL = 13;
48 IUTF8 = 14;
50 }
51 impl {
52 #[must_use]
54 pub const fn from_c_uint(bits: c_uint) -> Self {
55 Self::from_bits(bits as u16)
56 }
57 #[must_use]
59 pub const fn as_c_uint(self) -> c_uint {
60 self.bits() as c_uint
61 }
62 const _ASSERT_RAW_VALUES: () = {
63 assert!(Self::IGNBRK.as_c_uint() == I::IGNBRK);
64 assert!(Self::BRKINT.as_c_uint() == I::BRKINT);
65 assert!(Self::IGNPAR.as_c_uint() == I::IGNPAR);
66 assert!(Self::PARMRK.as_c_uint() == I::PARMRK);
67 assert!(Self::INPCK.as_c_uint() == I::INPCK);
68 assert!(Self::ISTRIP.as_c_uint() == I::ISTRIP);
69 assert!(Self::INLCR.as_c_uint() == I::INLCR);
70 assert!(Self::IGNCR.as_c_uint() == I::IGNCR);
71 assert!(Self::ICRNL.as_c_uint() == I::ICRNL);
72 assert!(Self::IUCLC.as_c_uint() == I::IUCLC);
73 assert!(Self::IXON.as_c_uint() == I::IXON);
74 assert!(Self::IXANY.as_c_uint() == I::IXANY);
75 assert!(Self::IXOFF.as_c_uint() == I::IXOFF);
76 assert!(Self::IMAXBEL.as_c_uint() == I::IMAXBEL);
77 assert!(Self::IUTF8.as_c_uint() == I::IUTF8);
78 };
79 }
80}
81set! {
82 #[doc = crate::_tags!(linux term set)]
83 #[doc = crate::_doc_meta!{
85 location("sys/os/term/session"),
86 test_size_of(LinuxTermiosOutputFlags = 4|32),
87 }]
88 pub struct LinuxTermiosOutputFlags(u32) {
93 OPOST = 0;
95 OLCUC = 1;
97 ONLCR = 2;
99 OCRNL = 3;
101 ONOCR = 4;
103 ONLRET = 5;
105 OFILL = 6;
107 OFDEL = 7;
109
110 NLDLY = 8;
112 NL1 = 8;
114
115 CRDLY = 9..=10;
117 CR1 = 9;
119 CR2 = 10;
121 CR3 = 9..=10;
123
124 TABDLY = 11..=12;
126 TAB1 = 11;
128 TAB2 = 12;
130 TAB3 = 11..=12;
132
133 BSDLY = 13;
135 BS1 = 13;
137
138 VTDLY = 14;
140 VT1 = 14;
142
143 FFDLY = 15;
145 FF1 = 15;
147
148 XTABS = 11..=12;
150 }
151 impl {
152 pub const NL0: Self = Self::new();
154 pub const CR0: Self = Self::new();
156 pub const TAB0: Self = Self::new();
158 pub const BS0: Self = Self::new();
160 pub const VT0: Self = Self::new();
162 pub const FF0: Self = Self::new();
164
165 #[must_use]
167 pub const fn from_c_uint(bits: c_uint) -> Self {
168 Self::from_bits(bits)
169 }
170 #[must_use]
172 pub const fn as_c_uint(self) -> c_uint {
173 self.bits()
174 }
175 const _ASSERT_RAW_VALUES: () = {
176 assert!(Self::OPOST.as_c_uint() == O::OPOST);
177 assert!(Self::OLCUC.as_c_uint() == O::OLCUC);
178 assert!(Self::ONLCR.as_c_uint() == O::ONLCR);
179 assert!(Self::OCRNL.as_c_uint() == O::OCRNL);
180 assert!(Self::ONOCR.as_c_uint() == O::ONOCR);
181 assert!(Self::ONLRET.as_c_uint() == O::ONLRET);
182 assert!(Self::OFILL.as_c_uint() == O::OFILL);
183 assert!(Self::OFDEL.as_c_uint() == O::OFDEL);
184
185 assert!(Self::NLDLY.as_c_uint() == O::NLDLY);
186 assert!(Self::NL0.as_c_uint() == O::NL0);
187 assert!(Self::NL1.as_c_uint() == O::NL1);
188
189 assert!(Self::CRDLY.as_c_uint() == O::CRDLY);
190 assert!(Self::CR0.as_c_uint() == O::CR0);
191 assert!(Self::CR1.as_c_uint() == O::CR1);
192 assert!(Self::CR2.as_c_uint() == O::CR2);
193 assert!(Self::CR3.as_c_uint() == O::CR3);
194
195 assert!(Self::TABDLY.as_c_uint() == O::TABDLY);
196 assert!(Self::TAB0.as_c_uint() == O::TAB0);
197 assert!(Self::TAB1.as_c_uint() == O::TAB1);
198 assert!(Self::TAB2.as_c_uint() == O::TAB2);
199 assert!(Self::TAB3.as_c_uint() == O::TAB3);
200 assert!(Self::XTABS.as_c_uint() == O::XTABS);
201
202 assert!(Self::BSDLY.as_c_uint() == O::BSDLY);
203 assert!(Self::BS0.as_c_uint() == O::BS0);
204 assert!(Self::BS1.as_c_uint() == O::BS1);
205
206 assert!(Self::VTDLY.as_c_uint() == O::VTDLY);
207 assert!(Self::VT0.as_c_uint() == O::VT0);
208 assert!(Self::VT1.as_c_uint() == O::VT1);
209
210 assert!(Self::FFDLY.as_c_uint() == O::FFDLY);
211 assert!(Self::FF0.as_c_uint() == O::FF0);
212 assert!(Self::FF1.as_c_uint() == O::FF1);
213 };
214 }
215}
216set! {
217 #[doc = crate::_tags!(linux term set)]
218 #[doc = crate::_doc_meta!{
220 location("sys/os/linux/io/term"),
221 test_size_of(LinuxTermiosControlFlags = 2|16),
222 }]
223 pub struct LinuxTermiosControlFlags(u16) {
226 CSIZE = 4..=5;
228 CS6 = 4;
230 CS7 = 5;
232 CS8 = 4..=5;
234
235 CSTOPB = 6;
237 CREAD = 7;
239 PARENB = 8;
241 PARODD = 9;
243 HUPCL = 10;
245 CLOCAL = 11;
247 }
248 impl {
249 pub const CS5: Self = Self::new();
251
252 #[must_use]
254 pub const fn from_c_uint(bits: c_uint) -> Self {
255 Self::from_bits(bits as u16)
256 }
257 #[must_use]
259 pub const fn as_c_uint(self) -> c_uint {
260 self.bits() as c_uint
261 }
262 const _ASSERT_RAW_VALUES: () = {
263 assert!(Self::CSIZE.as_c_uint() == C::CSIZE);
264 assert!(Self::CS5.as_c_uint() == C::CS5);
265 assert!(Self::CS6.as_c_uint() == C::CS6);
266 assert!(Self::CS7.as_c_uint() == C::CS7);
267 assert!(Self::CS8.as_c_uint() == C::CS8);
268 assert!(Self::CSTOPB.as_c_uint() == C::CSTOPB);
269 assert!(Self::CREAD.as_c_uint() == C::CREAD);
270 assert!(Self::PARENB.as_c_uint() == C::PARENB);
271 assert!(Self::PARODD.as_c_uint() == C::PARODD);
272 assert!(Self::HUPCL.as_c_uint() == C::HUPCL);
273 assert!(Self::CLOCAL.as_c_uint() == C::CLOCAL);
274 };
275 }
276}
277set! {
278 #[doc = crate::_tags!(linux term set)]
279 #[doc = crate::_doc_meta!{
281 location("sys/os/linux/io/term"),
282 test_size_of(LinuxTermiosLocalFlags = 4|32),
283 }]
284 pub struct LinuxTermiosLocalFlags(u32) {
285 ISIG = 0;
287 ICANON = 1;
289 XCASE = 2;
291 ECHO = 3;
293 ECHOE = 4;
295 ECHOK = 5;
297 ECHONL = 6;
299 NOFLSH = 7;
301 TOSTOP = 8;
303 ECHOCTL = 9;
305 ECHOPRT = 10;
307 ECHOKE = 11;
309 FLUSHO = 12;
311 PENDING = 14;
313 IEXTEN = 15;
315 EXTPROC = 16;
317 }
318 impl {
319 #[must_use]
321 pub const fn from_c_uint(bits: c_uint) -> Self {
322 Self::from_bits(bits)
323 }
324 #[must_use]
326 pub const fn as_c_uint(self) -> c_uint {
327 self.bits()
328 }
329 const _ASSERT_RAW_VALUES: () = {
330 assert!(Self::ISIG.as_c_uint() == L::ISIG);
331 assert!(Self::ICANON.as_c_uint() == L::ICANON);
332 assert!(Self::XCASE.as_c_uint() == L::XCASE);
333 assert!(Self::ECHO.as_c_uint() == L::ECHO);
334 assert!(Self::ECHOE.as_c_uint() == L::ECHOE);
335 assert!(Self::ECHOK.as_c_uint() == L::ECHOK);
336 assert!(Self::ECHONL.as_c_uint() == L::ECHONL);
337 assert!(Self::NOFLSH.as_c_uint() == L::NOFLSH);
338 assert!(Self::TOSTOP.as_c_uint() == L::TOSTOP);
339 assert!(Self::ECHOCTL.as_c_uint() == L::ECHOCTL);
340 assert!(Self::ECHOPRT.as_c_uint() == L::ECHOPRT);
341 assert!(Self::ECHOKE.as_c_uint() == L::ECHOKE);
342 assert!(Self::FLUSHO.as_c_uint() == L::FLUSHO);
343 assert!(Self::PENDING.as_c_uint() == L::PENDING);
344 assert!(Self::IEXTEN.as_c_uint() == L::IEXTEN);
345 assert!(Self::EXTPROC.as_c_uint() == L::EXTPROC);
346 };
347 }
348}