Runtime-Support
Functions
-
Header
Files
6.1.2
Character
Typing
and
Conversion
(ctype.h)
The
ctype.
h header declares functions that test (type) and convert charac-
ters.
For example, a character-typing
function
may test a character
to
determine
whether
it
is
a letter,
if
it
is
a printing character,
if
it
is
a hexadecimal
digit,
etc.
These functions return a value
of
true (a nonzero value)
or
false (0).
The character-conversion functions convert characters
to
lower
case, upper
case, or
ASCII. These functions return the converted character.
Character-typing functions have names in the form
isxxx
(for
example,
isdigit). Character-conversion functions have names in the form
toxxx
(for
example, toupper).
The
ctype.
h header also contains macro definitions
that
perform these same
operations; the macros run faster than the corresponding functions. The
typ-
ing macros expand
to
a lookup operation in
an
array
of
flags
(this
array is de-
fined in
ctype.
c).
The macros have the same name
as
the corresponding
functions,
but
each macro
is
prefixed
with
an
underscore
(for
example,
-isdigit).
6.1.3
Limits
(float.h
and
limits.h)
The
float.
h and
limits.
h headers define macros that expand
to
useful
limits and parameters
of
the TMS3401
O's
numeric representations. Table 6-1
and Table
6-2
list these macros and the limits they are associated
with.
Table
6-1.
Macros
that
Supply
Integer
Type
Range
Limits
(Iimits.h)
Macro
Value
Description
CHAR-BIT
8
Number
of
bits in type char
SCHAR-MIN
-128
Minimum value for a signed char
SCHAR-MAX
127 Maximum value for a signed char
UCHAR-MAX
255 Maximum value for
an
unsigned
c!'".ar
CHAR-MIN
SCHAR-MIN
Minimum value for a char
CHAR-MAX
SCHAR-MAX
Maximum value for a char
SHRT-MIN
-32768
Minimum value for a short
int
SHRT-MAX
32767 Maximum value for a short
int
USHRT-MAX
65535 Maximum value for
an
unsigned short int
INT-MIN
-2147483648 Minimum value for
an
int
I
NT-MAX
2147483647 Maximum value for
an
int
UINT-MAX
4294967295 Maximum value for
an
unsigned
int
LONG-MIN
-2147483648 Minimum value for a long int
LONG-MAX
2147483647 Maximum value for a long int
ULONG-MAX
4294967295 Maximum value for
an
unsigned long
int
6-3