Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
df48d14f
Commit
df48d14f
authored
Feb 27, 2001
by
Fred Drake
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Define the constants needed for working with these functions directly
in this module; no more need for TERMIOS.py.
parent
0f4e93d4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
158 additions
and
0 deletions
+158
-0
Modules/termios.c
Modules/termios.c
+158
-0
No files found.
Modules/termios.c
View file @
df48d14f
...
...
@@ -293,10 +293,163 @@ static PyMethodDef termios_methods[] =
{
NULL
,
NULL
}
};
static
struct
constant
{
char
*
name
;
long
value
;
}
termios_constants
[]
=
{
/* cfgetospeed(), cfsetospeed() constants */
{
"B0"
,
B0
},
{
"B50"
,
B50
},
{
"B75"
,
B75
},
{
"B110"
,
B110
},
{
"B134"
,
B134
},
{
"B150"
,
B150
},
{
"B200"
,
B200
},
{
"B300"
,
B300
},
{
"B600"
,
B600
},
{
"B1200"
,
B1200
},
{
"B1800"
,
B1800
},
{
"B2400"
,
B2400
},
{
"B4800"
,
B4800
},
{
"B9600"
,
B9600
},
{
"B19200"
,
B19200
},
{
"B38400"
,
B38400
},
{
"B57600"
,
B57600
},
{
"B115200"
,
B115200
},
{
"B230400"
,
B230400
},
{
"CBAUDEX"
,
CBAUDEX
},
/* tcsetattr() constants */
{
"TCSANOW"
,
TCSANOW
},
{
"TCSADRAIN"
,
TCSADRAIN
},
{
"TCSAFLUSH"
,
TCSAFLUSH
},
/* tcflush() constants */
{
"TCIFLUSH"
,
TCIFLUSH
},
{
"TCOFLUSH"
,
TCOFLUSH
},
{
"TCIOFLUSH"
,
TCIOFLUSH
},
/* tcflow() constants */
{
"TCOOFF"
,
TCOOFF
},
{
"TCOON"
,
TCOON
},
{
"TCIOFF"
,
TCIOFF
},
{
"TCION"
,
TCION
},
/* struct termios.c_iflag constants */
{
"IGNBRK"
,
IGNBRK
},
{
"BRKINT"
,
BRKINT
},
{
"IGNPAR"
,
IGNPAR
},
{
"PARMRK"
,
PARMRK
},
{
"INPCK"
,
INPCK
},
{
"ISTRIP"
,
ISTRIP
},
{
"INLCR"
,
INLCR
},
{
"IGNCR"
,
IGNCR
},
{
"ICRNL"
,
ICRNL
},
{
"IUCLC"
,
IUCLC
},
{
"IXON"
,
IXON
},
{
"IXANY"
,
IXANY
},
{
"IXOFF"
,
IXOFF
},
{
"IMAXBEL"
,
IMAXBEL
},
/* struct termios.c_oflag constants */
{
"OPOST"
,
OPOST
},
{
"OLCUC"
,
OLCUC
},
{
"ONLCR"
,
ONLCR
},
{
"OCRNL"
,
OCRNL
},
{
"ONOCR"
,
ONOCR
},
{
"ONLRET"
,
ONLRET
},
{
"OFILL"
,
OFILL
},
{
"OFDEL"
,
OFDEL
},
{
"NLDLY"
,
NLDLY
},
{
"CRDLY"
,
CRDLY
},
{
"TABDLY"
,
TABDLY
},
{
"BSDLY"
,
BSDLY
},
{
"VTDLY"
,
VTDLY
},
{
"FFDLY"
,
FFDLY
},
/* struct termios.c_oflag-related values (delay mask) */
{
"NL0"
,
NL0
},
{
"NL1"
,
NL1
},
{
"CR0"
,
CR0
},
{
"CR1"
,
CR1
},
{
"CR2"
,
CR2
},
{
"CR3"
,
CR3
},
{
"TAB0"
,
TAB0
},
{
"TAB1"
,
TAB1
},
{
"TAB2"
,
TAB2
},
{
"TAB3"
,
TAB3
},
{
"XTABS"
,
XTABS
},
{
"BS0"
,
BS0
},
{
"BS1"
,
BS1
},
{
"VT0"
,
VT0
},
{
"VT1"
,
VT1
},
{
"FF0"
,
FF0
},
{
"FF1"
,
FF1
},
/* struct termios.c_cflag constants */
{
"CSIZE"
,
CSIZE
},
{
"CSTOPB"
,
CSTOPB
},
{
"CREAD"
,
CREAD
},
{
"PARENB"
,
PARENB
},
{
"PARODD"
,
PARODD
},
{
"HUPCL"
,
HUPCL
},
{
"CLOCAL"
,
CLOCAL
},
{
"CIBAUD"
,
CIBAUD
},
{
"CRTSCTS"
,
CRTSCTS
},
/* struct termios.c_cflag-related values (character size) */
{
"CS5"
,
CS5
},
{
"CS6"
,
CS6
},
{
"CS7"
,
CS7
},
{
"CS8"
,
CS8
},
/* struct termios.c_lflag constants */
{
"ISIG"
,
ISIG
},
{
"ICANON"
,
ICANON
},
{
"XCASE"
,
XCASE
},
{
"ECHO"
,
ECHO
},
{
"ECHOE"
,
ECHOE
},
{
"ECHOK"
,
ECHOK
},
{
"ECHONL"
,
ECHONL
},
{
"ECHOCTL"
,
ECHOCTL
},
{
"ECHOPRT"
,
ECHOPRT
},
{
"ECHOKE"
,
ECHOKE
},
{
"FLUSHO"
,
FLUSHO
},
{
"NOFLSH"
,
NOFLSH
},
{
"TOSTOP"
,
TOSTOP
},
{
"PENDIN"
,
PENDIN
},
{
"IEXTEN"
,
IEXTEN
},
/* indexes into the control chars array returned by tcgetattr() */
{
"VINTR"
,
VINTR
},
{
"VQUIT"
,
VQUIT
},
{
"VERASE"
,
VERASE
},
{
"VKILL"
,
VKILL
},
{
"VEOF"
,
VEOF
},
{
"VTIME"
,
VTIME
},
{
"VMIN"
,
VMIN
},
{
"VSWTC"
,
VSWTC
},
{
"VSTART"
,
VSTART
},
{
"VSTOP"
,
VSTOP
},
{
"VSUSP"
,
VSUSP
},
{
"VEOL"
,
VEOL
},
{
"VREPRINT"
,
VREPRINT
},
{
"VDISCARD"
,
VDISCARD
},
{
"VWERASE"
,
VWERASE
},
{
"VLNEXT"
,
VLNEXT
},
{
"VEOL2"
,
VEOL2
},
/* sentinel */
{
NULL
,
0
}
};
DL_EXPORT
(
void
)
PyInit_termios
(
void
)
{
PyObject
*
m
,
*
d
;
struct
constant
*
constant
=
termios_constants
;
m
=
Py_InitModule4
(
"termios"
,
termios_methods
,
termios__doc__
,
(
PyObject
*
)
NULL
,
PYTHON_API_VERSION
);
...
...
@@ -304,4 +457,9 @@ PyInit_termios(void)
d
=
PyModule_GetDict
(
m
);
TermiosError
=
PyErr_NewException
(
"termios.error"
,
NULL
,
NULL
);
PyDict_SetItemString
(
d
,
"error"
,
TermiosError
);
while
(
constant
->
name
!=
NULL
)
{
PyModule_AddIntConstant
(
m
,
constant
->
name
,
constant
->
value
);
++
constant
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment