Skip to content

Commit 3ec4a96

Browse files
ronaldoussorenserhiy-storchaka
authored andcommitted
pythongh-51944: Add missing macOS constants to termios (python#112823)
* pythongh-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 <[email protected]>
1 parent aa839eb commit 3ec4a96

File tree

2 files changed

+67
-0
lines changed

2 files changed

+67
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Add the following constants to the :mod:`termios` module. These values are
2+
present in macOS system headers: ``ALTWERASE``, ``B14400``, ``B28800``,
3+
``B7200``, ``B76800``, ``CCAR_OFLOW``, ``CCTS_OFLOW``, ``CDSR_OFLOW``,
4+
``CDTR_IFLOW``, ``CIGNORE``, ``CRTS_IFLOW``, ``EXTPROC``, ``IUTF8``,
5+
``MDMBUF``, ``NL2``, ``NL3``, ``NOKERNINFO``, ``ONOEOT``, ``OXTABS``,
6+
``VDSUSP``, ``VSTATUS``.

Modules/termios.c

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -702,6 +702,9 @@ static struct constant {
702702
#ifdef IMAXBEL
703703
{"IMAXBEL", IMAXBEL},
704704
#endif
705+
#ifdef IUTF8
706+
{"IUTF8", IUTF8},
707+
#endif
705708

706709
/* struct termios.c_oflag constants */
707710
{"OPOST", OPOST},
@@ -726,6 +729,12 @@ static struct constant {
726729
#ifdef OFDEL
727730
{"OFDEL", OFDEL},
728731
#endif
732+
#ifdef OXTABS
733+
{"OXTABS", OXTABS},
734+
#endif
735+
#ifdef ONOEOT
736+
{"ONOEOT", ONOEOT},
737+
#endif
729738
#ifdef NLDLY
730739
{"NLDLY", NLDLY},
731740
#endif
@@ -752,6 +761,12 @@ static struct constant {
752761
#ifdef NL1
753762
{"NL1", NL1},
754763
#endif
764+
#ifdef NL2
765+
{"NL2", NL2},
766+
#endif
767+
#ifdef NL3
768+
{"NL3", NL3},
769+
#endif
755770
#ifdef CR0
756771
{"CR0", CR0},
757772
#endif
@@ -799,6 +814,9 @@ static struct constant {
799814
#endif
800815

801816
/* struct termios.c_cflag constants */
817+
#ifdef CIGNORE
818+
{"CIGNORE", CIGNORE},
819+
#endif
802820
{"CSIZE", CSIZE},
803821
{"CSTOPB", CSTOPB},
804822
{"CREAD", CREAD},
@@ -813,13 +831,32 @@ static struct constant {
813831
{"CRTSCTS", (long)CRTSCTS},
814832
#endif
815833

834+
#ifdef CRTS_IFLOW
835+
{"CRTS_IFLOW", CRTS_IFLOW},
836+
#endif
837+
#ifdef CDTR_IFLOW
838+
{"CDTR_IFLOW", CDTR_IFLOW},
839+
#endif
840+
#ifdef CDSR_OFLOW
841+
{"CDSR_OFLOW", CDSR_OFLOW},
842+
#endif
843+
#ifdef CCAR_OFLOW
844+
{"CCAR_OFLOW", CCAR_OFLOW},
845+
#endif
846+
#ifdef MDMBUF
847+
{"MDMBUF", MDMBUF},
848+
#endif
849+
816850
/* struct termios.c_cflag-related values (character size) */
817851
{"CS5", CS5},
818852
{"CS6", CS6},
819853
{"CS7", CS7},
820854
{"CS8", CS8},
821855

822856
/* struct termios.c_lflag constants */
857+
#ifdef ALTWERASE
858+
{"ALTWERASE", ALTWERASE},
859+
#endif
823860
{"ISIG", ISIG},
824861
{"ICANON", ICANON},
825862
#ifdef XCASE
@@ -840,13 +877,19 @@ static struct constant {
840877
#endif
841878
#ifdef FLUSHO
842879
{"FLUSHO", FLUSHO},
880+
#endif
881+
#ifdef NOKERNINFO
882+
{"NOKERNINFO", NOKERNINFO},
843883
#endif
844884
{"NOFLSH", NOFLSH},
845885
{"TOSTOP", TOSTOP},
846886
#ifdef PENDIN
847887
{"PENDIN", PENDIN},
848888
#endif
849889
{"IEXTEN", IEXTEN},
890+
#ifdef EXTPROC
891+
{"EXTPROC", EXTPROC},
892+
#endif
850893

851894
/* indexes into the control chars array returned by tcgetattr() */
852895
{"VINTR", VINTR},
@@ -855,6 +898,9 @@ static struct constant {
855898
{"VKILL", VKILL},
856899
{"VEOF", VEOF},
857900
{"VTIME", VTIME},
901+
#ifdef VSTATUS
902+
{"VSTATUS", VSTATUS},
903+
#endif
858904
{"VMIN", VMIN},
859905
#ifdef VSWTC
860906
/* The #defines above ensure that if either is defined, both are,
@@ -865,6 +911,9 @@ static struct constant {
865911
{"VSTART", VSTART},
866912
{"VSTOP", VSTOP},
867913
{"VSUSP", VSUSP},
914+
#ifdef VDSUSP
915+
{"VDSUSP", VREPRINT},
916+
#endif
868917
{"VEOL", VEOL},
869918
#ifdef VREPRINT
870919
{"VREPRINT", VREPRINT},
@@ -883,6 +932,18 @@ static struct constant {
883932
#endif
884933

885934

935+
#ifdef B7200
936+
{"B7200", B7200},
937+
#endif
938+
#ifdef B14400
939+
{"B14400", B14400},
940+
#endif
941+
#ifdef B28800
942+
{"B28800", B28800},
943+
#endif
944+
#ifdef B76800
945+
{"B76800", B76800},
946+
#endif
886947
#ifdef B460800
887948
{"B460800", B460800},
888949
#endif

0 commit comments

Comments
 (0)