gh-51944: Add missing macOS constants to termios (#112823)

* gh-51944: Add some macOS constants to termios

This changeset adds all public constants in <termio.h>
and <sys/termios.h> on macOS that weren't present
already.

Based on the macOS 14.2 SDK

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
Ronald Oussoren 2023-12-07 11:27:30 +01:00 committed by GitHub
parent 4ba15de191
commit 4b125dd31a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 67 additions and 0 deletions

View File

@ -0,0 +1,6 @@
Add the following constants to the :mod:`termios` module. These values are
present in macOS system headers: ``ALTWERASE``, ``B14400``, ``B28800``,
``B7200``, ``B76800``, ``CCAR_OFLOW``, ``CCTS_OFLOW``, ``CDSR_OFLOW``,
``CDTR_IFLOW``, ``CIGNORE``, ``CRTS_IFLOW``, ``EXTPROC``, ``IUTF8``,
``MDMBUF``, ``NL2``, ``NL3``, ``NOKERNINFO``, ``ONOEOT``, ``OXTABS``,
``VDSUSP``, ``VSTATUS``.

View File

@ -702,6 +702,9 @@ static struct constant {
#ifdef IMAXBEL #ifdef IMAXBEL
{"IMAXBEL", IMAXBEL}, {"IMAXBEL", IMAXBEL},
#endif #endif
#ifdef IUTF8
{"IUTF8", IUTF8},
#endif
/* struct termios.c_oflag constants */ /* struct termios.c_oflag constants */
{"OPOST", OPOST}, {"OPOST", OPOST},
@ -726,6 +729,12 @@ static struct constant {
#ifdef OFDEL #ifdef OFDEL
{"OFDEL", OFDEL}, {"OFDEL", OFDEL},
#endif #endif
#ifdef OXTABS
{"OXTABS", OXTABS},
#endif
#ifdef ONOEOT
{"ONOEOT", ONOEOT},
#endif
#ifdef NLDLY #ifdef NLDLY
{"NLDLY", NLDLY}, {"NLDLY", NLDLY},
#endif #endif
@ -752,6 +761,12 @@ static struct constant {
#ifdef NL1 #ifdef NL1
{"NL1", NL1}, {"NL1", NL1},
#endif #endif
#ifdef NL2
{"NL2", NL2},
#endif
#ifdef NL3
{"NL3", NL3},
#endif
#ifdef CR0 #ifdef CR0
{"CR0", CR0}, {"CR0", CR0},
#endif #endif
@ -799,6 +814,9 @@ static struct constant {
#endif #endif
/* struct termios.c_cflag constants */ /* struct termios.c_cflag constants */
#ifdef CIGNORE
{"CIGNORE", CIGNORE},
#endif
{"CSIZE", CSIZE}, {"CSIZE", CSIZE},
{"CSTOPB", CSTOPB}, {"CSTOPB", CSTOPB},
{"CREAD", CREAD}, {"CREAD", CREAD},
@ -813,6 +831,22 @@ static struct constant {
{"CRTSCTS", (long)CRTSCTS}, {"CRTSCTS", (long)CRTSCTS},
#endif #endif
#ifdef CRTS_IFLOW
{"CRTS_IFLOW", CRTS_IFLOW},
#endif
#ifdef CDTR_IFLOW
{"CDTR_IFLOW", CDTR_IFLOW},
#endif
#ifdef CDSR_OFLOW
{"CDSR_OFLOW", CDSR_OFLOW},
#endif
#ifdef CCAR_OFLOW
{"CCAR_OFLOW", CCAR_OFLOW},
#endif
#ifdef MDMBUF
{"MDMBUF", MDMBUF},
#endif
/* struct termios.c_cflag-related values (character size) */ /* struct termios.c_cflag-related values (character size) */
{"CS5", CS5}, {"CS5", CS5},
{"CS6", CS6}, {"CS6", CS6},
@ -820,6 +854,9 @@ static struct constant {
{"CS8", CS8}, {"CS8", CS8},
/* struct termios.c_lflag constants */ /* struct termios.c_lflag constants */
#ifdef ALTWERASE
{"ALTWERASE", ALTWERASE},
#endif
{"ISIG", ISIG}, {"ISIG", ISIG},
{"ICANON", ICANON}, {"ICANON", ICANON},
#ifdef XCASE #ifdef XCASE
@ -840,6 +877,9 @@ static struct constant {
#endif #endif
#ifdef FLUSHO #ifdef FLUSHO
{"FLUSHO", FLUSHO}, {"FLUSHO", FLUSHO},
#endif
#ifdef NOKERNINFO
{"NOKERNINFO", NOKERNINFO},
#endif #endif
{"NOFLSH", NOFLSH}, {"NOFLSH", NOFLSH},
{"TOSTOP", TOSTOP}, {"TOSTOP", TOSTOP},
@ -847,6 +887,9 @@ static struct constant {
{"PENDIN", PENDIN}, {"PENDIN", PENDIN},
#endif #endif
{"IEXTEN", IEXTEN}, {"IEXTEN", IEXTEN},
#ifdef EXTPROC
{"EXTPROC", EXTPROC},
#endif
/* indexes into the control chars array returned by tcgetattr() */ /* indexes into the control chars array returned by tcgetattr() */
{"VINTR", VINTR}, {"VINTR", VINTR},
@ -855,6 +898,9 @@ static struct constant {
{"VKILL", VKILL}, {"VKILL", VKILL},
{"VEOF", VEOF}, {"VEOF", VEOF},
{"VTIME", VTIME}, {"VTIME", VTIME},
#ifdef VSTATUS
{"VSTATUS", VSTATUS},
#endif
{"VMIN", VMIN}, {"VMIN", VMIN},
#ifdef VSWTC #ifdef VSWTC
/* The #defines above ensure that if either is defined, both are, /* The #defines above ensure that if either is defined, both are,
@ -865,6 +911,9 @@ static struct constant {
{"VSTART", VSTART}, {"VSTART", VSTART},
{"VSTOP", VSTOP}, {"VSTOP", VSTOP},
{"VSUSP", VSUSP}, {"VSUSP", VSUSP},
#ifdef VDSUSP
{"VDSUSP", VREPRINT},
#endif
{"VEOL", VEOL}, {"VEOL", VEOL},
#ifdef VREPRINT #ifdef VREPRINT
{"VREPRINT", VREPRINT}, {"VREPRINT", VREPRINT},
@ -883,6 +932,18 @@ static struct constant {
#endif #endif
#ifdef B7200
{"B7200", B7200},
#endif
#ifdef B14400
{"B14400", B14400},
#endif
#ifdef B28800
{"B28800", B28800},
#endif
#ifdef B76800
{"B76800", B76800},
#endif
#ifdef B460800 #ifdef B460800
{"B460800", B460800}, {"B460800", B460800},
#endif #endif