This is an automated email from the ASF dual-hosted git repository.
jiayu pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/sedona-db.git
The following commit(s) were added to refs/heads/main by this push:
new fbbbed8 refactor(c/sedona-proj,c/sedona-tg): Remove build-time
generated headers (#149)
fbbbed8 is described below
commit fbbbed87d5815f198ed64f3aba3370cf7650756c
Author: Dewey Dunnington <[email protected]>
AuthorDate: Thu Sep 25 12:16:22 2025 -0500
refactor(c/sedona-proj,c/sedona-tg): Remove build-time generated headers
(#149)
---
Cargo.lock | 2 -
c/sedona-proj/Cargo.toml | 1 -
c/sedona-proj/README.md | 48 -
c/sedona-proj/build.rs | 57 --
.../src/bindings/x86_64-pc-windows-gnu.rs | 382 --------
c/sedona-proj/src/proj_dyn_bindgen.rs | 140 ++-
c/sedona-tg/Cargo.toml | 1 -
c/sedona-tg/README.md | 48 -
c/sedona-tg/build.rs | 56 --
c/sedona-tg/src/bindings/x86_64-pc-windows-gnu.rs | 1018 --------------------
c/sedona-tg/src/tg_bindgen.rs | 50 +-
11 files changed, 186 insertions(+), 1617 deletions(-)
diff --git a/Cargo.lock b/Cargo.lock
index 8d5b402..1092f73 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -5020,7 +5020,6 @@ dependencies = [
"approx",
"arrow-array",
"arrow-schema",
- "bindgen 0.71.1",
"cc",
"criterion",
"datafusion-common",
@@ -5143,7 +5142,6 @@ version = "0.2.0"
dependencies = [
"arrow-array",
"arrow-schema",
- "bindgen 0.71.1",
"cc",
"criterion",
"datafusion-common",
diff --git a/c/sedona-proj/Cargo.toml b/c/sedona-proj/Cargo.toml
index dfddbf5..f54bd52 100644
--- a/c/sedona-proj/Cargo.toml
+++ b/c/sedona-proj/Cargo.toml
@@ -27,7 +27,6 @@ edition.workspace = true
rust-version.workspace = true
[build-dependencies]
-bindgen = "0.71.0"
cc = { version = "1" }
[dev-dependencies]
diff --git a/c/sedona-proj/README.md b/c/sedona-proj/README.md
deleted file mode 100644
index 1c9312d..0000000
--- a/c/sedona-proj/README.md
+++ /dev/null
@@ -1,48 +0,0 @@
-<!---
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-
-# sedona-proj
-
-## How to update the prebuilt bindings
-
-If `SEDONA_PROJ_BINDINGS_OUTPUT_PATH` envvar is set, the new bindings will be
-written to the specified path. The path is relative to the manifest dir of
-this crate.
-
-```sh
-SEDONA_PROJ_BINDINGS_OUTPUT_PATH=src/bindings/x86_64-unknown-linux-gnu.rs
cargo build -p sedona-proj
-```
-
-Note that, the generated file doesn't contain the license header, so you need
-to add it manually (hopefully, this will be automated).
-
-### Windows
-
-On Windows, you might need to set `PATH` and `PKG_CONFIG_SYSROOT_DIR` for
-`pkg-config`. For example, when using Rtools45, you probably need these
-envvars:
-
-```ps1
-$env:PATH = "C:\rtools45\x86_64-w64-mingw32.static.posix\bin;$env:PATH"
-$env:PKG_CONFIG_SYSROOT_DIR = "C:\rtools45\x86_64-w64-mingw32.static.posix\"
-
-$env:SEDONA_PROJ_BINDINGS_OUTPUT_PATH = "src/bindings/x86_64-pc-windows-gnu.rs"
-
-cargo build -p sedona-proj
-```
diff --git a/c/sedona-proj/build.rs b/c/sedona-proj/build.rs
index 85ac44e..f62fd8a 100644
--- a/c/sedona-proj/build.rs
+++ b/c/sedona-proj/build.rs
@@ -14,66 +14,9 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-use std::{env, path::PathBuf};
-
-// Since relative path differs between build.rs and a file under `src/`, use
the
-// absolute path.
-fn get_absolute_path(path: String) -> PathBuf {
- std::path::absolute(PathBuf::from(path)).expect("Failed to get absolute
path")
-}
-
-fn configure_bindings_path(prebuilt_bindings_path: String) -> (PathBuf, bool) {
- // If SEDONA_PROJ_BINDINGS_OUTPUT_PATH is set, honor the explicit output
- // path to regenerate bindings.
- if let Ok(output_path) = env::var("SEDONA_PROJ_BINDINGS_OUTPUT_PATH") {
- let output_path = get_absolute_path(output_path);
- if let Some(output_dir) = output_path.parent() {
- std::fs::create_dir_all(output_dir).expect("Failed to create
parent dirs");
- }
- return (output_path, true);
- }
-
- // If a prebuilt bindings exists, use it and skip bindgen.
- let prebuilt_bindings_path = get_absolute_path(prebuilt_bindings_path);
- if prebuilt_bindings_path.exists() {
- return (prebuilt_bindings_path, false);
- }
-
- let output_dir = env::var("OUT_DIR").unwrap();
- let output_path = PathBuf::from(output_dir).join("bindings.rs");
-
- (output_path, true)
-}
fn main() {
println!("cargo:rerun-if-changed=src/proj_dyn.c");
- println!("cargo:rerun-if-env-changed=SEDONA_PROJ_BINDINGS_OUTPUT_PATH");
cc::Build::new().file("src/proj_dyn.c").compile("proj_dyn");
-
- let target_triple = std::env::var("TARGET").unwrap();
- let prebuilt_bindings_path = format!("src/bindings/{target_triple}.rs");
-
- let (bindings_path, generate_bindings) =
configure_bindings_path(prebuilt_bindings_path);
-
- println!(
- "cargo::rustc-env=BINDINGS_PATH={}",
- bindings_path.to_string_lossy()
- );
-
- if !generate_bindings {
- return;
- }
-
- let bindings = bindgen::Builder::default()
- .header("src/proj_dyn.h")
- .generate_comments(false)
- .parse_callbacks(Box::new(bindgen::CargoCallbacks::new()))
- .generate()
- .expect("Unable to generate bindings");
-
- // Write the bindings to the $OUT_DIR/bindings.rs file.
- bindings
- .write_to_file(&bindings_path)
- .expect("Couldn't write bindings!");
}
diff --git a/c/sedona-proj/src/bindings/x86_64-pc-windows-gnu.rs
b/c/sedona-proj/src/bindings/x86_64-pc-windows-gnu.rs
deleted file mode 100644
index 0b23b07..0000000
--- a/c/sedona-proj/src/bindings/x86_64-pc-windows-gnu.rs
+++ /dev/null
@@ -1,382 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-/* automatically generated by rust-bindgen 0.71.1 */
-
-pub const _VCRT_COMPILER_PREPROCESSOR: u32 = 1;
-pub const _SAL_VERSION: u32 = 20;
-pub const __SAL_H_VERSION: u32 = 180000000;
-pub const _USE_DECLSPECS_FOR_SAL: u32 = 0;
-pub const _USE_ATTRIBUTES_FOR_SAL: u32 = 0;
-pub const _CRT_PACKING: u32 = 8;
-pub const _HAS_EXCEPTIONS: u32 = 1;
-pub const _STL_LANG: u32 = 0;
-pub const _HAS_CXX17: u32 = 0;
-pub const _HAS_CXX20: u32 = 0;
-pub const _HAS_CXX23: u32 = 0;
-pub const _HAS_NODISCARD: u32 = 0;
-pub const _ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE: u32 = 1;
-pub const _CRT_BUILD_DESKTOP_APP: u32 = 1;
-pub const _ARGMAX: u32 = 100;
-pub const _CRT_INT_MAX: u32 = 2147483647;
-pub const _CRT_FUNCTIONS_REQUIRED: u32 = 1;
-pub const _CRT_HAS_CXX17: u32 = 0;
-pub const _CRT_HAS_C11: u32 = 1;
-pub const _CRT_INTERNAL_NONSTDC_NAMES: u32 = 1;
-pub const __STDC_SECURE_LIB__: u32 = 200411;
-pub const __GOT_SECURE_LIB__: u32 = 200411;
-pub const __STDC_WANT_SECURE_LIB__: u32 = 1;
-pub const _SECURECRT_FILL_BUFFER_PATTERN: u32 = 254;
-pub const _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES: u32 = 0;
-pub const _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT: u32 = 0;
-pub const _CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES: u32 = 1;
-pub const _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_MEMORY: u32 = 0;
-pub const _CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES_MEMORY: u32 = 0;
-pub type va_list = *mut ::std::os::raw::c_char;
-unsafe extern "C" {
- pub fn __va_start(arg1: *mut *mut ::std::os::raw::c_char, ...);
-}
-pub type __vcrt_bool = bool;
-pub type wchar_t = ::std::os::raw::c_ushort;
-unsafe extern "C" {
- pub fn __security_init_cookie();
-}
-unsafe extern "C" {
- pub fn __security_check_cookie(_StackCookie: usize);
-}
-unsafe extern "C" {
- pub fn __report_gsfailure(_StackCookie: usize) -> !;
-}
-unsafe extern "C" {
- pub static mut __security_cookie: usize;
-}
-pub type __crt_bool = bool;
-unsafe extern "C" {
- pub fn _invalid_parameter_noinfo();
-}
-unsafe extern "C" {
- pub fn _invalid_parameter_noinfo_noreturn() -> !;
-}
-unsafe extern "C" {
- pub fn _invoke_watson(
- _Expression: *const wchar_t,
- _FunctionName: *const wchar_t,
- _FileName: *const wchar_t,
- _LineNo: ::std::os::raw::c_uint,
- _Reserved: usize,
- ) -> !;
-}
-pub type errno_t = ::std::os::raw::c_int;
-pub type wint_t = ::std::os::raw::c_ushort;
-pub type wctype_t = ::std::os::raw::c_ushort;
-pub type __time32_t = ::std::os::raw::c_long;
-pub type __time64_t = ::std::os::raw::c_longlong;
-#[repr(C)]
-#[derive(Debug, Copy, Clone)]
-pub struct __crt_locale_data_public {
- pub _locale_pctype: *const ::std::os::raw::c_ushort,
- pub _locale_mb_cur_max: ::std::os::raw::c_int,
- pub _locale_lc_codepage: ::std::os::raw::c_uint,
-}
-#[allow(clippy::unnecessary_operation, clippy::identity_op)]
-const _: () = {
- ["Size of __crt_locale_data_public"]
- [::std::mem::size_of::<__crt_locale_data_public>() - 16usize];
- ["Alignment of __crt_locale_data_public"]
- [::std::mem::align_of::<__crt_locale_data_public>() - 8usize];
- ["Offset of field: __crt_locale_data_public::_locale_pctype"]
- [::std::mem::offset_of!(__crt_locale_data_public, _locale_pctype) -
0usize];
- ["Offset of field: __crt_locale_data_public::_locale_mb_cur_max"]
- [::std::mem::offset_of!(__crt_locale_data_public, _locale_mb_cur_max)
- 8usize];
- ["Offset of field: __crt_locale_data_public::_locale_lc_codepage"]
- [::std::mem::offset_of!(__crt_locale_data_public, _locale_lc_codepage)
- 12usize];
-};
-#[repr(C)]
-#[derive(Debug, Copy, Clone)]
-pub struct __crt_locale_pointers {
- pub locinfo: *mut __crt_locale_data,
- pub mbcinfo: *mut __crt_multibyte_data,
-}
-#[allow(clippy::unnecessary_operation, clippy::identity_op)]
-const _: () = {
- ["Size of
__crt_locale_pointers"][::std::mem::size_of::<__crt_locale_pointers>() -
16usize];
- ["Alignment of __crt_locale_pointers"]
- [::std::mem::align_of::<__crt_locale_pointers>() - 8usize];
- ["Offset of field: __crt_locale_pointers::locinfo"]
- [::std::mem::offset_of!(__crt_locale_pointers, locinfo) - 0usize];
- ["Offset of field: __crt_locale_pointers::mbcinfo"]
- [::std::mem::offset_of!(__crt_locale_pointers, mbcinfo) - 8usize];
-};
-pub type _locale_t = *mut __crt_locale_pointers;
-#[repr(C)]
-#[derive(Debug, Copy, Clone)]
-pub struct _Mbstatet {
- pub _Wchar: ::std::os::raw::c_ulong,
- pub _Byte: ::std::os::raw::c_ushort,
- pub _State: ::std::os::raw::c_ushort,
-}
-#[allow(clippy::unnecessary_operation, clippy::identity_op)]
-const _: () = {
- ["Size of _Mbstatet"][::std::mem::size_of::<_Mbstatet>() - 8usize];
- ["Alignment of _Mbstatet"][::std::mem::align_of::<_Mbstatet>() - 4usize];
- ["Offset of field: _Mbstatet::_Wchar"][::std::mem::offset_of!(_Mbstatet,
_Wchar) - 0usize];
- ["Offset of field: _Mbstatet::_Byte"][::std::mem::offset_of!(_Mbstatet,
_Byte) - 4usize];
- ["Offset of field: _Mbstatet::_State"][::std::mem::offset_of!(_Mbstatet,
_State) - 6usize];
-};
-pub type mbstate_t = _Mbstatet;
-pub type time_t = __time64_t;
-pub type rsize_t = usize;
-unsafe extern "C" {
- pub fn _errno() -> *mut ::std::os::raw::c_int;
-}
-unsafe extern "C" {
- pub fn _set_errno(_Value: ::std::os::raw::c_int) -> errno_t;
-}
-unsafe extern "C" {
- pub fn _get_errno(_Value: *mut ::std::os::raw::c_int) -> errno_t;
-}
-unsafe extern "C" {
- pub fn __threadid() -> ::std::os::raw::c_ulong;
-}
-unsafe extern "C" {
- pub fn __threadhandle() -> usize;
-}
-#[repr(C)]
-#[derive(Debug, Copy, Clone)]
-pub struct pj_ctx {
- _unused: [u8; 0],
-}
-pub type PJ_CONTEXT = pj_ctx;
-#[repr(C)]
-#[derive(Debug, Copy, Clone)]
-pub struct PJ_AREA {
- _unused: [u8; 0],
-}
-#[repr(C)]
-#[derive(Debug, Copy, Clone)]
-pub struct PJconsts {
- _unused: [u8; 0],
-}
-pub type PJ = PJconsts;
-#[repr(C)]
-#[derive(Debug, Copy, Clone)]
-pub struct PJ_XYZT {
- pub x: f64,
- pub y: f64,
- pub z: f64,
- pub t: f64,
-}
-#[allow(clippy::unnecessary_operation, clippy::identity_op)]
-const _: () = {
- ["Size of PJ_XYZT"][::std::mem::size_of::<PJ_XYZT>() - 32usize];
- ["Alignment of PJ_XYZT"][::std::mem::align_of::<PJ_XYZT>() - 8usize];
- ["Offset of field: PJ_XYZT::x"][::std::mem::offset_of!(PJ_XYZT, x) -
0usize];
- ["Offset of field: PJ_XYZT::y"][::std::mem::offset_of!(PJ_XYZT, y) -
8usize];
- ["Offset of field: PJ_XYZT::z"][::std::mem::offset_of!(PJ_XYZT, z) -
16usize];
- ["Offset of field: PJ_XYZT::t"][::std::mem::offset_of!(PJ_XYZT, t) -
24usize];
-};
-#[repr(C)]
-#[derive(Copy, Clone)]
-pub union PJ_COORD {
- pub v: [f64; 4usize],
- pub xyzt: PJ_XYZT,
-}
-#[allow(clippy::unnecessary_operation, clippy::identity_op)]
-const _: () = {
- ["Size of PJ_COORD"][::std::mem::size_of::<PJ_COORD>() - 32usize];
- ["Alignment of PJ_COORD"][::std::mem::align_of::<PJ_COORD>() - 8usize];
- ["Offset of field: PJ_COORD::v"][::std::mem::offset_of!(PJ_COORD, v) -
0usize];
- ["Offset of field: PJ_COORD::xyzt"][::std::mem::offset_of!(PJ_COORD, xyzt)
- 0usize];
-};
-pub const PJ_DIRECTION_PJ_FWD: PJ_DIRECTION = 1;
-pub const PJ_DIRECTION_PJ_IDENT: PJ_DIRECTION = 0;
-pub const PJ_DIRECTION_PJ_INV: PJ_DIRECTION = -1;
-pub type PJ_DIRECTION = ::std::os::raw::c_int;
-pub const PJ_LOG_LEVEL_PJ_LOG_NONE: PJ_LOG_LEVEL = 0;
-pub const PJ_LOG_LEVEL_PJ_LOG_ERROR: PJ_LOG_LEVEL = 1;
-pub const PJ_LOG_LEVEL_PJ_LOG_DEBUG: PJ_LOG_LEVEL = 2;
-pub const PJ_LOG_LEVEL_PJ_LOG_TRACE: PJ_LOG_LEVEL = 3;
-pub const PJ_LOG_LEVEL_PJ_LOG_TELL: PJ_LOG_LEVEL = 4;
-pub type PJ_LOG_LEVEL = ::std::os::raw::c_int;
-#[repr(C)]
-#[derive(Debug, Copy, Clone)]
-pub struct PJ_INFO {
- pub major: ::std::os::raw::c_int,
- pub minor: ::std::os::raw::c_int,
- pub patch: ::std::os::raw::c_int,
- pub release: *const ::std::os::raw::c_char,
- pub version: *const ::std::os::raw::c_char,
- pub searchpath: *const ::std::os::raw::c_char,
-}
-#[allow(clippy::unnecessary_operation, clippy::identity_op)]
-const _: () = {
- ["Size of PJ_INFO"][::std::mem::size_of::<PJ_INFO>() - 40usize];
- ["Alignment of PJ_INFO"][::std::mem::align_of::<PJ_INFO>() - 8usize];
- ["Offset of field: PJ_INFO::major"][::std::mem::offset_of!(PJ_INFO, major)
- 0usize];
- ["Offset of field: PJ_INFO::minor"][::std::mem::offset_of!(PJ_INFO, minor)
- 4usize];
- ["Offset of field: PJ_INFO::patch"][::std::mem::offset_of!(PJ_INFO, patch)
- 8usize];
- ["Offset of field: PJ_INFO::release"][::std::mem::offset_of!(PJ_INFO,
release) - 16usize];
- ["Offset of field: PJ_INFO::version"][::std::mem::offset_of!(PJ_INFO,
version) - 24usize];
- ["Offset of field: PJ_INFO::searchpath"][::std::mem::offset_of!(PJ_INFO,
searchpath) - 32usize];
-};
-#[repr(C)]
-#[derive(Debug, Copy, Clone)]
-pub struct ProjApi {
- pub proj_area_create: ::std::option::Option<unsafe extern "C" fn() -> *mut
PJ_AREA>,
- pub proj_area_destroy: ::std::option::Option<unsafe extern "C" fn(area:
*mut PJ_AREA)>,
- pub proj_area_set_bbox: ::std::option::Option<
- unsafe extern "C" fn(
- area: *mut PJ_AREA,
- west_lon_degree: f64,
- south_lat_degree: f64,
- east_lon_degree: f64,
- north_lat_degree: f64,
- ) -> ::std::os::raw::c_int,
- >,
- pub proj_context_create: ::std::option::Option<unsafe extern "C" fn() ->
*mut PJ_CONTEXT>,
- pub proj_context_destroy: ::std::option::Option<unsafe extern "C" fn(ctx:
*mut PJ_CONTEXT)>,
- pub proj_context_errno:
- ::std::option::Option<unsafe extern "C" fn(ctx: *mut PJ_CONTEXT) ->
::std::os::raw::c_int>,
- pub proj_context_errno_string: ::std::option::Option<
- unsafe extern "C" fn(
- ctx: *mut PJ_CONTEXT,
- err: ::std::os::raw::c_int,
- ) -> *const ::std::os::raw::c_char,
- >,
- pub proj_context_set_database_path: ::std::option::Option<
- unsafe extern "C" fn(
- ctx: *mut PJ_CONTEXT,
- dbPath: *const ::std::os::raw::c_char,
- auxDbPaths: *const *const ::std::os::raw::c_char,
- options: *const *const ::std::os::raw::c_char,
- ) -> ::std::os::raw::c_int,
- >,
- pub proj_context_set_search_paths: ::std::option::Option<
- unsafe extern "C" fn(
- ctx: *mut PJ_CONTEXT,
- count_paths: ::std::os::raw::c_int,
- paths: *const *const ::std::os::raw::c_char,
- ),
- >,
- pub proj_create: ::std::option::Option<
- unsafe extern "C" fn(
- ctx: *mut PJ_CONTEXT,
- definition: *const ::std::os::raw::c_char,
- ) -> *mut PJ,
- >,
- pub proj_create_crs_to_crs_from_pj: ::std::option::Option<
- unsafe extern "C" fn(
- ctx: *mut PJ_CONTEXT,
- source_crs: *mut PJ,
- target_crs: *mut PJ,
- area: *mut PJ_AREA,
- options: *const *const ::std::os::raw::c_char,
- ) -> *mut PJ,
- >,
- pub proj_cs_get_axis_count: ::std::option::Option<
- unsafe extern "C" fn(ctx: *mut PJ_CONTEXT, cs: *const PJ) ->
::std::os::raw::c_int,
- >,
- pub proj_destroy: ::std::option::Option<unsafe extern "C" fn(P: *mut PJ)>,
- pub proj_errno:
- ::std::option::Option<unsafe extern "C" fn(P: *const PJ) ->
::std::os::raw::c_int>,
- pub proj_errno_reset: ::std::option::Option<unsafe extern "C" fn(P: *mut
PJ)>,
- pub proj_info: ::std::option::Option<unsafe extern "C" fn() -> PJ_INFO>,
- pub proj_log_level: ::std::option::Option<
- unsafe extern "C" fn(ctx: *mut PJ_CONTEXT, level: PJ_LOG_LEVEL) ->
PJ_LOG_LEVEL,
- >,
- pub proj_normalize_for_visualization: ::std::option::Option<
- unsafe extern "C" fn(ctx: *mut PJ_CONTEXT, obj: *const PJ) -> *mut PJ,
- >,
- pub proj_trans: ::std::option::Option<
- unsafe extern "C" fn(P: *mut PJ, direction: PJ_DIRECTION, coord:
PJ_COORD) -> PJ_COORD,
- >,
- pub proj_trans_array: ::std::option::Option<
- unsafe extern "C" fn(
- P: *mut PJ,
- direction: PJ_DIRECTION,
- n: usize,
- coord: *mut PJ_COORD,
- ) -> PJ_COORD,
- >,
- pub release: ::std::option::Option<unsafe extern "C" fn(arg1: *mut
ProjApi)>,
- pub private_data: *mut ::std::os::raw::c_void,
-}
-#[allow(clippy::unnecessary_operation, clippy::identity_op)]
-const _: () = {
- ["Size of ProjApi"][::std::mem::size_of::<ProjApi>() - 176usize];
- ["Alignment of ProjApi"][::std::mem::align_of::<ProjApi>() - 8usize];
- ["Offset of field: ProjApi::proj_area_create"]
- [::std::mem::offset_of!(ProjApi, proj_area_create) - 0usize];
- ["Offset of field: ProjApi::proj_area_destroy"]
- [::std::mem::offset_of!(ProjApi, proj_area_destroy) - 8usize];
- ["Offset of field: ProjApi::proj_area_set_bbox"]
- [::std::mem::offset_of!(ProjApi, proj_area_set_bbox) - 16usize];
- ["Offset of field: ProjApi::proj_context_create"]
- [::std::mem::offset_of!(ProjApi, proj_context_create) - 24usize];
- ["Offset of field: ProjApi::proj_context_destroy"]
- [::std::mem::offset_of!(ProjApi, proj_context_destroy) - 32usize];
- ["Offset of field: ProjApi::proj_context_errno"]
- [::std::mem::offset_of!(ProjApi, proj_context_errno) - 40usize];
- ["Offset of field: ProjApi::proj_context_errno_string"]
- [::std::mem::offset_of!(ProjApi, proj_context_errno_string) - 48usize];
- ["Offset of field: ProjApi::proj_context_set_database_path"]
- [::std::mem::offset_of!(ProjApi, proj_context_set_database_path) -
56usize];
- ["Offset of field: ProjApi::proj_context_set_search_paths"]
- [::std::mem::offset_of!(ProjApi, proj_context_set_search_paths) -
64usize];
- ["Offset of field: ProjApi::proj_create"]
- [::std::mem::offset_of!(ProjApi, proj_create) - 72usize];
- ["Offset of field: ProjApi::proj_create_crs_to_crs_from_pj"]
- [::std::mem::offset_of!(ProjApi, proj_create_crs_to_crs_from_pj) -
80usize];
- ["Offset of field: ProjApi::proj_cs_get_axis_count"]
- [::std::mem::offset_of!(ProjApi, proj_cs_get_axis_count) - 88usize];
- ["Offset of field: ProjApi::proj_destroy"]
- [::std::mem::offset_of!(ProjApi, proj_destroy) - 96usize];
- ["Offset of field: ProjApi::proj_errno"]
- [::std::mem::offset_of!(ProjApi, proj_errno) - 104usize];
- ["Offset of field: ProjApi::proj_errno_reset"]
- [::std::mem::offset_of!(ProjApi, proj_errno_reset) - 112usize];
- ["Offset of field: ProjApi::proj_info"][::std::mem::offset_of!(ProjApi,
proj_info) - 120usize];
- ["Offset of field: ProjApi::proj_log_level"]
- [::std::mem::offset_of!(ProjApi, proj_log_level) - 128usize];
- ["Offset of field: ProjApi::proj_normalize_for_visualization"]
- [::std::mem::offset_of!(ProjApi, proj_normalize_for_visualization) -
136usize];
- ["Offset of field: ProjApi::proj_trans"]
- [::std::mem::offset_of!(ProjApi, proj_trans) - 144usize];
- ["Offset of field: ProjApi::proj_trans_array"]
- [::std::mem::offset_of!(ProjApi, proj_trans_array) - 152usize];
- ["Offset of field: ProjApi::release"][::std::mem::offset_of!(ProjApi,
release) - 160usize];
- ["Offset of field: ProjApi::private_data"]
- [::std::mem::offset_of!(ProjApi, private_data) - 168usize];
-};
-unsafe extern "C" {
- pub fn proj_dyn_api_init(
- api: *mut ProjApi,
- shared_object_path: *const ::std::os::raw::c_char,
- err_msg: *mut ::std::os::raw::c_char,
- len: ::std::os::raw::c_int,
- ) -> ::std::os::raw::c_int;
-}
-#[repr(C)]
-#[derive(Debug, Copy, Clone)]
-pub struct __crt_locale_data {
- pub _address: u8,
-}
-#[repr(C)]
-#[derive(Debug, Copy, Clone)]
-pub struct __crt_multibyte_data {
- pub _address: u8,
-}
diff --git a/c/sedona-proj/src/proj_dyn_bindgen.rs
b/c/sedona-proj/src/proj_dyn_bindgen.rs
index fbae218..d9ede16 100644
--- a/c/sedona-proj/src/proj_dyn_bindgen.rs
+++ b/c/sedona-proj/src/proj_dyn_bindgen.rs
@@ -18,4 +18,142 @@
#![allow(non_snake_case)]
#![allow(dead_code)]
-include!(env!("BINDINGS_PATH"));
+use std::os::raw::{c_char, c_int, c_uint, c_void};
+
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct pj_ctx {
+ _unused: [u8; 0],
+}
+pub type PJ_CONTEXT = pj_ctx;
+
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct PJ_AREA {
+ _unused: [u8; 0],
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct PJconsts {
+ _unused: [u8; 0],
+}
+pub type PJ = PJconsts;
+
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct PJ_XYZT {
+ pub x: f64,
+ pub y: f64,
+ pub z: f64,
+ pub t: f64,
+}
+
+#[repr(C)]
+#[derive(Copy, Clone)]
+pub union PJ_COORD {
+ pub v: [f64; 4usize],
+ pub xyzt: PJ_XYZT,
+}
+
+pub const PJ_DIRECTION_PJ_FWD: PJ_DIRECTION = 1;
+pub const PJ_DIRECTION_PJ_IDENT: PJ_DIRECTION = 0;
+pub const PJ_DIRECTION_PJ_INV: PJ_DIRECTION = -1;
+pub type PJ_DIRECTION = c_int;
+
+pub const PJ_LOG_LEVEL_PJ_LOG_NONE: PJ_LOG_LEVEL = 0;
+pub const PJ_LOG_LEVEL_PJ_LOG_ERROR: PJ_LOG_LEVEL = 1;
+pub const PJ_LOG_LEVEL_PJ_LOG_DEBUG: PJ_LOG_LEVEL = 2;
+pub const PJ_LOG_LEVEL_PJ_LOG_TRACE: PJ_LOG_LEVEL = 3;
+pub const PJ_LOG_LEVEL_PJ_LOG_TELL: PJ_LOG_LEVEL = 4;
+
+#[cfg(target_env = "msvc")]
+pub type PJ_LOG_LEVEL = c_int;
+
+#[cfg(not(target_env = "msvc"))]
+pub type PJ_LOG_LEVEL = c_uint;
+
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct PJ_INFO {
+ pub major: c_int,
+ pub minor: c_int,
+ pub patch: c_int,
+ pub release: *const c_char,
+ pub version: *const c_char,
+ pub searchpath: *const c_char,
+}
+
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct ProjApi {
+ pub proj_area_create: Option<unsafe extern "C" fn() -> *mut PJ_AREA>,
+ pub proj_area_destroy: Option<unsafe extern "C" fn(area: *mut PJ_AREA)>,
+ pub proj_area_set_bbox: Option<
+ unsafe extern "C" fn(
+ area: *mut PJ_AREA,
+ west_lon_degree: f64,
+ south_lat_degree: f64,
+ east_lon_degree: f64,
+ north_lat_degree: f64,
+ ) -> c_int,
+ >,
+ pub proj_context_create: Option<unsafe extern "C" fn() -> *mut PJ_CONTEXT>,
+ pub proj_context_destroy: Option<unsafe extern "C" fn(ctx: *mut
PJ_CONTEXT)>,
+ pub proj_context_errno: Option<unsafe extern "C" fn(ctx: *mut PJ_CONTEXT)
-> c_int>,
+ pub proj_context_errno_string:
+ Option<unsafe extern "C" fn(ctx: *mut PJ_CONTEXT, err: c_int) ->
*const c_char>,
+ pub proj_context_set_database_path: Option<
+ unsafe extern "C" fn(
+ ctx: *mut PJ_CONTEXT,
+ dbPath: *const c_char,
+ auxDbPaths: *const *const c_char,
+ options: *const *const c_char,
+ ) -> c_int,
+ >,
+ pub proj_context_set_search_paths: Option<
+ unsafe extern "C" fn(ctx: *mut PJ_CONTEXT, count_paths: c_int, paths:
*const *const c_char),
+ >,
+ pub proj_create:
+ Option<unsafe extern "C" fn(ctx: *mut PJ_CONTEXT, definition: *const
c_char) -> *mut PJ>,
+ pub proj_create_crs_to_crs_from_pj: Option<
+ unsafe extern "C" fn(
+ ctx: *mut PJ_CONTEXT,
+ source_crs: *mut PJ,
+ target_crs: *mut PJ,
+ area: *mut PJ_AREA,
+ options: *const *const c_char,
+ ) -> *mut PJ,
+ >,
+ pub proj_cs_get_axis_count:
+ Option<unsafe extern "C" fn(ctx: *mut PJ_CONTEXT, cs: *const PJ) ->
c_int>,
+ pub proj_destroy: Option<unsafe extern "C" fn(P: *mut PJ)>,
+ pub proj_errno: Option<unsafe extern "C" fn(P: *const PJ) -> c_int>,
+ pub proj_errno_reset: Option<unsafe extern "C" fn(P: *mut PJ)>,
+ pub proj_info: Option<unsafe extern "C" fn() -> PJ_INFO>,
+ pub proj_log_level:
+ Option<unsafe extern "C" fn(ctx: *mut PJ_CONTEXT, level: PJ_LOG_LEVEL)
-> PJ_LOG_LEVEL>,
+ pub proj_normalize_for_visualization:
+ Option<unsafe extern "C" fn(ctx: *mut PJ_CONTEXT, obj: *const PJ) ->
*mut PJ>,
+ pub proj_trans: Option<
+ unsafe extern "C" fn(P: *mut PJ, direction: PJ_DIRECTION, coord:
PJ_COORD) -> PJ_COORD,
+ >,
+ pub proj_trans_array: Option<
+ unsafe extern "C" fn(
+ P: *mut PJ,
+ direction: PJ_DIRECTION,
+ n: usize,
+ coord: *mut PJ_COORD,
+ ) -> PJ_COORD,
+ >,
+ pub release: Option<unsafe extern "C" fn(arg1: *mut ProjApi)>,
+ pub private_data: *mut c_void,
+}
+
+unsafe extern "C" {
+ pub fn proj_dyn_api_init(
+ api: *mut ProjApi,
+ shared_object_path: *const c_char,
+ err_msg: *mut c_char,
+ len: c_int,
+ ) -> c_int;
+}
diff --git a/c/sedona-tg/Cargo.toml b/c/sedona-tg/Cargo.toml
index 190899b..bc29b6b 100644
--- a/c/sedona-tg/Cargo.toml
+++ b/c/sedona-tg/Cargo.toml
@@ -27,7 +27,6 @@ edition.workspace = true
rust-version.workspace = true
[build-dependencies]
-bindgen = "0.71.0"
cc = { version = "1" }
[dev-dependencies]
diff --git a/c/sedona-tg/README.md b/c/sedona-tg/README.md
deleted file mode 100644
index d0e1942..0000000
--- a/c/sedona-tg/README.md
+++ /dev/null
@@ -1,48 +0,0 @@
-<!---
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-
-# sedona-tg
-
-## How to update the prebuilt bindings
-
-If `SEDONA_TG_BINDINGS_OUTPUT_PATH` envvar is set, the new bindings will be
-written to the specified path. The path is relative to the manifest dir of
-this crate.
-
-```sh
-SEDONA_TG_BINDINGS_OUTPUT_PATH=src/bindings/x86_64-unknown-linux-gnu.rs cargo
build -p sedona-tg
-```
-
-Note that, the generated file doesn't contain the license header, so you need
-to add it manually (hopefully, this will be automated).
-
-### Windows
-
-On Windows, you might need to set `PATH` and `PKG_CONFIG_SYSROOT_DIR` for
-`pkg-config`. For example, when using Rtools45, you probably need these
-envvars:
-
-```ps1
-$env:PATH = "C:\rtools45\x86_64-w64-mingw32.static.posix\bin;$env:PATH"
-$env:PKG_CONFIG_SYSROOT_DIR = "C:\rtools45\x86_64-w64-mingw32.static.posix\"
-
-$env:SEDONA_TG_BINDINGS_OUTPUT_PATH = "src/bindings/x86_64-pc-windows-gnu.rs"
-
-cargo build -p sedona-tg
-```
diff --git a/c/sedona-tg/build.rs b/c/sedona-tg/build.rs
index a64a482..3ea82e9 100644
--- a/c/sedona-tg/build.rs
+++ b/c/sedona-tg/build.rs
@@ -14,40 +14,9 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-use std::{env, path::PathBuf};
-
-// Since relative path differs between build.rs and a file under `src/`, use
the
-// absolute path.
-fn get_absolute_path(path: String) -> PathBuf {
- std::path::absolute(PathBuf::from(path)).expect("Failed to get absolute
path")
-}
-
-fn configure_bindings_path(prebuilt_bindings_path: String) -> (PathBuf, bool) {
- // If SEDONA_TG_BINDINGS_OUTPUT_PATH is set, honor the explicit output
- // path to regenerate bindings.
- if let Ok(output_path) = env::var("SEDONA_TG_BINDINGS_OUTPUT_PATH") {
- let output_path = get_absolute_path(output_path);
- if let Some(output_dir) = output_path.parent() {
- std::fs::create_dir_all(output_dir).expect("Failed to create
parent dirs");
- }
- return (output_path, true);
- }
-
- // If a prebuilt bindings exists, use it and skip bindgen.
- let prebuilt_bindings_path = get_absolute_path(prebuilt_bindings_path);
- if prebuilt_bindings_path.exists() {
- return (prebuilt_bindings_path.to_path_buf(), false);
- }
-
- let output_dir = env::var("OUT_DIR").unwrap();
- let output_path = PathBuf::from(output_dir).join("bindings.rs");
-
- (output_path, true)
-}
fn main() {
println!("cargo:rerun-if-changed=src/tg/tg.c");
- println!("cargo:rerun-if-env-changed=SEDONA_TG_BINDINGS_OUTPUT_PATH");
cc::Build::new()
.file("src/tg/tg.c")
@@ -55,29 +24,4 @@ fn main() {
.flag_if_supported("/std:c11")
.flag_if_supported("/experimental:c11atomics")
.compile("tg");
-
- let target_triple = std::env::var("TARGET").unwrap();
- let prebuilt_bindings_path = format!("src/bindings/{target_triple}.rs");
-
- let (bindings_path, generate_bindings) =
configure_bindings_path(prebuilt_bindings_path);
-
- println!(
- "cargo::rustc-env=BINDINGS_PATH={}",
- bindings_path.to_string_lossy()
- );
-
- if !generate_bindings {
- return;
- }
-
- let bindings = bindgen::Builder::default()
- .header("src/tg/tg.h")
- .generate_comments(false)
- .parse_callbacks(Box::new(bindgen::CargoCallbacks::new()))
- .generate()
- .expect("Unable to generate bindings");
-
- bindings
- .write_to_file(&bindings_path)
- .expect("Couldn't write bindings!");
}
diff --git a/c/sedona-tg/src/bindings/x86_64-pc-windows-gnu.rs
b/c/sedona-tg/src/bindings/x86_64-pc-windows-gnu.rs
deleted file mode 100644
index 2a9e339..0000000
--- a/c/sedona-tg/src/bindings/x86_64-pc-windows-gnu.rs
+++ /dev/null
@@ -1,1018 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-/* automatically generated by rust-bindgen 0.71.1 */
-
-pub const __bool_true_false_are_defined: u32 = 1;
-pub const false_: u32 = 0;
-pub const true_: u32 = 1;
-pub const _VCRT_COMPILER_PREPROCESSOR: u32 = 1;
-pub const _SAL_VERSION: u32 = 20;
-pub const __SAL_H_VERSION: u32 = 180000000;
-pub const _USE_DECLSPECS_FOR_SAL: u32 = 0;
-pub const _USE_ATTRIBUTES_FOR_SAL: u32 = 0;
-pub const _CRT_PACKING: u32 = 8;
-pub const _HAS_EXCEPTIONS: u32 = 1;
-pub const _STL_LANG: u32 = 0;
-pub const _HAS_CXX17: u32 = 0;
-pub const _HAS_CXX20: u32 = 0;
-pub const _HAS_CXX23: u32 = 0;
-pub const _HAS_NODISCARD: u32 = 0;
-pub const WCHAR_MIN: u32 = 0;
-pub const WCHAR_MAX: u32 = 65535;
-pub const WINT_MIN: u32 = 0;
-pub const WINT_MAX: u32 = 65535;
-pub const _ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE: u32 = 1;
-pub const _CRT_BUILD_DESKTOP_APP: u32 = 1;
-pub const _ARGMAX: u32 = 100;
-pub const _CRT_INT_MAX: u32 = 2147483647;
-pub const _CRT_FUNCTIONS_REQUIRED: u32 = 1;
-pub const _CRT_HAS_CXX17: u32 = 0;
-pub const _CRT_HAS_C11: u32 = 1;
-pub const _CRT_INTERNAL_NONSTDC_NAMES: u32 = 1;
-pub const __STDC_SECURE_LIB__: u32 = 200411;
-pub const __GOT_SECURE_LIB__: u32 = 200411;
-pub const __STDC_WANT_SECURE_LIB__: u32 = 1;
-pub const _SECURECRT_FILL_BUFFER_PATTERN: u32 = 254;
-pub const _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES: u32 = 0;
-pub const _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT: u32 = 0;
-pub const _CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES: u32 = 1;
-pub const _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_MEMORY: u32 = 0;
-pub const _CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES_MEMORY: u32 = 0;
-pub type va_list = *mut ::std::os::raw::c_char;
-unsafe extern "C" {
- pub fn __va_start(arg1: *mut *mut ::std::os::raw::c_char, ...);
-}
-pub type __vcrt_bool = bool;
-pub type wchar_t = ::std::os::raw::c_ushort;
-unsafe extern "C" {
- pub fn __security_init_cookie();
-}
-unsafe extern "C" {
- pub fn __security_check_cookie(_StackCookie: usize);
-}
-unsafe extern "C" {
- pub fn __report_gsfailure(_StackCookie: usize) -> !;
-}
-unsafe extern "C" {
- pub static mut __security_cookie: usize;
-}
-pub type int_least8_t = ::std::os::raw::c_schar;
-pub type int_least16_t = ::std::os::raw::c_short;
-pub type int_least32_t = ::std::os::raw::c_int;
-pub type int_least64_t = ::std::os::raw::c_longlong;
-pub type uint_least8_t = ::std::os::raw::c_uchar;
-pub type uint_least16_t = ::std::os::raw::c_ushort;
-pub type uint_least32_t = ::std::os::raw::c_uint;
-pub type uint_least64_t = ::std::os::raw::c_ulonglong;
-pub type int_fast8_t = ::std::os::raw::c_schar;
-pub type int_fast16_t = ::std::os::raw::c_int;
-pub type int_fast32_t = ::std::os::raw::c_int;
-pub type int_fast64_t = ::std::os::raw::c_longlong;
-pub type uint_fast8_t = ::std::os::raw::c_uchar;
-pub type uint_fast16_t = ::std::os::raw::c_uint;
-pub type uint_fast32_t = ::std::os::raw::c_uint;
-pub type uint_fast64_t = ::std::os::raw::c_ulonglong;
-pub type intmax_t = ::std::os::raw::c_longlong;
-pub type uintmax_t = ::std::os::raw::c_ulonglong;
-pub type __crt_bool = bool;
-unsafe extern "C" {
- pub fn _invalid_parameter_noinfo();
-}
-unsafe extern "C" {
- pub fn _invalid_parameter_noinfo_noreturn() -> !;
-}
-unsafe extern "C" {
- pub fn _invoke_watson(
- _Expression: *const wchar_t,
- _FunctionName: *const wchar_t,
- _FileName: *const wchar_t,
- _LineNo: ::std::os::raw::c_uint,
- _Reserved: usize,
- ) -> !;
-}
-pub type errno_t = ::std::os::raw::c_int;
-pub type wint_t = ::std::os::raw::c_ushort;
-pub type wctype_t = ::std::os::raw::c_ushort;
-pub type __time32_t = ::std::os::raw::c_long;
-pub type __time64_t = ::std::os::raw::c_longlong;
-#[repr(C)]
-#[derive(Debug, Copy, Clone)]
-pub struct __crt_locale_data_public {
- pub _locale_pctype: *const ::std::os::raw::c_ushort,
- pub _locale_mb_cur_max: ::std::os::raw::c_int,
- pub _locale_lc_codepage: ::std::os::raw::c_uint,
-}
-#[allow(clippy::unnecessary_operation, clippy::identity_op)]
-const _: () = {
- ["Size of __crt_locale_data_public"]
- [::std::mem::size_of::<__crt_locale_data_public>() - 16usize];
- ["Alignment of __crt_locale_data_public"]
- [::std::mem::align_of::<__crt_locale_data_public>() - 8usize];
- ["Offset of field: __crt_locale_data_public::_locale_pctype"]
- [::std::mem::offset_of!(__crt_locale_data_public, _locale_pctype) -
0usize];
- ["Offset of field: __crt_locale_data_public::_locale_mb_cur_max"]
- [::std::mem::offset_of!(__crt_locale_data_public, _locale_mb_cur_max)
- 8usize];
- ["Offset of field: __crt_locale_data_public::_locale_lc_codepage"]
- [::std::mem::offset_of!(__crt_locale_data_public, _locale_lc_codepage)
- 12usize];
-};
-#[repr(C)]
-#[derive(Debug, Copy, Clone)]
-pub struct __crt_locale_pointers {
- pub locinfo: *mut __crt_locale_data,
- pub mbcinfo: *mut __crt_multibyte_data,
-}
-#[allow(clippy::unnecessary_operation, clippy::identity_op)]
-const _: () = {
- ["Size of
__crt_locale_pointers"][::std::mem::size_of::<__crt_locale_pointers>() -
16usize];
- ["Alignment of __crt_locale_pointers"]
- [::std::mem::align_of::<__crt_locale_pointers>() - 8usize];
- ["Offset of field: __crt_locale_pointers::locinfo"]
- [::std::mem::offset_of!(__crt_locale_pointers, locinfo) - 0usize];
- ["Offset of field: __crt_locale_pointers::mbcinfo"]
- [::std::mem::offset_of!(__crt_locale_pointers, mbcinfo) - 8usize];
-};
-pub type _locale_t = *mut __crt_locale_pointers;
-#[repr(C)]
-#[derive(Debug, Copy, Clone)]
-pub struct _Mbstatet {
- pub _Wchar: ::std::os::raw::c_ulong,
- pub _Byte: ::std::os::raw::c_ushort,
- pub _State: ::std::os::raw::c_ushort,
-}
-#[allow(clippy::unnecessary_operation, clippy::identity_op)]
-const _: () = {
- ["Size of _Mbstatet"][::std::mem::size_of::<_Mbstatet>() - 8usize];
- ["Alignment of _Mbstatet"][::std::mem::align_of::<_Mbstatet>() - 4usize];
- ["Offset of field: _Mbstatet::_Wchar"][::std::mem::offset_of!(_Mbstatet,
_Wchar) - 0usize];
- ["Offset of field: _Mbstatet::_Byte"][::std::mem::offset_of!(_Mbstatet,
_Byte) - 4usize];
- ["Offset of field: _Mbstatet::_State"][::std::mem::offset_of!(_Mbstatet,
_State) - 6usize];
-};
-pub type mbstate_t = _Mbstatet;
-pub type time_t = __time64_t;
-pub type rsize_t = usize;
-unsafe extern "C" {
- pub fn _errno() -> *mut ::std::os::raw::c_int;
-}
-unsafe extern "C" {
- pub fn _set_errno(_Value: ::std::os::raw::c_int) -> errno_t;
-}
-unsafe extern "C" {
- pub fn _get_errno(_Value: *mut ::std::os::raw::c_int) -> errno_t;
-}
-unsafe extern "C" {
- pub fn __threadid() -> ::std::os::raw::c_ulong;
-}
-unsafe extern "C" {
- pub fn __threadhandle() -> usize;
-}
-#[repr(C)]
-#[derive(Debug, Copy, Clone)]
-pub struct tg_point {
- pub x: f64,
- pub y: f64,
-}
-#[allow(clippy::unnecessary_operation, clippy::identity_op)]
-const _: () = {
- ["Size of tg_point"][::std::mem::size_of::<tg_point>() - 16usize];
- ["Alignment of tg_point"][::std::mem::align_of::<tg_point>() - 8usize];
- ["Offset of field: tg_point::x"][::std::mem::offset_of!(tg_point, x) -
0usize];
- ["Offset of field: tg_point::y"][::std::mem::offset_of!(tg_point, y) -
8usize];
-};
-#[repr(C)]
-#[derive(Debug, Copy, Clone)]
-pub struct tg_segment {
- pub a: tg_point,
- pub b: tg_point,
-}
-#[allow(clippy::unnecessary_operation, clippy::identity_op)]
-const _: () = {
- ["Size of tg_segment"][::std::mem::size_of::<tg_segment>() - 32usize];
- ["Alignment of tg_segment"][::std::mem::align_of::<tg_segment>() - 8usize];
- ["Offset of field: tg_segment::a"][::std::mem::offset_of!(tg_segment, a) -
0usize];
- ["Offset of field: tg_segment::b"][::std::mem::offset_of!(tg_segment, b) -
16usize];
-};
-#[repr(C)]
-#[derive(Debug, Copy, Clone)]
-pub struct tg_rect {
- pub min: tg_point,
- pub max: tg_point,
-}
-#[allow(clippy::unnecessary_operation, clippy::identity_op)]
-const _: () = {
- ["Size of tg_rect"][::std::mem::size_of::<tg_rect>() - 32usize];
- ["Alignment of tg_rect"][::std::mem::align_of::<tg_rect>() - 8usize];
- ["Offset of field: tg_rect::min"][::std::mem::offset_of!(tg_rect, min) -
0usize];
- ["Offset of field: tg_rect::max"][::std::mem::offset_of!(tg_rect, max) -
16usize];
-};
-#[repr(C)]
-#[derive(Debug, Copy, Clone)]
-pub struct tg_line {
- _unused: [u8; 0],
-}
-#[repr(C)]
-#[derive(Debug, Copy, Clone)]
-pub struct tg_ring {
- _unused: [u8; 0],
-}
-#[repr(C)]
-#[derive(Debug, Copy, Clone)]
-pub struct tg_poly {
- _unused: [u8; 0],
-}
-#[repr(C)]
-#[derive(Debug, Copy, Clone)]
-pub struct tg_geom {
- _unused: [u8; 0],
-}
-pub const tg_geom_type_TG_POINT: tg_geom_type = 1;
-pub const tg_geom_type_TG_LINESTRING: tg_geom_type = 2;
-pub const tg_geom_type_TG_POLYGON: tg_geom_type = 3;
-pub const tg_geom_type_TG_MULTIPOINT: tg_geom_type = 4;
-pub const tg_geom_type_TG_MULTILINESTRING: tg_geom_type = 5;
-pub const tg_geom_type_TG_MULTIPOLYGON: tg_geom_type = 6;
-pub const tg_geom_type_TG_GEOMETRYCOLLECTION: tg_geom_type = 7;
-pub type tg_geom_type = ::std::os::raw::c_int;
-pub const tg_index_TG_DEFAULT: tg_index = 0;
-pub const tg_index_TG_NONE: tg_index = 1;
-pub const tg_index_TG_NATURAL: tg_index = 2;
-pub const tg_index_TG_YSTRIPES: tg_index = 3;
-pub type tg_index = ::std::os::raw::c_int;
-unsafe extern "C" {
- pub fn tg_geom_new_point(point: tg_point) -> *mut tg_geom;
-}
-unsafe extern "C" {
- pub fn tg_geom_new_linestring(line: *const tg_line) -> *mut tg_geom;
-}
-unsafe extern "C" {
- pub fn tg_geom_new_polygon(poly: *const tg_poly) -> *mut tg_geom;
-}
-unsafe extern "C" {
- pub fn tg_geom_new_multipoint(
- points: *const tg_point,
- npoints: ::std::os::raw::c_int,
- ) -> *mut tg_geom;
-}
-unsafe extern "C" {
- pub fn tg_geom_new_multilinestring(
- lines: *const *const tg_line,
- nlines: ::std::os::raw::c_int,
- ) -> *mut tg_geom;
-}
-unsafe extern "C" {
- pub fn tg_geom_new_multipolygon(
- polys: *const *const tg_poly,
- npolys: ::std::os::raw::c_int,
- ) -> *mut tg_geom;
-}
-unsafe extern "C" {
- pub fn tg_geom_new_geometrycollection(
- geoms: *const *const tg_geom,
- ngeoms: ::std::os::raw::c_int,
- ) -> *mut tg_geom;
-}
-unsafe extern "C" {
- pub fn tg_geom_new_error(errmsg: *const ::std::os::raw::c_char) -> *mut
tg_geom;
-}
-unsafe extern "C" {
- pub fn tg_geom_clone(geom: *const tg_geom) -> *mut tg_geom;
-}
-unsafe extern "C" {
- pub fn tg_geom_copy(geom: *const tg_geom) -> *mut tg_geom;
-}
-unsafe extern "C" {
- pub fn tg_geom_free(geom: *mut tg_geom);
-}
-unsafe extern "C" {
- pub fn tg_geom_typeof(geom: *const tg_geom) -> tg_geom_type;
-}
-unsafe extern "C" {
- pub fn tg_geom_type_string(type_: tg_geom_type) -> *const
::std::os::raw::c_char;
-}
-unsafe extern "C" {
- pub fn tg_geom_rect(geom: *const tg_geom) -> tg_rect;
-}
-unsafe extern "C" {
- pub fn tg_geom_is_feature(geom: *const tg_geom) -> bool;
-}
-unsafe extern "C" {
- pub fn tg_geom_is_featurecollection(geom: *const tg_geom) -> bool;
-}
-unsafe extern "C" {
- pub fn tg_geom_point(geom: *const tg_geom) -> tg_point;
-}
-unsafe extern "C" {
- pub fn tg_geom_line(geom: *const tg_geom) -> *const tg_line;
-}
-unsafe extern "C" {
- pub fn tg_geom_poly(geom: *const tg_geom) -> *const tg_poly;
-}
-unsafe extern "C" {
- pub fn tg_geom_num_points(geom: *const tg_geom) -> ::std::os::raw::c_int;
-}
-unsafe extern "C" {
- pub fn tg_geom_point_at(geom: *const tg_geom, index:
::std::os::raw::c_int) -> tg_point;
-}
-unsafe extern "C" {
- pub fn tg_geom_num_lines(geom: *const tg_geom) -> ::std::os::raw::c_int;
-}
-unsafe extern "C" {
- pub fn tg_geom_line_at(geom: *const tg_geom, index: ::std::os::raw::c_int)
-> *const tg_line;
-}
-unsafe extern "C" {
- pub fn tg_geom_num_polys(geom: *const tg_geom) -> ::std::os::raw::c_int;
-}
-unsafe extern "C" {
- pub fn tg_geom_poly_at(geom: *const tg_geom, index: ::std::os::raw::c_int)
-> *const tg_poly;
-}
-unsafe extern "C" {
- pub fn tg_geom_num_geometries(geom: *const tg_geom) ->
::std::os::raw::c_int;
-}
-unsafe extern "C" {
- pub fn tg_geom_geometry_at(
- geom: *const tg_geom,
- index: ::std::os::raw::c_int,
- ) -> *const tg_geom;
-}
-unsafe extern "C" {
- pub fn tg_geom_extra_json(geom: *const tg_geom) -> *const
::std::os::raw::c_char;
-}
-unsafe extern "C" {
- pub fn tg_geom_is_empty(geom: *const tg_geom) -> bool;
-}
-unsafe extern "C" {
- pub fn tg_geom_dims(geom: *const tg_geom) -> ::std::os::raw::c_int;
-}
-unsafe extern "C" {
- pub fn tg_geom_has_z(geom: *const tg_geom) -> bool;
-}
-unsafe extern "C" {
- pub fn tg_geom_has_m(geom: *const tg_geom) -> bool;
-}
-unsafe extern "C" {
- pub fn tg_geom_z(geom: *const tg_geom) -> f64;
-}
-unsafe extern "C" {
- pub fn tg_geom_m(geom: *const tg_geom) -> f64;
-}
-unsafe extern "C" {
- pub fn tg_geom_extra_coords(geom: *const tg_geom) -> *const f64;
-}
-unsafe extern "C" {
- pub fn tg_geom_num_extra_coords(geom: *const tg_geom) ->
::std::os::raw::c_int;
-}
-unsafe extern "C" {
- pub fn tg_geom_memsize(geom: *const tg_geom) -> usize;
-}
-unsafe extern "C" {
- pub fn tg_geom_search(
- geom: *const tg_geom,
- rect: tg_rect,
- iter: ::std::option::Option<
- unsafe extern "C" fn(
- geom: *const tg_geom,
- index: ::std::os::raw::c_int,
- udata: *mut ::std::os::raw::c_void,
- ) -> bool,
- >,
- udata: *mut ::std::os::raw::c_void,
- );
-}
-unsafe extern "C" {
- pub fn tg_geom_fullrect(
- geom: *const tg_geom,
- min: *mut f64,
- max: *mut f64,
- ) -> ::std::os::raw::c_int;
-}
-unsafe extern "C" {
- pub fn tg_geom_equals(a: *const tg_geom, b: *const tg_geom) -> bool;
-}
-unsafe extern "C" {
- pub fn tg_geom_intersects(a: *const tg_geom, b: *const tg_geom) -> bool;
-}
-unsafe extern "C" {
- pub fn tg_geom_disjoint(a: *const tg_geom, b: *const tg_geom) -> bool;
-}
-unsafe extern "C" {
- pub fn tg_geom_contains(a: *const tg_geom, b: *const tg_geom) -> bool;
-}
-unsafe extern "C" {
- pub fn tg_geom_within(a: *const tg_geom, b: *const tg_geom) -> bool;
-}
-unsafe extern "C" {
- pub fn tg_geom_covers(a: *const tg_geom, b: *const tg_geom) -> bool;
-}
-unsafe extern "C" {
- pub fn tg_geom_coveredby(a: *const tg_geom, b: *const tg_geom) -> bool;
-}
-unsafe extern "C" {
- pub fn tg_geom_touches(a: *const tg_geom, b: *const tg_geom) -> bool;
-}
-unsafe extern "C" {
- pub fn tg_geom_intersects_rect(a: *const tg_geom, b: tg_rect) -> bool;
-}
-unsafe extern "C" {
- pub fn tg_geom_intersects_xy(a: *const tg_geom, x: f64, y: f64) -> bool;
-}
-unsafe extern "C" {
- pub fn tg_parse_geojson(geojson: *const ::std::os::raw::c_char) -> *mut
tg_geom;
-}
-unsafe extern "C" {
- pub fn tg_parse_geojsonn(geojson: *const ::std::os::raw::c_char, len:
usize) -> *mut tg_geom;
-}
-unsafe extern "C" {
- pub fn tg_parse_geojson_ix(
- geojson: *const ::std::os::raw::c_char,
- ix: tg_index,
- ) -> *mut tg_geom;
-}
-unsafe extern "C" {
- pub fn tg_parse_geojsonn_ix(
- geojson: *const ::std::os::raw::c_char,
- len: usize,
- ix: tg_index,
- ) -> *mut tg_geom;
-}
-unsafe extern "C" {
- pub fn tg_parse_wkt(wkt: *const ::std::os::raw::c_char) -> *mut tg_geom;
-}
-unsafe extern "C" {
- pub fn tg_parse_wktn(wkt: *const ::std::os::raw::c_char, len: usize) ->
*mut tg_geom;
-}
-unsafe extern "C" {
- pub fn tg_parse_wkt_ix(wkt: *const ::std::os::raw::c_char, ix: tg_index)
-> *mut tg_geom;
-}
-unsafe extern "C" {
- pub fn tg_parse_wktn_ix(
- wkt: *const ::std::os::raw::c_char,
- len: usize,
- ix: tg_index,
- ) -> *mut tg_geom;
-}
-unsafe extern "C" {
- pub fn tg_parse_wkb(wkb: *const u8, len: usize) -> *mut tg_geom;
-}
-unsafe extern "C" {
- pub fn tg_parse_wkb_ix(wkb: *const u8, len: usize, ix: tg_index) -> *mut
tg_geom;
-}
-unsafe extern "C" {
- pub fn tg_parse_hex(hex: *const ::std::os::raw::c_char) -> *mut tg_geom;
-}
-unsafe extern "C" {
- pub fn tg_parse_hexn(hex: *const ::std::os::raw::c_char, len: usize) ->
*mut tg_geom;
-}
-unsafe extern "C" {
- pub fn tg_parse_hex_ix(hex: *const ::std::os::raw::c_char, ix: tg_index)
-> *mut tg_geom;
-}
-unsafe extern "C" {
- pub fn tg_parse_hexn_ix(
- hex: *const ::std::os::raw::c_char,
- len: usize,
- ix: tg_index,
- ) -> *mut tg_geom;
-}
-unsafe extern "C" {
- pub fn tg_parse_geobin(geobin: *const u8, len: usize) -> *mut tg_geom;
-}
-unsafe extern "C" {
- pub fn tg_parse_geobin_ix(geobin: *const u8, len: usize, ix: tg_index) ->
*mut tg_geom;
-}
-unsafe extern "C" {
- pub fn tg_parse(data: *const ::std::os::raw::c_void, len: usize) -> *mut
tg_geom;
-}
-unsafe extern "C" {
- pub fn tg_parse_ix(
- data: *const ::std::os::raw::c_void,
- len: usize,
- ix: tg_index,
- ) -> *mut tg_geom;
-}
-unsafe extern "C" {
- pub fn tg_geom_error(geom: *const tg_geom) -> *const
::std::os::raw::c_char;
-}
-unsafe extern "C" {
- pub fn tg_geobin_fullrect(
- geobin: *const u8,
- len: usize,
- min: *mut f64,
- max: *mut f64,
- ) -> ::std::os::raw::c_int;
-}
-unsafe extern "C" {
- pub fn tg_geobin_rect(geobin: *const u8, len: usize) -> tg_rect;
-}
-unsafe extern "C" {
- pub fn tg_geobin_point(geobin: *const u8, len: usize) -> tg_point;
-}
-unsafe extern "C" {
- pub fn tg_geom_geojson(
- geom: *const tg_geom,
- dst: *mut ::std::os::raw::c_char,
- n: usize,
- ) -> usize;
-}
-unsafe extern "C" {
- pub fn tg_geom_wkt(geom: *const tg_geom, dst: *mut ::std::os::raw::c_char,
n: usize) -> usize;
-}
-unsafe extern "C" {
- pub fn tg_geom_wkb(geom: *const tg_geom, dst: *mut u8, n: usize) -> usize;
-}
-unsafe extern "C" {
- pub fn tg_geom_hex(geom: *const tg_geom, dst: *mut ::std::os::raw::c_char,
n: usize) -> usize;
-}
-unsafe extern "C" {
- pub fn tg_geom_geobin(geom: *const tg_geom, dst: *mut u8, n: usize) ->
usize;
-}
-unsafe extern "C" {
- pub fn tg_geom_new_point_z(point: tg_point, z: f64) -> *mut tg_geom;
-}
-unsafe extern "C" {
- pub fn tg_geom_new_point_m(point: tg_point, m: f64) -> *mut tg_geom;
-}
-unsafe extern "C" {
- pub fn tg_geom_new_point_zm(point: tg_point, z: f64, m: f64) -> *mut
tg_geom;
-}
-unsafe extern "C" {
- pub fn tg_geom_new_point_empty() -> *mut tg_geom;
-}
-unsafe extern "C" {
- pub fn tg_geom_new_linestring_z(
- line: *const tg_line,
- extra_coords: *const f64,
- ncoords: ::std::os::raw::c_int,
- ) -> *mut tg_geom;
-}
-unsafe extern "C" {
- pub fn tg_geom_new_linestring_m(
- line: *const tg_line,
- extra_coords: *const f64,
- ncoords: ::std::os::raw::c_int,
- ) -> *mut tg_geom;
-}
-unsafe extern "C" {
- pub fn tg_geom_new_linestring_zm(
- line: *const tg_line,
- extra_coords: *const f64,
- ncoords: ::std::os::raw::c_int,
- ) -> *mut tg_geom;
-}
-unsafe extern "C" {
- pub fn tg_geom_new_linestring_empty() -> *mut tg_geom;
-}
-unsafe extern "C" {
- pub fn tg_geom_new_polygon_z(
- poly: *const tg_poly,
- extra_coords: *const f64,
- ncoords: ::std::os::raw::c_int,
- ) -> *mut tg_geom;
-}
-unsafe extern "C" {
- pub fn tg_geom_new_polygon_m(
- poly: *const tg_poly,
- extra_coords: *const f64,
- ncoords: ::std::os::raw::c_int,
- ) -> *mut tg_geom;
-}
-unsafe extern "C" {
- pub fn tg_geom_new_polygon_zm(
- poly: *const tg_poly,
- extra_coords: *const f64,
- ncoords: ::std::os::raw::c_int,
- ) -> *mut tg_geom;
-}
-unsafe extern "C" {
- pub fn tg_geom_new_polygon_empty() -> *mut tg_geom;
-}
-unsafe extern "C" {
- pub fn tg_geom_new_multipoint_z(
- points: *const tg_point,
- npoints: ::std::os::raw::c_int,
- extra_coords: *const f64,
- ncoords: ::std::os::raw::c_int,
- ) -> *mut tg_geom;
-}
-unsafe extern "C" {
- pub fn tg_geom_new_multipoint_m(
- points: *const tg_point,
- npoints: ::std::os::raw::c_int,
- extra_coords: *const f64,
- ncoords: ::std::os::raw::c_int,
- ) -> *mut tg_geom;
-}
-unsafe extern "C" {
- pub fn tg_geom_new_multipoint_zm(
- points: *const tg_point,
- npoints: ::std::os::raw::c_int,
- extra_coords: *const f64,
- ncoords: ::std::os::raw::c_int,
- ) -> *mut tg_geom;
-}
-unsafe extern "C" {
- pub fn tg_geom_new_multipoint_empty() -> *mut tg_geom;
-}
-unsafe extern "C" {
- pub fn tg_geom_new_multilinestring_z(
- lines: *const *const tg_line,
- nlines: ::std::os::raw::c_int,
- extra_coords: *const f64,
- ncoords: ::std::os::raw::c_int,
- ) -> *mut tg_geom;
-}
-unsafe extern "C" {
- pub fn tg_geom_new_multilinestring_m(
- lines: *const *const tg_line,
- nlines: ::std::os::raw::c_int,
- extra_coords: *const f64,
- ncoords: ::std::os::raw::c_int,
- ) -> *mut tg_geom;
-}
-unsafe extern "C" {
- pub fn tg_geom_new_multilinestring_zm(
- lines: *const *const tg_line,
- nlines: ::std::os::raw::c_int,
- extra_coords: *const f64,
- ncoords: ::std::os::raw::c_int,
- ) -> *mut tg_geom;
-}
-unsafe extern "C" {
- pub fn tg_geom_new_multilinestring_empty() -> *mut tg_geom;
-}
-unsafe extern "C" {
- pub fn tg_geom_new_multipolygon_z(
- polys: *const *const tg_poly,
- npolys: ::std::os::raw::c_int,
- extra_coords: *const f64,
- ncoords: ::std::os::raw::c_int,
- ) -> *mut tg_geom;
-}
-unsafe extern "C" {
- pub fn tg_geom_new_multipolygon_m(
- polys: *const *const tg_poly,
- npolys: ::std::os::raw::c_int,
- extra_coords: *const f64,
- ncoords: ::std::os::raw::c_int,
- ) -> *mut tg_geom;
-}
-unsafe extern "C" {
- pub fn tg_geom_new_multipolygon_zm(
- polys: *const *const tg_poly,
- npolys: ::std::os::raw::c_int,
- extra_coords: *const f64,
- ncoords: ::std::os::raw::c_int,
- ) -> *mut tg_geom;
-}
-unsafe extern "C" {
- pub fn tg_geom_new_multipolygon_empty() -> *mut tg_geom;
-}
-unsafe extern "C" {
- pub fn tg_geom_new_geometrycollection_empty() -> *mut tg_geom;
-}
-unsafe extern "C" {
- pub fn tg_point_rect(point: tg_point) -> tg_rect;
-}
-unsafe extern "C" {
- pub fn tg_point_intersects_rect(a: tg_point, b: tg_rect) -> bool;
-}
-unsafe extern "C" {
- pub fn tg_segment_rect(s: tg_segment) -> tg_rect;
-}
-unsafe extern "C" {
- pub fn tg_segment_intersects_segment(a: tg_segment, b: tg_segment) -> bool;
-}
-unsafe extern "C" {
- pub fn tg_rect_expand(rect: tg_rect, other: tg_rect) -> tg_rect;
-}
-unsafe extern "C" {
- pub fn tg_rect_expand_point(rect: tg_rect, point: tg_point) -> tg_rect;
-}
-unsafe extern "C" {
- pub fn tg_rect_center(rect: tg_rect) -> tg_point;
-}
-unsafe extern "C" {
- pub fn tg_rect_intersects_rect(a: tg_rect, b: tg_rect) -> bool;
-}
-unsafe extern "C" {
- pub fn tg_rect_intersects_point(a: tg_rect, b: tg_point) -> bool;
-}
-unsafe extern "C" {
- pub fn tg_ring_new(points: *const tg_point, npoints:
::std::os::raw::c_int) -> *mut tg_ring;
-}
-unsafe extern "C" {
- pub fn tg_ring_new_ix(
- points: *const tg_point,
- npoints: ::std::os::raw::c_int,
- ix: tg_index,
- ) -> *mut tg_ring;
-}
-unsafe extern "C" {
- pub fn tg_ring_free(ring: *mut tg_ring);
-}
-unsafe extern "C" {
- pub fn tg_ring_clone(ring: *const tg_ring) -> *mut tg_ring;
-}
-unsafe extern "C" {
- pub fn tg_ring_copy(ring: *const tg_ring) -> *mut tg_ring;
-}
-unsafe extern "C" {
- pub fn tg_ring_memsize(ring: *const tg_ring) -> usize;
-}
-unsafe extern "C" {
- pub fn tg_ring_rect(ring: *const tg_ring) -> tg_rect;
-}
-unsafe extern "C" {
- pub fn tg_ring_num_points(ring: *const tg_ring) -> ::std::os::raw::c_int;
-}
-unsafe extern "C" {
- pub fn tg_ring_point_at(ring: *const tg_ring, index:
::std::os::raw::c_int) -> tg_point;
-}
-unsafe extern "C" {
- pub fn tg_ring_points(ring: *const tg_ring) -> *const tg_point;
-}
-unsafe extern "C" {
- pub fn tg_ring_num_segments(ring: *const tg_ring) -> ::std::os::raw::c_int;
-}
-unsafe extern "C" {
- pub fn tg_ring_segment_at(ring: *const tg_ring, index:
::std::os::raw::c_int) -> tg_segment;
-}
-unsafe extern "C" {
- pub fn tg_ring_convex(ring: *const tg_ring) -> bool;
-}
-unsafe extern "C" {
- pub fn tg_ring_clockwise(ring: *const tg_ring) -> bool;
-}
-unsafe extern "C" {
- pub fn tg_ring_index_spread(ring: *const tg_ring) -> ::std::os::raw::c_int;
-}
-unsafe extern "C" {
- pub fn tg_ring_index_num_levels(ring: *const tg_ring) ->
::std::os::raw::c_int;
-}
-unsafe extern "C" {
- pub fn tg_ring_index_level_num_rects(
- ring: *const tg_ring,
- levelidx: ::std::os::raw::c_int,
- ) -> ::std::os::raw::c_int;
-}
-unsafe extern "C" {
- pub fn tg_ring_index_level_rect(
- ring: *const tg_ring,
- levelidx: ::std::os::raw::c_int,
- rectidx: ::std::os::raw::c_int,
- ) -> tg_rect;
-}
-unsafe extern "C" {
- pub fn tg_ring_nearest_segment(
- ring: *const tg_ring,
- rect_dist: ::std::option::Option<
- unsafe extern "C" fn(
- rect: tg_rect,
- more: *mut ::std::os::raw::c_int,
- udata: *mut ::std::os::raw::c_void,
- ) -> f64,
- >,
- seg_dist: ::std::option::Option<
- unsafe extern "C" fn(
- seg: tg_segment,
- more: *mut ::std::os::raw::c_int,
- udata: *mut ::std::os::raw::c_void,
- ) -> f64,
- >,
- iter: ::std::option::Option<
- unsafe extern "C" fn(
- seg: tg_segment,
- dist: f64,
- index: ::std::os::raw::c_int,
- udata: *mut ::std::os::raw::c_void,
- ) -> bool,
- >,
- udata: *mut ::std::os::raw::c_void,
- ) -> bool;
-}
-unsafe extern "C" {
- pub fn tg_ring_line_search(
- a: *const tg_ring,
- b: *const tg_line,
- iter: ::std::option::Option<
- unsafe extern "C" fn(
- aseg: tg_segment,
- aidx: ::std::os::raw::c_int,
- bseg: tg_segment,
- bidx: ::std::os::raw::c_int,
- udata: *mut ::std::os::raw::c_void,
- ) -> bool,
- >,
- udata: *mut ::std::os::raw::c_void,
- );
-}
-unsafe extern "C" {
- pub fn tg_ring_ring_search(
- a: *const tg_ring,
- b: *const tg_ring,
- iter: ::std::option::Option<
- unsafe extern "C" fn(
- aseg: tg_segment,
- aidx: ::std::os::raw::c_int,
- bseg: tg_segment,
- bidx: ::std::os::raw::c_int,
- udata: *mut ::std::os::raw::c_void,
- ) -> bool,
- >,
- udata: *mut ::std::os::raw::c_void,
- );
-}
-unsafe extern "C" {
- pub fn tg_ring_area(ring: *const tg_ring) -> f64;
-}
-unsafe extern "C" {
- pub fn tg_ring_perimeter(ring: *const tg_ring) -> f64;
-}
-unsafe extern "C" {
- pub fn tg_line_new(points: *const tg_point, npoints:
::std::os::raw::c_int) -> *mut tg_line;
-}
-unsafe extern "C" {
- pub fn tg_line_new_ix(
- points: *const tg_point,
- npoints: ::std::os::raw::c_int,
- ix: tg_index,
- ) -> *mut tg_line;
-}
-unsafe extern "C" {
- pub fn tg_line_free(line: *mut tg_line);
-}
-unsafe extern "C" {
- pub fn tg_line_clone(line: *const tg_line) -> *mut tg_line;
-}
-unsafe extern "C" {
- pub fn tg_line_copy(line: *const tg_line) -> *mut tg_line;
-}
-unsafe extern "C" {
- pub fn tg_line_memsize(line: *const tg_line) -> usize;
-}
-unsafe extern "C" {
- pub fn tg_line_rect(line: *const tg_line) -> tg_rect;
-}
-unsafe extern "C" {
- pub fn tg_line_num_points(line: *const tg_line) -> ::std::os::raw::c_int;
-}
-unsafe extern "C" {
- pub fn tg_line_points(line: *const tg_line) -> *const tg_point;
-}
-unsafe extern "C" {
- pub fn tg_line_point_at(line: *const tg_line, index:
::std::os::raw::c_int) -> tg_point;
-}
-unsafe extern "C" {
- pub fn tg_line_num_segments(line: *const tg_line) -> ::std::os::raw::c_int;
-}
-unsafe extern "C" {
- pub fn tg_line_segment_at(line: *const tg_line, index:
::std::os::raw::c_int) -> tg_segment;
-}
-unsafe extern "C" {
- pub fn tg_line_clockwise(line: *const tg_line) -> bool;
-}
-unsafe extern "C" {
- pub fn tg_line_index_spread(line: *const tg_line) -> ::std::os::raw::c_int;
-}
-unsafe extern "C" {
- pub fn tg_line_index_num_levels(line: *const tg_line) ->
::std::os::raw::c_int;
-}
-unsafe extern "C" {
- pub fn tg_line_index_level_num_rects(
- line: *const tg_line,
- levelidx: ::std::os::raw::c_int,
- ) -> ::std::os::raw::c_int;
-}
-unsafe extern "C" {
- pub fn tg_line_index_level_rect(
- line: *const tg_line,
- levelidx: ::std::os::raw::c_int,
- rectidx: ::std::os::raw::c_int,
- ) -> tg_rect;
-}
-unsafe extern "C" {
- pub fn tg_line_nearest_segment(
- line: *const tg_line,
- rect_dist: ::std::option::Option<
- unsafe extern "C" fn(
- rect: tg_rect,
- more: *mut ::std::os::raw::c_int,
- udata: *mut ::std::os::raw::c_void,
- ) -> f64,
- >,
- seg_dist: ::std::option::Option<
- unsafe extern "C" fn(
- seg: tg_segment,
- more: *mut ::std::os::raw::c_int,
- udata: *mut ::std::os::raw::c_void,
- ) -> f64,
- >,
- iter: ::std::option::Option<
- unsafe extern "C" fn(
- seg: tg_segment,
- dist: f64,
- index: ::std::os::raw::c_int,
- udata: *mut ::std::os::raw::c_void,
- ) -> bool,
- >,
- udata: *mut ::std::os::raw::c_void,
- ) -> bool;
-}
-unsafe extern "C" {
- pub fn tg_line_line_search(
- a: *const tg_line,
- b: *const tg_line,
- iter: ::std::option::Option<
- unsafe extern "C" fn(
- aseg: tg_segment,
- aidx: ::std::os::raw::c_int,
- bseg: tg_segment,
- bidx: ::std::os::raw::c_int,
- udata: *mut ::std::os::raw::c_void,
- ) -> bool,
- >,
- udata: *mut ::std::os::raw::c_void,
- );
-}
-unsafe extern "C" {
- pub fn tg_line_length(line: *const tg_line) -> f64;
-}
-unsafe extern "C" {
- pub fn tg_poly_new(
- exterior: *const tg_ring,
- holes: *const *const tg_ring,
- nholes: ::std::os::raw::c_int,
- ) -> *mut tg_poly;
-}
-unsafe extern "C" {
- pub fn tg_poly_free(poly: *mut tg_poly);
-}
-unsafe extern "C" {
- pub fn tg_poly_clone(poly: *const tg_poly) -> *mut tg_poly;
-}
-unsafe extern "C" {
- pub fn tg_poly_copy(poly: *const tg_poly) -> *mut tg_poly;
-}
-unsafe extern "C" {
- pub fn tg_poly_memsize(poly: *const tg_poly) -> usize;
-}
-unsafe extern "C" {
- pub fn tg_poly_exterior(poly: *const tg_poly) -> *const tg_ring;
-}
-unsafe extern "C" {
- pub fn tg_poly_num_holes(poly: *const tg_poly) -> ::std::os::raw::c_int;
-}
-unsafe extern "C" {
- pub fn tg_poly_hole_at(poly: *const tg_poly, index: ::std::os::raw::c_int)
-> *const tg_ring;
-}
-unsafe extern "C" {
- pub fn tg_poly_rect(poly: *const tg_poly) -> tg_rect;
-}
-unsafe extern "C" {
- pub fn tg_poly_clockwise(poly: *const tg_poly) -> bool;
-}
-unsafe extern "C" {
- pub fn tg_env_set_allocator(
- malloc: ::std::option::Option<
- unsafe extern "C" fn(arg1: usize) -> *mut ::std::os::raw::c_void,
- >,
- realloc: ::std::option::Option<
- unsafe extern "C" fn(
- arg1: *mut ::std::os::raw::c_void,
- arg2: usize,
- ) -> *mut ::std::os::raw::c_void,
- >,
- free: ::std::option::Option<unsafe extern "C" fn(arg1: *mut
::std::os::raw::c_void)>,
- );
-}
-unsafe extern "C" {
- pub fn tg_env_set_index(ix: tg_index);
-}
-unsafe extern "C" {
- pub fn tg_env_set_index_spread(spread: ::std::os::raw::c_int);
-}
-unsafe extern "C" {
- pub fn tg_env_set_print_fixed_floats(print: bool);
-}
-#[repr(C)]
-#[derive(Debug, Copy, Clone)]
-pub struct __crt_locale_data {
- pub _address: u8,
-}
-#[repr(C)]
-#[derive(Debug, Copy, Clone)]
-pub struct __crt_multibyte_data {
- pub _address: u8,
-}
diff --git a/c/sedona-tg/src/tg_bindgen.rs b/c/sedona-tg/src/tg_bindgen.rs
index 8810e77..1474dce 100644
--- a/c/sedona-tg/src/tg_bindgen.rs
+++ b/c/sedona-tg/src/tg_bindgen.rs
@@ -16,7 +16,51 @@
// under the License.
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
-#![allow(non_snake_case)]
-#![allow(dead_code)]
-include!(env!("BINDINGS_PATH"));
+use std::os::raw::{c_char, c_void};
+
+#[cfg(target_env = "msvc")]
+use std::os::raw::c_int;
+
+#[cfg(target_env = "msvc")]
+pub type tg_index = c_int;
+
+#[cfg(not(target_env = "msvc"))]
+use std::os::raw::c_uint;
+
+#[cfg(not(target_env = "msvc"))]
+pub type tg_index = c_uint;
+
+pub const tg_index_TG_NONE: tg_index = 1;
+pub const tg_index_TG_DEFAULT: tg_index = 0;
+pub const tg_index_TG_NATURAL: tg_index = 2;
+pub const tg_index_TG_YSTRIPES: tg_index = 3;
+
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct tg_geom {
+ _unused: [u8; 0],
+}
+
+unsafe extern "C" {
+ pub fn tg_geom_free(geom: *mut tg_geom);
+ pub fn tg_parse_wktn_ix(wkt: *const c_char, len: usize, ix: tg_index) ->
*mut tg_geom;
+ pub fn tg_parse_wkb_ix(wkb: *const u8, len: usize, ix: tg_index) -> *mut
tg_geom;
+ pub fn tg_geom_error(geom: *const tg_geom) -> *const c_char;
+ pub fn tg_geom_wkb(geom: *const tg_geom, dst: *mut u8, n: usize) -> usize;
+ pub fn tg_geom_wkt(geom: *const tg_geom, dst: *mut c_char, n: usize) ->
usize;
+ pub fn tg_geom_memsize(geom: *const tg_geom) -> usize;
+ pub fn tg_geom_equals(a: *const tg_geom, b: *const tg_geom) -> bool;
+ pub fn tg_geom_intersects(a: *const tg_geom, b: *const tg_geom) -> bool;
+ pub fn tg_geom_disjoint(a: *const tg_geom, b: *const tg_geom) -> bool;
+ pub fn tg_geom_contains(a: *const tg_geom, b: *const tg_geom) -> bool;
+ pub fn tg_geom_within(a: *const tg_geom, b: *const tg_geom) -> bool;
+ pub fn tg_geom_covers(a: *const tg_geom, b: *const tg_geom) -> bool;
+ pub fn tg_geom_coveredby(a: *const tg_geom, b: *const tg_geom) -> bool;
+ pub fn tg_geom_touches(a: *const tg_geom, b: *const tg_geom) -> bool;
+ pub fn tg_env_set_allocator(
+ malloc: Option<unsafe extern "C" fn(arg1: usize) -> *mut c_void>,
+ realloc: Option<unsafe extern "C" fn(arg1: *mut c_void, arg2: usize)
-> *mut c_void>,
+ free: Option<unsafe extern "C" fn(arg1: *mut c_void)>,
+ );
+}