]> granicus.if.org Git - postgis/commitdiff
Move LWDEBUG macros in a new lwgeom_log.h header file (see #1220)
authorSandro Santilli <strk@keybit.net>
Wed, 28 Sep 2011 10:05:36 +0000 (10:05 +0000)
committerSandro Santilli <strk@keybit.net>
Wed, 28 Sep 2011 10:05:36 +0000 (10:05 +0000)
Update all implementation files accordingly.
Fix some misuses out of liblwgeom.
Add missing copyright notices in a few files.

git-svn-id: http://svn.osgeo.org/postgis/trunk@7907 b70326c6-7e19-0410-871a-916f4a2858ee

52 files changed:
liblwgeom/Makefile.in
liblwgeom/g_box.c
liblwgeom/g_serialized.c
liblwgeom/liblwgeom.h.in
liblwgeom/liblwgeom_internal.h
liblwgeom/libtgeom.c
liblwgeom/lwalgorithm.c
liblwgeom/lwcircstring.c
liblwgeom/lwcollection.c
liblwgeom/lwcompound.c
liblwgeom/lwcurvepoly.c
liblwgeom/lwgeodetic.c
liblwgeom/lwgeom.c
liblwgeom/lwgeom_api.c
liblwgeom/lwgeom_geos.c
liblwgeom/lwgeom_geos_clean.c
liblwgeom/lwgeom_log.h [new file with mode: 0644]
liblwgeom/lwgeom_transform.c
liblwgeom/lwhomogenize.c
liblwgeom/lwin_wkb.c
liblwgeom/lwin_wkt.c
liblwgeom/lwin_wkt_lex.c
liblwgeom/lwin_wkt_lex.l
liblwgeom/lwin_wkt_parse.c
liblwgeom/lwin_wkt_parse.y
liblwgeom/lwline.c
liblwgeom/lwmpoint.c
liblwgeom/lwmpoly.c
liblwgeom/lwmsurface.c
liblwgeom/lwout_wkb.c
liblwgeom/lwout_wkt.c
liblwgeom/lwpoint.c
liblwgeom/lwpoly.c
liblwgeom/lwpsurface.c
liblwgeom/lwsegmentize.c
liblwgeom/lwspheroid.c
liblwgeom/lwtin.c
liblwgeom/lwtree.c
liblwgeom/lwtriangle.c
liblwgeom/lwutil.c
liblwgeom/measures.c
liblwgeom/measures3d.c
liblwgeom/ptarray.c
libpgcommon/lwgeom_transform.c
loader/pgsql2shp-core.c
loader/shp2pgsql-core.c
postgis/geography_measurement.c
postgis/lwgeom_debug.c
postgis/lwgeom_functions_analytic.c
postgis/lwgeom_functions_lrs.c
postgis/lwgeom_rtree.c
postgis/lwgeom_spheroid.c

index 62186caa8cc869574c2a63e40abc074e4a26258c..0bdb1a984f0fe484bd73a274c86096769a07c0b5 100644 (file)
@@ -93,6 +93,7 @@ SA_HEADERS = \
        liblwgeom.h \
        liblwgeom_internal.h \
        libtgeom.h \
+       lwgeom_log.h \
        lwgeom_geos.h
 
 all: liblwgeom.la
index 797b894b3a3434ced2dff433b09a7b518669c157..93cd69290cbd81c75e751dd79bb850bca0dc7095 100644 (file)
@@ -10,6 +10,7 @@
  **********************************************************************/
 
 #include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
 #include <math.h>
 #include <stdlib.h>
 
index 92f9697d06e16b9968ef4bdbf0a5dc3fb928c885..eb432b666b5174e6dce09c80d894823532d5eb4c 100644 (file)
@@ -10,6 +10,7 @@
  **********************************************************************/
 
 #include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
 
 /***********************************************************************
 * GSERIALIZED metadata utility functions.
index 9ccebdc8d7e3c28dccb7e68b7622374c7b84bc04..d5282bfced7e7ebbdd21fbe97505d35961ab0944 100644 (file)
 #define SRID_UNKNOWN -1
 
 /**
-* Global functions for memory/logging handlers.
-*/
+ * Global functions for memory/logging handlers.
+ */
 typedef void* (*lwallocator)(size_t size);
 typedef void* (*lwreallocator)(void *mem, size_t size);
 typedef void (*lwfreeor)(void* mem);
@@ -175,22 +175,29 @@ extern void lwgeom_init_allocators(void);
 extern void lwgeom_install_default_allocators(void);
 
 /**
-* Write a notice out to the notice handler. Uses standard printf() substitutions.
-* Use for messages you always want output. For debugging, use LWDEBUG() or LWDEBUGF().
-* @ingroup logging
-*/
+ * Write a notice out to the notice handler.
+ *
+ * Uses standard printf() substitutions.
+ * Use for messages you always want output.
+ * For debugging, use LWDEBUG() or LWDEBUGF().
+ * @ingroup logging
+ */
 void lwnotice(const char *fmt, ...);
 
 /**
-* Write a notice out to the error handler. Uses standard printf() substitutions.
-* Use for errors you always want output. For debugging, use LWDEBUG() or LWDEBUGF().
-* @ingroup logging
-*/
+ * Write a notice out to the error handler.
+ *
+ * Uses standard printf() substitutions.
+ * Use for errors you always want output.
+ * For debugging, use LWDEBUG() or LWDEBUGF().
+ * @ingroup logging
+ */
 void lwerror(const char *fmt, ...);
 
 /**
-* The default memory/logging handlers installed by lwgeom_install_default_allocators()
-*/
+ * The default memory/logging handlers installed by
+ * lwgeom_install_default_allocators()
+ */
 void *default_allocator(size_t size);
 void *default_reallocator(void *mem, size_t size);
 void default_freeor(void *ptr);
@@ -208,39 +215,8 @@ va_dcl
 #endif
 
 
-/* Debug macros */
-#if POSTGIS_DEBUG_LEVEL > 0
-
-/* Display a notice at the given debug level */
-#define LWDEBUG(level, msg) \
-        do { \
-                if (POSTGIS_DEBUG_LEVEL >= level) \
-                        lwnotice("[%s:%s:%d] " msg, __FILE__, __func__, __LINE__); \
-        } while (0);
-
-/* Display a formatted notice at the given debug level (like printf, with variadic arguments) */
-#define LWDEBUGF(level, msg, ...) \
-        do { \
-                if (POSTGIS_DEBUG_LEVEL >= level) \
-                        lwnotice("[%s:%s:%d] " msg, __FILE__, __func__, __LINE__, __VA_ARGS__); \
-        } while (0);
-
-#else
-
-/* Empty prototype that can be optimised away by the compiler for non-debug builds */
-#define LWDEBUG(level, msg) \
-        ((void) 0)
-
-/* Empty prototype that can be optimised away by the compiler for non-debug builds */
-#define LWDEBUGF(level, msg, ...) \
-        ((void) 0)
-
-#endif
-
 /******************************************************************/
 
-
-
 typedef struct {
        double afac, bfac, cfac, dfac, efac, ffac, gfac, hfac, ifac, xoff, yoff, zoff;
 } AFFINE;
index 9dc23be40138ac95ffacfdad762a1516a196a98f..8ac7ce024bcb9f7a9ea0e466b9f8bcb4b323800b 100644 (file)
@@ -17,6 +17,7 @@
 
 #include <assert.h>
 #include "liblwgeom.h"
+#include <stdarg.h>
 #include <string.h>
 #include <math.h>
 #include <stdint.h>
@@ -259,4 +260,5 @@ void ptarray_affine(POINTARRAY *pa, const AFFINE *affine);
 char ptarray_isccw(const POINTARRAY *pa);
 
 
+
 #endif /* _LIBLWGEOM_INTERNAL_H */
index 062c29d62c97aaa921569b1f90044d799eeadc4b..36d4743f19b8519b3e4f4570e7e258893bd304bf 100644 (file)
@@ -16,6 +16,7 @@
 #include <stdlib.h>
 
 #include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
 #include "libtgeom.h"
 
 
index 88c63bbaf986dd2f50dafdfeea60e4efcd7e4eac..47c7c258e24086bcfe0bca57b8bb13906edbd211 100644 (file)
@@ -11,6 +11,7 @@
  **********************************************************************/
 
 #include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
 
 
 /**
index 3bfdfb4659cae58c82bfbd48b9ff6da04528ac66..60d89d331fcd117741904e9b88049a684ddc3437 100644 (file)
@@ -1,9 +1,9 @@
 /**********************************************************************
- * $Id$
  *
  * PostGIS - Spatial Types for PostgreSQL
  * http://postgis.refractions.net
- * Copyright 2001-2006 Refractions Research Inc.
+ *
+ * Copyright (C) 2001-2006 Refractions Research Inc.
  *
  * This is free software; you can redistribute and/or modify it under
  * the terms of the GNU General Public Licence. See the COPYING file.
@@ -17,6 +17,7 @@
 #include <string.h>
 #include <math.h>
 #include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
 
 BOX3D *lwcircle_compute_box3d(POINT4D *p1, POINT4D *p2, POINT4D *p3);
 void printLWCIRCSTRING(LWCIRCSTRING *curve);
index cd5ff9b7a8bf2fca95a328c34dd20768a2885ee0..84a0f8c696497a3542f225b5f7d8f7d25bcf4d41 100644 (file)
@@ -1,9 +1,9 @@
 /**********************************************************************
- * $Id$
  *
  * PostGIS - Spatial Types for PostgreSQL
  * http://postgis.refractions.net
- * Copyright 2001-2006 Refractions Research Inc.
+ *
+ * Copyright (C) 2001-2006 Refractions Research Inc.
  *
  * This is free software; you can redistribute and/or modify it under
  * the terms of the GNU General Public Licence. See the COPYING file.
@@ -14,6 +14,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
 
 
 #define CHECK_LWGEOM_ZM 1
index 30e99d44753e6feb2b14559255770fce30b91650..d0591ec4890f382578eeed9184fdab0a1b9d5ed8 100644 (file)
@@ -1,9 +1,9 @@
 /**********************************************************************
- * $Id$
  *
  * PostGIS - Spatial Types for PostgreSQL
  * http://postgis.refractions.net
- * Copyright 2001-2006 Refractions Research Inc.
+ *
+ * Copyright (C) 2001-2006 Refractions Research Inc.
  *
  * This is free software; you can redistribute and/or modify it under
  * the terms of the GNU General Public Licence. See the COPYING file.
@@ -14,6 +14,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
 
 LWCOMPOUND *
 lwcompound_deserialize(uint8_t *serialized)
index cb29d0a31aba80cc15b351bc6abc5577671c2f6f..690ac4be0f544ad91dd6c96ee317998e1ce03d8a 100644 (file)
@@ -1,9 +1,9 @@
 /**********************************************************************
- * $Id$
  *
  * PostGIS - Spatial Types for PostgreSQL
  * http://postgis.refractions.net
- * Copyright 2001-2006 Refractions Research Inc.
+ *
+ * Copyright (C) 2001-2006 Refractions Research Inc.
  *
  * This is free software; you can redistribute and/or modify it under
  * the terms of the GNU General Public Licence. See the COPYING file.
@@ -16,6 +16,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
 
 
 LWCURVEPOLY *
index 09c0ec7c6f54c1356da1050e92346947b2a07d2e..b6bdd6a70e248f22343cc086d46678630b667c97 100644 (file)
@@ -11,6 +11,7 @@
  **********************************************************************/
 
 #include "lwgeodetic.h"
+#include "lwgeom_log.h"
 
 /**
 * For testing geodetic bounding box, we have a magic global variable.
index ea7b1ac82407178af19f199d86ddc89a876a0ccb..c30b70e424045b5b8c1c6a4c56b41a4a91fdee4c 100644 (file)
@@ -1,9 +1,9 @@
 /**********************************************************************
- * $Id$
  *
  * PostGIS - Spatial Types for PostgreSQL
  * http://postgis.refractions.net
- * Copyright 2001-2006 Refractions Research Inc.
+ *
+ * Copyright (C) 2001-2006 Refractions Research Inc.
  *
  * This is free software; you can redistribute and/or modify it under
  * the terms of the GNU General Public Licence. See the COPYING file.
@@ -15,6 +15,7 @@
 #include <stdarg.h>
 
 #include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
 #include "libtgeom.h"
 
 
index b8c8119283719a75f242463693c43f113bdd34ad..ca1f7dbdf966f345caad3570e73c83eef9b528e0 100644 (file)
@@ -1,3 +1,15 @@
+/**********************************************************************
+ *
+ * PostGIS - Spatial Types for PostgreSQL
+ * http://postgis.refractions.net
+ *
+ * Copyright 2001-2006 Refractions Research Inc.
+ *
+ * This is free software; you can redistribute and/or modify it under
+ * the terms of the GNU General Public Licence. See the COPYING file.
+ *
+ **********************************************************************/
+
 
 #include <math.h>
 #include <float.h>
@@ -6,6 +18,7 @@
 #include <errno.h>
 
 #include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
 
 /*
  * Lower this to reduce integrity checks
index c65f18785348078fcf22d3d7b485304ae9742706..7d8fb777f906d4fcd25e62bff85d039874759252 100644 (file)
@@ -13,6 +13,7 @@
 #include "lwgeom_geos.h"
 #include "liblwgeom.h"
 #include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
 #include "profile.h"
 
 #include <stdlib.h>
index f96876281b52647dc44d442e417b728499c50fcc..88aeb9ad708d156726f331b39b10a4e40ce95aa8 100644 (file)
@@ -38,6 +38,7 @@
 #include "liblwgeom.h"
 #include "lwgeom_geos.h"
 #include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
 
 #include <string.h>
 #include <stdlib.h>
diff --git a/liblwgeom/lwgeom_log.h b/liblwgeom/lwgeom_log.h
new file mode 100644 (file)
index 0000000..fb8bc00
--- /dev/null
@@ -0,0 +1,60 @@
+/**********************************************************************
+ * 
+ * PostGIS - Spatial Types for PostgreSQL
+ * http://postgis.refractions.net
+ *
+ * Copyright 2011 Sandro Santilli <strk@keybit.net>
+ * Copyright 2008 Paul Ramsey <pramsey@cleverelephant.ca>
+ * Copyright 2007-2008 Mark Cave-Ayland
+ * Copyright 2001-2006 Refractions Research Inc.
+ *
+ * This is free software; you can redistribute and/or modify it under
+ * the terms of the GNU General Public Licence. See the COPYING file.
+ *
+ **********************************************************************
+ *
+ * Internal logging routines
+ *
+ **********************************************************************/
+
+#ifndef LWGEOM_LOG_H
+#define LWGEOM_LOG_H 1
+
+#include <stdarg.h>
+
+/*
+ * Debug macros
+ */
+#if POSTGIS_DEBUG_LEVEL > 0
+
+/* Display a notice at the given debug level */
+#define LWDEBUG(level, msg) \
+        do { \
+            if (POSTGIS_DEBUG_LEVEL >= level) \
+              lwnotice("[%s:%s:%d] " msg, __FILE__, __func__, __LINE__); \
+        } while (0);
+
+/* Display a formatted notice at the given debug level
+ * (like printf, with variadic arguments) */
+#define LWDEBUGF(level, msg, ...) \
+        do { \
+            if (POSTGIS_DEBUG_LEVEL >= level) \
+              lwnotice("[%s:%s:%d] " msg, \
+                __FILE__, __func__, __LINE__, __VA_ARGS__); \
+        } while (0);
+
+#else /* POSTGIS_DEBUG_LEVEL <= 0 */
+
+/* Empty prototype that can be optimised away by the compiler
+ * for non-debug builds */
+#define LWDEBUG(level, msg) \
+        ((void) 0)
+
+/* Empty prototype that can be optimised away by the compiler
+ * for non-debug builds */
+#define LWDEBUGF(level, msg, ...) \
+        ((void) 0)
+
+#endif /* POSTGIS_DEBUG_LEVEL <= 0 */
+
+#endif /* LWGEOM_LOG_H */
index 874fa1115e9c275f9abe951629a51571a2f1af10..f20cd82a2024cd56c5d18ce8d8a3f3a982214c73 100644 (file)
@@ -12,6 +12,7 @@
 
 #include "proj_api.h"
 #include "liblwgeom.h"
+#include "lwgeom_log.h"
 #include <math.h>
 #include <string.h>
 
index 133c0ce903e872b84562effb116b30c58bc30fb6..2afb02c4159df5df4aa3aae4327646c16ff86d63 100644 (file)
@@ -12,6 +12,7 @@
 
 #include <stdlib.h>
 #include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
 #include "lwhomogenize.h"
 
 
index d1899c94212ab8f10b91f5b69887af10420a6c68..e4a36efbeed4c07518cbddc10e3b718d3973c10e 100644 (file)
@@ -1,8 +1,8 @@
 /**********************************************************************
- * $Id$
  *
  * PostGIS - Spatial Types for PostgreSQL
- * Copyright 2009 Paul Ramsey <pramsey@cleverelephant.ca>
+ *
+ * Copyright (C) 2009 Paul Ramsey <pramsey@cleverelephant.ca>
  *
  * This is free software; you can redistribute and/or modify it under
  * the terms of the GNU General Public Licence. See the COPYING file.
@@ -10,6 +10,7 @@
  **********************************************************************/
 
 #include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
 #include <sys/param.h>
 
 /**
index 2c4c613e73a3f9615edacf7831ffaee1bf5ca146..0701ce34cc7eb461d0b6cf0c41fc07b3d0299fb9 100644 (file)
@@ -2,7 +2,7 @@
  *
  * PostGIS - Spatial Types for PostgreSQL
  *
- * Copyright 2010 Paul Ramsey <pramsey@cleverelephant.ca>
+ * Copyright (C) 2010 Paul Ramsey <pramsey@cleverelephant.ca>
  *
  * This is free software; you can redistribute and/or modify it under
  * the terms of the GNU General Public Licence. See the COPYING file.
@@ -13,6 +13,7 @@
 
 #include "lwin_wkt.h"
 #include "lwin_wkt_parse.h"
+#include "lwgeom_log.h"
 
 
 /*
index 23d77614beadb1f5aba9656a552336436a122fdf..6826fcd56d959a7620a7bc6bfb016637fe91cc5f 100644 (file)
@@ -625,6 +625,7 @@ char *wkt_yytext;
 #include <string.h>
 #include "lwin_wkt.h"
 #include "lwin_wkt_parse.h"
+#include "lwgeom_log.h"
 
 static YY_BUFFER_STATE wkt_yy_buf_state; 
 
index 50056870f0d15df85647e4c7a8c265b1184d3288..ed08b84082d65a27a8cc8e92caa53a4de23e8ada 100644 (file)
@@ -6,6 +6,7 @@
 #include <string.h>
 #include "lwin_wkt.h"
 #include "lwin_wkt_parse.h"
+#include "lwgeom_log.h"
 
 static YY_BUFFER_STATE wkt_yy_buf_state; 
 
index 0fdc9aa58958645cea9014c0ab8e1ab9987eaa4f..5a982dfa70df32e365a0e8b656d51e2b00874e2b 100644 (file)
 #include <stdlib.h>
 #include "lwin_wkt.h"
 #include "lwin_wkt_parse.h"
+#include "lwgeom_log.h"
 
 
 /* Prototypes to quiet the compiler */
index dada3d016464f8628e480a111e009af93d755ac4..89c0301a32f62e6482f78dbe2aaff47c10a0a5a0 100644 (file)
@@ -6,6 +6,7 @@
 #include <stdlib.h>
 #include "lwin_wkt.h"
 #include "lwin_wkt_parse.h"
+#include "lwgeom_log.h"
 
 
 /* Prototypes to quiet the compiler */
index 06910cca16b7b0d9cb313fee1e622ae73f29e920..d5ad6e8861840674a40b8206aaf3cf290af3ff83 100644 (file)
@@ -1,9 +1,9 @@
 /**********************************************************************
- * $Id$
  *
  * PostGIS - Spatial Types for PostgreSQL
  * http://postgis.refractions.net
- * Copyright 2001-2006 Refractions Research Inc.
+ *
+ * Copyright (C) 2001-2006 Refractions Research Inc.
  *
  * This is free software; you can redistribute and/or modify it under
  * the terms of the GNU General Public Licence. See the COPYING file.
@@ -16,6 +16,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
 
 
 
index 19b634177be814c69b9fbabfb7301ea74cf67292..04924d5f0fdae87b4fab914704e635dc0ba94c66 100644 (file)
@@ -1,9 +1,9 @@
 /**********************************************************************
- * $Id$
  *
  * PostGIS - Spatial Types for PostgreSQL
  * http://postgis.refractions.net
- * Copyright 2001-2006 Refractions Research Inc.
+ * 
+ * Copyright (C) 2001-2006 Refractions Research Inc.
  *
  * This is free software; you can redistribute and/or modify it under
  * the terms of the GNU General Public Licence. See the COPYING file.
@@ -14,6 +14,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
 
 void
 lwmpoint_release(LWMPOINT *lwmpoint)
index 8d026a8b7c0082ad1c7c925c5be5a862b486d398..a4659d8127249abc9e736aec335a97833d0a1b42 100644 (file)
@@ -1,9 +1,9 @@
 /**********************************************************************
- * $Id$
  *
  * PostGIS - Spatial Types for PostgreSQL
  * http://postgis.refractions.net
- * Copyright 2001-2006 Refractions Research Inc.
+ *
+ * Copyright (C) 2001-2006 Refractions Research Inc.
  *
  * This is free software; you can redistribute and/or modify it under
  * the terms of the GNU General Public Licence. See the COPYING file.
@@ -14,6 +14,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
 
 
 void
index c7d651633bb2de108906706ab2482c05f3219469..bb864fb678b5e805cff2c07ef7cdf4ef707e6131 100644 (file)
@@ -1,9 +1,9 @@
 /**********************************************************************
- * $Id$
  *
  * PostGIS - Spatial Types for PostgreSQL
  * http://postgis.refractions.net
- * Copyright 2001-2006 Refractions Research Inc.
+ *
+ * Copyright (C) 2001-2006 Refractions Research Inc.
  *
  * This is free software; you can redistribute and/or modify it under
  * the terms of the GNU General Public Licence. See the COPYING file.
@@ -14,6 +14,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
 
 
 LWMSURFACE *
index 8a11dcd8009e94072e3dcb8622e1ba8b1fd3220b..f012e04c32dde0c87d7467ddc7bda143147a0cc2 100644 (file)
@@ -1,8 +1,8 @@
 /**********************************************************************
- * $Id$
  *
  * PostGIS - Spatial Types for PostgreSQL
- * Copyright 2009 Paul Ramsey <pramsey@cleverelephant.ca>
+ *
+ * Copyright (C) 2009 Paul Ramsey <pramsey@cleverelephant.ca>
  *
  * This is free software; you can redistribute and/or modify it under
  * the terms of the GNU General Public Licence. See the COPYING file.
@@ -10,6 +10,7 @@
  **********************************************************************/
 
 #include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
 #include <sys/param.h>
 
 static uint8_t* lwgeom_to_wkb_buf(const LWGEOM *geom, uint8_t *buf, uint8_t variant);
index 6d6bdc215f4cbc9a4951332f38defb4319f992cf..124e295ba4e9400015c8b2f7d2b1d6b44d950de8 100644 (file)
@@ -1,8 +1,8 @@
 /**********************************************************************
- * $Id$
  *
  * PostGIS - Spatial Types for PostgreSQL
- * Copyright 2009 Paul Ramsey <pramsey@cleverelephant.ca>
+ *
+ * Copyright (C) 2009 Paul Ramsey <pramsey@cleverelephant.ca>
  *
  * This is free software; you can redistribute and/or modify it under
  * the terms of the GNU General Public Licence. See the COPYING file.
@@ -10,6 +10,7 @@
  **********************************************************************/
 
 #include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
 #include "stringbuffer.h"
 
 static void lwgeom_to_wkt_sb(const LWGEOM *geom, stringbuffer_t *sb, int precision, uint8_t variant);
index 78e395ab41816ed9ab4c3b02bac108c8cfe65939..51047a04591d7087db31938fa0442167fa9b6a08 100644 (file)
@@ -1,9 +1,9 @@
 /**********************************************************************
- * $Id$
  *
  * PostGIS - Spatial Types for PostgreSQL
  * http://postgis.refractions.net
- * Copyright 2001-2006 Refractions Research Inc.
+ *
+ * Copyright (C) 2001-2006 Refractions Research Inc.
  *
  * This is free software; you can redistribute and/or modify it under
  * the terms of the GNU General Public Licence. See the COPYING file.
@@ -14,6 +14,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
 
 
 /*
index b19fbc408c0fd675a2547b2e2796cc9a4e3cee07..bf6a7528a859348bea28f71f72f4dd94cb793edf 100644 (file)
@@ -1,9 +1,9 @@
 /**********************************************************************
- * $Id$
  *
  * PostGIS - Spatial Types for PostgreSQL
  * http://postgis.refractions.net
- * Copyright 2001-2006 Refractions Research Inc.
+ *
+ * Copyright (C) 2001-2006 Refractions Research Inc.
  *
  * This is free software; you can redistribute and/or modify it under
  * the terms of the GNU General Public Licence. See the COPYING file.
@@ -16,6 +16,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
 
 
 #define CHECK_POLY_RINGS_ZM 1
index 52038008fd4bd963486d3794b8791854bc3e1161..e4c746c3afa2d06a31badc408d7b53d4f0026cf5 100644 (file)
@@ -1,9 +1,9 @@
 /**********************************************************************
- * $Id:$
  *
  * PostGIS - Spatial Types for PostgreSQL
  * http://postgis.refractions.net
- * Copyright 2001-2006 Refractions Research Inc.
+ *
+ * Copyright (C) 2001-2006 Refractions Research Inc.
  *
  * This is free software; you can redistribute and/or modify it under
  * the terms of the GNU General Public Licence. See the COPYING file.
@@ -14,6 +14,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
 
 
 LWPSURFACE *
index 7406542c03f8ae66e6d509ee5bc9233362230f56..2955afc3aef691bf39ace7efd90177aaacc07d9f 100644 (file)
@@ -17,6 +17,7 @@
 #include <math.h>
 
 #include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
 
 
 LWMLINE *lwmcurve_segmentize(LWMCURVE *mcurve, uint32_t perQuad);
index c84fab0841ded853fecdc15d5871e23bc8e285e6..5f11555094cf4d4d15323258a0a583fa08fcb124 100644 (file)
@@ -1,9 +1,9 @@
 /**********************************************************************
- * $Id$
  *
  * PostGIS - Spatial Types for PostgreSQL
- * Copyright 2009 Paul Ramsey <pramsey@cleverelephant.ca>
- * Copyright 2009 David Skea <David.Skea@gov.bc.ca>
+ *
+ * Copyright (C) 2009 Paul Ramsey <pramsey@cleverelephant.ca>
+ * Copyright (C) 2009 David Skea <David.Skea@gov.bc.ca>
  *
  * This is free software; you can redistribute and/or modify it under
  * the terms of the GNU General Public Licence. See the COPYING file.
@@ -11,6 +11,7 @@
  **********************************************************************/
 
 #include "lwgeodetic.h"
+#include "lwgeom_log.h"
 
 /**
 * Initialize spheroid object based on major and minor axis
index abc706ced8dfc9ed3d2587aa88d11a0e8e6fa2e8..ecae808b3e016ef0688434c938d62522e742ff88 100644 (file)
@@ -1,9 +1,9 @@
 /**********************************************************************
- * $Id:$
  *
  * PostGIS - Spatial Types for PostgreSQL
  * http://postgis.refractions.net
- * Copyright 2001-2006 Refractions Research Inc.
+ *
+ * Copyright (C) 2001-2006 Refractions Research Inc.
  *
  * This is free software; you can redistribute and/or modify it under
  * the terms of the GNU General Public Licence. See the COPYING file.
@@ -14,6 +14,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
 
 
 LWTIN *
index ffdf3091d49f63e83495e786f5efb2647392cfc6..30b51acb1a18d0465db01a9ee6c9ed49febb4d9e 100644 (file)
@@ -1,4 +1,5 @@
 #include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
 #include "lwtree.h"
 
 
index c21a39848e1927678c355f2fb2a14408ee812299..c43714508257df67aa8892b97e625053301cbb98 100644 (file)
@@ -1,9 +1,9 @@
 /**********************************************************************
- * $Id:$
  *
  * PostGIS - Spatial Types for PostgreSQL
  * http://postgis.refractions.net
- * Copyright 2010 - Oslandia
+ * 
+ * Copyright (C) 2010 - Oslandia
  *
  * This is free software; you can redistribute and/or modify it under
  * the terms of the GNU General Public Licence. See the COPYING file.
@@ -16,6 +16,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
 
 
 
index ddd5c91d2900ec2474474280de14e8646d1e52dd..d47e8bfceba2597d39bfb8a36485ec56c6c3d190 100644 (file)
@@ -7,6 +7,7 @@
 /* Global variables */
 #include "../postgis_config.h"
 #include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
 
 void *init_allocator(size_t size);
 void init_freeor(void *mem);
index d3b8c00269528d4619d65e13ae8808557012650f..d8711a580f2b4fa73d76683f6c59c91924add571 100644 (file)
@@ -1,6 +1,4 @@
-
 /**********************************************************************
- * $Id$
  *
  * PostGIS - Spatial Types for PostgreSQL
  * http://postgis.refractions.net
@@ -17,6 +15,7 @@
 #include <stdlib.h>
 
 #include "measures.h"
+#include "lwgeom_log.h"
 
 
 /*------------------------------------------------------------------------------------------------------------
index 62dfc6ffc04adf11203e70620675e5beb072b376..becdea2403503d48b01f811e27a4c86a1d3f331a 100644 (file)
@@ -16,6 +16,7 @@
 #include <stdlib.h>\r
 \r
 #include "measures3d.h"\r
+#include "lwgeom_log.h"\r
 \r
 \r
 /*------------------------------------------------------------------------------------------------------------\r
index 532f4975a94e99fa98b7bffe1761b3412417ac06..7ac925ae04641c4265f81faf836696dd500ca934 100644 (file)
@@ -1,5 +1,4 @@
 /**********************************************************************
- * $Id$
  *
  * PostGIS - Spatial Types for PostgreSQL
  * http://postgis.refractions.net
@@ -14,6 +13,7 @@
 #include <string.h>
 
 #include "liblwgeom_internal.h"
+#include "lwgeom_log.h"
 
 /*
  * Size of point represeneted in the POINTARRAY
index 63bbb771085cbee58cf48db722b71289f59a679e..a6e191e0b744b658b7a985b4349244a2371387ac 100644 (file)
@@ -157,7 +157,7 @@ PROJ4SRSCacheDelete(MemoryContext context)
        if (!projection)
                elog(ERROR, "PROJ4SRSCacheDelete: Trying to delete non-existant projection object with MemoryContext key (%p)", (void *)context);
 
-       LWDEBUGF(3, "deleting projection object (%p) with MemoryContext key (%p)", projection, context);
+       POSTGIS_DEBUGF(3, "deleting projection object (%p) with MemoryContext key (%p)", projection, context);
 
        /* Free it */
        pj_free(projection);
@@ -508,7 +508,7 @@ AddToPROJ4SRSCache(PROJ4PortalCache *PROJ4Cache, int srid, int other_srid)
                {
                        if (PROJ4Cache->PROJ4SRSCache[i].srid != other_srid && found == false)
                        {
-                               LWDEBUGF(3, "choosing to remove item from query cache with SRID %d and index %d", PROJ4Cache->PROJ4SRSCache[i].srid, i);
+                               POSTGIS_DEBUGF(3, "choosing to remove item from query cache with SRID %d and index %d", PROJ4Cache->PROJ4SRSCache[i].srid, i);
 
                                DeleteFromPROJ4SRSCache(PROJ4Cache, PROJ4Cache->PROJ4SRSCache[i].srid);
                                PROJ4Cache->PROJ4SRSCacheCount = i;
@@ -522,7 +522,7 @@ AddToPROJ4SRSCache(PROJ4PortalCache *PROJ4Cache, int srid, int other_srid)
         * Now create a memory context for this projection and
         * store it in the backend hash
         */
-       LWDEBUGF(3, "adding SRID %d with proj4text \"%s\" to query cache at index %d", srid, proj_str, PROJ4Cache->PROJ4SRSCacheCount);
+       POSTGIS_DEBUGF(3, "adding SRID %d with proj4text \"%s\" to query cache at index %d", srid, proj_str, PROJ4Cache->PROJ4SRSCacheCount);
 
        PJMemoryContext = MemoryContextCreate(T_AllocSetContext, 8192,
                                              &PROJ4SRSCacheContextMethods,
@@ -537,7 +537,7 @@ AddToPROJ4SRSCache(PROJ4PortalCache *PROJ4Cache, int srid, int other_srid)
         * Add the MemoryContext to the backend hash so we can
         * clean up upon portal shutdown
         */
-       LWDEBUGF(3, "adding projection object (%p) to hash table with MemoryContext key (%p)", projection, PJMemoryContext);
+       POSTGIS_DEBUGF(3, "adding projection object (%p) to hash table with MemoryContext key (%p)", projection, PJMemoryContext);
 
        AddPJHashEntry(PJMemoryContext, projection);
 
@@ -568,7 +568,7 @@ static void DeleteFromPROJ4SRSCache(PROJ4PortalCache *PROJ4Cache, int srid)
        {
                if (PROJ4Cache->PROJ4SRSCache[i].srid == srid)
                {
-                       LWDEBUGF(3, "removing query cache entry with SRID %d at index %d", srid, i);
+                       POSTGIS_DEBUGF(3, "removing query cache entry with SRID %d at index %d", srid, i);
 
                        /*
                         * Zero out the entries and free the PROJ4 handle
index 7186b46e600b029453a4a511a275ff86f982cbef..5dbf45a9f608aea8ace517fec37ef82ec588a298 100644 (file)
@@ -3,7 +3,8 @@
  *
  * PostGIS - Spatial Types for PostgreSQL
  * http://www.postgis.org
- * Copyright 2001-2003 Refractions Research Inc.
+ *
+ * Copyright (C) 2001-2003 Refractions Research Inc.
  *
  * This is free software; you can redistribute and/or modify it under
  * the terms of the GNU General Public Licence. See the COPYING file.
@@ -47,6 +48,7 @@
 #include "getopt.h"
 
 #include "../liblwgeom/liblwgeom.h" /* for LWGEOM struct and funx */
+#include "../liblwgeom/lwgeom_log.h" /* for LWDEBUG macros */
 
 /* Maximum DBF field width (according to ARCGIS) */
 #define MAX_DBF_FIELD_SIZE 254
index 846b39fde5730356aba6e15743e79ae886a4b451..4b0efe88c82aa54d7086be67cc820d07e3f810c8 100644 (file)
@@ -1,10 +1,11 @@
 /**********************************************************************
- * $Id$
  *
  * PostGIS - Spatial Types for PostgreSQL
  * http://www.postgis.org
- * Copyright 2008 OpenGeo.org
- * Copyright 2009 Mark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>
+ * 
+ * Copyright (C) 2008 OpenGeo.org
+ * Copyright (C) 2009 Mark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>
+ *
  * This is free software; you can redistribute and/or modify it under
  * the terms of the GNU General Public Licence. See the COPYING file.
  *
@@ -14,6 +15,7 @@
 
 #include "shp2pgsql-core.h"
 #include "../liblwgeom/liblwgeom.h" /* for lw_vasprintf */
+#include "../liblwgeom/lwgeom_log.h" /* for LWDEBUG macros */
 
 
 /* Internal ring/point structures */
index b7c75dbb705d3e7ba1627d843e492148df16f358..e00a02057afda0cccfa25cfb76fbb7184687a477 100644 (file)
@@ -2,7 +2,8 @@
  * $Id: geography_inout.c 4535 2009-09-28 18:16:21Z colivier $
  *
  * PostGIS - Spatial Types for PostgreSQL
- * Copyright 2009 Paul Ramsey <pramsey@cleverelephant.ca>
+ *
+ * Copyright (C) 2009 Paul Ramsey <pramsey@cleverelephant.ca>
  *
  * This is free software; you can redistribute and/or modify it under
  * the terms of the GNU General Public Licence. See the COPYING file.
@@ -402,15 +403,15 @@ Datum geography_point_outside(PG_FUNCTION_ARGS)
        if ( gserialized_get_gbox_p(g, &gbox) == LW_FAILURE )
        {
                LWGEOM *lwgeom = lwgeom_from_gserialized(g);
-               LWDEBUGF(4,"unable to read gbox from gserialized, calculating from lwgeom (%p)", lwgeom);
+               POSTGIS_DEBUGF(4,"unable to read gbox from gserialized, calculating from lwgeom (%p)", lwgeom);
                if ( lwgeom_calculate_gbox(lwgeom, &gbox) == LW_FAILURE )
                {
-                       LWDEBUG(4,"lwgeom_calculate_gbox returned LW_FAILURE");
+                       POSTGIS_DEBUG(4,"lwgeom_calculate_gbox returned LW_FAILURE");
                        elog(ERROR, "Error in lwgeom_calculate_gbox calculation.");
                        PG_RETURN_NULL();
                }
        }
-       LWDEBUGF(4, "got gbox %s", gbox_to_string(&gbox));
+       POSTGIS_DEBUGF(4, "got gbox %s", gbox_to_string(&gbox));
 
        /* Get an exterior point, based on this gbox */
        gbox_pt_outside(&gbox, &pt);
@@ -521,7 +522,7 @@ Datum geography_bestsrid(PG_FUNCTION_ARGS)
        if ( ! empty1 && lwgeom_calculate_gbox_cartesian(lwgeom1, &gbox1) == LW_FAILURE )
                elog(ERROR, "Error in geography_bestsrid calling lwgeom_calculate_gbox(lwgeom1, &gbox1)");
 
-       LWDEBUGF(4, "calculated gbox = %s", gbox_to_string(&gbox1));
+       POSTGIS_DEBUGF(4, "calculated gbox = %s", gbox_to_string(&gbox1));
 
        /* If we have a unique second argument, fill in all the necessarily variables. */
        if ( d1 != d2 )
index 3ef6fb212c7335c28c6225f931600291694e644e..615001e74d296972fe71edd6521ace9dd31b5a59 100644 (file)
@@ -1,3 +1,14 @@
+/**********************************************************************
+ *
+ * PostGIS - Spatial Types for PostgreSQL
+ * http://postgis.refractions.net
+ *
+ * Copyright (C) 2004 Refractions Research Inc.
+ *
+ * This is free software; you can redistribute and/or modify it under
+ * the terms of the GNU General Public Licence. See the COPYING file.
+ *
+ **********************************************************************/
 
 #include "lwgeom_pg.h"
 #include "liblwgeom.h"
@@ -84,7 +95,7 @@ lwcollection_summary(LWCOLLECTION *col, int offset)
        int i;
        char *pad="";
 
-       LWDEBUG(2, "lwcollection_summary called");
+       POSTGIS_DEBUG(2, "lwcollection_summary called");
 
        result = (char *)lwalloc(size);
 
@@ -99,13 +110,13 @@ lwcollection_summary(LWCOLLECTION *col, int offset)
                size += strlen(tmp)+1;
                result = lwrealloc(result, size);
 
-               LWDEBUGF(4, "Reallocated %d bytes for result", size);
+               POSTGIS_DEBUGF(4, "Reallocated %d bytes for result", size);
 
                strcat(result, tmp);
                lwfree(tmp);
        }
 
-       LWDEBUG(3, "lwcollection_summary returning");
+       POSTGIS_DEBUG(3, "lwcollection_summary returning");
 
        return result;
 }
@@ -119,7 +130,7 @@ lwpoly_summary(LWPOLY *poly, int offset)
        int i;
        char *pad="";
 
-       LWDEBUG(2, "lwpoly_summary called");
+       POSTGIS_DEBUG(2, "lwpoly_summary called");
 
        result = lwalloc(size);
 
@@ -135,7 +146,7 @@ lwpoly_summary(LWPOLY *poly, int offset)
                strcat(result,tmp);
        }
 
-       LWDEBUG(3, "lwpoly_summary returning");
+       POSTGIS_DEBUG(3, "lwpoly_summary returning");
 
        return result;
 }
index b41e52b4d1c456c5d6898ef944609fb4c9d7a51a..6fcaaac742debd8d30a370f320d69515d6d1711c 100644 (file)
@@ -1,9 +1,9 @@
 /**********************************************************************
- * $Id$
  *
  * PostGIS - Spatial Types for PostgreSQL
  * http://postgis.refractions.net
- * Copyright 2001-2005 Refractions Research Inc.
+ *
+ * Copyright (C) 2001-2005 Refractions Research Inc.
  *
  * This is free software; you can redistribute and/or modify it under
  * the terms of the GNU General Public Licence. See the COPYING file.
@@ -285,7 +285,7 @@ ptarray_grid(POINTARRAY *pa, gridspec *grid)
        int ipn, opn; /* point numbers (input/output) */
        POINTARRAY *dpa;
 
-       LWDEBUGF(2, "ptarray_grid called on %p", pa);
+       POSTGIS_DEBUGF(2, "ptarray_grid called on %p", pa);
 
        dpa = ptarray_construct_empty(FLAGS_GET_Z(pa->flags),FLAGS_GET_M(pa->flags), pa->npoints);
 
@@ -370,7 +370,7 @@ lwpoly_grid(LWPOLY *poly, gridspec *grid)
 
        nrings = 0;
 
-       LWDEBUGF(3, "grid_polygon3d: applying grid to polygon with %d rings",
+       POSTGIS_DEBUGF(3, "grid_polygon3d: applying grid to polygon with %d rings",
                 poly->nrings);
 
        for (ri=0; ri<poly->nrings; ri++)
@@ -383,7 +383,7 @@ lwpoly_grid(LWPOLY *poly, gridspec *grid)
                getPoint2d_p(ring, 0, &p1);
                getPoint2d_p(ring, ring->npoints-1, &p2);
                if ( ! SAMEPOINT(&p1, &p2) )
-                       LWDEBUG(4, "Before gridding: first point != last point");
+                       POSTGIS_DEBUG(4, "Before gridding: first point != last point");
 #endif
 
                newring = ptarray_grid(ring, grid);
@@ -393,7 +393,7 @@ lwpoly_grid(LWPOLY *poly, gridspec *grid)
                {
                        pfree(newring);
 
-                       LWDEBUGF(3, "grid_polygon3d: ring%d skipped ( <4 pts )", ri);
+                       POSTGIS_DEBUGF(3, "grid_polygon3d: ring%d skipped ( <4 pts )", ri);
 
                        if ( ri ) continue;
                        else break; /* this is the external ring, no need to work on holes */
@@ -403,10 +403,10 @@ lwpoly_grid(LWPOLY *poly, gridspec *grid)
                getPoint2d_p(newring, 0, &p1);
                getPoint2d_p(newring, newring->npoints-1, &p2);
                if ( ! SAMEPOINT(&p1, &p2) )
-                       LWDEBUG(4, "After gridding: first point != last point");
+                       POSTGIS_DEBUG(4, "After gridding: first point != last point");
 #endif
 
-               LWDEBUGF(3, "grid_polygon3d: ring%d simplified from %d to %d points", ri,
+               POSTGIS_DEBUGF(3, "grid_polygon3d: ring%d simplified from %d to %d points", ri,
                         ring->npoints, newring->npoints);
 
                /*
@@ -429,7 +429,7 @@ lwpoly_grid(LWPOLY *poly, gridspec *grid)
                newrings[nrings++] = newring;
        }
 
-       LWDEBUGF(3, "grid_polygon3d: simplified polygon with %d rings", nrings);
+       POSTGIS_DEBUGF(3, "grid_polygon3d: simplified polygon with %d rings", nrings);
 
        if ( ! nrings ) return NULL;
 
@@ -448,7 +448,7 @@ lwpoint_grid(LWPOINT *point, gridspec *grid)
        /* TODO: grid bounding box ? */
        opoint = lwpoint_construct(point->srid, NULL, opa);
 
-       LWDEBUG(2, "lwpoint_grid called");
+       POSTGIS_DEBUG(2, "lwpoint_grid called");
 
        return opoint;
 }
@@ -1012,17 +1012,17 @@ int isOnSegment(POINT2D *seg1, POINT2D *seg2, POINT2D *point)
                minY = seg1->y;
        }
 
-       LWDEBUGF(3, "maxX minX/maxY minY: %.8f %.8f/%.8f %.8f", maxX, minX, maxY, minY);
+       POSTGIS_DEBUGF(3, "maxX minX/maxY minY: %.8f %.8f/%.8f %.8f", maxX, minX, maxY, minY);
 
        if (maxX < point->x || minX > point->x)
        {
-               LWDEBUGF(3, "X value %.8f falls outside the range %.8f-%.8f", point->x, minX, maxX);
+               POSTGIS_DEBUGF(3, "X value %.8f falls outside the range %.8f-%.8f", point->x, minX, maxX);
 
                return 0;
        }
        else if (maxY < point->y || minY > point->y)
        {
-               LWDEBUGF(3, "Y value %.8f falls outside the range %.8f-%.8f", point->y, minY, maxY);
+               POSTGIS_DEBUGF(3, "Y value %.8f falls outside the range %.8f-%.8f", point->y, minY, maxY);
 
                return 0;
        }
@@ -1043,7 +1043,7 @@ int point_in_ring_rtree(RTREE_NODE *root, POINT2D *point)
        POINT2D seg2;
        LWMLINE *lines;
 
-       LWDEBUG(2, "point_in_ring called.");
+       POSTGIS_DEBUG(2, "point_in_ring called.");
 
        lines = findLineSegments(root, point->y);
        if (!lines)
@@ -1057,14 +1057,14 @@ int point_in_ring_rtree(RTREE_NODE *root, POINT2D *point)
 
                side = determineSide(&seg1, &seg2, point);
 
-               LWDEBUGF(3, "segment: (%.8f, %.8f),(%.8f, %.8f)", seg1.x, seg1.y, seg2.x, seg2.y);
-               LWDEBUGF(3, "side result: %.8f", side);
-               LWDEBUGF(3, "counterclockwise wrap %d, clockwise wrap %d", FP_CONTAINS_BOTTOM(seg1.y,point->y,seg2.y), FP_CONTAINS_BOTTOM(seg2.y,point->y,seg1.y));
+               POSTGIS_DEBUGF(3, "segment: (%.8f, %.8f),(%.8f, %.8f)", seg1.x, seg1.y, seg2.x, seg2.y);
+               POSTGIS_DEBUGF(3, "side result: %.8f", side);
+               POSTGIS_DEBUGF(3, "counterclockwise wrap %d, clockwise wrap %d", FP_CONTAINS_BOTTOM(seg1.y,point->y,seg2.y), FP_CONTAINS_BOTTOM(seg2.y,point->y,seg1.y));
 
                /* zero length segments are ignored. */
                if (((seg2.x-seg1.x)*(seg2.x-seg1.x)+(seg2.y-seg1.y)*(seg2.y-seg1.y)) < 1e-12*1e-12)
                {
-                       LWDEBUG(3, "segment is zero length... ignoring.");
+                       POSTGIS_DEBUG(3, "segment is zero length... ignoring.");
 
                        continue;
                }
@@ -1074,7 +1074,7 @@ int point_in_ring_rtree(RTREE_NODE *root, POINT2D *point)
                {
                        if (isOnSegment(&seg1, &seg2, point) == 1)
                        {
-                               LWDEBUGF(3, "point on ring boundary between points %d, %d", i, i+1);
+                               POSTGIS_DEBUGF(3, "point on ring boundary between points %d, %d", i, i+1);
 
                                return 0;
                        }
@@ -1087,7 +1087,7 @@ int point_in_ring_rtree(RTREE_NODE *root, POINT2D *point)
                 */
                if (FP_CONTAINS_BOTTOM(seg1.y,point->y,seg2.y) && side>0)
                {
-                       LWDEBUG(3, "incrementing winding number.");
+                       POSTGIS_DEBUG(3, "incrementing winding number.");
 
                        ++wn;
                }
@@ -1098,13 +1098,13 @@ int point_in_ring_rtree(RTREE_NODE *root, POINT2D *point)
                 */
                else if (FP_CONTAINS_BOTTOM(seg2.y,point->y,seg1.y) && side<0)
                {
-                       LWDEBUG(3, "decrementing winding number.");
+                       POSTGIS_DEBUG(3, "decrementing winding number.");
 
                        --wn;
                }
        }
 
-       LWDEBUGF(3, "winding number %d", wn);
+       POSTGIS_DEBUGF(3, "winding number %d", wn);
 
        if (wn == 0)
                return -1;
@@ -1125,7 +1125,7 @@ int point_in_ring(POINTARRAY *pts, POINT2D *point)
        POINT2D seg1;
        POINT2D seg2;
 
-       LWDEBUG(2, "point_in_ring called.");
+       POSTGIS_DEBUG(2, "point_in_ring called.");
 
 
        for (i=0; i<pts->npoints-1; i++)
@@ -1136,14 +1136,14 @@ int point_in_ring(POINTARRAY *pts, POINT2D *point)
 
                side = determineSide(&seg1, &seg2, point);
 
-               LWDEBUGF(3, "segment: (%.8f, %.8f),(%.8f, %.8f)", seg1.x, seg1.y, seg2.x, seg2.y);
-               LWDEBUGF(3, "side result: %.8f", side);
-               LWDEBUGF(3, "counterclockwise wrap %d, clockwise wrap %d", FP_CONTAINS_BOTTOM(seg1.y,point->y,seg2.y), FP_CONTAINS_BOTTOM(seg2.y,point->y,seg1.y));
+               POSTGIS_DEBUGF(3, "segment: (%.8f, %.8f),(%.8f, %.8f)", seg1.x, seg1.y, seg2.x, seg2.y);
+               POSTGIS_DEBUGF(3, "side result: %.8f", side);
+               POSTGIS_DEBUGF(3, "counterclockwise wrap %d, clockwise wrap %d", FP_CONTAINS_BOTTOM(seg1.y,point->y,seg2.y), FP_CONTAINS_BOTTOM(seg2.y,point->y,seg1.y));
 
                /* zero length segments are ignored. */
                if (((seg2.x-seg1.x)*(seg2.x-seg1.x)+(seg2.y-seg1.y)*(seg2.y-seg1.y)) < 1e-12*1e-12)
                {
-                       LWDEBUG(3, "segment is zero length... ignoring.");
+                       POSTGIS_DEBUG(3, "segment is zero length... ignoring.");
 
                        continue;
                }
@@ -1153,7 +1153,7 @@ int point_in_ring(POINTARRAY *pts, POINT2D *point)
                {
                        if (isOnSegment(&seg1, &seg2, point) == 1)
                        {
-                               LWDEBUGF(3, "point on ring boundary between points %d, %d", i, i+1);
+                               POSTGIS_DEBUGF(3, "point on ring boundary between points %d, %d", i, i+1);
 
                                return 0;
                        }
@@ -1166,7 +1166,7 @@ int point_in_ring(POINTARRAY *pts, POINT2D *point)
                 */
                if (FP_CONTAINS_BOTTOM(seg1.y,point->y,seg2.y) && side>0)
                {
-                       LWDEBUG(3, "incrementing winding number.");
+                       POSTGIS_DEBUG(3, "incrementing winding number.");
 
                        ++wn;
                }
@@ -1177,13 +1177,13 @@ int point_in_ring(POINTARRAY *pts, POINT2D *point)
                 */
                else if (FP_CONTAINS_BOTTOM(seg2.y,point->y,seg1.y) && side<0)
                {
-                       LWDEBUG(3, "decrementing winding number.");
+                       POSTGIS_DEBUG(3, "decrementing winding number.");
 
                        --wn;
                }
        }
 
-       LWDEBUGF(3, "winding number %d", wn);
+       POSTGIS_DEBUGF(3, "winding number %d", wn);
 
        if (wn == 0)
                return -1;
@@ -1199,14 +1199,14 @@ int point_in_polygon_rtree(RTREE_NODE **root, int ringCount, LWPOINT *point)
        int i;
        POINT2D pt;
 
-       LWDEBUGF(2, "point_in_polygon called for %p %d %p.", root, ringCount, point);
+       POSTGIS_DEBUGF(2, "point_in_polygon called for %p %d %p.", root, ringCount, point);
 
        getPoint2d_p(point->point, 0, &pt);
        /* assume bbox short-circuit has already been attempted */
 
        if (point_in_ring_rtree(root[0], &pt) != 1)
        {
-               LWDEBUG(3, "point_in_polygon_rtree: outside exterior ring.");
+               POSTGIS_DEBUG(3, "point_in_polygon_rtree: outside exterior ring.");
 
                return 0;
        }
@@ -1215,7 +1215,7 @@ int point_in_polygon_rtree(RTREE_NODE **root, int ringCount, LWPOINT *point)
        {
                if (point_in_ring_rtree(root[i], &pt) != -1)
                {
-                       LWDEBUGF(3, "point_in_polygon_rtree: within hole %d.", i);
+                       POSTGIS_DEBUGF(3, "point_in_polygon_rtree: within hole %d.", i);
 
                        return 0;
                }
@@ -1236,7 +1236,7 @@ int point_in_multipolygon_rtree(RTREE_NODE **root, int polyCount, int *ringCount
        POINT2D pt;
        int result = -1;
 
-       LWDEBUGF(2, "point_in_multipolygon_rtree called for %p %d %p.", root, polyCount, point);
+       POSTGIS_DEBUGF(2, "point_in_multipolygon_rtree called for %p %d %p.", root, polyCount, point);
 
        getPoint2d_p(point->point, 0, &pt);
        /* assume bbox short-circuit has already been attempted */
@@ -1247,14 +1247,14 @@ int point_in_multipolygon_rtree(RTREE_NODE **root, int polyCount, int *ringCount
        for ( p = 0; p < polyCount; p++ )
        {
                in_ring = point_in_ring_rtree(root[i], &pt);
-               LWDEBUGF(4, "point_in_multipolygon_rtree: exterior ring (%d), point_in_ring returned %d", p, in_ring);
+               POSTGIS_DEBUGF(4, "point_in_multipolygon_rtree: exterior ring (%d), point_in_ring returned %d", p, in_ring);
                if ( in_ring == -1 ) /* outside the exterior ring */
                {
-                       LWDEBUG(3, "point_in_multipolygon_rtree: outside exterior ring.");
+                       POSTGIS_DEBUG(3, "point_in_multipolygon_rtree: outside exterior ring.");
                }
                else if ( in_ring == 0 ) /* on the boundary */
                {
-                       LWDEBUGF(3, "point_in_multipolygon_rtree: on edge of exterior ring %d", p);
+                       POSTGIS_DEBUGF(3, "point_in_multipolygon_rtree: on edge of exterior ring %d", p);
                         return 0;
                } else {
                        result = in_ring;
@@ -1262,16 +1262,16 @@ int point_in_multipolygon_rtree(RTREE_NODE **root, int polyCount, int *ringCount
                        for(r=1; r<ringCounts[p]; r++)
                        {
                                in_ring = point_in_ring_rtree(root[i+r], &pt);
-                               LWDEBUGF(4, "point_in_multipolygon_rtree: interior ring (%d), point_in_ring returned %d", r, in_ring);
+                               POSTGIS_DEBUGF(4, "point_in_multipolygon_rtree: interior ring (%d), point_in_ring returned %d", r, in_ring);
                                if (in_ring == 1) /* inside a hole => outside the polygon */
                                {
-                                       LWDEBUGF(3, "point_in_multipolygon_rtree: within hole %d of exterior ring %d", r, p);
+                                       POSTGIS_DEBUGF(3, "point_in_multipolygon_rtree: within hole %d of exterior ring %d", r, p);
                                        result = -1;
                                        break;
                                }
                                if (in_ring == 0) /* on the edge of a hole */
                                {
-                                       LWDEBUGF(3, "point_in_multipolygon_rtree: on edge of hole %d of exterior ring %d", r, p);
+                                       POSTGIS_DEBUGF(3, "point_in_multipolygon_rtree: on edge of hole %d of exterior ring %d", r, p);
                                        return 0;
                                }
                        }
@@ -1301,7 +1301,7 @@ int point_in_polygon(LWPOLY *polygon, LWPOINT *point)
        POINTARRAY *ring;
        POINT2D pt;
 
-       LWDEBUG(2, "point_in_polygon called.");
+       POSTGIS_DEBUG(2, "point_in_polygon called.");
 
        getPoint2d_p(point->point, 0, &pt);
        /* assume bbox short-circuit has already been attempted */
@@ -1310,7 +1310,7 @@ int point_in_polygon(LWPOLY *polygon, LWPOINT *point)
        in_ring = point_in_ring(polygon->rings[0], &pt);
        if ( in_ring == -1) /* outside the exterior ring */
        {
-               LWDEBUG(3, "point_in_polygon: outside exterior ring.");
+               POSTGIS_DEBUG(3, "point_in_polygon: outside exterior ring.");
                return -1;
        }
        result = in_ring;
@@ -1321,12 +1321,12 @@ int point_in_polygon(LWPOLY *polygon, LWPOINT *point)
                in_ring = point_in_ring(polygon->rings[i], &pt);
                if (in_ring == 1) /* inside a hole => outside the polygon */
                {
-                       LWDEBUGF(3, "point_in_polygon: within hole %d.", i);
+                       POSTGIS_DEBUGF(3, "point_in_polygon: within hole %d.", i);
                        return -1;
                }
                if (in_ring == 0) /* on the edge of a hole */
                {
-                       LWDEBUGF(3, "point_in_polygon: on edge of hole %d.", i);
+                       POSTGIS_DEBUGF(3, "point_in_polygon: on edge of hole %d.", i);
                        return 0;
                }
        }
@@ -1344,7 +1344,7 @@ int point_in_multipolygon(LWMPOLY *mpolygon, LWPOINT *point)
        POINTARRAY *ring;
        POINT2D pt;
 
-       LWDEBUG(2, "point_in_polygon called.");
+       POSTGIS_DEBUG(2, "point_in_polygon called.");
 
        getPoint2d_p(point->point, 0, &pt);
        /* assume bbox short-circuit has already been attempted */
@@ -1359,7 +1359,7 @@ int point_in_multipolygon(LWMPOLY *mpolygon, LWPOINT *point)
                in_ring = point_in_ring(polygon->rings[0], &pt);
                if ( in_ring == -1) /* outside the exterior ring */
                {
-                       LWDEBUG(3, "point_in_polygon: outside exterior ring.");
+                       POSTGIS_DEBUG(3, "point_in_polygon: outside exterior ring.");
                        continue;
                }
                if ( in_ring == 0 )
@@ -1375,13 +1375,13 @@ int point_in_multipolygon(LWMPOLY *mpolygon, LWPOINT *point)
                        in_ring = point_in_ring(polygon->rings[i], &pt);
                        if (in_ring == 1) /* inside a hole => outside the polygon */
                        {
-                               LWDEBUGF(3, "point_in_polygon: within hole %d.", i);
+                               POSTGIS_DEBUGF(3, "point_in_polygon: within hole %d.", i);
                                result = -1;
                                break;
                        }
                        if (in_ring == 0) /* on the edge of a hole */
                        {
-                               LWDEBUGF(3, "point_in_polygon: on edge of hole %d.", i);
+                               POSTGIS_DEBUGF(3, "point_in_polygon: on edge of hole %d.", i);
                                return 0;
                        }
                }
index 8f10d0091f5cfa876c4c306f1d31d239e927facc..9adab598419d005d8ac87de2a5089d1ab87d7197 100644 (file)
@@ -1,9 +1,9 @@
 /**********************************************************************
- * $Id$
  *
  * PostGIS - Spatial Types for PostgreSQL
  * http://postgis.refractions.net
- * Copyright 2001-2005 Refractions Research Inc.
+ *
+ * Copyright (C) 2001-2005 Refractions Research Inc.
  *
  * This is free software; you can redistribute and/or modify it under
  * the terms of the GNU General Public Licence. See the COPYING file.
@@ -70,7 +70,7 @@ clip_seg_by_m_range(POINT4D *p1, POINT4D *p2, double m0, double m1)
        int swapped=0;
        int ret=0;
 
-       LWDEBUGF(3, "m0: %g m1: %g", m0, m1);
+       POSTGIS_DEBUGF(3, "m0: %g m1: %g", m0, m1);
 
        /* Handle corner case of m values being the same */
        if ( p1->m == p2->m )
@@ -124,9 +124,9 @@ clip_seg_by_m_range(POINT4D *p1, POINT4D *p2, double m0, double m1)
        dY=p2->y-p1->y;
        dZ=p2->z-p1->z;
 
-       LWDEBUGF(3, "dM0:%g dM1:%g", dM0, dM1);
-       LWDEBUGF(3, "dX:%g dY:%g dZ:%g", dX, dY, dZ);
-       LWDEBUGF(3, "swapped: %d", swapped);
+       POSTGIS_DEBUGF(3, "dM0:%g dM1:%g", dM0, dM1);
+       POSTGIS_DEBUGF(3, "dX:%g dY:%g dZ:%g", dX, dY, dZ);
+       POSTGIS_DEBUGF(3, "swapped: %d", swapped);
 
        /*
         * First point out of range, project
@@ -142,7 +142,7 @@ clip_seg_by_m_range(POINT4D *p1, POINT4D *p2, double m0, double m1)
                {
                        memcpy(p1, p2, sizeof(POINT4D));
 
-                       LWDEBUG(3, "Projected p1 on range (as copy of p2)");
+                       POSTGIS_DEBUG(3, "Projected p1 on range (as copy of p2)");
                }
                else
                {
@@ -152,7 +152,7 @@ clip_seg_by_m_range(POINT4D *p1, POINT4D *p2, double m0, double m1)
                        p1->z += (dZ*dM0);
                        p1->m = m0;
 
-                       LWDEBUG(3, "Projected p1 on range");
+                       POSTGIS_DEBUG(3, "Projected p1 on range");
                }
 
                if ( swapped ) ret |= 0x0100;
@@ -173,7 +173,7 @@ clip_seg_by_m_range(POINT4D *p1, POINT4D *p2, double m0, double m1)
                {
                        memcpy(p2, p1, sizeof(POINT4D));
 
-                       LWDEBUG(3, "Projected p2 on range (as copy of p1)");
+                       POSTGIS_DEBUG(3, "Projected p2 on range (as copy of p1)");
                }
                else
                {
@@ -183,7 +183,7 @@ clip_seg_by_m_range(POINT4D *p1, POINT4D *p2, double m0, double m1)
                        p2->z += (dZ*dM1);
                        p2->m = m1;
 
-                       LWDEBUG(3, "Projected p2 on range");
+                       POSTGIS_DEBUG(3, "Projected p2 on range");
                }
 
                if ( swapped ) ret |= 0x0010;
@@ -213,7 +213,7 @@ ptarray_locate_between_m(POINTARRAY *ipa, double m0, double m1)
         */
        ret.ptarrays=lwalloc(sizeof(POINTARRAY *)*ipa->npoints-1);
 
-       LWDEBUGF(2, "ptarray_locate...: called for pointarray %x, m0:%g, m1:%g",
+       POSTGIS_DEBUGF(2, "ptarray_locate...: called for pointarray %x, m0:%g, m1:%g",
                 ipa, m0, m1);
 
 
@@ -225,7 +225,7 @@ ptarray_locate_between_m(POINTARRAY *ipa, double m0, double m1)
                getPoint4d_p(ipa, i-1, &p1);
                getPoint4d_p(ipa, i, &p2);
 
-               LWDEBUGF(3, " segment %d-%d [ %g %g %g %g -  %g %g %g %g ]",
+               POSTGIS_DEBUGF(3, " segment %d-%d [ %g %g %g %g -  %g %g %g %g ]",
                         i-1, i,
                         p1.x, p1.y, p1.z, p1.m,
                         p2.x, p2.y, p2.z, p2.m);
@@ -235,14 +235,14 @@ ptarray_locate_between_m(POINTARRAY *ipa, double m0, double m1)
                /* segment completely outside, nothing to do */
                if (! clipval ) continue;
 
-               LWDEBUGF(3, " clipped to: [ %g %g %g %g - %g %g %g %g ]   clipval: %x", p1.x, p1.y, p1.z, p1.m,
+               POSTGIS_DEBUGF(3, " clipped to: [ %g %g %g %g - %g %g %g %g ]   clipval: %x", p1.x, p1.y, p1.z, p1.m,
                         p2.x, p2.y, p2.z, p2.m, clipval);
 
                /* If no points have been accumulated so far, then if clipval != 0 the first point must be the
                   start of the intersection */
                if (dpa == NULL)
                {
-                       LWDEBUGF(3, " 1 creating new POINTARRAY with first point %g,%g,%g,%g", p1.x, p1.y, p1.z, p1.m);
+                       POSTGIS_DEBUGF(3, " 1 creating new POINTARRAY with first point %g,%g,%g,%g", p1.x, p1.y, p1.z, p1.m);
 
                        dpa = ptarray_construct_empty(FLAGS_GET_Z(ipa->flags), FLAGS_GET_M(ipa->flags), ipa->npoints-i);
                        ptarray_append_point(dpa, &p1, LW_TRUE);
@@ -257,7 +257,7 @@ ptarray_locate_between_m(POINTARRAY *ipa, double m0, double m1)
                 */
                if ( clipval & 0x0100 || i == ipa->npoints-1 )
                {
-                       LWDEBUGF(3, " closing pointarray %x with %d points", dpa, dpa->npoints);
+                       POSTGIS_DEBUGF(3, " closing pointarray %x with %d points", dpa, dpa->npoints);
 
                        ret.ptarrays[ret.nptarrays++] = dpa;
                        dpa = NULL;
@@ -283,18 +283,18 @@ lwpoint_locate_between_m(LWPOINT *lwpoint, double m0, double m1)
 {
        POINT3DM p3dm;
 
-       LWDEBUGF(2, "lwpoint_locate_between called for lwpoint %x", lwpoint);
+       POSTGIS_DEBUGF(2, "lwpoint_locate_between called for lwpoint %x", lwpoint);
 
        lwpoint_getPoint3dm_p(lwpoint, &p3dm);
        if ( p3dm.m >= m0 && p3dm.m <= m1)
        {
-               LWDEBUG(3, " lwpoint... returning a clone of input");
+               POSTGIS_DEBUG(3, " lwpoint... returning a clone of input");
 
                return (LWGEOM *)lwpoint_clone(lwpoint);
        }
        else
        {
-               LWDEBUG(3, " lwpoint... returning a clone of input");
+               POSTGIS_DEBUG(3, " lwpoint... returning a clone of input");
 
                return NULL;
        }
@@ -324,9 +324,9 @@ lwline_locate_between_m(LWLINE *lwline_in, double m0, double m1)
        const int lineflag=0x10;
        POINTARRAYSET paset=ptarray_locate_between_m(ipa, m0, m1);
 
-       LWDEBUGF(2, "lwline_locate_between called for lwline %x", lwline_in);
+       POSTGIS_DEBUGF(2, "lwline_locate_between called for lwline %x", lwline_in);
 
-       LWDEBUGF(3, " ptarray_locate... returned %d pointarrays",
+       POSTGIS_DEBUGF(3, " ptarray_locate... returned %d pointarrays",
                 paset.nptarrays);
 
        if ( paset.nptarrays == 0 )
@@ -395,7 +395,7 @@ lwcollection_locate_between_m(LWCOLLECTION *lwcoll, double m0, double m1)
        int ngeoms=0;
        LWGEOM **geoms;
 
-       LWDEBUGF(2, "lwcollection_locate_between_m called for lwcoll %x", lwcoll);
+       POSTGIS_DEBUGF(2, "lwcollection_locate_between_m called for lwcoll %x", lwcoll);
 
        geoms=lwalloc(sizeof(LWGEOM *)*lwcoll->ngeoms);
        for (i=0; i<lwcoll->ngeoms; i++)
@@ -424,7 +424,7 @@ lwcollection_locate_between_m(LWCOLLECTION *lwcoll, double m0, double m1)
 static LWGEOM *
 lwgeom_locate_between_m(LWGEOM *lwin, double m0, double m1)
 {
-       LWDEBUGF(2, "lwgeom_locate_between called for lwgeom %x", lwin);
+       POSTGIS_DEBUGF(2, "lwgeom_locate_between called for lwgeom %x", lwin);
 
        switch (lwin->type)
        {
index 4d6c33f5a9267d0ee8514bdb862906e95a55c7e2..6cd674d53a01e2e343184cd3433822d4fd9b7058 100644 (file)
@@ -1,9 +1,8 @@
 /**********************************************************************
- * $Id$
  *
  * PostGIS - Spatial Types for PostgreSQL
  * http://postgis.refractions.net
- * Copyright 2001-2005 Refractions Research Inc.
+ * Copyright (C) 2001-2005 Refractions Research Inc.
  *
  * This is free software; you can redistribute and/or modify it under
  * the terms of the GNU General Public Licence. See the COPYING file.
@@ -30,11 +29,11 @@ RTREE_NODE *createTree(POINTARRAY *pointArray)
        int i, nodeCount;
        int childNodes, parentNodes;
 
-       LWDEBUGF(2, "createTree called with pointarray %p", pointArray);
+       POSTGIS_DEBUGF(2, "createTree called with pointarray %p", pointArray);
 
        nodeCount = pointArray->npoints - 1;
 
-       LWDEBUGF(3, "Total leaf nodes: %d", nodeCount);
+       POSTGIS_DEBUGF(3, "Total leaf nodes: %d", nodeCount);
 
        /*
         * Create a leaf node for every line segment.
@@ -53,7 +52,7 @@ RTREE_NODE *createTree(POINTARRAY *pointArray)
        parentNodes = nodeCount / 2;
        while (parentNodes > 0)
        {
-               LWDEBUGF(3, "Merging %d children into %d parents.", childNodes, parentNodes);
+               POSTGIS_DEBUGF(3, "Merging %d children into %d parents.", childNodes, parentNodes);
 
                i = 0;
                while (i < parentNodes)
@@ -66,7 +65,7 @@ RTREE_NODE *createTree(POINTARRAY *pointArray)
                 */
                if (parentNodes * 2 < childNodes)
                {
-                       LWDEBUGF(3, "Shuffling child %d to parent %d", childNodes - 1, i);
+                       POSTGIS_DEBUGF(3, "Shuffling child %d to parent %d", childNodes - 1, i);
 
                        nodes[i] = nodes[childNodes - 1];
                        parentNodes++;
@@ -77,7 +76,7 @@ RTREE_NODE *createTree(POINTARRAY *pointArray)
 
        root = nodes[0];
        lwfree(nodes);
-       LWDEBUGF(3, "createTree returning %p", root);
+       POSTGIS_DEBUGF(3, "createTree returning %p", root);
 
        return root;
 }
@@ -89,7 +88,7 @@ RTREE_NODE *createInteriorNode(RTREE_NODE *left, RTREE_NODE *right)
 {
        RTREE_NODE *parent;
 
-       LWDEBUGF(2, "createInteriorNode called for children %p, %p", left, right);
+       POSTGIS_DEBUGF(2, "createInteriorNode called for children %p, %p", left, right);
 
        parent = lwalloc(sizeof(RTREE_NODE));
        parent->leftNode = left;
@@ -97,7 +96,7 @@ RTREE_NODE *createInteriorNode(RTREE_NODE *left, RTREE_NODE *right)
        parent->interval = mergeIntervals(left->interval, right->interval);
        parent->segment = NULL;
 
-       LWDEBUGF(3, "createInteriorNode returning %p", parent);
+       POSTGIS_DEBUGF(3, "createInteriorNode returning %p", parent);
 
        return parent;
 }
@@ -114,7 +113,7 @@ RTREE_NODE *createLeafNode(POINTARRAY *pa, int startPoint)
        POINT4D tmp;
        POINTARRAY *npa;
 
-       LWDEBUGF(2, "createLeafNode called for point %d of %p", startPoint, pa);
+       POSTGIS_DEBUGF(2, "createLeafNode called for point %d of %p", startPoint, pa);
 
        if (pa->npoints < startPoint + 2)
        {
@@ -144,7 +143,7 @@ RTREE_NODE *createLeafNode(POINTARRAY *pa, int startPoint)
        parent->leftNode = NULL;
        parent->rightNode = NULL;
 
-       LWDEBUGF(3, "createLeafNode returning %p", parent);
+       POSTGIS_DEBUGF(3, "createLeafNode returning %p", parent);
 
        return parent;
 }
@@ -156,13 +155,13 @@ INTERVAL *mergeIntervals(INTERVAL *inter1, INTERVAL *inter2)
 {
        INTERVAL *interval;
 
-       LWDEBUGF(2, "mergeIntervals called with %p, %p", inter1, inter2);
+       POSTGIS_DEBUGF(2, "mergeIntervals called with %p, %p", inter1, inter2);
 
        interval = lwalloc(sizeof(INTERVAL));
        interval->max = FP_MAX(inter1->max, inter2->max);
        interval->min = FP_MIN(inter1->min, inter2->min);
 
-       LWDEBUGF(3, "interval min = %8.3f, max = %8.3f", interval->min, interval->max);
+       POSTGIS_DEBUGF(3, "interval min = %8.3f, max = %8.3f", interval->min, interval->max);
 
        return interval;
 }
@@ -174,13 +173,13 @@ INTERVAL *createInterval(double value1, double value2)
 {
        INTERVAL *interval;
 
-       LWDEBUGF(2, "createInterval called with %8.3f, %8.3f", value1, value2);
+       POSTGIS_DEBUGF(2, "createInterval called with %8.3f, %8.3f", value1, value2);
 
        interval = lwalloc(sizeof(INTERVAL));
        interval->max = FP_MAX(value1, value2);
        interval->min = FP_MIN(value1, value2);
 
-       LWDEBUGF(3, "interval min = %8.3f, max = %8.3f", interval->min, interval->max);
+       POSTGIS_DEBUGF(3, "interval min = %8.3f, max = %8.3f", interval->min, interval->max);
 
        return interval;
 }
@@ -191,7 +190,7 @@ INTERVAL *createInterval(double value1, double value2)
  */
 void freeTree(RTREE_NODE *root)
 {
-       LWDEBUGF(2, "freeTree called for %p", root);
+       POSTGIS_DEBUGF(2, "freeTree called for %p", root);
 
        if (root->leftNode)
                freeTree(root->leftNode);
@@ -214,7 +213,7 @@ void freeTree(RTREE_NODE *root)
 void clearCache(RTREE_POLY_CACHE *cache)
 {
        int g, r, i;
-       LWDEBUGF(2, "clearCache called for %p", cache);
+       POSTGIS_DEBUGF(2, "clearCache called for %p", cache);
         i = 0;
         for (g = 0; g < cache->polyCount; g++)
         {
@@ -245,13 +244,13 @@ LWMLINE *findLineSegments(RTREE_NODE *root, double value)
        LWMLINE *tmp, *result;
        LWGEOM **lwgeoms;
 
-       LWDEBUGF(2, "findLineSegments called for tree %p and value %8.3f", root, value);
+       POSTGIS_DEBUGF(2, "findLineSegments called for tree %p and value %8.3f", root, value);
 
        result = NULL;
 
        if (!isContained(root->interval, value))
        {
-               LWDEBUGF(3, "findLineSegments %p: not contained.", root);
+               POSTGIS_DEBUGF(3, "findLineSegments %p: not contained.", root);
 
                return NULL;
        }
@@ -259,12 +258,12 @@ LWMLINE *findLineSegments(RTREE_NODE *root, double value)
        /* If there is a segment defined for this node, include it. */
        if (root->segment)
        {
-               LWDEBUGF(3, "findLineSegments %p: adding segment %p %d.", root, root->segment, root->segment->type);
+               POSTGIS_DEBUGF(3, "findLineSegments %p: adding segment %p %d.", root, root->segment, root->segment->type);
 
                lwgeoms = lwalloc(sizeof(LWGEOM *));
                lwgeoms[0] = (LWGEOM *)root->segment;
 
-               LWDEBUGF(3, "Found geom %p, type %d, dim %d", root->segment, root->segment->type, FLAGS_GET_Z(root->segment->flags));
+               POSTGIS_DEBUGF(3, "Found geom %p, type %d, dim %d", root->segment, root->segment->type, FLAGS_GET_Z(root->segment->flags));
 
                result = (LWMLINE *)lwcollection_construct(lwgeom_makeType_full(0, 0, 0, MULTILINETYPE, 0), -1, NULL, 1, lwgeoms);
        }
@@ -272,12 +271,12 @@ LWMLINE *findLineSegments(RTREE_NODE *root, double value)
        /* If there is a left child node, recursively include its results. */
        if (root->leftNode)
        {
-               LWDEBUGF(3, "findLineSegments %p: recursing left.", root);
+               POSTGIS_DEBUGF(3, "findLineSegments %p: recursing left.", root);
 
                tmp = findLineSegments(root->leftNode, value);
                if (tmp)
                {
-                       LWDEBUGF(3, "Found geom %p, type %d, dim %d", tmp, tmp->type, FLAGS_GET_Z(tmp->flags));
+                       POSTGIS_DEBUGF(3, "Found geom %p, type %d, dim %d", tmp, tmp->type, FLAGS_GET_Z(tmp->flags));
 
                        if (result)
                                result = mergeMultiLines(result, tmp);
@@ -289,12 +288,12 @@ LWMLINE *findLineSegments(RTREE_NODE *root, double value)
        /* Same for any right child. */
        if (root->rightNode)
        {
-               LWDEBUGF(3, "findLineSegments %p: recursing right.", root);
+               POSTGIS_DEBUGF(3, "findLineSegments %p: recursing right.", root);
 
                tmp = findLineSegments(root->rightNode, value);
                if (tmp)
                {
-                       LWDEBUGF(3, "Found geom %p, type %d, dim %d", tmp, tmp->type, FLAGS_GET_Z(tmp->flags));
+                       POSTGIS_DEBUGF(3, "Found geom %p, type %d, dim %d", tmp, tmp->type, FLAGS_GET_Z(tmp->flags));
 
                        if (result)
                                result = mergeMultiLines(result, tmp);
@@ -313,7 +312,7 @@ LWMLINE *mergeMultiLines(LWMLINE *line1, LWMLINE *line2)
        LWCOLLECTION *col;
        int i, j, ngeoms;
 
-       LWDEBUGF(2, "mergeMultiLines called on %p, %d, %d; %p, %d, %d", line1, line1->ngeoms, line1->type, line2, line2->ngeoms, line2->type);
+       POSTGIS_DEBUGF(2, "mergeMultiLines called on %p, %d, %d; %p, %d, %d", line1, line1->ngeoms, line1->type, line2, line2->ngeoms, line2->type);
 
        ngeoms = line1->ngeoms + line2->ngeoms;
        geoms = lwalloc(sizeof(LWGEOM *) * ngeoms);
@@ -329,7 +328,7 @@ LWMLINE *mergeMultiLines(LWMLINE *line1, LWMLINE *line2)
        }
        col = lwcollection_construct(MULTILINETYPE, -1, NULL, ngeoms, geoms);
 
-       LWDEBUGF(3, "mergeMultiLines returning %p, %d, %d", col, col->ngeoms, col->type);
+       POSTGIS_DEBUGF(3, "mergeMultiLines returning %p, %d, %d", col, col->ngeoms, col->type);
 
        return (LWMLINE *)col;
 }
@@ -412,11 +411,11 @@ void populateCache(RTREE_POLY_CACHE *currentCache, LWGEOM *lwgeom, PG_LWGEOM *se
        LWPOLY *poly;
        int nrings;
 
-       LWDEBUGF(2, "populateCache called with cache %p geom %p", currentCache, lwgeom);
+       POSTGIS_DEBUGF(2, "populateCache called with cache %p geom %p", currentCache, lwgeom);
 
        if (lwgeom->type == MULTIPOLYGONTYPE)
        {
-               LWDEBUG(2, "populateCache MULTIPOLYGON");
+               POSTGIS_DEBUG(2, "populateCache MULTIPOLYGON");
                mpoly = (LWMPOLY *)lwgeom;
                nrings = 0;
                /*
@@ -446,7 +445,7 @@ void populateCache(RTREE_POLY_CACHE *currentCache, LWGEOM *lwgeom, PG_LWGEOM *se
        }
        else if ( lwgeom->type == POLYGONTYPE )
        {
-               LWDEBUG(2, "populateCache POLYGON");
+               POSTGIS_DEBUG(2, "populateCache POLYGON");
                poly = (LWPOLY *)lwgeom;
                currentCache->polyCount = 1;
                currentCache->ringCounts = lwalloc(sizeof(int));
@@ -473,7 +472,7 @@ void populateCache(RTREE_POLY_CACHE *currentCache, LWGEOM *lwgeom, PG_LWGEOM *se
        length = VARSIZE(serializedPoly);
        currentCache->poly = lwalloc(length);
        memcpy(currentCache->poly, serializedPoly, length);
-       LWDEBUGF(3, "populateCache returning %p", currentCache);
+       POSTGIS_DEBUGF(3, "populateCache returning %p", currentCache);
 }
 
 /**
@@ -487,19 +486,19 @@ RTREE_POLY_CACHE *retrieveCache(LWGEOM *lwgeom, PG_LWGEOM *serializedPoly, RTREE
 {
        int length;
 
-       LWDEBUGF(2, "retrieveCache called with %p %p %p", lwgeom, serializedPoly, currentCache);
+       POSTGIS_DEBUGF(2, "retrieveCache called with %p %p %p", lwgeom, serializedPoly, currentCache);
 
        /* Make sure this isn't someone else's cache object. */
        if ( currentCache && currentCache->type != 1 ) currentCache = NULL;
 
        if (!currentCache)
        {
-               LWDEBUG(3, "No existing cache, create one.");
+               POSTGIS_DEBUG(3, "No existing cache, create one.");
                return createCache();
        }
        if (!(currentCache->poly))
        {
-               LWDEBUG(3, "Cache contains no polygon, populating it.");
+               POSTGIS_DEBUG(3, "Cache contains no polygon, populating it.");
                populateCache(currentCache, lwgeom, serializedPoly);
                return currentCache;
        }
@@ -508,18 +507,19 @@ RTREE_POLY_CACHE *retrieveCache(LWGEOM *lwgeom, PG_LWGEOM *serializedPoly, RTREE
 
        if (VARSIZE(currentCache->poly) != length)
        {
-               LWDEBUG(3, "Polygon size mismatch, creating new cache.");
+               POSTGIS_DEBUG(3, "Polygon size mismatch, creating new cache.");
                clearCache(currentCache);
                return currentCache;
        }
        if ( memcmp(serializedPoly, currentCache->poly, length) )
        {
-               LWDEBUG(3, "Polygon mismatch, creating new cache.");
+               POSTGIS_DEBUG(3, "Polygon mismatch, creating new cache.");
                clearCache(currentCache);
                return currentCache;
        }
 
-       LWDEBUGF(3, "Polygon match, retaining current cache, %p.", currentCache);
+       POSTGIS_DEBUGF(3, "Polygon match, retaining current cache, %p.",
+                         currentCache);
 
        return currentCache;
 }
index ebd7802b7bd94f430afc5a89a949c5ff51a5c630..b22d7249c62d96b12ab63c6a785eb321de26a687 100644 (file)
@@ -1,9 +1,9 @@
 /**********************************************************************
- * $Id$
  *
  * PostGIS - Spatial Types for PostgreSQL
  * http://postgis.refractions.net
- * Copyright 2001-2003 Refractions Research Inc.
+ *
+ * Copyright (C) 2001-2003 Refractions Research Inc.
  *
  * This is free software; you can redistribute and/or modify it under
  * the terms of the GNU General Public Licence. See the COPYING file.
@@ -208,9 +208,9 @@ distance_ellipse(double lat1, double long1,
 #if POSTGIS_DEBUG_LEVEL >= 4
        result2 =  distance_sphere_method(lat1, long1,lat2,long2, sphere);
 
-       LWDEBUGF(4, "delta = %lf, skae says: %.15lf,2 circle says: %.15lf",
+       POSTGIS_DEBUGF(4, "delta = %lf, skae says: %.15lf,2 circle says: %.15lf",
                 (result2-result),result,result2);
-       LWDEBUGF(4, "2 circle says: %.15lf",result2);
+       POSTGIS_DEBUGF(4, "2 circle says: %.15lf",result2);
 #endif
 
        if (result != result)  /* NaN check