Skip to content

Commit d73181e

Browse files
author
Aidan Lee
committed
Merge branch 'master' into typed-functions
2 parents 915a151 + 0b59d98 commit d73181e

File tree

256 files changed

+11557
-3129
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

256 files changed

+11557
-3129
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
arch: 64
4343
sep: /
4444
ext: .dylib
45-
os: macos-13
45+
os: macos-15-intel
4646

4747
MacOSArm:
4848
strategy:

.github/workflows/test.yml

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -147,26 +147,14 @@ jobs:
147147
uses: ./.github/workflows/setup
148148
with:
149149
haxe: ${{ inputs.haxe }}
150-
- name: install mariadb
150+
- name: setup mariadb
151151
if: runner.os == 'Linux'
152152
run: |
153153
set -ex
154-
sudo rm -R /var/lib/mysql/
155-
curl -sSL https://downloads.mariadb.com/MariaDB/mariadb_repo_setup > mariadb_repo_setup
156-
curl -sSL https://downloads.mariadb.com/MariaDB/mariadb_repo_setup.sha256 > mariadb_repo_setup.sha256
157-
sha256sum --check mariadb_repo_setup.sha256
158-
sudo bash mariadb_repo_setup
159154
sudo apt-get update -qqy
160-
sudo apt-get remove -qqy mysql-common
161-
sudo apt-get autoremove -qqy
162155
sudo apt-get install -qqy mariadb-server
163-
- name: configure mariadb
164-
if: runner.os == 'Linux'
165-
run: |
166-
set -ex
167-
sudo systemctl unmask mysql.service
168-
sudo systemctl start mysql
169-
sudo mysql -u root -e "create database hxcpp; grant all privileges on hxcpp.* to hxcpp@localhost identified by 'hxcpp'; flush privileges;"
156+
sudo systemctl start mariadb
157+
sudo mariadb -u root -e "create database hxcpp; grant all privileges on hxcpp.* to hxcpp@localhost identified by 'hxcpp'; flush privileges;"
170158
- name: build
171159
run: haxe compile${{ inputs.arch }}.hxml
172160
- name: run
@@ -227,6 +215,8 @@ jobs:
227215
haxe: ${{ inputs.haxe }}
228216
- name: install haxe libs
229217
run: haxelib install compile-cpp.hxml --always
218+
# haxe 4 tests don't build with latest utest
219+
if: inputs.haxe != 'latest'
230220
- name: build
231221
run: haxe compile-cpp.hxml -D ${{ env.HXCPP_ARCH_FLAG }} -D no_http
232222
- name: run

Changes.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,40 @@
11

2+
4.3.xx
3+
------------------------------------------------------------
4+
5+
* Added support for killing processes on OS' other than Windows, Apple TV, and Apple Watch
6+
* Added register capturing on Linux
7+
* Added HXCPP_CPP17 define
8+
* Added ASM and NASM support to build xml
9+
* Added support for name and value entries to build xml
10+
* Added tracy profiler
11+
* Added support for Android NDKs higher than 21
12+
* Added x86_64 support to older Android NDKs
13+
* Added optional detaching of main thread
14+
15+
* Updated mbedtls to 2.28.2
16+
* Updated sqlite to 3.40.1
17+
* Updated zlib to 1.2.13
18+
19+
* Fixed SSL socket non blocking handshake throwing an exception on 64bit Windows
20+
* Fixed Windows 64bit architecture detection
21+
* Fixed critial error handler returning the wrong callstack
22+
* Fixed ARM64 library names on Mac
23+
* Fixed generational GC when used with HXCPP_ALIGN_ALLOC
24+
* Fixed pthread structured being unaligned
25+
* Fixed cppia crash on functions with empty bodies
26+
* Fixed regression parsing integers which wrap around
27+
* Fixed compilation with HXCPP_GC_DEBUG_LEVEL define
28+
* Fixed compilation with MinGW
29+
* Fixed enum parameters potentially returning null
30+
* Fixed HXCPP_CLANG not being set when using clang
31+
* Fixed pcre2 and mbedtls not being compiled with the c99 standard
32+
* Fixed behaviour of indexOf and lastIndexOf on empty strings not aligning with other targets
33+
* Fixed behaviour of directory reading function not aligning with other targets
34+
* Fixed haxelib not being invoked with the current working directory
35+
36+
* Removed Haxe 3 support
37+
238
4.3
339
------------------------------------------------------------
440

docs/build_xml/Defines.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ Defines affecting how the code is compiled. These can be on the command line wh
3838
| *HXCPP_PROFILER* | Add profiler support |
3939
| *HXCPP_TELEMETRY* | Add telemetry support |
4040
| *HXCPP_CPP11* | Use c++11 features and link libraries |
41+
| *HXCPP_CPP17* | Use c++17 features and link libraries |
4142
| *exe_link* | Generate executable file (rather than dynamic library on android) |
4243
| *static_link* | Generate static library |
4344
| *dll_link* | Generate dynamic library |
@@ -67,7 +68,7 @@ Defines affecting target architecture.
6768
| *HXCPP_LINUX_ARM64* | Run on a linux ARM64 device |
6869
| *winrt* | Compile for windowsRt/windows UWP |
6970
| *android* | Compile for android |
70-
| *PLATFORM* | Specify the android platform for NDK compilation |
71+
| *HXCPP_ANDROID_PLATFORM* | Specify the android platform for NDK compilation |
7172
| *ANDROID_NDK_ROOT* | Specify the location of the android NDK toolchain |
7273
| *ANDROID_NDK_DIR* | Specify the search location for finding the android NDK toolchain |
7374
| *HXCPP_X86* | Compile android for x86 architecture |

include/Array.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ template<> struct ReturnNull<double> { typedef Dynamic type; };
4141
template<> struct ReturnNull<float> { typedef Dynamic type; };
4242
template<> struct ReturnNull<bool> { typedef Dynamic type; };
4343
template<> struct ReturnNull<char> { typedef Dynamic type; };
44+
template<> struct ReturnNull<char16_t> { typedef Dynamic type; };
4445
template<> struct ReturnNull<signed char> { typedef Dynamic type; };
4546
template<> struct ReturnNull<unsigned char> { typedef Dynamic type; };
4647
template<> struct ReturnNull<short> { typedef Dynamic type; };
@@ -536,6 +537,7 @@ template<> struct ArrayClassId<unsigned char> { enum { id=hx::clsIdArrayByte };
536537
template<> struct ArrayClassId<signed char> { enum { id=hx::clsIdArrayByte }; };
537538
template<> struct ArrayClassId<unsigned short> { enum { id=hx::clsIdArrayShort }; };
538539
template<> struct ArrayClassId<signed short> { enum { id=hx::clsIdArrayShort }; };
540+
template<> struct ArrayClassId<char16_t> { enum { id = hx::clsIdArrayShort }; };
539541
template<> struct ArrayClassId<unsigned int> { enum { id=hx::clsIdArrayInt }; };
540542
template<> struct ArrayClassId<signed int> { enum { id=hx::clsIdArrayInt }; };
541543
template<> struct ArrayClassId<float> { enum { id=hx::clsIdArrayFloat32 }; };

include/Dynamic.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class HXCPP_EXTERN_CLASS_ATTRIBUTES Dynamic : public hx::ObjectPtr<hx::Object>
2424
Dynamic(unsigned short inVal);
2525
Dynamic(unsigned char inVal);
2626
Dynamic(signed char inVal);
27+
Dynamic(char16_t inVal);
2728
Dynamic(const cpp::CppInt32__ &inVal);
2829
Dynamic(bool inVal);
2930
Dynamic(double inVal);
@@ -71,6 +72,7 @@ class HXCPP_EXTERN_CLASS_ATTRIBUTES Dynamic : public hx::ObjectPtr<hx::Object>
7172
inline operator unsigned char () const { return mPtr ? mPtr->__ToInt() : 0; }
7273
inline operator char () const { return mPtr ? mPtr->__ToInt() : 0; }
7374
inline operator signed char () const { return mPtr ? mPtr->__ToInt() : 0; }
75+
inline operator char16_t () const { return mPtr ? mPtr->__ToInt() : 0; }
7476
inline operator bool() const { return mPtr && mPtr->__ToInt(); }
7577
inline operator cpp::Int64() const { return mPtr ? mPtr->__ToInt64() : 0; }
7678
inline operator cpp::UInt64() const { return mPtr ? mPtr->__ToInt64() : 0; }
@@ -172,6 +174,7 @@ class HXCPP_EXTERN_CLASS_ATTRIBUTES Dynamic : public hx::ObjectPtr<hx::Object>
172174
bool operator op (unsigned short inRHS) const { return IsNumeric() && ((double)(*this) op (double)inRHS); } \
173175
bool operator op (signed char inRHS) const { return IsNumeric() && ((double)(*this) op (double)inRHS); } \
174176
bool operator op (unsigned char inRHS) const { return IsNumeric() && ((double)(*this) op (double)inRHS); } \
177+
bool operator op (char16_t inRHS) const { return IsNumeric() && ((double)(*this) op (double)inRHS); } \
175178
bool operator op (bool inRHS) const { return IsBool() && ((double)(*this) op (double)inRHS); } \
176179

177180
bool operator != (const String &inRHS) const { return !mPtr || ((String)(*this) != inRHS); }
@@ -185,6 +188,7 @@ class HXCPP_EXTERN_CLASS_ATTRIBUTES Dynamic : public hx::ObjectPtr<hx::Object>
185188
bool operator != (unsigned short inRHS) const { return !IsNumeric() || ((double)(*this) != (double)inRHS); }
186189
bool operator != (signed char inRHS) const { return !IsNumeric() || ((double)(*this) != (double)inRHS); }
187190
bool operator != (unsigned char inRHS) const { return !IsNumeric() || ((double)(*this) != (double)inRHS); }
191+
bool operator != (char16_t inRHS) const { return !IsNumeric() || ((double)(*this) != (double)inRHS); }
188192
bool operator != (bool inRHS) const { return !IsBool() || ((double)(*this) != (double)inRHS); }
189193

190194

@@ -230,6 +234,7 @@ class HXCPP_EXTERN_CLASS_ATTRIBUTES Dynamic : public hx::ObjectPtr<hx::Object>
230234
Dynamic operator+(const unsigned short &i) const;
231235
Dynamic operator+(const signed char &i) const;
232236
Dynamic operator+(const unsigned char &i) const;
237+
Dynamic operator+(const char16_t& i) const;
233238
Dynamic operator+(const double &d) const;
234239
Dynamic operator+(const float &d) const;
235240
Dynamic operator+(const cpp::Variant &d) const;
@@ -271,6 +276,8 @@ class HXCPP_EXTERN_CLASS_ATTRIBUTES Dynamic : public hx::ObjectPtr<hx::Object>
271276
{ return mPtr->__GetType()==vtInt ? Dynamic((int)(*this) op inRHS) : Dynamic((double)(*this) op inRHS); } \
272277
Dynamic operator op (const unsigned char &inRHS) const \
273278
{ return mPtr->__GetType()==vtInt ? Dynamic((int)(*this) op inRHS) : Dynamic((double)(*this) op inRHS); } \
279+
Dynamic operator op (const char16_t &inRHS) const \
280+
{ return mPtr->__GetType()==vtInt ? Dynamic((int)(*this) op inRHS) : Dynamic((double)(*this) op inRHS); } \
274281
Dynamic operator op (const cpp::Int64 &inRHS) const \
275282
{ return Dynamic((double)(*this) op inRHS); } \
276283
Dynamic operator op (const cpp::UInt64 &inRHS) const \
@@ -462,6 +469,7 @@ COMPARE_DYNAMIC_OP( > )
462469
inline double operator op (const unsigned short &inLHS,const Dynamic &inRHS) { return inLHS op (double)inRHS; } \
463470
inline double operator op (const signed char &inLHS,const Dynamic &inRHS) { return inLHS op (double)inRHS; } \
464471
inline double operator op (const unsigned char &inLHS,const Dynamic &inRHS) { return inLHS op (double)inRHS; } \
472+
inline double operator op (const char16_t &inLHS,const Dynamic &inRHS) { return inLHS op (double)inRHS; } \
465473

466474
ARITH_DYNAMIC( - )
467475
ARITH_DYNAMIC( + )

include/cpp/Pointer.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,15 @@ class Struct
131131
// This allows 'StaticCast' to be used from arrays
132132
typedef Dynamic Ptr;
133133

134-
inline Struct( ) { }
134+
inline Struct( ) : value() { }
135135
inline Struct( const T &inRHS ) : value(inRHS) { }
136136
inline Struct( const null &) { value = T(); }
137137
inline Struct( const Reference<T> &);
138138
inline Struct( const Dynamic &inRHS) { fromDynamic(inRHS.mPtr); }
139139

140+
template<class... TArgs>
141+
Struct(TArgs... args) : value(std::forward<TArgs>(args)...) {}
142+
140143
inline Struct<T,HANDLER> &operator=( const T &inRHS ) { value = inRHS; return *this; }
141144
inline Struct<T,HANDLER> &operator=( const null & ) { value = T(); return *this; }
142145
inline Struct<T,HANDLER> &operator=( const Dynamic &inRHS ) { return *this = Struct<T,HANDLER>(inRHS); }
@@ -212,6 +215,7 @@ class Pointer
212215
hx::Object *obj = inVariant.asObject();
213216
ptr = obj ? (T*)inVariant.valObject->__GetHandle() : 0;
214217
}
218+
inline Pointer(const ::cpp::marshal::PointerReference<T>);
215219

