From 20479e998998bcdfda7485f38514588335b72279 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20Zim=C3=A1nyi?= Date: Wed, 2 Sep 2026 23:09:20 +0200 Subject: [PATCH 1/2] Hold every declaration to a symbol MEOS exports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A P/Invoke binds by name at the first call, so a function MEOS renames or drops is invisible to the compiler and reaches a caller as an `EntryPointNotFoundException` in production. A test resolves every entry point the binding declares against the loaded library, which turns that into one named failure with the symbols listed. It reads the declarations by reflection over the `LibraryImport` attributes rather than from a list beside them, so a declaration cannot escape it, and it refuses a run that reads fewer than a thousand of them, since a parity check with nothing in its hand accepts anything. A second test holds the check itself to a control: `meos_initialize` resolves and `meos_no_such_function` does not. Under that check the binding declares MEOS's own surface. The catalog marks the declarations that reach it from a project MEOS vendors — pgPointCloud's `pc_api.h` and `hashtable.h`, PostgreSQL's `pg_numeric.h` — and those are that project's API rather than MEOS's: 150 declarations, every one of them internal, and `indexFor`, `pc_patch_sort` and `pc_patch_is_sorted` among them are the only three in the whole catalog that the built library never exports, the first because a `static inline` in a header defines no external symbol at all. The remaining 4675 functions across 26 headers each resolve. --- MEOS.NET.Tests/NativeSymbolTests.cs | 64 ++++ MEOS.NET/Functions/Meos.Native.g.cs | 456 ------------------------ MEOS.NET/Functions/Meos.hashtable.g.cs | 46 --- MEOS.NET/Functions/Meos.pc_api.g.cs | 274 -------------- MEOS.NET/Functions/Meos.pg_numeric.g.cs | 169 --------- tools/codegen.py | 11 +- 6 files changed, 73 insertions(+), 947 deletions(-) create mode 100644 MEOS.NET.Tests/NativeSymbolTests.cs delete mode 100644 MEOS.NET/Functions/Meos.hashtable.g.cs delete mode 100644 MEOS.NET/Functions/Meos.pc_api.g.cs delete mode 100644 MEOS.NET/Functions/Meos.pg_numeric.g.cs diff --git a/MEOS.NET.Tests/NativeSymbolTests.cs b/MEOS.NET.Tests/NativeSymbolTests.cs new file mode 100644 index 0000000..5c73dd3 --- /dev/null +++ b/MEOS.NET.Tests/NativeSymbolTests.cs @@ -0,0 +1,64 @@ +using System.Reflection; +using System.Runtime.InteropServices; + +using MEOS.NET.Functions; + +namespace MEOS.NET.Tests +{ + /// + /// Every function this binding declares must be a symbol the MEOS it loads + /// exports. + /// + /// A P/Invoke binds by name at the first call, so a function MEOS renames or + /// drops is invisible to the compiler and reaches a caller as an + /// at run time. Resolving every + /// declared entry point against the loaded library turns that into one named + /// failure here. + /// + [TestClass] + public class NativeSymbolTests : MeosTest + { + [TestMethod] + public void EveryDeclaredEntryPointResolvesInTheLoadedMeos() + { + string[] entryPoints = DeclaredEntryPoints(); + + // A parity check that read no declaration would pass over anything. + Assert.IsTrue(entryPoints.Length > 1000, + $"only {entryPoints.Length} entry points were read from the binding"); + + IntPtr meos = NativeLibrary.Load("meos", typeof(Meos).Assembly, null); + List missing = entryPoints + .Where(name => !NativeLibrary.TryGetExport(meos, name, out _)) + .ToList(); + + Assert.AreEqual(0, missing.Count, + $"MEOS exports none of: {string.Join(", ", missing.Take(20))}"); + } + + [TestMethod] + public void ASymbolMeosDoesNotExportIsSeenAsMissing() + { + IntPtr meos = NativeLibrary.Load("meos", typeof(Meos).Assembly, null); + + Assert.IsFalse(NativeLibrary.TryGetExport(meos, "meos_no_such_function", out _)); + Assert.IsTrue(NativeLibrary.TryGetExport(meos, "meos_initialize", out _)); + } + + /// The entry point of every native declaration the binding carries. + private static string[] DeclaredEntryPoints() + { + Type native = typeof(Meos).GetNestedType("Native", BindingFlags.NonPublic) + ?? throw new InvalidOperationException("the binding declares no Native class"); + + return native + .GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic + | BindingFlags.DeclaredOnly) + .Select(method => method.GetCustomAttribute()) + .Where(attribute => attribute is not null) + .Select(attribute => attribute!.EntryPoint!) + .Distinct() + .ToArray(); + } + } +} diff --git a/MEOS.NET/Functions/Meos.Native.g.cs b/MEOS.NET/Functions/Meos.Native.g.cs index a5393d6..96a15d9 100644 --- a/MEOS.NET/Functions/Meos.Native.g.cs +++ b/MEOS.NET/Functions/Meos.Native.g.cs @@ -9340,168 +9340,6 @@ private static partial class Native [LibraryImport(DllPath, EntryPoint = "tpointseqset_twcentroid", StringMarshalling = StringMarshalling.Utf8)] internal static partial IntPtr TpointseqsetTwcentroid(IntPtr ss); - [LibraryImport(DllPath, EntryPoint = "float4_to_numeric", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr Float4ToNumeric(float num); - - [LibraryImport(DllPath, EntryPoint = "float8_to_numeric", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr Float8ToNumeric(double num); - - [LibraryImport(DllPath, EntryPoint = "int16_to_numeric", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr Int16ToNumeric(short num); - - [LibraryImport(DllPath, EntryPoint = "int32_to_numeric", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr Int32ToNumeric(int num); - - [LibraryImport(DllPath, EntryPoint = "int64_to_numeric", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr Int64ToNumeric(long num); - - [LibraryImport(DllPath, EntryPoint = "numeric", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr Numeric(IntPtr num, int typmod); - - [LibraryImport(DllPath, EntryPoint = "numeric_abs", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr NumericAbs(IntPtr num); - - [LibraryImport(DllPath, EntryPoint = "numeric_add", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr NumericAdd(IntPtr num1, IntPtr num2); - - [LibraryImport(DllPath, EntryPoint = "numeric_ceil", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr NumericCeil(IntPtr num); - - [LibraryImport(DllPath, EntryPoint = "numeric_cmp", StringMarshalling = StringMarshalling.Utf8)] - internal static partial int NumericCmp(IntPtr num1, IntPtr num2); - - [LibraryImport(DllPath, EntryPoint = "numeric_copy", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr NumericCopy(IntPtr num); - - [LibraryImport(DllPath, EntryPoint = "numeric_div", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr NumericDiv(IntPtr num1, IntPtr num2); - - [LibraryImport(DllPath, EntryPoint = "numeric_div_trunc", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr NumericDivTrunc(IntPtr num1, IntPtr num2); - - [LibraryImport(DllPath, EntryPoint = "numeric_eq", StringMarshalling = StringMarshalling.Utf8)] - [return: MarshalAs(UnmanagedType.U1)] - internal static partial bool NumericEq(IntPtr num1, IntPtr num2); - - [LibraryImport(DllPath, EntryPoint = "numeric_exp", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr NumericExp(IntPtr num); - - [LibraryImport(DllPath, EntryPoint = "numeric_fac", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr NumericFac(long num); - - [LibraryImport(DllPath, EntryPoint = "numeric_floor", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr NumericFloor(IntPtr num); - - [LibraryImport(DllPath, EntryPoint = "numeric_gcd", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr NumericGcd(IntPtr num1, IntPtr num2); - - [LibraryImport(DllPath, EntryPoint = "numeric_ge", StringMarshalling = StringMarshalling.Utf8)] - [return: MarshalAs(UnmanagedType.U1)] - internal static partial bool NumericGe(IntPtr num1, IntPtr num2); - - [LibraryImport(DllPath, EntryPoint = "numeric_gt", StringMarshalling = StringMarshalling.Utf8)] - [return: MarshalAs(UnmanagedType.U1)] - internal static partial bool NumericGt(IntPtr num1, IntPtr num2); - - [LibraryImport(DllPath, EntryPoint = "numeric_hash", StringMarshalling = StringMarshalling.Utf8)] - internal static partial uint NumericHash(IntPtr key); - - [LibraryImport(DllPath, EntryPoint = "numeric_hash_extended", StringMarshalling = StringMarshalling.Utf8)] - internal static partial ulong NumericHashExtended(IntPtr num, ulong seed); - - [LibraryImport(DllPath, EntryPoint = "numeric_in", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr NumericIn(string str, int typmod); - - [LibraryImport(DllPath, EntryPoint = "numeric_inc", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr NumericInc(IntPtr num); - - [LibraryImport(DllPath, EntryPoint = "numeric_larger", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr NumericLarger(IntPtr num1, IntPtr num2); - - [LibraryImport(DllPath, EntryPoint = "numeric_lcm", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr NumericLcm(IntPtr num1, IntPtr num2); - - [LibraryImport(DllPath, EntryPoint = "numeric_le", StringMarshalling = StringMarshalling.Utf8)] - [return: MarshalAs(UnmanagedType.U1)] - internal static partial bool NumericLe(IntPtr num1, IntPtr num2); - - [LibraryImport(DllPath, EntryPoint = "numeric_ln", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr NumericLn(IntPtr num); - - [LibraryImport(DllPath, EntryPoint = "numeric_log", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr NumericLog(IntPtr num1, IntPtr num2); - - [LibraryImport(DllPath, EntryPoint = "numeric_lt", StringMarshalling = StringMarshalling.Utf8)] - [return: MarshalAs(UnmanagedType.U1)] - internal static partial bool NumericLt(IntPtr num1, IntPtr num2); - - [LibraryImport(DllPath, EntryPoint = "numeric_min_scale", StringMarshalling = StringMarshalling.Utf8)] - internal static partial uint NumericMinScale(IntPtr num); - - [LibraryImport(DllPath, EntryPoint = "numeric_minus", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr NumericMinus(IntPtr num1, IntPtr num2); - - [LibraryImport(DllPath, EntryPoint = "numeric_mod", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr NumericMod(IntPtr num1, IntPtr num2); - - [LibraryImport(DllPath, EntryPoint = "numeric_mul", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr NumericMul(IntPtr num1, IntPtr num2); - - [LibraryImport(DllPath, EntryPoint = "numeric_ne", StringMarshalling = StringMarshalling.Utf8)] - [return: MarshalAs(UnmanagedType.U1)] - internal static partial bool NumericNe(IntPtr num1, IntPtr num2); - - [LibraryImport(DllPath, EntryPoint = "numeric_out", StringMarshalling = StringMarshalling.Utf8)] - internal static partial string NumericOut(IntPtr num); - - [LibraryImport(DllPath, EntryPoint = "numeric_pow", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr NumericPow(IntPtr num1, IntPtr num2); - - [LibraryImport(DllPath, EntryPoint = "numeric_round", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr NumericRound(IntPtr num, int scale); - - [LibraryImport(DllPath, EntryPoint = "numeric_scale", StringMarshalling = StringMarshalling.Utf8)] - internal static partial int NumericScale(IntPtr num); - - [LibraryImport(DllPath, EntryPoint = "numeric_sign", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr NumericSign(IntPtr num); - - [LibraryImport(DllPath, EntryPoint = "numeric_smaller", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr NumericSmaller(IntPtr num1, IntPtr num2); - - [LibraryImport(DllPath, EntryPoint = "numeric_sqrt", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr NumericSqrt(IntPtr num); - - [LibraryImport(DllPath, EntryPoint = "numeric_to_float4", StringMarshalling = StringMarshalling.Utf8)] - internal static partial float NumericToFloat4(IntPtr num); - - [LibraryImport(DllPath, EntryPoint = "numeric_to_float8", StringMarshalling = StringMarshalling.Utf8)] - internal static partial double NumericToFloat8(IntPtr num); - - [LibraryImport(DllPath, EntryPoint = "numeric_to_int16", StringMarshalling = StringMarshalling.Utf8)] - internal static partial short NumericToInt16(IntPtr num); - - [LibraryImport(DllPath, EntryPoint = "numeric_to_int32", StringMarshalling = StringMarshalling.Utf8)] - internal static partial int NumericToInt32(IntPtr num); - - [LibraryImport(DllPath, EntryPoint = "numeric_to_int64", StringMarshalling = StringMarshalling.Utf8)] - internal static partial long NumericToInt64(IntPtr num); - - [LibraryImport(DllPath, EntryPoint = "numeric_trim_scale", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr NumericTrimScale(IntPtr num); - - [LibraryImport(DllPath, EntryPoint = "numeric_trunc", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr NumericTrunc(IntPtr num, int scale); - - [LibraryImport(DllPath, EntryPoint = "numeric_uminus", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr NumericUminus(IntPtr num); - - [LibraryImport(DllPath, EntryPoint = "numeric_uplus", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr NumericUplus(IntPtr num); - - [LibraryImport(DllPath, EntryPoint = "numeric_width_bucket", StringMarshalling = StringMarshalling.Utf8)] - internal static partial int NumericWidthBucket(IntPtr operand, IntPtr bound1, IntPtr bound2, int count); - [LibraryImport(DllPath, EntryPoint = "json_in", StringMarshalling = StringMarshalling.Utf8)] internal static partial IntPtr JsonIn(string str); @@ -15305,300 +15143,6 @@ private static partial class Native [LibraryImport(DllPath, EntryPoint = "pg_jsonb_path_query_all", StringMarshalling = StringMarshalling.Utf8)] internal static partial IntPtr PgJsonbPathQueryAll(IntPtr jb, IntPtr jp, IntPtr vars, [MarshalAs(UnmanagedType.U1)] bool silent, [MarshalAs(UnmanagedType.U1)] bool tz, IntPtr count); - [LibraryImport(DllPath, EntryPoint = "hash", StringMarshalling = StringMarshalling.Utf8)] - internal static partial uint Hash(IntPtr h, IntPtr k); - - [LibraryImport(DllPath, EntryPoint = "create_hashtable", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr CreateHashtable(uint minsize, IntPtr hashfunction, IntPtr key_eq_fn); - - [LibraryImport(DllPath, EntryPoint = "create_string_hashtable", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr CreateStringHashtable(); - - [LibraryImport(DllPath, EntryPoint = "hashtable_insert", StringMarshalling = StringMarshalling.Utf8)] - internal static partial int HashtableInsert(IntPtr h, IntPtr k, IntPtr v); - - [LibraryImport(DllPath, EntryPoint = "hashtable_search", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr HashtableSearch(IntPtr h, IntPtr k); - - [LibraryImport(DllPath, EntryPoint = "hashtable_remove", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr HashtableRemove(IntPtr h, IntPtr k); - - [LibraryImport(DllPath, EntryPoint = "hash_str", StringMarshalling = StringMarshalling.Utf8)] - internal static partial uint HashStr(IntPtr str); - - [LibraryImport(DllPath, EntryPoint = "str_eq", StringMarshalling = StringMarshalling.Utf8)] - internal static partial int StrEq(IntPtr str1, IntPtr str2); - - [LibraryImport(DllPath, EntryPoint = "hashtable_count", StringMarshalling = StringMarshalling.Utf8)] - internal static partial uint HashtableCount(IntPtr h); - - [LibraryImport(DllPath, EntryPoint = "hashtable_destroy", StringMarshalling = StringMarshalling.Utf8)] - internal static partial void HashtableDestroy(IntPtr h, int free_values); - - [LibraryImport(DllPath, EntryPoint = "indexFor", StringMarshalling = StringMarshalling.Utf8)] - internal static partial uint IndexFor(uint tablelength, uint hashvalue); - - [LibraryImport(DllPath, EntryPoint = "pcalloc", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr Pcalloc(ulong size); - - [LibraryImport(DllPath, EntryPoint = "pcrealloc", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr Pcrealloc(IntPtr mem, ulong size); - - [LibraryImport(DllPath, EntryPoint = "pcfree", StringMarshalling = StringMarshalling.Utf8)] - internal static partial void Pcfree(IntPtr mem); - - [LibraryImport(DllPath, EntryPoint = "pcerror", StringMarshalling = StringMarshalling.Utf8)] - internal static partial void Pcerror(string fmt); - - [LibraryImport(DllPath, EntryPoint = "pcinfo", StringMarshalling = StringMarshalling.Utf8)] - internal static partial void Pcinfo(string fmt); - - [LibraryImport(DllPath, EntryPoint = "pcwarn", StringMarshalling = StringMarshalling.Utf8)] - internal static partial void Pcwarn(string fmt); - - [LibraryImport(DllPath, EntryPoint = "pc_set_handlers", StringMarshalling = StringMarshalling.Utf8)] - internal static partial void PcSetHandlers(IntPtr allocator, IntPtr reallocator, IntPtr deallocator, IntPtr error_handler, IntPtr info_handler, IntPtr warning_handler); - - [LibraryImport(DllPath, EntryPoint = "pc_install_default_handlers", StringMarshalling = StringMarshalling.Utf8)] - internal static partial void PcInstallDefaultHandlers(); - - [LibraryImport(DllPath, EntryPoint = "pc_bytes_from_hexbytes", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr PcBytesFromHexbytes(string hexbuf, ulong hexsize); - - [LibraryImport(DllPath, EntryPoint = "pc_hexbytes_from_bytes", StringMarshalling = StringMarshalling.Utf8)] - internal static partial string PcHexbytesFromBytes(IntPtr bytebuf, ulong bytesize); - - [LibraryImport(DllPath, EntryPoint = "pc_wkb_get_pcid", StringMarshalling = StringMarshalling.Utf8)] - internal static partial uint PcWkbGetPcid(IntPtr wkb); - - [LibraryImport(DllPath, EntryPoint = "pc_dimstats_make", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr PcDimstatsMake(IntPtr schema); - - [LibraryImport(DllPath, EntryPoint = "pc_compression_name", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr PcCompressionName(int num); - - [LibraryImport(DllPath, EntryPoint = "pc_schema_free", StringMarshalling = StringMarshalling.Utf8)] - internal static partial void PcSchemaFree(IntPtr pcs); - - [LibraryImport(DllPath, EntryPoint = "pc_schema_new", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr PcSchemaNew(uint ndims); - - [LibraryImport(DllPath, EntryPoint = "pc_interpretation_number", StringMarshalling = StringMarshalling.Utf8)] - internal static partial int PcInterpretationNumber(string str); - - [LibraryImport(DllPath, EntryPoint = "pc_compression_number", StringMarshalling = StringMarshalling.Utf8)] - internal static partial int PcCompressionNumber(string str); - - [LibraryImport(DllPath, EntryPoint = "pc_schema_from_xml", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr PcSchemaFromXml(string xmlstr); - - [LibraryImport(DllPath, EntryPoint = "pc_schema_to_json", StringMarshalling = StringMarshalling.Utf8)] - internal static partial string PcSchemaToJson(IntPtr pcs); - - [LibraryImport(DllPath, EntryPoint = "pc_schema_get_dimension", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr PcSchemaGetDimension(IntPtr s, uint dim); - - [LibraryImport(DllPath, EntryPoint = "pc_schema_get_dimension_by_name", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr PcSchemaGetDimensionByName(IntPtr s, string name); - - [LibraryImport(DllPath, EntryPoint = "pc_schema_is_valid", StringMarshalling = StringMarshalling.Utf8)] - internal static partial uint PcSchemaIsValid(IntPtr s); - - [LibraryImport(DllPath, EntryPoint = "pc_schema_clone", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr PcSchemaClone(IntPtr s); - - [LibraryImport(DllPath, EntryPoint = "pc_schema_set_dimension", StringMarshalling = StringMarshalling.Utf8)] - internal static partial void PcSchemaSetDimension(IntPtr s, IntPtr d); - - [LibraryImport(DllPath, EntryPoint = "pc_schema_check_xyzm", StringMarshalling = StringMarshalling.Utf8)] - internal static partial void PcSchemaCheckXyzm(IntPtr s); - - [LibraryImport(DllPath, EntryPoint = "pc_schema_get_size", StringMarshalling = StringMarshalling.Utf8)] - internal static partial ulong PcSchemaGetSize(IntPtr s); - - [LibraryImport(DllPath, EntryPoint = "pc_schema_same_dimensions", StringMarshalling = StringMarshalling.Utf8)] - internal static partial uint PcSchemaSameDimensions(IntPtr s1, IntPtr s2); - - [LibraryImport(DllPath, EntryPoint = "pc_schema_same_interpretations", StringMarshalling = StringMarshalling.Utf8)] - internal static partial uint PcSchemaSameInterpretations(IntPtr s1, IntPtr s2); - - [LibraryImport(DllPath, EntryPoint = "pc_pointlist_make", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr PcPointlistMake(uint npoints); - - [LibraryImport(DllPath, EntryPoint = "pc_pointlist_free", StringMarshalling = StringMarshalling.Utf8)] - internal static partial void PcPointlistFree(IntPtr pl); - - [LibraryImport(DllPath, EntryPoint = "pc_pointlist_add_point", StringMarshalling = StringMarshalling.Utf8)] - internal static partial void PcPointlistAddPoint(IntPtr pl, IntPtr pt); - - [LibraryImport(DllPath, EntryPoint = "pc_pointlist_get_point", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr PcPointlistGetPoint(IntPtr pl, int i); - - [LibraryImport(DllPath, EntryPoint = "pc_point_make", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr PcPointMake(IntPtr s); - - [LibraryImport(DllPath, EntryPoint = "pc_point_from_data", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr PcPointFromData(IntPtr s, IntPtr data); - - [LibraryImport(DllPath, EntryPoint = "pc_point_from_double_array", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr PcPointFromDoubleArray(IntPtr s, IntPtr array, uint offset, uint stride); - - [LibraryImport(DllPath, EntryPoint = "pc_point_to_double_array", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr PcPointToDoubleArray(IntPtr pt); - - [LibraryImport(DllPath, EntryPoint = "pc_point_free", StringMarshalling = StringMarshalling.Utf8)] - internal static partial void PcPointFree(IntPtr pt); - - [LibraryImport(DllPath, EntryPoint = "pc_point_get_double_by_name", StringMarshalling = StringMarshalling.Utf8)] - internal static partial int PcPointGetDoubleByName(IntPtr pt, string name, IntPtr val); - - [LibraryImport(DllPath, EntryPoint = "pc_point_get_double_by_index", StringMarshalling = StringMarshalling.Utf8)] - internal static partial int PcPointGetDoubleByIndex(IntPtr pt, uint idx, IntPtr val); - - [LibraryImport(DllPath, EntryPoint = "pc_point_get_double", StringMarshalling = StringMarshalling.Utf8)] - internal static partial int PcPointGetDouble(IntPtr pt, IntPtr dim, IntPtr val); - - [LibraryImport(DllPath, EntryPoint = "pc_point_set_double_by_name", StringMarshalling = StringMarshalling.Utf8)] - internal static partial int PcPointSetDoubleByName(IntPtr pt, string name, double val); - - [LibraryImport(DllPath, EntryPoint = "pc_point_set_double_by_index", StringMarshalling = StringMarshalling.Utf8)] - internal static partial int PcPointSetDoubleByIndex(IntPtr pt, uint idx, double val); - - [LibraryImport(DllPath, EntryPoint = "pc_point_set_double", StringMarshalling = StringMarshalling.Utf8)] - internal static partial int PcPointSetDouble(IntPtr pt, IntPtr dim, double val); - - [LibraryImport(DllPath, EntryPoint = "pc_point_get_x", StringMarshalling = StringMarshalling.Utf8)] - internal static partial int PcPointGetX(IntPtr pt, IntPtr val); - - [LibraryImport(DllPath, EntryPoint = "pc_point_get_y", StringMarshalling = StringMarshalling.Utf8)] - internal static partial int PcPointGetY(IntPtr pt, IntPtr val); - - [LibraryImport(DllPath, EntryPoint = "pc_point_get_z", StringMarshalling = StringMarshalling.Utf8)] - internal static partial int PcPointGetZ(IntPtr pt, IntPtr val); - - [LibraryImport(DllPath, EntryPoint = "pc_point_get_m", StringMarshalling = StringMarshalling.Utf8)] - internal static partial int PcPointGetM(IntPtr pt, IntPtr val); - - [LibraryImport(DllPath, EntryPoint = "pc_point_set_x", StringMarshalling = StringMarshalling.Utf8)] - internal static partial int PcPointSetX(IntPtr pt, double val); - - [LibraryImport(DllPath, EntryPoint = "pc_point_set_y", StringMarshalling = StringMarshalling.Utf8)] - internal static partial int PcPointSetY(IntPtr pt, double val); - - [LibraryImport(DllPath, EntryPoint = "pc_point_set_z", StringMarshalling = StringMarshalling.Utf8)] - internal static partial int PcPointSetZ(IntPtr pt, double val); - - [LibraryImport(DllPath, EntryPoint = "pc_point_set_m", StringMarshalling = StringMarshalling.Utf8)] - internal static partial int PcPointSetM(IntPtr pt, double val); - - [LibraryImport(DllPath, EntryPoint = "pc_point_from_wkb", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr PcPointFromWkb(IntPtr s, IntPtr wkb, ulong wkbsize); - - [LibraryImport(DllPath, EntryPoint = "pc_point_to_wkb", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr PcPointToWkb(IntPtr pt, IntPtr wkbsize); - - [LibraryImport(DllPath, EntryPoint = "pc_point_to_string", StringMarshalling = StringMarshalling.Utf8)] - internal static partial string PcPointToString(IntPtr pt); - - [LibraryImport(DllPath, EntryPoint = "pc_point_to_geometry_wkb", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr PcPointToGeometryWkb(IntPtr pt, IntPtr wkbsize); - - [LibraryImport(DllPath, EntryPoint = "pc_patch_from_pointlist", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr PcPatchFromPointlist(IntPtr ptl); - - [LibraryImport(DllPath, EntryPoint = "pc_pointlist_from_patch", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr PcPointlistFromPatch(IntPtr patch); - - [LibraryImport(DllPath, EntryPoint = "pc_patch_from_patchlist", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr PcPatchFromPatchlist(IntPtr palist, int numpatches); - - [LibraryImport(DllPath, EntryPoint = "pc_patch_free", StringMarshalling = StringMarshalling.Utf8)] - internal static partial void PcPatchFree(IntPtr patch); - - [LibraryImport(DllPath, EntryPoint = "pc_patch_compress", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr PcPatchCompress(IntPtr patch, IntPtr userdata); - - [LibraryImport(DllPath, EntryPoint = "pc_patch_uncompress", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr PcPatchUncompress(IntPtr patch); - - [LibraryImport(DllPath, EntryPoint = "pc_patch_from_wkb", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr PcPatchFromWkb(IntPtr s, IntPtr wkb, ulong wkbsize); - - [LibraryImport(DllPath, EntryPoint = "pc_patch_to_wkb", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr PcPatchToWkb(IntPtr patch, IntPtr wkbsize); - - [LibraryImport(DllPath, EntryPoint = "pc_patch_to_string", StringMarshalling = StringMarshalling.Utf8)] - internal static partial string PcPatchToString(IntPtr patch); - - [LibraryImport(DllPath, EntryPoint = "pc_patch_dimensional_serialized_size", StringMarshalling = StringMarshalling.Utf8)] - internal static partial ulong PcPatchDimensionalSerializedSize(IntPtr patch); - - [LibraryImport(DllPath, EntryPoint = "pc_bytes_serialized_size", StringMarshalling = StringMarshalling.Utf8)] - internal static partial ulong PcBytesSerializedSize(IntPtr pcb); - - [LibraryImport(DllPath, EntryPoint = "pc_bytes_serialize", StringMarshalling = StringMarshalling.Utf8)] - internal static partial int PcBytesSerialize(IntPtr pcb, IntPtr buf, IntPtr size); - - [LibraryImport(DllPath, EntryPoint = "pc_bytes_deserialize", StringMarshalling = StringMarshalling.Utf8)] - internal static partial int PcBytesDeserialize(IntPtr buf, IntPtr dim, IntPtr pcb, int @readonly, int flip_endian); - - [LibraryImport(DllPath, EntryPoint = "pc_stats_new_from_data", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr PcStatsNewFromData(IntPtr schema, IntPtr mindata, IntPtr maxdata, IntPtr avgdata); - - [LibraryImport(DllPath, EntryPoint = "pc_stats_new", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr PcStatsNew(IntPtr schema); - - [LibraryImport(DllPath, EntryPoint = "pc_stats_free", StringMarshalling = StringMarshalling.Utf8)] - internal static partial void PcStatsFree(IntPtr stats); - - [LibraryImport(DllPath, EntryPoint = "pc_stats_size", StringMarshalling = StringMarshalling.Utf8)] - internal static partial ulong PcStatsSize(IntPtr schema); - - [LibraryImport(DllPath, EntryPoint = "pc_patch_compute_stats", StringMarshalling = StringMarshalling.Utf8)] - internal static partial int PcPatchComputeStats(IntPtr patch); - - [LibraryImport(DllPath, EntryPoint = "pc_patch_compute_extent", StringMarshalling = StringMarshalling.Utf8)] - internal static partial int PcPatchComputeExtent(IntPtr patch); - - [LibraryImport(DllPath, EntryPoint = "pc_bounds_intersects", StringMarshalling = StringMarshalling.Utf8)] - internal static partial int PcBoundsIntersects(IntPtr b1, IntPtr b2); - - [LibraryImport(DllPath, EntryPoint = "pc_bounding_diagonal_wkb_from_bounds", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr PcBoundingDiagonalWkbFromBounds(IntPtr bounds, IntPtr schema, IntPtr wkbsize); - - [LibraryImport(DllPath, EntryPoint = "pc_bounding_diagonal_wkb_from_stats", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr PcBoundingDiagonalWkbFromStats(IntPtr stats, IntPtr wkbsize); - - [LibraryImport(DllPath, EntryPoint = "pc_patch_filter_lt_by_name", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr PcPatchFilterLtByName(IntPtr pa, string name, double val); - - [LibraryImport(DllPath, EntryPoint = "pc_patch_filter_gt_by_name", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr PcPatchFilterGtByName(IntPtr pa, string name, double val); - - [LibraryImport(DllPath, EntryPoint = "pc_patch_filter_equal_by_name", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr PcPatchFilterEqualByName(IntPtr pa, string name, double val); - - [LibraryImport(DllPath, EntryPoint = "pc_patch_filter_between_by_name", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr PcPatchFilterBetweenByName(IntPtr pa, string name, double val1, double val2); - - [LibraryImport(DllPath, EntryPoint = "pc_patch_pointn", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr PcPatchPointn(IntPtr patch, int n); - - [LibraryImport(DllPath, EntryPoint = "pc_patch_sort", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr PcPatchSort(IntPtr pa, IntPtr name, int ndims); - - [LibraryImport(DllPath, EntryPoint = "pc_patch_is_sorted", StringMarshalling = StringMarshalling.Utf8)] - internal static partial uint PcPatchIsSorted(IntPtr pa, IntPtr name, int ndims, byte strict); - - [LibraryImport(DllPath, EntryPoint = "pc_patch_range", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr PcPatchRange(IntPtr pa, int first, int count); - - [LibraryImport(DllPath, EntryPoint = "pc_patch_set_schema", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr PcPatchSetSchema(IntPtr patch, IntPtr schema, double def); - - [LibraryImport(DllPath, EntryPoint = "pc_patch_transform", StringMarshalling = StringMarshalling.Utf8)] - internal static partial IntPtr PcPatchTransform(IntPtr patch, IntPtr schema, double def); - [LibraryImport(DllPath, EntryPoint = "meos_pc_point_serialize", StringMarshalling = StringMarshalling.Utf8)] internal static partial IntPtr MeosPcPointSerialize(IntPtr pcpt); diff --git a/MEOS.NET/Functions/Meos.hashtable.g.cs b/MEOS.NET/Functions/Meos.hashtable.g.cs deleted file mode 100644 index 0edb4ac..0000000 --- a/MEOS.NET/Functions/Meos.hashtable.g.cs +++ /dev/null @@ -1,46 +0,0 @@ -#nullable enable - -using System.Runtime.InteropServices; - -using MEOS.NET.Structures; - -namespace MEOS.NET.Functions -{ - /// The MEOS functions hashtable.h declares. - public static partial class Meos - { - public static uint Hash(IntPtr h, IntPtr k) - => SafeExecution(() => Native.Hash(h, k)); - - public static IntPtr CreateHashtable(uint minsize, IntPtr hashfunction, IntPtr key_eq_fn) - => SafeExecution(() => Native.CreateHashtable(minsize, hashfunction, key_eq_fn)); - - public static IntPtr CreateStringHashtable() - => SafeExecution(() => Native.CreateStringHashtable()); - - public static int HashtableInsert(IntPtr h, IntPtr k, IntPtr v) - => SafeExecution(() => Native.HashtableInsert(h, k, v)); - - public static IntPtr HashtableSearch(IntPtr h, IntPtr k) - => SafeExecution(() => Native.HashtableSearch(h, k)); - - public static IntPtr HashtableRemove(IntPtr h, IntPtr k) - => SafeExecution(() => Native.HashtableRemove(h, k)); - - public static uint HashStr(IntPtr str) - => SafeExecution(() => Native.HashStr(str)); - - public static int StrEq(IntPtr str1, IntPtr str2) - => SafeExecution(() => Native.StrEq(str1, str2)); - - public static uint HashtableCount(IntPtr h) - => SafeExecution(() => Native.HashtableCount(h)); - - public static void HashtableDestroy(IntPtr h, int free_values) - => SafeExecution(() => Native.HashtableDestroy(h, free_values)); - - public static uint IndexFor(uint tablelength, uint hashvalue) - => SafeExecution(() => Native.IndexFor(tablelength, hashvalue)); - - } -} diff --git a/MEOS.NET/Functions/Meos.pc_api.g.cs b/MEOS.NET/Functions/Meos.pc_api.g.cs deleted file mode 100644 index ba74bcf..0000000 --- a/MEOS.NET/Functions/Meos.pc_api.g.cs +++ /dev/null @@ -1,274 +0,0 @@ -#nullable enable - -using System.Runtime.InteropServices; - -using MEOS.NET.Structures; - -namespace MEOS.NET.Functions -{ - /// The MEOS functions pc_api.h declares. - public static partial class Meos - { - public static IntPtr Pcalloc(ulong size) - => SafeExecution(() => Native.Pcalloc(size)); - - public static IntPtr Pcrealloc(IntPtr mem, ulong size) - => SafeExecution(() => Native.Pcrealloc(mem, size)); - - public static void Pcfree(IntPtr mem) - => SafeExecution(() => Native.Pcfree(mem)); - - public static void Pcerror(string fmt) - => SafeExecution(() => Native.Pcerror(fmt)); - - public static void Pcinfo(string fmt) - => SafeExecution(() => Native.Pcinfo(fmt)); - - public static void Pcwarn(string fmt) - => SafeExecution(() => Native.Pcwarn(fmt)); - - public static void PcSetHandlers(IntPtr allocator, IntPtr reallocator, IntPtr deallocator, IntPtr error_handler, IntPtr info_handler, IntPtr warning_handler) - => SafeExecution(() => Native.PcSetHandlers(allocator, reallocator, deallocator, error_handler, info_handler, warning_handler)); - - public static void PcInstallDefaultHandlers() - => SafeExecution(() => Native.PcInstallDefaultHandlers()); - - public static IntPtr PcBytesFromHexbytes(string hexbuf, ulong hexsize) - => SafeExecution(() => Native.PcBytesFromHexbytes(hexbuf, hexsize)); - - public static string PcHexbytesFromBytes(IntPtr bytebuf, ulong bytesize) - => SafeExecution(() => Native.PcHexbytesFromBytes(bytebuf, bytesize)); - - public static uint PcWkbGetPcid(IntPtr wkb) - => SafeExecution(() => Native.PcWkbGetPcid(wkb)); - - public static IntPtr PcDimstatsMake(IntPtr schema) - => SafeExecution(() => Native.PcDimstatsMake(schema)); - - public static string? PcCompressionName(int num) - => Marshal.PtrToStringUTF8(SafeExecution(() => Native.PcCompressionName(num))); - - public static void PcSchemaFree(IntPtr pcs) - => SafeExecution(() => Native.PcSchemaFree(pcs)); - - public static IntPtr PcSchemaNew(uint ndims) - => SafeExecution(() => Native.PcSchemaNew(ndims)); - - public static int PcInterpretationNumber(string str) - => SafeExecution(() => Native.PcInterpretationNumber(str)); - - public static int PcCompressionNumber(string str) - => SafeExecution(() => Native.PcCompressionNumber(str)); - - public static IntPtr PcSchemaFromXml(string xmlstr) - => SafeExecution(() => Native.PcSchemaFromXml(xmlstr)); - - public static string PcSchemaToJson(IntPtr pcs) - => SafeExecution(() => Native.PcSchemaToJson(pcs)); - - public static IntPtr PcSchemaGetDimension(IntPtr s, uint dim) - => SafeExecution(() => Native.PcSchemaGetDimension(s, dim)); - - public static IntPtr PcSchemaGetDimensionByName(IntPtr s, string name) - => SafeExecution(() => Native.PcSchemaGetDimensionByName(s, name)); - - public static uint PcSchemaIsValid(IntPtr s) - => SafeExecution(() => Native.PcSchemaIsValid(s)); - - public static IntPtr PcSchemaClone(IntPtr s) - => SafeExecution(() => Native.PcSchemaClone(s)); - - public static void PcSchemaSetDimension(IntPtr s, IntPtr d) - => SafeExecution(() => Native.PcSchemaSetDimension(s, d)); - - public static void PcSchemaCheckXyzm(IntPtr s) - => SafeExecution(() => Native.PcSchemaCheckXyzm(s)); - - public static ulong PcSchemaGetSize(IntPtr s) - => SafeExecution(() => Native.PcSchemaGetSize(s)); - - public static uint PcSchemaSameDimensions(IntPtr s1, IntPtr s2) - => SafeExecution(() => Native.PcSchemaSameDimensions(s1, s2)); - - public static uint PcSchemaSameInterpretations(IntPtr s1, IntPtr s2) - => SafeExecution(() => Native.PcSchemaSameInterpretations(s1, s2)); - - public static IntPtr PcPointlistMake(uint npoints) - => SafeExecution(() => Native.PcPointlistMake(npoints)); - - public static void PcPointlistFree(IntPtr pl) - => SafeExecution(() => Native.PcPointlistFree(pl)); - - public static void PcPointlistAddPoint(IntPtr pl, IntPtr pt) - => SafeExecution(() => Native.PcPointlistAddPoint(pl, pt)); - - public static IntPtr PcPointlistGetPoint(IntPtr pl, int i) - => SafeExecution(() => Native.PcPointlistGetPoint(pl, i)); - - public static IntPtr PcPointMake(IntPtr s) - => SafeExecution(() => Native.PcPointMake(s)); - - public static IntPtr PcPointFromData(IntPtr s, IntPtr data) - => SafeExecution(() => Native.PcPointFromData(s, data)); - - public static IntPtr PcPointFromDoubleArray(IntPtr s, IntPtr array, uint offset, uint stride) - => SafeExecution(() => Native.PcPointFromDoubleArray(s, array, offset, stride)); - - public static IntPtr PcPointToDoubleArray(IntPtr pt) - => SafeExecution(() => Native.PcPointToDoubleArray(pt)); - - public static void PcPointFree(IntPtr pt) - => SafeExecution(() => Native.PcPointFree(pt)); - - public static int PcPointGetDoubleByName(IntPtr pt, string name, IntPtr val) - => SafeExecution(() => Native.PcPointGetDoubleByName(pt, name, val)); - - public static int PcPointGetDoubleByIndex(IntPtr pt, uint idx, IntPtr val) - => SafeExecution(() => Native.PcPointGetDoubleByIndex(pt, idx, val)); - - public static int PcPointGetDouble(IntPtr pt, IntPtr dim, IntPtr val) - => SafeExecution(() => Native.PcPointGetDouble(pt, dim, val)); - - public static int PcPointSetDoubleByName(IntPtr pt, string name, double val) - => SafeExecution(() => Native.PcPointSetDoubleByName(pt, name, val)); - - public static int PcPointSetDoubleByIndex(IntPtr pt, uint idx, double val) - => SafeExecution(() => Native.PcPointSetDoubleByIndex(pt, idx, val)); - - public static int PcPointSetDouble(IntPtr pt, IntPtr dim, double val) - => SafeExecution(() => Native.PcPointSetDouble(pt, dim, val)); - - public static int PcPointGetX(IntPtr pt, IntPtr val) - => SafeExecution(() => Native.PcPointGetX(pt, val)); - - public static int PcPointGetY(IntPtr pt, IntPtr val) - => SafeExecution(() => Native.PcPointGetY(pt, val)); - - public static int PcPointGetZ(IntPtr pt, IntPtr val) - => SafeExecution(() => Native.PcPointGetZ(pt, val)); - - public static int PcPointGetM(IntPtr pt, IntPtr val) - => SafeExecution(() => Native.PcPointGetM(pt, val)); - - public static int PcPointSetX(IntPtr pt, double val) - => SafeExecution(() => Native.PcPointSetX(pt, val)); - - public static int PcPointSetY(IntPtr pt, double val) - => SafeExecution(() => Native.PcPointSetY(pt, val)); - - public static int PcPointSetZ(IntPtr pt, double val) - => SafeExecution(() => Native.PcPointSetZ(pt, val)); - - public static int PcPointSetM(IntPtr pt, double val) - => SafeExecution(() => Native.PcPointSetM(pt, val)); - - public static IntPtr PcPointFromWkb(IntPtr s, IntPtr wkb, ulong wkbsize) - => SafeExecution(() => Native.PcPointFromWkb(s, wkb, wkbsize)); - - public static IntPtr PcPointToWkb(IntPtr pt, IntPtr wkbsize) - => SafeExecution(() => Native.PcPointToWkb(pt, wkbsize)); - - public static string PcPointToString(IntPtr pt) - => SafeExecution(() => Native.PcPointToString(pt)); - - public static IntPtr PcPointToGeometryWkb(IntPtr pt, IntPtr wkbsize) - => SafeExecution(() => Native.PcPointToGeometryWkb(pt, wkbsize)); - - public static IntPtr PcPatchFromPointlist(IntPtr ptl) - => SafeExecution(() => Native.PcPatchFromPointlist(ptl)); - - public static IntPtr PcPointlistFromPatch(IntPtr patch) - => SafeExecution(() => Native.PcPointlistFromPatch(patch)); - - public static IntPtr PcPatchFromPatchlist(IntPtr palist, int numpatches) - => SafeExecution(() => Native.PcPatchFromPatchlist(palist, numpatches)); - - public static void PcPatchFree(IntPtr patch) - => SafeExecution(() => Native.PcPatchFree(patch)); - - public static IntPtr PcPatchCompress(IntPtr patch, IntPtr userdata) - => SafeExecution(() => Native.PcPatchCompress(patch, userdata)); - - public static IntPtr PcPatchUncompress(IntPtr patch) - => SafeExecution(() => Native.PcPatchUncompress(patch)); - - public static IntPtr PcPatchFromWkb(IntPtr s, IntPtr wkb, ulong wkbsize) - => SafeExecution(() => Native.PcPatchFromWkb(s, wkb, wkbsize)); - - public static IntPtr PcPatchToWkb(IntPtr patch, IntPtr wkbsize) - => SafeExecution(() => Native.PcPatchToWkb(patch, wkbsize)); - - public static string PcPatchToString(IntPtr patch) - => SafeExecution(() => Native.PcPatchToString(patch)); - - public static ulong PcPatchDimensionalSerializedSize(IntPtr patch) - => SafeExecution(() => Native.PcPatchDimensionalSerializedSize(patch)); - - public static ulong PcBytesSerializedSize(IntPtr pcb) - => SafeExecution(() => Native.PcBytesSerializedSize(pcb)); - - public static int PcBytesSerialize(IntPtr pcb, IntPtr buf, IntPtr size) - => SafeExecution(() => Native.PcBytesSerialize(pcb, buf, size)); - - public static int PcBytesDeserialize(IntPtr buf, IntPtr dim, IntPtr pcb, int @readonly, int flip_endian) - => SafeExecution(() => Native.PcBytesDeserialize(buf, dim, pcb, @readonly, flip_endian)); - - public static IntPtr PcStatsNewFromData(IntPtr schema, IntPtr mindata, IntPtr maxdata, IntPtr avgdata) - => SafeExecution(() => Native.PcStatsNewFromData(schema, mindata, maxdata, avgdata)); - - public static IntPtr PcStatsNew(IntPtr schema) - => SafeExecution(() => Native.PcStatsNew(schema)); - - public static void PcStatsFree(IntPtr stats) - => SafeExecution(() => Native.PcStatsFree(stats)); - - public static ulong PcStatsSize(IntPtr schema) - => SafeExecution(() => Native.PcStatsSize(schema)); - - public static int PcPatchComputeStats(IntPtr patch) - => SafeExecution(() => Native.PcPatchComputeStats(patch)); - - public static int PcPatchComputeExtent(IntPtr patch) - => SafeExecution(() => Native.PcPatchComputeExtent(patch)); - - public static int PcBoundsIntersects(IntPtr b1, IntPtr b2) - => SafeExecution(() => Native.PcBoundsIntersects(b1, b2)); - - public static IntPtr PcBoundingDiagonalWkbFromBounds(IntPtr bounds, IntPtr schema, IntPtr wkbsize) - => SafeExecution(() => Native.PcBoundingDiagonalWkbFromBounds(bounds, schema, wkbsize)); - - public static IntPtr PcBoundingDiagonalWkbFromStats(IntPtr stats, IntPtr wkbsize) - => SafeExecution(() => Native.PcBoundingDiagonalWkbFromStats(stats, wkbsize)); - - public static IntPtr PcPatchFilterLtByName(IntPtr pa, string name, double val) - => SafeExecution(() => Native.PcPatchFilterLtByName(pa, name, val)); - - public static IntPtr PcPatchFilterGtByName(IntPtr pa, string name, double val) - => SafeExecution(() => Native.PcPatchFilterGtByName(pa, name, val)); - - public static IntPtr PcPatchFilterEqualByName(IntPtr pa, string name, double val) - => SafeExecution(() => Native.PcPatchFilterEqualByName(pa, name, val)); - - public static IntPtr PcPatchFilterBetweenByName(IntPtr pa, string name, double val1, double val2) - => SafeExecution(() => Native.PcPatchFilterBetweenByName(pa, name, val1, val2)); - - public static IntPtr PcPatchPointn(IntPtr patch, int n) - => SafeExecution(() => Native.PcPatchPointn(patch, n)); - - public static IntPtr PcPatchSort(IntPtr pa, IntPtr name, int ndims) - => SafeExecution(() => Native.PcPatchSort(pa, name, ndims)); - - public static uint PcPatchIsSorted(IntPtr pa, IntPtr name, int ndims, byte strict) - => SafeExecution(() => Native.PcPatchIsSorted(pa, name, ndims, strict)); - - public static IntPtr PcPatchRange(IntPtr pa, int first, int count) - => SafeExecution(() => Native.PcPatchRange(pa, first, count)); - - public static IntPtr PcPatchSetSchema(IntPtr patch, IntPtr schema, double def) - => SafeExecution(() => Native.PcPatchSetSchema(patch, schema, def)); - - public static IntPtr PcPatchTransform(IntPtr patch, IntPtr schema, double def) - => SafeExecution(() => Native.PcPatchTransform(patch, schema, def)); - - } -} diff --git a/MEOS.NET/Functions/Meos.pg_numeric.g.cs b/MEOS.NET/Functions/Meos.pg_numeric.g.cs deleted file mode 100644 index a743327..0000000 --- a/MEOS.NET/Functions/Meos.pg_numeric.g.cs +++ /dev/null @@ -1,169 +0,0 @@ -#nullable enable - -using System.Runtime.InteropServices; - -using MEOS.NET.Structures; - -namespace MEOS.NET.Functions -{ - /// The MEOS functions pg_numeric.h declares. - public static partial class Meos - { - public static IntPtr Float4ToNumeric(float num) - => SafeExecution(() => Native.Float4ToNumeric(num)); - - public static IntPtr Float8ToNumeric(double num) - => SafeExecution(() => Native.Float8ToNumeric(num)); - - public static IntPtr Int16ToNumeric(short num) - => SafeExecution(() => Native.Int16ToNumeric(num)); - - public static IntPtr Int32ToNumeric(int num) - => SafeExecution(() => Native.Int32ToNumeric(num)); - - public static IntPtr Int64ToNumeric(long num) - => SafeExecution(() => Native.Int64ToNumeric(num)); - - public static IntPtr Numeric(IntPtr num, int typmod) - => SafeExecution(() => Native.Numeric(num, typmod)); - - public static IntPtr NumericAbs(IntPtr num) - => SafeExecution(() => Native.NumericAbs(num)); - - public static IntPtr NumericAdd(IntPtr num1, IntPtr num2) - => SafeExecution(() => Native.NumericAdd(num1, num2)); - - public static IntPtr NumericCeil(IntPtr num) - => SafeExecution(() => Native.NumericCeil(num)); - - public static int NumericCmp(IntPtr num1, IntPtr num2) - => SafeExecution(() => Native.NumericCmp(num1, num2)); - - public static IntPtr NumericCopy(IntPtr num) - => SafeExecution(() => Native.NumericCopy(num)); - - public static IntPtr NumericDiv(IntPtr num1, IntPtr num2) - => SafeExecution(() => Native.NumericDiv(num1, num2)); - - public static IntPtr NumericDivTrunc(IntPtr num1, IntPtr num2) - => SafeExecution(() => Native.NumericDivTrunc(num1, num2)); - - public static bool NumericEq(IntPtr num1, IntPtr num2) - => SafeExecution(() => Native.NumericEq(num1, num2)); - - public static IntPtr NumericExp(IntPtr num) - => SafeExecution(() => Native.NumericExp(num)); - - public static IntPtr NumericFac(long num) - => SafeExecution(() => Native.NumericFac(num)); - - public static IntPtr NumericFloor(IntPtr num) - => SafeExecution(() => Native.NumericFloor(num)); - - public static IntPtr NumericGcd(IntPtr num1, IntPtr num2) - => SafeExecution(() => Native.NumericGcd(num1, num2)); - - public static bool NumericGe(IntPtr num1, IntPtr num2) - => SafeExecution(() => Native.NumericGe(num1, num2)); - - public static bool NumericGt(IntPtr num1, IntPtr num2) - => SafeExecution(() => Native.NumericGt(num1, num2)); - - public static uint NumericHash(IntPtr key) - => SafeExecution(() => Native.NumericHash(key)); - - public static ulong NumericHashExtended(IntPtr num, ulong seed) - => SafeExecution(() => Native.NumericHashExtended(num, seed)); - - public static IntPtr NumericIn(string str, int typmod) - => SafeExecution(() => Native.NumericIn(str, typmod)); - - public static IntPtr NumericInc(IntPtr num) - => SafeExecution(() => Native.NumericInc(num)); - - public static IntPtr NumericLarger(IntPtr num1, IntPtr num2) - => SafeExecution(() => Native.NumericLarger(num1, num2)); - - public static IntPtr NumericLcm(IntPtr num1, IntPtr num2) - => SafeExecution(() => Native.NumericLcm(num1, num2)); - - public static bool NumericLe(IntPtr num1, IntPtr num2) - => SafeExecution(() => Native.NumericLe(num1, num2)); - - public static IntPtr NumericLn(IntPtr num) - => SafeExecution(() => Native.NumericLn(num)); - - public static IntPtr NumericLog(IntPtr num1, IntPtr num2) - => SafeExecution(() => Native.NumericLog(num1, num2)); - - public static bool NumericLt(IntPtr num1, IntPtr num2) - => SafeExecution(() => Native.NumericLt(num1, num2)); - - public static uint NumericMinScale(IntPtr num) - => SafeExecution(() => Native.NumericMinScale(num)); - - public static IntPtr NumericMinus(IntPtr num1, IntPtr num2) - => SafeExecution(() => Native.NumericMinus(num1, num2)); - - public static IntPtr NumericMod(IntPtr num1, IntPtr num2) - => SafeExecution(() => Native.NumericMod(num1, num2)); - - public static IntPtr NumericMul(IntPtr num1, IntPtr num2) - => SafeExecution(() => Native.NumericMul(num1, num2)); - - public static bool NumericNe(IntPtr num1, IntPtr num2) - => SafeExecution(() => Native.NumericNe(num1, num2)); - - public static string NumericOut(IntPtr num) - => SafeExecution(() => Native.NumericOut(num)); - - public static IntPtr NumericPow(IntPtr num1, IntPtr num2) - => SafeExecution(() => Native.NumericPow(num1, num2)); - - public static IntPtr NumericRound(IntPtr num, int scale) - => SafeExecution(() => Native.NumericRound(num, scale)); - - public static int NumericScale(IntPtr num) - => SafeExecution(() => Native.NumericScale(num)); - - public static IntPtr NumericSign(IntPtr num) - => SafeExecution(() => Native.NumericSign(num)); - - public static IntPtr NumericSmaller(IntPtr num1, IntPtr num2) - => SafeExecution(() => Native.NumericSmaller(num1, num2)); - - public static IntPtr NumericSqrt(IntPtr num) - => SafeExecution(() => Native.NumericSqrt(num)); - - public static float NumericToFloat4(IntPtr num) - => SafeExecution(() => Native.NumericToFloat4(num)); - - public static double NumericToFloat8(IntPtr num) - => SafeExecution(() => Native.NumericToFloat8(num)); - - public static short NumericToInt16(IntPtr num) - => SafeExecution(() => Native.NumericToInt16(num)); - - public static int NumericToInt32(IntPtr num) - => SafeExecution(() => Native.NumericToInt32(num)); - - public static long NumericToInt64(IntPtr num) - => SafeExecution(() => Native.NumericToInt64(num)); - - public static IntPtr NumericTrimScale(IntPtr num) - => SafeExecution(() => Native.NumericTrimScale(num)); - - public static IntPtr NumericTrunc(IntPtr num, int scale) - => SafeExecution(() => Native.NumericTrunc(num, scale)); - - public static IntPtr NumericUminus(IntPtr num) - => SafeExecution(() => Native.NumericUminus(num)); - - public static IntPtr NumericUplus(IntPtr num) - => SafeExecution(() => Native.NumericUplus(num)); - - public static int NumericWidthBucket(IntPtr operand, IntPtr bound1, IntPtr bound2, int count) - => SafeExecution(() => Native.NumericWidthBucket(operand, bound1, bound2, count)); - - } -} diff --git a/tools/codegen.py b/tools/codegen.py index 4d2c277..e114ecc 100755 --- a/tools/codegen.py +++ b/tools/codegen.py @@ -672,7 +672,12 @@ def main(idl_path: str, dll_path: str = DLL_PATH) -> None: with open(idl_path) as fh: idl = json.load(fh) configure(idl) - funcs = idl["functions"] + # A binding projects MEOS's own surface. The catalog marks the declarations + # that reach it from a project MEOS vendors — pgPointCloud's `pc_api.h` and + # `hashtable.h`, PostgreSQL's `pg_numeric.h` — and those are that project's + # API, not MEOS's: 150 of them, every one internal, and the only three the + # built library does not export at all. + funcs = [f for f in idl["functions"] if not f.get("vendored")] repo_root = Path(__file__).resolve().parent.parent out_dir = repo_root / "MEOS.NET" / "Functions" if out_dir.exists(): @@ -699,8 +704,10 @@ def main(idl_path: str, dll_path: str = DLL_PATH) -> None: for header, group in sorted(grouped.items()): stem = header.removesuffix(".h") (out_dir / f"Meos.{stem}.g.cs").write_text(gen_exposed_functions(group, header)) + vendored = len(idl["functions"]) - len(funcs) print(f"Wrote {len(funcs)} functions across {len(grouped)} headers " - f"to MEOS.NET/Functions/, {len(BY_VALUE_STRUCTS)} by-value structs", + f"to MEOS.NET/Functions/, {len(BY_VALUE_STRUCTS)} by-value structs, " + f"{vendored} vendored declarations left to their own project", file=sys.stderr) From 4cb0d315954debbd0ce17728f3c3c8246c4d8b7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20Zim=C3=A1nyi?= Date: Wed, 2 Sep 2026 23:12:10 +0200 Subject: [PATCH 2/2] Resolve the committed snapshot before regenerating over it The generated tree this repository tracks is what a consumer of it compiles, and every step of the run overwrites it, so whether it still holds together is decided before the regeneration or nowhere. CI builds that tree and resolves its declarations against the provisioned MEOS first, through the symbol test, and only then regenerates, reports the drift, builds and runs the suite. Drift against a freshly derived catalog stays informational: MobilityDB master moves independently of this binding, so a difference there is ordinary and a contributor cannot act on it. What a stale snapshot costs is a function MEOS renamed or dropped reaching a consumer as an `EntryPointNotFoundException`, and that is what the step above fails on. --- .github/workflows/ci.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f4bc093..9ce9679 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,6 +27,20 @@ jobs: mobilitydb-ref: master build-libmeos: "true" + # The committed generated tree is what a consumer of this repository + # compiles, and every step below overwrites it, so whether it still holds + # together is decided HERE or nowhere. Drift against a freshly derived + # catalog is ordinary — MobilityDB master moves independently of this + # binding — but a snapshot declaring a function MEOS no longer exports + # reaches that consumer as an EntryPointNotFoundException at run time. + - name: Resolve the COMMITTED snapshot against MEOS + run: | + dotnet build MEOS.NET.sln -c Release + dotnet test MEOS.NET.sln -c Release --no-build \ + --filter "FullyQualifiedName~NativeSymbolTests" + env: + LD_LIBRARY_PATH: ${{ steps.provision.outputs.libmeos-prefix }}/lib + - name: Regenerate bindings run: python3 tools/codegen.py "${{ steps.provision.outputs.catalog-path }}"