From 31335cfb0c00c17d7672e79518406e1efedb9555 Mon Sep 17 00:00:00 2001 From: Fatih Aytekin Date: Fri, 8 May 2020 02:35:11 +0300 Subject: [PATCH 01/13] Fix variable type --- geos.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/geos.c b/geos.c index 2c81428..7819999 100755 --- a/geos.c +++ b/geos.c @@ -863,7 +863,7 @@ PHP_METHOD(Geometry, buffer) GEOS_PHP_ZVAL data; HashTable *style; zend_string *key; - ulong index; + zend_ulong index; this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); @@ -956,7 +956,7 @@ PHP_METHOD(Geometry, offsetCurve) GEOS_PHP_ZVAL data; HashTable *style; zend_string *key; - ulong index; + zend_ulong index; this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); From 297aa28c8cead19c68fa9079bdfd31b4a9e70084 Mon Sep 17 00:00:00 2001 From: Fatih Aytekin Date: Fri, 8 May 2020 02:44:33 +0300 Subject: [PATCH 02/13] Fix test for 7.4 (int vs integer) --- tests/004_WKBWriter.phpt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/004_WKBWriter.phpt b/tests/004_WKBWriter.phpt index d2b3c85..3a72e2d 100644 --- a/tests/004_WKBWriter.phpt +++ b/tests/004_WKBWriter.phpt @@ -139,7 +139,7 @@ class WKBWriterTest extends GEOSTest $writer->write(1); $this->assertTrue(false); } catch (ErrorException $e) { - $this->assertContains('expects parameter 1 to be object, integer given', $e->getMessage()); + $this->assertContains('expects parameter 1 to be object, int', $e->getMessage()); } } @@ -151,7 +151,7 @@ class WKBWriterTest extends GEOSTest $writer->writeHEX(1); $this->assertTrue(false); } catch (ErrorException $e) { - $this->assertContains('expects parameter 1 to be object, integer given', $e->getMessage()); + $this->assertContains('expects parameter 1 to be object, int', $e->getMessage()); } } } From eb1cabcd83d52a76a86802022fa5ae77c7064de4 Mon Sep 17 00:00:00 2001 From: Fatih Aytekin Date: Fri, 8 May 2020 03:01:21 +0300 Subject: [PATCH 03/13] Fix error message with php 7+ --- geos.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/geos.c b/geos.c index 7819999..4593620 100755 --- a/geos.c +++ b/geos.c @@ -189,11 +189,19 @@ getRelay(zval* val, zend_class_entry* ce) { if ( proxy->std.ce != ce ) { php_error_docref(NULL TSRMLS_CC, E_ERROR, +#if PHP_VERSION_ID >= 70000 + "Relay object is not an %s", ZSTR_VAL(ce->name)); +#else "Relay object is not an %s", ce->name); +#endif } if ( ! proxy->relay ) { - php_error_docref(NULL TSRMLS_CC, E_ERROR, + php_error_docref(NULL TSRMLS_CC, E_ERROR, +#if PHP_VERSION_ID >= 70000 + "Relay object for object of type %s is not set", ZSTR_VAL(ce->name)); +#else "Relay object for object of type %s is not set", ce->name); +#endif } return proxy->relay; } From 21c3f974b2a53d6859ba36af8921ffc743809460 Mon Sep 17 00:00:00 2001 From: Fatih Aytekin Date: Fri, 8 May 2020 03:14:09 +0300 Subject: [PATCH 04/13] Update README.md --- README.md | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 5e32c9c..9e12f8b 100644 --- a/README.md +++ b/README.md @@ -1,36 +1,35 @@ -PHP module for GEOS +# PHP module for GEOS + =================== -[![build status] -(https://drone.osgeo.org/api/badges/geos/php-geos/status.svg?branch=master)] -(https://drone.osgeo.org/geos/php-geos?branch=master) +[![build status](https://drone.osgeo.org/api/badges/geos/php-geos/status.svg?branch=master)](https://drone.osgeo.org/geos/php-geos?branch=master) The code in this directory provides a PHP module to make use -of functionalities of the [GEOS library] (http://geos.osgeo.org). +of functionalities of the [GEOS library](http://geos.osgeo.org). The bindings are linked to the C-API, for betters stability. -# Building +## Building -## Requirements +### Requirements You need: - - PHP development files - ( often found in packages named something like 'php5-dev' ) +- PHP development files + ( often found in packages named something like 'php5-dev' ) - - GEOS development files - ( often found in packages named something like 'libgeos-dev' ) +- GEOS development files + ( often found in packages named something like 'libgeos-dev' ) -## Procedure +### Procedure - git clone https://git.osgeo.org/gitea/geos/php-geos.git + git clone https://github.com/libgeos/php-geos.git cd php-geos ./autogen.sh ./configure make # generates modules/geos.so -# Testing +## Testing Automated testing is executed on 'make check'. @@ -38,15 +37,14 @@ You'll need phpunit installed for this to work. To install: pear install --force --alldeps phpunit/phpunit -# Installing +## Installing As root (or owner with write access to the directory returned by php-config --extension-dir), run: make install -# Using +## Using ... TODO ... (reference some automatically built doc?) - From 26b70fed58a3470c7cb93abb7305c660778c8f05 Mon Sep 17 00:00:00 2001 From: Fatih Aytekin Date: Fri, 8 May 2020 03:25:41 +0300 Subject: [PATCH 05/13] Update README.md --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index 9e12f8b..ecc0560 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,6 @@ # PHP module for GEOS -=================== - -[![build status](https://drone.osgeo.org/api/badges/geos/php-geos/status.svg?branch=master)](https://drone.osgeo.org/geos/php-geos?branch=master) +[![build status](https://dronie.osgeo.org/api/badges/geos/php-geos/status.svg?branch=master)](https://github.com/libgeos/php-geos/tree/master) The code in this directory provides a PHP module to make use of functionalities of the [GEOS library](http://geos.osgeo.org). From 4000429741614195589af112a3eaa303f5848173 Mon Sep 17 00:00:00 2001 From: Alexander Rakushin Date: Sat, 24 Oct 2020 22:27:43 +0300 Subject: [PATCH 06/13] Add build config for Windows --- config.w32 | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 config.w32 diff --git a/config.w32 b/config.w32 new file mode 100644 index 0000000..e69de29 From c704c6b4416274e2784b23cda386e6004c691905 Mon Sep 17 00:00:00 2001 From: Alexander Rakushin Date: Sat, 24 Oct 2020 22:29:45 +0300 Subject: [PATCH 07/13] Fix error compile RC. Chars "<" and ">" not support rc.exe --- CREDITS | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CREDITS b/CREDITS index 0c6410d..571227c 100644 --- a/CREDITS +++ b/CREDITS @@ -1,3 +1,3 @@ geos -Sandro Santilli - GEOS -J Smith - PHP packaging +Sandro Santilli strk@kbt.io - GEOS +J Smith dark.panda@gmail.com jay@php.net - PHP packaging From f8749f45963f1468c242ff5111cf2facae52a0c5 Mon Sep 17 00:00:00 2001 From: Alexander Rakushin Date: Sat, 24 Oct 2020 22:30:16 +0300 Subject: [PATCH 08/13] Update windows compile instruction --- README.md | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ecc0560..bf88f60 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ of functionalities of the [GEOS library](http://geos.osgeo.org). The bindings are linked to the C-API, for betters stability. -## Building +## Building (UNIX) ### Requirements @@ -27,6 +27,55 @@ You need: ./configure make # generates modules/geos.so +## Building (Windows) + +### Requirements + +- PHP source files: download [zip](http://windows.php.net/download/) or clone from [github](https://github.com/php/php-src) +- PHP SDK ( https://github.com/Microsoft/php-sdk-binary-tools ) +- Visual C++: + * Visual C++ 14.0 (Visual Studio 2015) for PHP 7.0 or PHP 7.1. + * Visual C++ 15.0 (Visual Studio 2017) for PHP 7.2, PHP 7.3 or PHP 7.4. + * Visual C++ 16.0 (Visual Studio 2019) for master. +- GEOS Windows binaries (binary dll, includes and lib): + * As part of [OSGeo4W](http://osgeo4w.osgeo.org/) as part of the geos package. + * As part of [MS4W](https://ms4w.com/) + +### Configure + +Official instructions for compiling PHP extensions: https://wiki.php.net/internals/windows/stepbystepbuild_sdk_2 + +1. Install OSGeo4w in `C:\OSGeo4W64` and PHP-SDK in `C:/php-sdk.` +2. Invoke the starter script, for example for Visual Studio 2015 64-bit build, invoke phpsdk-vc15-x64.bat +3. Run the phpsdk_buildtree batch script which will create the desired directory structure: + + phpsdk_buildtree phpdev + + The phpsdk_buildtree script will create the path according to the currently VC++ version used and switch into the newly created directory +4. Extract the PHP source code to `C:\php-sdk\phpdev\vX##\x##`, where: + + vX## is the compiler version you are using (eq vc15 or vs16) + x## is your architecture (x86 or x64) + For example: `C:\php-sdk\phpdev\vc15\x64\php-7.4.11-src` + In the same directory where you extracted the PHP source there is a deps directory. + For example: `C:\php-sdk\phpdev\vc15\x64\deps` + +5. Copy GEOS binaries from `C:\OSGeo4W64` (`bin`, `include` and `lib` subdir) to `C:\php-sdk\phpdev\vc15\x64\deps\` +6. Copy (clone) code from this repository to `C:\php-sdk\phpdev\vc15\x64\php-7.4.11-src\ext\geos` + + +### Compile + +Run next commands to compile ([see official php instruction](https://wiki.php.net/internals/windows/stepbystepbuild_sdk_2)): + + c:\php-sdk\phpsdk-vc15-x64.bat + cd C:\php-sdk\phpdev\vc15\x64\php-7.4.11-src + buildconf + configure --disable-all --enable-cli --with-geos + nmake + + + ## Testing Automated testing is executed on 'make check'. @@ -37,11 +86,16 @@ You'll need phpunit installed for this to work. To install: ## Installing +### Unix + As root (or owner with write access to the directory returned by php-config --extension-dir), run: make install +### Window +Copy php_geos.dll to extension directory and enable it in php.ini + ## Using ... TODO ... From 2371e359e1eac48de6bd90f8c438bf080f550579 Mon Sep 17 00:00:00 2001 From: Alexander Rakushin Date: Sat, 24 Oct 2020 23:03:33 +0300 Subject: [PATCH 09/13] Update windows build config --- config.w32 | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/config.w32 b/config.w32 index e69de29..a24be09 100644 --- a/config.w32 +++ b/config.w32 @@ -0,0 +1,20 @@ +// vim:ft=javascript + +ARG_WITH("geos", "geos support", "yes"); + +if (PHP_GEOS != "no") { + if (CHECK_LIB("geos_c.lib", "geos", PHP_GEOS) && + CHECK_HEADER_ADD_INCLUDE("geos_c.h", "CFLAGS_GEOS", PHP_GEOS)) { + + EXTENSION("geos", "geos.c", 1); + geos_c = "geos_c.lib"; + + CHECK_LIB(geos_c, "initGEOS_r", PHP_GEOS) && !PHP_GEOS && WARNING("Unable to build the GEOS: a newer libgeos is required"); + + + } else { + WARNING("geos support can't be enabled, libraries or headers are missing") + PHP_GEOS = "no"; + } + +} From 559ea142fc4274fce570fa0b25096a2e992b2549 Mon Sep 17 00:00:00 2001 From: nono303 Date: Mon, 30 Nov 2020 14:18:32 +0100 Subject: [PATCH 10/13] php8 compatibility : TSRMLS* & arginfo_void --- geos.c | 375 +++++++++++++++++++++++++++++---------------------------- 1 file changed, 189 insertions(+), 186 deletions(-) diff --git a/geos.c b/geos.c index 4593620..73dddd7 100755 --- a/geos.c +++ b/geos.c @@ -33,6 +33,9 @@ /* Own stuff */ #include "php_geos.h" +ZEND_BEGIN_ARG_INFO_EX(arginfo_void, 0, 0, 0) +ZEND_END_ARG_INFO() + static ZEND_DECLARE_MODULE_GLOBALS(geos); static PHP_GINIT_FUNCTION(geos); @@ -84,16 +87,16 @@ PHP_FUNCTION(GEOSRelateMatch); static zend_function_entry geos_functions[] = { - PHP_FE(GEOSVersion, NULL) - PHP_FE(GEOSPolygonize, NULL) - PHP_FE(GEOSLineMerge, NULL) + PHP_FE(GEOSVersion, arginfo_void) + PHP_FE(GEOSPolygonize, arginfo_void) + PHP_FE(GEOSLineMerge, arginfo_void) # ifdef HAVE_GEOS_SHARED_PATHS - PHP_FE(GEOSSharedPaths, NULL) + PHP_FE(GEOSSharedPaths, arginfo_void) # endif # ifdef HAVE_GEOS_RELATE_PATTERN_MATCH - PHP_FE(GEOSRelateMatch, NULL) + PHP_FE(GEOSRelateMatch, arginfo_void) # endif {NULL, NULL, NULL} }; @@ -123,19 +126,19 @@ ZEND_GET_MODULE(geos) static void noticeHandler(const char *fmt, ...) { - TSRMLS_FETCH(); + char message[256]; va_list args; va_start(args, fmt); vsnprintf(message, sizeof(message) - 1, fmt, args); va_end(args); - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%s", message); + php_error_docref(NULL, E_NOTICE, "%s", message); } static void errorHandler(const char *fmt, ...) { - TSRMLS_FETCH(); + char message[256]; va_list args; va_start(args, fmt); @@ -143,8 +146,8 @@ static void errorHandler(const char *fmt, ...) va_end(args); /* TODO: use a GEOSException ? */ - zend_throw_exception_ex(zend_exception_get_default(TSRMLS_C), - 1 TSRMLS_CC, "%s", message); + zend_throw_exception_ex(zend_exception_get_default(), + 1, "%s", message); } @@ -166,15 +169,15 @@ static inline Proxy *php_geos_fetch_object(zend_object *obj) { # define Z_GEOS_OBJ_P(zv) (Proxy *)((char *) (Z_OBJ_P(zv)) - XtOffsetOf(Proxy, std)) #else # ifdef Z_OBJ -# define Z_GEOS_OBJ_P(zv) (Proxy*)Z_OBJ(*val TSRMLS_CC) +# define Z_GEOS_OBJ_P(zv) (Proxy*)Z_OBJ(*val) # else -# define Z_GEOS_OBJ_P(zv) (Proxy*)zend_object_store_get_object(val TSRMLS_CC) +# define Z_GEOS_OBJ_P(zv) (Proxy*)zend_object_store_get_object(val) # endif #endif static void setRelay(zval* val, void* obj) { - TSRMLS_FETCH(); + Proxy* proxy = Z_GEOS_OBJ_P(val); @@ -183,12 +186,12 @@ setRelay(zval* val, void* obj) { static inline void * getRelay(zval* val, zend_class_entry* ce) { - TSRMLS_FETCH(); + Proxy* proxy = Z_GEOS_OBJ_P(val); if ( proxy->std.ce != ce ) { - php_error_docref(NULL TSRMLS_CC, E_ERROR, + php_error_docref(NULL, E_ERROR, #if PHP_VERSION_ID >= 70000 "Relay object is not an %s", ZSTR_VAL(ce->name)); #else @@ -196,7 +199,7 @@ getRelay(zval* val, zend_class_entry* ce) { #endif } if ( ! proxy->relay ) { - php_error_docref(NULL TSRMLS_CC, E_ERROR, + php_error_docref(NULL, E_ERROR, #if PHP_VERSION_ID >= 70000 "Relay object for object of type %s is not set", ZSTR_VAL(ce->name)); #else @@ -242,16 +245,16 @@ static long getZvalAsDouble(GEOS_PHP_ZVAL val) static zend_object_value Gen_create_obj (zend_class_entry *type, - void (*dtor)(GEOS_PHP_DTOR_OBJECT *object TSRMLS_DC), + void (*dtor)(GEOS_PHP_DTOR_OBJECT *object), zend_object_handlers* handlers) { - TSRMLS_FETCH(); + #if PHP_VERSION_ID >= 70000 Proxy *obj = (Proxy *) ecalloc(1, sizeof(Proxy) + zend_object_properties_size(type)); - zend_object_std_init(&obj->std, type TSRMLS_CC); + zend_object_std_init(&obj->std, type); object_properties_init(&obj->std, type); obj->std.handlers = handlers; @@ -278,7 +281,7 @@ Gen_create_obj (zend_class_entry *type, object_properties_init(&(obj->std), type); #endif - retval.handle = zend_objects_store_put(obj, NULL, dtor, NULL TSRMLS_CC); + retval.handle = zend_objects_store_put(obj, NULL, dtor, NULL); retval.handlers = handlers; return retval; @@ -428,142 +431,142 @@ PHP_METHOD(Geometry, clipByRect); #endif static zend_function_entry Geometry_methods[] = { - PHP_ME(Geometry, __construct, NULL, 0) - PHP_ME(Geometry, __toString, NULL, 0) - PHP_ME(Geometry, project, NULL, 0) - PHP_ME(Geometry, interpolate, NULL, 0) - PHP_ME(Geometry, buffer, NULL, 0) + PHP_ME(Geometry, __construct, arginfo_void, 0) + PHP_ME(Geometry, __toString, arginfo_void, 0) + PHP_ME(Geometry, project, arginfo_void, 0) + PHP_ME(Geometry, interpolate, arginfo_void, 0) + PHP_ME(Geometry, buffer, arginfo_void, 0) # ifdef HAVE_GEOS_OFFSET_CURVE - PHP_ME(Geometry, offsetCurve, NULL, 0) + PHP_ME(Geometry, offsetCurve, arginfo_void, 0) # endif - PHP_ME(Geometry, envelope, NULL, 0) - PHP_ME(Geometry, intersection, NULL, 0) - PHP_ME(Geometry, convexHull, NULL, 0) - PHP_ME(Geometry, difference, NULL, 0) - PHP_ME(Geometry, symDifference, NULL, 0) - PHP_ME(Geometry, boundary, NULL, 0) - PHP_ME(Geometry, union, NULL, 0) - PHP_ME(Geometry, pointOnSurface, NULL, 0) - PHP_ME(Geometry, centroid, NULL, 0) - PHP_ME(Geometry, relate, NULL, 0) + PHP_ME(Geometry, envelope, arginfo_void, 0) + PHP_ME(Geometry, intersection, arginfo_void, 0) + PHP_ME(Geometry, convexHull, arginfo_void, 0) + PHP_ME(Geometry, difference, arginfo_void, 0) + PHP_ME(Geometry, symDifference, arginfo_void, 0) + PHP_ME(Geometry, boundary, arginfo_void, 0) + PHP_ME(Geometry, union, arginfo_void, 0) + PHP_ME(Geometry, pointOnSurface, arginfo_void, 0) + PHP_ME(Geometry, centroid, arginfo_void, 0) + PHP_ME(Geometry, relate, arginfo_void, 0) # ifdef HAVE_GEOS_RELATE_BOUNDARY_NODE_RULE - PHP_ME(Geometry, relateBoundaryNodeRule, NULL, 0) + PHP_ME(Geometry, relateBoundaryNodeRule, arginfo_void, 0) # endif - PHP_ME(Geometry, simplify, NULL, 0) - PHP_ME(Geometry, normalize, NULL, 0) + PHP_ME(Geometry, simplify, arginfo_void, 0) + PHP_ME(Geometry, normalize, arginfo_void, 0) # ifdef HAVE_GEOS_GEOM_SET_PRECISION - PHP_ME(Geometry, setPrecision, NULL, 0) + PHP_ME(Geometry, setPrecision, arginfo_void, 0) # endif # if HAVE_GEOS_GEOM_GET_PRECISION - PHP_ME(Geometry, getPrecision, NULL, 0) + PHP_ME(Geometry, getPrecision, arginfo_void, 0) # endif # ifdef HAVE_GEOS_GEOM_EXTRACT_UNIQUE_POINTS - PHP_ME(Geometry, extractUniquePoints, NULL, 0) + PHP_ME(Geometry, extractUniquePoints, arginfo_void, 0) # endif - PHP_ME(Geometry, disjoint, NULL, 0) - PHP_ME(Geometry, touches, NULL, 0) - PHP_ME(Geometry, intersects, NULL, 0) - PHP_ME(Geometry, crosses, NULL, 0) - PHP_ME(Geometry, within, NULL, 0) - PHP_ME(Geometry, contains, NULL, 0) - PHP_ME(Geometry, overlaps, NULL, 0) + PHP_ME(Geometry, disjoint, arginfo_void, 0) + PHP_ME(Geometry, touches, arginfo_void, 0) + PHP_ME(Geometry, intersects, arginfo_void, 0) + PHP_ME(Geometry, crosses, arginfo_void, 0) + PHP_ME(Geometry, within, arginfo_void, 0) + PHP_ME(Geometry, contains, arginfo_void, 0) + PHP_ME(Geometry, overlaps, arginfo_void, 0) # ifdef HAVE_GEOS_COVERS - PHP_ME(Geometry, covers, NULL, 0) + PHP_ME(Geometry, covers, arginfo_void, 0) # endif # ifdef HAVE_GEOS_COVERED_BY - PHP_ME(Geometry, coveredBy, NULL, 0) + PHP_ME(Geometry, coveredBy, arginfo_void, 0) # endif - PHP_ME(Geometry, equals, NULL, 0) - PHP_ME(Geometry, equalsExact, NULL, 0) - PHP_ME(Geometry, isEmpty, NULL, 0) + PHP_ME(Geometry, equals, arginfo_void, 0) + PHP_ME(Geometry, equalsExact, arginfo_void, 0) + PHP_ME(Geometry, isEmpty, arginfo_void, 0) # ifdef HAVE_GEOS_IS_VALID_DETAIL - PHP_ME(Geometry, checkValidity, NULL, 0) + PHP_ME(Geometry, checkValidity, arginfo_void, 0) # endif - PHP_ME(Geometry, isSimple, NULL, 0) - PHP_ME(Geometry, isRing, NULL, 0) - PHP_ME(Geometry, hasZ, NULL, 0) + PHP_ME(Geometry, isSimple, arginfo_void, 0) + PHP_ME(Geometry, isRing, arginfo_void, 0) + PHP_ME(Geometry, hasZ, arginfo_void, 0) # ifdef HAVE_GEOS_IS_CLOSED - PHP_ME(Geometry, isClosed, NULL, 0) + PHP_ME(Geometry, isClosed, arginfo_void, 0) # endif - PHP_ME(Geometry, typeName, NULL, 0) - PHP_ME(Geometry, typeId, NULL, 0) - PHP_ME(Geometry, getSRID, NULL, 0) - PHP_ME(Geometry, setSRID, NULL, 0) - PHP_ME(Geometry, numGeometries, NULL, 0) - PHP_ME(Geometry, geometryN, NULL, 0) - PHP_ME(Geometry, numInteriorRings, NULL, 0) + PHP_ME(Geometry, typeName, arginfo_void, 0) + PHP_ME(Geometry, typeId, arginfo_void, 0) + PHP_ME(Geometry, getSRID, arginfo_void, 0) + PHP_ME(Geometry, setSRID, arginfo_void, 0) + PHP_ME(Geometry, numGeometries, arginfo_void, 0) + PHP_ME(Geometry, geometryN, arginfo_void, 0) + PHP_ME(Geometry, numInteriorRings, arginfo_void, 0) # ifdef HAVE_GEOS_GEOM_GET_NUM_POINTS - PHP_ME(Geometry, numPoints, NULL, 0) + PHP_ME(Geometry, numPoints, arginfo_void, 0) # endif # ifdef HAVE_GEOS_GEOM_GET_X - PHP_ME(Geometry, getX, NULL, 0) + PHP_ME(Geometry, getX, arginfo_void, 0) # endif # ifdef HAVE_GEOS_GEOM_GET_Y - PHP_ME(Geometry, getY, NULL, 0) + PHP_ME(Geometry, getY, arginfo_void, 0) # endif - PHP_ME(Geometry, interiorRingN, NULL, 0) - PHP_ME(Geometry, exteriorRing, NULL, 0) - PHP_ME(Geometry, numCoordinates, NULL, 0) - PHP_ME(Geometry, dimension, NULL, 0) + PHP_ME(Geometry, interiorRingN, arginfo_void, 0) + PHP_ME(Geometry, exteriorRing, arginfo_void, 0) + PHP_ME(Geometry, numCoordinates, arginfo_void, 0) + PHP_ME(Geometry, dimension, arginfo_void, 0) # ifdef HAVE_GEOS_GEOM_GET_COORDINATE_DIMENSION - PHP_ME(Geometry, coordinateDimension, NULL, 0) + PHP_ME(Geometry, coordinateDimension, arginfo_void, 0) # endif # ifdef HAVE_GEOS_GEOM_GET_POINT_N - PHP_ME(Geometry, pointN, NULL, 0) + PHP_ME(Geometry, pointN, arginfo_void, 0) # endif # ifdef HAVE_GEOS_GEOM_GET_START_POINT - PHP_ME(Geometry, startPoint, NULL, 0) + PHP_ME(Geometry, startPoint, arginfo_void, 0) # endif # ifdef HAVE_GEOS_GEOM_GET_END_POINT - PHP_ME(Geometry, endPoint, NULL, 0) + PHP_ME(Geometry, endPoint, arginfo_void, 0) # endif - PHP_ME(Geometry, area, NULL, 0) - PHP_ME(Geometry, length, NULL, 0) - PHP_ME(Geometry, distance, NULL, 0) - PHP_ME(Geometry, hausdorffDistance, NULL, 0) + PHP_ME(Geometry, area, arginfo_void, 0) + PHP_ME(Geometry, length, arginfo_void, 0) + PHP_ME(Geometry, distance, arginfo_void, 0) + PHP_ME(Geometry, hausdorffDistance, arginfo_void, 0) # if HAVE_GEOS_SNAP - PHP_ME(Geometry, snapTo, NULL, 0) + PHP_ME(Geometry, snapTo, arginfo_void, 0) # endif # ifdef HAVE_GEOS_NODE - PHP_ME(Geometry, node, NULL, 0) + PHP_ME(Geometry, node, arginfo_void, 0) # endif # ifdef HAVE_GEOS_DELAUNAY_TRIANGULATION - PHP_ME(Geometry, delaunayTriangulation, NULL, 0) + PHP_ME(Geometry, delaunayTriangulation, arginfo_void, 0) # endif # ifdef HAVE_GEOS_VORONOI_DIAGRAM - PHP_ME(Geometry, voronoiDiagram, NULL, 0) + PHP_ME(Geometry, voronoiDiagram, arginfo_void, 0) # endif # ifdef HAVE_GEOS_CLIP_BY_RECT - PHP_ME(Geometry, clipByRect, NULL, 0) + PHP_ME(Geometry, clipByRect, arginfo_void, 0) # endif {NULL, NULL, NULL} @@ -579,7 +582,7 @@ static GEOSWKBWriter* Geometry_serializer = 0; static GEOSWKBWriter* getGeometrySerializer() { - TSRMLS_FETCH(); + if ( ! Geometry_serializer ) { Geometry_serializer = GEOSWKBWriter_create_r(GEOS_G(handle)); @@ -591,7 +594,7 @@ static GEOSWKBWriter* getGeometrySerializer() static void delGeometrySerializer() { - TSRMLS_FETCH(); + if ( Geometry_serializer ) { GEOSWKBWriter_destroy_r(GEOS_G(handle), Geometry_serializer); @@ -604,7 +607,7 @@ static GEOSWKBReader* Geometry_deserializer = 0; static GEOSWKBReader* getGeometryDeserializer() { - TSRMLS_FETCH(); + if ( ! Geometry_deserializer ) { Geometry_deserializer = GEOSWKBReader_create_r(GEOS_G(handle)); @@ -614,7 +617,7 @@ static GEOSWKBReader* getGeometryDeserializer() static void delGeometryDeserializer() { - TSRMLS_FETCH(); + if ( Geometry_deserializer ) { GEOSWKBReader_destroy_r(GEOS_G(handle), Geometry_deserializer); @@ -625,7 +628,7 @@ static void delGeometryDeserializer() static int Geometry_serialize(zval *object, unsigned char **buffer, zend_uint *buf_len, - zend_serialize_data *data TSRMLS_DC) + zend_serialize_data *data) { GEOSWKBWriter *serializer; GEOSGeometry *geom; @@ -651,7 +654,7 @@ Geometry_serialize(zval *object, unsigned char **buffer, zend_uint *buf_len, static int Geometry_deserialize(GEOS_PHP_ZVAL object, zend_class_entry *ce, const unsigned char *buf, - zend_uint buf_len, zend_unserialize_data *data TSRMLS_DC) + zend_uint buf_len, zend_unserialize_data *data) { GEOSWKBReader* deserializer; GEOSGeometry* geom; @@ -661,7 +664,7 @@ Geometry_deserialize(GEOS_PHP_ZVAL object, zend_class_entry *ce, const unsigned /* check zend_class_entry being what we expect! */ if ( ce != Geometry_ce_ptr ) { - php_error_docref(NULL TSRMLS_CC, E_ERROR, + php_error_docref(NULL, E_ERROR, "Geometry_deserialize called with unexpected zend_class_entry"); return FAILURE; } @@ -685,7 +688,7 @@ Geometry_deserialize(GEOS_PHP_ZVAL object, zend_class_entry *ce, const unsigned static void dumpGeometry(GEOSGeometry* g, zval* array) { - TSRMLS_FETCH(); + int ngeoms, i; ngeoms = GEOSGetNumGeometries_r(GEOS_G(handle), g); @@ -711,7 +714,7 @@ dumpGeometry(GEOSGeometry* g, zval* array) static void -Geometry_dtor (GEOS_PHP_DTOR_OBJECT *object TSRMLS_DC) +Geometry_dtor (GEOS_PHP_DTOR_OBJECT *object) { #if PHP_VERSION_ID < 70000 Proxy *obj = (Proxy *)object; @@ -732,7 +735,7 @@ Geometry_dtor (GEOS_PHP_DTOR_OBJECT *object TSRMLS_DC) } static zend_object_value -Geometry_create_obj (zend_class_entry *type TSRMLS_DC) +Geometry_create_obj (zend_class_entry *type) { return Gen_create_obj(type, Geometry_dtor, &Geometry_object_handlers); } @@ -740,7 +743,7 @@ Geometry_create_obj (zend_class_entry *type TSRMLS_DC) PHP_METHOD(Geometry, __construct) { - php_error_docref(NULL TSRMLS_CC, E_ERROR, + php_error_docref(NULL, E_ERROR, "GEOSGeometry can't be constructed using new, check WKTReader"); } @@ -786,7 +789,7 @@ PHP_METHOD(Geometry, project) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o|b", &zobj, + if (zend_parse_parameters(ZEND_NUM_ARGS(), "o|b", &zobj, &normalized) == FAILURE) { RETURN_NULL(); } @@ -811,7 +814,7 @@ PHP_METHOD(Geometry, interpolate) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d|b", + if (zend_parse_parameters(ZEND_NUM_ARGS(), "d|b", &dist, &normalized) == FAILURE) { RETURN_NULL(); } @@ -875,7 +878,7 @@ PHP_METHOD(Geometry, buffer) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d|a", + if (zend_parse_parameters(ZEND_NUM_ARGS(), "d|a", &dist, &style_val) == FAILURE) { RETURN_NULL(); } @@ -968,7 +971,7 @@ PHP_METHOD(Geometry, offsetCurve) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d|a", + if (zend_parse_parameters(ZEND_NUM_ARGS(), "d|a", &dist, &style_val) == FAILURE) { RETURN_NULL(); } @@ -1032,7 +1035,7 @@ PHP_METHOD(Geometry, intersection) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zobj) + if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &zobj) == FAILURE) { RETURN_NULL(); } @@ -1058,7 +1061,7 @@ PHP_METHOD(Geometry, clipByRect) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dddd", + if (zend_parse_parameters(ZEND_NUM_ARGS(), "dddd", &xmin, &ymin, &xmax, &ymax) == FAILURE) { RETURN_NULL(); } @@ -1096,7 +1099,7 @@ PHP_METHOD(Geometry, difference) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zobj) + if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &zobj) == FAILURE) { RETURN_NULL(); } @@ -1119,7 +1122,7 @@ PHP_METHOD(Geometry, symDifference) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zobj) + if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &zobj) == FAILURE) { RETURN_NULL(); } @@ -1161,7 +1164,7 @@ PHP_METHOD(Geometry, union) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|o", &zobj) + if (zend_parse_parameters(ZEND_NUM_ARGS(), "|o", &zobj) == FAILURE) { RETURN_NULL(); } @@ -1241,7 +1244,7 @@ PHP_METHOD(Geometry, relate) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o|s", + if (zend_parse_parameters(ZEND_NUM_ARGS(), "o|s", &zobj, &pat, &patlen) == FAILURE) { RETURN_NULL(); @@ -1280,7 +1283,7 @@ PHP_METHOD(Geometry, relateBoundaryNodeRule) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ol", + if (zend_parse_parameters(ZEND_NUM_ARGS(), "ol", &zobj, &bnr) == FAILURE) { RETURN_NULL(); @@ -1310,7 +1313,7 @@ PHP_METHOD(Geometry, simplify) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d|b", + if (zend_parse_parameters(ZEND_NUM_ARGS(), "d|b", &tolerance, &preserveTopology) == FAILURE) { RETURN_NULL(); } @@ -1341,7 +1344,7 @@ PHP_METHOD(Geometry, setPrecision) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d|l", + if (zend_parse_parameters(ZEND_NUM_ARGS(), "d|l", &gridSize, &flags) == FAILURE) { RETURN_NULL(); } @@ -1428,7 +1431,7 @@ PHP_METHOD(Geometry, disjoint) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zobj) + if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &zobj) == FAILURE) { RETURN_NULL(); } @@ -1455,7 +1458,7 @@ PHP_METHOD(Geometry, touches) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zobj) + if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &zobj) == FAILURE) { RETURN_NULL(); } @@ -1482,7 +1485,7 @@ PHP_METHOD(Geometry, intersects) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zobj) + if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &zobj) == FAILURE) { RETURN_NULL(); } @@ -1509,7 +1512,7 @@ PHP_METHOD(Geometry, crosses) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zobj) + if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &zobj) == FAILURE) { RETURN_NULL(); } @@ -1536,7 +1539,7 @@ PHP_METHOD(Geometry, within) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zobj) + if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &zobj) == FAILURE) { RETURN_NULL(); } @@ -1563,7 +1566,7 @@ PHP_METHOD(Geometry, contains) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zobj) + if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &zobj) == FAILURE) { RETURN_NULL(); } @@ -1590,7 +1593,7 @@ PHP_METHOD(Geometry, overlaps) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zobj) + if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &zobj) == FAILURE) { RETURN_NULL(); } @@ -1618,7 +1621,7 @@ PHP_METHOD(Geometry, covers) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zobj) + if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &zobj) == FAILURE) { RETURN_NULL(); } @@ -1647,7 +1650,7 @@ PHP_METHOD(Geometry, coveredBy) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zobj) + if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &zobj) == FAILURE) { RETURN_NULL(); } @@ -1675,7 +1678,7 @@ PHP_METHOD(Geometry, equals) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", + if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &zobj) == FAILURE) { RETURN_NULL(); } @@ -1704,7 +1707,7 @@ PHP_METHOD(Geometry, equalsExact) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o|d", + if (zend_parse_parameters(ZEND_NUM_ARGS(), "o|d", &zobj, &tolerance) == FAILURE) { RETURN_NULL(); } @@ -1754,7 +1757,7 @@ PHP_METHOD(Geometry, checkValidity) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", + if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &flags) == FAILURE) { RETURN_NULL(); } @@ -1927,7 +1930,7 @@ PHP_METHOD(Geometry, setSRID) geom = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", + if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &srid) == FAILURE) { RETURN_NULL(); } @@ -1963,7 +1966,7 @@ PHP_METHOD(Geometry, geometryN) geom = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", + if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &num) == FAILURE) { RETURN_NULL(); } @@ -2062,7 +2065,7 @@ PHP_METHOD(Geometry, interiorRingN) geom = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", + if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &num) == FAILURE) { RETURN_NULL(); } @@ -2160,7 +2163,7 @@ PHP_METHOD(Geometry, pointN) geom = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", + if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &num) == FAILURE) { RETURN_NULL(); } @@ -2255,7 +2258,7 @@ PHP_METHOD(Geometry, distance) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", + if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &zobj) == FAILURE) { RETURN_NULL(); @@ -2282,7 +2285,7 @@ PHP_METHOD(Geometry, hausdorffDistance) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", + if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &zobj) == FAILURE) { RETURN_NULL(); @@ -2307,7 +2310,7 @@ PHP_METHOD(Geometry, snapTo) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "od", &zobj, + if (zend_parse_parameters(ZEND_NUM_ARGS(), "od", &zobj, &tolerance) == FAILURE) { RETURN_NULL(); } @@ -2347,8 +2350,8 @@ PHP_METHOD(WKTReader, __construct); PHP_METHOD(WKTReader, read); static zend_function_entry WKTReader_methods[] = { - PHP_ME(WKTReader, __construct, NULL, 0) - PHP_ME(WKTReader, read, NULL, 0) + PHP_ME(WKTReader, __construct, arginfo_void, 0) + PHP_ME(WKTReader, read, arginfo_void, 0) {NULL, NULL, NULL} }; @@ -2357,7 +2360,7 @@ static zend_class_entry *WKTReader_ce_ptr; static zend_object_handlers WKTReader_object_handlers; static void -WKTReader_dtor (GEOS_PHP_DTOR_OBJECT *object TSRMLS_DC) +WKTReader_dtor (GEOS_PHP_DTOR_OBJECT *object) { #if PHP_VERSION_ID < 70000 Proxy *obj = (Proxy *)object; @@ -2379,7 +2382,7 @@ WKTReader_dtor (GEOS_PHP_DTOR_OBJECT *object TSRMLS_DC) } static zend_object_value -WKTReader_create_obj (zend_class_entry *type TSRMLS_DC) +WKTReader_create_obj (zend_class_entry *type) { return Gen_create_obj(type, WKTReader_dtor, &WKTReader_object_handlers); } @@ -2392,7 +2395,7 @@ PHP_METHOD(WKTReader, __construct) obj = GEOSWKTReader_create_r(GEOS_G(handle)); if ( ! obj ) { - php_error_docref(NULL TSRMLS_CC, E_ERROR, + php_error_docref(NULL, E_ERROR, "GEOSWKTReader_create() failed (didn't initGEOS?)"); } @@ -2410,7 +2413,7 @@ PHP_METHOD(WKTReader, read) reader = (GEOSWKTReader*)getRelay(getThis(), WKTReader_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, + if (zend_parse_parameters(ZEND_NUM_ARGS(), #if PHP_VERSION_ID >= 70000 "S", &wkt #else @@ -2457,27 +2460,27 @@ PHP_METHOD(WKTWriter, setOld3D); #endif static zend_function_entry WKTWriter_methods[] = { - PHP_ME(WKTWriter, __construct, NULL, 0) - PHP_ME(WKTWriter, write, NULL, 0) + PHP_ME(WKTWriter, __construct, arginfo_void, 0) + PHP_ME(WKTWriter, write, arginfo_void, 0) # ifdef HAVE_GEOS_WKT_WRITER_SET_TRIM - PHP_ME(WKTWriter, setTrim, NULL, 0) + PHP_ME(WKTWriter, setTrim, arginfo_void, 0) # endif # ifdef HAVE_GEOS_WKT_WRITER_SET_ROUNDING_PRECISION - PHP_ME(WKTWriter, setRoundingPrecision, NULL, 0) + PHP_ME(WKTWriter, setRoundingPrecision, arginfo_void, 0) # endif # ifdef HAVE_GEOS_WKT_WRITER_SET_OUTPUT_DIMENSION - PHP_ME(WKTWriter, setOutputDimension, NULL, 0) + PHP_ME(WKTWriter, setOutputDimension, arginfo_void, 0) # endif # ifdef HAVE_GEOS_WKT_WRITER_GET_OUTPUT_DIMENSION - PHP_ME(WKTWriter, getOutputDimension, NULL, 0) + PHP_ME(WKTWriter, getOutputDimension, arginfo_void, 0) # endif # ifdef HAVE_GEOS_WKT_WRITER_SET_OLD_3D - PHP_ME(WKTWriter, setOld3D, NULL, 0) + PHP_ME(WKTWriter, setOld3D, arginfo_void, 0) # endif {NULL, NULL, NULL} @@ -2488,7 +2491,7 @@ static zend_class_entry *WKTWriter_ce_ptr; static zend_object_handlers WKTWriter_object_handlers; static void -WKTWriter_dtor (GEOS_PHP_DTOR_OBJECT *object TSRMLS_DC) +WKTWriter_dtor (GEOS_PHP_DTOR_OBJECT *object) { #if PHP_VERSION_ID < 70000 Proxy *obj = (Proxy *)object; @@ -2509,7 +2512,7 @@ WKTWriter_dtor (GEOS_PHP_DTOR_OBJECT *object TSRMLS_DC) } static zend_object_value -WKTWriter_create_obj (zend_class_entry *type TSRMLS_DC) +WKTWriter_create_obj (zend_class_entry *type) { return Gen_create_obj(type, WKTWriter_dtor, &WKTWriter_object_handlers); } @@ -2521,7 +2524,7 @@ PHP_METHOD(WKTWriter, __construct) obj = GEOSWKTWriter_create_r(GEOS_G(handle)); if ( ! obj ) { - php_error_docref(NULL TSRMLS_CC, E_ERROR, + php_error_docref(NULL, E_ERROR, "GEOSWKTWriter_create() failed (didn't initGEOS?)"); } @@ -2538,7 +2541,7 @@ PHP_METHOD(WKTWriter, write) writer = (GEOSWKTWriter*)getRelay(getThis(), WKTWriter_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zobj) + if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &zobj) == FAILURE) { RETURN_NULL(); @@ -2565,7 +2568,7 @@ PHP_METHOD(WKTWriter, setTrim) writer = (GEOSWKTWriter*)getRelay(getThis(), WKTWriter_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &trimval) + if (zend_parse_parameters(ZEND_NUM_ARGS(), "b", &trimval) == FAILURE) { RETURN_NULL(); @@ -2584,7 +2587,7 @@ PHP_METHOD(WKTWriter, setRoundingPrecision) writer = (GEOSWKTWriter*)getRelay(getThis(), WKTWriter_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &prec) + if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &prec) == FAILURE) { RETURN_NULL(); @@ -2605,7 +2608,7 @@ PHP_METHOD(WKTWriter, setOutputDimension) writer = (GEOSWKTWriter*)getRelay(getThis(), WKTWriter_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &dim) + if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &dim) == FAILURE) { RETURN_NULL(); @@ -2641,7 +2644,7 @@ PHP_METHOD(WKTWriter, setOld3D) writer = (GEOSWKTWriter*)getRelay(getThis(), WKTWriter_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &bval) + if (zend_parse_parameters(ZEND_NUM_ARGS(), "b", &bval) == FAILURE) { RETURN_NULL(); @@ -2665,15 +2668,15 @@ PHP_METHOD(WKBWriter, write); PHP_METHOD(WKBWriter, writeHEX); static zend_function_entry WKBWriter_methods[] = { - PHP_ME(WKBWriter, __construct, NULL, 0) - PHP_ME(WKBWriter, getOutputDimension, NULL, 0) - PHP_ME(WKBWriter, setOutputDimension, NULL, 0) - PHP_ME(WKBWriter, getByteOrder, NULL, 0) - PHP_ME(WKBWriter, setByteOrder, NULL, 0) - PHP_ME(WKBWriter, getIncludeSRID, NULL, 0) - PHP_ME(WKBWriter, setIncludeSRID, NULL, 0) - PHP_ME(WKBWriter, write, NULL, 0) - PHP_ME(WKBWriter, writeHEX, NULL, 0) + PHP_ME(WKBWriter, __construct, arginfo_void, 0) + PHP_ME(WKBWriter, getOutputDimension, arginfo_void, 0) + PHP_ME(WKBWriter, setOutputDimension, arginfo_void, 0) + PHP_ME(WKBWriter, getByteOrder, arginfo_void, 0) + PHP_ME(WKBWriter, setByteOrder, arginfo_void, 0) + PHP_ME(WKBWriter, getIncludeSRID, arginfo_void, 0) + PHP_ME(WKBWriter, setIncludeSRID, arginfo_void, 0) + PHP_ME(WKBWriter, write, arginfo_void, 0) + PHP_ME(WKBWriter, writeHEX, arginfo_void, 0) {NULL, NULL, NULL} }; @@ -2682,7 +2685,7 @@ static zend_class_entry *WKBWriter_ce_ptr; static zend_object_handlers WKBWriter_object_handlers; static void -WKBWriter_dtor (GEOS_PHP_DTOR_OBJECT *object TSRMLS_DC) +WKBWriter_dtor (GEOS_PHP_DTOR_OBJECT *object) { #if PHP_VERSION_ID < 70000 Proxy *obj = (Proxy *)object; @@ -2703,7 +2706,7 @@ WKBWriter_dtor (GEOS_PHP_DTOR_OBJECT *object TSRMLS_DC) } static zend_object_value -WKBWriter_create_obj (zend_class_entry *type TSRMLS_DC) +WKBWriter_create_obj (zend_class_entry *type) { return Gen_create_obj(type, WKBWriter_dtor, &WKBWriter_object_handlers); } @@ -2718,7 +2721,7 @@ PHP_METHOD(WKBWriter, __construct) obj = GEOSWKBWriter_create_r(GEOS_G(handle)); if ( ! obj ) { - php_error_docref(NULL TSRMLS_CC, E_ERROR, + php_error_docref(NULL, E_ERROR, "GEOSWKBWriter_create() failed (didn't initGEOS?)"); } @@ -2750,7 +2753,7 @@ PHP_METHOD(WKBWriter, setOutputDimension) writer = (GEOSWKBWriter*)getRelay(getThis(), WKBWriter_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &dim) + if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &dim) == FAILURE) { RETURN_NULL(); @@ -2774,7 +2777,7 @@ PHP_METHOD(WKBWriter, write) writer = (GEOSWKBWriter*)getRelay(getThis(), WKBWriter_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zobj) + if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &zobj) == FAILURE) { RETURN_NULL(); @@ -2806,7 +2809,7 @@ PHP_METHOD(WKBWriter, writeHEX) writer = (GEOSWKBWriter*)getRelay(getThis(), WKBWriter_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zobj) + if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &zobj) == FAILURE) { RETURN_NULL(); @@ -2849,7 +2852,7 @@ PHP_METHOD(WKBWriter, setByteOrder) writer = (GEOSWKBWriter*)getRelay(getThis(), WKBWriter_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &dim) + if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &dim) == FAILURE) { RETURN_NULL(); @@ -2887,7 +2890,7 @@ PHP_METHOD(WKBWriter, setIncludeSRID) writer = (GEOSWKBWriter*)getRelay(getThis(), WKBWriter_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &incVal) + if (zend_parse_parameters(ZEND_NUM_ARGS(), "b", &incVal) == FAILURE) { RETURN_NULL(); @@ -2904,9 +2907,9 @@ PHP_METHOD(WKBReader, read); PHP_METHOD(WKBReader, readHEX); static zend_function_entry WKBReader_methods[] = { - PHP_ME(WKBReader, __construct, NULL, 0) - PHP_ME(WKBReader, read, NULL, 0) - PHP_ME(WKBReader, readHEX, NULL, 0) + PHP_ME(WKBReader, __construct, arginfo_void, 0) + PHP_ME(WKBReader, read, arginfo_void, 0) + PHP_ME(WKBReader, readHEX, arginfo_void, 0) {NULL, NULL, NULL} }; @@ -2915,7 +2918,7 @@ static zend_class_entry *WKBReader_ce_ptr; static zend_object_handlers WKBReader_object_handlers; static void -WKBReader_dtor (GEOS_PHP_DTOR_OBJECT *object TSRMLS_DC) +WKBReader_dtor (GEOS_PHP_DTOR_OBJECT *object) { #if PHP_VERSION_ID < 70000 Proxy *obj = (Proxy *)object; @@ -2936,7 +2939,7 @@ WKBReader_dtor (GEOS_PHP_DTOR_OBJECT *object TSRMLS_DC) } static zend_object_value -WKBReader_create_obj (zend_class_entry *type TSRMLS_DC) +WKBReader_create_obj (zend_class_entry *type) { return Gen_create_obj(type, WKBReader_dtor, &WKBReader_object_handlers); } @@ -2949,7 +2952,7 @@ PHP_METHOD(WKBReader, __construct) obj = GEOSWKBReader_create_r(GEOS_G(handle)); if ( ! obj ) { - php_error_docref(NULL TSRMLS_CC, E_ERROR, + php_error_docref(NULL, E_ERROR, "GEOSWKBReader_create() failed (didn't initGEOS?)"); } @@ -2965,7 +2968,7 @@ PHP_METHOD(WKBReader, read) reader = (GEOSWKBReader*)getRelay(getThis(), WKBReader_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, + if (zend_parse_parameters(ZEND_NUM_ARGS(), #if PHP_VERSION_ID >= 70000 "S", &wkb #else @@ -3003,7 +3006,7 @@ PHP_METHOD(WKBReader, readHEX) reader = (GEOSWKBReader*)getRelay(getThis(), WKBReader_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", + if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &wkb, &wkblen) == FAILURE) { RETURN_NULL(); @@ -3066,7 +3069,7 @@ PHP_FUNCTION(GEOSPolygonize) zval *array_elem; zval *zobj; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zobj) + if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &zobj) == FAILURE) { RETURN_NULL(); @@ -3114,7 +3117,7 @@ PHP_FUNCTION(GEOSLineMerge) GEOSGeometry *geom_out; zval *zobj; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zobj) + if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &zobj) == FAILURE) { RETURN_NULL(); @@ -3141,7 +3144,7 @@ PHP_FUNCTION(GEOSSharedPaths) GEOSGeometry *geom_out; zval *zobj1, *zobj2; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "oo", &zobj1, &zobj2) + if (zend_parse_parameters(ZEND_NUM_ARGS(), "oo", &zobj1, &zobj2) == FAILURE) { RETURN_NULL(); @@ -3179,7 +3182,7 @@ PHP_METHOD(Geometry, delaunayTriangulation) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|db", + if (zend_parse_parameters(ZEND_NUM_ARGS(), "|db", &tolerance, &edgeonly) == FAILURE) { RETURN_NULL(); } @@ -3219,7 +3222,7 @@ PHP_METHOD(Geometry, voronoiDiagram) this = (GEOSGeometry*)getRelay(getThis(), Geometry_ce_ptr); - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|dbo", + if (zend_parse_parameters(ZEND_NUM_ARGS(), "|dbo", &tolerance, &edgeonly, &zobj) == FAILURE) { RETURN_NULL(); } @@ -3252,7 +3255,7 @@ PHP_FUNCTION(GEOSRelateMatch) int ret; zend_bool retBool; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", + if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &mat, &matlen, &pat, &patlen) == FAILURE) { RETURN_NULL(); @@ -3276,7 +3279,7 @@ PHP_MINIT_FUNCTION(geos) /* WKTReader */ INIT_CLASS_ENTRY(ce, "GEOSWKTReader", WKTReader_methods); - WKTReader_ce_ptr = zend_register_internal_class(&ce TSRMLS_CC); + WKTReader_ce_ptr = zend_register_internal_class(&ce); WKTReader_ce_ptr->create_object = WKTReader_create_obj; memcpy(&WKTReader_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); @@ -3288,7 +3291,7 @@ PHP_MINIT_FUNCTION(geos) /* WKTWriter */ INIT_CLASS_ENTRY(ce, "GEOSWKTWriter", WKTWriter_methods); - WKTWriter_ce_ptr = zend_register_internal_class(&ce TSRMLS_CC); + WKTWriter_ce_ptr = zend_register_internal_class(&ce); WKTWriter_ce_ptr->create_object = WKTWriter_create_obj; memcpy(&WKTWriter_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); @@ -3300,7 +3303,7 @@ PHP_MINIT_FUNCTION(geos) /* Geometry */ INIT_CLASS_ENTRY(ce, "GEOSGeometry", Geometry_methods); - Geometry_ce_ptr = zend_register_internal_class(&ce TSRMLS_CC); + Geometry_ce_ptr = zend_register_internal_class(&ce); Geometry_ce_ptr->create_object = Geometry_create_obj; memcpy(&Geometry_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); @@ -3315,7 +3318,7 @@ PHP_MINIT_FUNCTION(geos) /* WKBWriter */ INIT_CLASS_ENTRY(ce, "GEOSWKBWriter", WKBWriter_methods); - WKBWriter_ce_ptr = zend_register_internal_class(&ce TSRMLS_CC); + WKBWriter_ce_ptr = zend_register_internal_class(&ce); WKBWriter_ce_ptr->create_object = WKBWriter_create_obj; memcpy(&WKBWriter_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); @@ -3327,7 +3330,7 @@ PHP_MINIT_FUNCTION(geos) /* WKBReader */ INIT_CLASS_ENTRY(ce, "GEOSWKBReader", WKBReader_methods); - WKBReader_ce_ptr = zend_register_internal_class(&ce TSRMLS_CC); + WKBReader_ce_ptr = zend_register_internal_class(&ce); WKBReader_ce_ptr->create_object = WKBReader_create_obj; memcpy(&WKBReader_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); From e90d10202c9b6a3e7417c74634f1d960e2c4d0a4 Mon Sep 17 00:00:00 2001 From: nono303 Date: Mon, 30 Nov 2020 14:24:37 +0100 Subject: [PATCH 11/13] ste PHP_GEOS_VERSION --- php_geos.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php_geos.h b/php_geos.h index 5350541..9a63492 100644 --- a/php_geos.h +++ b/php_geos.h @@ -26,7 +26,7 @@ #define PHP_GEOS_H /* TODO: generate from ./configure ? */ -#define PHP_GEOS_VERSION "0.0" +#define PHP_GEOS_VERSION "1.0.1" #define PHP_GEOS_EXTNAME "geos" #ifdef HAVE_CONFIG_H From bba201f4ecc74fec69b832037647e4585b5cedd2 Mon Sep 17 00:00:00 2001 From: nono303 Date: Sun, 17 Jan 2021 11:32:12 +0100 Subject: [PATCH 12/13] add AC_DEFINE for vars HAVE_GEOS* on Windows build --- config.w32 | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/config.w32 b/config.w32 index a24be09..0a5512c 100644 --- a/config.w32 +++ b/config.w32 @@ -11,6 +11,37 @@ if (PHP_GEOS != "no") { CHECK_LIB(geos_c, "initGEOS_r", PHP_GEOS) && !PHP_GEOS && WARNING("Unable to build the GEOS: a newer libgeos is required"); + CHECK_LIB(geos_c, "GEOSClipByRect_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_CLIP_BY_RECT', 1, 'Whether we have GEOSClipByRect_r'); + CHECK_LIB(geos_c, "GEOSCoveredBy_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_COVERED_BY', 1, 'Whether we have GEOSCoveredBy_r'); + CHECK_LIB(geos_c, "GEOSCovers_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_COVERS', 1, 'Whether we have GEOSCovers_r'); + CHECK_LIB(geos_c, "GEOSDelaunayTriangulation_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_DELAUNAY_TRIANGULATION', 1, 'Whether we have GEOSDelaunayTriangulation_r'); + CHECK_LIB(geos_c, "GEOSGeomGetEndPoint_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_GEOM_GET_END_POINT', 1, 'Whether we have GEOSGeomGetEndPoint_r'); + CHECK_LIB(geos_c, "GEOSGeomGetNumPoints_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_GEOM_GET_NUM_POINTS', 1, 'Whether we have GEOSGeomGetNumPoints_r'); + CHECK_LIB(geos_c, "GEOSGeomGetPointN_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_GEOM_GET_POINT_N', 1, 'Whether we have GEOSGeomGetPointN_r'); + CHECK_LIB(geos_c, "GEOSGeomGetStartPoint_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_GEOM_GET_START_POINT', 1, 'Whether we have GEOSGeomGetStartPoint_r'); + CHECK_LIB(geos_c, "GEOSGeomGetX_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_GEOM_GET_X', 1, 'Whether we have GEOSGeomGetX_r'); + CHECK_LIB(geos_c, "GEOSGeomGetY_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_GEOM_GET_Y', 1, 'Whether we have GEOSGeomGetY_r'); + CHECK_LIB(geos_c, "GEOSGeom_extractUniquePoints_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_GEOM_EXTRACT_UNIQUE_POINTS', 1, 'Whether we have GEOSGeom_extractUniquePoints_r'); + CHECK_LIB(geos_c, "GEOSGeom_getCoordinateDimension_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_GEOM_GET_COORDINATE_DIMENSION', 1, 'Whether we have GEOSGeom_getCoordinateDimension_r'); + CHECK_LIB(geos_c, "GEOSNode_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_NODE', 1, 'Whether we have GEOSNode_r'); + CHECK_LIB(geos_c, "GEOSOffsetCurve_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_OFFSET_CURVE', 1, 'Whether we have GEOSOffsetCurve_r'); + CHECK_LIB(geos_c, "GEOSPolygonize_full_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_POLYGONIZE_FULL', 1, 'Whether we have GEOSPolygonize_full_r'); + CHECK_LIB(geos_c, "GEOSRelateBoundaryNodeRule_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_RELATE_BOUNDARY_NODE_RULE', 1, 'Whether we have GEOSRelateBoundaryNodeRule_r'); + CHECK_LIB(geos_c, "GEOSRelatePatternMatch_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_RELATE_PATTERN_MATCH', 1, 'Whether we have GEOSRelatePatternMatch_r'); + CHECK_LIB(geos_c, "GEOSSharedPaths_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_SHARED_PATHS', 1, 'Whether we have GEOSSharedPaths_r'); + CHECK_LIB(geos_c, "GEOSSnap_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_SNAP', 1, 'Whether we have GEOSSnap_r'); + CHECK_LIB(geos_c, "GEOSUnaryUnion_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_UNARY_UNION', 1, 'Whether we have GEOSUnaryUnion_r'); + CHECK_LIB(geos_c, "GEOSVoronoiDiagram_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_VORONOI_DIAGRAM', 1, 'Whether we have GEOSVoronoiDiagram_r'); + CHECK_LIB(geos_c, "GEOSisClosed_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_IS_CLOSED', 1, 'Whether we have GEOSisClosed_r'); + CHECK_LIB(geos_c, "GEOSisValidDetail_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_IS_VALID_DETAIL', 1, 'Whether we have GEOSisValidDetail_r'); + CHECK_LIB(geos_c, "GEOSGeom_setPrecision_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_GEOM_SET_PRECISION', 1, 'Whether we have GEOSGeom_setPrecision_r'); + CHECK_LIB(geos_c, "GEOSGeom_getPrecision_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_GEOM_GET_PRECISION', 1, 'Whether we have GEOSGeom_getPrecision_r'); + + CHECK_LIB(geos_c, "GEOSWKTWriter_setTrim_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_WKT_WRITER_SET_TRIM', 1, 'Whether we have GEOSWKTWriter_setTrim_r'); + CHECK_LIB(geos_c, "GEOSWKTWriter_setRoundingPrecision_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_WKT_WRITER_SET_ROUNDING_PRECISION', 1, 'Whether we have GEOSWKTWriter_setRoundingPrecision_r'); + CHECK_LIB(geos_c, "GEOSWKTWriter_setOutputDimension_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_WKT_WRITER_SET_OUTPUT_DIMENSION', 1, 'Whether we have GEOSWKTWriter_setOutputDimension_r'); + CHECK_LIB(geos_c, "GEOSWKTWriter_getOutputDimension_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_WKT_WRITER_GET_OUTPUT_DIMENSION', 1, 'Whether we have GEOSWKTWriter_getOutputDimension_r'); + CHECK_LIB(geos_c, "GEOSWKTWriter_setOld3D_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_WKT_WRITER_SET_OLD_3D', 1, 'Whether we have GEOSWKTWriter_setOld3D_r'); } else { WARNING("geos support can't be enabled, libraries or headers are missing") From e4f9578b0bad9f54926f1003669e017a690c536b Mon Sep 17 00:00:00 2001 From: nono303 Date: Tue, 19 Jan 2021 17:20:13 +0100 Subject: [PATCH 13/13] define GEOS_PREC_NO_TOPO & GEOS_PREC_KEEP_COLLAPSED to 1 for win build --- config.w32 | 78 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 43 insertions(+), 35 deletions(-) diff --git a/config.w32 b/config.w32 index 0a5512c..6a0f0cc 100644 --- a/config.w32 +++ b/config.w32 @@ -6,42 +6,50 @@ if (PHP_GEOS != "no") { if (CHECK_LIB("geos_c.lib", "geos", PHP_GEOS) && CHECK_HEADER_ADD_INCLUDE("geos_c.h", "CFLAGS_GEOS", PHP_GEOS)) { + CHECK_LIB("geos_c.lib", "initGEOS_r", PHP_GEOS) && !PHP_GEOS && WARNING("Unable to build the GEOS: a newer libgeos is required"); + + CHECK_LIB("geos_c.lib", "GEOSClipByRect_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_CLIP_BY_RECT', 1, 'Whether we have GEOSClipByRect_r'); + CHECK_LIB("geos_c.lib", "GEOSCoveredBy_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_COVERED_BY', 1, 'Whether we have GEOSCoveredBy_r'); + CHECK_LIB("geos_c.lib", "GEOSCovers_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_COVERS', 1, 'Whether we have GEOSCovers_r'); + CHECK_LIB("geos_c.lib", "GEOSDelaunayTriangulation_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_DELAUNAY_TRIANGULATION', 1, 'Whether we have GEOSDelaunayTriangulation_r'); + CHECK_LIB("geos_c.lib", "GEOSGeomGetEndPoint_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_GEOM_GET_END_POINT', 1, 'Whether we have GEOSGeomGetEndPoint_r'); + CHECK_LIB("geos_c.lib", "GEOSGeomGetNumPoints_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_GEOM_GET_NUM_POINTS', 1, 'Whether we have GEOSGeomGetNumPoints_r'); + CHECK_LIB("geos_c.lib", "GEOSGeomGetPointN_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_GEOM_GET_POINT_N', 1, 'Whether we have GEOSGeomGetPointN_r'); + CHECK_LIB("geos_c.lib", "GEOSGeomGetStartPoint_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_GEOM_GET_START_POINT', 1, 'Whether we have GEOSGeomGetStartPoint_r'); + CHECK_LIB("geos_c.lib", "GEOSGeomGetX_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_GEOM_GET_X', 1, 'Whether we have GEOSGeomGetX_r'); + CHECK_LIB("geos_c.lib", "GEOSGeomGetY_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_GEOM_GET_Y', 1, 'Whether we have GEOSGeomGetY_r'); + CHECK_LIB("geos_c.lib", "GEOSGeom_extractUniquePoints_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_GEOM_EXTRACT_UNIQUE_POINTS', 1, 'Whether we have GEOSGeom_extractUniquePoints_r'); + CHECK_LIB("geos_c.lib", "GEOSGeom_getCoordinateDimension_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_GEOM_GET_COORDINATE_DIMENSION', 1, 'Whether we have GEOSGeom_getCoordinateDimension_r'); + CHECK_LIB("geos_c.lib", "GEOSNode_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_NODE', 1, 'Whether we have GEOSNode_r'); + CHECK_LIB("geos_c.lib", "GEOSOffsetCurve_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_OFFSET_CURVE', 1, 'Whether we have GEOSOffsetCurve_r'); + CHECK_LIB("geos_c.lib", "GEOSPolygonize_full_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_POLYGONIZE_FULL', 1, 'Whether we have GEOSPolygonize_full_r'); + CHECK_LIB("geos_c.lib", "GEOSRelateBoundaryNodeRule_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_RELATE_BOUNDARY_NODE_RULE', 1, 'Whether we have GEOSRelateBoundaryNodeRule_r'); + CHECK_LIB("geos_c.lib", "GEOSRelatePatternMatch_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_RELATE_PATTERN_MATCH', 1, 'Whether we have GEOSRelatePatternMatch_r'); + CHECK_LIB("geos_c.lib", "GEOSSharedPaths_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_SHARED_PATHS', 1, 'Whether we have GEOSSharedPaths_r'); + CHECK_LIB("geos_c.lib", "GEOSSnap_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_SNAP', 1, 'Whether we have GEOSSnap_r'); + CHECK_LIB("geos_c.lib", "GEOSUnaryUnion_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_UNARY_UNION', 1, 'Whether we have GEOSUnaryUnion_r'); + CHECK_LIB("geos_c.lib", "GEOSVoronoiDiagram_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_VORONOI_DIAGRAM', 1, 'Whether we have GEOSVoronoiDiagram_r'); + CHECK_LIB("geos_c.lib", "GEOSisClosed_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_IS_CLOSED', 1, 'Whether we have GEOSisClosed_r'); + CHECK_LIB("geos_c.lib", "GEOSisValidDetail_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_IS_VALID_DETAIL', 1, 'Whether we have GEOSisValidDetail_r'); + CHECK_LIB("geos_c.lib", "GEOSGeom_setPrecision_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_GEOM_SET_PRECISION', 1, 'Whether we have GEOSGeom_setPrecision_r'); + CHECK_LIB("geos_c.lib", "GEOSGeom_getPrecision_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_GEOM_GET_PRECISION', 1, 'Whether we have GEOSGeom_getPrecision_r'); + + CHECK_LIB("geos_c.lib", "GEOSWKTWriter_setTrim_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_WKT_WRITER_SET_TRIM', 1, 'Whether we have GEOSWKTWriter_setTrim_r'); + CHECK_LIB("geos_c.lib", "GEOSWKTWriter_setRoundingPrecision_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_WKT_WRITER_SET_ROUNDING_PRECISION', 1, 'Whether we have GEOSWKTWriter_setRoundingPrecision_r'); + CHECK_LIB("geos_c.lib", "GEOSWKTWriter_setOutputDimension_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_WKT_WRITER_SET_OUTPUT_DIMENSION', 1, 'Whether we have GEOSWKTWriter_setOutputDimension_r'); + CHECK_LIB("geos_c.lib", "GEOSWKTWriter_getOutputDimension_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_WKT_WRITER_GET_OUTPUT_DIMENSION', 1, 'Whether we have GEOSWKTWriter_getOutputDimension_r'); + CHECK_LIB("geos_c.lib", "GEOSWKTWriter_setOld3D_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_WKT_WRITER_SET_OLD_3D', 1, 'Whether we have GEOSWKTWriter_setOld3D_r'); + + // https://juliahub.com/docs/LibGEOS/we91k/0.6.5/autodocs/ + // setPrecision: GEOS_PREC_NO_TOPO -- do not attempt at preserving the topology -- geos.c l. 3379 + // setPrecision: GEOS_PREC_KEEP_COLLAPSED -- retain collapsed elements -- geos.c l. 3384 + // We can't run TRY_COMPILE tests on Windows ?? force HAVE_GEOS_PREC_NO_TOPO & HAVE_GEOS_PREC_KEEP_COLLAPSED + // AC_TRY_COMPILE(geos_c.h, GEOS_PREC_NO_TOPO, AC_DEFINE(HAVE_GEOS_PREC_NO_TOPO,1,[Whether we have GEOS_PREC_NO_TOPO])) -- do not attempt at preserving the topology + // AC_TRY_COMPILE(geos_c.h, GEOS_PREC_KEEP_COLLAPSED, AC_DEFINE(HAVE_GEOS_PREC_KEEP_COLLAPSED,1,[Whether we have GEOS_PREC_KEEP_COLLAPSED])) -- retain collapsed elements + AC_DEFINE('HAVE_GEOS_PREC_NO_TOPO',1,'Whether we have GEOS_PREC_NO_TOPO'); + AC_DEFINE('HAVE_GEOS_PREC_KEEP_COLLAPSED',1,'Whether we have GEOS_PREC_KEEP_COLLAPSED'); + EXTENSION("geos", "geos.c", 1); - geos_c = "geos_c.lib"; - - CHECK_LIB(geos_c, "initGEOS_r", PHP_GEOS) && !PHP_GEOS && WARNING("Unable to build the GEOS: a newer libgeos is required"); - - CHECK_LIB(geos_c, "GEOSClipByRect_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_CLIP_BY_RECT', 1, 'Whether we have GEOSClipByRect_r'); - CHECK_LIB(geos_c, "GEOSCoveredBy_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_COVERED_BY', 1, 'Whether we have GEOSCoveredBy_r'); - CHECK_LIB(geos_c, "GEOSCovers_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_COVERS', 1, 'Whether we have GEOSCovers_r'); - CHECK_LIB(geos_c, "GEOSDelaunayTriangulation_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_DELAUNAY_TRIANGULATION', 1, 'Whether we have GEOSDelaunayTriangulation_r'); - CHECK_LIB(geos_c, "GEOSGeomGetEndPoint_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_GEOM_GET_END_POINT', 1, 'Whether we have GEOSGeomGetEndPoint_r'); - CHECK_LIB(geos_c, "GEOSGeomGetNumPoints_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_GEOM_GET_NUM_POINTS', 1, 'Whether we have GEOSGeomGetNumPoints_r'); - CHECK_LIB(geos_c, "GEOSGeomGetPointN_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_GEOM_GET_POINT_N', 1, 'Whether we have GEOSGeomGetPointN_r'); - CHECK_LIB(geos_c, "GEOSGeomGetStartPoint_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_GEOM_GET_START_POINT', 1, 'Whether we have GEOSGeomGetStartPoint_r'); - CHECK_LIB(geos_c, "GEOSGeomGetX_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_GEOM_GET_X', 1, 'Whether we have GEOSGeomGetX_r'); - CHECK_LIB(geos_c, "GEOSGeomGetY_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_GEOM_GET_Y', 1, 'Whether we have GEOSGeomGetY_r'); - CHECK_LIB(geos_c, "GEOSGeom_extractUniquePoints_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_GEOM_EXTRACT_UNIQUE_POINTS', 1, 'Whether we have GEOSGeom_extractUniquePoints_r'); - CHECK_LIB(geos_c, "GEOSGeom_getCoordinateDimension_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_GEOM_GET_COORDINATE_DIMENSION', 1, 'Whether we have GEOSGeom_getCoordinateDimension_r'); - CHECK_LIB(geos_c, "GEOSNode_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_NODE', 1, 'Whether we have GEOSNode_r'); - CHECK_LIB(geos_c, "GEOSOffsetCurve_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_OFFSET_CURVE', 1, 'Whether we have GEOSOffsetCurve_r'); - CHECK_LIB(geos_c, "GEOSPolygonize_full_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_POLYGONIZE_FULL', 1, 'Whether we have GEOSPolygonize_full_r'); - CHECK_LIB(geos_c, "GEOSRelateBoundaryNodeRule_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_RELATE_BOUNDARY_NODE_RULE', 1, 'Whether we have GEOSRelateBoundaryNodeRule_r'); - CHECK_LIB(geos_c, "GEOSRelatePatternMatch_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_RELATE_PATTERN_MATCH', 1, 'Whether we have GEOSRelatePatternMatch_r'); - CHECK_LIB(geos_c, "GEOSSharedPaths_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_SHARED_PATHS', 1, 'Whether we have GEOSSharedPaths_r'); - CHECK_LIB(geos_c, "GEOSSnap_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_SNAP', 1, 'Whether we have GEOSSnap_r'); - CHECK_LIB(geos_c, "GEOSUnaryUnion_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_UNARY_UNION', 1, 'Whether we have GEOSUnaryUnion_r'); - CHECK_LIB(geos_c, "GEOSVoronoiDiagram_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_VORONOI_DIAGRAM', 1, 'Whether we have GEOSVoronoiDiagram_r'); - CHECK_LIB(geos_c, "GEOSisClosed_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_IS_CLOSED', 1, 'Whether we have GEOSisClosed_r'); - CHECK_LIB(geos_c, "GEOSisValidDetail_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_IS_VALID_DETAIL', 1, 'Whether we have GEOSisValidDetail_r'); - CHECK_LIB(geos_c, "GEOSGeom_setPrecision_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_GEOM_SET_PRECISION', 1, 'Whether we have GEOSGeom_setPrecision_r'); - CHECK_LIB(geos_c, "GEOSGeom_getPrecision_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_GEOM_GET_PRECISION', 1, 'Whether we have GEOSGeom_getPrecision_r'); - - CHECK_LIB(geos_c, "GEOSWKTWriter_setTrim_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_WKT_WRITER_SET_TRIM', 1, 'Whether we have GEOSWKTWriter_setTrim_r'); - CHECK_LIB(geos_c, "GEOSWKTWriter_setRoundingPrecision_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_WKT_WRITER_SET_ROUNDING_PRECISION', 1, 'Whether we have GEOSWKTWriter_setRoundingPrecision_r'); - CHECK_LIB(geos_c, "GEOSWKTWriter_setOutputDimension_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_WKT_WRITER_SET_OUTPUT_DIMENSION', 1, 'Whether we have GEOSWKTWriter_setOutputDimension_r'); - CHECK_LIB(geos_c, "GEOSWKTWriter_getOutputDimension_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_WKT_WRITER_GET_OUTPUT_DIMENSION', 1, 'Whether we have GEOSWKTWriter_getOutputDimension_r'); - CHECK_LIB(geos_c, "GEOSWKTWriter_setOld3D_r", PHP_GEOS) && AC_DEFINE('HAVE_GEOS_WKT_WRITER_SET_OLD_3D', 1, 'Whether we have GEOSWKTWriter_setOld3D_r'); } else { WARNING("geos support can't be enabled, libraries or headers are missing")