Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
5dfa55a
Add marshal header for value type interop
Aidan63 Dec 15, 2024
ec75e42
finalise boxed objects if the type has a destructor
Aidan63 Dec 15, 2024
b22a024
works with static cast
Aidan63 Dec 16, 2024
4bc2bcc
add value type tests
Aidan63 Dec 16, 2024
44d5a28
move more conversion functions to reference class
Aidan63 Dec 27, 2024
0457958
forward declare everything to avoid order issues
Aidan63 Dec 27, 2024
d718eca
ValueType construction from boxed pointer
Aidan63 Dec 27, 2024
ad7f101
ValueType no longer inherits from struct
Aidan63 Dec 30, 2024
937868a
marshal reference interop with existing pointer types
Aidan63 Jan 1, 2025
5b00db8
Fix trying to dereference a null pointer when creating a boxed object…
Aidan63 Jan 1, 2025
73d18dc
add compare traits specialisation for reference null check
Aidan63 Jan 1, 2025
d4e7dfe
consistent null checking and throwing
Aidan63 Jan 1, 2025
46e0cd3
raise exceptions when value types are assigned null
Aidan63 Jan 1, 2025
e7195b4
reference equality operations
Aidan63 Jan 4, 2025
f92c9a3
remove no return
Aidan63 Jan 4, 2025
b49440f
remove some un-needed constructors
Jan 5, 2025
7f133d3
Make constructors use more templates and use reinterpret cast
Jan 7, 2025
d86f57c
use tagged dispatch
Jan 7, 2025
9f8ab77
support pointer types being held in value type helper
Jan 10, 2025
cfb6fee
Add new marshal pointer type
Jan 11, 2025
23da6f1
rename marshal types in prep for more pointer stuff
Jan 11, 2025
de4c7ec
support reinterpreting value type references
Jan 12, 2025
8004100
seemingly working pointer marshalling types
Jan 16, 2025
5572364
better null checking with pointer references
Jan 19, 2025
2ffcf81
add marshalling tests
Jan 19, 2025
0978d5b
Add pointer collection tests
Jan 19, 2025
d2a9bcf
Move enums into header files
Jan 20, 2025
50301d3
test abstract around pointers
Jan 20, 2025
b1231af
Pointer type changes
Jan 24, 2025
20cb53e
add pointer reference to pointer casting
Jan 25, 2025
5b5cd49
add null test to pointer access
Jan 25, 2025
335fe71
add test for vector of value types
Aidan63 Jan 26, 2025
f2a5e24
add tests showing weird null behaviour
Jan 26, 2025
82abbb4
move marshalling tests to existing native tests
Jan 26, 2025
98c4344
Merge branch 'master' into valuetype-marshal
Jan 26, 2025
7a45f5c
initial managed extern tests
Feb 1, 2025
d4e2d54
managed extern local tests for two different naming schemes
Feb 2, 2025
1354a56
reduce test duplication
Feb 2, 2025
18846ff
Add tests for classes holding managed externs
Feb 2, 2025
e8ac070
change tests so that static functions are tested
Feb 2, 2025
7dbc2ad
un-private point
Feb 2, 2025
bf54265
let enum abstract include meta handle it
Aidan63 Feb 3, 2025
8eb9888
remove analyser meta
Aidan63 Feb 3, 2025
f5a78c3
Merge branch 'master' into valuetype-marshal
Feb 5, 2025
7fcb920
Fix test related to recent pointer changes
Mar 21, 2025
7dc4687
Merge branch 'master' into valuetype-marshal
Aidan63 Nov 8, 2025
f6ecf8f
Add pointer ctor overload
Aidan63 Nov 9, 2025
11bc870
view marshalling type
Nov 15, 2025
92aa55f
Change to value semantics
Aidan63 Nov 15, 2025
e655568
Add view tests
Aidan63 Nov 15, 2025
cc0fbcc
Update some tests
Aidan63 Nov 16, 2025
5f46ac6
String marshalling functions
Nov 16, 2025
5db27ce
Marshalling tests
Aidan63 Nov 16, 2025
6639d0c
Merge remote-tracking branch 'Aidan63/valuetype-marshal' into valuety…
Aidan63 Nov 16, 2025
d595c91
view based string creation and support char16_t in various hxcpp types
Nov 17, 2025
4dc482b
Marshalling string tests
Aidan63 Nov 17, 2025
e15836d
const ref a bit
Nov 17, 2025
6c64ea8
Merge remote-tracking branch 'origin/valuetype-marshal' into valuetyp…
Nov 17, 2025
4e706d4
Don't use byte size in copyTo comparison check
Nov 17, 2025
a8b47b5
view extension tests
Aidan63 Nov 17, 2025
f3d750a
Split across multiple headers
Nov 18, 2025
5f991de
typed read and write helper functions
Nov 18, 2025
40e7fa1
Add compare function
Nov 18, 2025
45c112e
Some new typed zip work
Nov 23, 2025
4395cfc
more zlib impl
Nov 24, 2025
f46d5dd
full zip api
Nov 29, 2025
a3bb114
move to new folder and flexible build xml import
Nov 29, 2025
4e7bdb9
cstring to view conversion function, and allow null pointers
Nov 29, 2025
427e81c
Add view to pointer conversions
Nov 29, 2025
38b6197
Merge branch 'valuetype-marshal' into typed-zip
Nov 29, 2025
4e39395
View length is now size_t
Nov 30, 2025
3d7d9d4
Add endian specific read and write marshal functions
Aidan63 Dec 5, 2025
513330d
Add OOB checks
Dec 13, 2025
2603e8d
change the public api to use int64_t over size_t
Dec 13, 2025
14dc9b6
Fix string from view conversions to properly use the view length
Dec 13, 2025
a401f07
Add OOB exception tests
Aidan63 Dec 13, 2025
43fec7f
bound check read and write
Dec 13, 2025
c836e3a
make sure view write index is int64_t
Dec 13, 2025
6aac6da
Merge branch 'master' into valuetype-marshal
Dec 13, 2025
a18fca8
add tests for exceptions when reading or writing to small views
Aidan63 Dec 13, 2025
d315b3a
guard including new marshal headers
Dec 13, 2025
fe7ea65
fix dodgy conditional
Dec 13, 2025
a4db79f
Merge branch 'valuetype-marshal' into typed-zip
Dec 13, 2025
3fafc93
Updated zlib implementation
Dec 13, 2025
f171e82
header faff to make gcc pch happy
Dec 14, 2025
ad7606b
Support haxe 4 with new implementation
Dec 14, 2025
8eeba87
no longer throwing on multiple close calls
Dec 14, 2025
dc32e10
Merge branch 'master' into typed-zip
Dec 14, 2025
0d611e8
Give different file names to avoid cache issues
Dec 14, 2025
0a80434
Fix old string value
Dec 14, 2025
36d829f
Another old string
Dec 14, 2025
bc21f5e
static cast to int to avoid dynamic conversion of unsupported type
Dec 14, 2025
9deca1d
true instead of 1 for asLibrary value
Dec 14, 2025
9b8536f
some build xml tweaks
Dec 14, 2025
8207f7c
Make sure this_dir is used before Zip.cpp
Dec 14, 2025
bd15de5
case sensitive
Aidan63 Dec 14, 2025
6d1b328
Fix case sensitivity in include
Dec 14, 2025
5868d6b
flip around files order
Dec 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions include/hx/zip/Compress.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#pragma once

