PreviousNext
Help > Software > The “C.impl” Interpreter > Built-in Libraries
Built-in Libraries

C.impl includes built-in several most used standard C libraries. A good reference to the standard C libraries can be found at https://www.cplusplus.com/reference/clibrary/

The useful command ‘./lsl’ in RIDE allows listing the pre-installed system libraries or the content of any one of them. When listing a system library, it is important to supply the parameter together with the enclosing <> characters. Thus as an example, ‘./lsl <stdio.h>’ should be executed in order to list the content of the stdio.h library.

 

<stdlib.h>

Library with standard general utilities. C.impl also adds:

 

unsigned long BIT(unsigned char n)

 

Return an unsigned integer with the specified bit number raised. Bit numbers start from 0, which is the lowest meaningful bit in the number.

 

<stdio.h>

Standard input/output functions. C.impl also adds:

 

void run(const char *filename)

 

Load and run a specified file. The new file is loaded in memory over the currently executed program.

 

<stdint.h>

Standard integer definitions.

 

<stdbool.h>

Boolean definitions.

 

<stdarg.h>

Support for functions with variable number of parameters, provided by the ellipsis (…) operator.

 

<string.h>

Functions for manipulation of zero-terminated strings and memory transfers.

 

<math.h>

Mathematical functions and constants.

 

<limits.h>

Definitions of various numerical limits.

 

<ctype.h>

Functions for check and conversion of text characters.

 

<time.h>

Library with data types and functions for timing.

 

<assert.h>

Runtime assertion of an expression. C.impl also adds the possibility assert the existence of installed library functions, eg. assert(printf());

 

The library is also expanded with the following:

 

void error(int code, const char *message)

 

Trigger an execution error with supplied exit code and optionally display a message. If a message is not required, then the parameter is allowed to be NULL.

 

In case the error code is 0, the program will terminate as if it has correctly finished execution.

 

In order to keep backward compatibility with future versions, the error codes should be always negative numbers.

 

Error codes between -1 and -99 are reserved for C.impl and should not be used.

 

 

In addition to the standard libraries above, these non-standard ones are also included:

 

<conio.h>

Functions for work with a generic I/O console.

The <conio.h> library is to a large extent a subset of the <stdio.h> library with a notable exception being the kbhit() function, not present in <stdio.h>.

 

Another important difference is the behaviour of the putchar() function, which in <conio.h> works exactly as printf() with consideration of the control codes, while the same in <stdio.h> always outputs the visual character of a given code.

 

<fatfs.h>

C.impl wrapper functions for most of the FatFs library.

 

FatFs is a popular open-source library for work with files and drives in FAT16 and FAT32 disk volumes. Full information about FatFs is available at the developer’s website:

 

http://elm-chan.org/fsw/ff/00index_e.html

 

<graphics.h>

Higher-level hardware-independent graphical primitives. It is assumed that a graphics mode is already initialised on a lower level of execution.

 

 

<platform.h>

Library with specific functions and definitions related to the exact hardware platform on which the C.impl interpreter is running.