Chapter 13. c and math library overview, Included noniso functions, C and math library overview – Comtrol eCos User Manual

Page 355: Included non-iso functions

Advertising
background image

Chapter 13. C and math library overview

eCos provides compatibility with the ISO 9899:1990 specification for the standard C library, which is essentially
the same as the better-known ANSI C3.159-1989 specification (C-89).

There are three aspects of this compatibility supplied by eCos. First there is a C library which implements the
functions defined by the ISO standard, except for the mathematical functions. This is provided by the eCos C
library packages.

Then eCos provides a math library, which implements the mathematical functions from the ISO C library. This
distinction between C and math libraries is frequently drawn — most standard C library implementations provide
separate linkable files for the two, and the math library contains all the functions from the

math.h

header file.

There is a third element to the ISO C library, which is the environment in which applications run when they use
the standard C library. This environment is set up by the C library startup procedure (

the Section called C library

startup

) and it provides (among other things) a

main()

entry point function, an

exit()

function that does the

cleanup required by the standard (including handlers registered using the

atexit()

function), and an environment

that can be read with

getenv()

.

The description in this manual focuses on the eCos-specific aspects of the C library (mostly related to eCos’s
configurability) as well as mentioning the omissions from the standard in this release. We do not attempt to define
the semantics of each function, since that information can be found in the ISO, ANSI, POSIX and IEEE standards,
and the many good books that have been written about the standard C library, that cover usage of these functions
in a more general and useful way.

Included non-ISO functions

The following functions from the POSIX specification are included for convenience:

extern char **

environ variable (for setting up the environment for use with

getenv()

)

_exit()

strtok_r()

rand_r()

asctime_r()

ctime_r()

localtime_r()

gmtime_r()

eCos provides the following additional implementation-specific functions within the standard C library to adjust
the date and time settings:

void

cyg_libc_time_setdst

(

cyg_libc_time_dst state

);

This function sets the state of Daylight Savings Time. The values for state are:

CYG_LIBC_TIME_DSTNA

unknown

CYG_LIBC_TIME_DSTOFF

off

251

Advertising