MicrOS
stdlib.h File Reference
#include <stdint.h>
#include "string.h"
#include "time.h"
#include "micros.h"

Go to the source code of this file.

Classes

struct  div_t
 Structure to represent the result value of an integral division. More...
 
struct  ldiv_t
 Structure to represent the result value of an integral division. More...
 
struct  lldiv_t
 Structure to represent the result value of an integral division. More...
 

Macros

#define RAND_MAX   INT32_MAX
 Maximum value returned by rand. More...
 
#define EXIT_SUCCESS   0
 Success termination code. More...
 
#define EXIT_FAILURE   -1
 Failure termination code. More...
 

Functions

int abs (int n)
 Absolute value. More...
 
long int labs (long int n)
 Absolute value. More...
 
long long int llabs (long long int n)
 Absolute value. More...
 
div_t div (int numer, int denom)
 Integral division. More...
 
ldiv_t ldiv (long int numer, long int denom)
 Integral division. More...
 
lldiv_t lldiv (long long int numer, long long int denom)
 Integral division. More...
 
int atoi (const char *string)
 Convert string to integer. More...
 
long int atol (const char *string)
 Convert string to integer. More...
 
long long int atoll (const char *string)
 Convert string to integer. More...
 
char * itoa (int input, char *buffer, int base)
 Convert integer to string (non-standard function) More...
 
double strtod (const char *str, char **endptr)
 Convert string to double. More...
 
void * malloc (size_t size)
 Allocate memory block. More...
 
void * malloc_align (size_t size, uint32_t align)
 Allocate memory block with the specified align. More...
 
void * calloc (size_t num, size_t size)
 Allocate and zero-initialize array. More...
 
void * realloc (void *ptr, size_t size)
 Reallocate memory block. More...
 
void free (void *ptr)
 Deallocate memory block. More...
 
int rand ()
 Generate random number. More...
 
void srand (unsigned int new_seed)
 Initialize random number generator. More...
 
void qsort (void *base, size_t num, size_t size, int(*compar)(const void *, const void *))
 Sorts an array. More...
 
void * bsearch (const void *key, const void *base, size_t num, size_t size, int(*compar)(const void *, const void *))
 Binary search in array. More...
 
void abort ()
 Abort current process. More...
 
void exit (int status)
 Terminate calling process. More...
 
char * getenv (const char *name)
 Get environment string. More...
 
void __stdlib_swap (void *first, void *second, size_t size)
 Swap two elements. Used by qsort(). More...
 
int __stdlib_partition (void *base, size_t num, size_t size, int(*compar)(const void *, const void *))
 Sort and return position of key. Used by qsort(). More...
 

Variables

unsigned int seed
 

Macro Definition Documentation

◆ EXIT_FAILURE

#define EXIT_FAILURE   -1

Failure termination code.

◆ EXIT_SUCCESS

#define EXIT_SUCCESS   0

Success termination code.

◆ RAND_MAX

#define RAND_MAX   INT32_MAX

Maximum value returned by rand.

Function Documentation

◆ __stdlib_partition()

int __stdlib_partition ( void *  base,
size_t  num,
size_t  size,
int(*)(const void *, const void *)  compar 
)

Sort and return position of key. Used by qsort().

◆ __stdlib_swap()

void __stdlib_swap ( void *  first,
void *  second,
size_t  size 
)

Swap two elements. Used by qsort().

◆ abort()

void abort ( )

Abort current process.

◆ abs()

int abs ( int  n)

Absolute value.

◆ atoi()

int atoi ( const char *  string)

Convert string to integer.

◆ atol()

long int atol ( const char *  string)

Convert string to integer.

◆ atoll()

long long int atoll ( const char *  string)

Convert string to integer.

◆ bsearch()

void* bsearch ( const void *  key,
const void *  base,
size_t  num,
size_t  size,
int(*)(const void *, const void *)  compar 
)

Binary search in array.

◆ calloc()

void* calloc ( size_t  num,
size_t  size 
)

Allocate and zero-initialize array.

◆ div()

div_t div ( int  numer,
int  denom 
)

Integral division.

◆ exit()

void exit ( int  status)

Terminate calling process.

◆ free()

void free ( void *  ptr)

Deallocate memory block.

◆ getenv()

char* getenv ( const char *  name)

Get environment string.

◆ itoa()

char* itoa ( int  input,
char *  buffer,
int  base 
)

Convert integer to string (non-standard function)

◆ labs()

long int labs ( long int  n)

Absolute value.

◆ ldiv()

ldiv_t ldiv ( long int  numer,
long int  denom 
)

Integral division.

◆ llabs()

long long int llabs ( long long int  n)

Absolute value.

◆ lldiv()

lldiv_t lldiv ( long long int  numer,
long long int  denom 
)

Integral division.

◆ malloc()

void* malloc ( size_t  size)

Allocate memory block.

◆ malloc_align()

void* malloc_align ( size_t  size,
uint32_t  align 
)

Allocate memory block with the specified align.

◆ qsort()

void qsort ( void *  base,
size_t  num,
size_t  size,
int(*)(const void *, const void *)  compar 
)

Sorts an array.

◆ rand()

int rand ( )

Generate random number.

◆ realloc()

void* realloc ( void *  ptr,
size_t  size 
)

Reallocate memory block.

◆ srand()

void srand ( unsigned int  new_seed)

Initialize random number generator.

◆ strtod()

double strtod ( const char *  str,
char **  endptr 
)

Convert string to double.

Variable Documentation

◆ seed

unsigned int seed