mirror of https://github.com/flysand7/ciabatta.git
headers (2)
This commit is contained in:
parent
e4f23026f3
commit
a35716e34e
|
@ -23,7 +23,7 @@ void _Noreturn _assert(
|
|||
#define assert(c) if (!(c)) __builtin_trap()
|
||||
#elif _MSC_VER
|
||||
#define assert(c) if (!(c)) __debugbreak()
|
||||
// TODO: Handle Cuik, and if such handling is not required remove this comment
|
||||
// TODO: Handle Cuik, and if such handling is not required remove this comment
|
||||
#else
|
||||
// In debug mode there shouldn't be any optimizations so this should
|
||||
// work as a simple way to cause a trap.
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
#include <limits.h>
|
||||
#include <wchar.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#define PRIi8 "hhi"
|
||||
#define PRIu8 "hhu"
|
||||
|
@ -256,6 +254,12 @@
|
|||
#define SCNxPTR "lx"
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
typedef unsigned short wchar_t;
|
||||
#else
|
||||
typedef int wchar_t;
|
||||
#endif
|
||||
|
||||
typedef struct imaxdiv_t imaxdiv_t;
|
||||
struct imaxdiv_t {
|
||||
intmax_t quot;
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#if !defined(bool)
|
||||
#define bool _Bool
|
||||
#endif
|
||||
|
||||
#if !defined(true)
|
||||
#define true 1
|
||||
#endif
|
||||
|
||||
#if !defined(false)
|
||||
#define false 0
|
||||
#endif
|
14
inc/stddef.h
14
inc/stddef.h
|
@ -9,9 +9,17 @@
|
|||
#define NULL ((void *)0)
|
||||
#endif
|
||||
|
||||
#define bool _Bool
|
||||
#define true 1
|
||||
#define false 0
|
||||
#if !defined(bool)
|
||||
#define bool _Bool
|
||||
#endif
|
||||
|
||||
#if !defined(true)
|
||||
#define true 1
|
||||
#endif
|
||||
|
||||
#if !defined(false)
|
||||
#define false 0
|
||||
#endif
|
||||
|
||||
#define offsetof(st, m) ((size_t)((char *)&((st *)0)->m - (char *)0))
|
||||
#define alignas _Alignas
|
||||
|
|
24
inc/stdio.h
24
inc/stdio.h
|
@ -2,9 +2,27 @@
|
|||
#pragma once
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <uchar.h>
|
||||
|
||||
#if !defined(NULL)
|
||||
#define NULL ((void *)0)
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
typedef unsigned long long size_t;
|
||||
#else
|
||||
typedef unsigned long size_t;
|
||||
#endif
|
||||
|
||||
#if !defined(_mbstate_t_defined)
|
||||
#define _mbstate_t_defined
|
||||
typedef struct mbstate_t mbstate_t;
|
||||
struct mbstate_t {
|
||||
union {
|
||||
unsigned short leftover;
|
||||
unsigned short high_surrogate;
|
||||
};
|
||||
};
|
||||
#endif
|
||||
|
||||
typedef struct FILE FILE;
|
||||
|
||||
|
|
|
@ -1,12 +1,16 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#if !defined(NULL)
|
||||
#define NULL ((void *)0)
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
typedef unsigned long long size_t;
|
||||
#else
|
||||
typedef unsigned long size_t;
|
||||
#endif
|
||||
|
||||
#if !defined(__STDC_LIB_EXT1__)
|
||||
#define __STDC_LIB_EXT1__
|
||||
typedef int errno_t;
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#pragma once
|
||||
|
||||
#include <time.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdatomic.h>
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
@ -13,29 +11,38 @@
|
|||
#define ONCE_FLAG_INIT 1
|
||||
#define TSS_DTOR_ITERATIONS 32
|
||||
|
||||
#if !defined(_timespec_defined)
|
||||
#define _timespec_defined
|
||||
typedef unsigned long long time_t;
|
||||
struct timespec {
|
||||
time_t tv_sec;
|
||||
long tv_nsec;
|
||||
};
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
typedef struct cnd_t {
|
||||
int idk_yet;
|
||||
} cnd_t;
|
||||
typedef struct cnd_t {
|
||||
int idk_yet;
|
||||
} cnd_t;
|
||||
|
||||
typedef struct thrd_t {
|
||||
void* handle;
|
||||
} thrd_t;
|
||||
typedef struct thrd_t {
|
||||
void* handle;
|
||||
} thrd_t;
|
||||
|
||||
typedef struct tss_t {
|
||||
int idk_yet;
|
||||
} tss_t;
|
||||
typedef struct tss_t {
|
||||
int idk_yet;
|
||||
} tss_t;
|
||||
|
||||
typedef struct mtx_t {
|
||||
int type;
|
||||
// Done to handle recursive mutexes
|
||||
unsigned long recursion;
|
||||
unsigned long owner;
|
||||
atomic_int counter;
|
||||
void* semaphore;
|
||||
} mtx_t;
|
||||
typedef struct mtx_t {
|
||||
int type;
|
||||
// Done to handle recursive mutexes
|
||||
unsigned long recursion;
|
||||
unsigned long owner;
|
||||
atomic_int counter;
|
||||
void* semaphore;
|
||||
} mtx_t;
|
||||
#else
|
||||
#error "Not implemented"
|
||||
#error "Not implemented"
|
||||
#endif
|
||||
|
||||
typedef void(*tss_dtor_t) (void*);
|
||||
|
@ -85,11 +92,11 @@ int thrd_detach (thrd_t thr);
|
|||
int thrd_equal (thrd_t thr0, thrd_t thr1);
|
||||
int thrd_join (thrd_t thr, int *res);
|
||||
void thrd_yield (void);
|
||||
_Noreturn void thrd_exit(int res);
|
||||
int thrd_sleep(
|
||||
const struct timespec *duration,
|
||||
struct timespec *remaining
|
||||
);
|
||||
_Noreturn void thrd_exit(int res);
|
||||
|
||||
int tss_create(tss_t *key, tss_dtor_t dtor);
|
||||
void tss_delete(tss_t key);
|
||||
|
|
48
inc/time.h
48
inc/time.h
|
@ -3,32 +3,38 @@
|
|||
#include <stdint.h>
|
||||
|
||||
#if !defined(NULL)
|
||||
#define NULL ((void *)0)
|
||||
#define NULL ((void *)0)
|
||||
#endif
|
||||
|
||||
#define TIME_UTC 1
|
||||
|
||||
#define CLOCKS_PER_SEC ((clock_t)1000000)
|
||||
|
||||
typedef uint64_t clock_t;
|
||||
typedef uint64_t time_t;
|
||||
typedef unsigned long long clock_t;
|
||||
typedef unsigned long long time_t;
|
||||
|
||||
struct timespec {
|
||||
time_t tv_sec;
|
||||
long tv_nsec;
|
||||
};
|
||||
#if !defined(_timespec_defined)
|
||||
#define _timespec_defined
|
||||
struct timespec {
|
||||
time_t tv_sec;
|
||||
long tv_nsec;
|
||||
};
|
||||
#endif
|
||||
|
||||
struct tm {
|
||||
int tm_sec;
|
||||
int tm_min;
|
||||
int tm_hour;
|
||||
int tm_mon;
|
||||
int tm_mday; // Days passed within 1st of current month
|
||||
int tm_year; // Years since year 1900
|
||||
int tm_wday; // Days passed since sunday
|
||||
int tm_yday; // Days passed since Jan 1
|
||||
int tm_isdst;
|
||||
};
|
||||
#if !defined(_tm_defined)
|
||||
#define _tm_defined
|
||||
struct tm {
|
||||
int tm_sec;
|
||||
int tm_min;
|
||||
int tm_hour;
|
||||
int tm_mon;
|
||||
int tm_mday;
|
||||
int tm_year;
|
||||
int tm_wday;
|
||||
int tm_yday;
|
||||
int tm_isdst;
|
||||
};
|
||||
#endif
|
||||
|
||||
clock_t clock (void);
|
||||
time_t time (time_t *timer);
|
||||
|
@ -48,8 +54,10 @@ size_t strftime(
|
|||
);
|
||||
|
||||
#ifdef __STDC_WANT_LIB_EXT1__
|
||||
|
||||
errno_t asctime_s(char *s, rsize_t maxsize, const struct tm *timeptr);
|
||||
errno_t ctime_s(char *s, rsize_t maxsize, const time_t *timer);
|
||||
struct tm *gmtime_s(const time_t * restrict timer, struct tm * restrict result);
|
||||
errno_t ctime_s (char *s, rsize_t maxsize, const time_t *timer);
|
||||
struct tm *gmtime_s (const time_t * restrict timer, struct tm * restrict result);
|
||||
struct tm *localtime_s(const time_t * restrict timer, struct tm * restrict result);
|
||||
|
||||
#endif
|
||||
|
|
11
inc/uchar.h
11
inc/uchar.h
|
@ -1,8 +1,11 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#if defined(_WIN32)
|
||||
typedef unsigned long long size_t;
|
||||
#else
|
||||
typedef unsigned long size_t;
|
||||
#endif
|
||||
|
||||
#if !defined(_mbstate_t_defined)
|
||||
#define _mbstate_t_defined
|
||||
|
@ -15,8 +18,8 @@
|
|||
};
|
||||
#endif
|
||||
|
||||
typedef uint_least16_t char16_t;
|
||||
typedef uint_least32_t char32_t;
|
||||
typedef unsigned short char16_t;
|
||||
typedef unsigned int char32_t;
|
||||
|
||||
size_t mbrtoc16(
|
||||
char16_t *restrict pc16,
|
||||
|
|
51
inc/wchar.h
51
inc/wchar.h
|
@ -1,19 +1,39 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <limits.h>
|
||||
#include <locale.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#if !defined(WEOF)
|
||||
#define WEOF -1
|
||||
#endif
|
||||
|
||||
#if !defined(NULL)
|
||||
#define NULL ((void *)0)
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
#if !defined(WCHAR_MIN)
|
||||
#define WCHAR_MIN 0x0000
|
||||
#endif
|
||||
#if !defined(WCHAR_MAX)
|
||||
#define WCHAR_MAX 0xffff
|
||||
#endif
|
||||
typedef unsigned short wchar_t;
|
||||
#else
|
||||
#if !defined(WCHAR_MIN)
|
||||
#define WCHAR_MIN -0x80000000
|
||||
#endif
|
||||
#if !defined(WCHAR_MAX)
|
||||
#define WCHAR_MAX +0x7fffffff
|
||||
#endif
|
||||
typedef int wchar_t;
|
||||
#endif
|
||||
|
||||
typedef int wint_t;
|
||||
typedef int wint_t;
|
||||
typedef int (*wctrans_t)(wint_t wc);
|
||||
typedef int (*wctype_t)(wint_t wc);
|
||||
|
||||
#if !defined(_mbstate_t_defined)
|
||||
#define _mbstate_t_defined
|
||||
|
@ -26,14 +46,23 @@ typedef int wint_t;
|
|||
};
|
||||
#endif
|
||||
|
||||
// #define WCHAR_MIN 0x0000
|
||||
// #define WCHAR_MAX 0xffff
|
||||
|
||||
|
||||
#ifndef WEOF
|
||||
#define WEOF -1
|
||||
#if !defined(_tm_defined)
|
||||
#define _tm_defined
|
||||
struct tm {
|
||||
int tm_sec;
|
||||
int tm_min;
|
||||
int tm_hour;
|
||||
int tm_mon;
|
||||
int tm_mday;
|
||||
int tm_year;
|
||||
int tm_wday;
|
||||
int tm_yday;
|
||||
int tm_isdst;
|
||||
};
|
||||
#endif
|
||||
|
||||
typedef struct FILE FILE;
|
||||
|
||||
// String length
|
||||
size_t wcslen(const wchar_t *s);
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ typedef int wint_t;
|
|||
typedef int (*wctrans_t)(wint_t wc);
|
||||
typedef int (*wctype_t)(wint_t wc);
|
||||
|
||||
#ifndef WEOF
|
||||
#if !defined(WEOF)
|
||||
#define WEOF 0
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue