MOS Source Code
Loading...
Searching...
No Matches
libs.Stdlib

Some standard library functions. More...

+ Collaboration diagram for libs.Stdlib:

Macros

#define MIN(a, b)   __extension__ ({ __extension__ __auto_type _a = (a); __auto_type _b = (b); _a < _b ? _a : _b; })
 
#define MAX(a, b)   __extension__ ({ __extension__ __auto_type _a = (a); __auto_type _b = (b); _a > _b ? _a : _b; })
 
#define pow2(x)   ((__typeof__(x)) 1 << (x))
 

Functions

MOSAPI unsigned char tolower (unsigned char c)
 
MOSAPI s32 abs (s32 x)
 
MOSAPI long labs (long x)
 
MOSAPI s64 llabs (s64 x)
 
MOSAPI s32 atoi (const char *nptr)
 
MOSAPI unsigned long strtoul (const char *nptr, char **endptr, int base)
 
MOSAPI s64 strtoll (const char *str, char **endptr, int base)
 
MOSAPI s64 strntoll (const char *str, char **endptr, int base, size_t n)
 
MOSAPI void format_size (char *buf, size_t buf_size, u64 size)
 
MOSAPI char * string_trim (char *in)
 
MOSAPI pid_t spawn (const char *path, const char *const argv[])
 
MOSAPI noreturn void exit (int status)
 
MOSAPI int atexit (void(*func)(void))
 
MOSAPI tid_t start_thread (const char *name, thread_entry_t entry, void *arg)
 
MOSAPI noreturn void abort (void)
 

Detailed Description

Some standard library functions.

Macro Definition Documentation

◆ MIN

◆ MAX

#define MAX ( a,
b )   __extension__ ({ __extension__ __auto_type _a = (a); __auto_type _b = (b); _a > _b ? _a : _b; })

◆ pow2

#define pow2 ( x)    ((__typeof__(x)) 1 << (x))

Function Documentation

◆ tolower()

MOSAPI unsigned char tolower ( unsigned char c)

Definition at line 9 of file mos_stdlib.c.

Referenced by strncasecmp().

◆ abs()

MOSAPI s32 abs ( s32 x)

Definition at line 21 of file mos_stdlib.c.

◆ labs()

MOSAPI long labs ( long x)

Definition at line 26 of file mos_stdlib.c.

◆ llabs()

MOSAPI s64 llabs ( s64 x)

Definition at line 31 of file mos_stdlib.c.

◆ atoi()

MOSAPI s32 atoi ( const char * nptr)

Definition at line 36 of file mos_stdlib.c.

Referenced by encode_dictionary(), encode_tree(), and main().

+ Here is the call graph for this function:

◆ strtoul()

MOSAPI unsigned long strtoul ( const char * nptr,
char ** endptr,
int base )

Referenced by main().

◆ strtoll()

MOSAPI s64 strtoll ( const char * str,
char ** endptr,
int base )

Definition at line 68 of file mos_stdlib.c.

Referenced by strtoul().

+ Here is the call graph for this function:

◆ strntoll()

MOSAPI s64 strntoll ( const char * str,
char ** endptr,
int base,
size_t n )

◆ format_size()

MOSAPI void format_size ( char * buf,
size_t buf_size,
u64 size )

Definition at line 103 of file mos_stdlib.c.

Referenced by mmstat_sysfs_stat().

+ Here is the call graph for this function:

◆ string_trim()

MOSAPI char * string_trim ( char * in)

Definition at line 124 of file mos_stdlib.c.

+ Here is the call graph for this function:

◆ spawn()

MOSAPI pid_t spawn ( const char * path,
const char *const argv[] )

◆ exit()

MOSAPI noreturn void exit ( int status)

◆ atexit()

MOSAPI int atexit ( void(*)(void) func)

◆ start_thread()

MOSAPI tid_t start_thread ( const char * name,
thread_entry_t entry,
void * arg )

◆ abort()

MOSAPI noreturn void abort ( void )

Definition at line 37 of file avr_io.c.