├── .gitignore ├── LICENSE ├── README ├── include ├── float.h ├── stdalign.h ├── stdarg.h ├── stdatomic.h ├── stdbool.h ├── stddef.h ├── stdnoreturn.h ├── tccdefs.h ├── tgmath.h └── varargs.h ├── tcc_win64_x86_64.c ├── win32 ├── build-tcc.bat ├── examples │ ├── dll.c │ ├── fib.c │ ├── hello_dll.c │ └── hello_win.c ├── include │ ├── _mingw.h │ ├── assert.h │ ├── conio.h │ ├── ctype.h │ ├── dir.h │ ├── direct.h │ ├── dirent.h │ ├── dos.h │ ├── errno.h │ ├── excpt.h │ ├── fcntl.h │ ├── fenv.h │ ├── inttypes.h │ ├── io.h │ ├── iso646.h │ ├── limits.h │ ├── locale.h │ ├── malloc.h │ ├── math.h │ ├── mem.h │ ├── memory.h │ ├── process.h │ ├── sec_api │ │ ├── conio_s.h │ │ ├── crtdbg_s.h │ │ ├── io_s.h │ │ ├── mbstring_s.h │ │ ├── search_s.h │ │ ├── stdio_s.h │ │ ├── stdlib_s.h │ │ ├── stralign_s.h │ │ ├── string_s.h │ │ ├── sys │ │ │ └── timeb_s.h │ │ ├── tchar_s.h │ │ ├── time_s.h │ │ └── wchar_s.h │ ├── setjmp.h │ ├── share.h │ ├── signal.h │ ├── stdint.h │ ├── stdio.h │ ├── stdlib.h │ ├── string.h │ ├── sys │ │ ├── fcntl.h │ │ ├── file.h │ │ ├── locking.h │ │ ├── stat.h │ │ ├── time.h │ │ ├── timeb.h │ │ ├── types.h │ │ ├── unistd.h │ │ └── utime.h │ ├── tcc │ │ └── tcc_libm.h │ ├── tchar.h │ ├── time.h │ ├── uchar.h │ ├── unistd.h │ ├── vadefs.h │ ├── values.h │ ├── wchar.h │ ├── wctype.h │ └── winapi │ │ ├── basetsd.h │ │ ├── basetyps.h │ │ ├── guiddef.h │ │ ├── poppack.h │ │ ├── pshpack1.h │ │ ├── pshpack2.h │ │ ├── pshpack4.h │ │ ├── pshpack8.h │ │ ├── qos.h │ │ ├── shellapi.h │ │ ├── winbase.h │ │ ├── wincon.h │ │ ├── windef.h │ │ ├── windows.h │ │ ├── winerror.h │ │ ├── wingdi.h │ │ ├── winnls.h │ │ ├── winnt.h │ │ ├── winreg.h │ │ ├── winsock2.h │ │ ├── winuser.h │ │ ├── winver.h │ │ ├── ws2ipdef.h │ │ └── ws2tcpip.h ├── lib │ ├── chkstk.S │ ├── crt1.c │ ├── crt1w.c │ ├── crtinit.c │ ├── dllcrt1.c │ ├── dllmain.c │ ├── wincrt1.c │ └── wincrt1w.c └── tcc-win32.txt └── win64_x86_64.sh /.gitignore: -------------------------------------------------------------------------------- 1 | *.a 2 | *.o 3 | a.out 4 | tags 5 | *.exe 6 | f.c 7 | *.dll 8 | *.def 9 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | TINYCC 2 | ------ 3 | Single header C99 compiler (TCC) 4 | 5 | Entire core of TCC compiler in one file. Separate file for each target arch/platform. 6 | Arch/Platform unrelated code stripped out. 7 | 8 | Supported architectures: 9 | tcc_win64_x86_64 - 47609L LOC 10 | 11 | RATIONALE 12 | --------- 13 | 14 | It may be painful to deal with complex build systems and files may harm code navigation 15 | and/or understanding. Many people prefer single header libraries, and this is just 16 | that, entire compiler self contained and in one file. 17 | 18 | Have you ever wanted to ship a compiler inside your application? Well, now you can 19 | just do it. 20 | 21 | COMPILING 22 | --------- 23 | 24 | Bootstrap with GCC with UCRT (mingw-w64-x86_64-gcc) 25 | gcc tcc_win64_x86_64.c -o gnu_tcc.exe 26 | 27 | Self re-compile 28 | ./gnu_tcc.exe -I./win32/include -I./win32/include/winapi tcc_win64_x86_64.c -o tcc.exe 29 | ./tcc.exe -I./win32/include -I./win32/include/winapi tcc_win64_x86_64.c -o _tcc.exe 30 | 31 | UPDATING 32 | --------- 33 | Updating amalgamation to the latest git version is automated using custom scripts. 34 | 35 | win64_x86_64.sh 36 | -------------------------------------------------------------------------------- /include/float.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLOAT_H_ 2 | #define _FLOAT_H_ 3 | 4 | #define FLT_RADIX 2 5 | 6 | /* IEEE float */ 7 | #define FLT_MANT_DIG 24 8 | #define FLT_DIG 6 9 | #define FLT_ROUNDS 1 10 | #define FLT_EPSILON 1.19209290e-07F 11 | #define FLT_MIN_EXP (-125) 12 | #define FLT_MIN 1.17549435e-38F 13 | #define FLT_MIN_10_EXP (-37) 14 | #define FLT_MAX_EXP 128 15 | #define FLT_MAX 3.40282347e+38F 16 | #define FLT_MAX_10_EXP 38 17 | 18 | /* IEEE double */ 19 | #define DBL_MANT_DIG 53 20 | #define DBL_DIG 15 21 | #define DBL_EPSILON 2.2204460492503131e-16 22 | #define DBL_MIN_EXP (-1021) 23 | #define DBL_MIN 2.2250738585072014e-308 24 | #define DBL_MIN_10_EXP (-307) 25 | #define DBL_MAX_EXP 1024 26 | #define DBL_MAX 1.7976931348623157e+308 27 | #define DBL_MAX_10_EXP 308 28 | 29 | /* horrible intel long double */ 30 | #if defined __i386__ || defined __x86_64__ 31 | 32 | #define LDBL_MANT_DIG 64 33 | #define LDBL_DIG 18 34 | #define LDBL_EPSILON 1.08420217248550443401e-19L 35 | #define LDBL_MIN_EXP (-16381) 36 | #define LDBL_MIN 3.36210314311209350626e-4932L 37 | #define LDBL_MIN_10_EXP (-4931) 38 | #define LDBL_MAX_EXP 16384 39 | #define LDBL_MAX 1.18973149535723176502e+4932L 40 | #define LDBL_MAX_10_EXP 4932 41 | #define DECIMAL_DIG 21 42 | 43 | #elif defined __aarch64__ || defined __riscv 44 | /* 45 | * Use values from: 46 | * gcc -dM -E -xc /dev/null | grep LDBL | sed -e "s/__//g" 47 | */ 48 | #define LDBL_MANT_DIG 113 49 | #define LDBL_DIG 33 50 | #define LDBL_EPSILON 1.92592994438723585305597794258492732e-34L 51 | #define LDBL_MIN_EXP (-16381) 52 | #define LDBL_MIN 3.36210314311209350626267781732175260e-4932L 53 | #define LDBL_MIN_10_EXP (-4931) 54 | #define LDBL_MAX_EXP 16384 55 | #define LDBL_MAX 1.18973149535723176508575932662800702e+4932L 56 | #define LDBL_MAX_10_EXP 4932 57 | #define DECIMAL_DIG 36 58 | 59 | #else 60 | 61 | /* same as IEEE double */ 62 | #define LDBL_MANT_DIG 53 63 | #define LDBL_DIG 15 64 | #define LDBL_EPSILON 2.2204460492503131e-16L 65 | #define LDBL_MIN_EXP (-1021) 66 | #define LDBL_MIN 2.2250738585072014e-308L 67 | #define LDBL_MIN_10_EXP (-307) 68 | #define LDBL_MAX_EXP 1024 69 | #define LDBL_MAX 1.7976931348623157e+308L 70 | #define LDBL_MAX_10_EXP 308 71 | #define DECIMAL_DIG 17 72 | 73 | #endif 74 | 75 | #endif /* _FLOAT_H_ */ 76 | -------------------------------------------------------------------------------- /include/stdalign.h: -------------------------------------------------------------------------------- 1 | #ifndef _STDALIGN_H 2 | #define _STDALIGN_H 3 | 4 | #if __STDC_VERSION__ < 201112L && (defined(__GNUC__) || defined(__TINYC__)) 5 | # define _Alignas(t) __attribute__((__aligned__(t))) 6 | # define _Alignof(t) __alignof__(t) 7 | #endif 8 | 9 | #define alignas _Alignas 10 | #define alignof _Alignof 11 | 12 | #define __alignas_is_defined 1 13 | #define __alignof_is_defined 1 14 | 15 | #endif /* _STDALIGN_H */ 16 | 17 | -------------------------------------------------------------------------------- /include/stdarg.h: -------------------------------------------------------------------------------- 1 | #ifndef _STDARG_H 2 | #define _STDARG_H 3 | 4 | typedef __builtin_va_list va_list; 5 | #define va_start __builtin_va_start 6 | #define va_arg __builtin_va_arg 7 | #define va_copy __builtin_va_copy 8 | #define va_end __builtin_va_end 9 | 10 | /* fix a buggy dependency on GCC in libio.h */ 11 | typedef va_list __gnuc_va_list; 12 | #define _VA_LIST_DEFINED 13 | 14 | #endif /* _STDARG_H */ 15 | -------------------------------------------------------------------------------- /include/stdatomic.h: -------------------------------------------------------------------------------- 1 | /* This file is derived from clang's stdatomic.h */ 2 | 3 | /*===---- stdatomic.h - Standard header for atomic types and operations -----=== 4 | * 5 | * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 6 | * See https://llvm.org/LICENSE.txt for license information. 7 | * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 8 | * 9 | *===-----------------------------------------------------------------------=== 10 | */ 11 | 12 | #ifndef _STDATOMIC_H 13 | #define _STDATOMIC_H 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | #define __ATOMIC_RELAXED 0 20 | #define __ATOMIC_CONSUME 1 21 | #define __ATOMIC_ACQUIRE 2 22 | #define __ATOMIC_RELEASE 3 23 | #define __ATOMIC_ACQ_REL 4 24 | #define __ATOMIC_SEQ_CST 5 25 | 26 | /* Memory ordering */ 27 | typedef enum { 28 | memory_order_relaxed = __ATOMIC_RELAXED, 29 | memory_order_consume = __ATOMIC_CONSUME, 30 | memory_order_acquire = __ATOMIC_ACQUIRE, 31 | memory_order_release = __ATOMIC_RELEASE, 32 | memory_order_acq_rel = __ATOMIC_ACQ_REL, 33 | memory_order_seq_cst = __ATOMIC_SEQ_CST, 34 | } memory_order; 35 | 36 | /* Atomic typedefs */ 37 | typedef _Atomic(_Bool) atomic_bool; 38 | typedef _Atomic(char) atomic_char; 39 | typedef _Atomic(signed char) atomic_schar; 40 | typedef _Atomic(unsigned char) atomic_uchar; 41 | typedef _Atomic(short) atomic_short; 42 | typedef _Atomic(unsigned short) atomic_ushort; 43 | typedef _Atomic(int) atomic_int; 44 | typedef _Atomic(unsigned int) atomic_uint; 45 | typedef _Atomic(long) atomic_long; 46 | typedef _Atomic(unsigned long) atomic_ulong; 47 | typedef _Atomic(long long) atomic_llong; 48 | typedef _Atomic(unsigned long long) atomic_ullong; 49 | typedef _Atomic(uint_least16_t) atomic_char16_t; 50 | typedef _Atomic(uint_least32_t) atomic_char32_t; 51 | typedef _Atomic(wchar_t) atomic_wchar_t; 52 | typedef _Atomic(int_least8_t) atomic_int_least8_t; 53 | typedef _Atomic(uint_least8_t) atomic_uint_least8_t; 54 | typedef _Atomic(int_least16_t) atomic_int_least16_t; 55 | typedef _Atomic(uint_least16_t) atomic_uint_least16_t; 56 | typedef _Atomic(int_least32_t) atomic_int_least32_t; 57 | typedef _Atomic(uint_least32_t) atomic_uint_least32_t; 58 | typedef _Atomic(int_least64_t) atomic_int_least64_t; 59 | typedef _Atomic(uint_least64_t) atomic_uint_least64_t; 60 | typedef _Atomic(int_fast8_t) atomic_int_fast8_t; 61 | typedef _Atomic(uint_fast8_t) atomic_uint_fast8_t; 62 | typedef _Atomic(int_fast16_t) atomic_int_fast16_t; 63 | typedef _Atomic(uint_fast16_t) atomic_uint_fast16_t; 64 | typedef _Atomic(int_fast32_t) atomic_int_fast32_t; 65 | typedef _Atomic(uint_fast32_t) atomic_uint_fast32_t; 66 | typedef _Atomic(int_fast64_t) atomic_int_fast64_t; 67 | typedef _Atomic(uint_fast64_t) atomic_uint_fast64_t; 68 | typedef _Atomic(intptr_t) atomic_intptr_t; 69 | typedef _Atomic(uintptr_t) atomic_uintptr_t; 70 | typedef _Atomic(size_t) atomic_size_t; 71 | typedef _Atomic(ptrdiff_t) atomic_ptrdiff_t; 72 | typedef _Atomic(intmax_t) atomic_intmax_t; 73 | typedef _Atomic(uintmax_t) atomic_uintmax_t; 74 | 75 | /* Atomic flag */ 76 | typedef struct { 77 | atomic_bool value; 78 | } atomic_flag; 79 | 80 | #define ATOMIC_FLAG_INIT {0} 81 | #define ATOMIC_VAR_INIT(value) (value) 82 | 83 | #define atomic_flag_test_and_set_explicit(object, order) \ 84 | __atomic_test_and_set((void *)(&((object)->value)), order) 85 | #define atomic_flag_test_and_set(object) \ 86 | atomic_flag_test_and_set_explicit(object, __ATOMIC_SEQ_CST) 87 | 88 | #define atomic_flag_clear_explicit(object, order) \ 89 | __atomic_clear((bool *)(&((object)->value)), order) 90 | #define atomic_flag_clear(object) \ 91 | atomic_flag_clear_explicit(object, __ATOMIC_SEQ_CST) 92 | 93 | /* Generic routines */ 94 | #define atomic_init(object, desired) \ 95 | atomic_store_explicit(object, desired, __ATOMIC_RELAXED) 96 | 97 | #define atomic_store_explicit(object, desired, order) \ 98 | ({ __typeof__ (object) ptr = (object); \ 99 | __typeof__ (*ptr) tmp = (desired); \ 100 | __atomic_store (ptr, &tmp, (order)); \ 101 | }) 102 | #define atomic_store(object, desired) \ 103 | atomic_store_explicit (object, desired, __ATOMIC_SEQ_CST) 104 | 105 | #define atomic_load_explicit(object, order) \ 106 | ({ __typeof__ (object) ptr = (object); \ 107 | __typeof__ (*ptr) tmp; \ 108 | __atomic_load (ptr, &tmp, (order)); \ 109 | tmp; \ 110 | }) 111 | #define atomic_load(object) atomic_load_explicit (object, __ATOMIC_SEQ_CST) 112 | 113 | #define atomic_exchange_explicit(object, desired, order) \ 114 | ({ __typeof__ (object) ptr = (object); \ 115 | __typeof__ (*ptr) val = (desired); \ 116 | __typeof__ (*ptr) tmp; \ 117 | __atomic_exchange (ptr, &val, &tmp, (order)); \ 118 | tmp; \ 119 | }) 120 | #define atomic_exchange(object, desired) \ 121 | atomic_exchange_explicit (object, desired, __ATOMIC_SEQ_CST) 122 | 123 | #define atomic_compare_exchange_strong_explicit(object, expected, desired, success, failure) \ 124 | ({ __typeof__ (object) ptr = (object); \ 125 | __typeof__ (*ptr) tmp = desired; \ 126 | __atomic_compare_exchange(ptr, expected, &tmp, 0, success, failure); \ 127 | }) 128 | #define atomic_compare_exchange_strong(object, expected, desired) \ 129 | atomic_compare_exchange_strong_explicit (object, expected, desired, \ 130 | __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST) 131 | 132 | #define atomic_compare_exchange_weak_explicit(object, expected, desired, success, failure) \ 133 | ({ __typeof__ (object) ptr = (object); \ 134 | __typeof__ (*ptr) tmp = desired; \ 135 | __atomic_compare_exchange(ptr, expected, &tmp, 1, success, failure); \ 136 | }) 137 | #define atomic_compare_exchange_weak(object, expected, desired) \ 138 | atomic_compare_exchange_weak_explicit (object, expected, desired, \ 139 | __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST) 140 | 141 | #define atomic_fetch_add(object, operand) \ 142 | __atomic_fetch_add(object, operand, __ATOMIC_SEQ_CST) 143 | #define atomic_fetch_add_explicit __atomic_fetch_add 144 | 145 | #define atomic_fetch_sub(object, operand) \ 146 | __atomic_fetch_sub(object, operand, __ATOMIC_SEQ_CST) 147 | #define atomic_fetch_sub_explicit __atomic_fetch_sub 148 | 149 | #define atomic_fetch_or(object, operand) \ 150 | __atomic_fetch_or(object, operand, __ATOMIC_SEQ_CST) 151 | #define atomic_fetch_or_explicit __atomic_fetch_or 152 | 153 | #define atomic_fetch_xor(object, operand) \ 154 | __atomic_fetch_xor(object, operand, __ATOMIC_SEQ_CST) 155 | #define atomic_fetch_xor_explicit __atomic_fetch_xor 156 | 157 | #define atomic_fetch_and(object, operand) \ 158 | __atomic_fetch_and(object, operand, __ATOMIC_SEQ_CST) 159 | #define atomic_fetch_and_explicit __atomic_fetch_and 160 | 161 | extern void atomic_thread_fence (memory_order); 162 | extern void __atomic_thread_fence (memory_order); 163 | #define atomic_thread_fence(order) __atomic_thread_fence (order) 164 | extern void atomic_signal_fence (memory_order); 165 | extern void __atomic_signal_fence (memory_order); 166 | #define atomic_signal_fence(order) __atomic_signal_fence (order) 167 | extern bool __atomic_is_lock_free(size_t size, void *ptr); 168 | #define atomic_is_lock_free(OBJ) __atomic_is_lock_free (sizeof (*(OBJ)), (OBJ)) 169 | 170 | extern bool __atomic_test_and_set (void *, memory_order); 171 | extern void __atomic_clear (bool *, memory_order); 172 | 173 | #endif /* _STDATOMIC_H */ 174 | -------------------------------------------------------------------------------- /include/stdbool.h: -------------------------------------------------------------------------------- 1 | #ifndef _STDBOOL_H 2 | #define _STDBOOL_H 3 | 4 | /* ISOC99 boolean */ 5 | 6 | #define bool _Bool 7 | #define true 1 8 | #define false 0 9 | #define __bool_true_false_are_defined 1 10 | 11 | #endif /* _STDBOOL_H */ 12 | -------------------------------------------------------------------------------- /include/stddef.h: -------------------------------------------------------------------------------- 1 | #ifndef _STDDEF_H 2 | #define _STDDEF_H 3 | 4 | typedef __SIZE_TYPE__ size_t; 5 | typedef __PTRDIFF_TYPE__ ssize_t; 6 | typedef __WCHAR_TYPE__ wchar_t; 7 | typedef __PTRDIFF_TYPE__ ptrdiff_t; 8 | typedef __PTRDIFF_TYPE__ intptr_t; 9 | typedef __SIZE_TYPE__ uintptr_t; 10 | 11 | #if __STDC_VERSION__ >= 201112L 12 | typedef union { long long __ll; long double __ld; } max_align_t; 13 | #endif 14 | 15 | #ifndef NULL 16 | #define NULL ((void*)0) 17 | #endif 18 | 19 | #undef offsetof 20 | #define offsetof(type, field) ((size_t)&((type *)0)->field) 21 | 22 | #if defined __i386__ || defined __x86_64__ 23 | void *alloca(size_t size); 24 | #endif 25 | 26 | #endif 27 | 28 | /* Older glibc require a wint_t from (when requested 29 | by __need_wint_t, as otherwise stddef.h isn't allowed to 30 | define this type). Note that this must be outside the normal 31 | _STDDEF_H guard, so that it works even when we've included the file 32 | already (without requiring wint_t). Some other libs define _WINT_T 33 | if they've already provided that type, so we can use that as guard. 34 | TCC defines __WINT_TYPE__ for us. */ 35 | #if defined (__need_wint_t) 36 | #ifndef _WINT_T 37 | #define _WINT_T 38 | typedef __WINT_TYPE__ wint_t; 39 | #endif 40 | #undef __need_wint_t 41 | #endif 42 | -------------------------------------------------------------------------------- /include/stdnoreturn.h: -------------------------------------------------------------------------------- 1 | #ifndef _STDNORETURN_H 2 | #define _STDNORETURN_H 3 | 4 | /* ISOC11 noreturn */ 5 | #define noreturn _Noreturn 6 | 7 | #endif /* _STDNORETURN_H */ 8 | -------------------------------------------------------------------------------- /include/tgmath.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ISO C Standard: 7.22 Type-generic math 3 | */ 4 | 5 | #ifndef _TGMATH_H 6 | #define _TGMATH_H 7 | 8 | #include 9 | 10 | #ifndef __cplusplus 11 | #define __tgmath_real(x, F) \ 12 | _Generic ((x), float: F##f, long double: F##l, default: F)(x) 13 | #define __tgmath_real_2_1(x, y, F) \ 14 | _Generic ((x), float: F##f, long double: F##l, default: F)(x, y) 15 | #define __tgmath_real_2(x, y, F) \ 16 | _Generic ((x)+(y), float: F##f, long double: F##l, default: F)(x, y) 17 | #define __tgmath_real_3_2(x, y, z, F) \ 18 | _Generic ((x)+(y), float: F##f, long double: F##l, default: F)(x, y, z) 19 | #define __tgmath_real_3(x, y, z, F) \ 20 | _Generic ((x)+(y)+(z), float: F##f, long double: F##l, default: F)(x, y, z) 21 | 22 | /* Functions defined in both and (7.22p4) */ 23 | #define acos(z) __tgmath_real(z, acos) 24 | #define asin(z) __tgmath_real(z, asin) 25 | #define atan(z) __tgmath_real(z, atan) 26 | #define acosh(z) __tgmath_real(z, acosh) 27 | #define asinh(z) __tgmath_real(z, asinh) 28 | #define atanh(z) __tgmath_real(z, atanh) 29 | #define cos(z) __tgmath_real(z, cos) 30 | #define sin(z) __tgmath_real(z, sin) 31 | #define tan(z) __tgmath_real(z, tan) 32 | #define cosh(z) __tgmath_real(z, cosh) 33 | #define sinh(z) __tgmath_real(z, sinh) 34 | #define tanh(z) __tgmath_real(z, tanh) 35 | #define exp(z) __tgmath_real(z, exp) 36 | #define log(z) __tgmath_real(z, log) 37 | #define pow(z1,z2) __tgmath_real_2(z1, z2, pow) 38 | #define sqrt(z) __tgmath_real(z, sqrt) 39 | #define fabs(z) __tgmath_real(z, fabs) 40 | 41 | /* Functions defined in only (7.22p5) */ 42 | #define atan2(x,y) __tgmath_real_2(x, y, atan2) 43 | #define cbrt(x) __tgmath_real(x, cbrt) 44 | #define ceil(x) __tgmath_real(x, ceil) 45 | #define copysign(x,y) __tgmath_real_2(x, y, copysign) 46 | #define erf(x) __tgmath_real(x, erf) 47 | #define erfc(x) __tgmath_real(x, erfc) 48 | #define exp2(x) __tgmath_real(x, exp2) 49 | #define expm1(x) __tgmath_real(x, expm1) 50 | #define fdim(x,y) __tgmath_real_2(x, y, fdim) 51 | #define floor(x) __tgmath_real(x, floor) 52 | #define fma(x,y,z) __tgmath_real_3(x, y, z, fma) 53 | #define fmax(x,y) __tgmath_real_2(x, y, fmax) 54 | #define fmin(x,y) __tgmath_real_2(x, y, fmin) 55 | #define fmod(x,y) __tgmath_real_2(x, y, fmod) 56 | #define frexp(x,y) __tgmath_real_2_1(x, y, frexp) 57 | #define hypot(x,y) __tgmath_real_2(x, y, hypot) 58 | #define ilogb(x) __tgmath_real(x, ilogb) 59 | #define ldexp(x,y) __tgmath_real_2_1(x, y, ldexp) 60 | #define lgamma(x) __tgmath_real(x, lgamma) 61 | #define llrint(x) __tgmath_real(x, llrint) 62 | #define llround(x) __tgmath_real(x, llround) 63 | #define log10(x) __tgmath_real(x, log10) 64 | #define log1p(x) __tgmath_real(x, log1p) 65 | #define log2(x) __tgmath_real(x, log2) 66 | #define logb(x) __tgmath_real(x, logb) 67 | #define lrint(x) __tgmath_real(x, lrint) 68 | #define lround(x) __tgmath_real(x, lround) 69 | #define nearbyint(x) __tgmath_real(x, nearbyint) 70 | #define nextafter(x,y) __tgmath_real_2(x, y, nextafter) 71 | #define nexttoward(x,y) __tgmath_real_2(x, y, nexttoward) 72 | #define remainder(x,y) __tgmath_real_2(x, y, remainder) 73 | #define remquo(x,y,z) __tgmath_real_3_2(x, y, z, remquo) 74 | #define rint(x) __tgmath_real(x, rint) 75 | #define round(x) __tgmath_real(x, round) 76 | #define scalbln(x,y) __tgmath_real_2_1(x, y, scalbln) 77 | #define scalbn(x,y) __tgmath_real_2_1(x, y, scalbn) 78 | #define tgamma(x) __tgmath_real(x, tgamma) 79 | #define trunc(x) __tgmath_real(x, trunc) 80 | 81 | /* Functions defined in only (7.22p6) 82 | #define carg(z) __tgmath_cplx_only(z, carg) 83 | #define cimag(z) __tgmath_cplx_only(z, cimag) 84 | #define conj(z) __tgmath_cplx_only(z, conj) 85 | #define cproj(z) __tgmath_cplx_only(z, cproj) 86 | #define creal(z) __tgmath_cplx_only(z, creal) 87 | */ 88 | #endif /* __cplusplus */ 89 | #endif /* _TGMATH_H */ 90 | -------------------------------------------------------------------------------- /include/varargs.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the w64 mingw-runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | #ifndef _VARARGS_H 7 | #define _VARARGS_H 8 | 9 | #error "TinyCC no longer implements ." 10 | #error "Revise your code to use ." 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /win32/build-tcc.bat: -------------------------------------------------------------------------------- 1 | @rem ------------------------------------------------------ 2 | @rem batch file to build tcc using mingw, msvc or tcc itself 3 | @rem ------------------------------------------------------ 4 | 5 | @echo off 6 | setlocal 7 | if (%1)==(-clean) goto :cleanup 8 | set CC=gcc 9 | set /p VERSION= < ..\VERSION 10 | set TCCDIR= 11 | set BINDIR= 12 | set DOC=no 13 | set XCC=no 14 | goto :a0 15 | :a2 16 | shift 17 | :a3 18 | shift 19 | :a0 20 | if not (%1)==(-c) goto :a1 21 | set CC=%~2 22 | if (%2)==(cl) set CC=@call :cl 23 | goto :a2 24 | :a1 25 | if (%1)==(-t) set T=%2&& goto :a2 26 | if (%1)==(-v) set VERSION=%~2&& goto :a2 27 | if (%1)==(-i) set TCCDIR=%2&& goto :a2 28 | if (%1)==(-b) set BINDIR=%2&& goto :a2 29 | if (%1)==(-d) set DOC=yes&& goto :a3 30 | if (%1)==(-x) set XCC=yes&& goto :a3 31 | if (%1)==() goto :p1 32 | :usage 33 | echo usage: build-tcc.bat [ options ... ] 34 | echo options: 35 | echo -c prog use prog (gcc/tcc/cl) to compile tcc 36 | echo -c "prog options" use prog with options to compile tcc 37 | echo -t 32/64 force 32/64 bit default target 38 | echo -v "version" set tcc version 39 | echo -i tccdir install tcc into tccdir 40 | echo -b bindir but install tcc.exe and libtcc.dll into bindir 41 | echo -d create tcc-doc.html too (needs makeinfo) 42 | echo -x build the cross compiler too 43 | echo -clean delete all previously produced files and directories 44 | exit /B 1 45 | 46 | @rem ------------------------------------------------------ 47 | @rem sub-routines 48 | 49 | :cleanup 50 | set LOG=echo 51 | %LOG% removing files: 52 | for %%f in (*tcc.exe libtcc.dll lib\*.a) do call :del_file %%f 53 | for %%f in (..\config.h ..\config.texi) do call :del_file %%f 54 | for %%f in (include\*.h) do @if exist ..\%%f call :del_file %%f 55 | for %%f in (include\tcclib.h examples\libtcc_test.c) do call :del_file %%f 56 | for %%f in (lib\*.o *.o *.obj *.def *.pdb *.lib *.exp *.ilk) do call :del_file %%f 57 | %LOG% removing directories: 58 | for %%f in (doc libtcc) do call :del_dir %%f 59 | %LOG% done. 60 | exit /B 0 61 | :del_file 62 | if exist %1 del %1 && %LOG% %1 63 | exit /B 0 64 | :del_dir 65 | if exist %1 rmdir /Q/S %1 && %LOG% %1 66 | exit /B 0 67 | 68 | :cl 69 | @echo off 70 | set CMD=cl 71 | :c0 72 | set ARG=%1 73 | set ARG=%ARG:.dll=.lib% 74 | if (%1)==(-shared) set ARG=-LD 75 | if (%1)==(-o) shift && set ARG=-Fe%2 76 | set CMD=%CMD% %ARG% 77 | shift 78 | if not (%1)==() goto :c0 79 | echo on 80 | %CMD% -O2 -W2 -Zi -MT -GS- -nologo %DEF_GITHASH% -link -opt:ref,icf 81 | @exit /B %ERRORLEVEL% 82 | 83 | @rem ------------------------------------------------------ 84 | @rem main program 85 | 86 | :p1 87 | if not %T%_==_ goto :p2 88 | set T=32 89 | if %PROCESSOR_ARCHITECTURE%_==AMD64_ set T=64 90 | if %PROCESSOR_ARCHITEW6432%_==AMD64_ set T=64 91 | :p2 92 | if "%CC:~-3%"=="gcc" set CC=%CC% -O2 -s -static 93 | if (%BINDIR%)==() set BINDIR=%TCCDIR% 94 | 95 | set D32=-DTCC_TARGET_PE -DTCC_TARGET_I386 96 | set D64=-DTCC_TARGET_PE -DTCC_TARGET_X86_64 97 | set P32=i386-win32 98 | set P64=x86_64-win32 99 | 100 | if %T%==64 goto :t64 101 | set D=%D32% 102 | set P=%P32% 103 | set DX=%D64% 104 | set PX=%P64% 105 | set TX=64 106 | goto :p3 107 | 108 | :t64 109 | set D=%D64% 110 | set P=%P64% 111 | set DX=%D32% 112 | set PX=%P32% 113 | set TX=32 114 | goto :p3 115 | 116 | :p3 117 | git.exe --version 2>nul 118 | if not %ERRORLEVEL%==0 goto :git_done 119 | for /f %%b in ('git.exe rev-parse --abbrev-ref HEAD') do set GITHASH=%%b 120 | for /f %%b in ('git.exe log -1 "--pretty=format:%%cs_%GITHASH%@%%h"') do set GITHASH=%%b 121 | git.exe diff --quiet 122 | if %ERRORLEVEL%==1 set GITHASH=%GITHASH%* 123 | :git_done 124 | @echo on 125 | 126 | :config.h 127 | echo>..\config.h #define TCC_VERSION "%VERSION%" 128 | if not (%GITHASH%)==() echo>> ..\config.h #define TCC_GITHASH "%GITHASH%" 129 | @if not (%BINDIR%)==(%TCCDIR%) echo>> ..\config.h #define CONFIG_TCCDIR "%TCCDIR:\=/%" 130 | if %TX%==64 echo>> ..\config.h #ifdef TCC_TARGET_X86_64 131 | if %TX%==32 echo>> ..\config.h #ifdef TCC_TARGET_I386 132 | echo>> ..\config.h #define CONFIG_TCC_CROSSPREFIX "%PX%-" 133 | echo>> ..\config.h #endif 134 | 135 | for %%f in (*tcc.exe *tcc.dll) do @del %%f 136 | 137 | @if _%TCC_C%_==__ goto compiler_2parts 138 | @rem if TCC_C was defined then build only tcc.exe 139 | %CC% -o tcc.exe %TCC_C% %D% 140 | @if errorlevel 1 goto :the_end 141 | @goto :compiler_done 142 | 143 | :compiler_2parts 144 | @if _%LIBTCC_C%_==__ set LIBTCC_C=..\libtcc.c 145 | %CC% -o libtcc.dll -shared %LIBTCC_C% %D% -DLIBTCC_AS_DLL 146 | @if errorlevel 1 goto :the_end 147 | %CC% -o tcc.exe ..\tcc.c libtcc.dll %D% -DONE_SOURCE"=0" 148 | @if errorlevel 1 goto :the_end 149 | if not _%XCC%_==_yes_ goto :compiler_done 150 | %CC% -o %PX%-tcc.exe ..\tcc.c %DX% 151 | @if errorlevel 1 goto :the_end 152 | :compiler_done 153 | @if (%EXES_ONLY%)==(yes) goto :files_done 154 | 155 | if not exist libtcc mkdir libtcc 156 | if not exist doc mkdir doc 157 | copy>nul ..\include\*.h include 158 | copy>nul ..\tcclib.h include 159 | copy>nul ..\libtcc.h libtcc 160 | copy>nul ..\tests\libtcc_test.c examples 161 | copy>nul tcc-win32.txt doc 162 | 163 | if exist libtcc.dll .\tcc -impdef libtcc.dll -o libtcc\libtcc.def 164 | @if errorlevel 1 goto :the_end 165 | 166 | :lib 167 | call :make_lib %T% || goto :the_end 168 | @if exist %PX%-tcc.exe call :make_lib %TX% %PX%- || goto :the_end 169 | 170 | :tcc-doc.html 171 | @if not (%DOC%)==(yes) goto :doc-done 172 | echo>..\config.texi @set VERSION %VERSION% 173 | cmd /c makeinfo --html --no-split ../tcc-doc.texi -o doc/tcc-doc.html 174 | :doc-done 175 | 176 | :files_done 177 | for %%f in (*.o *.def) do @del %%f 178 | 179 | :copy-install 180 | @if (%TCCDIR%)==() goto :the_end 181 | if not exist %BINDIR% mkdir %BINDIR% 182 | for %%f in (*tcc.exe *tcc.dll) do @copy>nul %%f %BINDIR%\%%f 183 | if not exist %TCCDIR% mkdir %TCCDIR% 184 | @if not exist %TCCDIR%\lib mkdir %TCCDIR%\lib 185 | for %%f in (lib\*.a lib\*.o lib\*.def) do @copy>nul %%f %TCCDIR%\%%f 186 | for %%f in (include examples libtcc doc) do @xcopy>nul /s/i/q/y %%f %TCCDIR%\%%f 187 | 188 | :the_end 189 | exit /B %ERRORLEVEL% 190 | 191 | :make_lib 192 | .\tcc -B. -m%1 -c ../lib/libtcc1.c 193 | .\tcc -B. -m%1 -c lib/crt1.c 194 | .\tcc -B. -m%1 -c lib/crt1w.c 195 | .\tcc -B. -m%1 -c lib/wincrt1.c 196 | .\tcc -B. -m%1 -c lib/wincrt1w.c 197 | .\tcc -B. -m%1 -c lib/dllcrt1.c 198 | .\tcc -B. -m%1 -c lib/dllmain.c 199 | .\tcc -B. -m%1 -c lib/chkstk.S 200 | .\tcc -B. -m%1 -c ../lib/alloca.S 201 | .\tcc -B. -m%1 -c ../lib/alloca-bt.S 202 | .\tcc -B. -m%1 -c ../lib/stdatomic.c 203 | .\tcc -B. -m%1 -c ../lib/builtin.c 204 | .\tcc -B. -m%1 -ar lib/%2libtcc1.a libtcc1.o crt1.o crt1w.o wincrt1.o wincrt1w.o dllcrt1.o dllmain.o chkstk.o alloca.o alloca-bt.o stdatomic.o builtin.o 205 | .\tcc -B. -m%1 -c ../lib/bcheck.c -o lib/%2bcheck.o -bt -I.. 206 | .\tcc -B. -m%1 -c ../lib/bt-exe.c -o lib/%2bt-exe.o 207 | .\tcc -B. -m%1 -c ../lib/bt-log.c -o lib/%2bt-log.o 208 | .\tcc -B. -m%1 -c ../lib/bt-dll.c -o lib/%2bt-dll.o 209 | .\tcc -B. -m%1 -c ../lib/runmain.c -o lib/%2runmain.o 210 | exit /B %ERRORLEVEL% 211 | -------------------------------------------------------------------------------- /win32/examples/dll.c: -------------------------------------------------------------------------------- 1 | //+--------------------------------------------------------------------------- 2 | // 3 | // dll.c - Windows DLL example - dynamically linked part 4 | // 5 | 6 | #include 7 | 8 | __declspec(dllexport) const char *hello_data = "(not set)"; 9 | 10 | __declspec(dllexport) void hello_func (void) 11 | { 12 | MessageBox (0, hello_data, "From DLL", MB_ICONINFORMATION); 13 | } 14 | -------------------------------------------------------------------------------- /win32/examples/fib.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include // atoi() 3 | 4 | int fib(n) 5 | { 6 | if (n <= 2) 7 | return 1; 8 | else 9 | return fib(n-1) + fib(n-2); 10 | } 11 | 12 | int main(int argc, char **argv) 13 | { 14 | int n; 15 | if (argc < 2) { 16 | printf("usage: fib n\n" 17 | "Compute nth Fibonacci number\n"); 18 | return 1; 19 | } 20 | 21 | n = atoi(argv[1]); 22 | printf("fib(%d) = %d\n", n, fib(n)); 23 | return 0; 24 | } 25 | -------------------------------------------------------------------------------- /win32/examples/hello_dll.c: -------------------------------------------------------------------------------- 1 | //+--------------------------------------------------------------------------- 2 | // 3 | // HELLO_DLL.C - Windows DLL example - main application part 4 | // 5 | 6 | #include 7 | 8 | void hello_func (void); 9 | __declspec(dllimport) extern const char *hello_data; 10 | 11 | int WINAPI WinMain( 12 | HINSTANCE hInstance, 13 | HINSTANCE hPrevInstance, 14 | LPSTR lpCmdLine, 15 | int nCmdShow) 16 | { 17 | hello_data = "Hello World!"; 18 | hello_func(); 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /win32/examples/hello_win.c: -------------------------------------------------------------------------------- 1 | //+--------------------------------------------------------------------------- 2 | // 3 | // HELLO_WIN.C - Windows GUI 'Hello World!' Example 4 | // 5 | //+--------------------------------------------------------------------------- 6 | 7 | #include 8 | 9 | #define APPNAME "HELLO_WIN" 10 | 11 | char szAppName[] = APPNAME; // The name of this application 12 | char szTitle[] = APPNAME; // The title bar text 13 | const char *pWindowText; 14 | 15 | void CenterWindow(HWND hWnd); 16 | 17 | //+--------------------------------------------------------------------------- 18 | // 19 | // Function: WndProc 20 | // 21 | // Synopsis: very unusual type of function - gets called by system to 22 | // process windows messages. 23 | // 24 | // Arguments: same as always. 25 | //---------------------------------------------------------------------------- 26 | 27 | LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) 28 | { 29 | switch (message) { 30 | 31 | // ----------------------- first and last 32 | case WM_CREATE: 33 | CenterWindow(hwnd); 34 | break; 35 | 36 | case WM_DESTROY: 37 | PostQuitMessage(0); 38 | break; 39 | 40 | // ----------------------- get out of it... 41 | case WM_RBUTTONUP: 42 | DestroyWindow(hwnd); 43 | break; 44 | 45 | case WM_KEYDOWN: 46 | if (VK_ESCAPE == wParam) 47 | DestroyWindow(hwnd); 48 | break; 49 | 50 | // ----------------------- display our minimal info 51 | case WM_PAINT: 52 | { 53 | PAINTSTRUCT ps; 54 | HDC hdc; 55 | RECT rc; 56 | hdc = BeginPaint(hwnd, &ps); 57 | 58 | GetClientRect(hwnd, &rc); 59 | SetTextColor(hdc, RGB(240,240,96)); 60 | SetBkMode(hdc, TRANSPARENT); 61 | DrawText(hdc, pWindowText, -1, &rc, DT_CENTER|DT_SINGLELINE|DT_VCENTER); 62 | 63 | EndPaint(hwnd, &ps); 64 | break; 65 | } 66 | 67 | // ----------------------- let windows do all other stuff 68 | default: 69 | return DefWindowProc(hwnd, message, wParam, lParam); 70 | } 71 | return 0; 72 | } 73 | 74 | //+--------------------------------------------------------------------------- 75 | // 76 | // Function: WinMain 77 | // 78 | // Synopsis: standard entrypoint for GUI Win32 apps 79 | // 80 | //---------------------------------------------------------------------------- 81 | int APIENTRY WinMain( 82 | HINSTANCE hInstance, 83 | HINSTANCE hPrevInstance, 84 | LPSTR lpCmdLine, 85 | int nCmdShow 86 | ) 87 | { 88 | MSG msg; 89 | WNDCLASS wc; 90 | HWND hwnd; 91 | 92 | pWindowText = lpCmdLine[0] ? lpCmdLine : "Hello Windows!"; 93 | 94 | // Fill in window class structure with parameters that describe 95 | // the main window. 96 | 97 | ZeroMemory(&wc, sizeof wc); 98 | wc.hInstance = hInstance; 99 | wc.lpszClassName = szAppName; 100 | wc.lpfnWndProc = (WNDPROC)WndProc; 101 | wc.style = CS_DBLCLKS|CS_VREDRAW|CS_HREDRAW; 102 | wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); 103 | wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); 104 | wc.hCursor = LoadCursor(NULL, IDC_ARROW); 105 | 106 | if (FALSE == RegisterClass(&wc)) 107 | return 0; 108 | 109 | // create the browser 110 | hwnd = CreateWindow( 111 | szAppName, 112 | szTitle, 113 | WS_OVERLAPPEDWINDOW|WS_VISIBLE, 114 | CW_USEDEFAULT, 115 | CW_USEDEFAULT, 116 | 360,//CW_USEDEFAULT, 117 | 240,//CW_USEDEFAULT, 118 | 0, 119 | 0, 120 | hInstance, 121 | 0); 122 | 123 | if (NULL == hwnd) 124 | return 0; 125 | 126 | // Main message loop: 127 | while (GetMessage(&msg, NULL, 0, 0) > 0) { 128 | TranslateMessage(&msg); 129 | DispatchMessage(&msg); 130 | } 131 | 132 | return msg.wParam; 133 | } 134 | 135 | //+--------------------------------------------------------------------------- 136 | 137 | //+--------------------------------------------------------------------------- 138 | 139 | void CenterWindow(HWND hwnd_self) 140 | { 141 | HWND hwnd_parent; 142 | RECT rw_self, rc_parent, rw_parent; 143 | int xpos, ypos; 144 | 145 | hwnd_parent = GetParent(hwnd_self); 146 | if (NULL == hwnd_parent) 147 | hwnd_parent = GetDesktopWindow(); 148 | 149 | GetWindowRect(hwnd_parent, &rw_parent); 150 | GetClientRect(hwnd_parent, &rc_parent); 151 | GetWindowRect(hwnd_self, &rw_self); 152 | 153 | xpos = rw_parent.left + (rc_parent.right + rw_self.left - rw_self.right) / 2; 154 | ypos = rw_parent.top + (rc_parent.bottom + rw_self.top - rw_self.bottom) / 2; 155 | 156 | SetWindowPos( 157 | hwnd_self, NULL, 158 | xpos, ypos, 0, 0, 159 | SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE 160 | ); 161 | } 162 | 163 | //+--------------------------------------------------------------------------- 164 | -------------------------------------------------------------------------------- /win32/include/_mingw.h: -------------------------------------------------------------------------------- 1 | /* 2 | * _mingw.h 3 | * 4 | * This file is for TinyCC and not part of the Mingw32 package. 5 | * 6 | * THIS SOFTWARE IS NOT COPYRIGHTED 7 | * 8 | * This source code is offered for use in the public domain. You may 9 | * use, modify or distribute it freely. 10 | * 11 | * This code is distributed in the hope that it will be useful but 12 | * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY 13 | * DISCLAIMED. This includes but is not limited to warranties of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | * 16 | */ 17 | 18 | #ifndef __MINGW_H 19 | #define __MINGW_H 20 | 21 | /* some winapi files define these before including _mingw.h --> */ 22 | #undef __cdecl 23 | #undef _X86_ 24 | #undef WIN32 25 | /* <-- */ 26 | 27 | #include 28 | #include 29 | 30 | #define __int8 char 31 | #define __int16 short 32 | #define __int32 int 33 | #define __int64 long long 34 | #define _HAVE_INT64 35 | 36 | #define __cdecl 37 | #define __declspec(x) __attribute__((x)) 38 | #define __unaligned __attribute__((packed)) 39 | #define __fastcall __attribute__((fastcall)) 40 | 41 | #define __MSVCRT__ 1 42 | #undef _MSVCRT_ 43 | #define __MINGW_IMPORT extern __declspec(dllimport) 44 | #define __MINGW_ATTRIB_NORETURN __declspec(noreturn) 45 | #define __MINGW_ATTRIB_CONST 46 | #define __MINGW_ATTRIB_DEPRECATED 47 | #define __MINGW_ATTRIB_MALLOC 48 | #define __MINGW_ATTRIB_PURE 49 | #define __MINGW_ATTRIB_NONNULL(arg) 50 | #define __MINGW_NOTHROW 51 | #define __GNUC_VA_LIST 52 | 53 | #define _CRTIMP extern 54 | #define __CRT_INLINE static __inline__ 55 | 56 | #define _CRT_ALIGN(x) __attribute__((aligned(x))) 57 | #define DECLSPEC_ALIGN(x) __attribute__((aligned(x))) 58 | #define _CRT_PACKING 8 59 | #define __CRT_UNALIGNED 60 | #define _CONST_RETURN 61 | 62 | #ifndef _TRUNCATE 63 | #define _TRUNCATE ((size_t)-1) 64 | #endif 65 | 66 | #define __CRT_STRINGIZE(_Value) #_Value 67 | #define _CRT_STRINGIZE(_Value) __CRT_STRINGIZE(_Value) 68 | #define __CRT_WIDE(_String) L ## _String 69 | #define _CRT_WIDE(_String) __CRT_WIDE(_String) 70 | 71 | #ifdef _WIN64 72 | #define __stdcall 73 | #define _AMD64_ 1 74 | #define __x86_64 1 75 | #define _M_X64 100 /* Visual Studio */ 76 | #define _M_AMD64 100 /* Visual Studio */ 77 | #define USE_MINGW_SETJMP_TWO_ARGS 78 | #define mingw_getsp tinyc_getbp 79 | #else 80 | #define __stdcall __attribute__((__stdcall__)) 81 | #define _X86_ 1 82 | #define _M_IX86 300 /* Visual Studio */ 83 | #ifndef __MINGW_USE_VC2005_COMPAT /* time became 64, but not timeval.tv_sec */ 84 | # ifndef _USE_32BIT_TIME_T 85 | # define _USE_32BIT_TIME_T 86 | # endif 87 | #endif 88 | #endif 89 | 90 | /* in stddef.h */ 91 | #define _SIZE_T_DEFINED 92 | #define _SSIZE_T_DEFINED 93 | #define _PTRDIFF_T_DEFINED 94 | #define _WCHAR_T_DEFINED 95 | #define _UINTPTR_T_DEFINED 96 | #define _INTPTR_T_DEFINED 97 | #define _INTEGRAL_MAX_BITS 64 98 | 99 | #ifndef _TIME32_T_DEFINED 100 | #define _TIME32_T_DEFINED 101 | typedef long __time32_t; 102 | #endif 103 | 104 | #ifndef _TIME64_T_DEFINED 105 | #define _TIME64_T_DEFINED 106 | typedef long long __time64_t; 107 | #endif 108 | 109 | #ifndef _TIME_T_DEFINED 110 | #define _TIME_T_DEFINED 111 | #ifdef _USE_32BIT_TIME_T 112 | typedef __time32_t time_t; 113 | #else 114 | typedef __time64_t time_t; 115 | #endif 116 | #endif 117 | 118 | #ifndef _WCTYPE_T_DEFINED 119 | #define _WCTYPE_T_DEFINED 120 | typedef wchar_t wctype_t; 121 | #endif 122 | 123 | #ifndef _WINT_T 124 | #define _WINT_T 125 | typedef __WINT_TYPE__ wint_t; 126 | #endif 127 | 128 | typedef int errno_t; 129 | #define _ERRCODE_DEFINED 130 | 131 | typedef struct threadlocaleinfostruct *pthreadlocinfo; 132 | typedef struct threadmbcinfostruct *pthreadmbcinfo; 133 | typedef struct localeinfo_struct _locale_tstruct,*_locale_t; 134 | 135 | /* for winapi */ 136 | #define _ANONYMOUS_UNION 137 | #define _ANONYMOUS_STRUCT 138 | #define DECLSPEC_NORETURN __declspec(noreturn) 139 | #define DECLARE_STDCALL_P(type) __stdcall type 140 | #define NOSERVICE 1 141 | #define NOMCX 1 142 | #define NOIME 1 143 | #define __INTRIN_H_ 144 | #ifndef DUMMYUNIONNAME 145 | # define DUMMYUNIONNAME 146 | # define DUMMYUNIONNAME1 147 | # define DUMMYUNIONNAME2 148 | # define DUMMYUNIONNAME3 149 | # define DUMMYUNIONNAME4 150 | # define DUMMYUNIONNAME5 151 | #endif 152 | #ifndef DUMMYSTRUCTNAME 153 | # define DUMMYSTRUCTNAME 154 | #endif 155 | #ifndef WINVER 156 | # define WINVER 0x0502 157 | #endif 158 | #ifndef _WIN32_WINNT 159 | # define _WIN32_WINNT 0x502 160 | #endif 161 | 162 | #define __C89_NAMELESS 163 | #define __MINGW_EXTENSION 164 | #define WINAPI_FAMILY_PARTITION(X) 1 165 | #define MINGW_HAS_SECURE_API 166 | #define WIN32 1 167 | 168 | #endif /* __MINGW_H */ 169 | -------------------------------------------------------------------------------- /win32/include/assert.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the w64 mingw-runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | #ifndef __ASSERT_H_ 7 | #define __ASSERT_H_ 8 | 9 | #include <_mingw.h> 10 | #ifdef __cplusplus 11 | #include 12 | #endif 13 | 14 | #ifdef NDEBUG 15 | #ifndef assert 16 | #define assert(_Expression) ((void)0) 17 | #endif 18 | #else 19 | 20 | #ifndef _CRT_TERMINATE_DEFINED 21 | #define _CRT_TERMINATE_DEFINED 22 | void __cdecl __MINGW_NOTHROW exit(int _Code) __MINGW_ATTRIB_NORETURN; 23 | _CRTIMP void __cdecl __MINGW_NOTHROW _exit(int _Code) __MINGW_ATTRIB_NORETURN; 24 | #if !defined __NO_ISOCEXT /* extern stub in static libmingwex.a */ 25 | /* C99 function name */ 26 | void __cdecl _Exit(int) __MINGW_ATTRIB_NORETURN; 27 | __CRT_INLINE __MINGW_ATTRIB_NORETURN void __cdecl _Exit(int status) 28 | { _exit(status); } 29 | #endif 30 | 31 | #pragma push_macro("abort") 32 | #undef abort 33 | void __cdecl __declspec(noreturn) abort(void); 34 | #pragma pop_macro("abort") 35 | 36 | #endif 37 | 38 | #ifdef __cplusplus 39 | extern "C" { 40 | #endif 41 | 42 | 43 | extern void __cdecl _wassert(const wchar_t *_Message,const wchar_t *_File,unsigned _Line); 44 | extern void __cdecl _assert(const char *, const char *, unsigned); 45 | 46 | #ifdef __cplusplus 47 | } 48 | #endif 49 | 50 | #ifndef assert 51 | //#define assert(_Expression) (void)((!!(_Expression)) || (_wassert(_CRT_WIDE(#_Expression),_CRT_WIDE(__FILE__),__LINE__),0)) 52 | #define assert(e) ((e) ? (void)0 : _assert(#e, __FILE__, __LINE__)) 53 | #endif 54 | 55 | #endif 56 | 57 | #if (__STDC_VERSION__ >= 201112L) && !defined(static_assert) 58 | /* C11, section 7.2: The macro static_assert expands to _Static_assert. */ 59 | #define static_assert(exp, str) _Static_assert(exp, str) 60 | #endif 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /win32/include/dir.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the w64 mingw-runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | /* 7 | * dir.h 8 | * 9 | * This file OBSOLESCENT and only provided for backward compatibility. 10 | * Please use io.h instead. 11 | * 12 | * This file is part of the Mingw32 package. 13 | * 14 | * Contributors: 15 | * Created by Colin Peters 16 | * Mumit Khan 17 | * 18 | * THIS SOFTWARE IS NOT COPYRIGHTED 19 | * 20 | * This source code is offered for use in the public domain. You may 21 | * use, modify or distribute it freely. 22 | * 23 | * This code is distributed in the hope that it will be useful but 24 | * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY 25 | * DISCLAIMED. This includes but is not limited to warranties of 26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 27 | * 28 | */ 29 | 30 | #include 31 | 32 | -------------------------------------------------------------------------------- /win32/include/direct.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the w64 mingw-runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | #ifndef _INC_DIRECT 7 | #define _INC_DIRECT 8 | 9 | #include <_mingw.h> 10 | #include 11 | 12 | #pragma pack(push,_CRT_PACKING) 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | #ifndef _DISKFREE_T_DEFINED 19 | #define _DISKFREE_T_DEFINED 20 | struct _diskfree_t { 21 | unsigned total_clusters; 22 | unsigned avail_clusters; 23 | unsigned sectors_per_cluster; 24 | unsigned bytes_per_sector; 25 | }; 26 | #endif 27 | 28 | _CRTIMP char *__cdecl _getcwd(char *_DstBuf,int _SizeInBytes); 29 | _CRTIMP char *__cdecl _getdcwd(int _Drive,char *_DstBuf,int _SizeInBytes); 30 | char *__cdecl _getdcwd_nolock(int _Drive,char *_DstBuf,int _SizeInBytes); 31 | _CRTIMP int __cdecl _chdir(const char *_Path); 32 | _CRTIMP int __cdecl _mkdir(const char *_Path); 33 | _CRTIMP int __cdecl _rmdir(const char *_Path); 34 | _CRTIMP int __cdecl _chdrive(int _Drive); 35 | _CRTIMP int __cdecl _getdrive(void); 36 | _CRTIMP unsigned long __cdecl _getdrives(void); 37 | 38 | #ifndef _GETDISKFREE_DEFINED 39 | #define _GETDISKFREE_DEFINED 40 | _CRTIMP unsigned __cdecl _getdiskfree(unsigned _Drive,struct _diskfree_t *_DiskFree); 41 | #endif 42 | 43 | #ifndef _WDIRECT_DEFINED 44 | #define _WDIRECT_DEFINED 45 | _CRTIMP wchar_t *__cdecl _wgetcwd(wchar_t *_DstBuf,int _SizeInWords); 46 | _CRTIMP wchar_t *__cdecl _wgetdcwd(int _Drive,wchar_t *_DstBuf,int _SizeInWords); 47 | wchar_t *__cdecl _wgetdcwd_nolock(int _Drive,wchar_t *_DstBuf,int _SizeInWords); 48 | _CRTIMP int __cdecl _wchdir(const wchar_t *_Path); 49 | _CRTIMP int __cdecl _wmkdir(const wchar_t *_Path); 50 | _CRTIMP int __cdecl _wrmdir(const wchar_t *_Path); 51 | #endif 52 | 53 | #ifndef NO_OLDNAMES 54 | 55 | #define diskfree_t _diskfree_t 56 | 57 | char *__cdecl getcwd(char *_DstBuf,int _SizeInBytes); 58 | int __cdecl chdir(const char *_Path); 59 | int __cdecl mkdir(const char *_Path); 60 | int __cdecl rmdir(const char *_Path); 61 | #endif 62 | 63 | #ifdef __cplusplus 64 | } 65 | #endif 66 | 67 | #pragma pack(pop) 68 | #endif 69 | -------------------------------------------------------------------------------- /win32/include/dirent.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the w64 mingw-runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | /* All the headers include this file. */ 7 | #include <_mingw.h> 8 | 9 | #ifndef __STRICT_ANSI__ 10 | 11 | #ifndef _DIRENT_H_ 12 | #define _DIRENT_H_ 13 | 14 | 15 | #pragma pack(push,_CRT_PACKING) 16 | 17 | #include 18 | 19 | #ifndef RC_INVOKED 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | struct dirent 26 | { 27 | long d_ino; /* Always zero. */ 28 | unsigned short d_reclen; /* Always zero. */ 29 | unsigned short d_namlen; /* Length of name in d_name. */ 30 | char* d_name; /* File name. */ 31 | /* NOTE: The name in the dirent structure points to the name in the 32 | * finddata_t structure in the DIR. */ 33 | }; 34 | 35 | /* 36 | * This is an internal data structure. Good programmers will not use it 37 | * except as an argument to one of the functions below. 38 | * dd_stat field is now int (was short in older versions). 39 | */ 40 | typedef struct 41 | { 42 | /* disk transfer area for this dir */ 43 | struct _finddata_t dd_dta; 44 | 45 | /* dirent struct to return from dir (NOTE: this makes this thread 46 | * safe as long as only one thread uses a particular DIR struct at 47 | * a time) */ 48 | struct dirent dd_dir; 49 | 50 | /* _findnext handle */ 51 | long dd_handle; 52 | 53 | /* 54 | * Status of search: 55 | * 0 = not started yet (next entry to read is first entry) 56 | * -1 = off the end 57 | * positive = 0 based index of next entry 58 | */ 59 | int dd_stat; 60 | 61 | /* given path for dir with search pattern (struct is extended) */ 62 | char dd_name[1]; 63 | } DIR; 64 | 65 | DIR* __cdecl opendir (const char*); 66 | struct dirent* __cdecl readdir (DIR*); 67 | int __cdecl closedir (DIR*); 68 | void __cdecl rewinddir (DIR*); 69 | long __cdecl telldir (DIR*); 70 | void __cdecl seekdir (DIR*, long); 71 | 72 | 73 | /* wide char versions */ 74 | 75 | struct _wdirent 76 | { 77 | long d_ino; /* Always zero. */ 78 | unsigned short d_reclen; /* Always zero. */ 79 | unsigned short d_namlen; /* Length of name in d_name. */ 80 | wchar_t* d_name; /* File name. */ 81 | /* NOTE: The name in the dirent structure points to the name in the * wfinddata_t structure in the _WDIR. */ 82 | }; 83 | 84 | /* 85 | * This is an internal data structure. Good programmers will not use it 86 | * except as an argument to one of the functions below. 87 | */ 88 | typedef struct 89 | { 90 | /* disk transfer area for this dir */ 91 | struct _wfinddata_t dd_dta; 92 | 93 | /* dirent struct to return from dir (NOTE: this makes this thread 94 | * safe as long as only one thread uses a particular DIR struct at 95 | * a time) */ 96 | struct _wdirent dd_dir; 97 | 98 | /* _findnext handle */ 99 | long dd_handle; 100 | 101 | /* 102 | * Status of search: 103 | * 0 = not started yet (next entry to read is first entry) 104 | * -1 = off the end 105 | * positive = 0 based index of next entry 106 | */ 107 | int dd_stat; 108 | 109 | /* given path for dir with search pattern (struct is extended) */ 110 | wchar_t dd_name[1]; 111 | } _WDIR; 112 | 113 | 114 | 115 | _WDIR* __cdecl _wopendir (const wchar_t*); 116 | struct _wdirent* __cdecl _wreaddir (_WDIR*); 117 | int __cdecl _wclosedir (_WDIR*); 118 | void __cdecl _wrewinddir (_WDIR*); 119 | long __cdecl _wtelldir (_WDIR*); 120 | void __cdecl _wseekdir (_WDIR*, long); 121 | 122 | 123 | #ifdef __cplusplus 124 | } 125 | #endif 126 | 127 | #endif /* Not RC_INVOKED */ 128 | 129 | #pragma pack(pop) 130 | 131 | #endif /* Not _DIRENT_H_ */ 132 | 133 | 134 | #endif /* Not __STRICT_ANSI__ */ 135 | 136 | -------------------------------------------------------------------------------- /win32/include/dos.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the w64 mingw-runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | #ifndef _INC_DOS 7 | #define _INC_DOS 8 | 9 | #include <_mingw.h> 10 | #include 11 | 12 | #pragma pack(push,_CRT_PACKING) 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | #ifndef _DISKFREE_T_DEFINED 19 | #define _DISKFREE_T_DEFINED 20 | 21 | struct _diskfree_t { 22 | unsigned total_clusters; 23 | unsigned avail_clusters; 24 | unsigned sectors_per_cluster; 25 | unsigned bytes_per_sector; 26 | }; 27 | #endif 28 | 29 | #define _A_NORMAL 0x00 30 | #define _A_RDONLY 0x01 31 | #define _A_HIDDEN 0x02 32 | #define _A_SYSTEM 0x04 33 | #define _A_SUBDIR 0x10 34 | #define _A_ARCH 0x20 35 | 36 | #ifndef _GETDISKFREE_DEFINED 37 | #define _GETDISKFREE_DEFINED 38 | _CRTIMP unsigned __cdecl _getdiskfree(unsigned _Drive,struct _diskfree_t *_DiskFree); 39 | #endif 40 | 41 | #if (defined(_X86_) && !defined(__x86_64)) 42 | void __cdecl _disable(void); 43 | void __cdecl _enable(void); 44 | #endif 45 | 46 | #ifndef NO_OLDNAMES 47 | #define diskfree_t _diskfree_t 48 | #endif 49 | 50 | #ifdef __cplusplus 51 | } 52 | #endif 53 | 54 | #pragma pack(pop) 55 | #endif 56 | -------------------------------------------------------------------------------- /win32/include/errno.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the w64 mingw-runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | #ifndef _INC_ERRNO 7 | #define _INC_ERRNO 8 | 9 | #include <_mingw.h> 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | #ifndef _CRT_ERRNO_DEFINED 16 | #define _CRT_ERRNO_DEFINED 17 | _CRTIMP int *__cdecl _errno(void); 18 | #define errno (*_errno()) 19 | 20 | errno_t __cdecl _set_errno(int _Value); 21 | errno_t __cdecl _get_errno(int *_Value); 22 | #endif 23 | 24 | #define EPERM 1 25 | #define ENOENT 2 26 | #define ESRCH 3 27 | #define EINTR 4 28 | #define EIO 5 29 | #define ENXIO 6 30 | #define E2BIG 7 31 | #define ENOEXEC 8 32 | #define EBADF 9 33 | #define ECHILD 10 34 | #define EAGAIN 11 35 | #define ENOMEM 12 36 | #define EACCES 13 37 | #define EFAULT 14 38 | #define EBUSY 16 39 | #define EEXIST 17 40 | #define EXDEV 18 41 | #define ENODEV 19 42 | #define ENOTDIR 20 43 | #define EISDIR 21 44 | #define ENFILE 23 45 | #define EMFILE 24 46 | #define ENOTTY 25 47 | #define EFBIG 27 48 | #define ENOSPC 28 49 | #define ESPIPE 29 50 | #define EROFS 30 51 | #define EMLINK 31 52 | #define EPIPE 32 53 | #define EDOM 33 54 | #define EDEADLK 36 55 | #define ENAMETOOLONG 38 56 | #define ENOLCK 39 57 | #define ENOSYS 40 58 | #define ENOTEMPTY 41 59 | 60 | #ifndef RC_INVOKED 61 | #if !defined(_SECURECRT_ERRCODE_VALUES_DEFINED) 62 | #define _SECURECRT_ERRCODE_VALUES_DEFINED 63 | #define EINVAL 22 64 | #define ERANGE 34 65 | #define EILSEQ 42 66 | #define STRUNCATE 80 67 | #endif 68 | #endif 69 | 70 | #define EDEADLOCK EDEADLK 71 | 72 | #ifdef __cplusplus 73 | } 74 | #endif 75 | #endif 76 | -------------------------------------------------------------------------------- /win32/include/excpt.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the w64 mingw-runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | #ifndef _INC_EXCPT 7 | #define _INC_EXCPT 8 | 9 | #include <_mingw.h> 10 | 11 | #pragma pack(push,_CRT_PACKING) 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | struct _EXCEPTION_POINTERS; 18 | 19 | #ifndef EXCEPTION_DISPOSITION 20 | #define EXCEPTION_DISPOSITION int 21 | #endif 22 | #define ExceptionContinueExecution 0 23 | #define ExceptionContinueSearch 1 24 | #define ExceptionNestedException 2 25 | #define ExceptionCollidedUnwind 3 26 | 27 | #if (defined(_X86_) && !defined(__x86_64)) 28 | struct _EXCEPTION_RECORD; 29 | struct _CONTEXT; 30 | 31 | EXCEPTION_DISPOSITION __cdecl _except_handler(struct _EXCEPTION_RECORD *_ExceptionRecord,void *_EstablisherFrame,struct _CONTEXT *_ContextRecord,void *_DispatcherContext); 32 | #elif defined(__ia64__) 33 | 34 | typedef struct _EXCEPTION_POINTERS *Exception_info_ptr; 35 | struct _EXCEPTION_RECORD; 36 | struct _CONTEXT; 37 | struct _DISPATCHER_CONTEXT; 38 | 39 | _CRTIMP EXCEPTION_DISPOSITION __cdecl __C_specific_handler (struct _EXCEPTION_RECORD *_ExceptionRecord,unsigned __int64 _MemoryStackFp,unsigned __int64 _BackingStoreFp,struct _CONTEXT *_ContextRecord,struct _DISPATCHER_CONTEXT *_DispatcherContext,unsigned __int64 _GlobalPointer); 40 | #elif defined(__x86_64) 41 | 42 | struct _EXCEPTION_RECORD; 43 | struct _CONTEXT; 44 | #endif 45 | 46 | #define GetExceptionCode _exception_code 47 | #define exception_code _exception_code 48 | #define GetExceptionInformation (struct _EXCEPTION_POINTERS *)_exception_info 49 | #define exception_info (struct _EXCEPTION_POINTERS *)_exception_info 50 | #define AbnormalTermination _abnormal_termination 51 | #define abnormal_termination _abnormal_termination 52 | 53 | unsigned long __cdecl _exception_code(void); 54 | void *__cdecl _exception_info(void); 55 | int __cdecl _abnormal_termination(void); 56 | 57 | #define EXCEPTION_EXECUTE_HANDLER 1 58 | #define EXCEPTION_CONTINUE_SEARCH 0 59 | #define EXCEPTION_CONTINUE_EXECUTION -1 60 | 61 | /* CRT stuff */ 62 | typedef void (__cdecl * _PHNDLR)(int); 63 | 64 | struct _XCPT_ACTION { 65 | unsigned long XcptNum; 66 | int SigNum; 67 | _PHNDLR XcptAction; 68 | }; 69 | 70 | extern struct _XCPT_ACTION _XcptActTab[]; 71 | extern int _XcptActTabCount; 72 | extern int _XcptActTabSize; 73 | extern int _First_FPE_Indx; 74 | extern int _Num_FPE; 75 | 76 | int __cdecl __CppXcptFilter(unsigned long _ExceptionNum,struct _EXCEPTION_POINTERS * _ExceptionPtr); 77 | int __cdecl _XcptFilter(unsigned long _ExceptionNum,struct _EXCEPTION_POINTERS * _ExceptionPtr); 78 | 79 | /* 80 | * The type of function that is expected as an exception handler to be 81 | * installed with _try1. 82 | */ 83 | typedef EXCEPTION_DISPOSITION (*PEXCEPTION_HANDLER)(struct _EXCEPTION_RECORD*, void*, struct _CONTEXT*, void*); 84 | 85 | #ifndef HAVE_NO_SEH 86 | /* 87 | * This is not entirely necessary, but it is the structure installed by 88 | * the _try1 primitive below. 89 | */ 90 | typedef struct _EXCEPTION_REGISTRATION { 91 | struct _EXCEPTION_REGISTRATION *prev; 92 | EXCEPTION_DISPOSITION (*handler)(struct _EXCEPTION_RECORD*, void*, struct _CONTEXT*, void*); 93 | } EXCEPTION_REGISTRATION, *PEXCEPTION_REGISTRATION; 94 | 95 | typedef EXCEPTION_REGISTRATION EXCEPTION_REGISTRATION_RECORD; 96 | typedef PEXCEPTION_REGISTRATION PEXCEPTION_REGISTRATION_RECORD; 97 | #endif 98 | 99 | #if (defined(_X86_) && !defined(__x86_64)) 100 | #define __try1(pHandler) \ 101 | __asm__ ("pushl %0;pushl %%fs:0;movl %%esp,%%fs:0;" : : "g" (pHandler)); 102 | 103 | #define __except1 \ 104 | __asm__ ("movl (%%esp),%%eax;movl %%eax,%%fs:0;addl $8,%%esp;" \ 105 | : : : "%eax"); 106 | #elif defined(__x86_64) 107 | #define __try1(pHandler) \ 108 | __asm__ ("pushq %0;pushq %%gs:0;movq %%rsp,%%gs:0;" : : "g" (pHandler)); 109 | 110 | #define __except1 \ 111 | __asm__ ("movq (%%rsp),%%rax;movq %%rax,%%gs:0;addq $16,%%rsp;" \ 112 | : : : "%rax"); 113 | #else 114 | #define __try1(pHandler) 115 | #define __except1 116 | #endif 117 | 118 | #ifdef __cplusplus 119 | } 120 | #endif 121 | 122 | #pragma pack(pop) 123 | #endif 124 | -------------------------------------------------------------------------------- /win32/include/fcntl.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the w64 mingw-runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | #include <_mingw.h> 7 | 8 | #include 9 | 10 | #ifndef _INC_FCNTL 11 | #define _INC_FCNTL 12 | 13 | #define _O_RDONLY 0x0000 14 | #define _O_WRONLY 0x0001 15 | #define _O_RDWR 0x0002 16 | #define _O_APPEND 0x0008 17 | #define _O_CREAT 0x0100 18 | #define _O_TRUNC 0x0200 19 | #define _O_EXCL 0x0400 20 | #define _O_TEXT 0x4000 21 | #define _O_BINARY 0x8000 22 | #define _O_WTEXT 0x10000 23 | #define _O_U16TEXT 0x20000 24 | #define _O_U8TEXT 0x40000 25 | #define _O_ACCMODE (_O_RDONLY|_O_WRONLY|_O_RDWR) 26 | 27 | #define _O_RAW _O_BINARY 28 | #define _O_NOINHERIT 0x0080 29 | #define _O_TEMPORARY 0x0040 30 | #define _O_SHORT_LIVED 0x1000 31 | 32 | #define _O_SEQUENTIAL 0x0020 33 | #define _O_RANDOM 0x0010 34 | 35 | #if !defined(NO_OLDNAMES) || defined(_POSIX) 36 | #define O_RDONLY _O_RDONLY 37 | #define O_WRONLY _O_WRONLY 38 | #define O_RDWR _O_RDWR 39 | #define O_APPEND _O_APPEND 40 | #define O_CREAT _O_CREAT 41 | #define O_TRUNC _O_TRUNC 42 | #define O_EXCL _O_EXCL 43 | #define O_TEXT _O_TEXT 44 | #define O_BINARY _O_BINARY 45 | #define O_RAW _O_BINARY 46 | #define O_TEMPORARY _O_TEMPORARY 47 | #define O_NOINHERIT _O_NOINHERIT 48 | #define O_SEQUENTIAL _O_SEQUENTIAL 49 | #define O_RANDOM _O_RANDOM 50 | #define O_ACCMODE _O_ACCMODE 51 | #endif 52 | #endif 53 | -------------------------------------------------------------------------------- /win32/include/fenv.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the w64 mingw-runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | #ifndef _FENV_H_ 7 | #define _FENV_H_ 8 | 9 | #include <_mingw.h> 10 | 11 | /* FPU status word exception flags */ 12 | #define FE_INVALID 0x01 13 | #define FE_DENORMAL 0x02 14 | #define FE_DIVBYZERO 0x04 15 | #define FE_OVERFLOW 0x08 16 | #define FE_UNDERFLOW 0x10 17 | #define FE_INEXACT 0x20 18 | #define FE_ALL_EXCEPT (FE_INVALID | FE_DENORMAL | FE_DIVBYZERO \ 19 | | FE_OVERFLOW | FE_UNDERFLOW | FE_INEXACT) 20 | 21 | /* FPU control word rounding flags */ 22 | #define FE_TONEAREST 0x0000 23 | #define FE_DOWNWARD 0x0400 24 | #define FE_UPWARD 0x0800 25 | #define FE_TOWARDZERO 0x0c00 26 | 27 | /* The MXCSR exception flags are the same as the 28 | FE flags. */ 29 | #define __MXCSR_EXCEPT_FLAG_SHIFT 0 30 | 31 | /* How much to shift FE status word exception flags 32 | to get MXCSR rounding flags, */ 33 | #define __MXCSR_ROUND_FLAG_SHIFT 3 34 | 35 | #ifndef RC_INVOKED 36 | /* 37 | For now, support only for the basic abstraction of flags that are 38 | either set or clear. fexcept_t could be structure that holds more 39 | info about the fp environment. 40 | */ 41 | typedef unsigned short fexcept_t; 42 | 43 | /* This 32-byte struct represents the entire floating point 44 | environment as stored by fnstenv or fstenv, augmented by 45 | the contents of the MXCSR register, as stored by stmxcsr 46 | (if CPU supports it). */ 47 | typedef struct 48 | { 49 | unsigned short __control_word; 50 | unsigned short __unused0; 51 | unsigned short __status_word; 52 | unsigned short __unused1; 53 | unsigned short __tag_word; 54 | unsigned short __unused2; 55 | unsigned int __ip_offset; /* instruction pointer offset */ 56 | unsigned short __ip_selector; 57 | unsigned short __opcode; 58 | unsigned int __data_offset; 59 | unsigned short __data_selector; 60 | unsigned short __unused3; 61 | unsigned int __mxcsr; /* contents of the MXCSR register */ 62 | } fenv_t; 63 | 64 | 65 | /*The C99 standard (7.6.9) allows us to define implementation-specific macros for 66 | different fp environments */ 67 | 68 | /* The default Intel x87 floating point environment (64-bit mantissa) */ 69 | #define FE_PC64_ENV ((const fenv_t *)-1) 70 | 71 | /* The floating point environment set by MSVCRT _fpreset (53-bit mantissa) */ 72 | #define FE_PC53_ENV ((const fenv_t *)-2) 73 | 74 | /* The FE_DFL_ENV macro is required by standard. 75 | fesetenv will use the environment set at app startup.*/ 76 | #define FE_DFL_ENV ((const fenv_t *) 0) 77 | 78 | #ifdef __cplusplus 79 | extern "C" { 80 | #endif 81 | 82 | /*TODO: Some of these could be inlined */ 83 | /* 7.6.2 Exception */ 84 | 85 | extern int __cdecl feclearexcept (int); 86 | extern int __cdecl fegetexceptflag (fexcept_t * flagp, int excepts); 87 | extern int __cdecl feraiseexcept (int excepts ); 88 | extern int __cdecl fesetexceptflag (const fexcept_t *, int); 89 | extern int __cdecl fetestexcept (int excepts); 90 | 91 | /* 7.6.3 Rounding */ 92 | 93 | extern int __cdecl fegetround (void); 94 | extern int __cdecl fesetround (int mode); 95 | 96 | /* 7.6.4 Environment */ 97 | 98 | extern int __cdecl fegetenv(fenv_t * envp); 99 | extern int __cdecl fesetenv(const fenv_t * ); 100 | extern int __cdecl feupdateenv(const fenv_t *); 101 | extern int __cdecl feholdexcept(fenv_t *); 102 | 103 | #ifdef __cplusplus 104 | } 105 | #endif 106 | #endif /* Not RC_INVOKED */ 107 | 108 | #endif /* ndef _FENV_H */ 109 | -------------------------------------------------------------------------------- /win32/include/inttypes.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the w64 mingw-runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | /* 7.8 Format conversion of integer types */ 7 | 8 | #ifndef _INTTYPES_H_ 9 | #define _INTTYPES_H_ 10 | 11 | #include <_mingw.h> 12 | #include 13 | #define __need_wchar_t 14 | #include 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | typedef struct { 21 | intmax_t quot; 22 | intmax_t rem; 23 | } imaxdiv_t; 24 | 25 | #if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) 26 | 27 | /* 7.8.1 Macros for format specifiers 28 | * 29 | * MS runtime does not yet understand C9x standard "ll" 30 | * length specifier. It appears to treat "ll" as "l". 31 | * The non-standard I64 length specifier causes warning in GCC, 32 | * but understood by MS runtime functions. 33 | */ 34 | 35 | /* fprintf macros for signed types */ 36 | #define PRId8 "d" 37 | #define PRId16 "d" 38 | #define PRId32 "d" 39 | #define PRId64 "I64d" 40 | 41 | #define PRIdLEAST8 "d" 42 | #define PRIdLEAST16 "d" 43 | #define PRIdLEAST32 "d" 44 | #define PRIdLEAST64 "I64d" 45 | 46 | #define PRIdFAST8 "d" 47 | #define PRIdFAST16 "d" 48 | #define PRIdFAST32 "d" 49 | #define PRIdFAST64 "I64d" 50 | 51 | #define PRIdMAX "I64d" 52 | 53 | #define PRIi8 "i" 54 | #define PRIi16 "i" 55 | #define PRIi32 "i" 56 | #define PRIi64 "I64i" 57 | 58 | #define PRIiLEAST8 "i" 59 | #define PRIiLEAST16 "i" 60 | #define PRIiLEAST32 "i" 61 | #define PRIiLEAST64 "I64i" 62 | 63 | #define PRIiFAST8 "i" 64 | #define PRIiFAST16 "i" 65 | #define PRIiFAST32 "i" 66 | #define PRIiFAST64 "I64i" 67 | 68 | #define PRIiMAX "I64i" 69 | 70 | #define PRIo8 "o" 71 | #define PRIo16 "o" 72 | #define PRIo32 "o" 73 | #define PRIo64 "I64o" 74 | 75 | #define PRIoLEAST8 "o" 76 | #define PRIoLEAST16 "o" 77 | #define PRIoLEAST32 "o" 78 | #define PRIoLEAST64 "I64o" 79 | 80 | #define PRIoFAST8 "o" 81 | #define PRIoFAST16 "o" 82 | #define PRIoFAST32 "o" 83 | #define PRIoFAST64 "I64o" 84 | 85 | #define PRIoMAX "I64o" 86 | 87 | /* fprintf macros for unsigned types */ 88 | #define PRIu8 "u" 89 | #define PRIu16 "u" 90 | #define PRIu32 "u" 91 | #define PRIu64 "I64u" 92 | 93 | 94 | #define PRIuLEAST8 "u" 95 | #define PRIuLEAST16 "u" 96 | #define PRIuLEAST32 "u" 97 | #define PRIuLEAST64 "I64u" 98 | 99 | #define PRIuFAST8 "u" 100 | #define PRIuFAST16 "u" 101 | #define PRIuFAST32 "u" 102 | #define PRIuFAST64 "I64u" 103 | 104 | #define PRIuMAX "I64u" 105 | 106 | #define PRIx8 "x" 107 | #define PRIx16 "x" 108 | #define PRIx32 "x" 109 | #define PRIx64 "I64x" 110 | 111 | #define PRIxLEAST8 "x" 112 | #define PRIxLEAST16 "x" 113 | #define PRIxLEAST32 "x" 114 | #define PRIxLEAST64 "I64x" 115 | 116 | #define PRIxFAST8 "x" 117 | #define PRIxFAST16 "x" 118 | #define PRIxFAST32 "x" 119 | #define PRIxFAST64 "I64x" 120 | 121 | #define PRIxMAX "I64x" 122 | 123 | #define PRIX8 "X" 124 | #define PRIX16 "X" 125 | #define PRIX32 "X" 126 | #define PRIX64 "I64X" 127 | 128 | #define PRIXLEAST8 "X" 129 | #define PRIXLEAST16 "X" 130 | #define PRIXLEAST32 "X" 131 | #define PRIXLEAST64 "I64X" 132 | 133 | #define PRIXFAST8 "X" 134 | #define PRIXFAST16 "X" 135 | #define PRIXFAST32 "X" 136 | #define PRIXFAST64 "I64X" 137 | 138 | #define PRIXMAX "I64X" 139 | 140 | /* 141 | * fscanf macros for signed int types 142 | * NOTE: if 32-bit int is used for int_fast8_t and int_fast16_t 143 | * (see stdint.h, 7.18.1.3), FAST8 and FAST16 should have 144 | * no length identifiers 145 | */ 146 | 147 | #define SCNd16 "hd" 148 | #define SCNd32 "d" 149 | #define SCNd64 "I64d" 150 | 151 | #define SCNdLEAST16 "hd" 152 | #define SCNdLEAST32 "d" 153 | #define SCNdLEAST64 "I64d" 154 | 155 | #define SCNdFAST16 "hd" 156 | #define SCNdFAST32 "d" 157 | #define SCNdFAST64 "I64d" 158 | 159 | #define SCNdMAX "I64d" 160 | 161 | #define SCNi16 "hi" 162 | #define SCNi32 "i" 163 | #define SCNi64 "I64i" 164 | 165 | #define SCNiLEAST16 "hi" 166 | #define SCNiLEAST32 "i" 167 | #define SCNiLEAST64 "I64i" 168 | 169 | #define SCNiFAST16 "hi" 170 | #define SCNiFAST32 "i" 171 | #define SCNiFAST64 "I64i" 172 | 173 | #define SCNiMAX "I64i" 174 | 175 | #define SCNo16 "ho" 176 | #define SCNo32 "o" 177 | #define SCNo64 "I64o" 178 | 179 | #define SCNoLEAST16 "ho" 180 | #define SCNoLEAST32 "o" 181 | #define SCNoLEAST64 "I64o" 182 | 183 | #define SCNoFAST16 "ho" 184 | #define SCNoFAST32 "o" 185 | #define SCNoFAST64 "I64o" 186 | 187 | #define SCNoMAX "I64o" 188 | 189 | #define SCNx16 "hx" 190 | #define SCNx32 "x" 191 | #define SCNx64 "I64x" 192 | 193 | #define SCNxLEAST16 "hx" 194 | #define SCNxLEAST32 "x" 195 | #define SCNxLEAST64 "I64x" 196 | 197 | #define SCNxFAST16 "hx" 198 | #define SCNxFAST32 "x" 199 | #define SCNxFAST64 "I64x" 200 | 201 | #define SCNxMAX "I64x" 202 | 203 | /* fscanf macros for unsigned int types */ 204 | 205 | #define SCNu16 "hu" 206 | #define SCNu32 "u" 207 | #define SCNu64 "I64u" 208 | 209 | #define SCNuLEAST16 "hu" 210 | #define SCNuLEAST32 "u" 211 | #define SCNuLEAST64 "I64u" 212 | 213 | #define SCNuFAST16 "hu" 214 | #define SCNuFAST32 "u" 215 | #define SCNuFAST64 "I64u" 216 | 217 | #define SCNuMAX "I64u" 218 | 219 | #ifdef _WIN64 220 | #define PRIdPTR "I64d" 221 | #define PRIiPTR "I64i" 222 | #define PRIoPTR "I64o" 223 | #define PRIuPTR "I64u" 224 | #define PRIxPTR "I64x" 225 | #define PRIXPTR "I64X" 226 | #define SCNdPTR "I64d" 227 | #define SCNiPTR "I64i" 228 | #define SCNoPTR "I64o" 229 | #define SCNxPTR "I64x" 230 | #define SCNuPTR "I64u" 231 | #else 232 | #define PRIdPTR "d" 233 | #define PRIiPTR "i" 234 | #define PRIoPTR "o" 235 | #define PRIuPTR "u" 236 | #define PRIxPTR "x" 237 | #define PRIXPTR "X" 238 | #define SCNdPTR "d" 239 | #define SCNiPTR "i" 240 | #define SCNoPTR "o" 241 | #define SCNxPTR "x" 242 | #define SCNuPTR "u" 243 | #endif 244 | 245 | #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L 246 | /* 247 | * no length modifier for char types prior to C9x 248 | * MS runtime scanf appears to treat "hh" as "h" 249 | */ 250 | 251 | /* signed char */ 252 | #define SCNd8 "hhd" 253 | #define SCNdLEAST8 "hhd" 254 | #define SCNdFAST8 "hhd" 255 | 256 | #define SCNi8 "hhi" 257 | #define SCNiLEAST8 "hhi" 258 | #define SCNiFAST8 "hhi" 259 | 260 | #define SCNo8 "hho" 261 | #define SCNoLEAST8 "hho" 262 | #define SCNoFAST8 "hho" 263 | 264 | #define SCNx8 "hhx" 265 | #define SCNxLEAST8 "hhx" 266 | #define SCNxFAST8 "hhx" 267 | 268 | /* unsigned char */ 269 | #define SCNu8 "hhu" 270 | #define SCNuLEAST8 "hhu" 271 | #define SCNuFAST8 "hhu" 272 | #endif /* __STDC_VERSION__ >= 199901 */ 273 | 274 | #endif /* !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) */ 275 | 276 | intmax_t __cdecl imaxabs (intmax_t j); 277 | __CRT_INLINE intmax_t __cdecl imaxabs (intmax_t j) 278 | {return (j >= 0 ? j : -j);} 279 | imaxdiv_t __cdecl imaxdiv (intmax_t numer, intmax_t denom); 280 | 281 | /* 7.8.2 Conversion functions for greatest-width integer types */ 282 | 283 | intmax_t __cdecl strtoimax (const char* __restrict__ nptr, 284 | char** __restrict__ endptr, int base); 285 | uintmax_t __cdecl strtoumax (const char* __restrict__ nptr, 286 | char** __restrict__ endptr, int base); 287 | 288 | intmax_t __cdecl wcstoimax (const wchar_t* __restrict__ nptr, 289 | wchar_t** __restrict__ endptr, int base); 290 | uintmax_t __cdecl wcstoumax (const wchar_t* __restrict__ nptr, 291 | wchar_t** __restrict__ endptr, int base); 292 | 293 | #ifdef __cplusplus 294 | } 295 | #endif 296 | 297 | #endif /* ndef _INTTYPES_H */ 298 | -------------------------------------------------------------------------------- /win32/include/iso646.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the TinyCC package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | 7 | /* 8 | * ISO C Standard: 7.9 Alternative spellings 9 | */ 10 | 11 | #ifndef _ISO646_H_ 12 | #define _ISO646_H_ 13 | 14 | #define and && 15 | #define and_eq &= 16 | #define bitand & 17 | #define bitor | 18 | #define compl ~ 19 | #define not ! 20 | #define not_eq != 21 | #define or || 22 | #define or_eq |= 23 | #define xor ^ 24 | #define xor_eq ^= 25 | 26 | #endif /* _ISO646_H_ */ 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /win32/include/limits.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the w64 mingw-runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | #include <_mingw.h> 7 | 8 | #ifndef _INC_LIMITS 9 | #define _INC_LIMITS 10 | 11 | /* 12 | * File system limits 13 | * 14 | * TODO: NAME_MAX and OPEN_MAX are file system limits or not? Are they the 15 | * same as FILENAME_MAX and FOPEN_MAX from stdio.h? 16 | * NOTE: Apparently the actual size of PATH_MAX is 260, but a space is 17 | * required for the NUL. TODO: Test? 18 | */ 19 | #define PATH_MAX (259) 20 | 21 | #define CHAR_BIT 8 22 | #define SCHAR_MIN (-128) 23 | #define SCHAR_MAX 127 24 | #define UCHAR_MAX 0xff 25 | 26 | #ifndef __CHAR_UNSIGNED__ 27 | #define CHAR_MIN SCHAR_MIN 28 | #define CHAR_MAX SCHAR_MAX 29 | #else 30 | #define CHAR_MIN 0 31 | #define CHAR_MAX UCHAR_MAX 32 | #endif 33 | 34 | #define MB_LEN_MAX 5 35 | #define SHRT_MIN (-32768) 36 | #define SHRT_MAX 32767 37 | #define USHRT_MAX 0xffff 38 | #define INT_MIN (-2147483647 - 1) 39 | #define INT_MAX 2147483647 40 | #define UINT_MAX 0xffffffff 41 | #define LONG_MIN (-2147483647L - 1) 42 | #define LONG_MAX 2147483647L 43 | #define ULONG_MAX 0xffffffffUL 44 | #define LLONG_MAX 9223372036854775807ll 45 | #define LLONG_MIN (-9223372036854775807ll - 1) 46 | #define ULLONG_MAX 0xffffffffffffffffull 47 | 48 | #if _INTEGRAL_MAX_BITS >= 8 49 | #define _I8_MIN (-127 - 1) 50 | #define _I8_MAX 127i8 51 | #define _UI8_MAX 0xffu 52 | #endif 53 | 54 | #if _INTEGRAL_MAX_BITS >= 16 55 | #define _I16_MIN (-32767 - 1) 56 | #define _I16_MAX 32767i16 57 | #define _UI16_MAX 0xffffu 58 | #endif 59 | 60 | #if _INTEGRAL_MAX_BITS >= 32 61 | #define _I32_MIN (-2147483647 - 1) 62 | #define _I32_MAX 2147483647 63 | #define _UI32_MAX 0xffffffffu 64 | #endif 65 | 66 | #if defined(__GNUC__) 67 | #undef LONG_LONG_MAX 68 | #define LONG_LONG_MAX 9223372036854775807ll 69 | #undef LONG_LONG_MIN 70 | #define LONG_LONG_MIN (-LONG_LONG_MAX-1) 71 | #undef ULONG_LONG_MAX 72 | #define ULONG_LONG_MAX (2ull * LONG_LONG_MAX + 1ull) 73 | #endif 74 | 75 | #if _INTEGRAL_MAX_BITS >= 64 76 | #define _I64_MIN (-9223372036854775807ll - 1) 77 | #define _I64_MAX 9223372036854775807ll 78 | #define _UI64_MAX 0xffffffffffffffffull 79 | #endif 80 | 81 | #ifndef SIZE_MAX 82 | #ifdef _WIN64 83 | #define SIZE_MAX _UI64_MAX 84 | #else 85 | #define SIZE_MAX UINT_MAX 86 | #endif 87 | #endif 88 | 89 | #ifdef _POSIX_ 90 | #define _POSIX_ARG_MAX 4096 91 | #define _POSIX_CHILD_MAX 6 92 | #define _POSIX_LINK_MAX 8 93 | #define _POSIX_MAX_CANON 255 94 | #define _POSIX_MAX_INPUT 255 95 | #define _POSIX_NAME_MAX 14 96 | #define _POSIX_NGROUPS_MAX 0 97 | #define _POSIX_OPEN_MAX 16 98 | #define _POSIX_PATH_MAX 255 99 | #define _POSIX_PIPE_BUF 512 100 | #define _POSIX_SSIZE_MAX 32767 101 | #define _POSIX_STREAM_MAX 8 102 | #define _POSIX_TZNAME_MAX 3 103 | #define ARG_MAX 14500 104 | #define LINK_MAX 1024 105 | #define MAX_CANON _POSIX_MAX_CANON 106 | #define MAX_INPUT _POSIX_MAX_INPUT 107 | #define NAME_MAX 255 108 | #define NGROUPS_MAX 16 109 | #define OPEN_MAX 32 110 | #define PATH_MAX 512 111 | #define PIPE_BUF _POSIX_PIPE_BUF 112 | #define SSIZE_MAX _POSIX_SSIZE_MAX 113 | #define STREAM_MAX 20 114 | #define TZNAME_MAX 10 115 | #endif 116 | #endif 117 | -------------------------------------------------------------------------------- /win32/include/locale.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the w64 mingw-runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | #ifndef _INC_LOCALE 7 | #define _INC_LOCALE 8 | 9 | #include <_mingw.h> 10 | 11 | #pragma pack(push,_CRT_PACKING) 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | #ifndef NULL 18 | #ifdef __cplusplus 19 | #define NULL 0 20 | #else 21 | #define NULL ((void *)0) 22 | #endif 23 | #endif 24 | 25 | #define LC_ALL 0 26 | #define LC_COLLATE 1 27 | #define LC_CTYPE 2 28 | #define LC_MONETARY 3 29 | #define LC_NUMERIC 4 30 | #define LC_TIME 5 31 | 32 | #define LC_MIN LC_ALL 33 | #define LC_MAX LC_TIME 34 | 35 | #ifndef _LCONV_DEFINED 36 | #define _LCONV_DEFINED 37 | struct lconv { 38 | char *decimal_point; 39 | char *thousands_sep; 40 | char *grouping; 41 | char *int_curr_symbol; 42 | char *currency_symbol; 43 | char *mon_decimal_point; 44 | char *mon_thousands_sep; 45 | char *mon_grouping; 46 | char *positive_sign; 47 | char *negative_sign; 48 | char int_frac_digits; 49 | char frac_digits; 50 | char p_cs_precedes; 51 | char p_sep_by_space; 52 | char n_cs_precedes; 53 | char n_sep_by_space; 54 | char p_sign_posn; 55 | char n_sign_posn; 56 | }; 57 | #endif 58 | 59 | #ifndef _CONFIG_LOCALE_SWT 60 | #define _CONFIG_LOCALE_SWT 61 | 62 | #define _ENABLE_PER_THREAD_LOCALE 0x1 63 | #define _DISABLE_PER_THREAD_LOCALE 0x2 64 | #define _ENABLE_PER_THREAD_LOCALE_GLOBAL 0x10 65 | #define _DISABLE_PER_THREAD_LOCALE_GLOBAL 0x20 66 | #define _ENABLE_PER_THREAD_LOCALE_NEW 0x100 67 | #define _DISABLE_PER_THREAD_LOCALE_NEW 0x200 68 | 69 | #endif 70 | 71 | int __cdecl _configthreadlocale(int _Flag); 72 | char *__cdecl setlocale(int _Category,const char *_Locale); 73 | _CRTIMP struct lconv *__cdecl localeconv(void); 74 | _locale_t __cdecl _get_current_locale(void); 75 | _locale_t __cdecl _create_locale(int _Category,const char *_Locale); 76 | void __cdecl _free_locale(_locale_t _Locale); 77 | _locale_t __cdecl __get_current_locale(void); 78 | _locale_t __cdecl __create_locale(int _Category,const char *_Locale); 79 | void __cdecl __free_locale(_locale_t _Locale); 80 | 81 | #ifndef _WLOCALE_DEFINED 82 | #define _WLOCALE_DEFINED 83 | _CRTIMP wchar_t *__cdecl _wsetlocale(int _Category,const wchar_t *_Locale); 84 | #endif 85 | 86 | #ifdef __cplusplus 87 | } 88 | #endif 89 | 90 | #pragma pack(pop) 91 | #endif 92 | -------------------------------------------------------------------------------- /win32/include/malloc.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the w64 mingw-runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | #ifndef _MALLOC_H_ 7 | #define _MALLOC_H_ 8 | 9 | #include <_mingw.h> 10 | 11 | #pragma pack(push,_CRT_PACKING) 12 | 13 | #ifndef _MM_MALLOC_H_INCLUDED 14 | #define _MM_MALLOC_H_INCLUDED 15 | #endif 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | #ifdef _WIN64 22 | #define _HEAP_MAXREQ 0xFFFFFFFFFFFFFFE0 23 | #else 24 | #define _HEAP_MAXREQ 0xFFFFFFE0 25 | #endif 26 | 27 | #ifndef _STATIC_ASSERT 28 | #define _STATIC_ASSERT(expr) extern void __static_assert_t(int [(expr)?1:-1]) 29 | #endif 30 | 31 | /* Return codes for _heapwalk() */ 32 | #define _HEAPEMPTY (-1) 33 | #define _HEAPOK (-2) 34 | #define _HEAPBADBEGIN (-3) 35 | #define _HEAPBADNODE (-4) 36 | #define _HEAPEND (-5) 37 | #define _HEAPBADPTR (-6) 38 | 39 | /* Values for _heapinfo.useflag */ 40 | #define _FREEENTRY 0 41 | #define _USEDENTRY 1 42 | 43 | #ifndef _HEAPINFO_DEFINED 44 | #define _HEAPINFO_DEFINED 45 | /* The structure used to walk through the heap with _heapwalk. */ 46 | typedef struct _heapinfo { 47 | int *_pentry; 48 | size_t _size; 49 | int _useflag; 50 | } _HEAPINFO; 51 | #endif 52 | 53 | extern unsigned int _amblksiz; 54 | 55 | #define _mm_free(a) _aligned_free(a) 56 | #define _mm_malloc(a,b) _aligned_malloc(a,b) 57 | 58 | #ifndef _CRT_ALLOCATION_DEFINED 59 | #define _CRT_ALLOCATION_DEFINED 60 | void *__cdecl calloc(size_t _NumOfElements,size_t _SizeOfElements); 61 | void __cdecl free(void *_Memory); 62 | void *__cdecl malloc(size_t _Size); 63 | void *__cdecl realloc(void *_Memory,size_t _NewSize); 64 | _CRTIMP void *__cdecl _recalloc(void *_Memory,size_t _Count,size_t _Size); 65 | _CRTIMP void __cdecl _aligned_free(void *_Memory); 66 | _CRTIMP void *__cdecl _aligned_malloc(size_t _Size,size_t _Alignment); 67 | _CRTIMP void *__cdecl _aligned_offset_malloc(size_t _Size,size_t _Alignment,size_t _Offset); 68 | _CRTIMP void *__cdecl _aligned_realloc(void *_Memory,size_t _Size,size_t _Alignment); 69 | _CRTIMP void *__cdecl _aligned_recalloc(void *_Memory,size_t _Count,size_t _Size,size_t _Alignment); 70 | _CRTIMP void *__cdecl _aligned_offset_realloc(void *_Memory,size_t _Size,size_t _Alignment,size_t _Offset); 71 | _CRTIMP void *__cdecl _aligned_offset_recalloc(void *_Memory,size_t _Count,size_t _Size,size_t _Alignment,size_t _Offset); 72 | #endif 73 | 74 | #define _MAX_WAIT_MALLOC_CRT 60000 75 | 76 | _CRTIMP int __cdecl _resetstkoflw (void); 77 | _CRTIMP unsigned long __cdecl _set_malloc_crt_max_wait(unsigned long _NewValue); 78 | 79 | _CRTIMP void *__cdecl _expand(void *_Memory,size_t _NewSize); 80 | _CRTIMP size_t __cdecl _msize(void *_Memory); 81 | #ifdef __GNUC__ 82 | #undef _alloca 83 | #define _alloca(x) __builtin_alloca((x)) 84 | #else 85 | /* tcc implements alloca internally and exposes it (since commit d778bde7). 86 | /* alloca is declared at include/stddef.h (which is distributed with tcc). 87 | */ 88 | #ifdef _alloca 89 | #undef _alloca 90 | #endif 91 | #define _alloca(x) alloca((x)) 92 | #endif 93 | _CRTIMP size_t __cdecl _get_sbh_threshold(void); 94 | _CRTIMP int __cdecl _set_sbh_threshold(size_t _NewValue); 95 | _CRTIMP errno_t __cdecl _set_amblksiz(size_t _Value); 96 | _CRTIMP errno_t __cdecl _get_amblksiz(size_t *_Value); 97 | _CRTIMP int __cdecl _heapadd(void *_Memory,size_t _Size); 98 | _CRTIMP int __cdecl _heapchk(void); 99 | _CRTIMP int __cdecl _heapmin(void); 100 | _CRTIMP int __cdecl _heapset(unsigned int _Fill); 101 | _CRTIMP int __cdecl _heapwalk(_HEAPINFO *_EntryInfo); 102 | _CRTIMP size_t __cdecl _heapused(size_t *_Used,size_t *_Commit); 103 | _CRTIMP intptr_t __cdecl _get_heap_handle(void); 104 | 105 | #define _ALLOCA_S_THRESHOLD 1024 106 | #define _ALLOCA_S_STACK_MARKER 0xCCCC 107 | #define _ALLOCA_S_HEAP_MARKER 0xDDDD 108 | 109 | #if(defined(_X86_) && !defined(__x86_64)) 110 | #define _ALLOCA_S_MARKER_SIZE 8 111 | #elif defined(__ia64__) || defined(__x86_64) 112 | #define _ALLOCA_S_MARKER_SIZE 16 113 | #endif 114 | 115 | #if !defined(RC_INVOKED) 116 | static __inline void *_MarkAllocaS(void *_Ptr,unsigned int _Marker) { 117 | if(_Ptr) { 118 | *((unsigned int*)_Ptr) = _Marker; 119 | _Ptr = (char*)_Ptr + _ALLOCA_S_MARKER_SIZE; 120 | } 121 | return _Ptr; 122 | } 123 | #endif 124 | 125 | #undef _malloca 126 | #define _malloca(size) \ 127 | ((((size) + _ALLOCA_S_MARKER_SIZE) <= _ALLOCA_S_THRESHOLD) ? \ 128 | _MarkAllocaS(_alloca((size) + _ALLOCA_S_MARKER_SIZE),_ALLOCA_S_STACK_MARKER) : \ 129 | _MarkAllocaS(malloc((size) + _ALLOCA_S_MARKER_SIZE),_ALLOCA_S_HEAP_MARKER)) 130 | #undef _FREEA_INLINE 131 | #define _FREEA_INLINE 132 | 133 | #ifndef RC_INVOKED 134 | #undef _freea 135 | static __inline void __cdecl _freea(void *_Memory) { 136 | unsigned int _Marker; 137 | if(_Memory) { 138 | _Memory = (char*)_Memory - _ALLOCA_S_MARKER_SIZE; 139 | _Marker = *(unsigned int *)_Memory; 140 | if(_Marker==_ALLOCA_S_HEAP_MARKER) { 141 | free(_Memory); 142 | } 143 | #ifdef _ASSERTE 144 | else if(_Marker!=_ALLOCA_S_STACK_MARKER) { 145 | _ASSERTE(("Corrupted pointer passed to _freea",0)); 146 | } 147 | #endif 148 | } 149 | } 150 | #endif /* RC_INVOKED */ 151 | 152 | #ifndef NO_OLDNAMES 153 | #ifdef __GNUC__ 154 | #undef alloca 155 | #define alloca(x) __builtin_alloca((x)) 156 | #endif 157 | #endif 158 | 159 | #ifdef HEAPHOOK 160 | #ifndef _HEAPHOOK_DEFINED 161 | #define _HEAPHOOK_DEFINED 162 | typedef int (__cdecl *_HEAPHOOK)(int,size_t,void *,void **); 163 | #endif 164 | 165 | _CRTIMP _HEAPHOOK __cdecl _setheaphook(_HEAPHOOK _NewHook); 166 | 167 | #define _HEAP_MALLOC 1 168 | #define _HEAP_CALLOC 2 169 | #define _HEAP_FREE 3 170 | #define _HEAP_REALLOC 4 171 | #define _HEAP_MSIZE 5 172 | #define _HEAP_EXPAND 6 173 | #endif 174 | 175 | #ifdef __cplusplus 176 | } 177 | #endif 178 | 179 | #pragma pack(pop) 180 | 181 | #endif /* _MALLOC_H_ */ 182 | -------------------------------------------------------------------------------- /win32/include/mem.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the w64 mingw-runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | /* 7 | * This file is part of the Mingw32 package. 8 | * 9 | * mem.h maps to string.h 10 | */ 11 | #ifndef __STRICT_ANSI__ 12 | #include 13 | #endif 14 | -------------------------------------------------------------------------------- /win32/include/memory.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the w64 mingw-runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | #ifndef _INC_MEMORY 7 | #define _INC_MEMORY 8 | 9 | #include <_mingw.h> 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | #ifndef _CONST_RETURN 16 | #define _CONST_RETURN 17 | #endif 18 | 19 | #define _WConst_return _CONST_RETURN 20 | 21 | #ifndef _CRT_MEMORY_DEFINED 22 | #define _CRT_MEMORY_DEFINED 23 | _CRTIMP void *__cdecl _memccpy(void *_Dst,const void *_Src,int _Val,size_t _MaxCount); 24 | _CONST_RETURN void *__cdecl memchr(const void *_Buf ,int _Val,size_t _MaxCount); 25 | _CRTIMP int __cdecl _memicmp(const void *_Buf1,const void *_Buf2,size_t _Size); 26 | _CRTIMP int __cdecl _memicmp_l(const void *_Buf1,const void *_Buf2,size_t _Size,_locale_t _Locale); 27 | int __cdecl memcmp(const void *_Buf1,const void *_Buf2,size_t _Size); 28 | void *__cdecl memcpy(void *_Dst,const void *_Src,size_t _Size); 29 | void *__cdecl memset(void *_Dst,int _Val,size_t _Size); 30 | 31 | #ifndef NO_OLDNAMES 32 | void *__cdecl memccpy(void *_Dst,const void *_Src,int _Val,size_t _Size); 33 | int __cdecl memicmp(const void *_Buf1,const void *_Buf2,size_t _Size); 34 | #endif 35 | #endif 36 | 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | #endif 41 | -------------------------------------------------------------------------------- /win32/include/sec_api/conio_s.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the w64 mingw-runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | 7 | #ifndef _INC_CONIO_S 8 | #define _INC_CONIO_S 9 | 10 | #include 11 | 12 | #if defined(MINGW_HAS_SECURE_API) 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | _CRTIMP errno_t __cdecl _cgets_s(char *_Buffer,size_t _Size,size_t *_SizeRead); 19 | _CRTIMP int __cdecl _cprintf_s(const char *_Format,...); 20 | _CRTIMP int __cdecl _cscanf_s(const char *_Format,...); 21 | _CRTIMP int __cdecl _cscanf_s_l(const char *_Format,_locale_t _Locale,...); 22 | _CRTIMP int __cdecl _vcprintf_s(const char *_Format,va_list _ArgList); 23 | _CRTIMP int __cdecl _cprintf_s_l(const char *_Format,_locale_t _Locale,...); 24 | _CRTIMP int __cdecl _vcprintf_s_l(const char *_Format,_locale_t _Locale,va_list _ArgList); 25 | 26 | #ifndef _WCONIO_DEFINED_S 27 | #define _WCONIO_DEFINED_S 28 | _CRTIMP errno_t __cdecl _cgetws_s(wchar_t *_Buffer,size_t _SizeInWords,size_t *_SizeRead); 29 | _CRTIMP int __cdecl _cwprintf_s(const wchar_t *_Format,...); 30 | _CRTIMP int __cdecl _cwscanf_s(const wchar_t *_Format,...); 31 | _CRTIMP int __cdecl _cwscanf_s_l(const wchar_t *_Format,_locale_t _Locale,...); 32 | _CRTIMP int __cdecl _vcwprintf_s(const wchar_t *_Format,va_list _ArgList); 33 | _CRTIMP int __cdecl _cwprintf_s_l(const wchar_t *_Format,_locale_t _Locale,...); 34 | _CRTIMP int __cdecl _vcwprintf_s_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); 35 | #endif 36 | 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | 41 | #endif 42 | #endif 43 | -------------------------------------------------------------------------------- /win32/include/sec_api/crtdbg_s.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the w64 mingw-runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | 7 | #ifndef _INC_CRTDBG_S 8 | #define _INC_CRTDBG_S 9 | 10 | #include 11 | 12 | #if defined(MINGW_HAS_SECURE_API) 13 | 14 | #define _dupenv_s_dbg(ps1,size,s2,t,f,l) _dupenv_s(ps1,size,s2) 15 | #define _wdupenv_s_dbg(ps1,size,s2,t,f,l) _wdupenv_s(ps1,size,s2) 16 | 17 | #endif 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /win32/include/sec_api/io_s.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the w64 mingw-runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | #ifndef _INC_IO_S 7 | #define _INC_IO_S 8 | 9 | #include 10 | 11 | #if defined(MINGW_HAS_SECURE_API) 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | _CRTIMP errno_t __cdecl _access_s(const char *_Filename,int _AccessMode); 18 | _CRTIMP errno_t __cdecl _chsize_s(int _FileHandle,__int64 _Size); 19 | _CRTIMP errno_t __cdecl _mktemp_s(char *_TemplateName,size_t _Size); 20 | _CRTIMP errno_t __cdecl _umask_s(int _NewMode,int *_OldMode); 21 | 22 | #ifndef _WIO_S_DEFINED 23 | #define _WIO_S_DEFINED 24 | _CRTIMP errno_t __cdecl _waccess_s(const wchar_t *_Filename,int _AccessMode); 25 | _CRTIMP errno_t __cdecl _wmktemp_s(wchar_t *_TemplateName,size_t _SizeInWords); 26 | #endif 27 | 28 | #ifdef __cplusplus 29 | } 30 | #endif 31 | 32 | #endif 33 | #endif 34 | -------------------------------------------------------------------------------- /win32/include/sec_api/mbstring_s.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the w64 mingw-runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | #ifndef _INC_MBSTRING_S 7 | #define _INC_MBSTRING_S 8 | 9 | #include 10 | 11 | #if defined(MINGW_HAS_SECURE_API) 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | #ifndef _MBSTRING_S_DEFINED 18 | #define _MBSTRING_S_DEFINED 19 | _CRTIMP errno_t __cdecl _mbscat_s(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src); 20 | _CRTIMP errno_t __cdecl _mbscat_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,_locale_t _Locale); 21 | _CRTIMP errno_t __cdecl _mbscpy_s(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src); 22 | _CRTIMP errno_t __cdecl _mbscpy_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,_locale_t _Locale); 23 | _CRTIMP errno_t __cdecl _mbslwr_s(unsigned char *_Str,size_t _SizeInBytes); 24 | _CRTIMP errno_t __cdecl _mbslwr_s_l(unsigned char *_Str,size_t _SizeInBytes,_locale_t _Locale); 25 | _CRTIMP errno_t __cdecl _mbsnbcat_s(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,size_t _MaxCount); 26 | _CRTIMP errno_t __cdecl _mbsnbcat_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,size_t _MaxCount,_locale_t _Locale); 27 | _CRTIMP errno_t __cdecl _mbsnbcpy_s(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,size_t _MaxCount); 28 | _CRTIMP errno_t __cdecl _mbsnbcpy_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,size_t _MaxCount,_locale_t _Locale); 29 | _CRTIMP errno_t __cdecl _mbsnbset_s(unsigned char *_Dst,size_t _DstSizeInBytes,unsigned int _Ch,size_t _MaxCount); 30 | _CRTIMP errno_t __cdecl _mbsnbset_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,unsigned int _Ch,size_t _MaxCount,_locale_t _Locale); 31 | _CRTIMP errno_t __cdecl _mbsncat_s(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,size_t _MaxCount); 32 | _CRTIMP errno_t __cdecl _mbsncat_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,size_t _MaxCount,_locale_t _Locale); 33 | _CRTIMP errno_t __cdecl _mbsncpy_s(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,size_t _MaxCount); 34 | _CRTIMP errno_t __cdecl _mbsncpy_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,size_t _MaxCount,_locale_t _Locale); 35 | _CRTIMP errno_t __cdecl _mbsnset_s(unsigned char *_Dst,size_t _DstSizeInBytes,unsigned int _Val,size_t _MaxCount); 36 | _CRTIMP errno_t __cdecl _mbsnset_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,unsigned int _Val,size_t _MaxCount,_locale_t _Locale); 37 | _CRTIMP errno_t __cdecl _mbsset_s(unsigned char *_Dst,size_t _DstSizeInBytes,unsigned int _Val); 38 | _CRTIMP errno_t __cdecl _mbsset_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,unsigned int _Val,_locale_t _Locale); 39 | _CRTIMP unsigned char *__cdecl _mbstok_s(unsigned char *_Str,const unsigned char *_Delim,unsigned char **_Context); 40 | _CRTIMP unsigned char *__cdecl _mbstok_s_l(unsigned char *_Str,const unsigned char *_Delim,unsigned char **_Context,_locale_t _Locale); 41 | _CRTIMP errno_t __cdecl _mbsupr_s(unsigned char *_Str,size_t _SizeInBytes); 42 | _CRTIMP errno_t __cdecl _mbsupr_s_l(unsigned char *_Str,size_t _SizeInBytes,_locale_t _Locale); 43 | _CRTIMP errno_t __cdecl _mbccpy_s(unsigned char *_Dst,size_t _DstSizeInBytes,int *_PCopied,const unsigned char *_Src); 44 | _CRTIMP errno_t __cdecl _mbccpy_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,int *_PCopied,const unsigned char *_Src,_locale_t _Locale); 45 | #endif 46 | 47 | #ifdef __cplusplus 48 | } 49 | #endif 50 | 51 | #endif 52 | #endif 53 | -------------------------------------------------------------------------------- /win32/include/sec_api/search_s.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the w64 mingw-runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | #ifndef _INC_SEARCH_S 7 | #define _INC_SEARCH_S 8 | 9 | #include 10 | 11 | #if defined(MINGW_HAS_SECURE_API) 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | _CRTIMP void *__cdecl _lfind_s(const void *_Key,const void *_Base,unsigned int *_NumOfElements,size_t _SizeOfElements,int (__cdecl *_PtFuncCompare)(void *,const void *,const void *),void *_Context); 18 | _CRTIMP void *__cdecl _lsearch_s(const void *_Key,void *_Base,unsigned int *_NumOfElements,size_t _SizeOfElements,int (__cdecl *_PtFuncCompare)(void *,const void *,const void *),void *_Context); 19 | 20 | #ifdef __cplusplus 21 | } 22 | #endif 23 | 24 | #endif 25 | #endif 26 | -------------------------------------------------------------------------------- /win32/include/sec_api/stdlib_s.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the w64 mingw-runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | #ifndef _INC_STDLIB_S 7 | #define _INC_STDLIB_S 8 | 9 | #include 10 | 11 | #if defined(MINGW_HAS_SECURE_API) 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | _CRTIMP errno_t __cdecl _dupenv_s(char **_PBuffer,size_t *_PBufferSizeInBytes,const char *_VarName); 18 | _CRTIMP errno_t __cdecl _itoa_s(int _Value,char *_DstBuf,size_t _Size,int _Radix); 19 | #if _INTEGRAL_MAX_BITS >= 64 20 | _CRTIMP errno_t __cdecl _i64toa_s(__int64 _Val,char *_DstBuf,size_t _Size,int _Radix); 21 | _CRTIMP errno_t __cdecl _ui64toa_s(unsigned __int64 _Val,char *_DstBuf,size_t _Size,int _Radix); 22 | #endif 23 | _CRTIMP errno_t __cdecl _ltoa_s(long _Val,char *_DstBuf,size_t _Size,int _Radix); 24 | _CRTIMP errno_t __cdecl mbstowcs_s(size_t *_PtNumOfCharConverted,wchar_t *_DstBuf,size_t _SizeInWords,const char *_SrcBuf,size_t _MaxCount); 25 | _CRTIMP errno_t __cdecl _mbstowcs_s_l(size_t *_PtNumOfCharConverted,wchar_t *_DstBuf,size_t _SizeInWords,const char *_SrcBuf,size_t _MaxCount,_locale_t _Locale); 26 | _CRTIMP errno_t __cdecl _ultoa_s(unsigned long _Val,char *_DstBuf,size_t _Size,int _Radix); 27 | _CRTIMP errno_t __cdecl _wctomb_s_l(int *_SizeConverted,char *_MbCh,size_t _SizeInBytes,wchar_t _WCh,_locale_t _Locale); 28 | _CRTIMP errno_t __cdecl wcstombs_s(size_t *_PtNumOfCharConverted,char *_Dst,size_t _DstSizeInBytes,const wchar_t *_Src,size_t _MaxCountInBytes); 29 | _CRTIMP errno_t __cdecl _wcstombs_s_l(size_t *_PtNumOfCharConverted,char *_Dst,size_t _DstSizeInBytes,const wchar_t *_Src,size_t _MaxCountInBytes,_locale_t _Locale); 30 | 31 | #ifndef _WSTDLIB_S_DEFINED 32 | #define _WSTDLIB_S_DEFINED 33 | _CRTIMP errno_t __cdecl _itow_s (int _Val,wchar_t *_DstBuf,size_t _SizeInWords,int _Radix); 34 | _CRTIMP errno_t __cdecl _ltow_s (long _Val,wchar_t *_DstBuf,size_t _SizeInWords,int _Radix); 35 | _CRTIMP errno_t __cdecl _ultow_s (unsigned long _Val,wchar_t *_DstBuf,size_t _SizeInWords,int _Radix); 36 | _CRTIMP errno_t __cdecl _wgetenv_s(size_t *_ReturnSize,wchar_t *_DstBuf,size_t _DstSizeInWords,const wchar_t *_VarName); 37 | _CRTIMP errno_t __cdecl _wdupenv_s(wchar_t **_Buffer,size_t *_BufferSizeInWords,const wchar_t *_VarName); 38 | #if _INTEGRAL_MAX_BITS >= 64 39 | _CRTIMP errno_t __cdecl _i64tow_s(__int64 _Val,wchar_t *_DstBuf,size_t _SizeInWords,int _Radix); 40 | _CRTIMP errno_t __cdecl _ui64tow_s(unsigned __int64 _Val,wchar_t *_DstBuf,size_t _SizeInWords,int _Radix); 41 | #endif 42 | #endif 43 | 44 | #ifndef _POSIX_ 45 | _CRTIMP errno_t __cdecl _ecvt_s(char *_DstBuf,size_t _Size,double _Val,int _NumOfDights,int *_PtDec,int *_PtSign); 46 | _CRTIMP errno_t __cdecl _fcvt_s(char *_DstBuf,size_t _Size,double _Val,int _NumOfDec,int *_PtDec,int *_PtSign); 47 | _CRTIMP errno_t __cdecl _gcvt_s(char *_DstBuf,size_t _Size,double _Val,int _NumOfDigits); 48 | _CRTIMP errno_t __cdecl _makepath_s(char *_PathResult,size_t _Size,const char *_Drive,const char *_Dir,const char *_Filename,const char *_Ext); 49 | _CRTIMP errno_t __cdecl _putenv_s(const char *_Name,const char *_Value); 50 | _CRTIMP errno_t __cdecl _searchenv_s(const char *_Filename,const char *_EnvVar,char *_ResultPath,size_t _SizeInBytes); 51 | _CRTIMP errno_t __cdecl _splitpath_s(const char *_FullPath,char *_Drive,size_t _DriveSize,char *_Dir,size_t _DirSize,char *_Filename,size_t _FilenameSize,char *_Ext,size_t _ExtSize); 52 | 53 | #ifndef _WSTDLIBP_S_DEFINED 54 | #define _WSTDLIBP_S_DEFINED 55 | _CRTIMP errno_t __cdecl _wmakepath_s(wchar_t *_PathResult,size_t _SizeInWords,const wchar_t *_Drive,const wchar_t *_Dir,const wchar_t *_Filename,const wchar_t *_Ext); 56 | _CRTIMP errno_t __cdecl _wputenv_s(const wchar_t *_Name,const wchar_t *_Value); 57 | _CRTIMP errno_t __cdecl _wsearchenv_s(const wchar_t *_Filename,const wchar_t *_EnvVar,wchar_t *_ResultPath,size_t _SizeInWords); 58 | _CRTIMP errno_t __cdecl _wsplitpath_s(const wchar_t *_FullPath,wchar_t *_Drive,size_t _DriveSizeInWords,wchar_t *_Dir,size_t _DirSizeInWords,wchar_t *_Filename,size_t _FilenameSizeInWords,wchar_t *_Ext,size_t _ExtSizeInWords); 59 | #endif 60 | #endif 61 | 62 | #ifdef __cplusplus 63 | } 64 | #endif 65 | 66 | #endif 67 | #endif 68 | -------------------------------------------------------------------------------- /win32/include/sec_api/stralign_s.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the w64 mingw-runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | #ifndef __STRALIGN_H_S_ 7 | #define __STRALIGN_H_S_ 8 | 9 | #include 10 | 11 | #if defined(MINGW_HAS_SECURE_API) 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | #if !defined(I_X86_) && defined(_WSTRING_S_DEFINED) 18 | #if defined(__cplusplus) && defined(_WConst_Return) 19 | static __inline PUWSTR ua_wcscpy_s(PUWSTR Destination,size_t DestinationSize,PCUWSTR Source) { 20 | if(WSTR_ALIGNED(Source) && WSTR_ALIGNED(Destination)) return (wcscpy_s((PWSTR)Destination,DestinationSize,(PCWSTR)Source)==0 ? Destination : NULL); 21 | return uaw_wcscpy((PCUWSTR)String,Character); 22 | } 23 | #endif 24 | #endif 25 | 26 | #ifdef __cplusplus 27 | } 28 | #endif 29 | #endif 30 | #endif 31 | -------------------------------------------------------------------------------- /win32/include/sec_api/string_s.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the w64 mingw-runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | #ifndef _INC_STRING_S 7 | #define _INC_STRING_S 8 | 9 | #include 10 | 11 | #if defined(MINGW_HAS_SECURE_API) 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | _CRTIMP errno_t __cdecl _strset_s(char *_Dst,size_t _DstSize,int _Value); 18 | _CRTIMP errno_t __cdecl _strerror_s(char *_Buf,size_t _SizeInBytes,const char *_ErrMsg); 19 | _CRTIMP errno_t __cdecl _strlwr_s(char *_Str,size_t _Size); 20 | _CRTIMP errno_t __cdecl _strlwr_s_l(char *_Str,size_t _Size,_locale_t _Locale); 21 | _CRTIMP errno_t __cdecl _strnset_s(char *_Str,size_t _Size,int _Val,size_t _MaxCount); 22 | _CRTIMP errno_t __cdecl _strupr_s(char *_Str,size_t _Size); 23 | _CRTIMP errno_t __cdecl _strupr_s_l(char *_Str,size_t _Size,_locale_t _Locale); 24 | #ifndef _WSTRING_S_DEFINED 25 | #define _WSTRING_S_DEFINED 26 | _CRTIMP wchar_t *__cdecl wcstok_s(wchar_t *_Str,const wchar_t *_Delim,wchar_t **_Context); 27 | _CRTIMP errno_t __cdecl _wcserror_s(wchar_t *_Buf,size_t _SizeInWords,int _ErrNum); 28 | _CRTIMP errno_t __cdecl __wcserror_s(wchar_t *_Buffer,size_t _SizeInWords,const wchar_t *_ErrMsg); 29 | _CRTIMP errno_t __cdecl _wcsnset_s(wchar_t *_Dst,size_t _DstSizeInWords,wchar_t _Val,size_t _MaxCount); 30 | _CRTIMP errno_t __cdecl _wcsset_s(wchar_t *_Str,size_t _SizeInWords,wchar_t _Val); 31 | _CRTIMP errno_t __cdecl _wcslwr_s(wchar_t *_Str,size_t _SizeInWords); 32 | _CRTIMP errno_t __cdecl _wcslwr_s_l(wchar_t *_Str,size_t _SizeInWords,_locale_t _Locale); 33 | _CRTIMP errno_t __cdecl _wcsupr_s(wchar_t *_Str,size_t _Size); 34 | _CRTIMP errno_t __cdecl _wcsupr_s_l(wchar_t *_Str,size_t _Size,_locale_t _Locale); 35 | #endif 36 | 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | #endif 41 | #endif 42 | -------------------------------------------------------------------------------- /win32/include/sec_api/sys/timeb_s.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the w64 mingw-runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | 7 | #ifndef _TIMEB_H_S 8 | #define _TIMEB_H_S 9 | 10 | #include 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | #if defined(MINGW_HAS_SECURE_API) 17 | 18 | #ifdef _USE_32BIT_TIME_T 19 | #define _ftime_s _ftime32_s 20 | #else 21 | #define _ftime_s _ftime64_s 22 | #endif 23 | 24 | _CRTIMP errno_t __cdecl _ftime32_s(struct __timeb32 *_Time); 25 | #if _INTEGRAL_MAX_BITS >= 64 26 | _CRTIMP errno_t __cdecl _ftime64_s(struct __timeb64 *_Time); 27 | #endif 28 | #endif 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /win32/include/sec_api/time_s.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the w64 mingw-runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | #ifndef _TIME_H__S 7 | #define _TIME_H__S 8 | 9 | #include 10 | 11 | #if defined(MINGW_HAS_SECURE_API) 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | _CRTIMP errno_t __cdecl _ctime32_s(char *_Buf,size_t _SizeInBytes,const __time32_t *_Time); 18 | _CRTIMP errno_t __cdecl _gmtime32_s(struct tm *_Tm,const __time32_t *_Time); 19 | _CRTIMP errno_t __cdecl _localtime32_s(struct tm *_Tm,const __time32_t *_Time); 20 | _CRTIMP errno_t __cdecl _strdate_s(char *_Buf,size_t _SizeInBytes); 21 | _CRTIMP errno_t __cdecl _strtime_s(char *_Buf ,size_t _SizeInBytes); 22 | #if _INTEGRAL_MAX_BITS >= 64 23 | _CRTIMP errno_t __cdecl _ctime64_s(char *_Buf,size_t _SizeInBytes,const __time64_t *_Time); 24 | _CRTIMP errno_t __cdecl _gmtime64_s(struct tm *_Tm,const __time64_t *_Time); 25 | _CRTIMP errno_t __cdecl _localtime64_s(struct tm *_Tm,const __time64_t *_Time); 26 | #endif 27 | 28 | #ifndef _WTIME_S_DEFINED 29 | #define _WTIME_S_DEFINED 30 | _CRTIMP errno_t __cdecl _wasctime_s(wchar_t *_Buf,size_t _SizeInWords,const struct tm *_Tm); 31 | _CRTIMP errno_t __cdecl _wctime32_s(wchar_t *_Buf,size_t _SizeInWords,const __time32_t *_Time); 32 | _CRTIMP errno_t __cdecl _wstrdate_s(wchar_t *_Buf,size_t _SizeInWords); 33 | _CRTIMP errno_t __cdecl _wstrtime_s(wchar_t *_Buf,size_t _SizeInWords); 34 | #if _INTEGRAL_MAX_BITS >= 64 35 | _CRTIMP errno_t __cdecl _wctime64_s(wchar_t *_Buf,size_t _SizeInWords,const __time64_t *_Time); 36 | #endif 37 | 38 | #if !defined (RC_INVOKED) && !defined (_INC_WTIME_S_INL) 39 | #define _INC_WTIME_S_INL 40 | #ifdef _USE_32BIT_TIME_T 41 | __CRT_INLINE errno_t __cdecl _wctime_s(wchar_t *_Buffer,size_t _SizeInWords,const time_t *_Time) { return _wctime32_s(_Buffer,_SizeInWords,_Time); } 42 | #else 43 | __CRT_INLINE errno_t __cdecl _wctime_s(wchar_t *_Buffer,size_t _SizeInWords,const time_t *_Time) { return _wctime64_s(_Buffer,_SizeInWords,_Time); } 44 | #endif 45 | #endif 46 | #endif 47 | 48 | #ifndef RC_INVOKED 49 | #ifdef _USE_32BIT_TIME_T 50 | __CRT_INLINE errno_t __cdecl localtime_s(struct tm *_Tm,const time_t *_Time) { return _localtime32_s(_Tm,_Time); } 51 | #else 52 | __CRT_INLINE errno_t __cdecl localtime_s(struct tm *_Tm,const time_t *_Time) { return _localtime64_s(_Tm,_Time); } 53 | #endif 54 | #endif 55 | 56 | #ifdef __cplusplus 57 | } 58 | #endif 59 | 60 | #endif 61 | #endif 62 | -------------------------------------------------------------------------------- /win32/include/sec_api/wchar_s.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the w64 mingw-runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | #ifndef _INC_WCHAR_S 7 | #define _INC_WCHAR_S 8 | 9 | #include 10 | 11 | #if defined(MINGW_HAS_SECURE_API) 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | #ifndef _WIO_S_DEFINED 18 | #define _WIO_S_DEFINED 19 | _CRTIMP errno_t __cdecl _waccess_s(const wchar_t *_Filename,int _AccessMode); 20 | _CRTIMP errno_t __cdecl _wmktemp_s(wchar_t *_TemplateName,size_t _SizeInWords); 21 | #endif 22 | 23 | #ifndef _WCONIO_S_DEFINED 24 | #define _WCONIO_S_DEFINED 25 | _CRTIMP errno_t __cdecl _cgetws_s(wchar_t *_Buffer,size_t _SizeInWords,size_t *_SizeRead); 26 | _CRTIMP int __cdecl _cwprintf_s(const wchar_t *_Format,...); 27 | _CRTIMP int __cdecl _cwscanf_s(const wchar_t *_Format,...); 28 | _CRTIMP int __cdecl _cwscanf_s_l(const wchar_t *_Format,_locale_t _Locale,...); 29 | _CRTIMP int __cdecl _vcwprintf_s(const wchar_t *_Format,va_list _ArgList); 30 | _CRTIMP int __cdecl _cwprintf_s_l(const wchar_t *_Format,_locale_t _Locale,...); 31 | _CRTIMP int __cdecl _vcwprintf_s_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); 32 | #endif 33 | 34 | #ifndef _WSTDIO_S_DEFINED 35 | #define _WSTDIO_S_DEFINED 36 | _CRTIMP wchar_t *__cdecl _getws_s(wchar_t *_Str,size_t _SizeInWords); 37 | int __cdecl fwprintf_s(FILE *_File,const wchar_t *_Format,...); 38 | int __cdecl wprintf_s(const wchar_t *_Format,...); 39 | int __cdecl vfwprintf_s(FILE *_File,const wchar_t *_Format,va_list _ArgList); 40 | int __cdecl vwprintf_s(const wchar_t *_Format,va_list _ArgList); 41 | int __cdecl swprintf_s(wchar_t *_Dst,size_t _SizeInWords,const wchar_t *_Format,...); 42 | int __cdecl vswprintf_s(wchar_t *_Dst,size_t _SizeInWords,const wchar_t *_Format,va_list _ArgList); 43 | _CRTIMP int __cdecl _snwprintf_s(wchar_t *_DstBuf,size_t _DstSizeInWords,size_t _MaxCount,const wchar_t *_Format,...); 44 | _CRTIMP int __cdecl _vsnwprintf_s(wchar_t *_DstBuf,size_t _DstSizeInWords,size_t _MaxCount,const wchar_t *_Format,va_list _ArgList); 45 | _CRTIMP int __cdecl _wprintf_s_l(const wchar_t *_Format,_locale_t _Locale,...); 46 | _CRTIMP int __cdecl _vwprintf_s_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); 47 | _CRTIMP int __cdecl _fwprintf_s_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,...); 48 | _CRTIMP int __cdecl _vfwprintf_s_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); 49 | _CRTIMP int __cdecl _swprintf_s_l(wchar_t *_DstBuf,size_t _DstSize,const wchar_t *_Format,_locale_t _Locale,...); 50 | _CRTIMP int __cdecl _vswprintf_s_l(wchar_t *_DstBuf,size_t _DstSize,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); 51 | _CRTIMP int __cdecl _snwprintf_s_l(wchar_t *_DstBuf,size_t _DstSize,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,...); 52 | _CRTIMP int __cdecl _vsnwprintf_s_l(wchar_t *_DstBuf,size_t _DstSize,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); 53 | _CRTIMP int __cdecl _fwscanf_s_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,...); 54 | _CRTIMP int __cdecl _swscanf_s_l(const wchar_t *_Src,const wchar_t *_Format,_locale_t _Locale,...); 55 | _CRTIMP int __cdecl _snwscanf_s(const wchar_t *_Src,size_t _MaxCount,const wchar_t *_Format,...); 56 | _CRTIMP int __cdecl _snwscanf_s_l(const wchar_t *_Src,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,...); 57 | _CRTIMP int __cdecl _wscanf_s_l(const wchar_t *_Format,_locale_t _Locale,...); 58 | _CRTIMP errno_t __cdecl _wfopen_s(FILE **_File,const wchar_t *_Filename,const wchar_t *_Mode); 59 | _CRTIMP errno_t __cdecl _wfreopen_s(FILE **_File,const wchar_t *_Filename,const wchar_t *_Mode,FILE *_OldFile); 60 | _CRTIMP errno_t __cdecl _wtmpnam_s(wchar_t *_DstBuf,size_t _SizeInWords); 61 | #endif 62 | 63 | #ifndef _WSTDLIB_S_DEFINED 64 | #define _WSTDLIB_S_DEFINED 65 | _CRTIMP errno_t __cdecl _itow_s (int _Val,wchar_t *_DstBuf,size_t _SizeInWords,int _Radix); 66 | _CRTIMP errno_t __cdecl _ltow_s (long _Val,wchar_t *_DstBuf,size_t _SizeInWords,int _Radix); 67 | _CRTIMP errno_t __cdecl _ultow_s (unsigned long _Val,wchar_t *_DstBuf,size_t _SizeInWords,int _Radix); 68 | _CRTIMP errno_t __cdecl _wgetenv_s(size_t *_ReturnSize,wchar_t *_DstBuf,size_t _DstSizeInWords,const wchar_t *_VarName); 69 | _CRTIMP errno_t __cdecl _wdupenv_s(wchar_t **_Buffer,size_t *_BufferSizeInWords,const wchar_t *_VarName); 70 | #if _INTEGRAL_MAX_BITS >= 64 71 | _CRTIMP errno_t __cdecl _i64tow_s(__int64 _Val,wchar_t *_DstBuf,size_t _SizeInWords,int _Radix); 72 | _CRTIMP errno_t __cdecl _ui64tow_s(unsigned __int64 _Val,wchar_t *_DstBuf,size_t _SizeInWords,int _Radix); 73 | #endif 74 | #endif 75 | 76 | #ifndef _POSIX_ 77 | #ifndef _WSTDLIBP_S_DEFINED 78 | #define _WSTDLIBP_S_DEFINED 79 | _CRTIMP errno_t __cdecl _wmakepath_s(wchar_t *_PathResult,size_t _SizeInWords,const wchar_t *_Drive,const wchar_t *_Dir,const wchar_t *_Filename,const wchar_t *_Ext); 80 | _CRTIMP errno_t __cdecl _wputenv_s(const wchar_t *_Name,const wchar_t *_Value); 81 | _CRTIMP errno_t __cdecl _wsearchenv_s(const wchar_t *_Filename,const wchar_t *_EnvVar,wchar_t *_ResultPath,size_t _SizeInWords); 82 | _CRTIMP errno_t __cdecl _wsplitpath_s(const wchar_t *_FullPath,wchar_t *_Drive,size_t _DriveSizeInWords,wchar_t *_Dir,size_t _DirSizeInWords,wchar_t *_Filename,size_t _FilenameSizeInWords,wchar_t *_Ext,size_t _ExtSizeInWords); 83 | #endif 84 | #endif 85 | 86 | #ifndef _WSTRING_S_DEFINED 87 | #define _WSTRING_S_DEFINED 88 | _CRTIMP wchar_t *__cdecl wcstok_s(wchar_t *_Str,const wchar_t *_Delim,wchar_t **_Context); 89 | _CRTIMP errno_t __cdecl _wcserror_s(wchar_t *_Buf,size_t _SizeInWords,int _ErrNum); 90 | _CRTIMP errno_t __cdecl __wcserror_s(wchar_t *_Buffer,size_t _SizeInWords,const wchar_t *_ErrMsg); 91 | _CRTIMP errno_t __cdecl _wcsnset_s(wchar_t *_Dst,size_t _DstSizeInWords,wchar_t _Val,size_t _MaxCount); 92 | _CRTIMP errno_t __cdecl _wcsset_s(wchar_t *_Str,size_t _SizeInWords,wchar_t _Val); 93 | _CRTIMP errno_t __cdecl _wcslwr_s(wchar_t *_Str,size_t _SizeInWords); 94 | _CRTIMP errno_t __cdecl _wcslwr_s_l(wchar_t *_Str,size_t _SizeInWords,_locale_t _Locale); 95 | _CRTIMP errno_t __cdecl _wcsupr_s(wchar_t *_Str,size_t _Size); 96 | _CRTIMP errno_t __cdecl _wcsupr_s_l(wchar_t *_Str,size_t _Size,_locale_t _Locale); 97 | #endif 98 | 99 | #ifndef _WTIME_S_DEFINED 100 | #define _WTIME_S_DEFINED 101 | _CRTIMP errno_t __cdecl _wasctime_s(wchar_t *_Buf,size_t _SizeInWords,const struct tm *_Tm); 102 | _CRTIMP errno_t __cdecl _wctime32_s(wchar_t *_Buf,size_t _SizeInWords,const __time32_t *_Time); 103 | _CRTIMP errno_t __cdecl _wstrdate_s(wchar_t *_Buf,size_t _SizeInWords); 104 | _CRTIMP errno_t __cdecl _wstrtime_s(wchar_t *_Buf,size_t _SizeInWords); 105 | #if _INTEGRAL_MAX_BITS >= 64 106 | _CRTIMP errno_t __cdecl _wctime64_s(wchar_t *_Buf,size_t _SizeInWords,const __time64_t *_Time); 107 | #endif 108 | 109 | #if !defined (RC_INVOKED) && !defined (_INC_WTIME_S_INL) 110 | #define _INC_WTIME_S_INL 111 | #ifdef _USE_32BIT_TIME_T 112 | __CRT_INLINE errno_t __cdecl _wctime_s(wchar_t *_Buffer,size_t _SizeInWords,const time_t *_Time) { return _wctime32_s(_Buffer,_SizeInWords,_Time); } 113 | #else 114 | __CRT_INLINE errno_t __cdecl _wctime_s(wchar_t *_Buffer,size_t _SizeInWords,const time_t *_Time) { return _wctime64_s(_Buffer,_SizeInWords,_Time); } 115 | #endif 116 | #endif 117 | #endif 118 | 119 | _CRTIMP errno_t __cdecl mbsrtowcs_s(size_t *_Retval,wchar_t *_Dst,size_t _SizeInWords,const char **_PSrc,size_t _N,mbstate_t *_State); 120 | _CRTIMP errno_t __cdecl wcrtomb_s(size_t *_Retval,char *_Dst,size_t _SizeInBytes,wchar_t _Ch,mbstate_t *_State); 121 | _CRTIMP errno_t __cdecl wcsrtombs_s(size_t *_Retval,char *_Dst,size_t _SizeInBytes,const wchar_t **_Src,size_t _Size,mbstate_t *_State); 122 | 123 | #ifdef __cplusplus 124 | } 125 | #endif 126 | 127 | #endif 128 | #endif 129 | -------------------------------------------------------------------------------- /win32/include/setjmp.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the w64 mingw-runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | #ifndef _INC_SETJMP 7 | #define _INC_SETJMP 8 | 9 | #include <_mingw.h> 10 | 11 | #pragma pack(push,_CRT_PACKING) 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | #if (defined(_X86_) && !defined(__x86_64)) 18 | 19 | #define _JBLEN 16 20 | #define _JBTYPE int 21 | 22 | typedef struct __JUMP_BUFFER { 23 | unsigned long Ebp; 24 | unsigned long Ebx; 25 | unsigned long Edi; 26 | unsigned long Esi; 27 | unsigned long Esp; 28 | unsigned long Eip; 29 | unsigned long Registration; 30 | unsigned long TryLevel; 31 | unsigned long Cookie; 32 | unsigned long UnwindFunc; 33 | unsigned long UnwindData[6]; 34 | } _JUMP_BUFFER; 35 | #elif defined(__ia64__) 36 | typedef _CRT_ALIGN(16) struct _SETJMP_FLOAT128 { 37 | __int64 LowPart; 38 | __int64 HighPart; 39 | } SETJMP_FLOAT128; 40 | 41 | #define _JBLEN 33 42 | typedef SETJMP_FLOAT128 _JBTYPE; 43 | 44 | typedef struct __JUMP_BUFFER { 45 | 46 | unsigned long iAReserved[6]; 47 | 48 | unsigned long Registration; 49 | unsigned long TryLevel; 50 | unsigned long Cookie; 51 | unsigned long UnwindFunc; 52 | 53 | unsigned long UnwindData[6]; 54 | 55 | SETJMP_FLOAT128 FltS0; 56 | SETJMP_FLOAT128 FltS1; 57 | SETJMP_FLOAT128 FltS2; 58 | SETJMP_FLOAT128 FltS3; 59 | SETJMP_FLOAT128 FltS4; 60 | SETJMP_FLOAT128 FltS5; 61 | SETJMP_FLOAT128 FltS6; 62 | SETJMP_FLOAT128 FltS7; 63 | SETJMP_FLOAT128 FltS8; 64 | SETJMP_FLOAT128 FltS9; 65 | SETJMP_FLOAT128 FltS10; 66 | SETJMP_FLOAT128 FltS11; 67 | SETJMP_FLOAT128 FltS12; 68 | SETJMP_FLOAT128 FltS13; 69 | SETJMP_FLOAT128 FltS14; 70 | SETJMP_FLOAT128 FltS15; 71 | SETJMP_FLOAT128 FltS16; 72 | SETJMP_FLOAT128 FltS17; 73 | SETJMP_FLOAT128 FltS18; 74 | SETJMP_FLOAT128 FltS19; 75 | __int64 FPSR; 76 | __int64 StIIP; 77 | __int64 BrS0; 78 | __int64 BrS1; 79 | __int64 BrS2; 80 | __int64 BrS3; 81 | __int64 BrS4; 82 | __int64 IntS0; 83 | __int64 IntS1; 84 | __int64 IntS2; 85 | __int64 IntS3; 86 | __int64 RsBSP; 87 | __int64 RsPFS; 88 | __int64 ApUNAT; 89 | __int64 ApLC; 90 | __int64 IntSp; 91 | __int64 IntNats; 92 | __int64 Preds; 93 | 94 | } _JUMP_BUFFER; 95 | #elif defined(__x86_64) 96 | typedef _CRT_ALIGN(16) struct _SETJMP_FLOAT128 { 97 | unsigned __int64 Part[2]; 98 | } SETJMP_FLOAT128; 99 | 100 | #define _JBLEN 16 101 | typedef SETJMP_FLOAT128 _JBTYPE; 102 | 103 | typedef struct _JUMP_BUFFER { 104 | unsigned __int64 Frame; 105 | unsigned __int64 Rbx; 106 | unsigned __int64 Rsp; 107 | unsigned __int64 Rbp; 108 | unsigned __int64 Rsi; 109 | unsigned __int64 Rdi; 110 | unsigned __int64 R12; 111 | unsigned __int64 R13; 112 | unsigned __int64 R14; 113 | unsigned __int64 R15; 114 | unsigned __int64 Rip; 115 | unsigned __int64 Spare; 116 | SETJMP_FLOAT128 Xmm6; 117 | SETJMP_FLOAT128 Xmm7; 118 | SETJMP_FLOAT128 Xmm8; 119 | SETJMP_FLOAT128 Xmm9; 120 | SETJMP_FLOAT128 Xmm10; 121 | SETJMP_FLOAT128 Xmm11; 122 | SETJMP_FLOAT128 Xmm12; 123 | SETJMP_FLOAT128 Xmm13; 124 | SETJMP_FLOAT128 Xmm14; 125 | SETJMP_FLOAT128 Xmm15; 126 | } _JUMP_BUFFER; 127 | #endif 128 | #ifndef _JMP_BUF_DEFINED 129 | typedef _JBTYPE jmp_buf[_JBLEN]; 130 | #define _JMP_BUF_DEFINED 131 | #endif 132 | 133 | void * __cdecl __attribute__ ((__nothrow__)) mingw_getsp(void); 134 | 135 | #ifdef USE_MINGW_SETJMP_TWO_ARGS 136 | #ifndef _INC_SETJMPEX 137 | #define setjmp(BUF) _setjmp((BUF),mingw_getsp()) 138 | int __cdecl __attribute__ ((__nothrow__)) _setjmp(jmp_buf _Buf,void *_Ctx); 139 | #else 140 | #undef setjmp 141 | #define setjmp(BUF) _setjmpex((BUF),mingw_getsp()) 142 | #define setjmpex(BUF) _setjmpex((BUF),mingw_getsp()) 143 | int __cdecl __attribute__ ((__nothrow__)) _setjmpex(jmp_buf _Buf,void *_Ctx); 144 | #endif 145 | #else 146 | #ifndef _INC_SETJMPEX 147 | #define setjmp _setjmp 148 | #endif 149 | int __cdecl __attribute__ ((__nothrow__)) setjmp(jmp_buf _Buf); 150 | #endif 151 | 152 | __declspec(noreturn) __attribute__ ((__nothrow__)) void __cdecl ms_longjmp(jmp_buf _Buf,int _Value)/* throw(...)*/; 153 | __declspec(noreturn) __attribute__ ((__nothrow__)) void __cdecl longjmp(jmp_buf _Buf,int _Value); 154 | 155 | #ifdef __cplusplus 156 | } 157 | #endif 158 | 159 | #pragma pack(pop) 160 | #endif 161 | -------------------------------------------------------------------------------- /win32/include/share.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the w64 mingw-runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | #ifndef _INC_SHARE 7 | #define _INC_SHARE 8 | 9 | #ifndef _WIN32 10 | #error Only Win32 target is supported! 11 | #endif 12 | 13 | #define _SH_COMPAT 0x00 14 | #define _SH_DENYRW 0x10 15 | #define _SH_DENYWR 0x20 16 | #define _SH_DENYRD 0x30 17 | #define _SH_DENYNO 0x40 18 | #define _SH_SECURE 0x80 19 | 20 | #ifndef NO_OLDNAMES 21 | #define SH_COMPAT _SH_COMPAT 22 | #define SH_DENYRW _SH_DENYRW 23 | #define SH_DENYWR _SH_DENYWR 24 | #define SH_DENYRD _SH_DENYRD 25 | #define SH_DENYNO _SH_DENYNO 26 | #endif 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /win32/include/signal.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the w64 mingw-runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | #ifndef _INC_SIGNAL 7 | #define _INC_SIGNAL 8 | 9 | #include <_mingw.h> 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | #ifndef _SIG_ATOMIC_T_DEFINED 16 | #define _SIG_ATOMIC_T_DEFINED 17 | typedef int sig_atomic_t; 18 | #endif 19 | 20 | #define NSIG 23 21 | 22 | #define SIGHUP 1 /* hangup */ 23 | #define SIGINT 2 24 | #define SIGQUIT 3 /* quit */ 25 | #define SIGILL 4 26 | #define SIGTRAP 5 /* trace trap (not reset when caught) */ 27 | #define SIGIOT 6 /* IOT instruction */ 28 | #define SIGABRT 6 /* used by abort, replace SIGIOT in the future */ 29 | #define SIGEMT 7 /* EMT instruction */ 30 | #define SIGFPE 8 31 | #define SIGKILL 9 /* kill (cannot be caught or ignored) */ 32 | #define SIGBUS 10 /* bus error */ 33 | #define SIGSEGV 11 34 | #define SIGSYS 12 /* bad argument to system call */ 35 | #define SIGPIPE 13 /* write on a pipe with no one to read it */ 36 | #ifdef __USE_MINGW_ALARM 37 | #define SIGALRM 14 /* alarm clock */ 38 | #endif 39 | #define SIGTERM 15 40 | #define SIGBREAK 21 41 | #define SIGABRT2 22 42 | 43 | #define SIGABRT_COMPAT 6 44 | 45 | typedef void (*__p_sig_fn_t)(int); 46 | 47 | #define SIG_DFL (__p_sig_fn_t)0 48 | #define SIG_IGN (__p_sig_fn_t)1 49 | #define SIG_GET (__p_sig_fn_t)2 50 | #define SIG_SGE (__p_sig_fn_t)3 51 | #define SIG_ACK (__p_sig_fn_t)4 52 | #define SIG_ERR (__p_sig_fn_t)-1 53 | 54 | extern void **__cdecl __pxcptinfoptrs(void); 55 | #define _pxcptinfoptrs (*__pxcptinfoptrs()) 56 | 57 | __p_sig_fn_t __cdecl signal(int _SigNum,__p_sig_fn_t _Func); 58 | int __cdecl raise(int _SigNum); 59 | 60 | #ifdef __cplusplus 61 | } 62 | #endif 63 | #endif 64 | -------------------------------------------------------------------------------- /win32/include/stdint.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the w64 mingw-runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | /* ISO C9x 7.18 Integer types 7 | * Based on ISO/IEC SC22/WG14 9899 Committee draft (SC22 N2794) 8 | * 9 | * THIS SOFTWARE IS NOT COPYRIGHTED 10 | * 11 | * Contributor: Danny Smith 12 | * 13 | * This source code is offered for use in the public domain. You may 14 | * use, modify or distribute it freely. 15 | * 16 | * This code is distributed in the hope that it will be useful but 17 | * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY 18 | * DISCLAIMED. This includes but is not limited to warranties of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 20 | * 21 | * Date: 2000-12-02 22 | */ 23 | 24 | 25 | #ifndef _STDINT_H 26 | #define _STDINT_H 27 | 28 | #include <_mingw.h> 29 | 30 | #define __need_wint_t 31 | #define __need_wchar_t 32 | #include "stddef.h" 33 | 34 | #ifndef __int8_t_defined 35 | #define __int8_t_defined 36 | /* 7.18.1.1 Exact-width integer types */ 37 | typedef signed char int8_t; 38 | typedef unsigned char uint8_t; 39 | typedef short int16_t; 40 | typedef unsigned short uint16_t; 41 | typedef int int32_t; 42 | typedef unsigned uint32_t; 43 | typedef long long int64_t; 44 | typedef unsigned long long uint64_t; 45 | #endif 46 | 47 | /* 7.18.1.2 Minimum-width integer types */ 48 | typedef signed char int_least8_t; 49 | typedef unsigned char uint_least8_t; 50 | typedef short int_least16_t; 51 | typedef unsigned short uint_least16_t; 52 | typedef int int_least32_t; 53 | typedef unsigned uint_least32_t; 54 | typedef long long int_least64_t; 55 | typedef unsigned long long uint_least64_t; 56 | 57 | /* 7.18.1.3 Fastest minimum-width integer types 58 | * Not actually guaranteed to be fastest for all purposes 59 | * Here we use the exact-width types for 8 and 16-bit ints. 60 | */ 61 | typedef char int_fast8_t; 62 | typedef unsigned char uint_fast8_t; 63 | typedef short int_fast16_t; 64 | typedef unsigned short uint_fast16_t; 65 | typedef int int_fast32_t; 66 | typedef unsigned int uint_fast32_t; 67 | typedef long long int_fast64_t; 68 | typedef unsigned long long uint_fast64_t; 69 | 70 | /* 7.18.1.5 Greatest-width integer types */ 71 | typedef long long intmax_t; 72 | typedef unsigned long long uintmax_t; 73 | 74 | /* 7.18.2 Limits of specified-width integer types */ 75 | #if !defined ( __cplusplus) || defined (__STDC_LIMIT_MACROS) 76 | 77 | /* 7.18.2.1 Limits of exact-width integer types */ 78 | #define INT8_MIN (-128) 79 | #define INT16_MIN (-32768) 80 | #define INT32_MIN (-2147483647 - 1) 81 | #define INT64_MIN (-9223372036854775807LL - 1) 82 | 83 | #define INT8_MAX 127 84 | #define INT16_MAX 32767 85 | #define INT32_MAX 2147483647 86 | #define INT64_MAX 9223372036854775807LL 87 | 88 | #define UINT8_MAX 0xff /* 255U */ 89 | #define UINT16_MAX 0xffff /* 65535U */ 90 | #define UINT32_MAX 0xffffffff /* 4294967295U */ 91 | #define UINT64_MAX 0xffffffffffffffffULL /* 18446744073709551615ULL */ 92 | 93 | /* 7.18.2.2 Limits of minimum-width integer types */ 94 | #define INT_LEAST8_MIN INT8_MIN 95 | #define INT_LEAST16_MIN INT16_MIN 96 | #define INT_LEAST32_MIN INT32_MIN 97 | #define INT_LEAST64_MIN INT64_MIN 98 | 99 | #define INT_LEAST8_MAX INT8_MAX 100 | #define INT_LEAST16_MAX INT16_MAX 101 | #define INT_LEAST32_MAX INT32_MAX 102 | #define INT_LEAST64_MAX INT64_MAX 103 | 104 | #define UINT_LEAST8_MAX UINT8_MAX 105 | #define UINT_LEAST16_MAX UINT16_MAX 106 | #define UINT_LEAST32_MAX UINT32_MAX 107 | #define UINT_LEAST64_MAX UINT64_MAX 108 | 109 | /* 7.18.2.3 Limits of fastest minimum-width integer types */ 110 | #define INT_FAST8_MIN INT8_MIN 111 | #define INT_FAST16_MIN INT16_MIN 112 | #define INT_FAST32_MIN INT32_MIN 113 | #define INT_FAST64_MIN INT64_MIN 114 | 115 | #define INT_FAST8_MAX INT8_MAX 116 | #define INT_FAST16_MAX INT16_MAX 117 | #define INT_FAST32_MAX INT32_MAX 118 | #define INT_FAST64_MAX INT64_MAX 119 | 120 | #define UINT_FAST8_MAX UINT8_MAX 121 | #define UINT_FAST16_MAX UINT16_MAX 122 | #define UINT_FAST32_MAX UINT32_MAX 123 | #define UINT_FAST64_MAX UINT64_MAX 124 | 125 | /* 7.18.2.4 Limits of integer types capable of holding 126 | object pointers */ 127 | #ifdef _WIN64 128 | #define INTPTR_MIN INT64_MIN 129 | #define INTPTR_MAX INT64_MAX 130 | #define UINTPTR_MAX UINT64_MAX 131 | #else 132 | #define INTPTR_MIN INT32_MIN 133 | #define INTPTR_MAX INT32_MAX 134 | #define UINTPTR_MAX UINT32_MAX 135 | #endif 136 | 137 | /* 7.18.2.5 Limits of greatest-width integer types */ 138 | #define INTMAX_MIN INT64_MIN 139 | #define INTMAX_MAX INT64_MAX 140 | #define UINTMAX_MAX UINT64_MAX 141 | 142 | /* 7.18.3 Limits of other integer types */ 143 | #ifdef _WIN64 144 | #define PTRDIFF_MIN INT64_MIN 145 | #define PTRDIFF_MAX INT64_MAX 146 | #else 147 | #define PTRDIFF_MIN INT32_MIN 148 | #define PTRDIFF_MAX INT32_MAX 149 | #endif 150 | 151 | #define SIG_ATOMIC_MIN INT32_MIN 152 | #define SIG_ATOMIC_MAX INT32_MAX 153 | 154 | #ifndef SIZE_MAX 155 | #ifdef _WIN64 156 | #define SIZE_MAX UINT64_MAX 157 | #else 158 | #define SIZE_MAX UINT32_MAX 159 | #endif 160 | #endif 161 | 162 | #ifndef WCHAR_MIN /* also in wchar.h */ 163 | #define WCHAR_MIN 0 164 | #define WCHAR_MAX ((wchar_t)-1) /* UINT16_MAX */ 165 | #endif 166 | 167 | /* 168 | * wint_t is unsigned short for compatibility with MS runtime 169 | */ 170 | #define WINT_MIN 0 171 | #define WINT_MAX ((wint_t)-1) /* UINT16_MAX */ 172 | 173 | #endif /* !defined ( __cplusplus) || defined __STDC_LIMIT_MACROS */ 174 | 175 | 176 | /* 7.18.4 Macros for integer constants */ 177 | #if !defined ( __cplusplus) || defined (__STDC_CONSTANT_MACROS) 178 | 179 | /* 7.18.4.1 Macros for minimum-width integer constants 180 | 181 | According to Douglas Gwyn : 182 | "This spec was changed in ISO/IEC 9899:1999 TC1; in ISO/IEC 183 | 9899:1999 as initially published, the expansion was required 184 | to be an integer constant of precisely matching type, which 185 | is impossible to accomplish for the shorter types on most 186 | platforms, because C99 provides no standard way to designate 187 | an integer constant with width less than that of type int. 188 | TC1 changed this to require just an integer constant 189 | *expression* with *promoted* type." 190 | 191 | The trick used here is from Clive D W Feather. 192 | */ 193 | 194 | #define INT8_C(val) (INT_LEAST8_MAX-INT_LEAST8_MAX+(val)) 195 | #define INT16_C(val) (INT_LEAST16_MAX-INT_LEAST16_MAX+(val)) 196 | #define INT32_C(val) (INT_LEAST32_MAX-INT_LEAST32_MAX+(val)) 197 | /* The 'trick' doesn't work in C89 for long long because, without 198 | suffix, (val) will be evaluated as int, not intmax_t */ 199 | #define INT64_C(val) val##LL 200 | 201 | #define UINT8_C(val) (UINT_LEAST8_MAX-UINT_LEAST8_MAX+(val)) 202 | #define UINT16_C(val) (UINT_LEAST16_MAX-UINT_LEAST16_MAX+(val)) 203 | #define UINT32_C(val) (UINT_LEAST32_MAX-UINT_LEAST32_MAX+(val)) 204 | #define UINT64_C(val) val##ULL 205 | 206 | /* 7.18.4.2 Macros for greatest-width integer constants */ 207 | #define INTMAX_C(val) val##LL 208 | #define UINTMAX_C(val) val##ULL 209 | 210 | #endif /* !defined ( __cplusplus) || defined __STDC_CONSTANT_MACROS */ 211 | 212 | #endif 213 | -------------------------------------------------------------------------------- /win32/include/string.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the w64 mingw-runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | #ifndef _INC_STRING 7 | #define _INC_STRING 8 | 9 | #include <_mingw.h> 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | #ifndef _NLSCMP_DEFINED 16 | #define _NLSCMP_DEFINED 17 | #define _NLSCMPERROR 2147483647 18 | #endif 19 | 20 | #ifndef NULL 21 | #ifdef __cplusplus 22 | #define NULL 0 23 | #else 24 | #define NULL ((void *)0) 25 | #endif 26 | #endif 27 | 28 | #define _WConst_return _CONST_RETURN 29 | 30 | #ifndef _CRT_MEMORY_DEFINED 31 | #define _CRT_MEMORY_DEFINED 32 | _CRTIMP void *__cdecl _memccpy(void *_Dst,const void *_Src,int _Val,size_t _MaxCount); 33 | _CONST_RETURN void *__cdecl memchr(const void *_Buf ,int _Val,size_t _MaxCount); 34 | _CRTIMP int __cdecl _memicmp(const void *_Buf1,const void *_Buf2,size_t _Size); 35 | _CRTIMP int __cdecl _memicmp_l(const void *_Buf1,const void *_Buf2,size_t _Size,_locale_t _Locale); 36 | int __cdecl memcmp(const void *_Buf1,const void *_Buf2,size_t _Size); 37 | void *__cdecl memcpy(void *_Dst,const void *_Src,size_t _Size); 38 | void *__cdecl memset(void *_Dst,int _Val,size_t _Size); 39 | #ifndef NO_OLDNAMES 40 | void *__cdecl memccpy(void *_Dst,const void *_Src,int _Val,size_t _Size); 41 | int __cdecl memicmp(const void *_Buf1,const void *_Buf2,size_t _Size); 42 | #endif 43 | #endif 44 | char *__cdecl _strset(char *_Str,int _Val); 45 | char *__cdecl strcpy(char *_Dest,const char *_Source); 46 | char *__cdecl strcat(char *_Dest,const char *_Source); 47 | int __cdecl strcmp(const char *_Str1,const char *_Str2); 48 | size_t __cdecl strlen(const char *_Str); 49 | #if 0 50 | size_t __cdecl strnlen(const char *_Str,size_t _MaxCount); 51 | #endif 52 | void *__cdecl memmove(void *_Dst,const void *_Src,size_t _Size); 53 | _CRTIMP char *__cdecl _strdup(const char *_Src); 54 | _CONST_RETURN char *__cdecl strchr(const char *_Str,int _Val); 55 | _CRTIMP int __cdecl _stricmp(const char *_Str1,const char *_Str2); 56 | _CRTIMP int __cdecl _strcmpi(const char *_Str1,const char *_Str2); 57 | _CRTIMP int __cdecl _stricmp_l(const char *_Str1,const char *_Str2,_locale_t _Locale); 58 | int __cdecl strcoll(const char *_Str1,const char *_Str2); 59 | _CRTIMP int __cdecl _strcoll_l(const char *_Str1,const char *_Str2,_locale_t _Locale); 60 | _CRTIMP int __cdecl _stricoll(const char *_Str1,const char *_Str2); 61 | _CRTIMP int __cdecl _stricoll_l(const char *_Str1,const char *_Str2,_locale_t _Locale); 62 | _CRTIMP int __cdecl _strncoll (const char *_Str1,const char *_Str2,size_t _MaxCount); 63 | _CRTIMP int __cdecl _strncoll_l(const char *_Str1,const char *_Str2,size_t _MaxCount,_locale_t _Locale); 64 | _CRTIMP int __cdecl _strnicoll (const char *_Str1,const char *_Str2,size_t _MaxCount); 65 | _CRTIMP int __cdecl _strnicoll_l(const char *_Str1,const char *_Str2,size_t _MaxCount,_locale_t _Locale); 66 | size_t __cdecl strcspn(const char *_Str,const char *_Control); 67 | _CRTIMP char *__cdecl _strerror(const char *_ErrMsg); 68 | char *__cdecl strerror(int); 69 | _CRTIMP char *__cdecl _strlwr(char *_String); 70 | char *strlwr_l(char *_String,_locale_t _Locale); 71 | char *__cdecl strncat(char *_Dest,const char *_Source,size_t _Count); 72 | int __cdecl strncmp(const char *_Str1,const char *_Str2,size_t _MaxCount); 73 | _CRTIMP int __cdecl _strnicmp(const char *_Str1,const char *_Str2,size_t _MaxCount); 74 | _CRTIMP int __cdecl _strnicmp_l(const char *_Str1,const char *_Str2,size_t _MaxCount,_locale_t _Locale); 75 | char *strncpy(char *_Dest,const char *_Source,size_t _Count); 76 | _CRTIMP char *__cdecl _strnset(char *_Str,int _Val,size_t _MaxCount); 77 | _CONST_RETURN char *__cdecl strpbrk(const char *_Str,const char *_Control); 78 | _CONST_RETURN char *__cdecl strrchr(const char *_Str,int _Ch); 79 | _CRTIMP char *__cdecl _strrev(char *_Str); 80 | size_t __cdecl strspn(const char *_Str,const char *_Control); 81 | _CONST_RETURN char *__cdecl strstr(const char *_Str,const char *_SubStr); 82 | char *__cdecl strtok(char *_Str,const char *_Delim); 83 | _CRTIMP char *__cdecl _strupr(char *_String); 84 | _CRTIMP char *_strupr_l(char *_String,_locale_t _Locale); 85 | size_t __cdecl strxfrm(char *_Dst,const char *_Src,size_t _MaxCount); 86 | _CRTIMP size_t __cdecl _strxfrm_l(char *_Dst,const char *_Src,size_t _MaxCount,_locale_t _Locale); 87 | 88 | #ifndef NO_OLDNAMES 89 | char *__cdecl strdup(const char *_Src); 90 | int __cdecl strcmpi(const char *_Str1,const char *_Str2); 91 | int __cdecl stricmp(const char *_Str1,const char *_Str2); 92 | char *__cdecl strlwr(char *_Str); 93 | int __cdecl strnicmp(const char *_Str1,const char *_Str,size_t _MaxCount); 94 | __CRT_INLINE int __cdecl strncasecmp (const char *__sz1, const char *__sz2, size_t __sizeMaxCompare) { return _strnicmp (__sz1, __sz2, __sizeMaxCompare); } 95 | __CRT_INLINE int __cdecl strcasecmp (const char *__sz1, const char *__sz2) { return _stricmp (__sz1, __sz2); } 96 | char *__cdecl strnset(char *_Str,int _Val,size_t _MaxCount); 97 | char *__cdecl strrev(char *_Str); 98 | char *__cdecl strset(char *_Str,int _Val); 99 | char *__cdecl strupr(char *_Str); 100 | #endif 101 | 102 | #ifndef _WSTRING_DEFINED 103 | #define _WSTRING_DEFINED 104 | 105 | _CRTIMP wchar_t *__cdecl _wcsdup(const wchar_t *_Str); 106 | wchar_t *__cdecl wcscat(wchar_t *_Dest,const wchar_t *_Source); 107 | _CONST_RETURN wchar_t *__cdecl wcschr(const wchar_t *_Str,wchar_t _Ch); 108 | int __cdecl wcscmp(const wchar_t *_Str1,const wchar_t *_Str2); 109 | wchar_t *__cdecl wcscpy(wchar_t *_Dest,const wchar_t *_Source); 110 | size_t __cdecl wcscspn(const wchar_t *_Str,const wchar_t *_Control); 111 | size_t __cdecl wcslen(const wchar_t *_Str); 112 | size_t __cdecl wcsnlen(const wchar_t *_Src,size_t _MaxCount); 113 | wchar_t *wcsncat(wchar_t *_Dest,const wchar_t *_Source,size_t _Count); 114 | int __cdecl wcsncmp(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount); 115 | wchar_t *wcsncpy(wchar_t *_Dest,const wchar_t *_Source,size_t _Count); 116 | _CONST_RETURN wchar_t *__cdecl wcspbrk(const wchar_t *_Str,const wchar_t *_Control); 117 | _CONST_RETURN wchar_t *__cdecl wcsrchr(const wchar_t *_Str,wchar_t _Ch); 118 | size_t __cdecl wcsspn(const wchar_t *_Str,const wchar_t *_Control); 119 | _CONST_RETURN wchar_t *__cdecl wcsstr(const wchar_t *_Str,const wchar_t *_SubStr); 120 | wchar_t *__cdecl wcstok(wchar_t *_Str,const wchar_t *_Delim); 121 | _CRTIMP wchar_t *__cdecl _wcserror(int _ErrNum); 122 | _CRTIMP wchar_t *__cdecl __wcserror(const wchar_t *_Str); 123 | _CRTIMP int __cdecl _wcsicmp(const wchar_t *_Str1,const wchar_t *_Str2); 124 | _CRTIMP int __cdecl _wcsicmp_l(const wchar_t *_Str1,const wchar_t *_Str2,_locale_t _Locale); 125 | _CRTIMP int __cdecl _wcsnicmp(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount); 126 | _CRTIMP int __cdecl _wcsnicmp_l(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount,_locale_t _Locale); 127 | _CRTIMP wchar_t *__cdecl _wcsnset(wchar_t *_Str,wchar_t _Val,size_t _MaxCount); 128 | _CRTIMP wchar_t *__cdecl _wcsrev(wchar_t *_Str); 129 | _CRTIMP wchar_t *__cdecl _wcsset(wchar_t *_Str,wchar_t _Val); 130 | _CRTIMP wchar_t *__cdecl _wcslwr(wchar_t *_String); 131 | _CRTIMP wchar_t *_wcslwr_l(wchar_t *_String,_locale_t _Locale); 132 | _CRTIMP wchar_t *__cdecl _wcsupr(wchar_t *_String); 133 | _CRTIMP wchar_t *_wcsupr_l(wchar_t *_String,_locale_t _Locale); 134 | size_t __cdecl wcsxfrm(wchar_t *_Dst,const wchar_t *_Src,size_t _MaxCount); 135 | _CRTIMP size_t __cdecl _wcsxfrm_l(wchar_t *_Dst,const wchar_t *_Src,size_t _MaxCount,_locale_t _Locale); 136 | int __cdecl wcscoll(const wchar_t *_Str1,const wchar_t *_Str2); 137 | _CRTIMP int __cdecl _wcscoll_l(const wchar_t *_Str1,const wchar_t *_Str2,_locale_t _Locale); 138 | _CRTIMP int __cdecl _wcsicoll(const wchar_t *_Str1,const wchar_t *_Str2); 139 | _CRTIMP int __cdecl _wcsicoll_l(const wchar_t *_Str1,const wchar_t *_Str2,_locale_t _Locale); 140 | _CRTIMP int __cdecl _wcsncoll(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount); 141 | _CRTIMP int __cdecl _wcsncoll_l(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount,_locale_t _Locale); 142 | _CRTIMP int __cdecl _wcsnicoll(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount); 143 | _CRTIMP int __cdecl _wcsnicoll_l(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount,_locale_t _Locale); 144 | 145 | #ifndef NO_OLDNAMES 146 | wchar_t *__cdecl wcsdup(const wchar_t *_Str); 147 | #define wcswcs wcsstr 148 | int __cdecl wcsicmp(const wchar_t *_Str1,const wchar_t *_Str2); 149 | int __cdecl wcsnicmp(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount); 150 | wchar_t *__cdecl wcsnset(wchar_t *_Str,wchar_t _Val,size_t _MaxCount); 151 | wchar_t *__cdecl wcsrev(wchar_t *_Str); 152 | wchar_t *__cdecl wcsset(wchar_t *_Str,wchar_t _Val); 153 | wchar_t *__cdecl wcslwr(wchar_t *_Str); 154 | wchar_t *__cdecl wcsupr(wchar_t *_Str); 155 | int __cdecl wcsicoll(const wchar_t *_Str1,const wchar_t *_Str2); 156 | #endif 157 | #endif 158 | 159 | #ifdef __cplusplus 160 | } 161 | #endif 162 | 163 | #include 164 | #endif 165 | -------------------------------------------------------------------------------- /win32/include/sys/fcntl.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the w64 mingw-runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | /* 7 | * This file is part of the Mingw32 package. 8 | * 9 | * This fcntl.h maps to the root fcntl.h 10 | */ 11 | #ifndef __STRICT_ANSI__ 12 | #include 13 | #endif 14 | -------------------------------------------------------------------------------- /win32/include/sys/file.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the w64 mingw-runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | /* 7 | * This file is part of the Mingw32 package. 8 | * 9 | * This file.h maps to the root fcntl.h 10 | * TODO? 11 | */ 12 | #ifndef __STRICT_ANSI__ 13 | #include 14 | #endif 15 | -------------------------------------------------------------------------------- /win32/include/sys/locking.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the w64 mingw-runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | #ifndef _INC_LOCKING 7 | #define _INC_LOCKING 8 | 9 | #ifndef _WIN32 10 | #error Only Win32 target is supported! 11 | #endif 12 | 13 | /* All the headers include this file. */ 14 | #include <_mingw.h> 15 | 16 | #define _LK_UNLCK 0 17 | #define _LK_LOCK 1 18 | #define _LK_NBLCK 2 19 | #define _LK_RLCK 3 20 | #define _LK_NBRLCK 4 21 | 22 | #ifndef NO_OLDNAMES 23 | #define LK_UNLCK _LK_UNLCK 24 | #define LK_LOCK _LK_LOCK 25 | #define LK_NBLCK _LK_NBLCK 26 | #define LK_RLCK _LK_RLCK 27 | #define LK_NBRLCK _LK_NBRLCK 28 | #endif 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /win32/include/sys/stat.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the w64 mingw-runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | #ifndef _INC_STAT 7 | #define _INC_STAT 8 | 9 | #ifndef _WIN32 10 | #error Only Win32 target is supported! 11 | #endif 12 | 13 | #include <_mingw.h> 14 | #include 15 | 16 | #pragma pack(push,_CRT_PACKING) 17 | 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | #ifndef _CRTIMP 23 | #define _CRTIMP __declspec(dllimport) 24 | #endif 25 | 26 | #include 27 | 28 | #ifndef __TINYC__ /* gr */ 29 | #ifdef _USE_32BIT_TIME_T 30 | #ifdef _WIN64 31 | #undef _USE_32BIT_TIME_T 32 | #endif 33 | #else 34 | #if _INTEGRAL_MAX_BITS < 64 35 | #define _USE_32BIT_TIME_T 36 | #endif 37 | #endif 38 | #endif 39 | 40 | #ifndef _TIME32_T_DEFINED 41 | typedef long __time32_t; 42 | #define _TIME32_T_DEFINED 43 | #endif 44 | 45 | #ifndef _TIME64_T_DEFINED 46 | #if _INTEGRAL_MAX_BITS >= 64 47 | typedef __int64 __time64_t; 48 | #endif 49 | #define _TIME64_T_DEFINED 50 | #endif 51 | 52 | #ifndef _TIME_T_DEFINED 53 | #ifdef _USE_32BIT_TIME_T 54 | typedef __time32_t time_t; 55 | #else 56 | typedef __time64_t time_t; 57 | #endif 58 | #define _TIME_T_DEFINED 59 | #endif 60 | 61 | #ifndef _WCHAR_T_DEFINED 62 | typedef unsigned short wchar_t; 63 | #define _WCHAR_T_DEFINED 64 | #endif 65 | 66 | #ifndef _STAT_DEFINED 67 | 68 | #ifdef _USE_32BIT_TIME_T 69 | #ifndef _WIN64 70 | #define _fstat32 _fstat 71 | #define _stat32 _stat 72 | #define _wstat32 _wstat 73 | #else 74 | #define _fstat _fstat32 75 | #define _stat _stat32 76 | #define _wstat _wstat32 77 | #endif 78 | #define _fstati64 _fstat32i64 79 | #define _stati64 _stat32i64 80 | #define _wstati64 _wstat32i64 81 | #else 82 | #define _fstat _fstat64i32 83 | #define _fstati64 _fstat64 84 | #define _stat _stat64 85 | #define _stati64 _stat64 86 | #define _wstat _wstat64 87 | #define _wstati64 _wstat64 88 | #endif 89 | 90 | struct _stat32 { 91 | _dev_t st_dev; 92 | _ino_t st_ino; 93 | unsigned short st_mode; 94 | short st_nlink; 95 | short st_uid; 96 | short st_gid; 97 | _dev_t st_rdev; 98 | _off_t st_size; 99 | __time32_t st_atime; 100 | __time32_t st_mtime; 101 | __time32_t st_ctime; 102 | }; 103 | 104 | #ifndef NO_OLDNAMES 105 | struct stat { 106 | _dev_t st_dev; 107 | _ino_t st_ino; 108 | unsigned short st_mode; 109 | short st_nlink; 110 | short st_uid; 111 | short st_gid; 112 | _dev_t st_rdev; 113 | _off_t st_size; 114 | time_t st_atime; 115 | time_t st_mtime; 116 | time_t st_ctime; 117 | }; 118 | #endif 119 | 120 | #if _INTEGRAL_MAX_BITS >= 64 121 | struct _stat32i64 { 122 | _dev_t st_dev; 123 | _ino_t st_ino; 124 | unsigned short st_mode; 125 | short st_nlink; 126 | short st_uid; 127 | short st_gid; 128 | _dev_t st_rdev; 129 | __int64 st_size; 130 | __time32_t st_atime; 131 | __time32_t st_mtime; 132 | __time32_t st_ctime; 133 | }; 134 | 135 | struct _stat64i32 { 136 | _dev_t st_dev; 137 | _ino_t st_ino; 138 | unsigned short st_mode; 139 | short st_nlink; 140 | short st_uid; 141 | short st_gid; 142 | _dev_t st_rdev; 143 | _off_t st_size; 144 | __time64_t st_atime; 145 | __time64_t st_mtime; 146 | __time64_t st_ctime; 147 | }; 148 | 149 | struct _stat64 { 150 | _dev_t st_dev; 151 | _ino_t st_ino; 152 | unsigned short st_mode; 153 | short st_nlink; 154 | short st_uid; 155 | short st_gid; 156 | _dev_t st_rdev; 157 | __int64 st_size; 158 | __time64_t st_atime; 159 | __time64_t st_mtime; 160 | __time64_t st_ctime; 161 | }; 162 | #endif 163 | 164 | #define __stat64 _stat64 165 | 166 | #define _STAT_DEFINED 167 | #endif 168 | 169 | #define _S_IFMT 0xF000 170 | #define _S_IFDIR 0x4000 171 | #define _S_IFCHR 0x2000 172 | #define _S_IFIFO 0x1000 173 | #define _S_IFREG 0x8000 174 | #define _S_IREAD 0x0100 175 | #define _S_IWRITE 0x0080 176 | #define _S_IEXEC 0x0040 177 | 178 | _CRTIMP int __cdecl _fstat32(int _FileDes,struct _stat32 *_Stat); 179 | _CRTIMP int __cdecl _stat32(const char *_Name,struct _stat32 *_Stat); 180 | #if _INTEGRAL_MAX_BITS >= 64 181 | _CRTIMP int __cdecl _fstat64(int _FileDes,struct _stat64 *_Stat); 182 | _CRTIMP int __cdecl _fstat32i64(int _FileDes,struct _stat32i64 *_Stat); 183 | int __cdecl _fstat64i32(int _FileDes,struct _stat64i32 *_Stat); 184 | __CRT_INLINE int __cdecl _fstat64i32(int _FileDes,struct _stat64i32 *_Stat) 185 | { 186 | struct _stat64 st; 187 | int ret=_fstat64(_FileDes,&st); 188 | _Stat->st_dev=st.st_dev; 189 | _Stat->st_ino=st.st_ino; 190 | _Stat->st_mode=st.st_mode; 191 | _Stat->st_nlink=st.st_nlink; 192 | _Stat->st_uid=st.st_uid; 193 | _Stat->st_gid=st.st_gid; 194 | _Stat->st_rdev=st.st_rdev; 195 | _Stat->st_size=(_off_t) st.st_size; 196 | _Stat->st_atime=st.st_atime; 197 | _Stat->st_mtime=st.st_mtime; 198 | _Stat->st_ctime=st.st_ctime; 199 | return ret; 200 | } 201 | _CRTIMP int __cdecl _stat64(const char *_Name,struct _stat64 *_Stat); 202 | _CRTIMP int __cdecl _stat32i64(const char *_Name,struct _stat32i64 *_Stat); 203 | int __cdecl _stat64i32(const char *_Name,struct _stat64i32 *_Stat); 204 | __CRT_INLINE int __cdecl _stat64i32(const char *_Name,struct _stat64i32 *_Stat) 205 | { 206 | struct _stat64 st; 207 | int ret=_stat64(_Name,&st); 208 | _Stat->st_dev=st.st_dev; 209 | _Stat->st_ino=st.st_ino; 210 | _Stat->st_mode=st.st_mode; 211 | _Stat->st_nlink=st.st_nlink; 212 | _Stat->st_uid=st.st_uid; 213 | _Stat->st_gid=st.st_gid; 214 | _Stat->st_rdev=st.st_rdev; 215 | _Stat->st_size=(_off_t) st.st_size; 216 | _Stat->st_atime=st.st_atime; 217 | _Stat->st_mtime=st.st_mtime; 218 | _Stat->st_ctime=st.st_ctime; 219 | return ret; 220 | } 221 | #endif 222 | 223 | #ifndef _WSTAT_DEFINED 224 | #define _WSTAT_DEFINED 225 | _CRTIMP int __cdecl _wstat32(const wchar_t *_Name,struct _stat32 *_Stat); 226 | #if _INTEGRAL_MAX_BITS >= 64 227 | _CRTIMP int __cdecl _wstat32i64(const wchar_t *_Name,struct _stat32i64 *_Stat); 228 | int __cdecl _wstat64i32(const wchar_t *_Name,struct _stat64i32 *_Stat); 229 | _CRTIMP int __cdecl _wstat64(const wchar_t *_Name,struct _stat64 *_Stat); 230 | #endif 231 | #endif 232 | 233 | #ifndef NO_OLDNAMES 234 | #define _S_IFBLK 0x3000 /* Block: Is this ever set under w32? */ 235 | 236 | #define S_IFMT _S_IFMT 237 | #define S_IFDIR _S_IFDIR 238 | #define S_IFCHR _S_IFCHR 239 | #define S_IFREG _S_IFREG 240 | #define S_IREAD _S_IREAD 241 | #define S_IWRITE _S_IWRITE 242 | #define S_IEXEC _S_IEXEC 243 | #define S_IFIFO _S_IFIFO 244 | #define S_IFBLK _S_IFBLK 245 | 246 | #define _S_IRWXU (_S_IREAD | _S_IWRITE | _S_IEXEC) 247 | #define _S_IXUSR _S_IEXEC 248 | #define _S_IWUSR _S_IWRITE 249 | 250 | #define S_IRWXU _S_IRWXU 251 | #define S_IXUSR _S_IXUSR 252 | #define S_IWUSR _S_IWUSR 253 | #define S_IRUSR _S_IRUSR 254 | #define _S_IRUSR _S_IREAD 255 | 256 | #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) 257 | #define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) 258 | #define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) 259 | #define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) 260 | #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) 261 | 262 | #endif 263 | 264 | #if !defined (RC_INVOKED) && !defined (NO_OLDNAMES) 265 | int __cdecl stat(const char *_Filename,struct stat *_Stat); 266 | int __cdecl fstat(int _Desc,struct stat *_Stat); 267 | int __cdecl wstat(const wchar_t *_Filename,struct stat *_Stat); 268 | #ifdef _USE_32BIT_TIME_T 269 | __CRT_INLINE int __cdecl fstat(int _Desc,struct stat *_Stat) { 270 | return _fstat32(_Desc,(struct _stat32 *)_Stat); 271 | } 272 | __CRT_INLINE int __cdecl stat(const char *_Filename,struct stat *_Stat) { 273 | return _stat32(_Filename,(struct _stat32 *)_Stat); 274 | } 275 | #else 276 | __CRT_INLINE int __cdecl fstat(int _Desc,struct stat *_Stat) { 277 | return _fstat64i32(_Desc,(struct _stat64i32 *)_Stat); 278 | } 279 | __CRT_INLINE int __cdecl stat(const char *_Filename,struct stat *_Stat) { 280 | return _stat64i32(_Filename,(struct _stat64i32 *)_Stat); 281 | } 282 | #endif 283 | #endif 284 | 285 | #ifdef __cplusplus 286 | } 287 | #endif 288 | 289 | #pragma pack(pop) 290 | #endif 291 | -------------------------------------------------------------------------------- /win32/include/sys/time.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the w64 mingw-runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | 7 | #ifndef _SYS_TIME_H_ 8 | #define _SYS_TIME_H_ 9 | 10 | #include 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | #ifndef __STRICT_ANSI__ 17 | #ifndef _TIMEVAL_DEFINED /* also in winsock[2].h */ 18 | #define _TIMEVAL_DEFINED 19 | struct timeval { 20 | long tv_sec; 21 | long tv_usec; 22 | }; 23 | #define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec) 24 | #define timercmp(tvp, uvp, cmp) \ 25 | (((tvp)->tv_sec != (uvp)->tv_sec) ? \ 26 | ((tvp)->tv_sec cmp (uvp)->tv_sec) : \ 27 | ((tvp)->tv_usec cmp (uvp)->tv_usec)) 28 | #define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0 29 | #endif /* _TIMEVAL_DEFINED */ 30 | 31 | #ifndef _TIMEZONE_DEFINED /* also in sys/time.h */ 32 | #define _TIMEZONE_DEFINED 33 | /* Provided for compatibility with code that assumes that 34 | the presence of gettimeofday function implies a definition 35 | of struct timezone. */ 36 | struct timezone 37 | { 38 | int tz_minuteswest; /* of Greenwich */ 39 | int tz_dsttime; /* type of dst correction to apply */ 40 | }; 41 | 42 | extern int __cdecl mingw_gettimeofday (struct timeval *p, struct timezone *z); 43 | 44 | #endif 45 | 46 | /* 47 | Implementation as per: 48 | The Open Group Base Specifications, Issue 6 49 | IEEE Std 1003.1, 2004 Edition 50 | 51 | The timezone pointer arg is ignored. Errors are ignored. 52 | */ 53 | #ifndef _GETTIMEOFDAY_DEFINED 54 | #define _GETTIMEOFDAY_DEFINED 55 | int __cdecl gettimeofday(struct timeval *__restrict__, 56 | void *__restrict__ /* tzp (unused) */); 57 | #endif 58 | 59 | #endif /* __STRICT_ANSI__ */ 60 | 61 | #ifdef __cplusplus 62 | } 63 | #endif 64 | 65 | /* Adding timespec definition. */ 66 | #include 67 | 68 | 69 | #endif /* _SYS_TIME_H_ */ 70 | -------------------------------------------------------------------------------- /win32/include/sys/timeb.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the w64 mingw-runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | #ifndef _TIMEB_H_ 7 | #define _TIMEB_H_ 8 | 9 | #include <_mingw.h> 10 | 11 | #ifndef _WIN32 12 | #error Only Win32 target is supported! 13 | #endif 14 | 15 | #pragma pack(push,_CRT_PACKING) 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | #ifndef _CRTIMP 22 | #define _CRTIMP __declspec(dllimport) 23 | #endif 24 | 25 | #ifndef __TINYC__ /* gr */ 26 | #ifdef _USE_32BIT_TIME_T 27 | #ifdef _WIN64 28 | #undef _USE_32BIT_TIME_T 29 | #endif 30 | #else 31 | #if _INTEGRAL_MAX_BITS < 64 32 | #define _USE_32BIT_TIME_T 33 | #endif 34 | #endif 35 | #endif 36 | 37 | #ifndef _TIME32_T_DEFINED 38 | typedef long __time32_t; 39 | #define _TIME32_T_DEFINED 40 | #endif 41 | 42 | #ifndef _TIME64_T_DEFINED 43 | #if _INTEGRAL_MAX_BITS >= 64 44 | typedef __int64 __time64_t; 45 | #endif 46 | #define _TIME64_T_DEFINED 47 | #endif 48 | 49 | #ifndef _TIME_T_DEFINED 50 | #ifdef _USE_32BIT_TIME_T 51 | typedef __time32_t time_t; 52 | #else 53 | typedef __time64_t time_t; 54 | #endif 55 | #define _TIME_T_DEFINED 56 | #endif 57 | 58 | #ifndef _TIMEB_DEFINED 59 | #define _TIMEB_DEFINED 60 | 61 | struct __timeb32 { 62 | __time32_t time; 63 | unsigned short millitm; 64 | short timezone; 65 | short dstflag; 66 | }; 67 | 68 | #ifndef NO_OLDNAMES 69 | struct timeb { 70 | time_t time; 71 | unsigned short millitm; 72 | short timezone; 73 | short dstflag; 74 | }; 75 | #endif 76 | 77 | #if _INTEGRAL_MAX_BITS >= 64 78 | struct __timeb64 { 79 | __time64_t time; 80 | unsigned short millitm; 81 | short timezone; 82 | short dstflag; 83 | }; 84 | #endif 85 | 86 | #ifdef _USE_32BIT_TIME_T 87 | #define _timeb __timeb32 88 | //gr #define _ftime _ftime32 89 | #define _ftime32 _ftime 90 | #else 91 | #define _timeb __timeb64 92 | #define _ftime _ftime64 93 | #endif 94 | #endif 95 | 96 | _CRTIMP void __cdecl _ftime32(struct __timeb32 *_Time); 97 | #if _INTEGRAL_MAX_BITS >= 64 98 | _CRTIMP void __cdecl _ftime64(struct __timeb64 *_Time); 99 | #endif 100 | 101 | #ifndef _TIMESPEC_DEFINED 102 | #define _TIMESPEC_DEFINED 103 | struct timespec { 104 | time_t tv_sec; /* Seconds */ 105 | long tv_nsec; /* Nanoseconds */ 106 | }; 107 | 108 | struct itimerspec { 109 | struct timespec it_interval; /* Timer period */ 110 | struct timespec it_value; /* Timer expiration */ 111 | }; 112 | #endif 113 | 114 | #if !defined (RC_INVOKED) && !defined (NO_OLDNAMES) 115 | #ifdef _USE_32BIT_TIME_T 116 | __CRT_INLINE void __cdecl ftime(struct timeb *_Tmb) { 117 | _ftime32((struct __timeb32 *)_Tmb); 118 | } 119 | #else 120 | __CRT_INLINE void __cdecl ftime(struct timeb *_Tmb) { 121 | _ftime64((struct __timeb64 *)_Tmb); 122 | } 123 | #endif 124 | #endif 125 | 126 | #ifdef __cplusplus 127 | } 128 | #endif 129 | 130 | #pragma pack(pop) 131 | 132 | #include 133 | #endif 134 | -------------------------------------------------------------------------------- /win32/include/sys/types.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the w64 mingw-runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | #ifndef _INC_TYPES 7 | #define _INC_TYPES 8 | 9 | #ifndef _WIN32 10 | #error Only Win32 target is supported! 11 | #endif 12 | 13 | #include <_mingw.h> 14 | 15 | #ifndef __TINYC__ /* gr */ 16 | #ifdef _USE_32BIT_TIME_T 17 | #ifdef _WIN64 18 | #undef _USE_32BIT_TIME_T 19 | #endif 20 | #else 21 | #if _INTEGRAL_MAX_BITS < 64 22 | #define _USE_32BIT_TIME_T 23 | #endif 24 | #endif 25 | #endif 26 | 27 | #ifndef _TIME32_T_DEFINED 28 | #define _TIME32_T_DEFINED 29 | typedef long __time32_t; 30 | #endif 31 | 32 | #ifndef _TIME64_T_DEFINED 33 | #define _TIME64_T_DEFINED 34 | #if _INTEGRAL_MAX_BITS >= 64 35 | typedef __int64 __time64_t; 36 | #endif 37 | #endif 38 | 39 | #ifndef _TIME_T_DEFINED 40 | #define _TIME_T_DEFINED 41 | #ifdef _USE_32BIT_TIME_T 42 | typedef __time32_t time_t; 43 | #else 44 | typedef __time64_t time_t; 45 | #endif 46 | #endif 47 | 48 | #ifndef _INO_T_DEFINED 49 | #define _INO_T_DEFINED 50 | typedef unsigned short _ino_t; 51 | #ifndef NO_OLDNAMES 52 | typedef unsigned short ino_t; 53 | #endif 54 | #endif 55 | 56 | #ifndef _DEV_T_DEFINED 57 | #define _DEV_T_DEFINED 58 | typedef unsigned int _dev_t; 59 | #ifndef NO_OLDNAMES 60 | typedef unsigned int dev_t; 61 | #endif 62 | #endif 63 | 64 | #ifndef _PID_T_ 65 | #define _PID_T_ 66 | #ifndef _WIN64 67 | typedef int _pid_t; 68 | #else 69 | typedef __int64 _pid_t; 70 | #endif 71 | 72 | #ifndef NO_OLDNAMES 73 | typedef _pid_t pid_t; 74 | #endif 75 | #endif /* Not _PID_T_ */ 76 | 77 | #ifndef _MODE_T_ 78 | #define _MODE_T_ 79 | typedef unsigned short _mode_t; 80 | 81 | #ifndef NO_OLDNAMES 82 | typedef _mode_t mode_t; 83 | #endif 84 | #endif /* Not _MODE_T_ */ 85 | 86 | #ifndef _OFF_T_DEFINED 87 | #define _OFF_T_DEFINED 88 | #ifndef _OFF_T_ 89 | #define _OFF_T_ 90 | typedef long _off_t; 91 | #if !defined(NO_OLDNAMES) || defined(_POSIX) 92 | typedef long off_t; 93 | #endif 94 | #endif 95 | #endif 96 | 97 | #ifndef _OFF64_T_DEFINED 98 | #define _OFF64_T_DEFINED 99 | typedef long long _off64_t; 100 | #if !defined(NO_OLDNAMES) || defined(_POSIX) 101 | typedef long long off64_t; 102 | #endif 103 | #endif 104 | 105 | /* required by (unbundled) unistd.h for usleep arg type */ 106 | #ifndef __NO_ISOCEXT 107 | typedef unsigned int useconds_t; 108 | #endif 109 | 110 | #ifndef _TIMESPEC_DEFINED 111 | #define _TIMESPEC_DEFINED 112 | struct timespec { 113 | time_t tv_sec; /* Seconds */ 114 | long tv_nsec; /* Nanoseconds */ 115 | }; 116 | 117 | struct itimerspec { 118 | struct timespec it_interval; /* Timer period */ 119 | struct timespec it_value; /* Timer expiration */ 120 | }; 121 | #endif 122 | 123 | #endif 124 | -------------------------------------------------------------------------------- /win32/include/sys/unistd.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the w64 mingw-runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | /* 7 | * This file is part of the Mingw32 package. 8 | * 9 | * unistd.h maps (roughly) to io.h 10 | */ 11 | #ifndef __STRICT_ANSI__ 12 | #include 13 | #endif 14 | 15 | -------------------------------------------------------------------------------- /win32/include/sys/utime.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the w64 mingw-runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | #ifndef _INC_UTIME 7 | #define _INC_UTIME 8 | 9 | #ifndef _WIN32 10 | #error Only Win32 target is supported! 11 | #endif 12 | 13 | #include <_mingw.h> 14 | 15 | #pragma pack(push,_CRT_PACKING) 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | #ifndef _CRTIMP 22 | #define _CRTIMP __declspec(dllimport) 23 | #endif 24 | 25 | #ifndef _WCHAR_T_DEFINED 26 | typedef unsigned short wchar_t; 27 | #define _WCHAR_T_DEFINED 28 | #endif 29 | 30 | #ifndef __TINYC__ /* gr */ 31 | #ifdef _USE_32BIT_TIME_T 32 | #ifdef _WIN64 33 | #undef _USE_32BIT_TIME_T 34 | #endif 35 | #else 36 | #if _INTEGRAL_MAX_BITS < 64 37 | #define _USE_32BIT_TIME_T 38 | #endif 39 | #endif 40 | #endif 41 | 42 | #ifndef _TIME32_T_DEFINED 43 | #define _TIME32_T_DEFINED 44 | typedef long __time32_t; 45 | #endif 46 | 47 | #ifndef _TIME64_T_DEFINED 48 | #define _TIME64_T_DEFINED 49 | #if _INTEGRAL_MAX_BITS >= 64 50 | typedef __int64 __time64_t; 51 | #endif 52 | #endif 53 | 54 | #ifndef _TIME_T_DEFINED 55 | #define _TIME_T_DEFINED 56 | #ifdef _USE_32BIT_TIME_T 57 | typedef __time32_t time_t; 58 | #else 59 | typedef __time64_t time_t; 60 | #endif 61 | #endif 62 | 63 | #ifndef _UTIMBUF_DEFINED 64 | #define _UTIMBUF_DEFINED 65 | 66 | struct _utimbuf { 67 | time_t actime; 68 | time_t modtime; 69 | }; 70 | 71 | struct __utimbuf32 { 72 | __time32_t actime; 73 | __time32_t modtime; 74 | }; 75 | 76 | #if _INTEGRAL_MAX_BITS >= 64 77 | struct __utimbuf64 { 78 | __time64_t actime; 79 | __time64_t modtime; 80 | }; 81 | #endif 82 | 83 | #ifndef NO_OLDNAMES 84 | struct utimbuf { 85 | time_t actime; 86 | time_t modtime; 87 | }; 88 | 89 | struct utimbuf32 { 90 | __time32_t actime; 91 | __time32_t modtime; 92 | }; 93 | #endif 94 | #endif 95 | 96 | _CRTIMP int __cdecl _utime32(const char *_Filename,struct __utimbuf32 *_Time); 97 | _CRTIMP int __cdecl _futime32(int _FileDes,struct __utimbuf32 *_Time); 98 | _CRTIMP int __cdecl _wutime32(const wchar_t *_Filename,struct __utimbuf32 *_Time); 99 | #if _INTEGRAL_MAX_BITS >= 64 100 | _CRTIMP int __cdecl _utime64(const char *_Filename,struct __utimbuf64 *_Time); 101 | _CRTIMP int __cdecl _futime64(int _FileDes,struct __utimbuf64 *_Time); 102 | _CRTIMP int __cdecl _wutime64(const wchar_t *_Filename,struct __utimbuf64 *_Time); 103 | #endif 104 | 105 | #ifndef RC_INVOKED 106 | #ifdef _USE_32BIT_TIME_T 107 | __CRT_INLINE int __cdecl _utime(const char *_Filename,struct _utimbuf *_Utimbuf) { 108 | return _utime32(_Filename,(struct __utimbuf32 *)_Utimbuf); 109 | } 110 | __CRT_INLINE int __cdecl _futime(int _Desc,struct _utimbuf *_Utimbuf) { 111 | return _futime32(_Desc,(struct __utimbuf32 *)_Utimbuf); 112 | } 113 | __CRT_INLINE int __cdecl _wutime(const wchar_t *_Filename,struct _utimbuf *_Utimbuf) { 114 | return _wutime32(_Filename,(struct __utimbuf32 *)_Utimbuf); 115 | } 116 | #else 117 | __CRT_INLINE int __cdecl _utime(const char *_Filename,struct _utimbuf *_Utimbuf) { 118 | return _utime64(_Filename,(struct __utimbuf64 *)_Utimbuf); 119 | } 120 | __CRT_INLINE int __cdecl _futime(int _Desc,struct _utimbuf *_Utimbuf) { 121 | return _futime64(_Desc,(struct __utimbuf64 *)_Utimbuf); 122 | } 123 | __CRT_INLINE int __cdecl _wutime(const wchar_t *_Filename,struct _utimbuf *_Utimbuf) { 124 | return _wutime64(_Filename,(struct __utimbuf64 *)_Utimbuf); 125 | } 126 | #endif 127 | 128 | #ifndef NO_OLDNAMES 129 | #ifdef _USE_32BIT_TIME_T 130 | __CRT_INLINE int __cdecl utime(const char *_Filename,struct utimbuf *_Utimbuf) { 131 | return _utime32(_Filename,(struct __utimbuf32 *)_Utimbuf); 132 | } 133 | #else 134 | __CRT_INLINE int __cdecl utime(const char *_Filename,struct utimbuf *_Utimbuf) { 135 | return _utime64(_Filename,(struct __utimbuf64 *)_Utimbuf); 136 | } 137 | #endif 138 | #endif 139 | #endif 140 | 141 | #ifdef __cplusplus 142 | } 143 | #endif 144 | 145 | #pragma pack(pop) 146 | #endif 147 | -------------------------------------------------------------------------------- /win32/include/uchar.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the TinyCC package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | 7 | #ifndef _INC_UCHAR 8 | #define _INC_UCHAR 9 | 10 | /* 11 | * The following defines are only valid when C11 (-std=c11) is used. 12 | * 13 | * ... a wide character constant prefixed by the letter u or U has type char16_t 14 | * or char32_t, respectively, unsigned integer types defined in the 15 | * header. 16 | */ 17 | 18 | #if __STDC_VERSION__ >= 201112L 19 | /** 20 | * __STDC_UTF_16__ The integer constant 1, intended to indicate that 21 | * values of type char16_t are UTF-16 encoded. 22 | */ 23 | #define __STDC_UTF_16__ 1 24 | /** 25 | * __STDC_UTF_32__ The integer constant 1, intended to indicate that 26 | * values of type char32_t are UTF-32 encoded. 27 | */ 28 | #define __STDC_UTF_32__ 1 29 | 30 | typedef unsigned short char16_t; 31 | typedef unsigned int char32_t; 32 | #endif /* __STDC_VERSION__ >= 201112L */ 33 | #endif /* _INC_UCHAR */ 34 | -------------------------------------------------------------------------------- /win32/include/unistd.h: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /win32/include/vadefs.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the w64 mingw-runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | #ifndef _INC_VADEFS 7 | #define _INC_VADEFS 8 | 9 | //!__TINYC__: GNUC specific stuff removed 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /win32/include/values.h: -------------------------------------------------------------------------------- 1 | /* 2 | * TODO: Nothing here yet. Should provide UNIX compatibility constants 3 | * comparable to those in limits.h and float.h. 4 | */ 5 | -------------------------------------------------------------------------------- /win32/include/wctype.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the w64 mingw-runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | #ifndef _INC_WCTYPE 7 | #define _INC_WCTYPE 8 | 9 | #ifndef _WIN32 10 | #error Only Win32 target is supported! 11 | #endif 12 | 13 | #include <_mingw.h> 14 | 15 | #pragma pack(push,_CRT_PACKING) 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | #ifndef _CRTIMP 22 | #define _CRTIMP __declspec(dllimport) 23 | #endif 24 | 25 | #ifndef _WCHAR_T_DEFINED 26 | typedef unsigned short wchar_t; 27 | #define _WCHAR_T_DEFINED 28 | #endif 29 | 30 | #ifndef _WCTYPE_T_DEFINED 31 | typedef unsigned short wint_t; 32 | typedef unsigned short wctype_t; 33 | #define _WCTYPE_T_DEFINED 34 | #endif 35 | 36 | #ifndef WEOF 37 | #define WEOF (wint_t)(0xFFFF) 38 | #endif 39 | 40 | #ifndef _CRT_CTYPEDATA_DEFINED 41 | #define _CRT_CTYPEDATA_DEFINED 42 | #ifndef _CTYPE_DISABLE_MACROS 43 | 44 | #ifndef __PCTYPE_FUNC 45 | #define __PCTYPE_FUNC __pctype_func() 46 | #ifdef _MSVCRT_ 47 | #define __pctype_func() (_pctype) 48 | #else 49 | #define __pctype_func() (*_imp___pctype) 50 | #endif 51 | #endif 52 | 53 | #ifndef _pctype 54 | #ifdef _MSVCRT_ 55 | extern unsigned short *_pctype; 56 | #else 57 | extern unsigned short **_imp___pctype; 58 | #define _pctype (*_imp___pctype) 59 | #endif 60 | #endif 61 | 62 | #endif 63 | #endif 64 | 65 | #ifndef _CRT_WCTYPEDATA_DEFINED 66 | #define _CRT_WCTYPEDATA_DEFINED 67 | #ifndef _CTYPE_DISABLE_MACROS 68 | #ifndef _wctype 69 | #ifdef _MSVCRT_ 70 | extern unsigned short *_wctype; 71 | #else 72 | extern unsigned short **_imp___wctype; 73 | #define _wctype (*_imp___wctype) 74 | #endif 75 | #endif 76 | 77 | #ifndef _pwctype 78 | #ifdef _MSVCRT_ 79 | extern unsigned short *_pwctype; 80 | #else 81 | extern unsigned short **_imp___pwctype; 82 | #define _pwctype (*_imp___pwctype) 83 | #define __pwctype_func() (*_imp___pwctype) 84 | #endif 85 | #endif 86 | #endif 87 | #endif 88 | 89 | #define _UPPER 0x1 90 | #define _LOWER 0x2 91 | #define _DIGIT 0x4 92 | #define _SPACE 0x8 93 | 94 | #define _PUNCT 0x10 95 | #define _CONTROL 0x20 96 | #define _BLANK 0x40 97 | #define _HEX 0x80 98 | 99 | #define _LEADBYTE 0x8000 100 | #define _ALPHA (0x0100|_UPPER|_LOWER) 101 | 102 | #ifndef _WCTYPE_DEFINED 103 | #define _WCTYPE_DEFINED 104 | 105 | int __cdecl iswalpha(wint_t); 106 | int __cdecl iswupper(wint_t); 107 | int __cdecl iswlower(wint_t); 108 | int __cdecl iswdigit(wint_t); 109 | int __cdecl iswxdigit(wint_t); 110 | int __cdecl iswspace(wint_t); 111 | int __cdecl iswpunct(wint_t); 112 | int __cdecl iswalnum(wint_t); 113 | int __cdecl iswprint(wint_t); 114 | int __cdecl iswgraph(wint_t); 115 | int __cdecl iswcntrl(wint_t); 116 | int __cdecl iswascii(wint_t); 117 | int __cdecl isleadbyte(int); 118 | wint_t __cdecl towupper(wint_t); 119 | wint_t __cdecl towlower(wint_t); 120 | int __cdecl iswctype(wint_t,wctype_t); 121 | _CRTIMP int __cdecl __iswcsymf(wint_t); 122 | _CRTIMP int __cdecl __iswcsym(wint_t); 123 | int __cdecl is_wctype(wint_t,wctype_t); 124 | #if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || !defined (NO_OLDNAMES) 125 | int __cdecl isblank(int _C); 126 | #endif 127 | #endif 128 | 129 | #ifndef _WCTYPE_INLINE_DEFINED 130 | #define _WCTYPE_INLINE_DEFINED 131 | #ifndef __cplusplus 132 | #define iswalpha(_c) (iswctype(_c,_ALPHA)) 133 | #define iswupper(_c) (iswctype(_c,_UPPER)) 134 | #define iswlower(_c) (iswctype(_c,_LOWER)) 135 | #define iswdigit(_c) (iswctype(_c,_DIGIT)) 136 | #define iswxdigit(_c) (iswctype(_c,_HEX)) 137 | #define iswspace(_c) (iswctype(_c,_SPACE)) 138 | #define iswpunct(_c) (iswctype(_c,_PUNCT)) 139 | #define iswalnum(_c) (iswctype(_c,_ALPHA|_DIGIT)) 140 | #define iswprint(_c) (iswctype(_c,_BLANK|_PUNCT|_ALPHA|_DIGIT)) 141 | #define iswgraph(_c) (iswctype(_c,_PUNCT|_ALPHA|_DIGIT)) 142 | #define iswcntrl(_c) (iswctype(_c,_CONTROL)) 143 | #define iswascii(_c) ((unsigned)(_c) < 0x80) 144 | #define isleadbyte(c) (__pctype_func()[(unsigned char)(c)] & _LEADBYTE) 145 | #else 146 | __CRT_INLINE int __cdecl iswalpha(wint_t _C) {return (iswctype(_C,_ALPHA)); } 147 | __CRT_INLINE int __cdecl iswupper(wint_t _C) {return (iswctype(_C,_UPPER)); } 148 | __CRT_INLINE int __cdecl iswlower(wint_t _C) {return (iswctype(_C,_LOWER)); } 149 | __CRT_INLINE int __cdecl iswdigit(wint_t _C) {return (iswctype(_C,_DIGIT)); } 150 | __CRT_INLINE int __cdecl iswxdigit(wint_t _C) {return (iswctype(_C,_HEX)); } 151 | __CRT_INLINE int __cdecl iswspace(wint_t _C) {return (iswctype(_C,_SPACE)); } 152 | __CRT_INLINE int __cdecl iswpunct(wint_t _C) {return (iswctype(_C,_PUNCT)); } 153 | __CRT_INLINE int __cdecl iswalnum(wint_t _C) {return (iswctype(_C,_ALPHA|_DIGIT)); } 154 | __CRT_INLINE int __cdecl iswprint(wint_t _C) {return (iswctype(_C,_BLANK|_PUNCT|_ALPHA|_DIGIT)); } 155 | __CRT_INLINE int __cdecl iswgraph(wint_t _C) {return (iswctype(_C,_PUNCT|_ALPHA|_DIGIT)); } 156 | __CRT_INLINE int __cdecl iswcntrl(wint_t _C) {return (iswctype(_C,_CONTROL)); } 157 | __CRT_INLINE int __cdecl iswascii(wint_t _C) {return ((unsigned)(_C) < 0x80); } 158 | __CRT_INLINE int __cdecl isleadbyte(int _C) {return (__pctype_func()[(unsigned char)(_C)] & _LEADBYTE); } 159 | #endif 160 | #endif 161 | 162 | typedef wchar_t wctrans_t; 163 | wint_t __cdecl towctrans(wint_t,wctrans_t); 164 | wctrans_t __cdecl wctrans(const char *); 165 | wctype_t __cdecl wctype(const char *); 166 | 167 | #ifdef __cplusplus 168 | } 169 | #endif 170 | 171 | #pragma pack(pop) 172 | #endif 173 | -------------------------------------------------------------------------------- /win32/include/winapi/basetsd.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the w64 mingw-runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | #ifndef _BASETSD_H_ 7 | #define _BASETSD_H_ 8 | 9 | #if (defined(__x86_64) || defined(__ia64__)) && !defined(RC_INVOKED) 10 | typedef unsigned __int64 POINTER_64_INT; 11 | #else 12 | typedef unsigned long POINTER_64_INT; 13 | #endif 14 | 15 | #define POINTER_32 16 | #define POINTER_64 17 | #define FIRMWARE_PTR 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | typedef signed char INT8,*PINT8; 24 | typedef signed short INT16,*PINT16; 25 | typedef signed int INT32,*PINT32; 26 | typedef signed __int64 INT64,*PINT64; 27 | typedef unsigned char UINT8,*PUINT8; 28 | typedef unsigned short UINT16,*PUINT16; 29 | typedef unsigned int UINT32,*PUINT32; 30 | typedef unsigned __int64 UINT64,*PUINT64; 31 | typedef signed int LONG32,*PLONG32; 32 | typedef unsigned int ULONG32,*PULONG32; 33 | typedef unsigned int DWORD32,*PDWORD32; 34 | 35 | #ifndef _W64 36 | #define _W64 37 | #endif 38 | 39 | #ifdef _WIN64 40 | typedef __int64 INT_PTR,*PINT_PTR; 41 | typedef unsigned __int64 UINT_PTR,*PUINT_PTR; 42 | typedef __int64 LONG_PTR,*PLONG_PTR; 43 | typedef unsigned __int64 ULONG_PTR,*PULONG_PTR; 44 | #define __int3264 __int64 45 | #else 46 | typedef int INT_PTR,*PINT_PTR; 47 | typedef unsigned int UINT_PTR,*PUINT_PTR; 48 | typedef long LONG_PTR,*PLONG_PTR; 49 | typedef unsigned long ULONG_PTR,*PULONG_PTR; 50 | #define __int3264 __int32 51 | #endif 52 | 53 | #ifdef _WIN64 54 | #define ADDRESS_TAG_BIT 0x40000000000ULL 55 | typedef __int64 SHANDLE_PTR; 56 | typedef unsigned __int64 HANDLE_PTR; 57 | typedef unsigned int UHALF_PTR,*PUHALF_PTR; 58 | typedef int HALF_PTR,*PHALF_PTR; 59 | 60 | static __inline unsigned long HandleToULong(const void *h) { return((unsigned long) (ULONG_PTR) h); } 61 | static __inline long HandleToLong(const void *h) { return((long) (LONG_PTR) h); } 62 | static __inline void *ULongToHandle(const unsigned long h) { return((void *) (UINT_PTR) h); } 63 | static __inline void *LongToHandle(const long h) { return((void *) (INT_PTR) h); } 64 | static __inline unsigned long PtrToUlong(const void *p) { return((unsigned long) (ULONG_PTR) p); } 65 | static __inline unsigned int PtrToUint(const void *p) { return((unsigned int) (UINT_PTR) p); } 66 | static __inline unsigned short PtrToUshort(const void *p) { return((unsigned short) (unsigned long) (ULONG_PTR) p); } 67 | static __inline long PtrToLong(const void *p) { return((long) (LONG_PTR) p); } 68 | static __inline int PtrToInt(const void *p) { return((int) (INT_PTR) p); } 69 | static __inline short PtrToShort(const void *p) { return((short) (long) (LONG_PTR) p); } 70 | static __inline void *IntToPtr(const int i) { return((void *)(INT_PTR)i); } 71 | static __inline void *UIntToPtr(const unsigned int ui) { return((void *)(UINT_PTR)ui); } 72 | static __inline void *LongToPtr(const long l) { return((void *)(LONG_PTR)l); } 73 | static __inline void *ULongToPtr(const unsigned long ul) { return((void *)(ULONG_PTR)ul); } 74 | 75 | #define PtrToPtr64(p) ((void *) p) 76 | #define Ptr64ToPtr(p) ((void *) p) 77 | #define HandleToHandle64(h) (PtrToPtr64(h)) 78 | #define Handle64ToHandle(h) (Ptr64ToPtr(h)) 79 | 80 | static __inline void *Ptr32ToPtr(const void *p) { return (void *)p; } 81 | static __inline void *Handle32ToHandle(const void *h) { return((void *) h); } 82 | static __inline void *PtrToPtr32(const void *p) { return((void *) (ULONG_PTR) p); } 83 | 84 | #define HandleToHandle32(h) (PtrToPtr32(h)) 85 | #else 86 | 87 | #define ADDRESS_TAG_BIT 0x80000000UL 88 | 89 | typedef unsigned short UHALF_PTR,*PUHALF_PTR; 90 | typedef short HALF_PTR,*PHALF_PTR; 91 | typedef long SHANDLE_PTR; 92 | typedef unsigned long HANDLE_PTR; 93 | 94 | #define HandleToULong(h) ((ULONG)(ULONG_PTR)(h)) 95 | #define HandleToLong(h) ((LONG)(LONG_PTR) (h)) 96 | #define ULongToHandle(ul) ((HANDLE)(ULONG_PTR) (ul)) 97 | #define LongToHandle(h) ((HANDLE)(LONG_PTR) (h)) 98 | #define PtrToUlong(p) ((ULONG)(ULONG_PTR) (p)) 99 | #define PtrToLong(p) ((LONG)(LONG_PTR) (p)) 100 | #define PtrToUint(p) ((UINT)(UINT_PTR) (p)) 101 | #define PtrToInt(p) ((INT)(INT_PTR) (p)) 102 | #define PtrToUshort(p) ((unsigned short)(ULONG_PTR)(p)) 103 | #define PtrToShort(p) ((short)(LONG_PTR)(p)) 104 | #define IntToPtr(i) ((VOID *)(INT_PTR)((int)i)) 105 | #define UIntToPtr(ui) ((VOID *)(UINT_PTR)((unsigned int)ui)) 106 | #define LongToPtr(l) ((VOID *)(LONG_PTR)((long)l)) 107 | #define ULongToPtr(ul) ((VOID *)(ULONG_PTR)((unsigned long)ul)) 108 | 109 | static __inline void *PtrToPtr64(const void *p) { return((void *) (ULONG_PTR)p); } 110 | static __inline void *Ptr64ToPtr(const void *p) { return((void *) (ULONG_PTR) p); } 111 | static __inline void *HandleToHandle64(const void *h) { return((void *) h); } 112 | static __inline void *Handle64ToHandle(const void *h) { return((void *) (ULONG_PTR) h); } 113 | 114 | #define Ptr32ToPtr(p) ((void *) p) 115 | #define Handle32ToHandle(h) (Ptr32ToPtr(h)) 116 | #define PtrToPtr32(p) ((void *) p) 117 | #define HandleToHandle32(h) (PtrToPtr32(h)) 118 | #endif 119 | 120 | #define HandleToUlong(h) HandleToULong(h) 121 | #define UlongToHandle(ul) ULongToHandle(ul) 122 | #define UlongToPtr(ul) ULongToPtr(ul) 123 | #define UintToPtr(ui) UIntToPtr(ui) 124 | 125 | #define MAXUINT_PTR (~((UINT_PTR)0)) 126 | #define MAXINT_PTR ((INT_PTR)(MAXUINT_PTR >> 1)) 127 | #define MININT_PTR (~MAXINT_PTR) 128 | 129 | #define MAXULONG_PTR (~((ULONG_PTR)0)) 130 | #define MAXLONG_PTR ((LONG_PTR)(MAXULONG_PTR >> 1)) 131 | #define MINLONG_PTR (~MAXLONG_PTR) 132 | 133 | #define MAXUHALF_PTR ((UHALF_PTR)~0) 134 | #define MAXHALF_PTR ((HALF_PTR)(MAXUHALF_PTR >> 1)) 135 | #define MINHALF_PTR (~MAXHALF_PTR) 136 | 137 | typedef ULONG_PTR SIZE_T,*PSIZE_T; 138 | typedef LONG_PTR SSIZE_T,*PSSIZE_T; 139 | typedef ULONG_PTR DWORD_PTR,*PDWORD_PTR; 140 | typedef __int64 LONG64,*PLONG64; 141 | typedef unsigned __int64 ULONG64,*PULONG64; 142 | typedef unsigned __int64 DWORD64,*PDWORD64; 143 | typedef ULONG_PTR KAFFINITY; 144 | typedef KAFFINITY *PKAFFINITY; 145 | 146 | #ifdef __cplusplus 147 | } 148 | #endif 149 | #endif 150 | -------------------------------------------------------------------------------- /win32/include/winapi/basetyps.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the w64 mingw-runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | #if !defined(_BASETYPS_H_) 7 | #define _BASETYPS_H_ 8 | 9 | #ifdef __cplusplus 10 | #define EXTERN_C extern "C" 11 | #else 12 | #define EXTERN_C extern 13 | #endif 14 | 15 | #define STDMETHODCALLTYPE WINAPI 16 | #define STDMETHODVCALLTYPE __cdecl 17 | 18 | #define STDAPICALLTYPE WINAPI 19 | #define STDAPIVCALLTYPE __cdecl 20 | 21 | #define STDAPI EXTERN_C HRESULT WINAPI 22 | #define STDAPI_(type) EXTERN_C type WINAPI 23 | 24 | #define STDMETHODIMP HRESULT WINAPI 25 | #define STDMETHODIMP_(type) type WINAPI 26 | 27 | #define STDAPIV EXTERN_C HRESULT STDAPIVCALLTYPE 28 | #define STDAPIV_(type) EXTERN_C type STDAPIVCALLTYPE 29 | 30 | #define STDMETHODIMPV HRESULT STDMETHODVCALLTYPE 31 | #define STDMETHODIMPV_(type) type STDMETHODVCALLTYPE 32 | 33 | #if defined(__cplusplus) && !defined(CINTERFACE) 34 | 35 | #define __STRUCT__ struct 36 | #define STDMETHOD(method) virtual HRESULT WINAPI method 37 | #define STDMETHOD_(type,method) virtual type WINAPI method 38 | #define STDMETHODV(method) virtual HRESULT STDMETHODVCALLTYPE method 39 | #define STDMETHODV_(type,method) virtual type STDMETHODVCALLTYPE method 40 | #define PURE = 0 41 | #define THIS_ 42 | #define THIS void 43 | #define DECLARE_INTERFACE(iface) __STRUCT__ iface 44 | #define DECLARE_INTERFACE_(iface,baseiface) __STRUCT__ iface : public baseiface 45 | #else 46 | 47 | #ifndef __OBJC__ 48 | #define interface struct 49 | #endif 50 | 51 | #define STDMETHOD(method) HRESULT (WINAPI *method) 52 | #define STDMETHOD_(type,method) type (WINAPI *method) 53 | #define STDMETHODV(method) HRESULT (STDMETHODVCALLTYPE *method) 54 | #define STDMETHODV_(type,method) type (STDMETHODVCALLTYPE *method) 55 | 56 | #define PURE 57 | #define THIS_ INTERFACE *This, 58 | #define THIS INTERFACE *This 59 | #ifdef CONST_VTABLE 60 | #define DECLARE_INTERFACE(iface) typedef struct iface { \ 61 | const struct iface##Vtbl *lpVtbl; } iface; \ 62 | typedef const struct iface##Vtbl iface##Vtbl; \ 63 | const struct iface##Vtbl 64 | #else 65 | #define DECLARE_INTERFACE(iface) typedef struct iface { \ 66 | struct iface##Vtbl *lpVtbl; \ 67 | } iface; \ 68 | typedef struct iface##Vtbl iface##Vtbl; \ 69 | struct iface##Vtbl 70 | #endif 71 | #define DECLARE_INTERFACE_(iface,baseiface) DECLARE_INTERFACE(iface) 72 | #endif 73 | 74 | #include 75 | 76 | #ifndef _ERROR_STATUS_T_DEFINED 77 | #define _ERROR_STATUS_T_DEFINED 78 | typedef unsigned long error_status_t; 79 | #endif 80 | 81 | #ifndef _WCHAR_T_DEFINED 82 | typedef unsigned short wchar_t; 83 | #define _WCHAR_T_DEFINED 84 | #endif 85 | #endif 86 | -------------------------------------------------------------------------------- /win32/include/winapi/guiddef.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the w64 mingw-runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | #ifndef GUID_DEFINED 7 | #define GUID_DEFINED 8 | typedef struct _GUID { 9 | unsigned long Data1; 10 | unsigned short Data2; 11 | unsigned short Data3; 12 | unsigned char Data4[8 ]; 13 | } GUID; 14 | #endif 15 | 16 | #ifndef UUID_DEFINED 17 | #define UUID_DEFINED 18 | typedef GUID UUID; 19 | #endif 20 | 21 | #ifndef FAR 22 | #define FAR 23 | #endif 24 | 25 | #ifndef DECLSPEC_SELECTANY 26 | #define DECLSPEC_SELECTANY __declspec(selectany) 27 | #endif 28 | 29 | #ifndef EXTERN_C 30 | #ifdef __cplusplus 31 | #define EXTERN_C extern "C" 32 | #else 33 | #define EXTERN_C extern 34 | #endif 35 | #endif 36 | 37 | #ifdef DEFINE_GUID 38 | #undef DEFINE_GUID 39 | #endif 40 | 41 | #ifdef INITGUID 42 | #ifdef __cplusplus 43 | #define DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) EXTERN_C const GUID DECLSPEC_SELECTANY name = { l,w1,w2,{ b1,b2,b3,b4,b5,b6,b7,b8 } } 44 | #else 45 | #define DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) const GUID DECLSPEC_SELECTANY name = { l,w1,w2,{ b1,b2,b3,b4,b5,b6,b7,b8 } } 46 | #endif 47 | #else 48 | #define DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) EXTERN_C const GUID name 49 | #endif 50 | 51 | #define DEFINE_OLEGUID(name,l,w1,w2) DEFINE_GUID(name,l,w1,w2,0xC0,0,0,0,0,0,0,0x46) 52 | 53 | #ifndef _GUIDDEF_H_ 54 | #define _GUIDDEF_H_ 55 | 56 | #ifndef __LPGUID_DEFINED__ 57 | #define __LPGUID_DEFINED__ 58 | typedef GUID *LPGUID; 59 | #endif 60 | 61 | #ifndef __LPCGUID_DEFINED__ 62 | #define __LPCGUID_DEFINED__ 63 | typedef const GUID *LPCGUID; 64 | #endif 65 | 66 | #ifndef __IID_DEFINED__ 67 | #define __IID_DEFINED__ 68 | 69 | typedef GUID IID; 70 | typedef IID *LPIID; 71 | #define IID_NULL GUID_NULL 72 | #define IsEqualIID(riid1,riid2) IsEqualGUID(riid1,riid2) 73 | typedef GUID CLSID; 74 | typedef CLSID *LPCLSID; 75 | #define CLSID_NULL GUID_NULL 76 | #define IsEqualCLSID(rclsid1,rclsid2) IsEqualGUID(rclsid1,rclsid2) 77 | typedef GUID FMTID; 78 | typedef FMTID *LPFMTID; 79 | #define FMTID_NULL GUID_NULL 80 | #define IsEqualFMTID(rfmtid1,rfmtid2) IsEqualGUID(rfmtid1,rfmtid2) 81 | 82 | #ifdef __midl_proxy 83 | #define __MIDL_CONST 84 | #else 85 | #define __MIDL_CONST const 86 | #endif 87 | 88 | #ifndef _REFGUID_DEFINED 89 | #define _REFGUID_DEFINED 90 | #ifdef __cplusplus 91 | #define REFGUID const GUID & 92 | #else 93 | #define REFGUID const GUID *__MIDL_CONST 94 | #endif 95 | #endif 96 | 97 | #ifndef _REFIID_DEFINED 98 | #define _REFIID_DEFINED 99 | #ifdef __cplusplus 100 | #define REFIID const IID & 101 | #else 102 | #define REFIID const IID *__MIDL_CONST 103 | #endif 104 | #endif 105 | 106 | #ifndef _REFCLSID_DEFINED 107 | #define _REFCLSID_DEFINED 108 | #ifdef __cplusplus 109 | #define REFCLSID const IID & 110 | #else 111 | #define REFCLSID const IID *__MIDL_CONST 112 | #endif 113 | #endif 114 | 115 | #ifndef _REFFMTID_DEFINED 116 | #define _REFFMTID_DEFINED 117 | #ifdef __cplusplus 118 | #define REFFMTID const IID & 119 | #else 120 | #define REFFMTID const IID *__MIDL_CONST 121 | #endif 122 | #endif 123 | #endif 124 | 125 | #ifndef _SYS_GUID_OPERATORS_ 126 | #define _SYS_GUID_OPERATORS_ 127 | #include 128 | 129 | #ifdef __cplusplus 130 | __inline int InlineIsEqualGUID(REFGUID rguid1,REFGUID rguid2) { 131 | return (((unsigned long *) &rguid1)[0]==((unsigned long *) &rguid2)[0] && ((unsigned long *) &rguid1)[1]==((unsigned long *) &rguid2)[1] && 132 | ((unsigned long *) &rguid1)[2]==((unsigned long *) &rguid2)[2] && ((unsigned long *) &rguid1)[3]==((unsigned long *) &rguid2)[3]); 133 | } 134 | __inline int IsEqualGUID(REFGUID rguid1,REFGUID rguid2) { return !memcmp(&rguid1,&rguid2,sizeof(GUID)); } 135 | #else 136 | #define InlineIsEqualGUID(rguid1,rguid2) (((unsigned long *) rguid1)[0]==((unsigned long *) rguid2)[0] && ((unsigned long *) rguid1)[1]==((unsigned long *) rguid2)[1] && ((unsigned long *) rguid1)[2]==((unsigned long *) rguid2)[2] && ((unsigned long *) rguid1)[3]==((unsigned long *) rguid2)[3]) 137 | #define IsEqualGUID(rguid1,rguid2) (!memcmp(rguid1,rguid2,sizeof(GUID))) 138 | #endif 139 | 140 | #ifdef __INLINE_ISEQUAL_GUID 141 | #undef IsEqualGUID 142 | #define IsEqualGUID(rguid1,rguid2) InlineIsEqualGUID(rguid1,rguid2) 143 | #endif 144 | 145 | #define IsEqualIID(riid1,riid2) IsEqualGUID(riid1,riid2) 146 | #define IsEqualCLSID(rclsid1,rclsid2) IsEqualGUID(rclsid1,rclsid2) 147 | 148 | #if !defined _SYS_GUID_OPERATOR_EQ_ && !defined _NO_SYS_GUID_OPERATOR_EQ_ 149 | #define _SYS_GUID_OPERATOR_EQ_ 150 | #ifdef __cplusplus 151 | __inline int operator==(REFGUID guidOne,REFGUID guidOther) { return IsEqualGUID(guidOne,guidOther); } 152 | __inline int operator!=(REFGUID guidOne,REFGUID guidOther) { return !(guidOne==guidOther); } 153 | #endif 154 | #endif 155 | #endif 156 | #endif 157 | -------------------------------------------------------------------------------- /win32/include/winapi/poppack.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the w64 mingw-runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | #if !(defined(lint) || defined(RC_INVOKED)) 7 | #pragma pack(pop) 8 | #endif 9 | -------------------------------------------------------------------------------- /win32/include/winapi/pshpack1.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the w64 mingw-runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | #if !(defined(lint) || defined(RC_INVOKED)) 7 | #pragma pack(push,1) 8 | #endif 9 | -------------------------------------------------------------------------------- /win32/include/winapi/pshpack2.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the w64 mingw-runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | #if !(defined(lint) || defined(RC_INVOKED)) 7 | #pragma pack(push,2) 8 | #endif 9 | -------------------------------------------------------------------------------- /win32/include/winapi/pshpack4.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the w64 mingw-runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | #if !(defined(lint) || defined(RC_INVOKED)) 7 | #pragma pack(push,4) 8 | #endif 9 | -------------------------------------------------------------------------------- /win32/include/winapi/pshpack8.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the w64 mingw-runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | #if !(defined(lint) || defined(RC_INVOKED)) 7 | #pragma pack(push,8) 8 | #endif 9 | -------------------------------------------------------------------------------- /win32/include/winapi/qos.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the w64 mingw-runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | #ifndef __QOS_H_ 7 | #define __QOS_H_ 8 | 9 | typedef ULONG SERVICETYPE; 10 | 11 | #define SERVICETYPE_NOTRAFFIC 0x00000000 12 | #define SERVICETYPE_BESTEFFORT 0x00000001 13 | #define SERVICETYPE_CONTROLLEDLOAD 0x00000002 14 | #define SERVICETYPE_GUARANTEED 0x00000003 15 | 16 | #define SERVICETYPE_NETWORK_UNAVAILABLE 0x00000004 17 | #define SERVICETYPE_GENERAL_INFORMATION 0x00000005 18 | #define SERVICETYPE_NOCHANGE 0x00000006 19 | #define SERVICETYPE_NONCONFORMING 0x00000009 20 | #define SERVICETYPE_NETWORK_CONTROL 0x0000000A 21 | #define SERVICETYPE_QUALITATIVE 0x0000000D 22 | 23 | #define SERVICE_BESTEFFORT 0x80010000 24 | #define SERVICE_CONTROLLEDLOAD 0x80020000 25 | #define SERVICE_GUARANTEED 0x80040000 26 | #define SERVICE_QUALITATIVE 0x80200000 27 | 28 | #define SERVICE_NO_TRAFFIC_CONTROL 0x81000000 29 | 30 | #define SERVICE_NO_QOS_SIGNALING 0x40000000 31 | 32 | typedef struct _flowspec { 33 | ULONG TokenRate; 34 | ULONG TokenBucketSize; 35 | ULONG PeakBandwidth; 36 | ULONG Latency; 37 | ULONG DelayVariation; 38 | SERVICETYPE ServiceType; 39 | ULONG MaxSduSize; 40 | ULONG MinimumPolicedSize; 41 | } FLOWSPEC,*PFLOWSPEC,*LPFLOWSPEC; 42 | 43 | #define QOS_NOT_SPECIFIED 0xFFFFFFFF 44 | #define POSITIVE_INFINITY_RATE 0xFFFFFFFE 45 | 46 | typedef struct { 47 | ULONG ObjectType; 48 | ULONG ObjectLength; 49 | } QOS_OBJECT_HDR,*LPQOS_OBJECT_HDR; 50 | 51 | #define QOS_GENERAL_ID_BASE 2000 52 | #define QOS_OBJECT_END_OF_LIST (0x00000001 + QOS_GENERAL_ID_BASE) 53 | #define QOS_OBJECT_SD_MODE (0x00000002 + QOS_GENERAL_ID_BASE) 54 | #define QOS_OBJECT_SHAPING_RATE (0x00000003 + QOS_GENERAL_ID_BASE) 55 | #define QOS_OBJECT_DESTADDR (0x00000004 + QOS_GENERAL_ID_BASE) 56 | 57 | typedef struct _QOS_SD_MODE { 58 | QOS_OBJECT_HDR ObjectHdr; 59 | ULONG ShapeDiscardMode; 60 | } QOS_SD_MODE,*LPQOS_SD_MODE; 61 | 62 | #define TC_NONCONF_BORROW 0 63 | #define TC_NONCONF_SHAPE 1 64 | #define TC_NONCONF_DISCARD 2 65 | #define TC_NONCONF_BORROW_PLUS 3 66 | 67 | typedef struct _QOS_SHAPING_RATE { 68 | QOS_OBJECT_HDR ObjectHdr; 69 | ULONG ShapingRate; 70 | } QOS_SHAPING_RATE,*LPQOS_SHAPING_RATE; 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /win32/include/winapi/shellapi.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the w64 mingw-runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | #ifndef _INC_SHELLAPI 7 | #define _INC_SHELLAPI 8 | 9 | #ifndef WINSHELLAPI 10 | #if !defined(_SHELL32_) 11 | #define WINSHELLAPI DECLSPEC_IMPORT 12 | #else 13 | #define WINSHELLAPI 14 | #endif 15 | #endif 16 | 17 | #ifndef SHSTDAPI 18 | #if !defined(_SHELL32_) 19 | #define SHSTDAPI EXTERN_C DECLSPEC_IMPORT HRESULT WINAPI 20 | #define SHSTDAPI_(type) EXTERN_C DECLSPEC_IMPORT type WINAPI 21 | #else 22 | #define SHSTDAPI STDAPI 23 | #define SHSTDAPI_(type) STDAPI_(type) 24 | #endif 25 | #endif 26 | 27 | /* SHDOCAPI[_] definitions not required in this TinyCC minimal header */ 28 | 29 | #if !defined(_WIN64) 30 | #include 31 | #endif 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | #ifdef UNICODE 38 | #define ShellExecute ShellExecuteW 39 | #define FindExecutable FindExecutableW 40 | #else 41 | #define ShellExecute ShellExecuteA 42 | #define FindExecutable FindExecutableA 43 | #endif 44 | 45 | /* minimal subset distributed with TinyCC. nShowCmd is at winuser.h */ 46 | SHSTDAPI_(HINSTANCE) ShellExecuteA(HWND hwnd,LPCSTR lpOperation,LPCSTR lpFile,LPCSTR lpParameters,LPCSTR lpDirectory,INT nShowCmd); 47 | SHSTDAPI_(HINSTANCE) ShellExecuteW(HWND hwnd,LPCWSTR lpOperation,LPCWSTR lpFile,LPCWSTR lpParameters,LPCWSTR lpDirectory,INT nShowCmd); 48 | SHSTDAPI_(HINSTANCE) FindExecutableA(LPCSTR lpFile,LPCSTR lpDirectory,LPSTR lpResult); 49 | SHSTDAPI_(HINSTANCE) FindExecutableW(LPCWSTR lpFile,LPCWSTR lpDirectory,LPWSTR lpResult); 50 | SHSTDAPI_(LPWSTR *) CommandLineToArgvW(LPCWSTR lpCmdLine,int*pNumArgs); 51 | 52 | #ifdef __cplusplus 53 | } 54 | #endif 55 | 56 | #if !defined(_WIN64) 57 | #include 58 | #endif 59 | #endif 60 | -------------------------------------------------------------------------------- /win32/include/winapi/windef.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the w64 mingw-runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | #ifndef _WINDEF_ 7 | #define _WINDEF_ 8 | 9 | #ifndef STRICT 10 | #define STRICT 1 11 | #endif 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | #ifndef WINVER 18 | #define WINVER 0x0502 19 | #endif 20 | 21 | #ifndef BASETYPES 22 | #define BASETYPES 23 | typedef unsigned long ULONG; 24 | typedef ULONG *PULONG; 25 | typedef unsigned short USHORT; 26 | typedef USHORT *PUSHORT; 27 | typedef unsigned char UCHAR; 28 | typedef UCHAR *PUCHAR; 29 | typedef char *PSZ; 30 | #endif 31 | 32 | #define MAX_PATH 260 33 | 34 | #ifndef NULL 35 | #ifdef __cplusplus 36 | #define NULL 0 37 | #else 38 | #define NULL ((void *)0) 39 | #endif 40 | #endif 41 | 42 | #ifndef FALSE 43 | #define FALSE 0 44 | #endif 45 | 46 | #ifndef TRUE 47 | #define TRUE 1 48 | #endif 49 | 50 | #ifndef IN 51 | #define IN 52 | #endif 53 | 54 | #ifndef OUT 55 | #define OUT 56 | #endif 57 | 58 | #ifndef OPTIONAL 59 | #define OPTIONAL 60 | #endif 61 | 62 | #undef far 63 | #undef near 64 | #undef pascal 65 | 66 | #define far 67 | #define near 68 | #define pascal __stdcall 69 | 70 | #define cdecl 71 | #ifndef CDECL 72 | #define CDECL 73 | #endif 74 | #ifndef CALLBACK 75 | #define CALLBACK __stdcall 76 | #endif 77 | #ifndef WINAPI 78 | #define WINAPI __stdcall 79 | #endif 80 | #define WINAPIV __cdecl 81 | #define APIENTRY WINAPI 82 | #define APIPRIVATE WINAPI 83 | #define PASCAL WINAPI 84 | #define WINAPI_INLINE WINAPI 85 | 86 | #undef FAR 87 | #undef NEAR 88 | #define FAR 89 | #define NEAR 90 | #ifndef CONST 91 | #define CONST const 92 | #endif 93 | 94 | typedef unsigned long DWORD; 95 | typedef int WINBOOL; 96 | #define BOOL WINBOOL 97 | typedef unsigned char BYTE; 98 | typedef unsigned short WORD; 99 | typedef float FLOAT; 100 | typedef FLOAT *PFLOAT; 101 | typedef WINBOOL *PBOOL; 102 | typedef WINBOOL *LPBOOL; 103 | typedef BYTE *PBYTE; 104 | typedef BYTE *LPBYTE; 105 | typedef int *PINT; 106 | typedef int *LPINT; 107 | typedef WORD *PWORD; 108 | typedef WORD *LPWORD; 109 | typedef long *LPLONG; 110 | typedef DWORD *PDWORD; 111 | typedef DWORD *LPDWORD; 112 | typedef void *LPVOID; 113 | # ifndef _LPCVOID_DEFINED 114 | #define _LPCVOID_DEFINED 115 | typedef CONST void *LPCVOID; 116 | #endif 117 | typedef int INT; 118 | typedef unsigned int UINT; 119 | typedef unsigned int *PUINT; 120 | 121 | #ifndef NT_INCLUDED 122 | #include 123 | #endif 124 | 125 | //gr #include 126 | 127 | typedef UINT_PTR WPARAM; 128 | typedef LONG_PTR LPARAM; 129 | typedef LONG_PTR LRESULT; 130 | 131 | #ifndef __cplusplus 132 | #ifndef NOMINMAX 133 | #ifndef max 134 | #define max(a,b) (((a) > (b)) ? (a) : (b)) 135 | #endif 136 | 137 | #ifndef min 138 | #define min(a,b) (((a) < (b)) ? (a) : (b)) 139 | #endif 140 | #endif 141 | #endif 142 | 143 | #define MAKEWORD(a,b) ((WORD)(((BYTE)((DWORD_PTR)(a) & 0xff)) | ((WORD)((BYTE)((DWORD_PTR)(b) & 0xff))) << 8)) 144 | #define MAKELONG(a,b) ((LONG)(((WORD)((DWORD_PTR)(a) & 0xffff)) | ((DWORD)((WORD)((DWORD_PTR)(b) & 0xffff))) << 16)) 145 | #define LOWORD(l) ((WORD)((DWORD_PTR)(l) & 0xffff)) 146 | #define HIWORD(l) ((WORD)((DWORD_PTR)(l) >> 16)) 147 | #define LOBYTE(w) ((BYTE)((DWORD_PTR)(w) & 0xff)) 148 | #define HIBYTE(w) ((BYTE)((DWORD_PTR)(w) >> 8)) 149 | 150 | #ifndef WIN_INTERNAL 151 | DECLARE_HANDLE (HWND); 152 | DECLARE_HANDLE (HHOOK); 153 | #ifdef WINABLE 154 | DECLARE_HANDLE (HEVENT); 155 | #endif 156 | #endif 157 | 158 | typedef WORD ATOM; 159 | 160 | typedef HANDLE *SPHANDLE; 161 | typedef HANDLE *LPHANDLE; 162 | typedef HANDLE HGLOBAL; 163 | typedef HANDLE HLOCAL; 164 | typedef HANDLE GLOBALHANDLE; 165 | typedef HANDLE LOCALHANDLE; 166 | #ifdef _WIN64 167 | typedef INT_PTR (WINAPI *FARPROC)(); 168 | typedef INT_PTR (WINAPI *NEARPROC)(); 169 | typedef INT_PTR (WINAPI *PROC)(); 170 | #else 171 | typedef int (WINAPI *FARPROC)(); 172 | typedef int (WINAPI *NEARPROC)(); 173 | typedef int (WINAPI *PROC)(); 174 | #endif 175 | 176 | typedef void *HGDIOBJ; 177 | 178 | DECLARE_HANDLE(HKEY); 179 | typedef HKEY *PHKEY; 180 | 181 | DECLARE_HANDLE(HACCEL); 182 | DECLARE_HANDLE(HBITMAP); 183 | DECLARE_HANDLE(HBRUSH); 184 | DECLARE_HANDLE(HCOLORSPACE); 185 | DECLARE_HANDLE(HDC); 186 | DECLARE_HANDLE(HGLRC); 187 | DECLARE_HANDLE(HDESK); 188 | DECLARE_HANDLE(HENHMETAFILE); 189 | DECLARE_HANDLE(HFONT); 190 | DECLARE_HANDLE(HICON); 191 | DECLARE_HANDLE(HMENU); 192 | DECLARE_HANDLE(HMETAFILE); 193 | DECLARE_HANDLE(HINSTANCE); 194 | typedef HINSTANCE HMODULE; 195 | DECLARE_HANDLE(HPALETTE); 196 | DECLARE_HANDLE(HPEN); 197 | DECLARE_HANDLE(HRGN); 198 | DECLARE_HANDLE(HRSRC); 199 | DECLARE_HANDLE(HSTR); 200 | DECLARE_HANDLE(HTASK); 201 | DECLARE_HANDLE(HWINSTA); 202 | DECLARE_HANDLE(HKL); 203 | DECLARE_HANDLE(HMONITOR); 204 | DECLARE_HANDLE(HWINEVENTHOOK); 205 | DECLARE_HANDLE(HUMPD); 206 | 207 | typedef int HFILE; 208 | typedef HICON HCURSOR; 209 | typedef DWORD COLORREF; 210 | typedef DWORD *LPCOLORREF; 211 | 212 | #define HFILE_ERROR ((HFILE)-1) 213 | 214 | typedef struct tagRECT { 215 | LONG left; 216 | LONG top; 217 | LONG right; 218 | LONG bottom; 219 | } RECT,*PRECT,*NPRECT,*LPRECT; 220 | 221 | typedef const RECT *LPCRECT; 222 | 223 | typedef struct _RECTL { 224 | LONG left; 225 | LONG top; 226 | LONG right; 227 | LONG bottom; 228 | } RECTL,*PRECTL,*LPRECTL; 229 | 230 | typedef const RECTL *LPCRECTL; 231 | 232 | typedef struct tagPOINT { 233 | LONG x; 234 | LONG y; 235 | } POINT,*PPOINT,*NPPOINT,*LPPOINT; 236 | 237 | typedef struct _POINTL { 238 | LONG x; 239 | LONG y; 240 | } POINTL,*PPOINTL; 241 | 242 | typedef struct tagSIZE { 243 | LONG cx; 244 | LONG cy; 245 | } SIZE,*PSIZE,*LPSIZE; 246 | 247 | typedef SIZE SIZEL; 248 | typedef SIZE *PSIZEL,*LPSIZEL; 249 | 250 | typedef struct tagPOINTS { 251 | SHORT x; 252 | SHORT y; 253 | } POINTS,*PPOINTS,*LPPOINTS; 254 | 255 | typedef struct _FILETIME { 256 | DWORD dwLowDateTime; 257 | DWORD dwHighDateTime; 258 | } FILETIME,*PFILETIME,*LPFILETIME; 259 | #define _FILETIME_ 260 | 261 | #define DM_UPDATE 1 262 | #define DM_COPY 2 263 | #define DM_PROMPT 4 264 | #define DM_MODIFY 8 265 | 266 | #define DM_IN_BUFFER DM_MODIFY 267 | #define DM_IN_PROMPT DM_PROMPT 268 | #define DM_OUT_BUFFER DM_COPY 269 | #define DM_OUT_DEFAULT DM_UPDATE 270 | 271 | #define DC_FIELDS 1 272 | #define DC_PAPERS 2 273 | #define DC_PAPERSIZE 3 274 | #define DC_MINEXTENT 4 275 | #define DC_MAXEXTENT 5 276 | #define DC_BINS 6 277 | #define DC_DUPLEX 7 278 | #define DC_SIZE 8 279 | #define DC_EXTRA 9 280 | #define DC_VERSION 10 281 | #define DC_DRIVER 11 282 | #define DC_BINNAMES 12 283 | #define DC_ENUMRESOLUTIONS 13 284 | #define DC_FILEDEPENDENCIES 14 285 | #define DC_TRUETYPE 15 286 | #define DC_PAPERNAMES 16 287 | #define DC_ORIENTATION 17 288 | #define DC_COPIES 18 289 | 290 | #ifdef __cplusplus 291 | } 292 | #endif 293 | #endif 294 | -------------------------------------------------------------------------------- /win32/include/winapi/windows.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the w64 mingw-runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | #ifndef _WINDOWS_ 7 | #define _WINDOWS_ 8 | 9 | #ifndef WIN32_LEAN_AND_MEAN 10 | #define WIN32_LEAN_AND_MEAN 1 11 | #endif 12 | 13 | #ifndef WINVER 14 | #define WINVER 0x0502 15 | #endif 16 | 17 | #include <_mingw.h> 18 | 19 | #ifndef _INC_WINDOWS 20 | #define _INC_WINDOWS 21 | 22 | #if defined(RC_INVOKED) && !defined(NOWINRES) 23 | 24 | #include 25 | #else 26 | 27 | #ifdef RC_INVOKED 28 | #define NOATOM 29 | #define NOGDI 30 | #define NOGDICAPMASKS 31 | #define NOMETAFILE 32 | #define NOMINMAX 33 | #define NOMSG 34 | #define NOOPENFILE 35 | #define NORASTEROPS 36 | #define NOSCROLL 37 | #define NOSOUND 38 | #define NOSYSMETRICS 39 | #define NOTEXTMETRIC 40 | #define NOWH 41 | #define NOCOMM 42 | #define NOKANJI 43 | #define NOCRYPT 44 | #define NOMCX 45 | #endif 46 | 47 | #if !defined(I_X86_) && !defined(_IA64_) && !defined(_AMD64_) && (defined(_X86_) && !defined(__x86_64)) 48 | #define I_X86_ 49 | #endif 50 | 51 | #if !defined(I_X86_) && !defined(_IA64_) && !defined(_AMD64_) && defined(__x86_64) 52 | #define _AMD64_ 53 | #endif 54 | 55 | #if !defined(I_X86_) && !(defined(_X86_) && !defined(__x86_64)) && !defined(_AMD64_) && defined(__ia64__) 56 | #if !defined(_IA64_) 57 | #define _IA64_ 58 | #endif 59 | #endif 60 | 61 | #ifndef RC_INVOKED 62 | #include 63 | #include 64 | #endif 65 | 66 | #include 67 | #include 68 | #include 69 | #include 70 | #include 71 | #include 72 | #include 73 | #include 74 | //gr #include 75 | 76 | #ifndef WIN32_LEAN_AND_MEAN 77 | #include 78 | #include 79 | #include 80 | #include 81 | #include 82 | #include 83 | #include 84 | #include 85 | #include 86 | #include 87 | #include 88 | #ifndef NOCRYPT 89 | #include 90 | #include 91 | #include 92 | #endif 93 | 94 | #ifndef NOUSER 95 | #ifndef NOGDI 96 | #include 97 | #ifdef INC_OLE1 98 | #include 99 | #else 100 | #include 101 | #endif 102 | #include 103 | #endif 104 | #endif 105 | #endif 106 | 107 | //gr #include 108 | 109 | #ifdef INC_OLE2 110 | #include 111 | #endif 112 | 113 | #ifndef NOSERVICE 114 | #include 115 | #endif 116 | 117 | #ifndef NOMCX 118 | #include 119 | #endif 120 | 121 | #ifndef NOIME 122 | #include 123 | #endif 124 | 125 | #endif 126 | #endif 127 | #endif 128 | -------------------------------------------------------------------------------- /win32/include/winapi/winver.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the w64 mingw-runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | #ifndef VER_H 7 | #define VER_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | #define VS_FILE_INFO RT_VERSION 14 | #define VS_VERSION_INFO 1 15 | #define VS_USER_DEFINED 100 16 | 17 | #define VS_FFI_SIGNATURE 0xFEEF04BDL 18 | #define VS_FFI_STRUCVERSION 0x00010000L 19 | #define VS_FFI_FILEFLAGSMASK 0x0000003FL 20 | 21 | #define VS_FF_DEBUG 0x00000001L 22 | #define VS_FF_PRERELEASE 0x00000002L 23 | #define VS_FF_PATCHED 0x00000004L 24 | #define VS_FF_PRIVATEBUILD 0x00000008L 25 | #define VS_FF_INFOINFERRED 0x00000010L 26 | #define VS_FF_SPECIALBUILD 0x00000020L 27 | 28 | #define VOS_UNKNOWN 0x00000000L 29 | #define VOS_DOS 0x00010000L 30 | #define VOS_OS216 0x00020000L 31 | #define VOS_OS232 0x00030000L 32 | #define VOS_NT 0x00040000L 33 | #define VOS_WINCE 0x00050000L 34 | 35 | #define VOS__BASE 0x00000000L 36 | #define VOS__WINDOWS16 0x00000001L 37 | #define VOS__PM16 0x00000002L 38 | #define VOS__PM32 0x00000003L 39 | #define VOS__WINDOWS32 0x00000004L 40 | 41 | #define VOS_DOS_WINDOWS16 0x00010001L 42 | #define VOS_DOS_WINDOWS32 0x00010004L 43 | #define VOS_OS216_PM16 0x00020002L 44 | #define VOS_OS232_PM32 0x00030003L 45 | #define VOS_NT_WINDOWS32 0x00040004L 46 | 47 | #define VFT_UNKNOWN 0x00000000L 48 | #define VFT_APP 0x00000001L 49 | #define VFT_DLL 0x00000002L 50 | #define VFT_DRV 0x00000003L 51 | #define VFT_FONT 0x00000004L 52 | #define VFT_VXD 0x00000005L 53 | #define VFT_STATIC_LIB 0x00000007L 54 | 55 | #define VFT2_UNKNOWN 0x00000000L 56 | #define VFT2_DRV_PRINTER 0x00000001L 57 | #define VFT2_DRV_KEYBOARD 0x00000002L 58 | #define VFT2_DRV_LANGUAGE 0x00000003L 59 | #define VFT2_DRV_DISPLAY 0x00000004L 60 | #define VFT2_DRV_MOUSE 0x00000005L 61 | #define VFT2_DRV_NETWORK 0x00000006L 62 | #define VFT2_DRV_SYSTEM 0x00000007L 63 | #define VFT2_DRV_INSTALLABLE 0x00000008L 64 | #define VFT2_DRV_SOUND 0x00000009L 65 | #define VFT2_DRV_COMM 0x0000000AL 66 | #define VFT2_DRV_INPUTMETHOD 0x0000000BL 67 | #define VFT2_DRV_VERSIONED_PRINTER 0x0000000CL 68 | 69 | #define VFT2_FONT_RASTER 0x00000001L 70 | #define VFT2_FONT_VECTOR 0x00000002L 71 | #define VFT2_FONT_TRUETYPE 0x00000003L 72 | 73 | #define VFFF_ISSHAREDFILE 0x0001 74 | 75 | #define VFF_CURNEDEST 0x0001 76 | #define VFF_FILEINUSE 0x0002 77 | #define VFF_BUFFTOOSMALL 0x0004 78 | 79 | #define VIFF_FORCEINSTALL 0x0001 80 | #define VIFF_DONTDELETEOLD 0x0002 81 | 82 | #define VIF_TEMPFILE 0x00000001L 83 | #define VIF_MISMATCH 0x00000002L 84 | #define VIF_SRCOLD 0x00000004L 85 | 86 | #define VIF_DIFFLANG 0x00000008L 87 | #define VIF_DIFFCODEPG 0x00000010L 88 | #define VIF_DIFFTYPE 0x00000020L 89 | 90 | #define VIF_WRITEPROT 0x00000040L 91 | #define VIF_FILEINUSE 0x00000080L 92 | #define VIF_OUTOFSPACE 0x00000100L 93 | #define VIF_ACCESSVIOLATION 0x00000200L 94 | #define VIF_SHARINGVIOLATION 0x00000400L 95 | #define VIF_CANNOTCREATE 0x00000800L 96 | #define VIF_CANNOTDELETE 0x00001000L 97 | #define VIF_CANNOTRENAME 0x00002000L 98 | #define VIF_CANNOTDELETECUR 0x00004000L 99 | #define VIF_OUTOFMEMORY 0x00008000L 100 | 101 | #define VIF_CANNOTREADSRC 0x00010000L 102 | #define VIF_CANNOTREADDST 0x00020000L 103 | 104 | #define VIF_BUFFTOOSMALL 0x00040000L 105 | #define VIF_CANNOTLOADLZ32 0x00080000L 106 | #define VIF_CANNOTLOADCABINET 0x00100000L 107 | 108 | #ifndef RC_INVOKED 109 | 110 | typedef struct tagVS_FIXEDFILEINFO 111 | { 112 | DWORD dwSignature; 113 | DWORD dwStrucVersion; 114 | DWORD dwFileVersionMS; 115 | DWORD dwFileVersionLS; 116 | DWORD dwProductVersionMS; 117 | DWORD dwProductVersionLS; 118 | DWORD dwFileFlagsMask; 119 | DWORD dwFileFlags; 120 | DWORD dwFileOS; 121 | DWORD dwFileType; 122 | DWORD dwFileSubtype; 123 | DWORD dwFileDateMS; 124 | DWORD dwFileDateLS; 125 | } VS_FIXEDFILEINFO; 126 | 127 | #ifdef UNICODE 128 | #define VerFindFile VerFindFileW 129 | #define VerInstallFile VerInstallFileW 130 | #define GetFileVersionInfoSize GetFileVersionInfoSizeW 131 | #define GetFileVersionInfo GetFileVersionInfoW 132 | #define VerLanguageName VerLanguageNameW 133 | #define VerQueryValue VerQueryValueW 134 | #else 135 | #define VerFindFile VerFindFileA 136 | #define VerInstallFile VerInstallFileA 137 | #define GetFileVersionInfoSize GetFileVersionInfoSizeA 138 | #define GetFileVersionInfo GetFileVersionInfoA 139 | #define VerLanguageName VerLanguageNameA 140 | #define VerQueryValue VerQueryValueA 141 | #endif 142 | 143 | DWORD WINAPI VerFindFileA(DWORD uFlags,LPSTR szFileName,LPSTR szWinDir,LPSTR szAppDir,LPSTR szCurDir,PUINT lpuCurDirLen,LPSTR szDestDir,PUINT lpuDestDirLen); 144 | DWORD WINAPI VerFindFileW(DWORD uFlags,LPWSTR szFileName,LPWSTR szWinDir,LPWSTR szAppDir,LPWSTR szCurDir,PUINT lpuCurDirLen,LPWSTR szDestDir,PUINT lpuDestDirLen); 145 | DWORD WINAPI VerInstallFileA(DWORD uFlags,LPSTR szSrcFileName,LPSTR szDestFileName,LPSTR szSrcDir,LPSTR szDestDir,LPSTR szCurDir,LPSTR szTmpFile,PUINT lpuTmpFileLen); 146 | DWORD WINAPI VerInstallFileW(DWORD uFlags,LPWSTR szSrcFileName,LPWSTR szDestFileName,LPWSTR szSrcDir,LPWSTR szDestDir,LPWSTR szCurDir,LPWSTR szTmpFile,PUINT lpuTmpFileLen); 147 | DWORD WINAPI GetFileVersionInfoSizeA(LPCSTR lptstrFilename,LPDWORD lpdwHandle); 148 | DWORD WINAPI GetFileVersionInfoSizeW(LPCWSTR lptstrFilename,LPDWORD lpdwHandle); 149 | WINBOOL WINAPI GetFileVersionInfoA(LPCSTR lptstrFilename,DWORD dwHandle,DWORD dwLen,LPVOID lpData); 150 | WINBOOL WINAPI GetFileVersionInfoW(LPCWSTR lptstrFilename,DWORD dwHandle,DWORD dwLen,LPVOID lpData); 151 | DWORD WINAPI VerLanguageNameA(DWORD wLang,LPSTR szLang,DWORD nSize); 152 | DWORD WINAPI VerLanguageNameW(DWORD wLang,LPWSTR szLang,DWORD nSize); 153 | WINBOOL WINAPI VerQueryValueA(const LPVOID pBlock,LPSTR lpSubBlock,LPVOID *lplpBuffer,PUINT puLen); 154 | WINBOOL WINAPI VerQueryValueW(const LPVOID pBlock,LPWSTR lpSubBlock,LPVOID *lplpBuffer,PUINT puLen); 155 | #endif 156 | 157 | #ifdef __cplusplus 158 | } 159 | #endif 160 | #endif 161 | -------------------------------------------------------------------------------- /win32/include/winapi/ws2ipdef.h: -------------------------------------------------------------------------------- 1 | #ifndef _WS2IPDEF_H 2 | #define _WS2IPDEF_H 3 | 4 | #if __GNUC__ >=3 5 | #pragma GCC system_header 6 | #endif 7 | 8 | #include 9 | 10 | struct ip_mreq { 11 | struct in_addr imr_multiaddr; 12 | struct in_addr imr_interface; 13 | }; 14 | 15 | struct ip_mreq_source { 16 | struct in_addr imr_multiaddr; 17 | struct in_addr imr_sourceaddr; 18 | struct in_addr imr_interface; 19 | }; 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /win32/lib/chkstk.S: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------- */ 2 | /* chkstk86.s */ 3 | 4 | #ifdef __leading_underscore 5 | # define _(s) _##s 6 | #else 7 | # define _(s) s 8 | #endif 9 | 10 | /* ---------------------------------------------- */ 11 | #ifndef __x86_64__ 12 | /* ---------------------------------------------- */ 13 | 14 | .globl _(__chkstk) 15 | _(__chkstk): 16 | xchg (%esp),%ebp /* store ebp, get ret.addr */ 17 | push %ebp /* push ret.addr */ 18 | lea 4(%esp),%ebp /* setup frame ptr */ 19 | push %ecx /* save ecx */ 20 | mov %ebp,%ecx 21 | P0: 22 | sub $4096,%ecx 23 | test %eax,(%ecx) 24 | sub $4096,%eax 25 | cmp $4096,%eax 26 | jge P0 27 | sub %eax,%ecx 28 | test %eax,(%ecx) 29 | 30 | mov %esp,%eax 31 | mov %ecx,%esp 32 | mov (%eax),%ecx /* restore ecx */ 33 | jmp *4(%eax) 34 | 35 | /* ---------------------------------------------- */ 36 | #else 37 | /* ---------------------------------------------- */ 38 | 39 | .globl _(__chkstk) 40 | _(__chkstk): 41 | xchg (%rsp),%rbp /* store ebp, get ret.addr */ 42 | push %rbp /* push ret.addr */ 43 | lea 8(%rsp),%rbp /* setup frame ptr */ 44 | push %rcx /* save ecx */ 45 | mov %rbp,%rcx 46 | movslq %eax,%rax 47 | P0: 48 | sub $4096,%rcx 49 | test %rax,(%rcx) 50 | sub $4096,%rax 51 | cmp $4096,%rax 52 | jge P0 53 | sub %rax,%rcx 54 | test %rax,(%rcx) 55 | 56 | mov %rsp,%rax 57 | mov %rcx,%rsp 58 | mov (%rax),%rcx /* restore ecx */ 59 | jmp *8(%rax) 60 | 61 | /* ---------------------------------------------- */ 62 | /* setjmp/longjmp support */ 63 | 64 | .globl _(tinyc_getbp) 65 | _(tinyc_getbp): 66 | mov %rbp,%rax 67 | ret 68 | 69 | /* ---------------------------------------------- */ 70 | #endif 71 | /* ---------------------------------------------- */ 72 | 73 | 74 | -------------------------------------------------------------------------------- /win32/lib/crt1.c: -------------------------------------------------------------------------------- 1 | // ============================================= 2 | // crt1.c 3 | 4 | // _UNICODE for tchar.h, UNICODE for API 5 | #include 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | #define _UNKNOWN_APP 0 12 | #define _CONSOLE_APP 1 13 | #define _GUI_APP 2 14 | 15 | #define _MCW_PC 0x00030000 // Precision Control 16 | #define _PC_24 0x00020000 // 24 bits 17 | #define _PC_53 0x00010000 // 53 bits 18 | #define _PC_64 0x00000000 // 64 bits 19 | 20 | #ifdef _UNICODE 21 | #define __tgetmainargs __wgetmainargs 22 | #define _tstart _wstart 23 | #define _tmain wmain 24 | #define _runtmain _runwmain 25 | #else 26 | #define __tgetmainargs __getmainargs 27 | #define _tstart _start 28 | #define _tmain main 29 | #define _runtmain _runmain 30 | #endif 31 | 32 | typedef struct { int newmode; } _startupinfo; 33 | int __cdecl __tgetmainargs(int *pargc, _TCHAR ***pargv, _TCHAR ***penv, int globb, _startupinfo*); 34 | void __cdecl __set_app_type(int apptype); 35 | unsigned int __cdecl _controlfp(unsigned int new_value, unsigned int mask); 36 | extern int _tmain(int argc, _TCHAR * argv[], _TCHAR * env[]); 37 | 38 | #include "crtinit.c" 39 | 40 | /* Allow command-line globbing with "int _dowildcard = 1;" in the user source */ 41 | int _dowildcard; 42 | 43 | static LONG WINAPI catch_sig(EXCEPTION_POINTERS *ex) 44 | { 45 | return _XcptFilter(ex->ExceptionRecord->ExceptionCode, ex); 46 | } 47 | 48 | void _tstart(void) 49 | { 50 | int ret; 51 | 52 | _startupinfo start_info = {0}; 53 | SetUnhandledExceptionFilter(catch_sig); 54 | // Sets the current application type 55 | __set_app_type(_CONSOLE_APP); 56 | 57 | // Set default FP precision to 53 bits (8-byte double) 58 | // _MCW_PC (Precision control) is not supported on ARM 59 | #if defined __i386__ || defined __x86_64__ 60 | _controlfp(_PC_53, _MCW_PC); 61 | #endif 62 | 63 | __tgetmainargs( &__argc, &__targv, &_tenviron, _dowildcard, &start_info); 64 | run_ctors(__argc, __targv, _tenviron); 65 | ret = _tmain(__argc, __targv, _tenviron); 66 | run_dtors(); 67 | exit(ret); 68 | } 69 | 70 | // ============================================= 71 | // for 'tcc -run ,,,' 72 | 73 | __attribute__((weak)) extern int __run_on_exit(); 74 | 75 | int _runtmain(int argc, /* as tcc passed in */ char **argv) 76 | { 77 | int ret; 78 | #ifdef UNICODE 79 | _startupinfo start_info = {0}; 80 | 81 | __tgetmainargs(&__argc, &__targv, &_tenviron, _dowildcard, &start_info); 82 | /* may be wrong when tcc has received wildcards (*.c) */ 83 | if (argc < __argc) { 84 | __targv += __argc - argc; 85 | __argc = argc; 86 | } 87 | #else 88 | __argc = argc; 89 | __targv = argv; 90 | #endif 91 | #if defined __i386__ || defined __x86_64__ 92 | _controlfp(_PC_53, _MCW_PC); 93 | #endif 94 | run_ctors(__argc, __targv, _tenviron); 95 | ret = _tmain(__argc, __targv, _tenviron); 96 | run_dtors(); 97 | __run_on_exit(ret); 98 | return ret; 99 | } 100 | 101 | // ============================================= 102 | -------------------------------------------------------------------------------- /win32/lib/crt1w.c: -------------------------------------------------------------------------------- 1 | #define _UNICODE 1 2 | #define UNICODE 1 3 | #include "crt1.c" 4 | -------------------------------------------------------------------------------- /win32/lib/crtinit.c: -------------------------------------------------------------------------------- 1 | //+--------------------------------------------------------------------------- 2 | 3 | #ifdef __leading_underscore 4 | # define _(s) s 5 | #else 6 | # define _(s) _##s 7 | #endif 8 | 9 | extern void (*_(_init_array_start)[]) (int argc, _TCHAR **argv, _TCHAR **envp); 10 | extern void (*_(_init_array_end)[]) (int argc, _TCHAR **argv, _TCHAR **envp); 11 | extern void (*_(_fini_array_start)[]) (void); 12 | extern void (*_(_fini_array_end)[]) (void); 13 | 14 | static void run_ctors(int argc, _TCHAR **argv, _TCHAR **env) 15 | { 16 | int i = 0; 17 | while (&_(_init_array_start)[i] != _(_init_array_end)) 18 | (*_(_init_array_start)[i++])(argc, argv, env); 19 | } 20 | 21 | static void run_dtors(void) 22 | { 23 | int i = 0; 24 | while (&_(_fini_array_end)[i] != _(_fini_array_start)) 25 | (*_(_fini_array_end)[--i])(); 26 | } 27 | -------------------------------------------------------------------------------- /win32/lib/dllcrt1.c: -------------------------------------------------------------------------------- 1 | //+--------------------------------------------------------------------------- 2 | 3 | #include 4 | #include 5 | #include "crtinit.c" 6 | 7 | BOOL WINAPI DllMain (HINSTANCE hDll, DWORD dwReason, LPVOID lpReserved); 8 | 9 | BOOL WINAPI _dllstart(HINSTANCE hDll, DWORD dwReason, LPVOID lpReserved) 10 | { 11 | BOOL bRet; 12 | if (dwReason == DLL_PROCESS_ATTACH) /* ignore DLL_THREAD_ATTACH */ 13 | run_ctors(0, 0, 0); 14 | bRet = DllMain (hDll, dwReason, lpReserved); 15 | if (dwReason == DLL_PROCESS_DETACH) /* ignore DLL_THREAD_DETACH */ 16 | run_dtors(); 17 | return bRet; 18 | } 19 | -------------------------------------------------------------------------------- /win32/lib/dllmain.c: -------------------------------------------------------------------------------- 1 | //+--------------------------------------------------------------------------- 2 | 3 | #include 4 | 5 | BOOL WINAPI DllMain (HINSTANCE hDll, DWORD dwReason, LPVOID lpReserved) 6 | { 7 | return TRUE; 8 | } 9 | 10 | -------------------------------------------------------------------------------- /win32/lib/wincrt1.c: -------------------------------------------------------------------------------- 1 | //+--------------------------------------------------------------------------- 2 | 3 | // _UNICODE for tchar.h, UNICODE for API 4 | #include 5 | 6 | #include 7 | #include 8 | 9 | #define __UNKNOWN_APP 0 10 | #define __CONSOLE_APP 1 11 | #define __GUI_APP 2 12 | void __set_app_type(int); 13 | void _controlfp(unsigned a, unsigned b); 14 | 15 | #ifdef _UNICODE 16 | #define __tgetmainargs __wgetmainargs 17 | #define _twinstart _wwinstart 18 | #define _runtwinmain _runwwinmain 19 | int APIENTRY wWinMain(HINSTANCE, HINSTANCE, LPWSTR, int); 20 | #else 21 | #define __tgetmainargs __getmainargs 22 | #define _twinstart _winstart 23 | #define _runtwinmain _runwinmain 24 | #endif 25 | 26 | typedef struct { int newmode; } _startupinfo; 27 | int __cdecl __tgetmainargs(int *pargc, _TCHAR ***pargv, _TCHAR ***penv, int globb, _startupinfo*); 28 | 29 | #include "crtinit.c" 30 | 31 | static int go_winmain(TCHAR *arg1) 32 | { 33 | STARTUPINFO si; 34 | _TCHAR *szCmd, *p; 35 | int fShow; 36 | int retval; 37 | 38 | GetStartupInfo(&si); 39 | if (si.dwFlags & STARTF_USESHOWWINDOW) 40 | fShow = si.wShowWindow; 41 | else 42 | fShow = SW_SHOWDEFAULT; 43 | 44 | szCmd = NULL, p = GetCommandLine(); 45 | if (arg1) 46 | szCmd = _tcsstr(p, arg1); 47 | if (NULL == szCmd) 48 | szCmd = _tcsdup(__T("")); 49 | else if (szCmd > p && szCmd[-1] == __T('"')) 50 | --szCmd; 51 | #if defined __i386__ || defined __x86_64__ 52 | _controlfp(0x10000, 0x30000); 53 | #endif 54 | run_ctors(__argc, __targv, _tenviron); 55 | retval = _tWinMain(GetModuleHandle(NULL), NULL, szCmd, fShow); 56 | run_dtors(); 57 | return retval; 58 | } 59 | 60 | static LONG WINAPI catch_sig(EXCEPTION_POINTERS *ex) 61 | { 62 | return _XcptFilter(ex->ExceptionRecord->ExceptionCode, ex); 63 | } 64 | 65 | int _twinstart(void) 66 | { 67 | _startupinfo start_info_con = {0}; 68 | SetUnhandledExceptionFilter(catch_sig); 69 | __set_app_type(__GUI_APP); 70 | __tgetmainargs(&__argc, &__targv, &_tenviron, 0, &start_info_con); 71 | exit(go_winmain(__argc > 1 ? __targv[1] : NULL)); 72 | } 73 | 74 | int _runtwinmain(int argc, /* as tcc passed in */ char **argv) 75 | { 76 | #ifdef UNICODE 77 | _startupinfo start_info = {0}; 78 | __tgetmainargs(&__argc, &__targv, &_tenviron, 0, &start_info); 79 | /* may be wrong when tcc has received wildcards (*.c) */ 80 | if (argc < __argc) 81 | __targv += __argc - argc, __argc = argc; 82 | #else 83 | __argc = argc, __targv = argv; 84 | #endif 85 | return go_winmain(__argc > 1 ? __targv[1] : NULL); 86 | } 87 | -------------------------------------------------------------------------------- /win32/lib/wincrt1w.c: -------------------------------------------------------------------------------- 1 | #define _UNICODE 1 2 | #define UNICODE 1 3 | #include "wincrt1.c" 4 | -------------------------------------------------------------------------------- /win32/tcc-win32.txt: -------------------------------------------------------------------------------- 1 | 2 | TinyCC 3 | ====== 4 | 5 | This file contains specific information for usage of TinyCC 6 | under MS-Windows. See tcc-doc.html to have all the features. 7 | 8 | 9 | Installation from the binary ZIP package: 10 | ----------------------------------------- 11 | Unzip the package to a directory of your choice. 12 | 13 | 14 | Set the system PATH: 15 | -------------------- 16 | To be able to invoke the compiler from everywhere on your computer by 17 | just typing "tcc", please add the directory containing tcc.exe to your 18 | system PATH. 19 | 20 | 21 | Include and library search paths 22 | -------------------------------- 23 | On windows, the standard "include" and "lib" directories are searched 24 | relatively from the location of the executables (tcc.exe, libtcc.dll). 25 | 26 | 27 | Examples: 28 | --------- 29 | Open a console window (DOS box) and 'cd' to the examples directory. 30 | 31 | For the 'Fibonacci' example type: 32 | 33 | tcc fib.c 34 | 35 | For the 'Hello Windows' GUI example type: 36 | 37 | tcc hello_win.c 38 | 39 | For the 'Hello DLL' example type 40 | 41 | tcc -shared dll.c 42 | tcc -impdef dll.dll (optional) 43 | tcc hello_dll.c dll.def 44 | 45 | 46 | Using libtcc as JIT compiler in your program 47 | -------------------------------------------- 48 | Check out the 'libtcc_test' example: 49 | 50 | - Running it from source: 51 | tcc -I libtcc libtcc/libtcc.def -run examples/libtcc_test.c 52 | 53 | - Compiling with TCC: 54 | tcc examples/libtcc_test.c -I libtcc libtcc/libtcc.def 55 | 56 | - Compiling with MinGW: 57 | gcc examples/libtcc_test.c -I libtcc libtcc.dll -o libtcc_test.exe 58 | 59 | - Compiling with MSVC: 60 | lib /def:libtcc\libtcc.def /out:libtcc.lib 61 | cl /MD examples/libtcc_test.c -I libtcc libtcc.lib 62 | 63 | 64 | Import Definition Files: 65 | ------------------------ 66 | To link with Windows system DLLs, TCC uses import definition 67 | files (.def) instead of libraries. 68 | 69 | The now built-in 'tiny_impdef' program may be used to make 70 | additional .def files for any DLL. For example 71 | 72 | tcc -impdef [-v] opengl32.dll [-o opengl32.def] 73 | 74 | Put opengl32.def into the tcc/lib directory. Specify -lopengl32 at 75 | the TCC commandline to link a program that uses opengl32.dll. 76 | 77 | 78 | Header Files: 79 | ------------- 80 | The system header files (except _mingw.h) are from the MinGW 81 | distribution: 82 | 83 | http://www.mingw.org/ 84 | 85 | From the windows headers, only a minimal set is included. If you need 86 | more, get MinGW's "w32api" package. Extract the files from "include" 87 | into your "tcc/include/winapi" directory. 88 | 89 | If the latest mingw headers don't play nice with the TinyCC headers, 90 | there's also TinyCC-specific win32 headers package which contains 91 | an "include" dir. Files in that dir are additional to the built-in 92 | include files. At the time of writing there are few files in that 93 | package which also exist as built-in headers: 94 | 95 | unistd.h 96 | winapi/qos.h 97 | winapi/winnls.h 98 | winapi/ws2ipdef.h 99 | winapi/ws2tcpip.h 100 | winapi/windows.h 101 | winapi/winsock2.h 102 | 103 | With the exception of winapi/winsock2.h, these should overwrite the 104 | built-in headers (unistd.h and winapi/windows.h are enhanced in that 105 | package, winapi/winsock2.h is older than the built-in file - and with 106 | less definitions, and the rest are identical). 107 | 108 | The latest package at the time of writing is winapi-full-for-0.9.27.zip 109 | which works well also with TinyCC 0.9.28rc, and is available at: 110 | 111 | http://download.savannah.nongnu.org/releases/tinycc/ 112 | 113 | 114 | Resource Files: 115 | --------------- 116 | TCC can link windows resources in coff format as generated by MinGW's 117 | windres.exe. For example: 118 | 119 | windres -O coff app.rc -o appres.o 120 | tcc app.c appres.o -o app.exe 121 | 122 | 123 | Tiny Libmaker: 124 | -------------- 125 | The now built-in tiny_libmaker tool by Timovj Lahde can be used as 126 | 'ar' replacement to make a library from several object files: 127 | 128 | tcc -ar [rcsv] library objectfiles ... 129 | 130 | 131 | Compilation from source: 132 | ------------------------ 133 | * You can use the MinGW and MSYS tools available at 134 | http://www.mingw.org 135 | http://www.mingw-w64.org 136 | http://www.msys2.org 137 | 138 | Untar the TCC archive and type in the MSYS shell: 139 | ./configure [--prefix installpath] 140 | make 141 | make install 142 | 143 | The default install location is c:\Program Files\tcc 144 | 145 | Cygwin can be used too with its mingw cross-compiler installed: 146 | ./configure --cross-prefix=i686-w64-mingw32- 147 | (the prefix may vary) 148 | 149 | * Alternatively you can compile TCC with just GCC from MinGW using 150 | > build-tcc.bat (from the win32 directory) 151 | 152 | Also MSVC can be used with the "VSTools Developer Command Prompt": 153 | > build-tcc.bat -c cl 154 | 155 | or with an existing tcc (needs to be in a different directory) 156 | > build-tcc.bat -c some-tcc-dir\tcc.exe 157 | 158 | Also you can copy/install everything into another directory: 159 | > build-tcc.bat -i 160 | 161 | Limitations: 162 | ------------ 163 | - On the object file level, currently TCC supports only the ELF format, 164 | not COFF as used by MinGW and MSVC. It is not possible to exchange 165 | object files or libraries between TCC and these compilers. 166 | 167 | However libraries for TCC from objects by TCC can be made using 168 | tcc -ar lib.a files.o ,,, 169 | 170 | - No leading underscore is generated in the ELF symbols. 171 | 172 | Documentation and License: 173 | -------------------------- 174 | TCC is distributed under the GNU Lesser General Public License. (See 175 | COPYING file or http://www.gnu.org/licenses/lgpl-2.1.html) 176 | 177 | TinyCC homepage is at: 178 | 179 | http://fabrice.bellard.free.fr/tcc/ 180 | 181 | 182 | WinAPI Help and 3rd-party tools: 183 | -------------------------------- 184 | The Windows API documentation (Win95) in a single .hlp file is 185 | available on the lcc-win32 site as "win32hlp.exe" or from other 186 | locations as "win32hlp_big.zip". 187 | 188 | A nice RAD tool to create windows resources (dialog boxes etc.) is 189 | "ResEd", available at the RadASM website. 190 | 191 | 192 | --- grischka 193 | -------------------------------------------------------------------------------- /win64_x86_64.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | amal -DONE_SOURCE -E tcc.c > all.c 4 | # cleanup multiline macros for compat with unifdef 5 | EXINIT='se noled:&/\\$ 6 | DJ$DJnDJnDJ$DJ$DJnDJ$DJnDJ$DJnDJ$DJnDJnDJnDJ$DJn :q' vi -e all.c 7 | 8 | #cleanup license turds 9 | EXINIT='se noled:/ifndef ONE_SOURCE/:.,$g/\/\*$/.,.+1g/.*\*.*TCC - /.-1,.d\\:&d/\*/$ 10 | dd:wq' vi -e all.c 11 | 12 | cp all.c __all.c 13 | 14 | cat lib/libtcc1.c >> __all.c 15 | EXINIT="1,18d:i\#define TCC_VERSION \"$(git rev-parse --verify HEAD)\" 16 | :g/if \(TCC_LIBTCC1\[0\]\)/.,.+1d:wq" vi -e __all.c 17 | 18 | cat <<\EOF >> __all.c 19 | 20 | #ifdef __TINYC__ 21 | 22 | #ifdef TCC_TARGET_I386 23 | __asm__ 24 | ( 25 | ".global alloca\n" 26 | "alloca:\n" 27 | "pop %edx\n" 28 | "pop %eax\n" 29 | "add $3, %eax\n" 30 | "and $-4,%eax\n" 31 | "je exit\n" 32 | "p1:\n" 33 | "cmp $0x1000,%eax\n" 34 | "jbe inter\n" 35 | "test %eax,-0x1000(%esp)\n" 36 | "sub $0x1000,%esp\n" 37 | "sub $0x1000,%eax\n" 38 | "jmp p1\n" 39 | "inter:\n" 40 | "sub %eax,%esp\n" 41 | "mov %esp,%eax\n" 42 | "exit:\n" 43 | "push %edx\n" 44 | "push %edx\n" 45 | "ret\n" 46 | ); 47 | 48 | __asm__ 49 | ( 50 | ".global __chkstk \n" 51 | "__chkstk: \n" 52 | "xchg (%esp),%ebp\n" /* store ebp, get ret.addr */ 53 | "push %ebp\n" /* push ret.addr */ 54 | "lea 4(%esp),%ebp\n" /* setup frame ptr */ 55 | "push %ecx\n" /* save ecx */ 56 | "mov %ebp,%ecx\n" 57 | "P0:\n" 58 | "sub $4096,%ecx\n" 59 | "test %eax,(%ecx)\n" 60 | "sub $4096,%eax\n" 61 | "cmp $4096,%eax\n" 62 | "jge P0\n" 63 | "sub %eax,%ecx\n" 64 | "test %eax,(%ecx)\n" 65 | "mov %esp,%eax\n" 66 | "mov %ecx,%esp\n" 67 | "mov (%eax),%ecx\n" /* restore ecx */ 68 | "jmp *4(%eax)\n" 69 | ); 70 | #endif 71 | 72 | #ifdef TCC_TARGET_X86_64 73 | __asm__ 74 | ( 75 | ".globl alloca \n " 76 | "alloca: \n " 77 | "pop %rdx \n " 78 | #ifdef _WIN32 79 | "mov %rcx,%rax \n " 80 | #else 81 | "mov %rdi,%rax \n " 82 | #endif 83 | "add $15,%rax \n " 84 | "and $-16,%rax \n " 85 | "jz p3 \n " 86 | #ifdef _WIN32 87 | "p1: \n " 88 | "cmp $4096,%rax \n " 89 | "jbe p2 \n " 90 | "test %rax,-4096(%rsp) \n " 91 | "sub $4096,%rsp \n " 92 | "sub $4096,%rax \n " 93 | "jmp p1 \n " 94 | "p2: \n " 95 | #endif 96 | "sub %rax,%rsp \n " 97 | "mov %rsp,%rax \n " 98 | "p3: \n " 99 | "push %rdx \n " 100 | "ret \n " 101 | ); 102 | 103 | __asm__ 104 | ( 105 | ".globl __chkstk\n" 106 | "__chkstk:\n" 107 | "xchg (%rsp),%rbp\n" /* store ebp, get ret.addr */ 108 | "push %rbp\n" /* push ret.addr */ 109 | "lea 8(%rsp),%rbp\n" /* setup frame ptr */ 110 | "push %rcx\n" /* save ecx */ 111 | "mov %rbp,%rcx\n" 112 | "movslq %eax,%rax\n" 113 | "P0:\n" 114 | "sub $4096,%rcx\n" 115 | "test %rax,(%rcx)\n" 116 | "sub $4096,%rax\n" 117 | "cmp $4096,%rax\n" 118 | "jge P0\n" 119 | "sub %rax,%rcx\n" 120 | "test %rax,(%rcx)\n" 121 | "mov %rsp,%rax\n" 122 | "mov %rcx,%rsp\n" 123 | "mov (%rax),%rcx\n" /* restore ecx */ 124 | "jmp *8(%rax)\n" 125 | ); 126 | 127 | /* ---------------------------------------------- */ 128 | /* setjmp/longjmp support */ 129 | __asm__ 130 | ( 131 | ".globl tinyc_getbp\n" 132 | "tinyc_getbp:\n" 133 | "mov %rbp,%rax\n" 134 | "ret\n" 135 | ); 136 | 137 | #endif 138 | 139 | #include 140 | #define __UNKNOWN_APP 0 141 | #define __CONSOLE_APP 1 142 | #define __GUI_APP 2 143 | 144 | extern void __set_app_type(int); 145 | typedef struct 146 | { 147 | int newmode; 148 | } _startupinfo; 149 | extern int __cdecl __getmainargs(int *pargc, _TCHAR ***pargv, _TCHAR ***penv, int globb, _startupinfo*); 150 | 151 | int _start() 152 | { 153 | _startupinfo start_info = {0}; 154 | __set_app_type(__GUI_APP); 155 | //assume no unicode. 156 | __getmainargs( &__argc, &__targv, &_tenviron, 0, &start_info); 157 | main(__argc, __targv); 158 | return 1; 159 | } 160 | 161 | #endif 162 | EOF 163 | 164 | unifdef -k \ 165 | -DTCC_TARGET_PE \ 166 | -DTCC_TARGET_X86_64 \ 167 | -D__x86_64__ \ 168 | -DONE_SOURCE \ 169 | -DTCC_IS_NATIVE \ 170 | -D_WIN64 \ 171 | -D_WIN32 \ 172 | -UCONFIG_NEW_MACHO \ 173 | -UTCC_TARGET_MACHO \ 174 | -UTCC_TARGET_ARM \ 175 | -UTCC_TARGET_UNIX \ 176 | -UTARGETOS_BSD \ 177 | -UTARGETOS_OpenBSD \ 178 | -UTARGETOS_FreeBSD \ 179 | -UTARGETOS_NetBSD \ 180 | -UTARGETOS_FreeBSD_kernel \ 181 | -UTCC_TARGET_I386 \ 182 | -U__arm__ \ 183 | -UTCC_TARGET_ARM64 \ 184 | -UTCC_ARM_EABI \ 185 | -UTCC_ARM_VFP \ 186 | -UTCC_TARGET_COFF \ 187 | -UTCC_TARGET_RISCV64 \ 188 | -UTCC_TARGET_C67 \ 189 | -U__APPLE__ \ 190 | -UCONFIG_SELINUX \ 191 | -U_MSC_VER \ 192 | __all.c > tcc_win64_x86_64.c 193 | 194 | astyle -n -H --style=linux --max-code-length=80 --indent=force-tab=8 --squeeze-ws --squeeze-lines=1 --align-pointer=name tcc_win64_x86_64.c 195 | 196 | --------------------------------------------------------------------------------