#include "Zip.hpp"

HX_DECLARE_CLASS2(hx, zip, Compress)

namespace hx
{
namespace zip
{
struct Compress_obj : Zip_obj
{
static Compress create(int level);
static Array<uint8_t> run(cpp::marshal::View<uint8_t> src, int level);

virtual int getBounds(int length) = 0;
};
}
}
17 changes: 17 additions & 0 deletions include/hx/zip/Uncompress.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#pragma once

#include "Zip.hpp"

HX_DECLARE_CLASS2(hx, zip, Uncompress)

namespace hx
{
namespace zip
{
struct Uncompress_obj : Zip_obj
{
static Uncompress create(int windowSize);
static Array<uint8_t> run(cpp::marshal::View<uint8_t> src, int bufferSize);
};
}
}
36 changes: 36 additions & 0 deletions include/hx/zip/Zip.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#pragma once

#ifndef HXCPP_H
#include <hxcpp.h>
#endif

HX_DECLARE_CLASS2(hx, zip, Zip)

namespace hx
{
namespace zip
{
enum Flush {
None,
Sync,
Full,
Finish,
Block
};

struct Result final {
const bool done;
const int read;
const int write;

Result(int inDone, int inRead, int inWrite);
};

struct Zip_obj : hx::Object
{
virtual Result execute(cpp::marshal::View<uint8_t> src, cpp::marshal::View<uint8_t> dst) = 0;
virtual void setFlushMode(Flush mode) = 0;
virtual void close() = 0;
};
}
}
4 changes: 0 additions & 4 deletions include/hxString.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,8 @@ class HXCPP_EXTERN_CLASS_ATTRIBUTES String
static String create(const char16_t *inPtr,int inLen=-1);
static String create(const char *inPtr,int inLen=-1);

#if (HXCPP_API_LEVEL>=500)
static String create(const ::cpp::marshal::View<char>& buffer);
static String create(const ::cpp::marshal::View<char16_t>& buffer);
#endif

// Uses non-gc memory and wont ever be collected
static ::String createPermanent(const char *inUtf8, int inLen);
Expand Down Expand Up @@ -173,10 +171,8 @@ class HXCPP_EXTERN_CLASS_ATTRIBUTES String
const wchar_t *wchar_str(hx::IStringAlloc *inBuffer = 0) const;
const char16_t *wc_str(hx::IStringAlloc *inBuffer = 0, int *outCharLength = 0) const;

#if (HXCPP_API_LEVEL >= 500)
bool wc_str(::cpp::marshal::View<char16_t> buffer, int* outCharLength = nullptr) const;
bool utf8_str(::cpp::marshal::View<char> buffer, int* outByteLength = nullptr) const;
#endif

const char *__CStr() const { return utf8_str(); };
const wchar_t *__WCStr() const { return wchar_str(0); }
Expand Down
16 changes: 7 additions & 9 deletions include/hxcpp.h
Original file line number Diff line number Diff line change
Expand Up @@ -351,15 +351,13 @@ typedef PropertyAccessMode PropertyAccess;
#endif
#include <hx/StdLibs.h>
#include <cpp/Pointer.h>
#if (HXCPP_API_LEVEL>=500)
#include <cpp/marshal/Boxed.hpp>
#include <cpp/marshal/ValueType.hpp>
#include <cpp/marshal/PointerType.hpp>
#include <cpp/marshal/ValueReference.hpp>
#include <cpp/marshal/PointerReference.hpp>
#include <cpp/marshal/View.hpp>
#include <cpp/marshal/Marshal.hpp>
#endif
#include <cpp/marshal/Boxed.hpp>
#include <cpp/marshal/ValueType.hpp>
#include <cpp/marshal/PointerType.hpp>
#include <cpp/marshal/ValueReference.hpp>
#include <cpp/marshal/PointerReference.hpp>
#include <cpp/marshal/View.hpp>
#include <cpp/marshal/Marshal.hpp>
#include <hx/Native.h>
#include <hx/Operators.h>
#include <hx/Functions.h>
Expand Down
6 changes: 0 additions & 6 deletions src/String.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,6 @@ String String::create(const char *inString,int inLength)
return String(s,len);
}

#if (HXCPP_API_LEVEL>=500)
String String::create(const::cpp::marshal::View<char>& buffer)
{
auto start = buffer.ptr.ptr;
Expand Down Expand Up @@ -824,7 +823,6 @@ String String::create(const cpp::marshal::View<char16_t>& buffer)

return String::create(buffer.ptr.ptr, buffer.length - (end - start) - extra);
}
#endif

