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

Skip to content

Commit 5ccd4b2

Browse files
committed
Added entries for the curses.ascii module.
1 parent 6da3434 commit 5ccd4b2

2 files changed

Lines changed: 93 additions & 50 deletions

File tree

Doc/Makefile.deps

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ LIBFILES= $(MANSTYLES) $(COMMONTEX) \
218218
../lib/libchunk.tex \
219219
../lib/libcodeop.tex \
220220
../lib/libcurses.tex \
221+
../lib/libascii.tex \
221222
../lib/libdl.tex \
222223
../lib/libmutex.tex \
223224
../lib/libnis.tex \

Doc/lib/libascii.tex

Lines changed: 92 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,131 +1,173 @@
11
\section{\module{curses.ascii} ---
2-
Constants and set-membership functions for ASCII characters.}
2+
Utilities for ASCII characters}
33

44
\declaremodule{standard}{curses.ascii}
5-
\modulesynopsis{Constants and set-membership functions for ASCII characters.}
5+
\modulesynopsis{Constants and set-membership functions for
6+
\ASCII{} characters.}
67
\moduleauthor{Eric S. Raymond}{[email protected]}
78
\sectionauthor{Eric S. Raymond}{[email protected]}
89

910
\versionadded{1.6}
1011

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:
12+
The \module{curses.ascii} module supplies name constants for
13+
\ASCII{} characters and functions to test membership in various
14+
\ASCII{} character classes. The constants supplied are names for
15+
control characters as follows:
16+
17+
\begin{tableii}{l|l}{constant}{Name}{Meaning}
18+
\lineii{NUL}{}
19+
\lineii{SOH}{Start of heading, console interrupt}
20+
\lineii{STX}{Start of text}
21+
\lineii{ETX}{Ennd of text}
22+
\lineii{EOT}{End of transmission}
23+
\lineii{ENQ}{Enquiry, goes with \constant{ACK} flow control}
24+
\lineii{ACK}{Acknowledgement}
25+
\lineii{BEL}{Bell}
26+
\lineii{BS}{Backspace}
27+
\lineii{TAB}{Tab}
28+
\lineii{HT}{Alias for \constant{TAB}: ``Horizontal tab''}
29+
\lineii{LF}{Line feed}
30+
\lineii{NL}{Alias for \constant{LF}: ``New line''}
31+
\lineii{VT}{Vertical tab}
32+
\lineii{FF}{Form feed}
33+
\lineii{CR}{Carriage return}
34+
\lineii{SO}{Shift-out, begin alternate character set}
35+
\lineii{SI}{Shift-in, resume default character set}
36+
\lineii{DLE}{Data-link escape}
37+
\lineii{DC1}{XON, for flow control}
38+
\lineii{DC2}{Device control 2, block-mode flow control}
39+
\lineii{DC3}{XOFF, for flow control}
40+
\lineii{DC4}{Device control 4}
41+
\lineii{NAK}{Negative acknowledgement}
42+
\lineii{SYN}{Synchronous idle}
43+
\lineii{ETB}{End transmission block}
44+
\lineii{CAN}{Cancel}
45+
\lineii{EM}{End of medium}
46+
\lineii{SUB}{Substitute}
47+
\lineii{ESC}{Escape}
48+
\lineii{FS}{File separator}
49+
\lineii{GS}{Group separator}
50+
\lineii{RS}{Record separator, block-mode terminator}
51+
\lineii{US}{Unit separator}
52+
\lineii{SP}{Space}
53+
\lineii{DEL}{Delete}
54+
\end{tableii}
55+
56+
Note that many of these have little practical use in modern usage.
57+
58+
The module supplies the following functions, patterned on those in the
59+
standard C library:
1460

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:
2161

2262
\begin{funcdesc}{isalnum}{c}
23-
Checks for an ASCII alphanumeric character; it is equivalent to
24-
isalpha(c) or isdigit(c))
63+
Checks for an \ASCII{} alphanumeric character; it is equivalent to
64+
\samp{isalpha(\var{c}) or isdigit(\var{c})}.
2565
\end{funcdesc}
2666

2767
\begin{funcdesc}{isalpha}{c}
28-
Checks for an ASCII alphabetic character; it is equivalent to
29-
isupper(c) or islower(c))
68+
Checks for an \ASCII{} alphabetic character; it is equivalent to
69+
\samp{isupper(\var{c}) or islower(\var{c})}.
3070
\end{funcdesc}
3171

3272
\begin{funcdesc}{isascii}{c}
33-
Checks for a character value that fits in the 7-bit ASCII set.
73+
Checks for a character value that fits in the 7-bit \ASCII{} set.
3474
\end{funcdesc}
3575

3676
\begin{funcdesc}{isblank}{c}
37-
Checks for an ASCII alphanumeric character; it is equivalent to
38-
isalpha(c) or isdigit(c))
77+
Checks for an \ASCII{} whitespace character.
3978
\end{funcdesc}
4079

