Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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``.
61 changes: 61 additions & 0 deletions Modules/termios.c
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,9 @@ static struct constant {
#ifdef IMAXBEL
{"IMAXBEL", IMAXBEL},
#endif
#ifdef IUTF8
{"IUTF8", IUTF8},
#endif

/* struct termios.c_oflag constants */
{"OPOST", OPOST},
Expand All @@ -726,6 +729,12 @@ static struct constant {
#ifdef OFDEL
{"OFDEL", OFDEL},
#endif
#ifdef OXTABS
{"OXTABS", OXTABS},
#endif
#ifdef ONOEOT
{"ONOEOT", ONOEOT},
#endif
#ifdef NLDLY
{"NLDLY", NLDLY},
#endif
Expand All @@ -752,6 +761,12 @@ static struct constant {
#ifdef NL1
{"NL1", NL1},
#endif
#ifdef NL2
{"NL2", NL2},
#endif
#ifdef NL3
{"NL3", NL3},
#endif
#ifdef CR0
{"CR0", CR0},
#endif
Expand Down Expand Up @@ -799,6 +814,9 @@ static struct constant {
#endif

/* struct termios.c_cflag constants */
#ifdef CIGNORE
{"CIGNORE", CIGNORE},
#endif
{"CSIZE", CSIZE},
{"CSTOPB", CSTOPB},
{"CREAD", CREAD},
Expand All @@ -813,13 +831,32 @@ static struct constant {
{"CRTSCTS", (long)CRTSCTS},
#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) */
{"CS5", CS5},
{"CS6", CS6},
{"CS7", CS7},
{"CS8", CS8},

/* struct termios.c_lflag constants */
#ifdef ALTWERASE
{"ALTWERASE", ALTWERASE},
#endif
{"ISIG", ISIG},
{"ICANON", ICANON},
#ifdef XCASE
Expand All @@ -840,13 +877,19 @@ static struct constant {
#endif
#ifdef FLUSHO
{"FLUSHO", FLUSHO},
#endif
#ifdef NOKERNINFO
{"NOKERNINFO", NOKERNINFO},
#endif
{"NOFLSH", NOFLSH},
{"TOSTOP", TOSTOP},
#ifdef PENDIN
{"PENDIN", PENDIN},
#endif
{"IEXTEN", IEXTEN},
#ifdef EXTPROC
{"EXTPROC", EXTPROC},
#endif

/* indexes into the control chars array returned by tcgetattr() */
{"VINTR", VINTR},
Expand All @@ -855,6 +898,9 @@ static struct constant {
{"VKILL", VKILL},
{"VEOF", VEOF},
{"VTIME", VTIME},
#ifdef VSTATUS
{"VSTATUS", VSTATUS},
#endif
{"VMIN", VMIN},
#ifdef VSWTC
/* The #defines above ensure that if either is defined, both are,
Expand All @@ -865,6 +911,9 @@ static struct constant {
{"VSTART", VSTART},
{"VSTOP", VSTOP},
{"VSUSP", VSUSP},
#ifdef VDSUSP
{"VDSUSP", VREPRINT},
#endif
{"VEOL", VEOL},
#ifdef VREPRINT
{"VREPRINT", VREPRINT},
Expand All @@ -883,6 +932,18 @@ static struct constant {
#endif


#ifdef B7200
{"B7200", B7200},
#endif
#ifdef B14400
{"B14400", B14400},
#endif
#ifdef B28800
{"B28800", B28800},
#endif
#ifdef B76800
{"B76800", B76800},
#endif
#ifdef B460800
{"B460800", B460800},
#endif
Expand Down