Commit graph

770 commits

Author SHA1 Message Date
Mark Cave-Ayland a6a0bbc574 Add parser flags to the LWGEOM to (E)WKB/WKT parsers, similar to has already been done for the (E)WKB/WKT to LWGEOM parsers.
git-svn-id: http://svn.osgeo.org/postgis/trunk@3012 b70326c6-7e19-0410-871a-916f4a2858ee
2008-09-25 21:50:19 +00:00
Mark Cave-Ayland e3a4081c51 Use __va_copy() to pass a copy of the variadic structure to lw_vasprintf() to solve ABI difference between 32bit/64bit architectures.
git-svn-id: http://svn.osgeo.org/postgis/trunk@2998 b70326c6-7e19-0410-871a-916f4a2858ee
2008-09-23 21:32:19 +00:00
Mark Cave-Ayland 442d938075 Revert commit 2990: the real bug was that the LWDEBUG statement was incorrect rather than the code - the additional read_int() was causing an off-by-one error when outputting WKB causing several regression tests to fail.
git-svn-id: http://svn.osgeo.org/postgis/trunk@2996 b70326c6-7e19-0410-871a-916f4a2858ee
2008-09-23 19:53:12 +00:00
Mark Cave-Ayland b53c6b8ebb Refactor the memory management routines to account for the fact that variadic functions can't be called directly from the initial allocators. Also solve issues related to differences between the system vasprintf() (if supplied) and the liblwgeom vasprintf() by renaming to lw_vasprintf() and using it throughout PostGIS. With all this in place, GBT#54 is fixed which is very useful when debugging ;)
git-svn-id: http://svn.osgeo.org/postgis/trunk@2995 b70326c6-7e19-0410-871a-916f4a2858ee
2008-09-23 19:44:57 +00:00
Paul Ramsey 2b6e3d5b0b Add cnt declaration where missing.
git-svn-id: http://svn.osgeo.org/postgis/trunk@2990 b70326c6-7e19-0410-871a-916f4a2858ee
2008-09-22 22:59:47 +00:00
Mark Cave-Ayland 248a9bcb69 Update the code for unparsing LWGEOMs to WKB/WKT so that it includes the standard simple checks: LINESTRINGs must have > 2 points, POLYGONs must have closed rings and CIRCULARSTRINGs must have > 2 points and the number of points must be odd. There is still a little more work to do to allow flags to be passed into the parser to specify which checks should be enforced, much like has already been done for the parsing from WKB/WKT to LWGEOM.
git-svn-id: http://svn.osgeo.org/postgis/trunk@2983 b70326c6-7e19-0410-871a-916f4a2858ee
2008-09-18 13:54:05 +00:00
Mark Cave-Ayland 552023181f Silence a few more compiler warnings that had appeared during my last few parser commits.
git-svn-id: http://svn.osgeo.org/postgis/trunk@2972 b70326c6-7e19-0410-871a-916f4a2858ee
2008-09-16 22:43:31 +00:00
Mark Cave-Ayland 8a8f2140d6 Add an example of how the liblwgeom API can be used by other C programs to manipulate geometries and output the result. Currently the unparser.c program shows how a geometry can be constructed "on the fly" and then exported in both WKT and HEXWKB formats; however it gives programmers the potential to devise some very unique processing tools which can generate files that can be loaded into PostGIS.
git-svn-id: http://svn.osgeo.org/postgis/trunk@2971 b70326c6-7e19-0410-871a-916f4a2858ee
2008-09-16 22:29:54 +00:00
Mark Cave-Ayland 29f98cefc4 Move the LWGEOM-specific functions from lwgeom_sqlmm.c into liblwgeom/lwsegmentize.c to ensure that liblwgeom can exist as a standalone library.
git-svn-id: http://svn.osgeo.org/postgis/trunk@2970 b70326c6-7e19-0410-871a-916f4a2858ee
2008-09-16 18:44:49 +00:00
Mark Cave-Ayland 742d9515ca Allow a flags parameter to be passed into the WKT parser to determine which consistency checks are performed out of polygon ring closure, minimum number of points and odd number of points.
git-svn-id: http://svn.osgeo.org/postgis/trunk@2949 b70326c6-7e19-0410-871a-916f4a2858ee
2008-09-09 21:10:46 +00:00
Mark Cave-Ayland 0f7eae6d0e Commit generated versions of the new parser files for people who do not have flex or bison installed.
git-svn-id: http://svn.osgeo.org/postgis/trunk@2948 b70326c6-7e19-0410-871a-916f4a2858ee
2008-09-08 20:17:29 +00:00
Mark Cave-Ayland 8437f89419 Enhance geometry parser so that it keeps track of the current position during parsing. With a bit more work, this should allow error messages to pinpoint the exact location of an invalid geometry section or syntax error.
git-svn-id: http://svn.osgeo.org/postgis/trunk@2947 b70326c6-7e19-0410-871a-916f4a2858ee
2008-09-08 20:16:04 +00:00
Mark Cave-Ayland b0641e9c1d Yet another update to the liblwgeom parser API - lwgeom_from_ewkt() has been renamed to serialized_lwgeom_from_ewkt() to indicate that the function returns a serialied LWGEOM rather than an unserialized LWGEOM structure.
git-svn-id: http://svn.osgeo.org/postgis/trunk@2945 b70326c6-7e19-0410-871a-916f4a2858ee
2008-09-07 11:02:05 +00:00
Mark Cave-Ayland 9a8647cfe6 Fix -o option for flex; the output filename must be specified immediately after -o without any preceding white space. Per report from Jorgen Austvik.
git-svn-id: http://svn.osgeo.org/postgis/trunk@2884 b70326c6-7e19-0410-871a-916f4a2858ee
2008-07-28 09:13:45 +00:00
Mark Cave-Ayland bdaf9c2271 Rename the new parser function ewkt_to_lwgeom() to lwgeon_from_ewkt() so that it matches the rest of the parser API
git-svn-id: http://svn.osgeo.org/postgis/trunk@2841 b70326c6-7e19-0410-871a-916f4a2858ee
2008-07-13 17:33:19 +00:00
Mark Cave-Ayland 49b827c8d6 Add some additional LWDEBUG(F) statements for debugging that I missed the first time around with the new debugging infrastructure
git-svn-id: http://svn.osgeo.org/postgis/trunk@2840 b70326c6-7e19-0410-871a-916f4a2858ee
2008-07-13 11:09:34 +00:00
Mark Cave-Ayland 4f8c4b5e8f More work on improving the EWKT/B parser; remove all references to allocator functions from outside of liblwgeom by generating wrapper functions with more meaningful names. As well as cleaning up the API, it also makes the code much more readable
git-svn-id: http://svn.osgeo.org/postgis/trunk@2839 b70326c6-7e19-0410-871a-916f4a2858ee
2008-07-13 10:50:56 +00:00
Mark Cave-Ayland 94babd74af Add the parser build rules back into the liblwgeom Makefile, so now any changes to either the lexer or parser source files will automatically invoke a rebuild of the relevant output files during make
git-svn-id: http://svn.osgeo.org/postgis/trunk@2820 b70326c6-7e19-0410-871a-916f4a2858ee
2008-07-03 09:28:38 +00:00
Mark Cave-Ayland 0e7e3e01d9 Fix liblwgeom requiring gcc to compile. By using macros and variables supplied by libtool, we can now detect the PIC flags and whether the compiler will accept additional gcc warning flags for developers
git-svn-id: http://svn.osgeo.org/postgis/trunk@2819 b70326c6-7e19-0410-871a-916f4a2858ee
2008-07-01 14:15:33 +00:00
Mark Cave-Ayland ffde636dc0 Split the basic geometry accessors into a separate static library liblwgeom.a; this potentially allows re-use of the liblwgeom functions from within PostGIS, or could be extended at a later date to include databases other than MySQL. This patch includes a change to the liblwgeom handler functions; instead of sprinkling init_pg_func()s around the source, I have changed the default liblwgeom handlers to make use of a callback to allow linked libraries to set their own handlers the first time any of them are called. I have also tidied up the parser API a little in liblwgeom.h, which means wktparse.h can be removed from all of the headers in the lwgeom/ directory, plus renamed wktunparse.c to lwgunparse.c to keep things similar to lwgparse.c. Finally, I renamed liblwgeom.c to lwutil.c to avoid confusion within the new interface. TODO: the liblwgeom Makefile has some gcc-specific options, but these can be fixed later - it seemed more important to make the warnings visible to developers.
git-svn-id: http://svn.osgeo.org/postgis/trunk@2815 b70326c6-7e19-0410-871a-916f4a2858ee
2008-06-29 19:11:48 +00:00