Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f57d7b9

Browse files
committed
Dcoumentation for ascii.py. I've changed two references from ascii to
curses.ascii.
1 parent 2b9d0bc commit f57d7b9

1 file changed

Lines changed: 131 additions & 0 deletions

File tree

Doc/lib/libascii.tex

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
\section{\module{curses.ascii} ---
2+
Constants and set-membership functions for ASCII characters.}
3+
4+
\declaremodule{standard}{curses.ascii}
5+
\modulesynopsis{Constants and set-membership functions for ASCII characters.}
6+
\moduleauthor{Eric S. Raymond}{[email protected]}
7+
\sectionauthor{Eric S. Raymond}{[email protected]}
8+
9+
\versionadded{1.6}
10+
11+
The \module{curses.ascii} module supplies name constants for ASCII characters
12+
and functions to test membership in various ASCII character classes.
13+
The constants supplied are names for control characters as follows:
14+
15+
NUL, SOH, STX, ETX, EOT, ENQ, ACK, BEL, BS, TAB, HT, LF, NL, VT, FF, CR,
16+
SO, SI, DLE, DC1, DC2, DC3, DC4, NAK, SYN, ETB, CAN, EM, SUB, ESC, FS,
17+
GS, RS, US, SP, DEL.
18+
19+
NL and LF are synonyms; so are HT and TAB. The module also supplies
20+
the following functions, patterned on those in the standard C library:
21+
22+
\begin{funcdesc}{isalnum}{c}
23+
Checks for an ASCII alphanumeric character; it is equivalent to
24+
isalpha(c) or isdigit(c))
25+
\end{funcdesc}
26+
27+
\begin{funcdesc}{isalpha}{c}
28+
Checks for an ASCII alphabetic character; it is equivalent to
29+
isupper(c) or islower(c))
30+
\end{funcdesc}
31+
32+
\begin{funcdesc}{isascii}{c}
33+
Checks for a character value that fits in the 7-bit ASCII set.
34+
\end{funcdesc}
35+
36+
\begin{funcdesc}{isblank}{c}
37+
Checks for an ASCII alphanumeric character; it is equivalent to
38+
isalpha(c) or isdigit(c))
39+
\end{funcdesc}
40+
41+
\begin{funcdesc}{iscntrl}{c}
42+
Checks for an ASCII control character (range 0x00 to 0x1f).
43+
\end{funcdesc}
44+
45+
\begin{funcdesc}{isdigit}{c}
46+
Checks for an ASCII decimal digit, 0 through 9.
47+
\end{funcdesc}
48+
49+
\begin{funcdesc}{isgraph}{c}
50+
Checks for ASCII any printable character except space.
51+
\end{funcdesc}
52+
53+
\begin{funcdesc}{islower}{c}
54+
Checks for an ASCII lower-case character.
55+
\end{funcdesc}
56+
57+
\begin{funcdesc}{isprint}{c}
58+
Checks for any ASCII printable character including space.
59+
\end{funcdesc}
60+
61+
\begin{funcdesc}{ispunct}{c}
62+
Checks for any printable ASCII character which is not a space or an
63+
alphanumeric character.
64+
\end{funcdesc}
65+
66+
\begin{funcdesc}{isspace}{c}
67+
Checks for ASCII white-space characters; space, tab, line feed,
68+
carriage return, form feed, horizontal tab, vertical tab.
69+
\end{funcdesc}
70+
71+
\begin{funcdesc}{isupper}{c}
72+
Checks for an ASCII uppercase letter.
73+
\end{funcdesc}
74+
75+
\begin{funcdesc}{isxdigit}{c}
76+
Checks for an ASCII hexadecimal digit, i.e. one of 0123456789abcdefABCDEF.
77+
\end{funcdesc}
78+
79+
\begin{funcdesc}{isctrl}{c}
80+
Checks for an ASCII control character, bit values 0 to 31.
81+
\end{funcdesc}
82+
83+
\begin{funcdesc}{ismeta}{c}
84+
Checks for a (non-ASCII) character, bit values 0x80 and above.
85+
\end{funcdesc}
86+
87+
These functions accept either integers or strings; when the argument
88+
is a string, it is first converted using the built-in function ord().
89+
90+
Note that all these functions check ordinal bit values derived from the
91+
first character of the string you pass in; they do not actually know
92+
anything about the host machine's character encoding. For functions
93+
that know about the character encoding (and handle
94+
internationalization properly) see the string module.
95+
96+
The following two functions take either a single-character string or
97+
integer byte value; they return a value of the same type.
98+
99+
\begin{funcdesc}{ascii}{c}
100+
Return the ASCII value corresponding to the low 7 bits of c.
101+
\end{funcdesc}
102+
103+
\begin{funcdesc}{ctrl}{c}
104+
Return the control character corresponding to the given character
105+
(the character bit value is logical-anded with 0x1f).
106+
\end{funcdesc}
107+
108+
\begin{funcdesc}{alt}{c}
109+
Return the 8-bit character corresponding to the given ASCII character
110+
(the character bit value is logical-ored with 0x80).
111+
\end{funcdesc}
112+
113+
The following function takes either a single-character string or
114+
integer byte value; it returns a string.
115+
116+
\begin{funcdesc}{unctrl}{c}
117+
Return a string representation of the ASCII character c. If c is
118+
printable, this string is the character itself. If the character
119+
is a control character (0x00-0x1f) the string consists of a caret
120+
(^) followed by the corresponding uppercase letter. If the character
121+
is an ASCII delete (0x7f) the string is "^?". If the character has
122+
its meta bit (0x80) set, the meta bit is stripped, the preceding rules
123+
applied, and "!" prepended to the result.
124+
\end{funcdesc}
125+
126+
Finally, the module supplies a 33-element string array
127+
called controlnames that contains the ASCII mnemonics for the
128+
thirty-two ASCII control characters from 0 (NUL) to 0x1f (US),
129+
in order, plus the mnemonic "SP" for space.
130+
131+

0 commit comments

Comments
 (0)