XenevaOS
Loading...
Searching...
No Matches
stdlib.h
Go to the documentation of this file.
1
30#ifndef __STDLIB_H__
31#define __STDLIB_H__
32
33#include <_xeneva.h>
34#include <stddef.h>
35#include <_xeprint.h>
36
37#ifdef __cplusplus
39#endif
40
41#include <stdarg.h>
42
43#define max(a, b) ((a) > (b) ? (a) : (b))
44#define min(a, b) ((a) < (b) ? (a) : (b))
45#define offsetof(type, field) ((unsigned long)&(((type*)0L)->field))
46
47#define EXIT_FAILURE 1
48#define EXIT_SUCCESS 0
49
50#define RAND_MAX (0x7fffffff)
51
52 XE_LIB int atoi(const char*);
53 XE_LIB long atol(const char*);
54#define atoll(string) ((long long)_str2num(string, 10, 1, NULL))
55
56 XE_LIB double atof(const char*);
57 XE_LIB int abs(int);
58 XE_LIB void* malloc(unsigned int);
59 XE_LIB void free(void* ptr);
60 XE_LIB void* realloc(void* address, unsigned int new_size);
61 XE_LIB void* calloc(unsigned long long num, unsigned long long size);
62 XE_LIB int mblen(const char*, size_t);
63 XE_LIB size_t mbstowcs(wchar_t*, const char*, size_t);
64 XE_LIB int mbtowc(wchar_t*, const char*, size_t);
65 XE_LIB char* mkdtemp(char*);
66 XE_LIB char* mkstemp(char*);
67 XE_LIB int rand(void);
68#define random() rand()
69 XE_LIB size_t wcstombs(char*, const wchar_t*, size_t);
70 XE_LIB int wctomb(char*, wchar_t);
71 XE_LIB void qsort(
72 void* base, size_t num, size_t size, int (*comparator)(const void*, const void*));
73 XE_LIB void* bsearch(const void* key,
74 const void* base,
75 size_t num,
76 size_t size,
77 int (*comparator)(const void*, const void*));
78
79 XE_LIB int system(const char* command);
80
81 XE_LIB char* sztoa(size_t value, char* str, int base);
82 /*
83 * setenv -- set environment variables
84 * @param name -- Key name
85 * @param value -- value of the variable
86 * @param overwrite -- 0 - append at the last, 1 force-write
87 */
88 XE_LIB int setenv(const char* name, const char* value, int overwrite);
89 XE_LIB char* getenv(const char*);
90 XE_LIB void exit(int errno);
91
92 XE_LIB int vsprintf(char* str, const char* format, va_list ap);
93 XE_LIB long strtol(const char* nptr, char** endptr, int base);
94 XE_LIB unsigned long strtoul(const char* nptr, char** endptr, int base);
95 XE_LIB void itoa_s(int i, unsigned base, char* buf);
97 XE_LIB void abort(void);
98 XE_LIB int atexit(void (*func)(void));
99
100// Functions are from Visopsys project
101// These are unofficial, Andy-special extensions of the atoi() and atoll()
102// paradigm
103// Visopsys, Copyright (C) 1998-2020 J. Andrew McLaughlin
104#define atou(string) ((unsigned)_str2num(string, 10, 0, NULL))
105#define atoull(string) _str2num(string, 10, 0, NULL)
106#define atoo(string) ((unsigned)_str2num(string, 8, 0, NULL))
107#define atooll(string) _str2num(string, 8, 0, NULL)
108#define dtoa(num, string, round) _dbl2str(num, string, round)
109#define ftoa(num, string) _flt2str(num, string, round)
110#define itoa(num, string) _num2str(num, string, 10, 1)
111#define itouo(num, string) _num2str(num, string, 10, 1)
112#define itoux(num, string) _num2str(num, string, 16, 0);
113#define itox(num, string) _num2str(num, string, 16, 1)
114#define lltoa(num, string) _lnum2str(num, string, 10, 1)
115#define lltouo(num, string) _lnum2str(num, string, 8, 0)
116#define lltoux(num, string) _lnum2str(num, string, 16, 0)
117#define lltox(num, string) _lnum2str(num, string, 16, 1)
118#define xtoi(string) ((int)_str2num(string, 16, 1, NULL))
119#define xtoll(string) ((long long)_str2num(string, 16, 1, NULL))
120#define ulltoa(num, string) _lnum2str(num, string, 10, 0)
121#define utoa(num, string) _num2str(num, string, 10, 0)
122
123#ifdef __cplusplus
124}
125#endif
126
127#endif
#define abs(x)
Definition math.h:146
#define XE_LIB
Definition _xeneva.h:55
#define XE_EXTERN
Definition _xeneva.h:50
char * va_list
Definition acmsvcex.h:186
#define errno
Definition dlmalloc.c:616
size_t size
Definition drm_bridge.h:1299
struct drm_crtc struct drm_plane struct drm_plane const struct drm_crtc_funcs const char * name
Definition drm_crtc.h:1242
const char const char * format
Definition drm_print.h:516
struct i915_user_extension base
Definition i915_drm.h:0
#define realloc(p, s)
Definition quickjs.c:2292
#define malloc(s)
Definition quickjs.c:2290
#define free(p)
Definition quickjs.c:2291
XE_LIB void PrintOSName()
XE_LIB double atof(const char *)
Definition stdlib.cpp:64
XE_LIB void itoa_s(int i, unsigned base, char *buf)
Definition stdlib.cpp:257
XE_LIB size_t wcstombs(char *, const wchar_t *, size_t)
Definition stdlib.cpp:178
XE_LIB char * mkdtemp(char *)
XE_LIB unsigned long strtoul(const char *nptr, char **endptr, int base)
converts a string to an unsigned long
Definition stdlib.cpp:348
XE_LIB long strtol(const char *nptr, char **endptr, int base)
converts a string to a long
Definition stdlib.cpp:268
XE_LIB size_t mbstowcs(wchar_t *, const char *, size_t)
Definition stdlib.cpp:104
XE_LIB char * mkstemp(char *)
XE_LIB char * getenv(const char *)
Definition stdlib.cpp:253
XE_LIB long atol(const char *)
XE_LIB int mblen(const char *, size_t)
Definition stdlib.cpp:84
XE_LIB char * sztoa(size_t value, char *str, int base)
Definition clib.cpp:115
XE_LIB int vsprintf(char *str, const char *format, va_list ap)
Definition stdio.cpp:343
XE_LIB void * calloc(unsigned long long num, unsigned long long size)
Definition _heap.cpp:6476
XE_LIB int mbtowc(wchar_t *, const char *, size_t)
Definition stdlib.cpp:129
XE_LIB void abort(void)
Definition stdlib.cpp:415
XE_LIB void * bsearch(const void *key, const void *base, size_t num, size_t size, int(*comparator)(const void *, const void *))
Definition port.c:27
XE_LIB int rand(void)
NOT IMPLEMENTED.
Definition stdio.cpp:132
XE_LIB int wctomb(char *, wchar_t)
Definition stdlib.cpp:161
XE_LIB int atoi(const char *)
Definition stdio.cpp:107
XE_LIB void qsort(void *base, size_t num, size_t size, int(*comparator)(const void *, const void *))
Definition qsort.cpp:78
XE_LIB int system(const char *command)
Definition stdlib.cpp:421
XE_LIB int atexit(void(*func)(void))
Definition stdlib.cpp:410
XE_LIB int setenv(const char *name, const char *value, int overwrite)
Definition stdlib.cpp:245
void exit(void)
Definition test_module.c:45