XenevaOS
Loading...
Searching...
No Matches
Macros | Functions
stdlib.h File Reference
#include <_xeneva.h>
#include <stddef.h>
#include <_xeprint.h>
#include <stdarg.h>
Include dependency graph for stdlib.h:

Go to the source code of this file.

Macros

#define max(a, b)   ((a) > (b) ? (a) : (b))
 
#define min(a, b)   ((a) < (b) ? (a) : (b))
 
#define offsetof(type, field)   ((unsigned long) &(((type *)0L)->field))
 
#define EXIT_FAILURE   1
 
#define EXIT_SUCCESS   0
 
#define RAND_MAX   (0x7fffffff)
 
#define atoll(string)   ((long long) _str2num(string, 10, 1, NULL))
 
#define random()   rand()
 
#define atou(string)   ((unsigned) _str2num(string, 10, 0, NULL))
 
#define atoull(string)   _str2num(string, 10, 0, NULL)
 
#define atoo(string)   ((unsigned)_str2num(string, 8, 0, NULL))
 
#define atooll(string)   _str2num(string, 8, 0, NULL)
 
#define dtoa(num, string, round)   _dbl2str(num, string, round)
 
#define ftoa(num, string)   _flt2str(num, string, round)
 
#define itoa(num, string)   _num2str(num, string, 10, 1)
 
#define itouo(num, string)   _num2str(num,string, 10, 1)
 
#define itoux(num, string)   _num2str(num, string, 16,0);
 
#define itox(num, string)   _num2str(num, string, 16, 1)
 
#define lltoa(num, string)   _lnum2str(num, string, 10,1)
 
#define lltouo(num, string)   _lnum2str(num, string, 8, 0)
 
#define lltoux(num, string)   _lnum2str(num, string, 16,0)
 
#define lltox(num, string)   _lnum2str(num, string, 16, 1)
 
#define xtoi(string)   ((int)_str2num(string, 16, 1, NULL))
 
#define xtoll(string)   ((long long) _str2num(string, 16,1, NULL))
 
#define ulltoa(num, string)   _lnum2str(num, string, 10, 0)
 
#define utoa(num, string)   _num2str(num, string, 10, 0)
 

Functions

XE_LIB int atoi (const char *)
 
XE_LIB long atol (const char *)
 
XE_LIB double atof (const char *)
 
XE_LIB int abs (int)
 
XE_LIB void * malloc (unsigned int)
 
XE_LIB void free (void *ptr)
 
XE_LIB void * realloc (void *address, unsigned int new_size)
 
XE_LIB void * calloc (unsigned long long num, unsigned long long size)
 
XE_LIB int mblen (const char *, size_t)
 
XE_LIB size_t mbstowcs (wchar_t *, const char *, size_t)
 
XE_LIB int mbtowc (wchar_t *, const char *, size_t)
 
XE_LIB char * mkdtemp (char *)
 
XE_LIB char * mkstemp (char *)
 
XE_LIB int rand (void)
 NOT IMPLEMENTED.
 
XE_LIB size_t wcstombs (char *, const wchar_t *, size_t)
 
XE_LIB int wctomb (char *, wchar_t)
 
XE_LIB void qsort (void *base, size_t num, size_t size, int(*comparator)(const void *, const void *))
 
XE_LIB char * sztoa (size_t value, char *str, int base)
 
XE_LIB int setenv (const char *name, const char *value, int overwrite)
 
XE_LIB char * getenv (const char *)
 
XE_LIB void exit (int errno)
 
XE_LIB int vsprintf (char *str, const char *format, va_list ap)
 
XE_LIB long strtol (const char *nptr, char **endptr, int base)
 converts a string to a long
 
XE_LIB unsigned long strtoul (const char *nptr, char **endptr, int base)
 converts a string to an unsigned long
 
XE_LIB void itoa_s (int i, unsigned base, char *buf)
 
XE_LIB void PrintOSName ()
 
XE_LIB void abort (void)
 

Macro Definition Documentation

◆ atoll

#define atoll (   string)    ((long long) _str2num(string, 10, 1, NULL))

◆ atoo

#define atoo (   string)    ((unsigned)_str2num(string, 8, 0, NULL))

◆ atooll

#define atooll (   string)    _str2num(string, 8, 0, NULL)

◆ atou

#define atou (   string)    ((unsigned) _str2num(string, 10, 0, NULL))

◆ atoull

#define atoull (   string)    _str2num(string, 10, 0, NULL)

