PatchworkOS
Loading...
Searching...
No Matches
stdlib.h File Reference
#include "_internal/NULL.h"
#include "_internal/config.h"
#include "_internal/size_t.h"

Go to the source code of this file.

Data Structures

struct  div_t
 
struct  ldiv_t
 
struct  lldiv_t
 

Macros

#define ltoa(number, str, base)   lltoa(number, str, base)
 
#define itoa(number, str, base)   lltoa(number, str, base)
 
#define ultoa(number, str, base)   lltoa(number, str, base)
 
#define uitoa(number, str, base)   lltoa(number, str, base)
 
#define strtol(nptr, endptr, base)   ((long int)strtoll(nptr, endptr, base))
 
#define atol(nptr)   ((long)atoll(nptr))
 
#define atoi(nptr)   ((int)atoll(nptr))
 
#define RAND_MAX   32767
 
#define EXIT_SUCCESS   0
 
#define EXIT_FAILURE   -1
 

Functions

_PUBLIC char * lltoa (long long number, char *str, int base)
 
_PUBLIC char * ulltoa (unsigned long long number, char *str, int base)
 
_PUBLIC double atof (const char *nptr)
 
_PUBLIC double strtod (const char *_RESTRICT nptr, char **_RESTRICT endptr)
 
_PUBLIC float strtof (const char *_RESTRICT nptr, char **_RESTRICT endptr)
 
_PUBLIC long double strtold (const char *_RESTRICT nptr, char **_RESTRICT endptr)
 
_PUBLIC long long int strtoll (const char *_RESTRICT nptr, char **_RESTRICT endptr, int base)
 
_PUBLIC unsigned long int strtoul (const char *_RESTRICT nptr, char **_RESTRICT endptr, int base)
 
_PUBLIC unsigned long long int strtoull (const char *_RESTRICT nptr, char **_RESTRICT endptr, int base)
 
_PUBLIC long long int atoll (const char *nptr)
 
_PUBLIC int rand (void)
 
_PUBLIC void srand (unsigned int seed)
 
_PUBLIC void * malloc (size_t size)
 
_PUBLIC void * calloc (size_t nmemb, size_t size)
 
_PUBLIC void free (void *ptr)
 
_PUBLIC void * realloc (void *ptr, size_t size)
 
_PUBLIC _NORETURN void abort (void)
 
_PUBLIC int at_quick_exit (void(*func)(void))
 
_PUBLIC int atexit (void(*func)(void))
 
_PUBLIC _NORETURN void exit (int status)
 
_PUBLIC _NORETURN void quick_exit (int status)
 
_PUBLIC _NORETURN void _Exit (int status)
 
_PUBLIC char * getenv (const char *name)
 
_PUBLIC int system (const char *string)
 
_PUBLIC void * bsearch (const void *key, const void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *))
 
_PUBLIC void qsort (void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *))
 
_PUBLIC int abs (int j)
 
_PUBLIC long int labs (long int j)
 
_PUBLIC long long int llabs (long long int j)
 
_PUBLIC div_t div (int numer, int denom)
 
_PUBLIC ldiv_t ldiv (long int numer, long int denom)
 
_PUBLIC lldiv_t lldiv (long long int numer, long long int denom)
 

Macro Definition Documentation

◆ atoi

#define atoi (   nptr)    ((int)atoll(nptr))

Definition at line 34 of file stdlib.h.

◆ atol

#define atol (   nptr)    ((long)atoll(nptr))

Definition at line 33 of file stdlib.h.

◆ EXIT_FAILURE

#define EXIT_FAILURE   -1

Definition at line 47 of file stdlib.h.

◆ EXIT_SUCCESS

#define EXIT_SUCCESS   0

Definition at line 46 of file stdlib.h.

◆ itoa

#define itoa (   number,
  str,
  base 
)    lltoa(number, str, base)

Definition at line 15 of file stdlib.h.

◆ ltoa

#define ltoa (   number,
  str,
  base 
)    lltoa(number, str, base)

Definition at line 14 of file stdlib.h.

◆ RAND_MAX

#define RAND_MAX   32767

Definition at line 36 of file stdlib.h.

◆ strtol

#define strtol (   nptr,
  endptr,
  base 
)    ((long int)strtoll(nptr, endptr, base))

Definition at line 27 of file stdlib.h.

◆ uitoa

#define uitoa (   number,
  str,
  base 
)    lltoa(number, str, base)

Definition at line 19 of file stdlib.h.

◆ ultoa

#define ultoa (   number,
  str,
  base 
)    lltoa(number, str, base)

Definition at line 18 of file stdlib.h.

Function Documentation

◆ _Exit()

_PUBLIC _NORETURN void _Exit ( int  status)

◆ abort()

◆ abs()

_PUBLIC int abs ( int  j)

Definition at line 3 of file abs.c.

Referenced by _print().

◆ at_quick_exit()

_PUBLIC int at_quick_exit ( void(*)(void)  func)

◆ atexit()

_PUBLIC int atexit ( void(*)(void)  func)

◆ atof()

_PUBLIC double atof ( const char *  nptr)

Definition at line 7 of file atof.c.

References isspace().

◆ atoll()

_PUBLIC long long int atoll ( const char *  nptr)

Definition at line 8 of file atoll.c.