4180
\begin{funcdesc}{iscntrl}{c}
42-
Checks for an ASCII control character (range 0x00 to 0x1f).
81+
Checks for an \ASCII{} control character (in the range 0x00 to 0x1f).
4382
\end{funcdesc}
4483

4584
\begin{funcdesc}{isdigit}{c}
46-
Checks for an ASCII decimal digit, 0 through 9.
85+
Checks for an \ASCII{} decimal digit, \character{0} through
86+
\character{9}. This is equivalent to \samp{\var{c} in string.digits}.
4787
\end{funcdesc}
4888

4989
\begin{funcdesc}{isgraph}{c}
50-
Checks for ASCII any printable character except space.
90+
Checks for \ASCII{} any printable character except space.
5191
\end{funcdesc}
5292

5393
\begin{funcdesc}{islower}{c}
54-
Checks for an ASCII lower-case character.
94+
Checks for an \ASCII{} lower-case character.
5595
\end{funcdesc}
5696

5797
\begin{funcdesc}{isprint}{c}
58-
Checks for any ASCII printable character including space.
98+
Checks for any \ASCII{} printable character including space.
5999
\end{funcdesc}
60100

61101
\begin{funcdesc}{ispunct}{c}
62-
Checks for any printable ASCII character which is not a space or an
102+
Checks for any printable \ASCII{} character which is not a space or an
63103
alphanumeric character.
64104
\end{funcdesc}
65105

66106
\begin{funcdesc}{isspace}{c}
67-
Checks for ASCII white-space characters; space, tab, line feed,
107+
Checks for \ASCII{} white-space characters; space, tab, line feed,
68108
carriage return, form feed, horizontal tab, vertical tab.
69109
\end{funcdesc}
70110

71111
\begin{funcdesc}{isupper}{c}
72-
Checks for an ASCII uppercase letter.
112+
Checks for an \ASCII{} uppercase letter.
73113
\end{funcdesc}
74114

75115
\begin{funcdesc}{isxdigit}{c}
76-
Checks for an ASCII hexadecimal digit, i.e. one of 0123456789abcdefABCDEF.
116+
Checks for an \ASCII{} hexadecimal digit. This is equivalent to
117+
\samp{\var{c} in string.hexdigits}.
77118
\end{funcdesc}
78119

79120
\begin{funcdesc}{isctrl}{c}
80-
Checks for an ASCII control character, bit values 0 to 31.
121+
Checks for an \ASCII{} control character (ordinal values 0 to 31).
81122
\end{funcdesc}
82123

83124
\begin{funcdesc}{ismeta}{c}
84-
Checks for a (non-ASCII) character, bit values 0x80 and above.
125+
Checks for a non-\ASCII{} character (ordinal values 0x80 and above).
85126
\end{funcdesc}
86127

87128
These functions accept either integers or strings; when the argument
88-
is a string, it is first converted using the built-in function ord().
129+
is a string, it is first converted using the built-in function
130+
\function{ord()}.
89131

90132
Note that all these functions check ordinal bit values derived from the
91133
first character of the string you pass in; they do not actually know
92134
anything about the host machine's character encoding. For functions
93135
that know about the character encoding (and handle
94-
internationalization properly) see the string module.
136+
internationalization properly) see the \refmodule{string} module.
95137

96138
The following two functions take either a single-character string or
97139
integer byte value; they return a value of the same type.
98140

99141
\begin{funcdesc}{ascii}{c}
100-
Return the ASCII value corresponding to the low 7 bits of c.
142+
Return the ASCII value corresponding to the low 7 bits of \var{c}.
101143
\end{funcdesc}
102144

103145
\begin{funcdesc}{ctrl}{c}
104146
Return the control character corresponding to the given character
105-
(the character bit value is logical-anded with 0x1f).
147+
(the character bit value is bitwise-anded with 0x1f).
106148
\end{funcdesc}
107149

108150
\begin{funcdesc}{alt}{c}
109151
Return the 8-bit character corresponding to the given ASCII character
110-
(the character bit value is logical-ored with 0x80).
152+
(the character bit value is bitwise-ored with 0x80).
111153
\end{funcdesc}
112154

113155
The following function takes either a single-character string or
114-
integer byte value; it returns a string.
156+
integer value; it returns a string.
115157

116158
\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-
159+
Return a string representation of the \ASCII{} character \var{c}. If
160+
\var{c} is printable, this string is the character itself. If the
161+
character is a control character (0x00-0x1f) the string consists of a
162+
caret (\character{\^}) followed by the corresponding uppercase letter.
163+
If the character is an \ASCII{} delete (0x7f) the string is
164+
\code{'\^{}?'}. If the character has its meta bit (0x80) set, the meta
165+
bit is stripped, the preceding rules applied, and
166+
\character{!} prepended to the result.
167+
\end{funcdesc}
168+
169+
\begin{datadesc}{controlnames}
170+
A 33-element string array that contains the \ASCII{} mnemonics for the
171+
thirty-two \ASCII{} control characters from 0 (NUL) to 0x1f (US), in
172+
order, plus the mnemonic \samp{SP} for the space character.
173+
\end{datadesc}

0 commit comments

Comments
 (0)