2020-12-09 23:04:54 +00:00
|
|
|
#ifndef COSMOPOLITAN_LIBC_FMT_CONV_H_
|
|
|
|
#define COSMOPOLITAN_LIBC_FMT_CONV_H_
|
2020-06-15 14:18:57 +00:00
|
|
|
COSMOPOLITAN_C_START_
|
|
|
|
|
|
|
|
int abs(int) libcesque pureconst;
|
|
|
|
long labs(long) libcesque pureconst;
|
|
|
|
long long llabs(long long) libcesque pureconst;
|
2023-04-27 03:45:01 +00:00
|
|
|
intmax_t imaxabs(intmax_t)
|
|
|
|
libcesque pureconst;
|
2020-10-11 04:18:53 +00:00
|
|
|
int atoi(const char *) paramsnonnull() libcesque;
|
|
|
|
long atol(const char *) paramsnonnull() libcesque;
|
|
|
|
long long atoll(const char *) paramsnonnull() libcesque;
|
2020-06-15 14:18:57 +00:00
|
|
|
unsigned long strtoul(const char *, char **, int) paramsnonnull((1));
|
|
|
|
long long strtoll(const char *, char **, int) paramsnonnull((1));
|
|
|
|
unsigned long long strtoull(const char *, char **, int) paramsnonnull((1));
|
|
|
|
intmax_t strtoimax(const char *, char **, int) paramsnonnull((1));
|
|
|
|
uintmax_t strtoumax(const char *, char **, int) paramsnonnull((1));
|
|
|
|
intmax_t wcstoimax(const wchar_t *, wchar_t **, int);
|
2021-08-13 18:18:25 +00:00
|
|
|
uintmax_t wcstoumax(const wchar_t *, wchar_t **, int);
|
2020-06-15 14:18:57 +00:00
|
|
|
long wcstol(const wchar_t *, wchar_t **, int);
|
2021-08-13 18:18:25 +00:00
|
|
|
unsigned long wcstoul(const wchar_t *, wchar_t **, int);
|
2020-10-11 04:18:53 +00:00
|
|
|
long strtol(const char *, char **, int) paramsnonnull((1)) libcesque;
|
2021-08-13 18:18:25 +00:00
|
|
|
long sizetol(const char *, long) paramsnonnull() libcesque;
|
2022-08-17 20:41:21 +00:00
|
|
|
char *sizefmt(char *, uint64_t, uint64_t);
|
Import C++ Standard Template Library
You can now use the hardest fastest and most dangerous language there is
with Cosmopolitan. So far about 75% of LLVM libcxx has been added. A few
breaking changes needed to be made to help this go smoothly.
- Rename nothrow to dontthrow
- Rename nodiscard to dontdiscard
- Add some libm functions, e.g. lgamma, nan, etc.
- Change intmax_t from int128 to int64 like everything else
- Introduce %jjd formatting directive for int128_t
- Introduce strtoi128(), strtou128(), etc.
- Rename bsrmax() to bsr128()
Some of the templates that should be working currently are std::vector,
std::string, std::map, std::set, std::deque, etc.
2022-03-22 12:51:41 +00:00
|
|
|
long long wcstoll(const wchar_t *, wchar_t **, int);
|
|
|
|
unsigned long long wcstoull(const wchar_t *, wchar_t **, int);
|
|
|
|
int wcscoll(const wchar_t *, const wchar_t *);
|
|
|
|
size_t wcsxfrm(wchar_t *, const wchar_t *, size_t);
|
2020-06-15 14:18:57 +00:00
|
|
|
|
2023-06-17 17:13:50 +00:00
|
|
|
double atof(const char *);
|
|
|
|
float strtof(const char *, char **);
|
|
|
|
double strtod(const char *, char **);
|
|
|
|
long double strtold(const char *, char **);
|
|
|
|
float wcstof(const wchar_t *, wchar_t **);
|
|
|
|
double wcstod(const wchar_t *, wchar_t **);
|
|
|
|
long double wcstold(const wchar_t *, wchar_t **);
|
|
|
|
|
2023-08-14 03:31:27 +00:00
|
|
|
#ifdef _COSMO_SOURCE
|
2021-09-28 05:58:51 +00:00
|
|
|
char *stripext(char *);
|
2021-07-19 21:55:20 +00:00
|
|
|
char *stripexts(char *);
|
2023-10-03 02:25:19 +00:00
|
|
|
#endif /* _COSMO_SOURCE */
|
2020-06-15 14:18:57 +00:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
int quot;
|
|
|
|
int rem;
|
|
|
|
} div_t;
|
|
|
|
|
|
|
|
typedef struct {
|
2022-05-12 13:11:22 +00:00
|
|
|
long int quot;
|
|
|
|
long int rem;
|
2020-06-15 14:18:57 +00:00
|
|
|
} ldiv_t;
|
|
|
|
|
|
|
|
typedef struct {
|
2022-05-12 13:11:22 +00:00
|
|
|
long long int quot;
|
|
|
|
long long int rem;
|
2020-06-15 14:18:57 +00:00
|
|
|
} lldiv_t;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
intmax_t quot;
|
|
|
|
intmax_t rem;
|
|
|
|
} imaxdiv_t;
|
|
|
|
|
|
|
|
div_t div(int, int) pureconst;
|
|
|
|
ldiv_t ldiv(long, long) pureconst;
|
|
|
|
lldiv_t lldiv(long long, long long) pureconst;
|
|
|
|
imaxdiv_t imaxdiv(intmax_t, intmax_t) pureconst;
|
|
|
|
|
|
|
|
#if __STDC_VERSION__ + 0 >= 199901L
|
|
|
|
#define div(num, den) ((div_t){(num) / (den), (num) % (den)})
|
|
|
|
#define ldiv(num, den) ((ldiv_t){(num) / (den), (num) % (den)})
|
|
|
|
#define lldiv(num, den) ((lldiv_t){(num) / (den), (num) % (den)})
|
|
|
|
#endif
|
|
|
|
|
|
|
|
COSMOPOLITAN_C_END_
|
2020-12-09 23:04:54 +00:00
|
|
|
#endif /* COSMOPOLITAN_LIBC_FMT_CONV_H_ */
|