216220
template<typename O>
217221
inline Pointer( const O *inValue ) : ptr( (T*) inValue) { }
@@ -509,6 +513,11 @@ class Pointer_obj
509513
}
510514

511515

516+
template<typename T>
517+
inline static Pointer<T> addressOf(const ::cpp::marshal::ValueReference<T>&);
518+
519+
template<typename T>
520+
inline static Pointer<T*> addressOf(const ::cpp::marshal::PointerReference<T>&);
512521

513522
template<typename T>
514523
inline static Pointer<T> addressOf(T &value) { return Pointer<T>(&value); }

include/cpp/Variant.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ namespace cpp
109109
inline operator unsigned char () const { return asInt(); }
110110
inline operator char () const { return asInt(); }
111111
inline operator signed char () const { return asInt(); }
112+
inline operator char16_t() const { return asInt(); }
112113
inline operator cpp::Int64 () const { return asInt64(); }
113114
inline operator cpp::UInt64 () const { return asInt64(); }
114115
inline bool operator !() const { return !asInt(); }
@@ -213,6 +214,7 @@ namespace cpp
213214
inline bool operator op (unsigned short inRHS) const { return isNumeric() && (asDouble() op (double)inRHS); } \
214215
inline bool operator op (signed char inRHS) const { return isNumeric() && (asDouble() op (double)inRHS); } \
215216
inline bool operator op (unsigned char inRHS) const { return isNumeric() && (asDouble() op (double)inRHS); } \
217+
inline bool operator op (char16_t inRHS) const { return isNumeric() && (asDouble() op (double)inRHS); } \
216218
inline bool operator op (bool inRHS) const { return isBool() && (asDouble() op (double)inRHS); } \
217219
inline bool operator op (const Dynamic &inRHS) const { return Compare(inRHS) op 0; } \
218220