References _digits, isspace(), memchr(), NULL, tolower(), and x.

Referenced by process_prio_write().

◆ bsearch()

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

◆ calloc()

◆ div()

_PUBLIC div_t div ( int  numer,
int  denom 
)

Definition at line 3 of file div.c.

References div_t::quot, and div_t::rem.

Referenced by _print(), _print_hexa(), and _print_integer().

◆ exit()

_PUBLIC _NORETURN void exit ( int  status)

Definition at line 7 of file exit.c.

References _exit_stack_dispatch(), _files_close(), and _syscall_process_exit().

Referenced by abort().

◆ free()

_PUBLIC void free ( void *  ptr)

Definition at line 11 of file free.c.

References _heap_acquire(), _HEAP_ALLOCATED, _heap_free(), _HEAP_HEADER_MAGIC, _heap_release(), abort(), CONTAINER_OF, data, _heap_header_t::flags, _heap_header_t::magic, NULL, panic(), and printf().

Referenced by _file_deinit(), _file_free(), _file_init(), _thread_entry(), _thread_free(), _thread_new(), acpi_tables_push(), aml_convert_to_decimal_string(), aml_exception_register(), aml_exception_unregister(), aml_mutex_stack_pop(), aml_object_clear(), aml_object_free(), aml_package_set(), aml_patch_up_remove_unresolved(), aml_string_resize(), argv_deinit(), button_procedure(), client_free(), config_array_free(), config_close(), config_open(), dentry_free(), display_free(), display_new(), display_poll(), dwm_deinit(), element_free(), element_new_raw(), element_set_text(), fb_dir_cleanup(), fb_new(), file_free(), font_free(), font_new(), futex_ctx_deinit(), history_deinit(), history_push(), image_free(), inode_free(), kbd_dir_cleanup(), kbd_new(), key_claim(), key_share(), key_timer_handler(), local_conn_free(), local_conn_new(), local_listen_free(), local_listen_new(), local_socket_deinit(), main(), map_deinit(), map_resize(), mount_free(), mouse_dir_cleanup(), mouse_new(), pipe_close(), pipe_open(), pipe_open2(), pipeline_deinit(), pipeline_execute(), pipeline_init(), print_dir(), procedure(), process_free(), process_new(), ps2_mouse_init(), ramfs_dentry_deinit(), ramfs_inode_cleanup(), ramfs_truncate(), realloc(), ref_init(), screen_deinit(), shmem_object_allocate_pages(), shmem_object_free(), socket_family_register(), socket_family_unregister(), socket_free(), socket_new(), space_alloc_callback(), space_deinit(), space_pin_depth_dec(), space_pin_depth_inc(), start_menu_load_entries(), startmenu_procedure(), statistics_cpu_read(), statistics_mem_read(), superblock_free(), surface_free(), surface_new(), SYSCALL_DEFINE(), taskbar_entry_add(), taskbar_entry_remove(), taskbar_procedure(), terminal_procedure(), thrd_create(), thread_free(), thread_new(), wait_block_setup(), wait_remove_wait_entries(), wait_unblock(), window_deco_free(), window_deco_init(), window_free(), and window_new().

◆ getenv()

_PUBLIC char * getenv ( const char *  name)

◆ labs()

_PUBLIC long int labs ( long int  j)

Definition at line 3 of file labs.c.

◆ ldiv()

_PUBLIC ldiv_t ldiv ( long int  numer,
long int  denom 
)

◆ llabs()

_PUBLIC long long int llabs ( long long int  j)

Definition at line 3 of file llabs.c.

◆ lldiv()

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

◆ lltoa()

_PUBLIC char * lltoa ( long long  number,
char *  str,
int  base 
)

◆ malloc()

◆ qsort()

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

Definition at line 47 of file qsort.c.

References memswp(), POP, PREPARE_STACK, PUSH, stack, and T.

Referenced by draw_polygon(), and syscall_table_init().

◆ quick_exit()

_PUBLIC _NORETURN void quick_exit ( int  status)

◆ rand()

_PUBLIC int rand ( void  )

Definition at line 5 of file rand.c.

References random_gen().

Referenced by current_piece_choose_new(), and draw_gradient().

◆ realloc()

◆ srand()

_PUBLIC void srand ( unsigned int  seed)

Referenced by procedure().

◆ strtod()

_PUBLIC double strtod ( const char *_RESTRICT  nptr,
char **_RESTRICT  endptr 
)

◆ strtof()

_PUBLIC float strtof ( const char *_RESTRICT  nptr,
char **_RESTRICT  endptr 
)

◆ strtold()

_PUBLIC long double strtold ( const char *_RESTRICT  nptr,
char **_RESTRICT  endptr 
)

◆ strtoll()

_PUBLIC long long int strtoll ( const char *_RESTRICT  nptr,
char **_RESTRICT  endptr,
int  base 
)

Referenced by config_get_int().

◆ strtoul()

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

◆ strtoull()

_PUBLIC unsigned long long int strtoull ( const char *_RESTRICT  nptr,
char **_RESTRICT  endptr,
int  base 
)

◆ system()

int system ( const char *  string)

◆ ulltoa()

_PUBLIC char * ulltoa ( unsigned long long  number,
char *  str,
int  base 
)

Definition at line 5 of file ulltoa.c.

References _digits.

Referenced by procedure().