◆ dtoa

#define dtoa (   num,
  string,
  round 
)    _dbl2str(num, string, round)

◆ EXIT_FAILURE

#define EXIT_FAILURE   1

◆ EXIT_SUCCESS

#define EXIT_SUCCESS   0

◆ ftoa

#define ftoa (   num,
  string 
)    _flt2str(num, string, round)

◆ itoa

#define itoa (   num,
  string 
)    _num2str(num, string, 10, 1)

◆ itouo

#define itouo (   num,
  string 
)    _num2str(num,string, 10, 1)

◆ itoux

#define itoux (   num,
  string 
)    _num2str(num, string, 16,0);

◆ itox

#define itox (   num,
  string 
)    _num2str(num, string, 16, 1)

◆ lltoa

#define lltoa (   num,
  string 
)    _lnum2str(num, string, 10,1)

◆ lltouo

#define lltouo (   num,
  string 
)    _lnum2str(num, string, 8, 0)

◆ lltoux

#define lltoux (   num,
  string 
)    _lnum2str(num, string, 16,0)

◆ lltox

#define lltox (   num,
  string 
)    _lnum2str(num, string, 16, 1)

◆ max

#define max (   a,
 
)    ((a) > (b) ? (a) : (b))

BSD 2-Clause License

Copyright (c) 2022-2023, Manas Kamal Choudhury All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

◆ min

#define min (   a,
 
)    ((a) < (b) ? (a) : (b))

◆ offsetof

#define offsetof (   type,
  field 
)    ((unsigned long) &(((type *)0L)->field))

◆ RAND_MAX

#define RAND_MAX   (0x7fffffff)

◆ random

#define random ( )    rand()

◆ ulltoa

#define ulltoa (   num,
  string 
)    _lnum2str(num, string, 10, 0)

◆ utoa

#define utoa (   num,
  string 
)    _num2str(num, string, 10, 0)

◆ xtoi

#define xtoi (   string)    ((int)_str2num(string, 16, 1, NULL))

◆ xtoll

#define xtoll (   string)    ((long long) _str2num(string, 16,1, NULL))

Function Documentation

◆ abort()

XE_LIB void abort ( void  )

◆ abs()

XE_LIB int abs ( int  i)

◆ atof()

XE_LIB double atof ( const char *  nptr)

◆ atoi()

XE_LIB int atoi ( const char *  s)

◆ atol()

XE_LIB long atol ( const char *  )

◆ calloc()

XE_LIB void * calloc ( unsigned long long  num,
unsigned long long  size 
)

◆ exit()

XE_LIB void exit ( int  errno)

◆ free()

XE_LIB void free ( void *  ptr)

◆ getenv()

XE_LIB char * getenv ( const char *  name)

◆ itoa_s()

XE_LIB void itoa_s ( int  i,
unsigned  base,
char *  buf 
)

◆ malloc()

XE_LIB void * malloc ( unsigned int  size)

◆ mblen()

XE_LIB int mblen ( const char *  s,
size_t  n 
)

◆ mbstowcs()

XE_LIB size_t mbstowcs ( wchar_t dest,
const char *  src,
size_t  n 
)

◆ mbtowc()

XE_LIB int mbtowc ( wchar_t wc,
const char *  bytes,
size_t  n 
)

◆ mkdtemp()

XE_LIB char * mkdtemp ( char *  )

◆ mkstemp()

XE_LIB char * mkstemp ( char *  )

◆ PrintOSName()

XE_LIB void PrintOSName ( )

◆ qsort()

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

◆ rand()

XE_LIB int rand ( void  )

NOT IMPLEMENTED.

◆ realloc()

XE_LIB void * realloc ( void *  address,
unsigned int  new_size 
)

◆ setenv()

XE_LIB int setenv ( const char *  name,
const char *  value,
int  overwrite 
)

◆ strtol()

XE_LIB long strtol ( const char *  nptr,
char **  endptr,
int  base 
)

converts a string to a long

◆ strtoul()

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

converts a string to an unsigned long

◆ sztoa()

XE_LIB char * sztoa ( size_t  value,
char *  str,
int  base 
)

◆ vsprintf()

XE_LIB int vsprintf ( char *  str,
const char *  format,
va_list  ap 
)

◆ wcstombs()

XE_LIB size_t wcstombs ( char *  dest,
const wchar_t src,
size_t  n 
)

◆ wctomb()

XE_LIB int wctomb ( char *  s,
wchar_t  wc 
)