@@ -285,6 +287,7 @@ namespace cpp
285287
inline double operator op (const unsigned int &inLHS,const cpp::Variant &inRHS) { return inLHS op (double)inRHS; } \
286288
inline double operator op (const signed char &inLHS,const cpp::Variant &inRHS) { return inLHS op (double)inRHS; } \
287289
inline double operator op (const unsigned char &inLHS,const cpp::Variant &inRHS) { return inLHS op (double)inRHS; } \
290+
inline double operator op (const char16_t &inLHS,const cpp::Variant &inRHS) { return inLHS op (double)inRHS; } \
288291
inline double operator op (const signed short &inLHS,const cpp::Variant &inRHS) { return inLHS op (double)inRHS; } \
289292
inline double operator op (const unsigned short &inLHS,const cpp::Variant &inRHS) { return inLHS op (double)inRHS; } \
290293
inline double operator op (const cpp::Int64 &inLHS,const cpp::Variant &inRHS) { return inLHS op (double)inRHS; } \
@@ -612,6 +615,7 @@ HX_VARIANT_OP_ISEQ(short)
612615
HX_VARIANT_OP_ISEQ(unsigned short)
613616
HX_VARIANT_OP_ISEQ(signed char)
614617
HX_VARIANT_OP_ISEQ(unsigned char)
618+
HX_VARIANT_OP_ISEQ(char16_t)
615619
HX_VARIANT_OP_ISEQ(bool)
616620