String::String(const Dynamic &inRHS)
{
Expand Down Expand Up @@ -1794,8 +1792,6 @@ const char16_t * String::wc_str(hx::IStringAlloc *inBuffer, int *outCharLength)
return str;
}

#if (HXCPP_API_LEVEL >= 500)

bool String::wc_str(::cpp::marshal::View<char16_t> buffer, int* outCharLength) const
{
#ifdef HX_SMART_STRINGS
Expand Down Expand Up @@ -1918,8 +1914,6 @@ bool String::utf8_str(::cpp::marshal::View<char> buffer, int* outByteLength) con
return true;
}

#endif

const wchar_t * String::wchar_str(hx::IStringAlloc *inBuffer) const
{
if (!__s)
Expand Down
49 changes: 7 additions & 42 deletions src/hx/libs/zlib/Build.xml
Original file line number Diff line number Diff line change
@@ -1,42 +1,7 @@
<xml>

<pragma once="true" />

<set name="ZLIB_DIR" value="${HXCPP}/project/thirdparty/zlib-1.3.1"/>

<files id="hxcpp_zlib" dir="${this_dir}" >
<depend files="hxcpp-depends"/>
<depend name="${this_dir}/Build.xml" dateOnly="true" />
<cache value="true" asLibrary="1" />

<compilerflag value="-I${ZLIB_DIR}"/>
<compilerflag value="-DSTDC" unless="windows" />
<compilerflag value="-DHAVE_UNISTD_H" unless="windows" />

<file name="ZLib.cpp"/>

<!-- HXCPP_LINK_NO_ZLIB may be set too late, so use filterout as well. -->
<section unless="HXCPP_LINK_NO_ZLIB" >
<file name="${ZLIB_DIR}/adler32.c" filterout="HXCPP_LINK_NO_ZLIB" tags="" />
<file name="${ZLIB_DIR}/compress.c" filterout="HXCPP_LINK_NO_ZLIB" tags="" />
<file name="${ZLIB_DIR}/crc32.c" filterout="HXCPP_LINK_NO_ZLIB" tags="" />
<file name="${ZLIB_DIR}/deflate.c" filterout="HXCPP_LINK_NO_ZLIB" tags="" />
<file name="${ZLIB_DIR}/gzclose.c" filterout="HXCPP_LINK_NO_ZLIB" tags="" />
<file name="${ZLIB_DIR}/gzlib.c" filterout="HXCPP_LINK_NO_ZLIB" tags="" />
<file name="${ZLIB_DIR}/gzread.c" filterout="HXCPP_LINK_NO_ZLIB" tags="" />
<file name="${ZLIB_DIR}/gzwrite.c" filterout="HXCPP_LINK_NO_ZLIB" tags="" />
<file name="${ZLIB_DIR}/infback.c" filterout="HXCPP_LINK_NO_ZLIB" tags="" />
<file name="${ZLIB_DIR}/inffast.c" filterout="HXCPP_LINK_NO_ZLIB" tags="" />
<file name="${ZLIB_DIR}/inflate.c" filterout="HXCPP_LINK_NO_ZLIB" tags="" />
<file name="${ZLIB_DIR}/inftrees.c" filterout="HXCPP_LINK_NO_ZLIB" tags="" />
<file name="${ZLIB_DIR}/trees.c" filterout="HXCPP_LINK_NO_ZLIB" tags="" />
<file name="${ZLIB_DIR}/uncompr.c" filterout="HXCPP_LINK_NO_ZLIB" tags="" />
<file name="${ZLIB_DIR}/zutil.c" filterout="HXCPP_LINK_NO_ZLIB" tags="" />
</section>
</files>

<target id="haxe">
<files id="hxcpp_zlib" />
</target>

</xml>
<xml>

<pragma once="true" />

<import name="${this_dir}/../../zip/Build.xml"/>

</xml>
Loading