617621
inline bool operator < (bool inLHS,const cpp::Variant &inRHS) { return false; }
@@ -641,6 +645,8 @@ inline bool operator > (bool inLHS,const cpp::Variant &inRHS) { return false; }
641645
{ return inRHS.isNumeric() && (inLHS op (double)inRHS); } \
642646
inline bool operator op (unsigned char inLHS,const ::cpp::Variant &inRHS) \
643647
{ return inRHS.isNumeric() && (inLHS op (double)inRHS); } \
648+
inline bool operator op (char16_t inLHS,const ::cpp::Variant &inRHS) \
649+
{ return inRHS.isNumeric() && (inLHS op (double)inRHS); } \
644650
inline bool operator op (const null &,const ::cpp::Variant &inRHS) \
645651
{ return false; } \
646652

include/cpp/marshal/Boxed.hpp

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#pragma once
2+
3+
#include "Definitions.inc"
4+
5+
template<class T>
6+
inline void cpp::marshal::Boxed_obj<T>::finalise(::hx::Object* obj)
7+
{
8+
auto ptr = reinterpret_cast<Boxed_obj<T>*>(obj);
9+
10+
ptr->value.~T();
11+
}
12+
13+
template<class T>
14+
inline void cpp::marshal::Boxed_obj<T>::setFinaliser(std::true_type)
15+
{
16+
::hx::GCSetFinalizer(this, finalise);
17+
}
18+
19+
template<class T>
20+
inline void cpp::marshal::Boxed_obj<T>::setFinaliser(std::false_type) {}
21+
22+
template<class T>
23+
inline cpp::marshal::Boxed_obj<T>::Boxed_obj() : value()
24+
{
25+
setFinaliser(std::is_destructible<T>{});
26+
}
27+
28+
template<class T>
29+
inline cpp::marshal::Boxed_obj<T>::Boxed_obj(T* ptr) : value(*ptr)
30+
{
31+
setFinaliser(std::is_destructible<T>{});
32+
}
33+
34+
template<class T>
35+
template<class ...TArgs>
36+
inline cpp::marshal::Boxed_obj<T>::Boxed_obj(TArgs... args) : value(std::forward<TArgs>(args)...)
37+
{
38+
setFinaliser(std::is_destructible<T>{});
39+
}

0 commit comments

Comments
 (0)