]> granicus.if.org Git - postgis/commitdiff
Added typedefs and serialization/deserialization functionality for sql-mm defined...
authorMark Leslie <mark.leslie@lisasoft.com>
Fri, 1 Dec 2006 22:16:44 +0000 (22:16 +0000)
committerMark Leslie <mark.leslie@lisasoft.com>
Fri, 1 Dec 2006 22:16:44 +0000 (22:16 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@2532 b70326c6-7e19-0410-871a-916f4a2858ee

36 files changed:
NEWS
Version.config
doc/postgis.xml
lwgeom/Makefile
lwgeom/lex.yy.c
lwgeom/liblwgeom.c
lwgeom/liblwgeom.h
lwgeom/lwcollection.c
lwgeom/lwcompound.c [new file with mode: 0644]
lwgeom/lwcurve.c [new file with mode: 0644]
lwgeom/lwcurvepoly.c [new file with mode: 0644]
lwgeom/lwgeom.c
lwgeom/lwgeom_api.c
lwgeom/lwgeom_functions_analytic.c
lwgeom/lwgeom_functions_basic.c
lwgeom/lwgeom_geos.c
lwgeom/lwgeom_geos_c.c
lwgeom/lwgeom_pg.c
lwgeom/lwgeom_spheroid.c
lwgeom/lwgeom_sqlmm.c [new file with mode: 0644]
lwgeom/lwgparse.c
lwgeom/lwline.c
lwgeom/lwmcurve.c [new file with mode: 0644]
lwgeom/lwmsurface.c [new file with mode: 0644]
lwgeom/lwpostgis.sql.in
lwgeom/ptarray.c
lwgeom/wktparse.h
lwgeom/wktparse.lex
lwgeom/wktparse.tab.c
lwgeom/wktparse.tab.h
lwgeom/wktparse.y
lwgeom/wktunparse.c
regress/Makefile
regress/lwgeom_regress_expected
regress/sql-mm-serialize.sql [new file with mode: 0644]
regress/sql-mm-serialize_expected [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index 6478a1327e311d1e0f8955b1c9e7761c539bc726..4ed1802507ed08cadff22e3d76a667c6678925b7 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,7 @@
+PostGIS 1.1,7
+        - Added curved geometry type support for serialization/deserialization.
+        - Added point-in-polygon shortcircuit to Contains and Within functions.
+
 PostGIS 1.1.6
 2006/11/02
 
index 8756e28c874c09ba6cc212f2e28f76e17e77cd96..94fed8f43f356f6bf2711582b8c0ae83b89822d1 100644 (file)
@@ -5,5 +5,5 @@
 
 REL_MAJOR_VERSION=1
 REL_MINOR_VERSION=1
-REL_MICRO_VERSION=6
+REL_MICRO_VERSION=7
 
index c0f488a627a7275a05274a92fc0a77e09bad4d2e..f142afbcd0e59413089e454822a942c7849a2f5a 100644 (file)
@@ -5326,9 +5326,25 @@ FROM geometry_table;</literallayout>
        <title>Appendix</title>
 
        <sect1>
-
+                 
                <title>Release Notes</title>
 
+                <sect2>
+                        <title>Release 1.1.7</title>
+                        <para>Release date:</para>
+                        <para>This release provides type definitions along
+                            with serialization/deserialization capabilities 
+                            for SQL-MM defined curved geometries, as well as
+                            performance enhancements.
+                        </para>
+                        <sect3>
+                                <title>Changes</title>
+                                <para>Added curved geometry type support for serialization/deserialization</para>
+                                <para>Added point-in-polygon shortcircuit to the Contains and Within functions to improve performance for these cases.</para>
+                        </sect3>
+
+                </sect2>
+
                 <sect2>
                         <title>Release 1.1.6</title>
                         <para>Release date: 2006/11/02</para>
index 59cb7ed27f9954ccd9406ef4d3878e486285f2b9..edbd3f7d4c95fa8aace8f2a65cb79ea9bffe11c2 100644 (file)
@@ -84,7 +84,8 @@ override CXXFLAGS += $(CSTAR_FLAGS)
 
 SA_OBJS=measures.o box2d.o ptarray.o lwgeom_api.o lwgeom.o lwpoint.o lwline.o lwpoly.o lwmpoint.o lwmline.o lwmpoly.o lwcollection.o $(GEOS_WRAPPER) $(JTS_WRAPPER) wktunparse.o lwgparse.o wktparse.tab.o lex.yy.o vsprintf.o
 
-OBJS=$(SA_OBJS) liblwgeom.o lwgeom_pg.o lwgeom_debug.o lwgeom_spheroid.o lwgeom_ogc.o lwgeom_functions_analytic.o $(JTS_OBJ) lwgeom_inout.o lwgeom_estimate.o lwgeom_functions_basic.o lwgeom_gist.o lwgeom_btree.o lwgeom_transform.o stringBuffer.o lwgeom_box.o lwgeom_box3d.o lwgeom_box2dfloat4.o lwgeom_chip.o lwgeom_svg.o lwgeom_gml.o lwgeom_triggers.o lwgeom_dump.o lwgeom_functions_lrs.o long_xact.o
+OBJS=$(SA_OBJS) liblwgeom.o lwgeom_pg.o lwgeom_debug.o lwgeom_spheroid.o lwgeom_ogc.o lwgeom_functions_analytic.o $(JTS_OBJ) lwgeom_inout.o lwgeom_estimate.o lwgeom_functions_basic.o lwgeom_gist.o lwgeom_btree.o lwgeom_transform.o stringBuffer.o lwgeom_box.o lwgeom_box3d.o lwgeom_box2dfloat4.o lwgeom_chip.o lwgeom_svg.o lwgeom_gml.o lwgeom_triggers.o lwgeom_dump.o lwgeom_functions_lrs.o long_xact.o lwcurve.o lwcompound.o lwcurvepoly.o lwmcurve.o lwmsurface.o lwgeom_sqlmm.o
+
 
 #OTHERS=y.output lex.yy.c wktparse.tab.c wktparse.tab.h lwpostgis.sql
 OTHERS=y.output postgis_geos_version.h
@@ -171,7 +172,6 @@ liblwgeom_sa.so: $(SA_OBJS) liblwgeom_sa.o
 liblwgeom_sa.a: $(SA_OBJS) liblwgeom_sa.o 
        $(AR) -rc $@ $^ 
 
-
 test: liblwgeom_sa.so liblwgeom_sa.a test.c
        $(CC) -Wall -lm -g -o test test.c liblwgeom_sa.a 
 
index dba46cde82d1e21cb30303c9d2c7d9f9958319d7..80a803ed572fb49af00c54faf06e3cbe6534a2b0 100644 (file)
@@ -20,7 +20,7 @@
 /* A lexical scanner generated by flex */
 
 /* Scanner skeleton version:
- * $Header$
+ * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $
  */
 
 #define FLEX_SCANNER
@@ -28,7 +28,8 @@
 #define YY_FLEX_MINOR_VERSION 5
 
 #include <stdio.h>
-#include <errno.h>
+#include <unistd.h>
+
 
 /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
 #ifdef c_plusplus
 #ifdef __cplusplus
 
 #include <stdlib.h>
-#ifndef _WIN32
-#include <unistd.h>
-#else
-#ifndef YY_ALWAYS_INTERACTIVE
-#ifndef YY_NEVER_INTERACTIVE
-extern int isatty YY_PROTO(( int ));
-#endif
-#endif
-#endif
 
 /* Use prototypes in function declarations. */
 #define YY_USE_PROTOS
@@ -319,13 +311,13 @@ static yyconst short yy_nxt[][128] =
         6,    6,    7,    6,    6,    6,    6,    6,    6,    6,
         9,   10,    6,    6,   11,    6,    6,    6,   12,    6,
         6,    6,    6,    6,    6,    6,    6,    6,    6,   13,
-        6,   14,    6,    6,    6,    6,    6,    6,    6,   15,
+        6,   14,    6,    6,    6,    6,    6,   15,    6,   16,
 
-        6,   16,    6,    6,    6,    6,   17,   18,    6,    6,
-       19,    6,    6,   20,    6,    6,    6,    6,    6,    6,
-        6,    6,    6,    6,    6,    6,    6,    6,    6,    6,
-        6,   15,    6,   16,    6,    6,    6,    6,   17,   18,
-        6,    6,   19,    6,    6,   20,    6,    6,    6,    6,
+        6,   17,    6,    6,    6,    6,   18,   19,    6,    6,
+       20,    6,    6,   21,    6,    6,    6,    6,    6,    6,
+        6,    6,    6,    6,    6,    6,    6,    6,    6,   15,
+        6,   16,    6,   17,    6,    6,    6,    6,   18,   19,
+        6,    6,   20,    6,    6,   21,    6,    6,    6,    6,
         6,    6,    6,    6,    6,    6,    6,    6
     },
 
@@ -337,12 +329,12 @@ static yyconst short yy_nxt[][128] =
 
         9,   10,    6,    6,   11,    6,    6,    6,   12,    6,
         6,    6,    6,    6,    6,    6,    6,    6,    6,   13,
-        6,   14,    6,    6,    6,    6,    6,    6,    6,   15,
-        6,   16,    6,    6,    6,    6,   17,   18,    6,    6,
-       19,    6,    6,   20,    6,    6,    6,    6,    6,    6,
-        6,    6,    6,    6,    6,    6,    6,    6,    6,    6,
-        6,   15,    6,   16,    6,    6,    6,    6,   17,   18,
-        6,    6,   19,    6,    6,   20,    6,    6,    6,    6,
+        6,   14,    6,    6,    6,    6,    6,   15,    6,   16,
+        6,   17,    6,    6,    6,    6,   18,   19,    6,    6,
+       20,    6,    6,   21,    6,    6,    6,    6,    6,    6,
+        6,    6,    6,    6,    6,    6,    6,    6,    6,   15,
+        6,   16,    6,   17,    6,    6,    6,    6,   18,   19,
+        6,    6,   20,    6,    6,   21,    6,    6,    6,    6,
         6,    6,    6,    6,    6,    6,    6,    6
     },
 
@@ -352,16 +344,16 @@ static yyconst short yy_nxt[][128] =
         8,    6,    6,    7,    6,    6,    6,    6,    6,    6,
         6,    6,    6,    6,    6,    6,    6,    6,    6,    6,
         6,    6,    7,    6,    6,    6,    6,    6,    6,    6,
-        9,   10,    6,   21,   11,   21,   22,    6,   23,   23,
-       23,   23,   23,   23,   23,   23,   23,   23,    6,   13,
-        6,   14,    6,    6,    6,    6,    6,    6,    6,   15,
-        6,   16,    6,    6,    6,    6,   17,   18,    6,    6,
-       19,    6,    6,   20,    6,    6,    6,    6,    6,    6,
-        6,    6,    6,    6,    6,    6,    6,    6,    6,    6,
-        6,   15,    6,   16,    6,    6,    6,    6,   17,   18,
-
-        6,    6,   19,    6,    6,   20,    6,    6,    6,    6,
-        6,    6,    6,    6,   21,    6,    6,    6
+        9,   10,    6,   22,   11,   22,   23,    6,   24,   24,
+       24,   24,   24,   24,   24,   24,   24,   24,    6,   13,
+        6,   14,    6,    6,    6,    6,    6,   15,    6,   16,
+        6,   17,    6,    6,    6,    6,   18,   19,    6,    6,
+       20,    6,    6,   21,    6,    6,    6,    6,    6,    6,
+        6,    6,    6,    6,    6,    6,    6,    6,    6,   15,
+        6,   16,    6,   17,    6,    6,    6,    6,   18,   19,
+
+        6,    6,   20,    6,    6,   21,    6,    6,    6,    6,
+        6,    6,    6,    6,   22,    6,    6,    6
     },
 
     {
@@ -369,16 +361,16 @@ static yyconst short yy_nxt[][128] =
         8,    6,    6,    7,    6,    6,    6,    6,    6,    6,
         6,    6,    6,    6,    6,    6,    6,    6,    6,    6,
         6,    6,    7,    6,    6,    6,    6,    6,    6,    6,
-        9,   10,    6,   21,   11,   21,   22,    6,   23,   23,
-       23,   23,   23,   23,   23,   23,   23,   23,    6,   13,
-        6,   14,    6,    6,    6,    6,    6,    6,    6,   15,
-        6,   16,    6,    6,    6,    6,   17,   18,    6,    6,
-
-       19,    6,    6,   20,    6,    6,    6,    6,    6,    6,
-        6,    6,    6,    6,    6,    6,    6,    6,    6,    6,
-        6,   15,    6,   16,    6,    6,    6,    6,   17,   18,
-        6,    6,   19,    6,    6,   20,    6,    6,    6,    6,
-        6,    6,    6,    6,   21,    6,    6,    6
+        9,   10,    6,   22,   11,   22,   23,    6,   24,   24,
+       24,   24,   24,   24,   24,   24,   24,   24,    6,   13,
+        6,   14,    6,    6,    6,    6,    6,   15,    6,   16,
+        6,   17,    6,    6,    6,    6,   18,   19,    6,    6,
+
+       20,    6,    6,   21,    6,    6,    6,    6,    6,    6,
+        6,    6,    6,    6,    6,    6,    6,    6,    6,   15,
+        6,   16,    6,   17,    6,    6,    6,    6,   18,   19,
+        6,    6,   20,    6,    6,   21,    6,    6,    6,    6,
+        6,    6,    6,    6,   22,    6,    6,    6
     },
 
     {
@@ -417,10 +409,10 @@ static yyconst short yy_nxt[][128] =
     },
 
     {
-        5,   -7,   -7,   -7,   -7,   -7,   -7,   -7,   -7,   24,
-       24,   -7,   -7,   24,   -7,   -7,   -7,   -7,   -7,   -7,
+        5,   -7,   -7,   -7,   -7,   -7,   -7,   -7,   -7,   25,
+       25,   -7,   -7,   25,   -7,   -7,   -7,   -7,   -7,   -7,
        -7,   -7,   -7,   -7,   -7,   -7,   -7,   -7,   -7,   -7,
-       -7,   -7,   24,   -7,   -7,   -7,   -7,   -7,   -7,   -7,
+       -7,   -7,   25,   -7,   -7,   -7,   -7,   -7,   -7,   -7,
        -7,   -7,   -7,   -7,   -7,   -7,   -7,   -7,   -7,   -7,
        -7,   -7,   -7,   -7,   -7,   -7,   -7,   -7,   -7,   -7,
        -7,   -7,   -7,   -7,   -7,   -7,   -7,   -7,   -7,   -7,
@@ -434,10 +426,10 @@ static yyconst short yy_nxt[][128] =
     },
 
     {
-        5,   -8,   -8,   -8,   -8,   -8,   -8,   -8,   -8,   24,
-       24,   -8,   -8,   24,   -8,   -8,   -8,   -8,   -8,   -8,
+        5,   -8,   -8,   -8,   -8,   -8,   -8,   -8,   -8,   25,
+       25,   -8,   -8,   25,   -8,   -8,   -8,   -8,   -8,   -8,
        -8,   -8,   -8,   -8,   -8,   -8,   -8,   -8,   -8,   -8,
-       -8,   -8,   24,   -8,   -8,   -8,   -8,   -8,   -8,   -8,
+       -8,   -8,   25,   -8,   -8,   -8,   -8,   -8,   -8,   -8,
        -8,   -8,   -8,   -8,   -8,   -8,   -8,   -8,   -8,   -8,
        -8,   -8,   -8,   -8,   -8,   -8,   -8,   -8,   -8,   -8,
 
@@ -508,7 +500,7 @@ static yyconst short yy_nxt[][128] =
       -12,  -12,  -12,  -12,  -12,  -12,  -12,  -12,  -12,  -12,
       -12,  -12,  -12,  -12,  -12,  -12,  -12,  -12,  -12,  -12,
 
-      -12,  -12,  -12,  -12,  -12,  -12,  -12,  -12,   25,   26,
+      -12,  -12,  -12,  -12,  -12,  -12,  -12,  -12,   26,   27,
       -12,  -12,  -12,  -12,  -12,  -12,  -12,  -12,  -12,  -12,
       -12,  -12,  -12,  -12,  -12,  -12,  -12,  -12,  -12,  -12,
       -12,  -12,  -12,  -12,  -12,  -12,  -12,  -12,  -12,  -12,
@@ -563,11 +555,11 @@ static yyconst short yy_nxt[][128] =
 
       -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,
       -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,
-      -15,  -15,  -15,  -15,  -15,  -15,  -15,   27,  -15,  -15,
-      -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,
-      -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,
-      -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,   27,
+      -15,  -15,  -15,   28,  -15,  -15,  -15,  -15,  -15,   29,
+      -15,  -15,  -15,  -15,  -15,   30,  -15,  -15,  -15,  -15,
       -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15,
+      -15,  -15,  -15,  -15,  -15,   28,  -15,  -15,  -15,  -15,
+      -15,   29,  -15,  -15,  -15,  -15,  -15,   30,  -15,  -15,
       -15,  -15,  -15,  -15,  -15,  -15,  -15,  -15
     },
 
@@ -579,11 +571,11 @@ static yyconst short yy_nxt[][128] =
       -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,
       -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,
       -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,
-      -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,   28,
       -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,
+      -16,  -16,  -16,  -16,  -16,  -16,  -16,   31,  -16,  -16,
       -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,
       -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,
-      -16,   28,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,
+      -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,   31,
       -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,
 
       -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16
@@ -596,12 +588,12 @@ static yyconst short yy_nxt[][128] =
       -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,
       -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,
       -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,
+      -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,   32,
       -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,
-      -17,  -17,  -17,   29,  -17,  -17,  -17,  -17,  -17,  -17,
       -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,
 
       -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,
-      -17,  -17,  -17,  -17,  -17,   29,  -17,  -17,  -17,  -17,
+      -17,   32,  -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,
       -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17,
       -17,  -17,  -17,  -17,  -17,  -17,  -17,  -17
     },
@@ -615,11 +607,11 @@ static yyconst short yy_nxt[][128] =
       -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,
 
       -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,
+      -18,  -18,  -18,   33,  -18,  -18,  -18,  -18,  -18,  -18,
       -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,
-      -18,  -18,  -18,  -18,  -18,   30,  -18,  -18,  -18,  -18,
       -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,
+      -18,  -18,  -18,  -18,  -18,   33,  -18,  -18,  -18,  -18,
       -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18,
-      -18,  -18,  -18,  -18,  -18,  -18,  -18,   30,  -18,  -18,
       -18,  -18,  -18,  -18,  -18,  -18,  -18,  -18
     },
 
@@ -632,11 +624,11 @@ static yyconst short yy_nxt[][128] =
       -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,
       -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,
       -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,
-      -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,   31,
       -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,
+      -19,  -19,  -19,  -19,  -19,   34,  -19,  -19,  -19,  -19,
       -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,
       -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,
-      -19,   31,  -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,
+      -19,  -19,  -19,  -19,  -19,  -19,  -19,   34,  -19,  -19,
       -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19
 
     },
@@ -649,12 +641,12 @@ static yyconst short yy_nxt[][128] =
       -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,
       -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,
       -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,
+      -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,   35,
       -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,
-      -20,  -20,   32,  -20,  -20,  -20,  -20,  -20,  -20,  -20,
       -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,
 
       -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,
-      -20,  -20,  -20,  -20,   32,  -20,  -20,  -20,  -20,  -20,
+      -20,   35,  -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20,
       -20,  -20,  -20,  -20,  -20,  -20,  -20,  -20
     },
 
@@ -663,15 +655,15 @@ static yyconst short yy_nxt[][128] =
       -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,
       -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,
       -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,
-      -21,  -21,  -21,  -21,  -21,  -21,   33,  -21,   34,   34,
-       34,   34,   34,   34,   34,   34,   34,   34,  -21,  -21,
       -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,
-
       -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,
       -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,
+
       -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,
+      -21,  -21,   36,  -21,  -21,  -21,  -21,  -21,  -21,  -21,
       -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,
       -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21,
+      -21,  -21,  -21,  -21,   36,  -21,  -21,  -21,  -21,  -21,
       -21,  -21,  -21,  -21,  -21,  -21,  -21,  -21
     },
 
@@ -681,8 +673,8 @@ static yyconst short yy_nxt[][128] =
       -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,
       -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,
 
-      -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,   35,   35,
-       35,   35,   35,   35,   35,   35,   35,   35,  -22,  -22,
+      -22,  -22,  -22,  -22,  -22,  -22,   37,  -22,   38,   38,
+       38,   38,   38,   38,   38,   38,   38,   38,  -22,  -22,
       -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,
       -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,
       -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,  -22,
@@ -698,48 +690,48 @@ static yyconst short yy_nxt[][128] =
       -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,
       -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,
       -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,
-      -23,  -23,  -23,  -23,  -23,  -23,   36,  -23,   34,   34,
-       34,   34,   34,   34,   34,   34,   34,   34,  -23,  -23,
-      -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,   37,
+      -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,   39,   39,
+       39,   39,   39,   39,   39,   39,   39,   39,  -23,  -23,
+      -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,
+      -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,
       -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,
       -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,
       -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,
-      -23,   37,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,
 
       -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23,
       -23,  -23,  -23,  -23,  -23,  -23,  -23,  -23
     },
 
     {
-        5,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,   24,
-       24,  -24,  -24,   24,  -24,  -24,  -24,  -24,  -24,  -24,
-      -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,
-      -24,  -24,   24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,
+        5,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,
       -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,
       -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,
       -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,
+      -24,  -24,  -24,  -24,  -24,  -24,   40,  -24,   38,   38,
+       38,   38,   38,   38,   38,   38,   38,   38,  -24,  -24,
+      -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,   41,
       -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,
 
       -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,
       -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,
-      -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,
+      -24,   41,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,
       -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24,
       -24,  -24,  -24,  -24,  -24,  -24,  -24,  -24
     },
 
     {
-        5,  -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,
+        5,  -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,   25,
+       25,  -25,  -25,   25,  -25,  -25,  -25,  -25,  -25,  -25,
       -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,
+      -25,  -25,   25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,
       -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,
-      -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,
-      -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,   38,   38,
 
-       38,   38,   38,   38,   38,   38,   38,   38,  -25,  -25,
-      -25,  -25,  -25,  -25,  -25,   38,   38,   38,   38,   38,
-       38,  -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,
       -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,
-      -25,  -25,  -25,  -25,  -25,  -25,  -25,   38,   38,   38,
-       38,   38,   38,  -25,  -25,  -25,  -25,  -25,  -25,  -25,
+      -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,
+      -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,
+      -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,
+      -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,
+      -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,
       -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,
       -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25
     },
@@ -750,13 +742,13 @@ static yyconst short yy_nxt[][128] =
 
       -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,
       -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,
-      -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,   39,   39,
-       39,   39,   39,   39,   39,   39,   39,   39,  -26,  -26,
-      -26,  -26,  -26,  -26,  -26,   39,   39,   39,   39,   39,
-       39,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,
+      -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,   42,   42,
+       42,   42,   42,   42,   42,   42,   42,   42,  -26,  -26,
+      -26,  -26,  -26,  -26,  -26,   42,   42,   42,   42,   42,
+       42,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,
       -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,
-      -26,  -26,  -26,  -26,  -26,  -26,  -26,   39,   39,   39,
-       39,   39,   39,  -26,  -26,  -26,  -26,  -26,  -26,  -26,
+      -26,  -26,  -26,  -26,  -26,  -26,  -26,   42,   42,   42,
+       42,   42,   42,  -26,  -26,  -26,  -26,  -26,  -26,  -26,
       -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26,
 
       -26,  -26,  -26,  -26,  -26,  -26,  -26,  -26
@@ -767,15 +759,15 @@ static yyconst short yy_nxt[][128] =
       -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,
       -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,
       -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,
+      -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,   43,   43,
+       43,   43,   43,   43,   43,   43,   43,   43,  -27,  -27,
+      -27,  -27,  -27,  -27,  -27,   43,   43,   43,   43,   43,
+       43,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,
       -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,
-      -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,
-      -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,
-      -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,
-       40,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,
 
+      -27,  -27,  -27,  -27,  -27,  -27,  -27,   43,   43,   43,
+       43,   43,   43,  -27,  -27,  -27,  -27,  -27,  -27,  -27,
       -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,
-      -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27,
-      -27,  -27,   40,  -27,  -27,  -27,  -27,  -27,  -27,  -27,
       -27,  -27,  -27,  -27,  -27,  -27,  -27,  -27
     },
 
@@ -788,11 +780,11 @@ static yyconst short yy_nxt[][128] =
       -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,
 
       -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,
-      -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,   41,
       -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,
+      -28,  -28,   44,  -28,  -28,  -28,  -28,  -28,  -28,  -28,
       -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,
       -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,
-      -28,   41,  -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,
+      -28,  -28,  -28,  -28,   44,  -28,  -28,  -28,  -28,  -28,
       -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28
     },
 
@@ -805,11 +797,11 @@ static yyconst short yy_nxt[][128] =
       -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,
       -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,
       -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,
-      -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,   42,  -29,
+      -29,  -29,  -29,  -29,  -29,  -29,  -29,   45,  -29,  -29,
       -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,
       -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,
+      -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,   45,
       -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,
-       42,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29,
       -29,  -29,  -29,  -29,  -29,  -29,  -29,  -29
 
     },
@@ -822,12 +814,12 @@ static yyconst short yy_nxt[][128] =
       -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,
       -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,
       -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,
-      -30,  -30,  -30,  -30,  -30,  -30,   43,  -30,  -30,  -30,
       -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,
+      -30,  -30,   46,  -30,  -30,  -30,  -30,  -30,  -30,  -30,
       -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,
 
-      -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,   43,  -30,
       -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30,
+      -30,  -30,  -30,  -30,   46,  -30,  -30,  -30,  -30,  -30,
       -30,  -30,  -30,  -30,  -30,  -30,  -30,  -30
     },
 
@@ -840,11 +832,11 @@ static yyconst short yy_nxt[][128] =
       -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,
       -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,
 
-      -31,  -31,  -31,   44,  -31,  -31,   45,  -31,  -31,  -31,
       -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,
+       47,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,
       -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,
-      -31,  -31,  -31,  -31,  -31,   44,  -31,  -31,   45,  -31,
       -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31,
+      -31,  -31,   47,  -31,  -31,  -31,  -31,  -31,  -31,  -31,
       -31,  -31,  -31,  -31,  -31,  -31,  -31,  -31
     },
 
@@ -857,11 +849,11 @@ static yyconst short yy_nxt[][128] =
       -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,
       -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,
       -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,
-      -32,  -32,  -32,   46,  -32,  -32,  -32,  -32,  -32,  -32,
+      -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,   48,
       -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,
       -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,
-      -32,  -32,  -32,  -32,  -32,   46,  -32,  -32,  -32,  -32,
       -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,
+      -32,   48,  -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32,
       -32,  -32,  -32,  -32,  -32,  -32,  -32,  -32
     },
 
@@ -871,15 +863,15 @@ static yyconst short yy_nxt[][128] =
       -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,
       -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,
       -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,
-      -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,   35,   35,
-       35,   35,   35,   35,   35,   35,   35,   35,  -33,  -33,
       -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,
       -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,
       -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,
+      -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,   49,  -33,
       -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,
       -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,
-
       -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,
+
+       49,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33,
       -33,  -33,  -33,  -33,  -33,  -33,  -33,  -33
     },
 
@@ -888,14 +880,14 @@ static yyconst short yy_nxt[][128] =
       -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,
       -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,
       -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,
-      -34,  -34,  -34,  -34,  -34,  -34,   36,  -34,   34,   34,
-       34,   34,   34,   34,   34,   34,   34,   34,  -34,  -34,
-      -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,   37,
       -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,
+      -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,
+      -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,
+      -34,  -34,  -34,  -34,  -34,  -34,   50,  -34,  -34,  -34,
 
       -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,
       -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,
-      -34,   37,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,
+      -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,   50,  -34,
       -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34,
       -34,  -34,  -34,  -34,  -34,  -34,  -34,  -34
     },
@@ -905,14 +897,14 @@ static yyconst short yy_nxt[][128] =
       -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,
       -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,
       -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,
-      -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,   35,   35,
+      -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,
 
-       35,   35,   35,   35,   35,   35,   35,   35,  -35,  -35,
-      -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,   47,
       -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,
       -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,
+      -35,  -35,  -35,   51,  -35,  -35,   52,  -35,  -35,  -35,
       -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,
-      -35,   47,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,
+      -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,
+      -35,  -35,  -35,  -35,  -35,   51,  -35,  -35,   52,  -35,
       -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35,
       -35,  -35,  -35,  -35,  -35,  -35,  -35,  -35
     },
@@ -923,13 +915,13 @@ static yyconst short yy_nxt[][128] =
 
       -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,
       -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,
-      -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,   48,   48,
-       48,   48,   48,   48,   48,   48,   48,   48,  -36,  -36,
       -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,
       -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,
       -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,
+      -36,  -36,  -36,   53,  -36,  -36,  -36,  -36,  -36,  -36,
       -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,
       -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,
+      -36,  -36,  -36,  -36,  -36,   53,  -36,  -36,  -36,  -36,
       -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,
 
       -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36
@@ -940,8 +932,8 @@ static yyconst short yy_nxt[][128] =
       -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,
       -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,
       -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,
-      -37,  -37,  -37,   49,  -37,   49,  -37,  -37,   50,   50,
-       50,   50,   50,   50,   50,   50,   50,   50,  -37,  -37,
+      -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,   39,   39,
+       39,   39,   39,   39,   39,   39,   39,   39,  -37,  -37,
       -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,
       -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,
       -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,
@@ -957,14 +949,14 @@ static yyconst short yy_nxt[][128] =
       -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,
       -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,
       -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,
-      -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,   38,   38,
+      -38,  -38,  -38,  -38,  -38,  -38,   40,  -38,   38,   38,
        38,   38,   38,   38,   38,   38,   38,   38,  -38,  -38,
 
-      -38,  -38,  -38,  -38,  -38,   38,   38,   38,   38,   38,
-       38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,
+      -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,   41,
+      -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,
+      -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,
       -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,
-      -38,  -38,  -38,  -38,  -38,  -38,  -38,   38,   38,   38,
-       38,   38,   38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,
+      -38,   41,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,
       -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38,
       -38,  -38,  -38,  -38,  -38,  -38,  -38,  -38
     },
@@ -977,11 +969,11 @@ static yyconst short yy_nxt[][128] =
       -39,  -39,  -39,  -39,  -39,  -39,  -39,  -39,  -39,  -39,
       -39,  -39,  -39,  -39,  -39,  -39,  -39,  -39,   39,   39,
        39,   39,   39,   39,   39,   39,   39,   39,  -39,  -39,
-      -39,  -39,  -39,  -39,  -39,   39,   39,   39,   39,   39,
-       39,  -39,  -39,  -39,  -39,  -39,  -39,  -39,  -39,  -39,
+      -39,  -39,  -39,  -39,  -39,  -39,  -39,  -39,  -39,   54,
       -39,  -39,  -39,  -39,  -39,  -39,  -39,  -39,  -39,  -39,
-      -39,  -39,  -39,  -39,  -39,  -39,  -39,   39,   39,   39,
-       39,   39,   39,  -39,  -39,  -39,  -39,  -39,  -39,  -39,
+      -39,  -39,  -39,  -39,  -39,  -39,  -39,  -39,  -39,  -39,
+      -39,  -39,  -39,  -39,  -39,  -39,  -39,  -39,  -39,  -39,
+      -39,   54,  -39,  -39,  -39,  -39,  -39,  -39,  -39,  -39,
       -39,  -39,  -39,  -39,  -39,  -39,  -39,  -39,  -39,  -39,
       -39,  -39,  -39,  -39,  -39,  -39,  -39,  -39
 
@@ -992,15 +984,15 @@ static yyconst short yy_nxt[][128] =
       -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,
       -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,
       -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,
+      -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,   55,   55,
+       55,   55,   55,   55,   55,   55,   55,   55,  -40,  -40,
       -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,
       -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,
       -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,
       -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,
-      -40,  -40,  -40,  -40,   51,  -40,  -40,  -40,  -40,  -40,
-      -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,
 
       -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,
-      -40,  -40,  -40,  -40,  -40,  -40,   51,  -40,  -40,  -40,
+      -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40,
       -40,  -40,  -40,  -40,  -40,  -40,  -40,  -40
     },
 
@@ -1009,14 +1001,14 @@ static yyconst short yy_nxt[][128] =
       -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41,
       -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41,
       -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41,
+      -41,  -41,  -41,   56,  -41,   56,  -41,  -41,   57,   57,
+       57,   57,   57,   57,   57,   57,   57,   57,  -41,  -41,
       -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41,
+
       -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41,
       -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41,
-
-      -41,  -41,  -41,  -41,  -41,  -41,  -41,   52,  -41,  -41,
       -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41,
       -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41,
-      -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41,   52,
       -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41,
       -41,  -41,  -41,  -41,  -41,  -41,  -41,  -41
     },
@@ -1027,13 +1019,13 @@ static yyconst short yy_nxt[][128] =
       -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,
       -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,
 
+      -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,   42,   42,
+       42,   42,   42,   42,   42,   42,   42,   42,  -42,  -42,
+      -42,  -42,  -42,  -42,  -42,   42,   42,   42,   42,   42,
+       42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,
       -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,
-      -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,
-      -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,   53,
-      -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,
-      -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,
-      -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,
-      -42,   53,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,
+      -42,  -42,  -42,  -42,  -42,  -42,  -42,   42,   42,   42,
+       42,   42,   42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,
       -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42,
       -42,  -42,  -42,  -42,  -42,  -42,  -42,  -42
     },
@@ -1044,15 +1036,15 @@ static yyconst short yy_nxt[][128] =
       -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,
       -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,
       -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,
+      -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,   43,   43,
+       43,   43,   43,   43,   43,   43,   43,   43,  -43,  -43,
+      -43,  -43,  -43,  -43,  -43,   43,   43,   43,   43,   43,
+       43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,
       -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,
-      -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,
-      -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,
-      -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,
-      -43,  -43,  -43,  -43,   54,  -43,  -43,  -43,  -43,  -43,
-      -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,
-      -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,
+      -43,  -43,  -43,  -43,  -43,  -43,  -43,   43,   43,   43,
+       43,   43,   43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,
 
-      -43,  -43,  -43,  -43,  -43,  -43,   54,  -43,  -43,  -43,
+      -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43,
       -43,  -43,  -43,  -43,  -43,  -43,  -43,  -43
     },
 
@@ -1063,13 +1055,13 @@ static yyconst short yy_nxt[][128] =
       -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,
       -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,
       -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,
+      -44,  -44,  -44,  -44,  -44,  -44,  -44,   58,  -44,  -44,
       -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,
-      -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,   55,  -44,
 
       -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,
+      -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,   58,
       -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,
       -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,
-       55,  -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44,
       -44,  -44,  -44,  -44,  -44,  -44,  -44,  -44
     },
 
@@ -1083,11 +1075,11 @@ static yyconst short yy_nxt[][128] =
       -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,
       -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,
       -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,
-      -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,   56,
-      -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,
+       59,  -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,
       -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,
       -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45,
-      -45,   56,  -45,  -45,  -45,  -45,  -45,  -45
+      -45,  -45,   59,  -45,  -45,  -45,  -45,  -45,  -45,  -45,
+      -45,  -45,  -45,  -45,  -45,  -45,  -45,  -45
     },
 
     {
@@ -1098,12 +1090,12 @@ static yyconst short yy_nxt[][128] =
       -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,
       -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,
       -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,
-      -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,   57,  -46,
       -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,
       -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,
+      -46,  -46,  -46,  -46,  -46,  -46,   60,  -46,  -46,  -46,
       -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,
-       57,  -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,
       -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,
+      -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,   60,  -46,
 
       -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46
     },
@@ -1113,15 +1105,15 @@ static yyconst short yy_nxt[][128] =
       -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,
       -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,
       -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,
-      -47,  -47,  -47,   58,  -47,   58,  -47,  -47,   59,   59,
-       59,   59,   59,   59,   59,   59,   59,   59,  -47,  -47,
       -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,
       -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,
       -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,
-
       -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,
+      -47,  -47,  -47,  -47,   61,  -47,  -47,  -47,  -47,  -47,
+
       -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,
       -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,
+      -47,  -47,  -47,  -47,  -47,  -47,   61,  -47,  -47,  -47,
       -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47
     },
 
@@ -1130,14 +1122,14 @@ static yyconst short yy_nxt[][128] =
       -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,
       -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,
       -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,
-      -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,   48,   48,
-       48,   48,   48,   48,   48,   48,   48,   48,  -48,  -48,
+      -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,
+      -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,
 
-      -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,   37,
       -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,
+      -48,  -48,  -48,  -48,  -48,  -48,  -48,   62,  -48,  -48,
       -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,
       -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,
-      -48,   37,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,
+      -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,   62,
       -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,
       -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48
     },
@@ -1148,13 +1140,13 @@ static yyconst short yy_nxt[][128] =
       -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,
 
       -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,
-      -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,   50,   50,
-       50,   50,   50,   50,   50,   50,   50,   50,  -49,  -49,
       -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,
       -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,
+      -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,   63,
       -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,
       -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,
       -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,
+      -49,   63,  -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,
       -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49,
       -49,  -49,  -49,  -49,  -49,  -49,  -49,  -49
 
@@ -1165,15 +1157,15 @@ static yyconst short yy_nxt[][128] =
       -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,
       -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,
       -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,
-      -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,   50,   50,
-       50,   50,   50,   50,   50,   50,   50,   50,  -50,  -50,
       -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,
       -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,
       -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,
       -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,
-
+      -50,  -50,  -50,  -50,   64,  -50,  -50,  -50,  -50,  -50,
       -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,
+
       -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50,
+      -50,  -50,  -50,  -50,  -50,  -50,   64,  -50,  -50,  -50,
       -50,  -50,  -50,  -50,  -50,  -50,  -50,  -50
     },
 
@@ -1186,12 +1178,12 @@ static yyconst short yy_nxt[][128] =
       -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,
       -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,
 
-      -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,
-      -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,   60,
+      -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,   65,  -51,
       -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,
       -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,
       -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,
-      -51,   60,  -51,  -51,  -51,  -51,  -51,  -51
+       65,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51,
+      -51,  -51,  -51,  -51,  -51,  -51,  -51,  -51
     },
 
     {
@@ -1202,13 +1194,13 @@ static yyconst short yy_nxt[][128] =
 
       -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,
       -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,
-      -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,   61,
       -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,
       -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,
+      -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,   66,
       -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,
-      -52,   61,  -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,
       -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,
-      -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52
+      -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,  -52,
+      -52,   66,  -52,  -52,  -52,  -52,  -52,  -52
     },
 
     {
@@ -1219,13 +1211,13 @@ static yyconst short yy_nxt[][128] =
       -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,
       -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,
       -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,
+      -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,   67,  -53,
       -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,
       -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,
-      -53,  -53,  -53,   62,  -53,  -53,  -53,  -53,  -53,  -53,
-      -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,
       -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,
+       67,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,
 
-      -53,  -53,  -53,  -53,  -53,   62,  -53,  -53,  -53,  -53,
+      -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,
       -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53
     },
 
@@ -1234,14 +1226,14 @@ static yyconst short yy_nxt[][128] =
       -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,
       -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,
       -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,
+      -54,  -54,  -54,   68,  -54,   68,  -54,  -54,   69,   69,
+       69,   69,   69,   69,   69,   69,   69,   69,  -54,  -54,
       -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,
       -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,
-      -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,
-      -54,  -54,  -54,   63,  -54,  -54,  -54,  -54,  -54,  -54,
 
       -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,
       -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,
-      -54,  -54,  -54,  -54,  -54,   63,  -54,  -54,  -54,  -54,
+      -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,
       -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54,
       -54,  -54,  -54,  -54,  -54,  -54,  -54,  -54
     },
@@ -1251,15 +1243,15 @@ static yyconst short yy_nxt[][128] =
       -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,
       -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,
       -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,
-      -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,
+      -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,   55,   55,
 
+       55,   55,   55,   55,   55,   55,   55,   55,  -55,  -55,
+      -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,   41,
       -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,
       -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,
       -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,
-      -55,  -55,  -55,  -55,   64,  -55,  -55,  -55,  -55,  -55,
+      -55,   41,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,
       -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,
-      -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55,
-      -55,  -55,  -55,  -55,  -55,  -55,   64,  -55,  -55,  -55,
       -55,  -55,  -55,  -55,  -55,  -55,  -55,  -55
     },
 
@@ -1269,13 +1261,13 @@ static yyconst short yy_nxt[][128] =
 
       -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,
       -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,
+      -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,   57,   57,
+       57,   57,   57,   57,   57,   57,   57,   57,  -56,  -56,
       -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,
       -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,
       -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,
-      -56,   65,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,
       -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,
       -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,
-      -56,  -56,  -56,   65,  -56,  -56,  -56,  -56,  -56,  -56,
       -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56,
 
       -56,  -56,  -56,  -56,  -56,  -56,  -56,  -56
@@ -1286,8 +1278,8 @@ static yyconst short yy_nxt[][128] =
       -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,
       -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,
       -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,
-      -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,
-      -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,
+      -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,   57,   57,
+       57,   57,   57,   57,   57,   57,   57,   57,  -57,  -57,
       -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,
       -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,
       -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,  -57,
@@ -1303,15 +1295,15 @@ static yyconst short yy_nxt[][128] =
       -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,
       -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,
       -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,
-      -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,   59,   59,
-       59,   59,   59,   59,   59,   59,   59,   59,  -58,  -58,
-
       -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,
       -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,
+
       -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,
       -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,
+      -58,  -58,  -58,  -58,  -58,   70,  -58,  -58,  -58,  -58,
       -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,
       -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58,
+      -58,  -58,  -58,  -58,  -58,  -58,  -58,   70,  -58,  -58,
       -58,  -58,  -58,  -58,  -58,  -58,  -58,  -58
     },
 
@@ -1321,14 +1313,14 @@ static yyconst short yy_nxt[][128] =
       -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,
 
       -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,
-      -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,   59,   59,
-       59,   59,   59,   59,   59,   59,   59,   59,  -59,  -59,
       -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,
       -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,
       -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,
+      -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,   71,
       -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,
       -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,
       -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,
+      -59,   71,  -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,
       -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59
 
     },
@@ -1340,12 +1332,12 @@ static yyconst short yy_nxt[][128] =
       -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,
       -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,
       -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,
-      -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,
+      -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,   72,
       -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,
       -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,
       -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,
 
-      -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,
+      -60,   72,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,
       -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,
       -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60
     },
@@ -1360,11 +1352,11 @@ static yyconst short yy_nxt[][128] =
       -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,
 
       -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,
-      -61,  -61,  -61,  -61,   66,  -61,  -61,  -61,  -61,  -61,
+      -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,   73,
+      -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,
       -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,
       -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61,
-      -61,  -61,  -61,  -61,  -61,  -61,   66,  -61,  -61,  -61,
-      -61,  -61,  -61,  -61,  -61,  -61,  -61,  -61
+      -61,   73,  -61,  -61,  -61,  -61,  -61,  -61
     },
 
     {
@@ -1375,12 +1367,12 @@ static yyconst short yy_nxt[][128] =
 
       -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,
       -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,
+      -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,   74,
       -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,
       -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,
-      -62,  -62,  -62,  -62,   67,  -62,  -62,  -62,  -62,  -62,
       -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,
+      -62,   74,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,
       -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,
-      -62,  -62,  -62,  -62,  -62,  -62,   67,  -62,  -62,  -62,
       -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62
     },
 
@@ -1393,12 +1385,12 @@ static yyconst short yy_nxt[][128] =
       -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,
       -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,
       -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,
-      -63,  -63,  -63,  -63,  -63,  -63,   68,  -63,  -63,  -63,
-       69,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,
       -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,
-      -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,   68,  -63,
+      -63,  -63,  -63,   75,  -63,  -63,  -63,  -63,  -63,  -63,
+      -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,
+      -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63,
 
-      -63,  -63,   69,  -63,  -63,  -63,  -63,  -63,  -63,  -63,
+      -63,  -63,  -63,  -63,  -63,   75,  -63,  -63,  -63,  -63,
       -63,  -63,  -63,  -63,  -63,  -63,  -63,  -63
     },
 
@@ -1410,11 +1402,11 @@ static yyconst short yy_nxt[][128] =
       -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,
       -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,
       -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,
-      -64,  -64,  -64,  -64,  -64,  -64,  -64,   70,  -64,  -64,
+      -64,  -64,  -64,   76,  -64,  -64,  -64,  -64,  -64,  -64,
 
       -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,
       -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,
-      -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,   70,
+      -64,  -64,  -64,  -64,  -64,   76,  -64,  -64,  -64,  -64,
       -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64,
       -64,  -64,  -64,  -64,  -64,  -64,  -64,  -64
     },
@@ -1428,11 +1420,11 @@ static yyconst short yy_nxt[][128] =
 
       -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,
       -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,
-      -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,   71,
       -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,
+      -65,  -65,  -65,  -65,   77,  -65,  -65,  -65,  -65,  -65,
       -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,
       -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,
-      -65,   71,  -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65,
+      -65,  -65,  -65,  -65,  -65,  -65,   77,  -65,  -65,  -65,
       -65,  -65,  -65,  -65,  -65,  -65,  -65,  -65
     },
 
@@ -1445,11 +1437,11 @@ static yyconst short yy_nxt[][128] =
       -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,
       -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,
       -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,
+      -66,   78,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,
       -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,
-      -66,  -66,   72,  -66,  -66,  -66,  -66,  -66,  -66,  -66,
       -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,
+      -66,  -66,  -66,   78,  -66,  -66,  -66,  -66,  -66,  -66,
       -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,
-      -66,  -66,  -66,  -66,   72,  -66,  -66,  -66,  -66,  -66,
 
       -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66
     },
@@ -1463,11 +1455,11 @@ static yyconst short yy_nxt[][128] =
       -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,
       -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,
       -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,
-      -67,  -67,   73,  -67,  -67,  -67,  -67,  -67,  -67,  -67,
+      -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,
 
       -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,
       -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,
-      -67,  -67,  -67,  -67,   73,  -67,  -67,  -67,  -67,  -67,
+      -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67,
       -67,  -67,  -67,  -67,  -67,  -67,  -67,  -67
     },
 
@@ -1476,14 +1468,14 @@ static yyconst short yy_nxt[][128] =
       -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,
       -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,
       -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,
+      -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,   69,   69,
+       69,   69,   69,   69,   69,   69,   69,   69,  -68,  -68,
+
       -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,
       -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,
-
       -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,
-      -68,  -68,  -68,   74,  -68,  -68,  -68,  -68,  -68,  -68,
       -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,
       -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,
-      -68,  -68,  -68,  -68,  -68,   74,  -68,  -68,  -68,  -68,
       -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68,
       -68,  -68,  -68,  -68,  -68,  -68,  -68,  -68
     },
@@ -1494,14 +1486,14 @@ static yyconst short yy_nxt[][128] =
       -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,
 
       -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,
+      -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,   69,   69,
+       69,   69,   69,   69,   69,   69,   69,   69,  -69,  -69,
       -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,
       -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,
       -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,
-      -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,   75,
       -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,
       -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,
       -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,
-      -69,   75,  -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69,
       -69,  -69,  -69,  -69,  -69,  -69,  -69,  -69
 
     },
@@ -1514,11 +1506,11 @@ static yyconst short yy_nxt[][128] =
       -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,
       -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,
       -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,
-      -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,
+      -70,  -70,  -70,  -70,  -70,  -70,   79,  -70,  -70,  -70,
       -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,
       -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,
 
-      -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,
+      -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,   79,  -70,
       -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70,
       -70,  -70,  -70,  -70,  -70,  -70,  -70,  -70
     },
@@ -1532,11 +1524,11 @@ static yyconst short yy_nxt[][128] =
       -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,
       -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,
 
-      -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,   76,  -71,
       -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,
+      -71,  -71,  -71,  -71,  -71,   80,  -71,  -71,  -71,  -71,
       -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,
       -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,
-       76,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71,
+      -71,  -71,  -71,  -71,  -71,  -71,  -71,   80,  -71,  -71,
       -71,  -71,  -71,  -71,  -71,  -71,  -71,  -71
     },
 
@@ -1550,11 +1542,11 @@ static yyconst short yy_nxt[][128] =
       -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,
       -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,
       -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,
-      -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,   77,
-      -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,
+       81,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,
       -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,
       -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72,
-      -72,   77,  -72,  -72,  -72,  -72,  -72,  -72
+      -72,  -72,   81,  -72,  -72,  -72,  -72,  -72,  -72,  -72,
+      -72,  -72,  -72,  -72,  -72,  -72,  -72,  -72
     },
 
     {
@@ -1566,10 +1558,10 @@ static yyconst short yy_nxt[][128] =
       -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,
       -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,
       -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,
-      -73,  -73,  -73,   78,  -73,  -73,  -73,  -73,  -73,  -73,
       -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,
       -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,
-      -73,  -73,  -73,  -73,  -73,   78,  -73,  -73,  -73,  -73,
+      -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,
+      -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,
 
       -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73,
       -73,  -73,  -73,  -73,  -73,  -73,  -73,  -73
@@ -1583,12 +1575,12 @@ static yyconst short yy_nxt[][128] =
       -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,
       -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,
       -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,
-      -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,   79,  -74,
-
       -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,
+
+      -74,  -74,  -74,  -74,   82,  -74,  -74,  -74,  -74,  -74,
       -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,
       -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,
-       79,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74,
+      -74,  -74,  -74,  -74,  -74,  -74,   82,  -74,  -74,  -74,
       -74,  -74,  -74,  -74,  -74,  -74,  -74,  -74
     },
 
@@ -1601,11 +1593,11 @@ static yyconst short yy_nxt[][128] =
 
       -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,
       -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,
-      -75,  -75,  -75,   80,  -75,  -75,   81,  -75,  -75,  -75,
       -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,
+      -75,  -75,  -75,  -75,   83,  -75,  -75,  -75,  -75,  -75,
       -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,
-      -75,  -75,  -75,  -75,  -75,   80,  -75,  -75,   81,  -75,
       -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75,
+      -75,  -75,  -75,  -75,  -75,  -75,   83,  -75,  -75,  -75,
       -75,  -75,  -75,  -75,  -75,  -75,  -75,  -75
     },
 
@@ -1617,12 +1609,12 @@ static yyconst short yy_nxt[][128] =
       -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,
       -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,
       -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,
-      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,
-      -76,  -76,  -76,  -76,  -76,  -76,  -76,   82,  -76,  -76,
-      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,
-      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,
-      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,   82,
-      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,
+      -76,  -76,  -76,  -76,  -76,  -76,  -76,   84,  -76,  -76,
+      -76,  -76,  -76,  -76,  -76,  -76,   85,  -76,  -76,  -76,
+       86,  -76,  -76,   87,  -76,  -76,  -76,  -76,  -76,  -76,
+      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,   84,
+      -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76,   85,  -76,
+      -76,  -76,   86,  -76,  -76,   87,  -76,  -76,  -76,  -76,
 
       -76,  -76,  -76,  -76,  -76,  -76,  -76,  -76
     },
@@ -1634,12 +1626,12 @@ static yyconst short yy_nxt[][128] =
       -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,
       -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,
       -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,
-      -77,  -77,  -77,  -77,  -77,  -77,  -77,   83,  -77,  -77,
       -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,
+      -77,  -77,  -77,  -77,  -77,  -77,  -77,   88,  -77,  -77,
       -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,
 
-      -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,   83,
       -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,
+      -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,   88,
       -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77,
       -77,  -77,  -77,  -77,  -77,  -77,  -77,  -77
     },
@@ -1653,11 +1645,11 @@ static yyconst short yy_nxt[][128] =
       -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,
 
       -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,
-      -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,   84,  -78,
+      -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,   89,
       -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,
       -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,
       -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,
-       84,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,
+      -78,   89,  -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78,
       -78,  -78,  -78,  -78,  -78,  -78,  -78,  -78
     },
 
@@ -1669,11 +1661,11 @@ static yyconst short yy_nxt[][128] =
       -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,
       -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,
       -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,
-      -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,   85,
+      -79,  -79,  -79,  -79,  -79,   90,  -79,  -79,  -79,  -79,
       -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,
       -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,
+      -79,  -79,  -79,  -79,  -79,  -79,  -79,   90,  -79,  -79,
       -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,
-      -79,   85,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,
       -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79,
       -79,  -79,  -79,  -79,  -79,  -79,  -79,  -79
 
@@ -1687,12 +1679,12 @@ static yyconst short yy_nxt[][128] =
       -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,
       -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,
       -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,
-      -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,   86,  -80,
+      -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,   91,  -80,
       -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,
       -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,
 
       -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,
-       86,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,
+       91,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80,
       -80,  -80,  -80,  -80,  -80,  -80,  -80,  -80
     },
 
@@ -1705,12 +1697,12 @@ static yyconst short yy_nxt[][128] =
       -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,
       -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,
 
-      -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,
-      -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,   87,
+      -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,   92,
       -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,
       -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,
       -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,
-      -81,   87,  -81,  -81,  -81,  -81,  -81,  -81
+      -81,   92,  -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81,
+      -81,  -81,  -81,  -81,  -81,  -81,  -81,  -81
     },
 
     {
@@ -1723,10 +1715,10 @@ static yyconst short yy_nxt[][128] =
       -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,
       -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,
       -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,
+      -82,  -82,   93,  -82,  -82,  -82,  -82,  -82,  -82,  -82,
       -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,
       -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,
-      -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,
-      -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82,
+      -82,  -82,  -82,  -82,   93,  -82,  -82,  -82,  -82,  -82,
       -82,  -82,  -82,  -82,  -82,  -82,  -82,  -82
     },
 
@@ -1739,12 +1731,12 @@ static yyconst short yy_nxt[][128] =
       -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,
       -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,
       -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,
-      -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,   88,
       -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,
+      -83,  -83,   94,  -83,  -83,  -83,  -83,  -83,  -83,  -83,
       -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,
       -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,
 
-      -83,   88,  -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83,
+      -83,  -83,  -83,  -83,   94,  -83,  -83,  -83,  -83,  -83,
       -83,  -83,  -83,  -83,  -83,  -83,  -83,  -83
     },
 
@@ -1756,12 +1748,12 @@ static yyconst short yy_nxt[][128] =
       -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,
       -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,
       -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,
-      -84,   89,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,
-
       -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,
+
+      -84,  -84,  -84,  -84,  -84,   95,  -84,  -84,  -84,  -84,
       -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,
-      -84,  -84,  -84,   89,  -84,  -84,  -84,  -84,  -84,  -84,
       -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84,
+      -84,  -84,  -84,  -84,  -84,  -84,  -84,   95,  -84,  -84,
       -84,  -84,  -84,  -84,  -84,  -84,  -84,  -84
     },
 
@@ -1774,11 +1766,11 @@ static yyconst short yy_nxt[][128] =
 
       -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,
       -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,
+      -85,  -85,  -85,   96,  -85,  -85,  -85,  -85,  -85,  -85,
       -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,
-      -85,  -85,  -85,   90,  -85,  -85,  -85,  -85,  -85,  -85,
       -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,
+      -85,  -85,  -85,  -85,  -85,   96,  -85,  -85,  -85,  -85,
       -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85,
-      -85,  -85,  -85,  -85,  -85,   90,  -85,  -85,  -85,  -85,
       -85,  -85,  -85,  -85,  -85,  -85,  -85,  -85
     },
 
@@ -1791,11 +1783,11 @@ static yyconst short yy_nxt[][128] =
       -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,
       -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,
       -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,
+      -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,   97,
       -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,
-      -86,  -86,  -86,  -86,   91,  -86,  -86,  -86,  -86,  -86,
       -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,
       -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,
-      -86,  -86,  -86,  -86,  -86,  -86,   91,  -86,  -86,  -86,
+      -86,   97,  -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86,
 
       -86,  -86,  -86,  -86,  -86,  -86,  -86,  -86
     },
@@ -1808,12 +1800,12 @@ static yyconst short yy_nxt[][128] =
       -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,
       -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,
       -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,
-      -87,   92,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,
       -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,
+      -87,  -87,  -87,  -87,  -87,   98,  -87,  -87,  -87,  -87,
 
       -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,
-      -87,  -87,  -87,   92,  -87,  -87,  -87,  -87,  -87,  -87,
       -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87,
+      -87,  -87,  -87,  -87,  -87,  -87,  -87,   98,  -87,  -87,
       -87,  -87,  -87,  -87,  -87,  -87,  -87,  -87
     },
 
@@ -1826,10 +1818,10 @@ static yyconst short yy_nxt[][128] =
       -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,
 
       -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,
-      -88,  -88,  -88,  -88,  -88,  -88,   93,  -88,  -88,  -88,
       -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,
       -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,
-      -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,   93,  -88,
+      -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,
+      -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,
       -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88,
       -88,  -88,  -88,  -88,  -88,  -88,  -88,  -88
     },
@@ -1843,11 +1835,11 @@ static yyconst short yy_nxt[][128] =
       -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,
       -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,
       -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,
-      -89,  -89,  -89,  -89,  -89,  -89,  -89,   94,  -89,  -89,
+      -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,   99,  -89,
       -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,
       -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,
-      -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,   94,
       -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,
+       99,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89,
       -89,  -89,  -89,  -89,  -89,  -89,  -89,  -89
 
     },
@@ -1861,11 +1853,11 @@ static yyconst short yy_nxt[][128] =
       -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,
       -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,
       -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,
-      -90,  -90,  -90,  -90,   95,  -90,  -90,  -90,  -90,  -90,
+      -90,  -90,  100,  -90,  -90,  -90,  -90,  -90,  -90,  -90,
       -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,
 
       -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90,
-      -90,  -90,  -90,  -90,  -90,  -90,   95,  -90,  -90,  -90,
+      -90,  -90,  -90,  -90,  100,  -90,  -90,  -90,  -90,  -90,
       -90,  -90,  -90,  -90,  -90,  -90,  -90,  -90
     },
 
@@ -1876,12 +1868,12 @@ static yyconst short yy_nxt[][128] =
       -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,
       -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,
       -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,
-      -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,
+      -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  101,  -91,
 
-      -91,  -91,  -91,  -91,  -91,  -91,  -91,   96,  -91,  -91,
       -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,
       -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,
-      -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,   96,
+      -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,
+      101,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,
       -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91,
       -91,  -91,  -91,  -91,  -91,  -91,  -91,  -91
     },
@@ -1895,11 +1887,11 @@ static yyconst short yy_nxt[][128] =
       -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,
       -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,
       -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,
-      -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,   97,
+      -92,  -92,  -92,  -92,  -92,  -92,  102,  -92,  -92,  -92,
       -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,
       -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,
+      -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  102,  -92,
       -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,
-      -92,   97,  -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92,
       -92,  -92,  -92,  -92,  -92,  -92,  -92,  -92
     },
 
@@ -1912,13 +1904,13 @@ static yyconst short yy_nxt[][128] =
       -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,
       -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,
       -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,
-      -93,  -93,  -93,  -93,  -93,  -93,   98,  -93,  -93,  -93,
+      -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,
+      -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  103,
       -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,
       -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,
-      -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,   98,  -93,
 
       -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93,
-      -93,  -93,  -93,  -93,  -93,  -93,  -93,  -93
+      -93,  103,  -93,  -93,  -93,  -93,  -93,  -93
     },
 
     {
@@ -1929,11 +1921,11 @@ static yyconst short yy_nxt[][128] =
       -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,
       -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,
       -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,
-      -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,
+      -94,  -94,  -94,  104,  -94,  -94,  -94,  -94,  -94,  -94,
 
       -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,
       -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,
-      -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,
+      -94,  -94,  -94,  -94,  -94,  104,  -94,  -94,  -94,  -94,
       -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94,
       -94,  -94,  -94,  -94,  -94,  -94,  -94,  -94
     },
@@ -1948,10 +1940,10 @@ static yyconst short yy_nxt[][128] =
       -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,
       -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,
       -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,
-      -95,  -95,   99,  -95,  -95,  -95,  -95,  -95,  -95,  -95,
+      -95,  -95,  105,  -95,  -95,  -95,  -95,  -95,  -95,  -95,
       -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,
       -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95,
-      -95,  -95,  -95,  -95,   99,  -95,  -95,  -95,  -95,  -95,
+      -95,  -95,  -95,  -95,  105,  -95,  -95,  -95,  -95,  -95,
       -95,  -95,  -95,  -95,  -95,  -95,  -95,  -95
     },
 
@@ -1964,11 +1956,11 @@ static yyconst short yy_nxt[][128] =
       -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,
       -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,
       -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,
+      -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  106,  -96,
       -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,
       -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,
       -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,
-      -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,
-      -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,
+      106,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96,
 
       -96,  -96,  -96,  -96,  -96,  -96,  -96,  -96
     },
@@ -1981,12 +1973,12 @@ static yyconst short yy_nxt[][128] =
       -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,
       -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,
       -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,
-      -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  100,  -97,
+      -97,  -97,  -97,  107,  -97,  -97,  108,  -97,  -97,  -97,
       -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,
 
       -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,
+      -97,  -97,  -97,  -97,  -97,  107,  -97,  -97,  108,  -97,
       -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,
-      100,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97,
       -97,  -97,  -97,  -97,  -97,  -97,  -97,  -97
     },
 
@@ -1998,12 +1990,12 @@ static yyconst short yy_nxt[][128] =
       -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,
       -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,
 
-      -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  101,
       -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,
       -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,
+      -98,  -98,  109,  -98,  -98,  -98,  -98,  -98,  -98,  -98,
       -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,
-      -98,  101,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,
       -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98,
+      -98,  -98,  -98,  -98,  109,  -98,  -98,  -98,  -98,  -98,
       -98,  -98,  -98,  -98,  -98,  -98,  -98,  -98
     },
 
@@ -2016,10 +2008,10 @@ static yyconst short yy_nxt[][128] =
       -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,
       -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,
       -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,
-      -99,  -99,  -99,  102,  -99,  -99,  -99,  -99,  -99,  -99,
+      -99,  -99,  -99,  -99,  -99,  -99,  -99,  110,  -99,  -99,
       -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,
       -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,
-      -99,  -99,  -99,  -99,  -99,  102,  -99,  -99,  -99,  -99,
+      -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  110,
       -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99,
       -99,  -99,  -99,  -99,  -99,  -99,  -99,  -99
 
@@ -2033,12 +2025,12 @@ static yyconst short yy_nxt[][128] =
      -100, -100, -100, -100, -100, -100, -100, -100, -100, -100,
      -100, -100, -100, -100, -100, -100, -100, -100, -100, -100,
      -100, -100, -100, -100, -100, -100, -100, -100, -100, -100,
-     -100, -100, -100, -100, -100, -100, -100,  103, -100, -100,
      -100, -100, -100, -100, -100, -100, -100, -100, -100, -100,
+     -100, -100, -100,  111, -100, -100, -100, -100, -100, -100,
      -100, -100, -100, -100, -100, -100, -100, -100, -100, -100,
 
-     -100, -100, -100, -100, -100, -100, -100, -100, -100,  103,
      -100, -100, -100, -100, -100, -100, -100, -100, -100, -100,
+     -100, -100, -100, -100, -100,  111, -100, -100, -100, -100,
      -100, -100, -100, -100, -100, -100, -100, -100
     },
 
@@ -2049,11 +2041,11 @@ static yyconst short yy_nxt[][128] =
      -101, -101, -101, -101, -101, -101, -101, -101, -101, -101,
      -101, -101, -101, -101, -101, -101, -101, -101, -101, -101,
      -101, -101, -101, -101, -101, -101, -101, -101, -101, -101,
-     -101, -101, -101, -101, -101, -101, -101,  104, -101, -101,
+     -101, -101, -101, -101, -101, -101, -101,  112, -101, -101,
 
      -101, -101, -101, -101, -101, -101, -101, -101, -101, -101,
      -101, -101, -101, -101, -101, -101, -101, -101, -101, -101,
-     -101, -101, -101, -101, -101, -101, -101, -101, -101,  104,
+     -101, -101, -101, -101, -101, -101, -101, -101, -101,  112,
      -101, -101, -101, -101, -101, -101, -101, -101, -101, -101,
      -101, -101, -101, -101, -101, -101, -101, -101, -101, -101,
      -101, -101, -101, -101, -101, -101, -101, -101
@@ -2068,12 +2060,12 @@ static yyconst short yy_nxt[][128] =
      -102, -102, -102, -102, -102, -102, -102, -102, -102, -102,
      -102, -102, -102, -102, -102, -102, -102, -102, -102, -102,
      -102, -102, -102, -102, -102, -102, -102, -102, -102, -102,
-     -102, -102, -102, -102, -102, -102, -102, -102,  105, -102,
+     -102, -102, -102, -102, -102, -102, -102, -102, -102, -102,
+     -102, -102, -102, -102, -102, -102, -102, -102, -102,  113,
      -102, -102, -102, -102, -102, -102, -102, -102, -102, -102,
      -102, -102, -102, -102, -102, -102, -102, -102, -102, -102,
      -102, -102, -102, -102, -102, -102, -102, -102, -102, -102,
-      105, -102, -102, -102, -102, -102, -102, -102, -102, -102,
-     -102, -102, -102, -102, -102, -102, -102, -102
+     -102,  113, -102, -102, -102, -102, -102, -102
     },
 
     {
@@ -2084,10 +2076,10 @@ static yyconst short yy_nxt[][128] =
      -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,
      -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,
      -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,
+     -103, -103, -103, -103, -103, -103, -103,  114, -103, -103,
      -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,
      -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,
-     -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,
-     -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,
+     -103, -103, -103, -103, -103, -103, -103, -103, -103,  114,
      -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,
 
      -103, -103, -103, -103, -103, -103, -103, -103, -103, -103,
@@ -2102,12 +2094,12 @@ static yyconst short yy_nxt[][128] =
      -104, -104, -104, -104, -104, -104, -104, -104, -104, -104,
      -104, -104, -104, -104, -104, -104, -104, -104, -104, -104,
      -104, -104, -104, -104, -104, -104, -104, -104, -104, -104,
-     -104, -104, -104, -104, -104, -104, -104, -104, -104, -104,
+     -104, -104, -104, -104, -104, -104, -104, -104,  115, -104,
 
-     -104, -104, -104, -104,  106, -104, -104, -104, -104, -104,
      -104, -104, -104, -104, -104, -104, -104, -104, -104, -104,
      -104, -104, -104, -104, -104, -104, -104, -104, -104, -104,
-     -104, -104, -104, -104, -104, -104,  106, -104, -104, -104,
+     -104, -104, -104, -104, -104, -104, -104, -104, -104, -104,
+      115, -104, -104, -104, -104, -104, -104, -104, -104, -104,
      -104, -104, -104, -104, -104, -104, -104, -104
     },
 
@@ -2120,11 +2112,11 @@ static yyconst short yy_nxt[][128] =
 
      -105, -105, -105, -105, -105, -105, -105, -105, -105, -105,
      -105, -105, -105, -105, -105, -105, -105, -105, -105, -105,
-     -105,  107, -105, -105, -105, -105, -105, -105, -105, -105,
      -105, -105, -105, -105, -105, -105, -105, -105, -105, -105,
+     -105, -105, -105, -105, -105, -105,  116, -105, -105, -105,
      -105, -105, -105, -105, -105, -105, -105, -105, -105, -105,
-     -105, -105, -105,  107, -105, -105, -105, -105, -105, -105,
      -105, -105, -105, -105, -105, -105, -105, -105, -105, -105,
+     -105, -105, -105, -105, -105, -105, -105, -105,  116, -105,
      -105, -105, -105, -105, -105, -105, -105, -105
     },
 
@@ -2136,11 +2128,11 @@ static yyconst short yy_nxt[][128] =
      -106, -106, -106, -106, -106, -106, -106, -106, -106, -106,
      -106, -106, -106, -106, -106, -106, -106, -106, -106, -106,
      -106, -106, -106, -106, -106, -106, -106, -106, -106, -106,
+     -106, -106, -106, -106, -106, -106, -106, -106, -106,  117,
      -106, -106, -106, -106, -106, -106, -106, -106, -106, -106,
-     -106, -106, -106,  108, -106, -106, -106, -106, -106, -106,
      -106, -106, -106, -106, -106, -106, -106, -106, -106, -106,
      -106, -106, -106, -106, -106, -106, -106, -106, -106, -106,
-     -106, -106, -106, -106, -106,  108, -106, -106, -106, -106,
+     -106,  117, -106, -106, -106, -106, -106, -106, -106, -106,
      -106, -106, -106, -106, -106, -106, -106, -106, -106, -106,
 
      -106, -106, -106, -106, -106, -106, -106, -106
@@ -2154,12 +2146,12 @@ static yyconst short yy_nxt[][128] =
      -107, -107, -107, -107, -107, -107, -107, -107, -107, -107,
      -107, -107, -107, -107, -107, -107, -107, -107, -107, -107,
      -107, -107, -107, -107, -107, -107, -107, -107, -107, -107,
-     -107, -107, -107, -107, -107, -107, -107,  109, -107, -107,
+     -107, -107, -107, -107, -107, -107, -107, -107,  118, -107,
      -107, -107, -107, -107, -107, -107, -107, -107, -107, -107,
 
      -107, -107, -107, -107, -107, -107, -107, -107, -107, -107,
-     -107, -107, -107, -107, -107, -107, -107, -107, -107,  109,
      -107, -107, -107, -107, -107, -107, -107, -107, -107, -107,
+      118, -107, -107, -107, -107, -107, -107, -107, -107, -107,
      -107, -107, -107, -107, -107, -107, -107, -107
     },
 
@@ -2172,12 +2164,12 @@ static yyconst short yy_nxt[][128] =
      -108, -108, -108, -108, -108, -108, -108, -108, -108, -108,
 
      -108, -108, -108, -108, -108, -108, -108, -108, -108, -108,
-     -108, -108, -108, -108, -108, -108, -108, -108, -108,  110,
      -108, -108, -108, -108, -108, -108, -108, -108, -108, -108,
+     -108, -108, -108, -108, -108, -108, -108, -108, -108,  119,
      -108, -108, -108, -108, -108, -108, -108, -108, -108, -108,
      -108, -108, -108, -108, -108, -108, -108, -108, -108, -108,
-     -108,  110, -108, -108, -108, -108, -108, -108, -108, -108,
-     -108, -108, -108, -108, -108, -108, -108, -108
+     -108, -108, -108, -108, -108, -108, -108, -108, -108, -108,
+     -108,  119, -108, -108, -108, -108, -108, -108
     },
 
     {
@@ -2189,10 +2181,10 @@ static yyconst short yy_nxt[][128] =
      -109, -109, -109, -109, -109, -109, -109, -109, -109, -109,
      -109, -109, -109, -109, -109, -109, -109, -109, -109, -109,
      -109, -109, -109, -109, -109, -109, -109, -109, -109, -109,
+      120, -109, -109, -109, -109, -109, -109, -109, -109, -109,
      -109, -109, -109, -109, -109, -109, -109, -109, -109, -109,
      -109, -109, -109, -109, -109, -109, -109, -109, -109, -109,
-     -109, -109, -109, -109, -109, -109, -109, -109, -109, -109,
-     -109, -109, -109, -109, -109, -109, -109, -109, -109, -109,
+     -109, -109,  120, -109, -109, -109, -109, -109, -109, -109,
      -109, -109, -109, -109, -109, -109, -109, -109, -109, -109,
      -109, -109, -109, -109, -109, -109, -109, -109
 
@@ -2206,12 +2198,12 @@ static yyconst short yy_nxt[][128] =
      -110, -110, -110, -110, -110, -110, -110, -110, -110, -110,
      -110, -110, -110, -110, -110, -110, -110, -110, -110, -110,
      -110, -110, -110, -110, -110, -110, -110, -110, -110, -110,
-     -110, -110, -110, -110, -110, -110, -110, -110,  111, -110,
+     -110, -110, -110, -110, -110, -110, -110, -110, -110, -110,
      -110, -110, -110, -110, -110, -110, -110, -110, -110, -110,
      -110, -110, -110, -110, -110, -110, -110, -110, -110, -110,
 
      -110, -110, -110, -110, -110, -110, -110, -110, -110, -110,
-      111, -110, -110, -110, -110, -110, -110, -110, -110, -110,
+     -110, -110, -110, -110, -110, -110, -110, -110, -110, -110,
      -110, -110, -110, -110, -110, -110, -110, -110
     },
 
@@ -2224,11 +2216,11 @@ static yyconst short yy_nxt[][128] =
      -111, -111, -111, -111, -111, -111, -111, -111, -111, -111,
      -111, -111, -111, -111, -111, -111, -111, -111, -111, -111,
 
-     -111, -111, -111, -111, -111, -111, -111,  112, -111, -111,
      -111, -111, -111, -111, -111, -111, -111, -111, -111, -111,
+     -111, -111, -111, -111,  121, -111, -111, -111, -111, -111,
      -111, -111, -111, -111, -111, -111, -111, -111, -111, -111,
-     -111, -111, -111, -111, -111, -111, -111, -111, -111,  112,
      -111, -111, -111, -111, -111, -111, -111, -111, -111, -111,
+     -111, -111, -111, -111, -111, -111,  121, -111, -111, -111,
      -111, -111, -111, -111, -111, -111, -111, -111
     },
 
@@ -2242,13 +2234,948 @@ static yyconst short yy_nxt[][128] =
      -112, -112, -112, -112, -112, -112, -112, -112, -112, -112,
      -112, -112, -112, -112, -112, -112, -112, -112, -112, -112,
      -112, -112, -112, -112, -112, -112, -112, -112, -112, -112,
+     -112, -112, -112, -112, -112,  122, -112, -112, -112, -112,
      -112, -112, -112, -112, -112, -112, -112, -112, -112, -112,
      -112, -112, -112, -112, -112, -112, -112, -112, -112, -112,
-     -112, -112, -112, -112, -112, -112, -112, -112, -112, -112,
-     -112, -112, -112, -112, -112, -112, -112, -112, -112, -112,
+     -112, -112, -112, -112, -112, -112, -112,  122, -112, -112,
      -112, -112, -112, -112, -112, -112, -112, -112
     },
 
+    {
+        5, -113, -113, -113, -113, -113, -113, -113, -113, -113,
+
+     -113, -113, -113, -113, -113, -113, -113, -113, -113, -113,
+     -113, -113, -113, -113, -113, -113, -113, -113, -113, -113,
+     -113, -113, -113, -113, -113, -113, -113, -113, -113, -113,
+     -113, -113, -113, -113, -113, -113, -113, -113, -113, -113,
+     -113, -113, -113, -113, -113, -113, -113, -113, -113, -113,
+     -113, -113, -113, -113, -113, -113, -113, -113, -113, -113,
+     -113,  123, -113, -113, -113, -113, -113, -113, -113, -113,
+     -113, -113, -113, -113, -113, -113, -113, -113, -113, -113,
+     -113, -113, -113, -113, -113, -113, -113, -113, -113, -113,
+     -113, -113, -113,  123, -113, -113, -113, -113, -113, -113,
+
+     -113, -113, -113, -113, -113, -113, -113, -113, -113, -113,
+     -113, -113, -113, -113, -113, -113, -113, -113
+    },
+
+    {
+        5, -114, -114, -114, -114, -114, -114, -114, -114, -114,
+     -114, -114, -114, -114, -114, -114, -114, -114, -114, -114,
+     -114, -114, -114, -114, -114, -114, -114, -114, -114, -114,
+     -114, -114, -114, -114, -114, -114, -114, -114, -114, -114,
+     -114, -114, -114, -114, -114, -114, -114, -114, -114, -114,
+     -114, -114, -114, -114, -114, -114, -114, -114, -114, -114,
+     -114, -114, -114, -114, -114, -114, -114, -114, -114, -114,
+     -114, -114, -114, -114, -114, -114, -114, -114, -114,  124,
+
+     -114, -114, -114, -114, -114, -114, -114, -114, -114, -114,
+     -114, -114, -114, -114, -114, -114, -114, -114, -114, -114,
+     -114, -114, -114, -114, -114, -114, -114, -114, -114, -114,
+     -114,  124, -114, -114, -114, -114, -114, -114, -114, -114,
+     -114, -114, -114, -114, -114, -114, -114, -114
+    },
+
+    {
+        5, -115, -115, -115, -115, -115, -115, -115, -115, -115,
+     -115, -115, -115, -115, -115, -115, -115, -115, -115, -115,
+     -115, -115, -115, -115, -115, -115, -115, -115, -115, -115,
+     -115, -115, -115, -115, -115, -115, -115, -115, -115, -115,
+     -115, -115, -115, -115, -115, -115, -115, -115, -115, -115,
+
+     -115, -115, -115, -115, -115, -115, -115, -115, -115, -115,
+     -115, -115, -115, -115, -115, -115, -115, -115, -115, -115,
+     -115,  125, -115, -115, -115, -115, -115, -115, -115, -115,
+     -115, -115, -115, -115, -115, -115, -115, -115, -115, -115,
+     -115, -115, -115, -115, -115, -115, -115, -115, -115, -115,
+     -115, -115, -115,  125, -115, -115, -115, -115, -115, -115,
+     -115, -115, -115, -115, -115, -115, -115, -115, -115, -115,
+     -115, -115, -115, -115, -115, -115, -115, -115
+    },
+
+    {
+        5, -116, -116, -116, -116, -116, -116, -116, -116, -116,
+     -116, -116, -116, -116, -116, -116, -116, -116, -116, -116,
+
+     -116, -116, -116, -116, -116, -116, -116, -116, -116, -116,
+     -116, -116, -116, -116, -116, -116, -116, -116, -116, -116,
+     -116, -116, -116, -116, -116, -116, -116, -116, -116, -116,
+     -116, -116, -116, -116, -116, -116, -116, -116, -116, -116,
+     -116, -116, -116, -116, -116, -116, -116, -116, -116,  126,
+     -116, -116, -116, -116, -116, -116, -116, -116, -116, -116,
+     -116, -116, -116, -116, -116, -116, -116, -116, -116, -116,
+     -116, -116, -116, -116, -116, -116, -116, -116, -116, -116,
+     -116,  126, -116, -116, -116, -116, -116, -116, -116, -116,
+     -116, -116, -116, -116, -116, -116, -116, -116, -116, -116,
+
+     -116, -116, -116, -116, -116, -116, -116, -116
+    },
+
+    {
+        5, -117, -117, -117, -117, -117, -117, -117, -117, -117,
+     -117, -117, -117, -117, -117, -117, -117, -117, -117, -117,
+     -117, -117, -117, -117, -117, -117, -117, -117, -117, -117,
+     -117, -117, -117, -117, -117, -117, -117, -117, -117, -117,
+     -117, -117, -117, -117, -117, -117, -117, -117, -117, -117,
+     -117, -117, -117, -117, -117, -117, -117, -117, -117, -117,
+     -117, -117, -117, -117, -117, -117, -117, -117, -117, -117,
+     -117, -117, -117, -117, -117, -117, -117, -117, -117, -117,
+     -117, -117, -117,  127, -117, -117, -117, -117, -117, -117,
+
+     -117, -117, -117, -117, -117, -117, -117, -117, -117, -117,
+     -117, -117, -117, -117, -117, -117, -117, -117, -117, -117,
+     -117, -117, -117, -117, -117,  127, -117, -117, -117, -117,
+     -117, -117, -117, -117, -117, -117, -117, -117
+    },
+
+    {
+        5, -118, -118, -118, -118, -118, -118, -118, -118, -118,
+     -118, -118, -118, -118, -118, -118, -118, -118, -118, -118,
+     -118, -118, -118, -118, -118, -118, -118, -118, -118, -118,
+     -118, -118, -118, -118, -118, -118, -118, -118, -118, -118,
+     -118, -118, -118, -118, -118, -118, -118, -118, -118, -118,
+     -118, -118, -118, -118, -118, -118, -118, -118, -118, -118,
+
+     -118, -118, -118, -118, -118, -118, -118, -118, -118, -118,
+     -118, -118, -118, -118, -118, -118, -118, -118, -118, -118,
+     -118, -118, -118, -118,  128, -118, -118, -118, -118, -118,
+     -118, -118, -118, -118, -118, -118, -118, -118, -118, -118,
+     -118, -118, -118, -118, -118, -118, -118, -118, -118, -118,
+     -118, -118, -118, -118, -118, -118,  128, -118, -118, -118,
+     -118, -118, -118, -118, -118, -118, -118, -118
+    },
+
+    {
+        5, -119, -119, -119, -119, -119, -119, -119, -119, -119,
+     -119, -119, -119, -119, -119, -119, -119, -119, -119, -119,
+     -119, -119, -119, -119, -119, -119, -119, -119, -119, -119,
+
+     -119, -119, -119, -119, -119, -119, -119, -119, -119, -119,
+     -119, -119, -119, -119, -119, -119, -119, -119, -119, -119,
+     -119, -119, -119, -119, -119, -119, -119, -119, -119, -119,
+     -119, -119, -119, -119, -119, -119, -119, -119, -119, -119,
+     -119,  129, -119, -119, -119, -119, -119, -119, -119, -119,
+     -119, -119, -119, -119, -119, -119, -119, -119, -119, -119,
+     -119, -119, -119, -119, -119, -119, -119, -119, -119, -119,
+     -119, -119, -119,  129, -119, -119, -119, -119, -119, -119,
+     -119, -119, -119, -119, -119, -119, -119, -119, -119, -119,
+     -119, -119, -119, -119, -119, -119, -119, -119
+
+    },
+
+    {
+        5, -120, -120, -120, -120, -120, -120, -120, -120, -120,
+     -120, -120, -120, -120, -120, -120, -120, -120, -120, -120,
+     -120, -120, -120, -120, -120, -120, -120, -120, -120, -120,
+     -120, -120, -120, -120, -120, -120, -120, -120, -120, -120,
+     -120, -120, -120, -120, -120, -120, -120, -120, -120, -120,
+     -120, -120, -120, -120, -120, -120, -120, -120, -120, -120,
+     -120, -120, -120, -120, -120,  130, -120, -120, -120, -120,
+     -120, -120, -120, -120, -120, -120, -120, -120, -120, -120,
+     -120, -120, -120, -120, -120, -120, -120, -120, -120, -120,
+     -120, -120, -120, -120, -120, -120, -120,  130, -120, -120,
+
+     -120, -120, -120, -120, -120, -120, -120, -120, -120, -120,
+     -120, -120, -120, -120, -120, -120, -120, -120, -120, -120,
+     -120, -120, -120, -120, -120, -120, -120, -120
+    },
+
+    {
+        5, -121, -121, -121, -121, -121, -121, -121, -121, -121,
+     -121, -121, -121, -121, -121, -121, -121, -121, -121, -121,
+     -121, -121, -121, -121, -121, -121, -121, -121, -121, -121,
+     -121, -121, -121, -121, -121, -121, -121, -121, -121, -121,
+     -121, -121, -121, -121, -121, -121, -121, -121, -121, -121,
+     -121, -121, -121, -121, -121, -121, -121, -121, -121, -121,
+     -121, -121, -121, -121, -121, -121, -121, -121, -121, -121,
+
+     -121, -121, -121, -121, -121, -121, -121, -121, -121, -121,
+     -121, -121,  131, -121, -121, -121, -121, -121, -121, -121,
+     -121, -121, -121, -121, -121, -121, -121, -121, -121, -121,
+     -121, -121, -121, -121, -121, -121, -121, -121, -121, -121,
+     -121, -121, -121, -121,  131, -121, -121, -121, -121, -121,
+     -121, -121, -121, -121, -121, -121, -121, -121
+    },
+
+    {
+        5, -122, -122, -122, -122, -122, -122, -122, -122, -122,
+     -122, -122, -122, -122, -122, -122, -122, -122, -122, -122,
+     -122, -122, -122, -122, -122, -122, -122, -122, -122, -122,
+     -122, -122, -122, -122, -122, -122, -122, -122, -122, -122,
+
+     -122, -122, -122, -122, -122, -122, -122, -122, -122, -122,
+     -122, -122, -122, -122, -122, -122, -122, -122, -122, -122,
+     -122, -122, -122, -122, -122, -122, -122, -122, -122, -122,
+     -122, -122, -122, -122, -122, -122, -122, -122, -122, -122,
+     -122, -122,  132, -122, -122, -122, -122, -122, -122, -122,
+     -122, -122, -122, -122, -122, -122, -122, -122, -122, -122,
+     -122, -122, -122, -122, -122, -122, -122, -122, -122, -122,
+     -122, -122, -122, -122,  132, -122, -122, -122, -122, -122,
+     -122, -122, -122, -122, -122, -122, -122, -122
+    },
+
+    {
+        5, -123, -123, -123, -123, -123, -123, -123, -123, -123,
+
+     -123, -123, -123, -123, -123, -123, -123, -123, -123, -123,
+     -123, -123, -123, -123, -123, -123, -123, -123, -123, -123,
+     -123, -123, -123, -123, -123, -123, -123, -123, -123, -123,
+     -123, -123, -123, -123, -123, -123, -123, -123, -123, -123,
+     -123, -123, -123, -123, -123, -123, -123, -123, -123, -123,
+     -123, -123, -123, -123, -123, -123, -123, -123, -123, -123,
+     -123, -123, -123, -123, -123, -123, -123, -123, -123,  133,
+     -123, -123, -123, -123, -123, -123, -123, -123, -123, -123,
+     -123, -123, -123, -123, -123, -123, -123, -123, -123, -123,
+     -123, -123, -123, -123, -123, -123, -123, -123, -123, -123,
+
+     -123,  133, -123, -123, -123, -123, -123, -123, -123, -123,
+     -123, -123, -123, -123, -123, -123, -123, -123
+    },
+
+    {
+        5, -124, -124, -124, -124, -124, -124, -124, -124, -124,
+     -124, -124, -124, -124, -124, -124, -124, -124, -124, -124,
+     -124, -124, -124, -124, -124, -124, -124, -124, -124, -124,
+     -124, -124, -124, -124, -124, -124, -124, -124, -124, -124,
+     -124, -124, -124, -124, -124, -124, -124, -124, -124, -124,
+     -124, -124, -124, -124, -124, -124, -124, -124, -124, -124,
+     -124, -124, -124, -124, -124, -124, -124, -124, -124, -124,
+     -124, -124, -124, -124, -124, -124,  134, -124, -124, -124,
+
+     -124, -124, -124, -124, -124, -124, -124, -124, -124, -124,
+     -124, -124, -124, -124, -124, -124, -124, -124, -124, -124,
+     -124, -124, -124, -124, -124, -124, -124, -124,  134, -124,
+     -124, -124, -124, -124, -124, -124, -124, -124, -124, -124,
+     -124, -124, -124, -124, -124, -124, -124, -124
+    },
+
+    {
+        5, -125, -125, -125, -125, -125, -125, -125, -125, -125,
+     -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,
+     -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,
+     -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,
+     -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,
+
+     -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,
+     -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,
+     -125, -125, -125, -125, -125, -125, -125,  135, -125, -125,
+     -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,
+     -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,
+     -125, -125, -125, -125, -125, -125, -125, -125, -125,  135,
+     -125, -125, -125, -125, -125, -125, -125, -125, -125, -125,
+     -125, -125, -125, -125, -125, -125, -125, -125
+    },
+
+    {
+        5, -126, -126, -126, -126, -126, -126, -126, -126, -126,
+     -126, -126, -126, -126, -126, -126, -126, -126, -126, -126,
+
+     -126, -126, -126, -126, -126, -126, -126, -126, -126, -126,
+     -126, -126, -126, -126, -126, -126, -126, -126, -126, -126,
+     -126, -126, -126, -126, -126, -126, -126, -126, -126, -126,
+     -126, -126, -126, -126, -126, -126, -126, -126, -126, -126,
+     -126, -126, -126, -126, -126, -126, -126, -126, -126, -126,
+     -126, -126, -126, -126, -126, -126, -126,  136, -126, -126,
+     -126, -126, -126, -126, -126, -126, -126, -126, -126, -126,
+     -126, -126, -126, -126, -126, -126, -126, -126, -126, -126,
+     -126, -126, -126, -126, -126, -126, -126, -126, -126,  136,
+     -126, -126, -126, -126, -126, -126, -126, -126, -126, -126,
+
+     -126, -126, -126, -126, -126, -126, -126, -126
+    },
+
+    {
+        5, -127, -127, -127, -127, -127, -127, -127, -127, -127,
+     -127, -127, -127, -127, -127, -127, -127, -127, -127, -127,
+     -127, -127, -127, -127, -127, -127, -127, -127, -127, -127,
+     -127, -127, -127, -127, -127, -127, -127, -127, -127, -127,
+     -127, -127, -127, -127, -127, -127, -127, -127, -127, -127,
+     -127, -127, -127, -127, -127, -127, -127, -127, -127, -127,
+     -127, -127, -127, -127, -127, -127, -127, -127, -127, -127,
+     -127, -127, -127, -127, -127, -127, -127, -127, -127, -127,
+     -127, -127, -127, -127,  137, -127, -127, -127, -127, -127,
+
+     -127, -127, -127, -127, -127, -127, -127, -127, -127, -127,
+     -127, -127, -127, -127, -127, -127, -127, -127, -127, -127,
+     -127, -127, -127, -127, -127, -127,  137, -127, -127, -127,
+     -127, -127, -127, -127, -127, -127, -127, -127
+    },
+
+    {
+        5, -128, -128, -128, -128, -128, -128, -128, -128, -128,
+     -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
+     -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
+     -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
+     -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
+     -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
+
+     -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
+     -128, -128, -128, -128, -128, -128, -128,  138, -128, -128,
+     -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
+     -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
+     -128, -128, -128, -128, -128, -128, -128, -128, -128,  138,
+     -128, -128, -128, -128, -128, -128, -128, -128, -128, -128,
+     -128, -128, -128, -128, -128, -128, -128, -128
+    },
+
+    {
+        5, -129, -129, -129, -129, -129, -129, -129, -129, -129,
+     -129, -129, -129, -129, -129, -129, -129, -129, -129, -129,
+     -129, -129, -129, -129, -129, -129, -129, -129, -129, -129,
+
+     -129, -129, -129, -129, -129, -129, -129, -129, -129, -129,
+     -129, -129, -129, -129, -129, -129, -129, -129, -129, -129,
+     -129, -129, -129, -129, -129, -129, -129, -129, -129, -129,
+     -129, -129, -129, -129, -129, -129, -129, -129, -129, -129,
+     -129, -129, -129, -129, -129, -129, -129, -129, -129,  139,
+     -129, -129, -129, -129, -129, -129, -129, -129, -129, -129,
+     -129, -129, -129, -129, -129, -129, -129, -129, -129, -129,
+     -129, -129, -129, -129, -129, -129, -129, -129, -129, -129,
+     -129,  139, -129, -129, -129, -129, -129, -129, -129, -129,
+     -129, -129, -129, -129, -129, -129, -129, -129
+
+    },
+
+    {
+        5, -130, -130, -130, -130, -130, -130, -130, -130, -130,
+     -130, -130, -130, -130, -130, -130, -130, -130, -130, -130,
+     -130, -130, -130, -130, -130, -130, -130, -130, -130, -130,
+     -130, -130, -130, -130, -130, -130, -130, -130, -130, -130,
+     -130, -130, -130, -130, -130, -130, -130, -130, -130, -130,
+     -130, -130, -130, -130, -130, -130, -130, -130, -130, -130,
+     -130, -130, -130, -130, -130, -130, -130,  140, -130, -130,
+     -130, -130, -130, -130, -130, -130, -130, -130, -130, -130,
+     -130, -130, -130, -130, -130, -130, -130, -130, -130, -130,
+     -130, -130, -130, -130, -130, -130, -130, -130, -130,  140,
+
+     -130, -130, -130, -130, -130, -130, -130, -130, -130, -130,
+     -130, -130, -130, -130, -130, -130, -130, -130, -130, -130,
+     -130, -130, -130, -130, -130, -130, -130, -130
+    },
+
+    {
+        5, -131, -131, -131, -131, -131, -131, -131, -131, -131,
+     -131, -131, -131, -131, -131, -131, -131, -131, -131, -131,
+     -131, -131, -131, -131, -131, -131, -131, -131, -131, -131,
+     -131, -131, -131, -131, -131, -131, -131, -131, -131, -131,
+     -131, -131, -131, -131, -131, -131, -131, -131, -131, -131,
+     -131, -131, -131, -131, -131, -131, -131, -131, -131, -131,
+     -131, -131, -131, -131, -131, -131, -131, -131, -131, -131,
+
+     -131, -131, -131,  141, -131, -131, -131, -131, -131, -131,
+     -131, -131, -131, -131, -131, -131, -131, -131, -131, -131,
+     -131, -131, -131, -131, -131, -131, -131, -131, -131, -131,
+     -131, -131, -131, -131, -131,  141, -131, -131, -131, -131,
+     -131, -131, -131, -131, -131, -131, -131, -131, -131, -131,
+     -131, -131, -131, -131, -131, -131, -131, -131
+    },
+
+    {
+        5, -132, -132, -132, -132, -132, -132, -132, -132, -132,
+     -132, -132, -132, -132, -132, -132, -132, -132, -132, -132,
+     -132, -132, -132, -132, -132, -132, -132, -132, -132, -132,
+     -132, -132, -132, -132, -132, -132, -132, -132, -132, -132,
+
+     -132, -132, -132, -132, -132, -132, -132, -132, -132, -132,
+     -132, -132, -132, -132, -132, -132, -132, -132, -132, -132,
+     -132, -132, -132, -132, -132, -132, -132, -132, -132, -132,
+     -132, -132, -132, -132, -132, -132, -132, -132, -132, -132,
+     -132, -132, -132, -132, -132, -132,  142, -132, -132, -132,
+     -132, -132, -132, -132, -132, -132, -132, -132, -132, -132,
+     -132, -132, -132, -132, -132, -132, -132, -132, -132, -132,
+     -132, -132, -132, -132, -132, -132, -132, -132,  142, -132,
+     -132, -132, -132, -132, -132, -132, -132, -132
+    },
+
+    {
+        5, -133, -133, -133, -133, -133, -133, -133, -133, -133,
+
+     -133, -133, -133, -133, -133, -133, -133, -133, -133, -133,
+     -133, -133, -133, -133, -133, -133, -133, -133, -133, -133,
+     -133, -133, -133, -133, -133, -133, -133, -133, -133, -133,
+     -133, -133, -133, -133, -133, -133, -133, -133, -133, -133,
+     -133, -133, -133, -133, -133, -133, -133, -133, -133, -133,
+     -133, -133, -133, -133, -133, -133, -133, -133, -133, -133,
+     -133, -133, -133, -133, -133, -133, -133, -133,  143, -133,
+     -133, -133, -133, -133, -133, -133, -133, -133, -133, -133,
+     -133, -133, -133, -133, -133, -133, -133, -133, -133, -133,
+     -133, -133, -133, -133, -133, -133, -133, -133, -133, -133,
+
+      143, -133, -133, -133, -133, -133, -133, -133, -133, -133,
+     -133, -133, -133, -133, -133, -133, -133, -133
+    },
+
+    {
+        5, -134, -134, -134, -134, -134, -134, -134, -134, -134,
+     -134, -134, -134, -134, -134, -134, -134, -134, -134, -134,
+     -134, -134, -134, -134, -134, -134, -134, -134, -134, -134,
+     -134, -134, -134, -134, -134, -134, -134, -134, -134, -134,
+     -134, -134, -134, -134, -134, -134, -134, -134, -134, -134,
+     -134, -134, -134, -134, -134, -134, -134, -134, -134, -134,
+     -134, -134, -134, -134, -134, -134, -134, -134, -134, -134,
+     -134, -134, -134, -134, -134, -134,  144, -134, -134, -134,
+
+     -134, -134, -134, -134, -134, -134, -134, -134, -134, -134,
+     -134, -134, -134, -134, -134, -134, -134, -134, -134, -134,
+     -134, -134, -134, -134, -134, -134, -134, -134,  144, -134,
+     -134, -134, -134, -134, -134, -134, -134, -134, -134, -134,
+     -134, -134, -134, -134, -134, -134, -134, -134
+    },
+
+    {
+        5, -135, -135, -135, -135, -135, -135, -135, -135, -135,
+     -135, -135, -135, -135, -135, -135, -135, -135, -135, -135,
+     -135, -135, -135, -135, -135, -135, -135, -135, -135, -135,
+     -135, -135, -135, -135, -135, -135, -135, -135, -135, -135,
+     -135, -135, -135, -135, -135, -135, -135, -135, -135, -135,
+
+     -135, -135, -135, -135, -135, -135, -135, -135, -135, -135,
+     -135, -135, -135, -135, -135, -135, -135, -135, -135, -135,
+     -135, -135, -135, -135, -135, -135, -135, -135, -135, -135,
+     -135, -135, -135, -135, -135, -135, -135, -135, -135, -135,
+     -135, -135, -135, -135, -135, -135, -135, -135, -135, -135,
+     -135, -135, -135, -135, -135, -135, -135, -135, -135, -135,
+     -135, -135, -135, -135, -135, -135, -135, -135, -135, -135,
+     -135, -135, -135, -135, -135, -135, -135, -135
+    },
+
+    {
+        5, -136, -136, -136, -136, -136, -136, -136, -136, -136,
+     -136, -136, -136, -136, -136, -136, -136, -136, -136, -136,
+
+     -136, -136, -136, -136, -136, -136, -136, -136, -136, -136,
+     -136, -136, -136, -136, -136, -136, -136, -136, -136, -136,
+     -136, -136, -136, -136, -136, -136, -136, -136, -136, -136,
+     -136, -136, -136, -136, -136, -136, -136, -136, -136, -136,
+     -136, -136, -136, -136, -136, -136, -136, -136, -136, -136,
+     -136, -136, -136, -136, -136, -136, -136, -136, -136, -136,
+     -136, -136, -136, -136, -136, -136, -136, -136, -136, -136,
+     -136, -136, -136, -136, -136, -136, -136, -136, -136, -136,
+     -136, -136, -136, -136, -136, -136, -136, -136, -136, -136,
+     -136, -136, -136, -136, -136, -136, -136, -136, -136, -136,
+
+     -136, -136, -136, -136, -136, -136, -136, -136
+    },
+
+    {
+        5, -137, -137, -137, -137, -137, -137, -137, -137, -137,
+     -137, -137, -137, -137, -137, -137, -137, -137, -137, -137,
+     -137, -137, -137, -137, -137, -137, -137, -137, -137, -137,
+     -137, -137, -137, -137, -137, -137, -137, -137, -137, -137,
+     -137, -137, -137, -137, -137, -137, -137, -137, -137, -137,
+     -137, -137, -137, -137, -137, -137, -137, -137, -137, -137,
+     -137, -137, -137, -137, -137, -137, -137, -137, -137, -137,
+     -137, -137, -137, -137, -137, -137, -137, -137, -137, -137,
+     -137, -137,  145, -137, -137, -137, -137, -137, -137, -137,
+
+     -137, -137, -137, -137, -137, -137, -137, -137, -137, -137,
+     -137, -137, -137, -137, -137, -137, -137, -137, -137, -137,
+     -137, -137, -137, -137,  145, -137, -137, -137, -137, -137,
+     -137, -137, -137, -137, -137, -137, -137, -137
+    },
+
+    {
+        5, -138, -138, -138, -138, -138, -138, -138, -138, -138,
+     -138, -138, -138, -138, -138, -138, -138, -138, -138, -138,
+     -138, -138, -138, -138, -138, -138, -138, -138, -138, -138,
+     -138, -138, -138, -138, -138, -138, -138, -138, -138, -138,
+     -138, -138, -138, -138, -138, -138, -138, -138, -138, -138,
+     -138, -138, -138, -138, -138, -138, -138, -138, -138, -138,
+
+     -138, -138, -138, -138, -138, -138, -138, -138, -138, -138,
+     -138, -138, -138, -138, -138, -138, -138, -138, -138, -138,
+     -138, -138, -138, -138, -138, -138, -138, -138, -138, -138,
+     -138, -138, -138, -138, -138, -138, -138, -138, -138, -138,
+     -138, -138, -138, -138, -138, -138, -138, -138, -138, -138,
+     -138, -138, -138, -138, -138, -138, -138, -138, -138, -138,
+     -138, -138, -138, -138, -138, -138, -138, -138
+    },
+
+    {
+        5, -139, -139, -139, -139, -139, -139, -139, -139, -139,
+     -139, -139, -139, -139, -139, -139, -139, -139, -139, -139,
+     -139, -139, -139, -139, -139, -139, -139, -139, -139, -139,
+
+     -139, -139, -139, -139, -139, -139, -139, -139, -139, -139,
+     -139, -139, -139, -139, -139, -139, -139, -139, -139, -139,
+     -139, -139, -139, -139, -139, -139, -139, -139, -139, -139,
+     -139, -139, -139, -139, -139, -139, -139, -139, -139, -139,
+     -139, -139, -139, -139, -139, -139, -139, -139,  146, -139,
+     -139, -139, -139, -139, -139, -139, -139, -139, -139, -139,
+     -139, -139, -139, -139, -139, -139, -139, -139, -139, -139,
+     -139, -139, -139, -139, -139, -139, -139, -139, -139, -139,
+      146, -139, -139, -139, -139, -139, -139, -139, -139, -139,
+     -139, -139, -139, -139, -139, -139, -139, -139
+
+    },
+
+    {
+        5, -140, -140, -140, -140, -140, -140, -140, -140, -140,
+     -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,
+     -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,
+     -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,
+     -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,
+     -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,
+     -140, -140, -140, -140, -140, -140, -140, -140, -140,  147,
+     -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,
+     -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,
+     -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,
+
+     -140,  147, -140, -140, -140, -140, -140, -140, -140, -140,
+     -140, -140, -140, -140, -140, -140, -140, -140, -140, -140,
+     -140, -140, -140, -140, -140, -140, -140, -140
+    },
+
+    {
+        5, -141, -141, -141, -141, -141, -141, -141, -141, -141,
+     -141, -141, -141, -141, -141, -141, -141, -141, -141, -141,
+     -141, -141, -141, -141, -141, -141, -141, -141, -141, -141,
+     -141, -141, -141, -141, -141, -141, -141, -141, -141, -141,
+     -141, -141, -141, -141, -141, -141, -141, -141, -141, -141,
+     -141, -141, -141, -141, -141, -141, -141, -141, -141, -141,
+     -141, -141, -141, -141, -141, -141, -141, -141, -141, -141,
+
+     -141, -141, -141, -141, -141, -141, -141, -141,  148, -141,
+     -141, -141, -141, -141, -141, -141, -141, -141, -141, -141,
+     -141, -141, -141, -141, -141, -141, -141, -141, -141, -141,
+     -141, -141, -141, -141, -141, -141, -141, -141, -141, -141,
+      148, -141, -141, -141, -141, -141, -141, -141, -141, -141,
+     -141, -141, -141, -141, -141, -141, -141, -141
+    },
+
+    {
+        5, -142, -142, -142, -142, -142, -142, -142, -142, -142,
+     -142, -142, -142, -142, -142, -142, -142, -142, -142, -142,
+     -142, -142, -142, -142, -142, -142, -142, -142, -142, -142,
+     -142, -142, -142, -142, -142, -142, -142, -142, -142, -142,
+
+     -142, -142, -142, -142, -142, -142, -142, -142, -142, -142,
+     -142, -142, -142, -142, -142, -142, -142, -142, -142, -142,
+     -142, -142, -142, -142, -142, -142, -142, -142, -142,  149,
+     -142, -142, -142, -142, -142, -142, -142, -142, -142, -142,
+     -142, -142, -142, -142, -142, -142, -142, -142, -142, -142,
+     -142, -142, -142, -142, -142, -142, -142, -142, -142, -142,
+     -142,  149, -142, -142, -142, -142, -142, -142, -142, -142,
+     -142, -142, -142, -142, -142, -142, -142, -142, -142, -142,
+     -142, -142, -142, -142, -142, -142, -142, -142
+    },
+
+    {
+        5, -143, -143, -143, -143, -143, -143, -143, -143, -143,
+
+     -143, -143, -143, -143, -143, -143, -143, -143, -143, -143,
+     -143, -143, -143, -143, -143, -143, -143, -143, -143, -143,
+     -143, -143, -143, -143, -143, -143, -143, -143, -143, -143,
+     -143, -143, -143, -143, -143, -143, -143, -143, -143, -143,
+     -143, -143, -143, -143, -143, -143, -143, -143, -143, -143,
+     -143, -143, -143, -143, -143, -143, -143, -143, -143, -143,
+     -143, -143, -143, -143, -143, -143, -143,  150, -143, -143,
+     -143, -143, -143, -143, -143, -143, -143, -143, -143, -143,
+     -143, -143, -143, -143, -143, -143, -143, -143, -143, -143,
+     -143, -143, -143, -143, -143, -143, -143, -143, -143,  150,
+
+     -143, -143, -143, -143, -143, -143, -143, -143, -143, -143,
+     -143, -143, -143, -143, -143, -143, -143, -143
+    },
+
+    {
+        5, -144, -144, -144, -144, -144, -144, -144, -144, -144,
+     -144, -144, -144, -144, -144, -144, -144, -144, -144, -144,
+     -144, -144, -144, -144, -144, -144, -144, -144, -144, -144,
+     -144, -144, -144, -144, -144, -144, -144, -144, -144, -144,
+     -144, -144, -144, -144, -144, -144, -144, -144, -144, -144,
+     -144, -144, -144, -144, -144, -144, -144, -144, -144, -144,
+     -144, -144, -144, -144, -144, -144, -144, -144, -144,  151,
+     -144, -144, -144, -144, -144, -144, -144, -144, -144, -144,
+
+     -144, -144, -144, -144, -144, -144, -144, -144, -144, -144,
+     -144, -144, -144, -144, -144, -144, -144, -144, -144, -144,
+     -144,  151, -144, -144, -144, -144, -144, -144, -144, -144,
+     -144, -144, -144, -144, -144, -144, -144, -144, -144, -144,
+     -144, -144, -144, -144, -144, -144, -144, -144
+    },
+
+    {
+        5, -145, -145, -145, -145, -145, -145, -145, -145, -145,
+     -145, -145, -145, -145, -145, -145, -145, -145, -145, -145,
+     -145, -145, -145, -145, -145, -145, -145, -145, -145, -145,
+     -145, -145, -145, -145, -145, -145, -145, -145, -145, -145,
+     -145, -145, -145, -145, -145, -145, -145, -145, -145, -145,
+
+     -145, -145, -145, -145, -145, -145, -145, -145, -145, -145,
+     -145, -145, -145, -145, -145, -145, -145, -145, -145, -145,
+     -145, -145, -145,  152, -145, -145, -145, -145, -145, -145,
+     -145, -145, -145, -145, -145, -145, -145, -145, -145, -145,
+     -145, -145, -145, -145, -145, -145, -145, -145, -145, -145,
+     -145, -145, -145, -145, -145,  152, -145, -145, -145, -145,
+     -145, -145, -145, -145, -145, -145, -145, -145, -145, -145,
+     -145, -145, -145, -145, -145, -145, -145, -145
+    },
+
+    {
+        5, -146, -146, -146, -146, -146, -146, -146, -146, -146,
+     -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,
+
+     -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,
+     -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,
+     -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,
+     -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,
+     -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,
+     -146, -146, -146, -146, -146, -146, -146,  153, -146, -146,
+     -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,
+     -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,
+     -146, -146, -146, -146, -146, -146, -146, -146, -146,  153,
+     -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,
+
+     -146, -146, -146, -146, -146, -146, -146, -146
+    },
+
+    {
+        5, -147, -147, -147, -147, -147, -147, -147, -147, -147,
+     -147, -147, -147, -147, -147, -147, -147, -147, -147, -147,
+     -147, -147, -147, -147, -147, -147, -147, -147, -147, -147,
+     -147, -147, -147, -147, -147, -147, -147, -147, -147, -147,
+     -147, -147, -147, -147, -147, -147, -147, -147, -147, -147,
+     -147, -147, -147, -147, -147, -147, -147, -147, -147, -147,
+     -147, -147, -147, -147, -147, -147, -147, -147, -147, -147,
+     -147, -147, -147, -147, -147, -147, -147,  154, -147, -147,
+     -147, -147, -147, -147, -147, -147, -147, -147, -147, -147,
+
+     -147, -147, -147, -147, -147, -147, -147, -147, -147, -147,
+     -147, -147, -147, -147, -147, -147, -147, -147, -147,  154,
+     -147, -147, -147, -147, -147, -147, -147, -147, -147, -147,
+     -147, -147, -147, -147, -147, -147, -147, -147
+    },
+
+    {
+        5, -148, -148, -148, -148, -148, -148, -148, -148, -148,
+     -148, -148, -148, -148, -148, -148, -148, -148, -148, -148,
+     -148, -148, -148, -148, -148, -148, -148, -148, -148, -148,
+     -148, -148, -148, -148, -148, -148, -148, -148, -148, -148,
+     -148, -148, -148, -148, -148, -148, -148, -148, -148, -148,
+     -148, -148, -148, -148, -148, -148, -148, -148, -148, -148,
+
+     -148, -148, -148, -148, -148, -148, -148, -148, -148, -148,
+     -148,  155, -148, -148, -148, -148, -148, -148, -148, -148,
+     -148, -148, -148, -148, -148, -148, -148, -148, -148, -148,
+     -148, -148, -148, -148, -148, -148, -148, -148, -148, -148,
+     -148, -148, -148,  155, -148, -148, -148, -148, -148, -148,
+     -148, -148, -148, -148, -148, -148, -148, -148, -148, -148,
+     -148, -148, -148, -148, -148, -148, -148, -148
+    },
+
+    {
+        5, -149, -149, -149, -149, -149, -149, -149, -149, -149,
+     -149, -149, -149, -149, -149, -149, -149, -149, -149, -149,
+     -149, -149, -149, -149, -149, -149, -149, -149, -149, -149,
+
+     -149, -149, -149, -149, -149, -149, -149, -149, -149, -149,
+     -149, -149, -149, -149, -149, -149, -149, -149, -149, -149,
+     -149, -149, -149, -149, -149, -149, -149, -149, -149, -149,
+     -149, -149, -149, -149, -149, -149, -149, -149, -149, -149,
+     -149, -149, -149, -149, -149, -149, -149,  156, -149, -149,
+     -149, -149, -149, -149, -149, -149, -149, -149, -149, -149,
+     -149, -149, -149, -149, -149, -149, -149, -149, -149, -149,
+     -149, -149, -149, -149, -149, -149, -149, -149, -149,  156,
+     -149, -149, -149, -149, -149, -149, -149, -149, -149, -149,
+     -149, -149, -149, -149, -149, -149, -149, -149
+
+    },
+
+    {
+        5, -150, -150, -150, -150, -150, -150, -150, -150, -150,
+     -150, -150, -150, -150, -150, -150, -150, -150, -150, -150,
+     -150, -150, -150, -150, -150, -150, -150, -150, -150, -150,
+     -150, -150, -150, -150, -150, -150, -150, -150, -150, -150,
+     -150, -150, -150, -150, -150, -150, -150, -150, -150, -150,
+     -150, -150, -150, -150, -150, -150, -150, -150, -150, -150,
+     -150, -150, -150, -150, -150, -150, -150, -150, -150, -150,
+     -150, -150, -150, -150, -150, -150, -150, -150, -150, -150,
+     -150, -150, -150, -150, -150, -150, -150, -150, -150, -150,
+     -150, -150, -150, -150, -150, -150, -150, -150, -150, -150,
+
+     -150, -150, -150, -150, -150, -150, -150, -150, -150, -150,
+     -150, -150, -150, -150, -150, -150, -150, -150, -150, -150,
+     -150, -150, -150, -150, -150, -150, -150, -150
+    },
+
+    {
+        5, -151, -151, -151, -151, -151, -151, -151, -151, -151,
+     -151, -151, -151, -151, -151, -151, -151, -151, -151, -151,
+     -151, -151, -151, -151, -151, -151, -151, -151, -151, -151,
+     -151, -151, -151, -151, -151, -151, -151, -151, -151, -151,
+     -151, -151, -151, -151, -151, -151, -151, -151, -151, -151,
+     -151, -151, -151, -151, -151, -151, -151, -151, -151, -151,
+     -151, -151, -151, -151, -151, -151, -151,  157, -151, -151,
+
+     -151, -151, -151, -151, -151, -151, -151, -151, -151, -151,
+     -151, -151, -151, -151, -151, -151, -151, -151, -151, -151,
+     -151, -151, -151, -151, -151, -151, -151, -151, -151,  157,
+     -151, -151, -151, -151, -151, -151, -151, -151, -151, -151,
+     -151, -151, -151, -151, -151, -151, -151, -151, -151, -151,
+     -151, -151, -151, -151, -151, -151, -151, -151
+    },
+
+    {
+        5, -152, -152, -152, -152, -152, -152, -152, -152, -152,
+     -152, -152, -152, -152, -152, -152, -152, -152, -152, -152,
+     -152, -152, -152, -152, -152, -152, -152, -152, -152, -152,
+     -152, -152, -152, -152, -152, -152, -152, -152, -152, -152,
+
+     -152, -152, -152, -152, -152, -152, -152, -152, -152, -152,
+     -152, -152, -152, -152, -152, -152, -152, -152, -152, -152,
+     -152, -152, -152, -152, -152, -152, -152, -152, -152, -152,
+     -152, -152, -152, -152, -152, -152, -152, -152,  158, -152,
+     -152, -152, -152, -152, -152, -152, -152, -152, -152, -152,
+     -152, -152, -152, -152, -152, -152, -152, -152, -152, -152,
+     -152, -152, -152, -152, -152, -152, -152, -152, -152, -152,
+      158, -152, -152, -152, -152, -152, -152, -152, -152, -152,
+     -152, -152, -152, -152, -152, -152, -152, -152
+    },
+
+    {
+        5, -153, -153, -153, -153, -153, -153, -153, -153, -153,
+
+     -153, -153, -153, -153, -153, -153, -153, -153, -153, -153,
+     -153, -153, -153, -153, -153, -153, -153, -153, -153, -153,
+     -153, -153, -153, -153, -153, -153, -153, -153, -153, -153,
+     -153, -153, -153, -153, -153, -153, -153, -153, -153, -153,
+     -153, -153, -153, -153, -153, -153, -153, -153, -153, -153,
+     -153, -153, -153, -153, -153, -153, -153, -153, -153, -153,
+     -153, -153, -153, -153, -153, -153, -153, -153, -153, -153,
+     -153, -153, -153, -153, -153, -153, -153, -153, -153, -153,
+     -153, -153, -153, -153, -153, -153, -153, -153, -153, -153,
+     -153, -153, -153, -153, -153, -153, -153, -153, -153, -153,
+
+     -153, -153, -153, -153, -153, -153, -153, -153, -153, -153,
+     -153, -153, -153, -153, -153, -153, -153, -153
+    },
+
+    {
+        5, -154, -154, -154, -154, -154, -154, -154, -154, -154,
+     -154, -154, -154, -154, -154, -154, -154, -154, -154, -154,
+     -154, -154, -154, -154, -154, -154, -154, -154, -154, -154,
+     -154, -154, -154, -154, -154, -154, -154, -154, -154, -154,
+     -154, -154, -154, -154, -154, -154, -154, -154, -154, -154,
+     -154, -154, -154, -154, -154, -154, -154, -154, -154, -154,
+     -154, -154, -154, -154, -154, -154, -154, -154, -154, -154,
+     -154, -154, -154, -154, -154, -154, -154, -154, -154, -154,
+
+     -154, -154, -154, -154, -154, -154, -154, -154, -154, -154,
+     -154, -154, -154, -154, -154, -154, -154, -154, -154, -154,
+     -154, -154, -154, -154, -154, -154, -154, -154, -154, -154,
+     -154, -154, -154, -154, -154, -154, -154, -154, -154, -154,
+     -154, -154, -154, -154, -154, -154, -154, -154
+    },
+
+    {
+        5, -155, -155, -155, -155, -155, -155, -155, -155, -155,
+     -155, -155, -155, -155, -155, -155, -155, -155, -155, -155,
+     -155, -155, -155, -155, -155, -155, -155, -155, -155, -155,
+     -155, -155, -155, -155, -155, -155, -155, -155, -155, -155,
+     -155, -155, -155, -155, -155, -155, -155, -155, -155, -155,
+
+     -155, -155, -155, -155, -155, -155, -155, -155, -155, -155,
+     -155, -155, -155, -155, -155, -155, -155, -155, -155, -155,
+     -155, -155, -155, -155, -155, -155, -155,  159, -155, -155,
+     -155, -155, -155, -155, -155, -155, -155, -155, -155, -155,
+     -155, -155, -155, -155, -155, -155, -155, -155, -155, -155,
+     -155, -155, -155, -155, -155, -155, -155, -155, -155,  159,
+     -155, -155, -155, -155, -155, -155, -155, -155, -155, -155,
+     -155, -155, -155, -155, -155, -155, -155, -155
+    },
+
+    {
+        5, -156, -156, -156, -156, -156, -156, -156, -156, -156,
+     -156, -156, -156, -156, -156, -156, -156, -156, -156, -156,
+
+     -156, -156, -156, -156, -156, -156, -156, -156, -156, -156,
+     -156, -156, -156, -156, -156, -156, -156, -156, -156, -156,
+     -156, -156, -156, -156, -156, -156, -156, -156, -156, -156,
+     -156, -156, -156, -156, -156, -156, -156, -156, -156, -156,
+     -156, -156, -156, -156, -156, -156, -156, -156, -156, -156,
+     -156, -156, -156, -156, -156, -156, -156, -156, -156, -156,
+     -156, -156, -156, -156, -156, -156, -156, -156, -156, -156,
+     -156, -156, -156, -156, -156, -156, -156, -156, -156, -156,
+     -156, -156, -156, -156, -156, -156, -156, -156, -156, -156,
+     -156, -156, -156, -156, -156, -156, -156, -156, -156, -156,
+
+     -156, -156, -156, -156, -156, -156, -156, -156
+    },
+
+    {
+        5, -157, -157, -157, -157, -157, -157, -157, -157, -157,
+     -157, -157, -157, -157, -157, -157, -157, -157, -157, -157,
+     -157, -157, -157, -157, -157, -157, -157, -157, -157, -157,
+     -157, -157, -157, -157, -157, -157, -157, -157, -157, -157,
+     -157, -157, -157, -157, -157, -157, -157, -157, -157, -157,
+     -157, -157, -157, -157, -157, -157, -157, -157, -157, -157,
+     -157, -157, -157, -157, -157, -157, -157, -157, -157, -157,
+     -157, -157, -157, -157, -157, -157, -157, -157, -157, -157,
+     -157, -157, -157, -157,  160, -157, -157, -157, -157, -157,
+
+     -157, -157, -157, -157, -157, -157, -157, -157, -157, -157,
+     -157, -157, -157, -157, -157, -157, -157, -157, -157, -157,
+     -157, -157, -157, -157, -157, -157,  160, -157, -157, -157,
+     -157, -157, -157, -157, -157, -157, -157, -157
+    },
+
+    {
+        5, -158, -158, -158, -158, -158, -158, -158, -158, -158,
+     -158, -158, -158, -158, -158, -158, -158, -158, -158, -158,
+     -158, -158, -158, -158, -158, -158, -158, -158, -158, -158,
+     -158, -158, -158, -158, -158, -158, -158, -158, -158, -158,
+     -158, -158, -158, -158, -158, -158, -158, -158, -158, -158,
+     -158, -158, -158, -158, -158, -158, -158, -158, -158, -158,
+
+     -158, -158, -158, -158, -158, -158, -158, -158, -158, -158,
+     -158,  161, -158, -158, -158, -158, -158, -158, -158, -158,
+     -158, -158, -158, -158, -158, -158, -158, -158, -158, -158,
+     -158, -158, -158, -158, -158, -158, -158, -158, -158, -158,
+     -158, -158, -158,  161, -158, -158, -158, -158, -158, -158,
+     -158, -158, -158, -158, -158, -158, -158, -158, -158, -158,
+     -158, -158, -158, -158, -158, -158, -158, -158
+    },
+
+    {
+        5, -159, -159, -159, -159, -159, -159, -159, -159, -159,
+     -159, -159, -159, -159, -159, -159, -159, -159, -159, -159,
+     -159, -159, -159, -159, -159, -159, -159, -159, -159, -159,
+
+     -159, -159, -159, -159, -159, -159, -159, -159, -159, -159,
+     -159, -159, -159, -159, -159, -159, -159, -159, -159, -159,
+     -159, -159, -159, -159, -159, -159, -159, -159, -159, -159,
+     -159, -159, -159, -159, -159, -159, -159, -159, -159, -159,
+     -159, -159, -159, -159, -159, -159, -159, -159, -159, -159,
+     -159, -159, -159, -159, -159, -159, -159, -159, -159, -159,
+     -159, -159, -159, -159, -159, -159, -159, -159, -159, -159,
+     -159, -159, -159, -159, -159, -159, -159, -159, -159, -159,
+     -159, -159, -159, -159, -159, -159, -159, -159, -159, -159,
+     -159, -159, -159, -159, -159, -159, -159, -159
+
+    },
+
+    {
+        5, -160, -160, -160, -160, -160, -160, -160, -160, -160,
+     -160, -160, -160, -160, -160, -160, -160, -160, -160, -160,
+     -160, -160, -160, -160, -160, -160, -160, -160, -160, -160,
+     -160, -160, -160, -160, -160, -160, -160, -160, -160, -160,
+     -160, -160, -160, -160, -160, -160, -160, -160, -160, -160,
+     -160, -160, -160, -160, -160, -160, -160, -160, -160, -160,
+     -160, -160, -160, -160, -160, -160, -160, -160, -160, -160,
+     -160, -160, -160,  162, -160, -160, -160, -160, -160, -160,
+     -160, -160, -160, -160, -160, -160, -160, -160, -160, -160,
+     -160, -160, -160, -160, -160, -160, -160, -160, -160, -160,
+
+     -160, -160, -160, -160, -160,  162, -160, -160, -160, -160,
+     -160, -160, -160, -160, -160, -160, -160, -160, -160, -160,
+     -160, -160, -160, -160, -160, -160, -160, -160
+    },
+
+    {
+        5, -161, -161, -161, -161, -161, -161, -161, -161, -161,
+     -161, -161, -161, -161, -161, -161, -161, -161, -161, -161,
+     -161, -161, -161, -161, -161, -161, -161, -161, -161, -161,
+     -161, -161, -161, -161, -161, -161, -161, -161, -161, -161,
+     -161, -161, -161, -161, -161, -161, -161, -161, -161, -161,
+     -161, -161, -161, -161, -161, -161, -161, -161, -161, -161,
+     -161, -161, -161, -161, -161, -161, -161, -161, -161, -161,
+
+     -161, -161, -161, -161, -161, -161, -161,  163, -161, -161,
+     -161, -161, -161, -161, -161, -161, -161, -161, -161, -161,
+     -161, -161, -161, -161, -161, -161, -161, -161, -161, -161,
+     -161, -161, -161, -161, -161, -161, -161, -161, -161,  163,
+     -161, -161, -161, -161, -161, -161, -161, -161, -161, -161,
+     -161, -161, -161, -161, -161, -161, -161, -161
+    },
+
+    {
+        5, -162, -162, -162, -162, -162, -162, -162, -162, -162,
+     -162, -162, -162, -162, -162, -162, -162, -162, -162, -162,
+     -162, -162, -162, -162, -162, -162, -162, -162, -162, -162,
+     -162, -162, -162, -162, -162, -162, -162, -162, -162, -162,
+
+     -162, -162, -162, -162, -162, -162, -162, -162, -162, -162,
+     -162, -162, -162, -162, -162, -162, -162, -162, -162, -162,
+     -162, -162, -162, -162, -162, -162, -162, -162, -162, -162,
+     -162, -162, -162, -162, -162, -162, -162, -162, -162,  164,
+     -162, -162, -162, -162, -162, -162, -162, -162, -162, -162,
+     -162, -162, -162, -162, -162, -162, -162, -162, -162, -162,
+     -162, -162, -162, -162, -162, -162, -162, -162, -162, -162,
+     -162,  164, -162, -162, -162, -162, -162, -162, -162, -162,
+     -162, -162, -162, -162, -162, -162, -162, -162
+    },
+
+    {
+        5, -163, -163, -163, -163, -163, -163, -163, -163, -163,
+
+     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,
+     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,
+     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,
+     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,
+     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,
+     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,
+     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,
+     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,
+     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,
+     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,
+
+     -163, -163, -163, -163, -163, -163, -163, -163, -163, -163,
+     -163, -163, -163, -163, -163, -163, -163, -163
+    },
+
+    {
+        5, -164, -164, -164, -164, -164, -164, -164, -164, -164,
+     -164, -164, -164, -164, -164, -164, -164, -164, -164, -164,
+     -164, -164, -164, -164, -164, -164, -164, -164, -164, -164,
+     -164, -164, -164, -164, -164, -164, -164, -164, -164, -164,
+     -164, -164, -164, -164, -164, -164, -164, -164, -164, -164,
+     -164, -164, -164, -164, -164, -164, -164, -164, -164, -164,
+     -164, -164, -164, -164, -164, -164, -164, -164, -164, -164,
+     -164, -164, -164, -164, -164, -164, -164, -164,  165, -164,
+
+     -164, -164, -164, -164, -164, -164, -164, -164, -164, -164,
+     -164, -164, -164, -164, -164, -164, -164, -164, -164, -164,
+     -164, -164, -164, -164, -164, -164, -164, -164, -164, -164,
+      165, -164, -164, -164, -164, -164, -164, -164, -164, -164,
+     -164, -164, -164, -164, -164, -164, -164, -164
+    },
+
+    {
+        5, -165, -165, -165, -165, -165, -165, -165, -165, -165,
+     -165, -165, -165, -165, -165, -165, -165, -165, -165, -165,
+     -165, -165, -165, -165, -165, -165, -165, -165, -165, -165,
+     -165, -165, -165, -165, -165, -165, -165, -165, -165, -165,
+     -165, -165, -165, -165, -165, -165, -165, -165, -165, -165,
+
+     -165, -165, -165, -165, -165, -165, -165, -165, -165, -165,
+     -165, -165, -165, -165, -165, -165, -165, -165, -165, -165,
+     -165, -165, -165, -165, -165, -165, -165,  166, -165, -165,
+     -165, -165, -165, -165, -165, -165, -165, -165, -165, -165,
+     -165, -165, -165, -165, -165, -165, -165, -165, -165, -165,
+     -165, -165, -165, -165, -165, -165, -165, -165, -165,  166,
+     -165, -165, -165, -165, -165, -165, -165, -165, -165, -165,
+     -165, -165, -165, -165, -165, -165, -165, -165
+    },
+
+    {
+        5, -166, -166, -166, -166, -166, -166, -166, -166, -166,
+     -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,
+
+     -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,
+     -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,
+     -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,
+     -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,
+     -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,
+     -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,
+     -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,
+     -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,
+     -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,
+     -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,
+
+     -166, -166, -166, -166, -166, -166, -166, -166
+    },
+
     } ;
 
 
@@ -2267,29 +3194,34 @@ static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
        *yy_cp = '\0'; \
        yy_c_buf_p = yy_cp;
 
-#define YY_NUM_RULES 28
-#define YY_END_OF_BUFFER 29
-static yyconst short int yy_accept[113] =
+#define YY_NUM_RULES 38
+#define YY_END_OF_BUFFER 39
+static yyconst short int yy_accept[167] =
     {   0,
-        0,    0,    0,    0,   29,   27,   26,   26,   21,   22,
-       23,   27,   25,   24,   27,   27,   27,   27,   27,   27,
-       27,   27,    1,   26,    3,    4,    0,    0,    0,    0,
-        0,    0,    0,    1,    2,    0,    0,    3,    4,    0,
-        0,    0,    0,    0,    0,    0,    0,    1,    0,    1,
-        0,    0,    0,    0,    0,    0,   19,    0,    2,   20,
-        0,    0,    0,    5,    0,    0,    0,    0,    0,    6,
-        0,    0,    0,    0,    0,    9,    0,    0,    0,    0,
-        0,   10,    0,    0,    0,    0,    0,    0,    7,    0,
-       11,    0,    0,    8,    0,   12,    0,    0,    0,   15,
-
-        0,    0,   16,    0,    0,    0,   13,    0,   14,    0,
-       17,   18
+        0,    0,    0,    0,   39,   37,   36,   36,   31,   32,
+       33,   37,   35,   34,   37,   37,   37,   37,   37,   37,
+       37,   37,   37,    1,   36,    3,    4,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    1,    2,    0,
+        0,    3,    4,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    1,    0,    1,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,   29,    0,    2,    0,
+        0,    0,   30,    0,    0,    0,    5,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    6,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,   11,    0,
+
+        0,    0,    0,    0,    0,    0,    0,    0,    0,   12,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    7,   21,    0,   17,    0,    0,
+        0,    0,    0,    0,    8,   22,    0,   18,    0,    0,
+        0,    0,   15,    0,    0,   23,   25,    0,   13,   16,
+        0,    0,   24,   26,    9,   14,    0,    0,   10,    0,
+       19,    0,   20,    0,   27,   28
     } ;
 
 static yy_state_type yy_last_accepting_state;
 static char *yy_last_accepting_cpos;
 
-static yyconst yy_state_type yy_NUL_trans[113] =
+static yyconst yy_state_type yy_NUL_trans[167] =
     {   0,
         6,    6,    6,    6,    0,    0,    0,    0,    0,    0,
         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
@@ -2303,7 +3235,12 @@ static yyconst yy_state_type yy_NUL_trans[113] =
         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
 
         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0
     } ;
 
 /* The intent behind this definition is that it'll catch
@@ -2340,7 +3277,7 @@ static YY_BUFFER_STATE buf_state;
    void close_parser() { lwg_parse_yy_delete_buffer(buf_state); }
    int lwg_parse_yywrap(void){ return 1; }
 
-#line 2344 "lex.yy.c"
+#line 3281 "lex.yy.c"
 
 /* Macros after this point can all be overridden by user definitions in
  * section 1.
@@ -2428,17 +3365,8 @@ YY_MALLOC_DECL
  */
 #ifndef YY_INPUT
 #define YY_INPUT(buf,result,max_size) \
-       errno=0; \
-       while ( (result = read( fileno(yyin), (char *) buf, max_size )) < 0 ) \
-       { \
-               if( errno != EINTR) \
-               { \
-                       YY_FATAL_ERROR( "input in flex scanner failed" ); \
-                       break; \
-               } \
-               errno=0; \
-               clearerr(yyin); \
-       }
+       if ( (result = read( fileno(yyin), (char *) buf, max_size )) < 0 ) \
+               YY_FATAL_ERROR( "input in flex scanner failed" );
 #endif
 
 /* No semi-colon after return; correct usage is to write "yyterminate();" -
@@ -2484,13 +3412,13 @@ YY_MALLOC_DECL
 YY_DECL
        {
        register yy_state_type yy_current_state;
-       register char *yy_cp, *yy_bp;
+       register char *yy_cp = NULL, *yy_bp = NULL;
        register int yy_act;
 
 #line 27 "wktparse.lex"
 
 
-#line 2494 "lex.yy.c"
+#line 3422 "lex.yy.c"
 
        if ( yy_init )
                {
@@ -2604,104 +3532,154 @@ YY_RULE_SETUP
 case 9:
 YY_RULE_SETUP
 #line 39 "wktparse.lex"
-{ return POLYGON; }
+{ return CIRCULARSTRING; }
        YY_BREAK
 case 10:
 YY_RULE_SETUP
 #line 40 "wktparse.lex"
-{ return POLYGONM; }
+{ return CIRCULARSTRINGM; }
        YY_BREAK
 case 11:
 YY_RULE_SETUP
 #line 41 "wktparse.lex"
-{ return MULTIPOINT; }
+{ return POLYGON; }
        YY_BREAK
 case 12:
 YY_RULE_SETUP
 #line 42 "wktparse.lex"
-{ return MULTIPOINTM; }
+{ return POLYGONM; }
        YY_BREAK
 case 13:
 YY_RULE_SETUP
 #line 43 "wktparse.lex"
-{ return MULTILINESTRING; }
+{ return COMPOUNDCURVE; }
        YY_BREAK
 case 14:
 YY_RULE_SETUP
 #line 44 "wktparse.lex"
-{ return MULTILINESTRINGM; }
+{ return COMPOUNDCURVEM; }
        YY_BREAK
 case 15:
 YY_RULE_SETUP
 #line 45 "wktparse.lex"
-{ return MULTIPOLYGON; }
+{ return CURVEPOLYGON; }
        YY_BREAK
 case 16:
 YY_RULE_SETUP
 #line 46 "wktparse.lex"
-{ return MULTIPOLYGONM; }
+{ return CURVEPOLYGONM; }
        YY_BREAK
 case 17:
 YY_RULE_SETUP
 #line 47 "wktparse.lex"
-{ return GEOMETRYCOLLECTION; }
+{ return MULTIPOINT; }
        YY_BREAK
 case 18:
 YY_RULE_SETUP
 #line 48 "wktparse.lex"
-{ return GEOMETRYCOLLECTIONM; }
+{ return MULTIPOINTM; }
        YY_BREAK
 case 19:
 YY_RULE_SETUP
 #line 49 "wktparse.lex"
-{ BEGIN(vals_ok); return SRID; }
+{ return MULTILINESTRING; }
        YY_BREAK
 case 20:
 YY_RULE_SETUP
 #line 50 "wktparse.lex"
-{ return EMPTY; }
+{ return MULTILINESTRINGM; }
        YY_BREAK
 case 21:
 YY_RULE_SETUP
-#line 52 "wktparse.lex"
-{ BEGIN(vals_ok); return LPAREN; }
+#line 51 "wktparse.lex"
+{ return MULTICURVE; }
        YY_BREAK
 case 22:
 YY_RULE_SETUP
-#line 53 "wktparse.lex"
-{ return RPAREN; }
+#line 52 "wktparse.lex"
+{ return MULTICURVEM; }
        YY_BREAK
 case 23:
 YY_RULE_SETUP
-#line 54 "wktparse.lex"
-{ return COMMA ; }
+#line 53 "wktparse.lex"
+{ return MULTIPOLYGON; }
        YY_BREAK
 case 24:
 YY_RULE_SETUP
-#line 55 "wktparse.lex"
-{ return EQUALS ; }
+#line 54 "wktparse.lex"
+{ return MULTIPOLYGONM; }
        YY_BREAK
 case 25:
 YY_RULE_SETUP
-#line 56 "wktparse.lex"
-{ BEGIN(0); return SEMICOLON; }
+#line 55 "wktparse.lex"
+{ return MULTISURFACE; }
        YY_BREAK
 case 26:
 YY_RULE_SETUP
-#line 57 "wktparse.lex"
-/*eat whitespace*/
+#line 56 "wktparse.lex"
+{ return MULTISURFACEM; }
        YY_BREAK
 case 27:
 YY_RULE_SETUP
-#line 58 "wktparse.lex"
-{ return lwg_parse_yytext[0]; }
+#line 57 "wktparse.lex"
+{ return GEOMETRYCOLLECTION; }
        YY_BREAK
 case 28:
 YY_RULE_SETUP
+#line 58 "wktparse.lex"
+{ return GEOMETRYCOLLECTIONM; }
+       YY_BREAK
+case 29:
+YY_RULE_SETUP
+#line 59 "wktparse.lex"
+{ BEGIN(vals_ok); return SRID; }
+       YY_BREAK
+case 30:
+YY_RULE_SETUP
 #line 60 "wktparse.lex"
+{ return EMPTY; }
+       YY_BREAK
+case 31:
+YY_RULE_SETUP
+#line 62 "wktparse.lex"
+{ BEGIN(vals_ok); return LPAREN; }
+       YY_BREAK
+case 32:
+YY_RULE_SETUP
+#line 63 "wktparse.lex"
+{ return RPAREN; }
+       YY_BREAK
+case 33:
+YY_RULE_SETUP
+#line 64 "wktparse.lex"
+{ return COMMA ; }
+       YY_BREAK
+case 34:
+YY_RULE_SETUP
+#line 65 "wktparse.lex"
+{ return EQUALS ; }
+       YY_BREAK
+case 35:
+YY_RULE_SETUP
+#line 66 "wktparse.lex"
+{ BEGIN(0); return SEMICOLON; }
+       YY_BREAK
+case 36:
+YY_RULE_SETUP
+#line 67 "wktparse.lex"
+/*eat whitespace*/
+       YY_BREAK
+case 37:
+YY_RULE_SETUP
+#line 68 "wktparse.lex"
+{ return lwg_parse_yytext[0]; }
+       YY_BREAK
+case 38:
+YY_RULE_SETUP
+#line 70 "wktparse.lex"
 ECHO;
        YY_BREAK
-#line 2705 "lex.yy.c"
+#line 3683 "lex.yy.c"
 case YY_STATE_EOF(INITIAL):
 case YY_STATE_EOF(vals_ok):
        yyterminate();
@@ -3079,6 +4057,7 @@ register char *yy_bp;
 #endif /* ifndef YY_NO_UNPUT */
 
 
+#ifndef YY_NO_INPUT
 #ifdef __cplusplus
 static int yyinput()
 #else
@@ -3150,7 +4129,7 @@ static int input()
 
        return c;
        }
-
+#endif /* YY_NO_INPUT */
 
 #ifdef YY_USE_PROTOS
 void yyrestart( FILE *input_file )
@@ -3261,15 +4240,6 @@ YY_BUFFER_STATE b;
        }
 
 
-#ifndef _WIN32
-#include <unistd.h>
-#else
-#ifndef YY_ALWAYS_INTERACTIVE
-#ifndef YY_NEVER_INTERACTIVE
-extern int isatty YY_PROTO(( int ));
-#endif
-#endif
-#endif
 
 #ifdef YY_USE_PROTOS
 void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
@@ -3587,6 +4557,6 @@ int main()
        return 0;
        }
 #endif
-#line 60 "wktparse.lex"
+#line 70 "wktparse.lex"
 
 
index ed656ce874a87ccf650a30adcabd2f448aa7385a..ada3658c77316bb2a6e6baaec5a09fa0d08603a0 100644 (file)
@@ -41,7 +41,15 @@ static char *lwgeomTypeName[] = {
        "MultiPoint",
        "MultiLine",
        "MultiPolygon",
-       "GeometryCollection"
+       "GeometryCollection",
+        "Curve",
+        "CompoundString",
+        "Invalid Type",  /* POINTTYPEI */
+        "Invalid Type",  /* LINETYPEI */
+        "Invalid Type",  /* POLYTYPEI */
+        "CurvePolygon",
+        "MultiCurve",
+        "MultiSurface"
 };
 
 void *
@@ -113,7 +121,7 @@ const char *
 lwgeom_typename(int type)
 {
        // something went wrong somewhere
-       if ( type < 0 || type > 7 ) {
+       if ( type < 0 || type > 12 ) {
                // assert(0);
                return "Invalid type";
        }
index 74cc3980f8f057ca4e958e6b02c86f680f9ebcb5..3d7179119a87ed522ab2dc6d1ba27c81065b14c1 100644 (file)
@@ -6,7 +6,8 @@
 
 #define INTEGRITY_CHECKS 1
 /* #define DEBUG_ALLOCS 1 */
-/* #define PGIS_DEBUG 1 */
+/*#define PGIS_DEBUG 1
+#define PGIS_DEBUG_CALLS 1*/
 /* #define DEBUG_CALLS 1 */
 
 /*
@@ -250,7 +251,7 @@ typedef struct
 /* MULTIPOINTTYPE */
 typedef struct
 {
-       uchar type; 
+       uchar type;  
        BOX2DFLOAT4 *bbox;
        uint32 SRID;    
        int  ngeoms;
@@ -521,6 +522,7 @@ char is_worth_caching_lwgeom_bbox(const LWGEOM *);
 extern size_t lwgeom_size(const uchar *serialized_form);
 extern size_t lwgeom_size_subgeom(const uchar *serialized_form, int geom_number);
 extern size_t lwgeom_size_line(const uchar *serialized_line);
+extern size_t lwgeom_size_curve(const uchar *serialized_curve);
 extern size_t lwgeom_size_point(const uchar *serialized_point);
 extern size_t lwgeom_size_poly(const uchar *serialized_line);
 
@@ -742,6 +744,8 @@ extern LWLINE *lwgeom_getline_inspected(LWGEOM_INSPECTED *inspected, int geom_nu
 extern LWPOLY *lwgeom_getpoly(uchar *serialized_form, int geom_number);
 extern LWPOLY *lwgeom_getpoly_inspected(LWGEOM_INSPECTED *inspected, int geom_number);
 
+extern LWGEOM *lwgeom_getgeom_inspected(LWGEOM_INSPECTED *inspected, int geom_number);
+
 /*
  * this gets the serialized form of a sub-geometry
  * 1st geometry has geom_number = 0
@@ -1073,4 +1077,116 @@ extern char getMachineEndian(void);
 
 void errorIfSRIDMismatch(int srid1, int srid2);
 
+
+/* CURVETYPE */
+typedef struct
+{
+        uchar type; /* CURVETYPE */
+        BOX2DFLOAT4 *bbox;
+        uint32 SRID;
+        POINTARRAY *points; /* array of POINT(3D/3DM) */
+} LWCURVE; /* "light-weight arcline" */
+
+/* COMPOUNDTYPE */
+typedef struct
+{
+        uchar type; /* COMPOUNDTYPE */
+        BOX2DFLOAT4 *bbox;
+        uint32 SRID;
+        int ngeoms;
+        LWGEOM **geoms;
+} LWCOMPOUND; /* "light-weight compound line" */
+
+/* CURVEPOLYTYPE */
+typedef struct
+{
+        uchar type; /* CURVEPOLYTYPE */
+        BOX2DFLOAT4 *bbox;
+        uint32 SRID;
+        int nrings;
+        LWGEOM **rings; /* list of rings (list of points) */
+} LWCURVEPOLY; /* "light-weight polygon" */
+
+/* MULTICURVE */
+typedef struct
+{
+        uchar type;
+        BOX2DFLOAT4 *bbox;
+        uint32 SRID;
+        int ngeoms;
+        LWGEOM **geoms;
+} LWMCURVE;
+
+/* MULTISURFACETYPE */
+typedef struct
+{
+        uchar type;
+        BOX2DFLOAT4 *bbox;
+        uint32 SRID;
+        int ngeoms;
+        LWGEOM **geoms;
+} LWMSURFACE;
+
+#define CURVETYPE       8
+#define COMPOUNDTYPE    9
+#define CURVEPOLYTYPE   13
+#define MULTICURVETYPE          14
+#define MULTISURFACETYPE        15
+
+/******************************************************************
+ * LWCURVE functions
+ ******************************************************************/
+
+/*
+ * given the LWGEOM serialized form (or a pointer into a muli* one)
+ * construct a proper LWCURVE.
+ * serialized_form should point to the 8bit type format (with type = 2)
+ * See SERIALIZED_FORM doc
+ */
+extern LWCURVE *lwcurve_deserialize(uchar *serialized_form);
+
+/* find the size this curve would get when serialized */
+extern size_t lwcurve_serialize_size(LWCURVE *curve);
+
+/*
+ * convert this curve into its serialize form
+ * result's first char will be the 8bit type.  See serialized form doc
+ * copies data.
+ */
+extern uchar *lwcurve_serialize(LWCURVE *curve);
+
+/* same as above, writes to buf */
+extern void lwcurve_serialize_buf(LWCURVE *curve, uchar *buf, size_t *size);
+
+/*
+ * find bounding box (standard one)  zmin=zmax=0 if 2d (might change to NaN)
+ */
+extern BOX3D *lwcurve_compute_box3d(LWCURVE *curve);
+
+LWGEOM *lwcurve_add(const LWCURVE *to, uint32 where, const LWGEOM *what);
+extern int lwcurve_compute_box2d_p(LWCURVE *curve, BOX2DFLOAT4 *box);
+extern BOX3D *lwcurve_compute_box3d(LWCURVE *curve);
+extern void pfree_curve(LWCURVE  *curve);
+
+/******************************************************************
+ * LWMULTIx and LWCOLLECTION functions
+ ******************************************************************/
+
+LWCOMPOUND *lwcompound_deserialize(uchar *serialized_form);
+
+LWGEOM *lwcompound_add(const LWCOMPOUND *to, uint32 where, const LWGEOM *what);
+
+LWCURVEPOLY *lwcurvepoly_deserialize(uchar *serialized_form);
+
+LWGEOM *lwcurvepoly_add(const LWCURVEPOLY *to, uint32 where, const LWGEOM *what);
+
+LWMCURVE *lwmcurve_deserialize(uchar *serialized_form);
+
+LWGEOM *lwmcurve_add(const LWMCURVE *to, uint32 where, const LWGEOM *what);
+
+LWMSURFACE *lwmsurface_deserialize(uchar *serialized_form);
+
+LWGEOM *lwmsurface_add(const LWMSURFACE *to, uint32 where, const LWGEOM *what);
 #endif /* !defined _LIBLWGEOM_H  */
+
+double lwcircle_center(POINT4D *p1, POINT4D *p2, POINT4D *p3, POINT4D **result);
index 312a5177fdd6e1d4354c1e856da9e3ef02c080d5..3f0d2ddd280ecc9b377dab7ae3dce698c5b3522a 100644 (file)
@@ -30,6 +30,10 @@ lwcollection_construct(unsigned int type, int SRID, BOX2DFLOAT4 *bbox,
        unsigned int i;
 #endif
 
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("lwcollection_construct called.");
+#endif        
+
        hasz = 0;
        hasm = 0;
        if ( ngeoms > 0 )
@@ -38,10 +42,16 @@ lwcollection_construct(unsigned int type, int SRID, BOX2DFLOAT4 *bbox,
                hasm = TYPE_HASM(geoms[0]->type);
 #ifdef CHECK_LWGEOM_ZM
                zm = TYPE_GETZM(geoms[0]->type);
+#ifdef PGIS_DEBUG
+                lwnotice("lwcollection_construct type[0]=%d", geoms[0]->type);
+#endif
                for (i=1; i<ngeoms; i++)
                {
+#ifdef PGIS_DEBUG
+                        lwnotice("lwcollection_construct type=[%d]=%d", i, geoms[i]->type);
+#endif
                        if ( zm != TYPE_GETZM(geoms[i]->type) )
-                               lwerror("lwcollection_construct: mixed dimension geometries");
+                               lwerror("lwcollection_construct: mixed dimension geometries: %d/%d", zm, TYPE_GETZM(geoms[i]->type));
                }
 #endif
        }
diff --git a/lwgeom/lwcompound.c b/lwgeom/lwcompound.c
new file mode 100644 (file)
index 0000000..ec463aa
--- /dev/null
@@ -0,0 +1,120 @@
+/**********************************************************************\r
+ * $Id$\r
+ *\r
+ * PostGIS - Spatial Types for PostgreSQL\r
+ * http://postgis.refractions.net\r
+ * Copyright 2001-2006 Refractions Research Inc.\r
+ *\r
+ * This is free software; you can redistribute and/or modify it under\r
+ * the terms of the GNU General Public Licence. See the COPYING file.\r
+ * \r
+ **********************************************************************/\r
+\r
+#include <stdio.h>\r
+#include <stdlib.h>\r
+#include <string.h>\r
+#include "liblwgeom.h"\r
+\r
+LWCOMPOUND *\r
+lwcompound_deserialize(uchar *serialized)\r
+{\r
+        LWCOMPOUND *result;\r
+        LWGEOM_INSPECTED *insp;\r
+        int type = lwgeom_getType(serialized[0]);\r
+        int i;\r
+\r
+        if(type != COMPOUNDTYPE)\r
+        {\r
+                lwerror("lwcompound_deserialize called on non compound: %d", type);\r
+                return NULL;\r
+        }\r
+\r
+        insp = lwgeom_inspect(serialized);\r
+\r
+        result = lwalloc(sizeof(LWCOMPOUND));\r
+        result->type = insp->type;\r
+        result->SRID = insp->SRID;\r
+        result->ngeoms = insp->ngeometries;\r
+        result->geoms = lwalloc(sizeof(LWGEOM *)*insp->ngeometries);\r
+\r
+        if(lwgeom_hasBBOX(serialized[0]))\r
+        {\r
+                result->bbox = lwalloc(sizeof(BOX2DFLOAT4));\r
+                memcpy(result->bbox, serialized + 1, sizeof(BOX2DFLOAT4));\r
+        }\r
+        else result->bbox = NULL;\r
+\r
+        for(i = 0; i < insp->ngeometries; i++)\r
+        {\r
+                if(lwgeom_getType(insp->sub_geoms[i][0]) == LINETYPE)\r
+                        result->geoms[i] = (LWGEOM *)lwline_deserialize(insp->sub_geoms[i]);\r
+                else\r
+                        result->geoms[i] = (LWGEOM *)lwcurve_deserialize(insp->sub_geoms[i]);\r
+                if(TYPE_NDIMS(result->geoms[i]->type) != TYPE_NDIMS(result->type))\r
+                {\r
+                        lwerror("Mixed dimensions (compound:%d, line/curve%d:%d)",\r
+                            TYPE_NDIMS(result->type), i,\r
+                            TYPE_NDIMS(result->geoms[i]->type)\r
+                        );\r
+                        lwfree(result);\r
+                        return NULL;\r
+                }\r
+        }\r
+        return result;\r
+}\r
+\r
+/*\r
+ * Add 'what' to this string at position 'where'\r
+ * where=0 == prepend\r
+ * where=-1 == append\r
+ * Returns a COMPOUND or a GEOMETRYCOLLECTION\r
+ */\r
+LWGEOM *\r
+lwcompound_add(const LWCOMPOUND *to, uint32 where, const LWGEOM *what)\r
+{\r
+        LWCOLLECTION *col;\r
+        LWGEOM **geoms;\r
+        int newtype;\r
+\r
+#ifdef PGIS_DEBUG_CALLS\r
+        lwnotice("lwcompound_add called.");\r
+#endif\r
+\r
+        if(where != -1 && where != 0)\r
+        {\r
+                lwerror("lwcompound_add only supports 0 or -1 as a second argument, not %d", where);\r
+                return NULL;\r
+        }\r
+\r
+        /* dimensions compatibility are checked by caller */\r
+\r
+        /* Construct geoms array */\r
+        geoms = lwalloc(sizeof(LWGEOM *)*2);\r
+        if(where == -1) /* append */\r
+        {\r
+                geoms[0] = lwgeom_clone((LWGEOM *)to);\r
+                geoms[1] = lwgeom_clone(what);\r
+        }\r
+        else /* prepend */\r
+        {\r
+                geoms[0] = lwgeom_clone(what);\r
+                geoms[1] = lwgeom_clone((LWGEOM *)to);\r
+        }\r
+\r
+        /* reset SRID and wantbbox flag from component types */\r
+        geoms[0]->SRID = geoms[1]->SRID = -1;\r
+        TYPE_SETHASSRID(geoms[0]->type, 0);\r
+        TYPE_SETHASSRID(geoms[1]->type, 0);\r
+        TYPE_SETHASBBOX(geoms[0]->type, 0);\r
+        TYPE_SETHASBBOX(geoms[1]->type, 0);\r
+\r
+        /* Find appropriate geom type */\r
+        if(TYPE_GETTYPE(what->type) == LINETYPE || TYPE_GETTYPE(what->type) == CURVETYPE) newtype = COMPOUNDTYPE;\r
+        else newtype = COLLECTIONTYPE;\r
+\r
+        col = lwcollection_construct(newtype,\r
+                to->SRID, NULL, 2, geoms);\r
+\r
+        return (LWGEOM *)col;\r
+}\r
+\r
diff --git a/lwgeom/lwcurve.c b/lwgeom/lwcurve.c
new file mode 100644 (file)
index 0000000..2572835
--- /dev/null
@@ -0,0 +1,749 @@
+/**********************************************************************\r
+ * $Id$\r
+ *\r
+ * PostGIS - Spatial Types for PostgreSQL\r
+ * http://postgis.refractions.net\r
+ * Copyright 2001-2006 Refractions Research Inc.\r
+ *\r
+ * This is free software; you can redistribute and/or modify it under\r
+ * the terms of the GNU General Public Licence. See the COPYING file.\r
+ * \r
+ **********************************************************************/\r
+\r
+/* basic LWCURVE functions */\r
+\r
+#include <stdio.h>\r
+#include <stdlib.h>\r
+#include <string.h>\r
+#include <math.h>\r
+#include "liblwgeom.h"\r
+\r
+/*#define PGIS_DEBUG_CALLS 1 */\r
+/*#define PGIS_DEBUG 1 */\r
+\r
+#ifndef MAXFLOAT\r
+  #define MAXFLOAT      3.40282347e+38F\r
+#endif\r
+\r
+/*\r
+ * Construct a new LWCURVE.  points will *NOT* be copied\r
+ * use SRID=-1 for unknown SRID (will have 8bit type's S = 0)\r
+ */\r
+LWCURVE *\r
+lwcurve_construct(int SRID, BOX2DFLOAT4 *bbox, POINTARRAY *points)\r
+{\r
+        /*\r
+         * The first arc requires three points.  Each additional\r
+         * arc requires two more points.  Thus the minimum point count\r
+         * is three, and the count must be odd.\r
+         */\r
+        if(points->npoints % 2 != 1 || points->npoints < 3) \r
+        {\r
+                lwerror("lwcurve_construct: invalid point count %d", points->npoints);\r
+                return NULL;\r
+        }\r
+        \r
+        LWCURVE *result;\r
+        result = (LWCURVE*) lwalloc(sizeof(LWCURVE));\r
+\r
+        result->type = lwgeom_makeType_full(\r
+                TYPE_HASZ(points->dims),\r
+                TYPE_HASM(points->dims),\r
+                (SRID!=-1), CURVETYPE, 0);\r
+        result->SRID = SRID;\r
+        result->points = points;\r
+        result->bbox = bbox;\r
+         \r
+        return result;\r
+}\r
+\r
+/*\r
+ * given the LWGEOM serialized form (or a point into a multi* one)\r
+ * construct a propert LWCURVE.\r
+ * serialized_form should point to the 8bit type format (with type = 8)\r
+ * See serialized form doc\r
+ */\r
+LWCURVE *\r
+lwcurve_deserialize(uchar *serialized_form)\r
+{\r
+        uchar type;\r
+        LWCURVE *result;\r
+        uchar *loc=NULL;\r
+        uint32 npoints;\r
+        POINTARRAY *pa;\r
+\r
+        type = (uchar)serialized_form[0];\r
+        if(lwgeom_getType(type) != CURVETYPE)\r
+        {\r
+                lwerror("lwcurve_deserialize: attempt to deserialize a curve which is really a %s", lwgeom_typename(type));\r
+                return NULL;\r
+        }\r
+\r
+        result = (LWCURVE*) lwalloc(sizeof(LWCURVE));\r
+        result->type = type;\r
+\r
+        loc = serialized_form + 1;\r
+\r
+        if(lwgeom_hasBBOX(type))\r
+        {\r
+#ifdef PGIS_DEBUG\r
+                lwnotice("lwcurve_deserialize: input has bbox");\r
+#endif\r
+                result->bbox = lwalloc(sizeof(BOX2DFLOAT4));\r
+                memcpy(result->bbox, loc, sizeof(BOX2DFLOAT4));\r
+                loc += sizeof(BOX2DFLOAT4);               \r
+         }\r
+         else\r
+         {\r
+#ifdef PGIS_DEBUG\r
+                lwnotice("lwcurve_deserialize: input lacks bbox");           \r
+#endif               \r
+                result->bbox = NULL;\r
+         }\r
+\r
+         if(lwgeom_hasSRID(type))\r
+         {\r
+#ifdef PGIS_DEBUG\r
+                lwnotice("lwcurve_deserialize: input has srid");\r
+#endif\r
+                result->SRID = get_int32(loc);               \r
+                loc += 4; /* type + SRID */\r
+         }\r
+         else\r
+         {\r
+#ifdef PGIS_DEBUG\r
+                lwnotice("lwcurve_deserialize: input lacks srid");\r
+#endif\r
+                result->SRID = -1;                \r
+         }\r
+\r
+         /* we've read the type (1 byte) and SRID (4 bytes, if present) */\r
+\r
+         npoints = get_uint32(loc);\r
+#ifdef PGIS_DEBUG\r
+         lwnotice("curve npoints = %d", npoints);\r
+#endif         \r
+         loc += 4;\r
+         pa = pointArray_construct(loc, TYPE_HASZ(type), TYPE_HASM(type), npoints);\r
+         result->points = pa;\r
+         return result;\r
+}\r
+\r
+/*\r
+ * convert this curve into its serialized form\r
+ * result's first char will be the 8bit type. See serialized form doc\r
+ */\r
+uchar *\r
+lwcurve_serialize(LWCURVE *curve)\r
+{\r
+        size_t size, retsize;\r
+        uchar * result;\r
+\r
+        if(curve == NULL) {\r
+                lwerror("lwcurve_serialize:: given null curve");\r
+                return NULL;\r
+        }\r
+\r
+        size = lwcurve_serialize_size(curve);\r
+        result = lwalloc(size);\r
+        lwcurve_serialize_buf(curve, result, &retsize);\r
+        if(retsize != size)\r
+                lwerror("lwcurve_serialize_size returned %d, ..selialize_buf returned %d", size, retsize);\r
+        return result;\r
+}\r
+\r
+/*\r
+ * convert this curve into its serialized form writing it into \r
+ * the given buffer, and returning number of bytes written into \r
+ * the given int pointer.\r
+ * result's first char will be the 8bit type.  See serialized form doc\r
+ */\r
+void lwcurve_serialize_buf(LWCURVE *curve, uchar *buf, size_t *retsize)\r
+{\r
+        char hasSRID;\r
+        uchar *loc;\r
+        int ptsize;\r
+        size_t size;\r
+\r
+#ifdef PGIS_DEBUG_CALLS\r
+        lwnotice("lwcurve_serialize_buf(%p, %p, %p) called",\r
+                curve, buf, retsize);\r
+#endif\r
+\r
+        if(curve == NULL) \r
+        {\r
+                lwerror("lwcurve_serialize:: given null curve");\r
+                return;\r
+        }\r
+\r
+        if(TYPE_GETZM(curve->type) != TYPE_GETZM(curve->points->dims))\r
+        {\r
+                lwerror("Dimensions mismatch in lwcurve");\r
+                return;\r
+        }\r
+\r
+        ptsize = pointArray_ptsize(curve->points);\r
+\r
+        hasSRID = (curve->SRID != -1);\r
+\r
+        buf[0] = (uchar)lwgeom_makeType_full(\r
+                TYPE_HASZ(curve->type), TYPE_HASM(curve->type),\r
+                hasSRID, CURVETYPE, curve->bbox ? 1 : 0);\r
+        loc = buf+1;\r
+\r
+#ifdef PGIS_DEBUG\r
+        lwnotice("lwcurve_serialize_buf added type (%d)", curve->type);\r
+#endif\r
+\r
+        if(curve->bbox)\r
+        {\r
+                memcpy(loc, curve->bbox, sizeof(BOX2DFLOAT4));\r
+                loc += sizeof(BOX2DFLOAT4);\r
+\r
+#ifdef PGIS_DEBUG\r
+                lwnotice("lwcurve_serialize_buf added BBOX");\r
+#endif\r
+\r
+        }                \r
+\r
+        if(hasSRID)\r
+        {\r
+                memcpy(loc, &curve->SRID, sizeof(int32));\r
+                loc += sizeof(int32);\r
+\r
+#ifdef PGIS_DEBUG\r
+                lwnotice("lwcurve_serialize_buf added SRID");\r
+#endif\r
+\r
+        }\r
+\r
+        memcpy(loc, &curve->points->npoints, sizeof(uint32));\r
+        loc += sizeof(uint32);\r
+\r
+#ifdef PGIS_DEBUG\r
+        lwnotice("lwcurve_serialize_buf added npoints (%d)",\r
+            curve->points->npoints);\r
+#endif\r
+\r
+        /* copy in points */\r
+        size = curve->points->npoints * ptsize;\r
+        memcpy(loc, getPoint_internal(curve->points, 0), size);\r
+        loc += size;\r
+\r
+#ifdef PGIS_DEBUG\r
+        lwnotice("lwcurve_serialize_buf copied serialized_pointlist (%d bytes)",\r
+                ptsize * curve->points->npoints);        \r
+#endif\r
+\r
+        if(retsize) *retsize = loc-buf;\r
+\r
+#ifdef PGIS_DEBUG_CALLS\r
+        lwnotice("lwcurve_serialize_buf returning (loc: %p, size: %d)",\r
+                loc, loc-buf);\r
+#endif\r
+}\r
+\r
+/* find length of this deserialized curve */\r
+size_t\r
+lwcurve_serialize_size(LWCURVE *curve)\r
+{\r
+        size_t size = 1; /* type */\r
+\r
+#ifdef PGIS_DEBUG_CALLS\r
+        lwnotice("lwcurve_serialize_size called");        \r
+#endif\r
+\r
+        if(curve->SRID != -1) size += 4; /* SRID */\r
+        if(curve->bbox) size += sizeof(BOX2DFLOAT4);\r
+\r
+        size += 4; /* npoints */\r
+        size += pointArray_ptsize(curve->points) * curve->points->npoints;\r
+\r
+#ifdef PGIS_DEBUG_CALLS\r
+        lwnotice("lwcurve_serialize_size returning %d", size);\r
+#endif\r
+\r
+        return size;\r
+}\r
+\r
+BOX3D *\r
+lwcircle_compute_box3d(POINT4D *p1, POINT4D *p2, POINT4D *p3)\r
+{\r
+        double x1, x2, y1, y2, z1, z2;\r
+        double angle, radius, sweep;\r
+        /*\r
+        double top, left;\r
+        */\r
+        double a1, a2, a3;\r
+        double xe = 0.0, ye = 0.0;\r
+        POINT4D *center;\r
+        int i;\r
+        BOX3D *box;\r
+\r
+#ifdef PGIS_DEBUG_CALLS\r
+        lwnotice("lwcircle_compute_box3d called.");\r
+#endif\r
+\r
+        center = lwalloc(sizeof(POINT4D));\r
+        radius = lwcircle_center(p1, p2, p3, &center);\r
+        if(radius < 0.0) return NULL;\r
+\r
+        /*\r
+        top = center->y + radius;\r
+        left = center->x - radius;\r
+\r
+#ifdef PGIS_DEBUG_CALLS\r
+        lwnotice("lwcircle_compute_box3d: top=%.16f, left=%.16f", top, left);\r
+#endif\r
+        */\r
+\r
+        x1 = MAXFLOAT;\r
+        x2 = -1 * MAXFLOAT;\r
+        y1 = MAXFLOAT;\r
+        y2 = -1 * MAXFLOAT;\r
+\r
+        a1 = atan2(p1->y - center->y, p1->x - center->x);\r
+        a2 = atan2(p2->y - center->y, p2->x - center->x);\r
+        a3 = atan2(p3->y - center->y, p3->x - center->x);\r
+\r
+        /* Determine sweep angle */\r
+        if(a1 > a2 && a2 > a3) \r
+        {\r
+                sweep = a3 - a1;\r
+        }\r
+        /* Counter-clockwise */\r
+        else if(a1 < a2 && a2 < a3)\r
+        {\r
+                sweep = a3 - a1;\r
+        }\r
+        /* Clockwise, wrap */\r
+        else if((a1 < a2 && a1 > a3) || (a2 < a3 && a1 > a3))\r
+        {\r
+                sweep = a3 - a1 + 2*M_PI;\r
+        }\r
+        /* Counter-clockwise, wrap */\r
+        else if((a1 > a2 && a1 < a3) || (a2 > a3 && a1 < a3))\r
+        {\r
+                sweep = a3 - a1 - 2*M_PI;\r
+        } \r
+        else \r
+        {\r
+                sweep = 0.0;\r
+        }\r
+\r
+#ifdef PGIS_DEBUG\r
+        lwnotice("a1 %.16f, a2 %.16f, a3 %.16f, sweep %.16f", a1, a2, a3, sweep);\r
+#endif\r
+\r
+        angle = 0.0;\r
+        for(i=0; i < 6; i++)\r
+        {\r
+                switch(i) {\r
+                case 0:\r
+                        angle = 0.0;\r
+                        xe = center->x + radius;\r
+                        ye = center->y;\r
+                        break;\r
+                case 1:\r
+                        angle = M_PI_2;\r
+                        xe = center->x;\r
+                        ye = center->y + radius;\r
+                        break;\r
+                case 2:\r
+                        angle = M_PI;\r
+                        xe = center->x - radius;\r
+                        ye = center->y;\r
+                        break;\r
+                case 3:\r
+                        angle = -1 * M_PI_2;\r
+                        xe = center->x;\r
+                        ye = center->y - radius;\r
+                        break;\r
+                case 4:\r
+                        angle = a1;\r
+                        xe = p1->x;\r
+                        ye = p1->y;\r
+                        break;\r
+                case 5:\r
+                        angle = a3;\r
+                        xe = p3->x;\r
+                        ye = p3->y;\r
+                        break;\r
+                }\r
+                if(i < 4) \r
+                {\r
+                        if(sweep > 0.0 && (angle > a3 || angle < a1)) continue;\r
+                        if(sweep < 0.0 && (angle < a3 || angle > a1)) continue;\r
+                }\r
+\r
+#ifdef PGIS_DEBUG\r
+                lwnotice("lwcircle_compute_box3d: potential extreame %d (%.16f, %.16f)", i, xe, ye);\r
+#endif\r
+                x1 = (x1 < xe) ? x1 : xe;\r
+                y1 = (y1 < ye) ? y1 : ye;\r
+                x2 = (x2 > xe) ? x2 : xe;\r
+                y2 = (y2 > ye) ? y2 : ye;\r
+        }\r
+#ifdef PGIS_DEBUG\r
+        lwnotice("lwcircle_compute_box3d: extreames found (%.16f %.16f, %.16f %.16f)", x1, y1, x2, y2);\r
+#endif\r
+\r
+        /*\r
+        x1 = center->x + x1 * radius;\r
+        x2 = center->x + x2 * radius;\r
+        y1 = center->y + y1 * radius;\r
+        y2 = center->y + y2 * radius;\r
+        */\r
+        z1 = (p1->z < p2->z) ? p1->z : p2->z;\r
+        z1 = (z1 < p3->z) ? z1 : p3->z;\r
+        z2 = (p1->z > p2->z) ? p1->z : p2->z;\r
+        z2 = (z2 > p3->z) ? z2 : p3->z;\r
+\r
+        box = lwalloc(sizeof(BOX3D));\r
+        box->xmin = x1; box->xmax = x2;\r
+        box->ymin = y1; box->ymax = y2;\r
+        box->zmin = z1; box->zmax = z2;\r
+\r
+        lwfree(center);\r
+\r
+        return box;\r
+}\r
+\r
+/*\r
+ * Find bounding box (standard one)\r
+ * zmin=zmax=NO_Z_VALUE if 2d\r
+ * TODO: This ignores curvature, which should be taken into account.\r
+ */\r
+BOX3D *\r
+lwcurve_compute_box3d(LWCURVE *curve)\r
+{\r
+        BOX3D *box, *tmp; \r
+        int i;\r
+        POINT4D *p1 = lwalloc(sizeof(POINT4D));\r
+        POINT4D *p2 = lwalloc(sizeof(POINT4D));\r
+        POINT4D *p3 = lwalloc(sizeof(POINT4D));\r
+\r
+#ifdef PGIS_DEBUG_CALLS\r
+        lwnotice("lwcurve_compute_box3d called.");\r
+#endif\r
+\r
+        /* initialize box values */\r
+        box = lwalloc(sizeof(BOX3D));\r
+        box->xmin = MAXFLOAT; box->xmax = -1 * MAXFLOAT;\r
+        box->ymin = MAXFLOAT; box->ymax = -1 * MAXFLOAT;\r
+        box->zmin = MAXFLOAT; box->zmax = -1 * MAXFLOAT;\r
+        \r
+        for(i = 2; i < curve->points->npoints; i+=2)\r
+        {\r
+                getPoint4d_p(curve->points, i-2, p1);\r
+                getPoint4d_p(curve->points, i-1, p2);\r
+                getPoint4d_p(curve->points, i, p3);\r
+                tmp = lwcircle_compute_box3d(p1, p2, p3);\r
+                if(tmp == NULL) continue;\r
+                box->xmin = (box->xmin < tmp->xmin) ? box->xmin : tmp->xmin;\r
+                box->xmax = (box->xmax > tmp->xmax) ? box->xmax : tmp->xmax;\r
+                box->ymin = (box->ymin < tmp->ymin) ? box->ymin : tmp->ymin;\r
+                box->ymax = (box->ymax > tmp->ymax) ? box->ymax : tmp->ymax;\r
+                box->zmin = (box->zmin < tmp->zmin) ? box->zmin : tmp->zmin;\r
+                box->zmax = (box->zmax > tmp->zmax) ? box->zmax : tmp->zmax;\r
+#ifdef PGIS_DEBUG_CALLS\r
+                lwnotice("curve %d x=(%.16f,%.16f) y=(%.16f,%.16f) z=(%.16f,%.16f)", i/2, box->xmin, box->xmax, box->ymin, box->ymax, box->zmin, box->zmax);\r
+#endif\r
+        }\r
+\r
+        \r
+        return box;\r
+}\r
+\r
+int\r
+lwcurve_compute_box2d_p(LWCURVE *curve, BOX2DFLOAT4 *result)\r
+{\r
+\r
+#ifdef PGIS_DEBUG_CALLS\r
+        lwnotice("lwcurve_compute_box2d_p called.");\r
+#endif\r
+\r
+        BOX3D *box = lwcurve_compute_box3d(curve);\r
+        if(box == NULL) return 0;\r
+        box3d_to_box2df_p(box, result);\r
+        return 1;\r
+}\r
+\r
+void pfree_curve(LWCURVE *curve)\r
+{\r
+        lwfree(curve->points);\r
+        lwfree(curve);\r
+}\r
+\r
+/* find length of this serialized curve */\r
+size_t\r
+lwgeom_size_curve(const uchar *serialized_curve)\r
+{\r
+        int type = (uchar)serialized_curve[0];\r
+        uint32 result = 1; /* type */\r
+        const uchar *loc;\r
+        uint32 npoints;\r
+\r
+#ifdef PGIS_DEBUG_CALLS\r
+        lwnotice("lwgeom_size_curve called");\r
+#endif\r
+        if(lwgeom_getType(type) != CURVETYPE)\r
+                lwerror("lwgeom_size_curve::attempt to find the length of a non-curve");\r
+\r
+        loc = serialized_curve + 1;\r
+        if(lwgeom_hasBBOX(type))\r
+        {\r
+                loc += sizeof(BOX2DFLOAT4);\r
+                result += sizeof(BOX2DFLOAT4);\r
+        }\r
+\r
+        if(lwgeom_hasSRID(type))\r
+        {\r
+                loc += 4; /* type + SRID */\r
+                result += 4;\r
+        }\r
+\r
+        /* we've read the type (1 byte) and SRID (4 bytes, if present) */\r
+        npoints = get_uint32(loc);\r
+        result += sizeof(uint32); /* npoints */\r
+\r
+        result += TYPE_NDIMS(type) * sizeof(double) * npoints;\r
+\r
+#ifdef PGIS_DEBUG_CALLS\r
+        lwnotice("lwgeom_size_curve returning %d", result);\r
+#endif        \r
+\r
+        return result;\r
+}\r
+\r
+void printLWCURVE(LWCURVE *curve)\r
+{\r
+        lwnotice("LWCURVE {");\r
+        lwnotice("    ndims = %i", (int)TYPE_NDIMS(curve->type));\r
+        lwnotice("    SRID = %i", (int)curve->SRID);\r
+        printPA(curve->points);\r
+        lwnotice("}");\r
+}\r
+\r
+/* Clone LWCURVE object.  POINTARRAY is not copied. */\r
+LWCURVE *\r
+lwcurve_clone(const LWCURVE *g)\r
+{\r
+        LWCURVE *ret = lwalloc(sizeof(LWCURVE));\r
+        memcpy(ret, g, sizeof(LWCURVE));\r
+        if(g->bbox) ret->bbox = box2d_clone(g->bbox);\r
+        return ret;\r
+}\r
+\r
+/*\r
+ * Add 'what' to this curve at position 'where'.\r
+ * where=0 == prepend\r
+ * where=-1 == append\r
+ * Returns a MULTICURVE or a GEOMETRYCOLLECTION\r
+ */\r
+LWGEOM *\r
+lwcurve_add(const LWCURVE *to, uint32 where, const LWGEOM *what)\r
+{\r
+        LWCOLLECTION *col;\r
+        LWGEOM **geoms;\r
+        int newtype;\r
+        \r
+        if(where != -1 && where != 0)\r
+        {\r
+                lwerror("lwcurve_add only supports 0 or -1 as second argument %d", where);\r
+                return NULL;\r
+        }\r
+\r
+        /* dimensions compatibility are checked by caller */\r
+\r
+        /* Construct geoms array */\r
+        geoms = lwalloc(sizeof(LWGEOM *)*2);\r
+        if(where == -1) /* append */\r
+        {\r
+                geoms[0] = lwgeom_clone((LWGEOM *)to);\r
+                geoms[1] = lwgeom_clone(what);\r
+        }\r
+        else /* prepend */\r
+        {\r
+                geoms[0] = lwgeom_clone(what);\r
+                geoms[1] = lwgeom_clone((LWGEOM *)to);\r
+        }\r
+        \r
+        /* reset SRID and wantbbox flag from component types */\r
+        geoms[0]->SRID = geoms[1]->SRID = -1;\r
+        TYPE_SETHASSRID(geoms[0]->type, 0);\r
+        TYPE_SETHASSRID(geoms[1]->type, 0);\r
+        TYPE_SETHASBBOX(geoms[0]->type, 0);\r
+        TYPE_SETHASBBOX(geoms[1]->type, 0);\r
+\r
+        /* Find appropriate geom type */\r
+        if(TYPE_GETTYPE(what->type) == CURVETYPE || TYPE_GETTYPE(what->type) == LINETYPE) newtype = MULTICURVETYPE;\r
+        else newtype = COLLECTIONTYPE;\r
+\r
+        col = lwcollection_construct(newtype, \r
+                to->SRID, NULL, \r
+                2, geoms);\r
+\r
+        return (LWGEOM *)col;\r
+}\r
+\r
+void lwcurve_reverse(LWCURVE *curve)\r
+{\r
+        ptarray_reverse(curve->points);\r
+}\r
+\r
+/*\r
+ * TODO: Invalid segmentization.  This should accomodate the curvature.\r
+ */\r
+LWCURVE *\r
+lwcurve_segmentize2d(LWCURVE *curve, double dist)\r
+{\r
+        return lwcurve_construct(curve->SRID, NULL,\r
+                ptarray_segmentize2d(curve->points, dist));\r
+}\r
+                    \r
+/* check coordinate equality */\r
+char\r
+lwcurve_same(const LWCURVE *me, const LWCURVE *you)\r
+{\r
+        return ptarray_same(me->points, you->points);\r
+}\r
+\r
+/*\r
+ * Construct a LWCURVE from an array of LWPOINTs\r
+ * LWCURVE dimensions are large enough to host all input dimensions.\r
+ */\r
+LWCURVE *\r
+lwcurve_from_lwpointarray(int SRID, unsigned int npoints, LWPOINT **points)\r
+{\r
+        int zmflag=0;\r
+        unsigned int i;\r
+        POINTARRAY *pa;\r
+        uchar *newpoints, *ptr;\r
+        size_t ptsize, size;\r
+\r
+        /*\r
+         * Find output dimensions, check integrity\r
+         */\r
+        for(i = 0; i < npoints; i++)\r
+        {\r
+                if(TYPE_GETTYPE(points[i]->type) != POINTTYPE)\r
+                {\r
+                        lwerror("lwcurve_from_lwpointarray: invalid input type: %s",\r
+                            lwgeom_typename(TYPE_GETTYPE(points[i]->type)));\r
+                        return NULL;\r
+                }\r
+                if(TYPE_HASZ(points[i]->type)) zmflag |= 2;\r
+                if(TYPE_HASM(points[i]->type)) zmflag |=1;\r
+                if(zmflag == 3) break;\r
+        }\r
+\r
+        if(zmflag == 0) ptsize = 2 * sizeof(double);\r
+        else if(zmflag == 3) ptsize = 4 * sizeof(double);\r
+        else ptsize = 3 * sizeof(double);\r
+\r
+        /*\r
+         * Allocate output points array\r
+         */\r
+        size = ptsize * npoints;\r
+        newpoints = lwalloc(size);\r
+        memset(newpoints, 0, size);\r
+\r
+        ptr = newpoints;\r
+        for(i = 0; i < npoints; i++)\r
+        {\r
+                size = pointArray_ptsize(points[i]->point);\r
+                memcpy(ptr, getPoint_internal(points[i]->point, 0), size);\r
+                ptr += ptsize;\r
+        }\r
+        pa = pointArray_construct(newpoints, zmflag&2, zmflag&1, npoints);\r
+\r
+        return lwcurve_construct(SRID, NULL, pa);\r
+}\r
+\r
+/*\r
+ * Construct a LWCURVE from a LWMPOINT\r
+ */\r
+LWCURVE *\r
+lwcurve_from_lwmpoint(int SRID, LWMPOINT *mpoint)\r
+{\r
+        unsigned int i;\r
+        POINTARRAY *pa;\r
+        char zmflag = TYPE_GETZM(mpoint->type);\r
+        size_t ptsize, size;\r
+        uchar *newpoints, *ptr;\r
+\r
+        if(zmflag == 0) ptsize = 2 * sizeof(double);\r
+        else if(zmflag == 3) ptsize = 4 * sizeof(double);\r
+        else ptsize = 3 * sizeof(double);\r
+\r
+        /* Allocate space for output points */\r
+        size = ptsize * mpoint->ngeoms;\r
+        newpoints = lwalloc(size);\r
+        memset(newpoints, 0, size);\r
+\r
+        ptr = newpoints;\r
+        for(i = 0; i < mpoint->ngeoms; i++)\r
+        {\r
+                memcpy(ptr,\r
+                        getPoint_internal(mpoint->geoms[i]->point, 0),\r
+                        ptsize);\r
+                ptr += ptsize;\r
+        }\r
+\r
+        pa = pointArray_construct(newpoints, zmflag&2, zmflag&1,\r
+                mpoint->ngeoms);\r
+\r
+#ifdef PGIS_DEBUG\r
+        lwnotice("lwcurve_from_lwmpoint: constructed pointarray for %d points, %d zmflag", mpoint->ngeoms, zmflag);\r
+#endif\r
+        \r
+        return lwcurve_construct(SRID, NULL, pa);\r
+}\r
+\r
+LWCURVE *\r
+lwcurve_addpoint(LWCURVE *curve, LWPOINT *point, unsigned int where)\r
+{\r
+        POINTARRAY *newpa;\r
+        LWCURVE *ret;\r
+\r
+        newpa = ptarray_addPoint(curve->points, \r
+                getPoint_internal(point->point, 0),\r
+                TYPE_NDIMS(point->type), where);\r
+        ret = lwcurve_construct(curve->SRID, NULL, newpa);\r
+\r
+        return ret;\r
+}\r
+\r
+LWCURVE *\r
+lwcurve_removepoint(LWCURVE *curve, unsigned int index)\r
+{\r
+        POINTARRAY *newpa;\r
+        LWCURVE *ret;\r
+\r
+        newpa = ptarray_removePoint(curve->points, index);\r
+        ret = lwcurve_construct(curve->SRID, NULL, newpa);\r
+\r
+        return ret;\r
+}\r
+\r
+/*\r
+ * Note: input will be changed, make sure you have permissions for this.\r
+ * */\r
+void\r
+lwcurve_setPoint4d(LWCURVE *curve, unsigned int index, POINT4D *newpoint)\r
+{\r
+        setPoint4d(curve->points, index, newpoint);\r
+}\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
diff --git a/lwgeom/lwcurvepoly.c b/lwgeom/lwcurvepoly.c
new file mode 100644 (file)
index 0000000..0da2ad9
--- /dev/null
@@ -0,0 +1,89 @@
+/**********************************************************************\r
+ * $Id$\r
+ *\r
+ * PostGIS - Spatial Types for PostgreSQL\r
+ * http://postgis.refractions.net\r
+ * Copyright 2001-2006 Refractions Research Inc.\r
+ *\r
+ * This is free software; you can redistribute and/or modify it under\r
+ * the terms of the GNU General Public Licence. See the COPYING file.\r
+ * \r
+ **********************************************************************/\r
+\r
+/* basic LWCURVEPOLY manipulation */\r
+\r
+#include <stdio.h>\r
+#include <stdlib.h>\r
+#include <string.h>\r
+#include "liblwgeom.h"\r
+\r
+/*#define PGIS_DEBUG_CALLS 1 */\r
+\r
+LWCURVEPOLY *\r
+lwcurvepoly_deserialize(uchar *srl)\r
+{\r
+        LWCURVEPOLY *result;\r
+        LWGEOM_INSPECTED *insp;\r
+        int type = lwgeom_getType(srl[0]);\r
+        int i;\r
+\r
+#ifdef PGIS_DEBUG_CALLS\r
+        lwnotice("lwcurvepoly_deserialize called.");\r
+#endif\r
+\r
+        if(type != CURVEPOLYTYPE)\r
+        {\r
+                lwerror("lwcurvepoly_deserialize called on NON curvepoly: %d",\r
+                        type);\r
+                return NULL;\r
+        }\r
+\r
+        insp = lwgeom_inspect(srl);\r
+\r
+        result = lwalloc(sizeof(LWCURVEPOLY));\r
+        result->type = insp->type;\r
+        result->SRID = insp->SRID;\r
+        result->nrings = insp->ngeometries;\r
+        result->rings = lwalloc(sizeof(LWGEOM *)*insp->ngeometries);\r
+\r
+        if(lwgeom_hasBBOX(srl[0]))\r
+        {\r
+                result->bbox = lwalloc(sizeof(BOX2DFLOAT4));\r
+                memcpy(result->bbox, srl + 1, sizeof(BOX2DFLOAT4));\r
+        }\r
+        else result->bbox = NULL;\r
+\r
+        for(i = 0; i < insp->ngeometries; i++)\r
+        {\r
+                result->rings[i] = lwgeom_deserialize(insp->sub_geoms[i]);\r
+                if(lwgeom_getType(result->rings[i]->type) != CURVETYPE \r
+                        && lwgeom_getType(result->rings[i]->type) != LINETYPE)\r
+                {\r
+                        lwerror("Only Circular curves and Linestrings are currently supported as rings, not %s (%d)", lwgeom_typename(result->rings[i]->type), result->rings[i]->type);\r
+                        lwfree(result);\r
+                        lwfree(insp);\r
+                        return NULL;\r
+                }\r
+                if(TYPE_NDIMS(result->rings[i]->type) != TYPE_NDIMS(result->type))\r
+                {\r
+                        lwerror("Mixed dimensions (curvepoly %d, ring %d)",\r
+                                TYPE_NDIMS(result->type), i, \r
+                                TYPE_NDIMS(result->rings[i]->type));\r
+                        lwfree(result);\r
+                        lwfree(insp);\r
+                        return NULL;\r
+                }\r
+        }\r
+        return result;\r
+}\r
+\r
+LWGEOM *\r
+lwcurvepoly_add(const LWCURVEPOLY *to, uint32 where, const LWGEOM *what)\r
+{\r
+        /* TODO */\r
+        lwerror("lwcurvepoly_add not yet implemented.");\r
+        return NULL;\r
+}\r
+\r
+\r
+\r
index c960fbe3e2f0ce483de8ee3ab8aaf5a6f0c96894..e22548851d4263590ef5467f801d239131571ff3 100644 (file)
@@ -27,7 +27,7 @@ lwgeom_deserialize(uchar *srl)
        int type = lwgeom_getType(srl[0]);
 
 #ifdef PGIS_DEBUG_CALLS
-       lwnotice("lwgeom_deserialize got %s", lwgeom_typename(type));
+       lwnotice("lwgeom_deserialize got %d - %s", type, lwgeom_typename(type));
 #endif
 
        switch (type)
@@ -36,6 +36,8 @@ lwgeom_deserialize(uchar *srl)
                        return (LWGEOM *)lwpoint_deserialize(srl);
                case LINETYPE:
                        return (LWGEOM *)lwline_deserialize(srl);
+                case CURVETYPE:
+                        return (LWGEOM *)lwcurve_deserialize(srl);
                case POLYGONTYPE:
                        return (LWGEOM *)lwpoly_deserialize(srl);
                case MULTIPOINTTYPE:
@@ -46,8 +48,20 @@ lwgeom_deserialize(uchar *srl)
                        return (LWGEOM *)lwmpoly_deserialize(srl);
                case COLLECTIONTYPE:
                        return (LWGEOM *)lwcollection_deserialize(srl);
+                case COMPOUNDTYPE:
+                        return (LWGEOM *)lwcompound_deserialize(srl);
+                case CURVEPOLYTYPE:
+                        return (LWGEOM *)lwcurvepoly_deserialize(srl);
+                case MULTICURVETYPE:
+                        return (LWGEOM *)lwmcurve_deserialize(srl);
+                case MULTISURFACETYPE:
+                        return (LWGEOM *)lwmsurface_deserialize(srl);
                default:
+#ifdef PGIS_DEBUG
+                        lwerror("lwgeom_deserialize: Unknown geometry type: %d", type);
+#else
                        lwerror("Unknown geometry type: %d", type);
+#endif
                        return NULL;
        }
 
@@ -70,13 +84,23 @@ lwgeom_serialize_size(LWGEOM *lwgeom)
                        return lwline_serialize_size((LWLINE *)lwgeom);
                case POLYGONTYPE:
                        return lwpoly_serialize_size((LWPOLY *)lwgeom);
+                case CURVETYPE:
+                        return lwcurve_serialize_size((LWCURVE *)lwgeom);
+                case CURVEPOLYTYPE:
+                case COMPOUNDTYPE:
                case MULTIPOINTTYPE:
                case MULTILINETYPE:
+                case MULTICURVETYPE:
                case MULTIPOLYGONTYPE:
+                case MULTISURFACETYPE:
                case COLLECTIONTYPE:
                        return lwcollection_serialize_size((LWCOLLECTION *)lwgeom);
                default:
+#ifdef PGIS_DEBUG
+                        lwerror("lwgeom_serialize_size: Unknown geometry type: %d", type);
+#else
                        lwerror("Unknown geometry type: %d", type);
+#endif
                        return 0;
        }
 }
@@ -101,15 +125,26 @@ lwgeom_serialize_buf(LWGEOM *lwgeom, uchar *buf, size_t *retsize)
                case POLYGONTYPE:
                        lwpoly_serialize_buf((LWPOLY *)lwgeom, buf, retsize);
                        break;
+                case CURVETYPE:
+                        lwcurve_serialize_buf((LWCURVE *)lwgeom, buf, retsize);
+                        break;
+                case CURVEPOLYTYPE:
+                case COMPOUNDTYPE:
                case MULTIPOINTTYPE:
                case MULTILINETYPE:
+                case MULTICURVETYPE:
                case MULTIPOLYGONTYPE:
+                case MULTISURFACETYPE:
                case COLLECTIONTYPE:
                        lwcollection_serialize_buf((LWCOLLECTION *)lwgeom, buf,
                                retsize);
                        break;
                default:
+#ifdef PGIS_DEBUG
+                        lwerror("lwgeom_serialize_buf: Unknown geometry type: %d", type);
+#else
                        lwerror("Unknown geometry type: %d", type);
+#endif
                        return;
        }
        return;
@@ -191,11 +226,17 @@ lwgeom_compute_box2d_p(LWGEOM *lwgeom, BOX2DFLOAT4 *buf)
                        return lwpoint_compute_box2d_p((LWPOINT *)lwgeom, buf);
                case LINETYPE:
                        return lwline_compute_box2d_p((LWLINE *)lwgeom, buf);
+                case CURVETYPE:
+                        return lwcurve_compute_box2d_p((LWCURVE *)lwgeom, buf);
                case POLYGONTYPE:
                        return lwpoly_compute_box2d_p((LWPOLY *)lwgeom, buf);
+                case COMPOUNDTYPE:
+                case CURVEPOLYTYPE:
                case MULTIPOINTTYPE:
                case MULTILINETYPE:
+                case MULTICURVETYPE:
                case MULTIPOLYGONTYPE:
+                case MULTISURFACETYPE:
                case COLLECTIONTYPE:
                        return lwcollection_compute_box2d_p((LWCOLLECTION *)lwgeom, buf);
        }
@@ -232,6 +273,14 @@ lwgeom_as_lwline(LWGEOM *lwgeom)
        else return NULL;
 }
 
+LWCURVE *
+lwgeom_as_lwcurve(LWGEOM *lwgeom)
+{
+        if( TYPE_GETTYPE(lwgeom->type) == CURVETYPE )
+                return (LWCURVE *)lwgeom;
+        else return NULL;
+}
+
 LWPOLY *
 lwgeom_as_lwpoly(LWGEOM *lwgeom)
 {
@@ -243,7 +292,8 @@ lwgeom_as_lwpoly(LWGEOM *lwgeom)
 LWCOLLECTION *
 lwgeom_as_lwcollection(LWGEOM *lwgeom)
 {
-       if ( TYPE_GETTYPE(lwgeom->type) >= MULTIPOINTTYPE )
+       if ( TYPE_GETTYPE(lwgeom->type) >= MULTIPOINTTYPE 
+            && TYPE_GETTYPE(lwgeom->type) <= COLLECTIONTYPE)
                return (LWCOLLECTION *)lwgeom;
        else return NULL;
 }
@@ -292,11 +342,21 @@ lwgeom_release(LWGEOM *lwgeom)
 #endif
 
        /* Drop bounding box (always a copy) */
-       if ( lwgeom->bbox ) lwfree(lwgeom->bbox);
+       if ( lwgeom->bbox ) {
+#ifdef PGIS_DEBUG
+                lwnotice("lwgeom_release: releasing bbox.");
+#endif
+                lwfree(lwgeom->bbox);
+        }
 
        /* Collection */
        if ( (col=lwgeom_as_lwcollection(lwgeom)) )
        {
+
+#ifdef PGIS_DEBUG
+                lwnotice("lwgeom_release: Releasing collection.");
+#endif
+
                for (i=0; i<col->ngeoms; i++)
                {
                        lwgeom_release(col->geoms[i]);
@@ -361,9 +421,19 @@ lwgeom_add(const LWGEOM *to, uint32 where, const LWGEOM *what)
                        return (LWGEOM *)lwpoint_add((const LWPOINT *)to, where, what);
                case LINETYPE:
                        return (LWGEOM *)lwline_add((const LWLINE *)to, where, what);
+
+                case CURVETYPE:
+                        return (LWGEOM *)lwcurve_add((const LWCURVE *)to, where, what);
+
                case POLYGONTYPE:
                        return (LWGEOM *)lwpoly_add((const LWPOLY *)to, where, what);
 
+                case COMPOUNDTYPE:
+                        return (LWGEOM *)lwcompound_add((const LWCOMPOUND *)to, where, what);
+
+                case CURVEPOLYTYPE:
+                        return (LWGEOM *)lwcurvepoly_add((const LWCURVEPOLY *)to, where, what);
+
                case MULTIPOINTTYPE:
                        return (LWGEOM *)lwmpoint_add((const LWMPOINT *)to,
                                where, what);
@@ -372,10 +442,18 @@ lwgeom_add(const LWGEOM *to, uint32 where, const LWGEOM *what)
                        return (LWGEOM *)lwmline_add((const LWMLINE *)to,
                                where, what);
 
+                case MULTICURVETYPE:
+                        return (LWGEOM *)lwmcurve_add((const LWMCURVE *)to,
+                                where, what);
+
                case MULTIPOLYGONTYPE:
                        return (LWGEOM *)lwmpoly_add((const LWMPOLY *)to,
                                where, what);
 
+                case MULTISURFACETYPE:
+                        return (LWGEOM *)lwmsurface_add((const LWMSURFACE *)to,
+                                where, what);
+
                case COLLECTIONTYPE:
                        return (LWGEOM *)lwcollection_add(
                                (const LWCOLLECTION *)to, where, what);
index db16272c4063df5b93ef80b2d0d85a500d84599a..7c82d334cb1e0bf2f733dc08709133391d186867 100644 (file)
@@ -330,6 +330,13 @@ box3d_union(BOX3D *b1, BOX3D *b2)
 int
 box3d_union_p(BOX3D *b1, BOX3D *b2, BOX3D *ubox)
 {
+
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("box3d_union_p called: (xmin, xmax), (ymin, ymax), (zmin, zmax)");
+        lwnotice("b1: (%.16f, %.16f),(%.16f, %.16f),(%.16f, %.16f)", b1->xmin, b1->xmax, b1->ymin, b1->ymax, b1->zmin, b1->zmax);
+        lwnotice("b2: (%.16f, %.16f),(%.16f, %.16f),(%.16f, %.16f)", b2->xmin, b2->xmax, b2->ymin, b2->ymax, b2->zmin, b2->zmax);
+#endif
+
        if ( (b1 == NULL) && (b2 == NULL) )
        {
                return 0;
@@ -372,7 +379,7 @@ box3d_union_p(BOX3D *b1, BOX3D *b2, BOX3D *ubox)
        else
                ubox->zmax = b2->zmax;
 
-       if (b1->zmin > b2->zmin)
+       if (b1->zmin < b2->zmin)
                ubox->zmin = b1->zmin;
        else
                ubox->zmin = b2->zmin;
@@ -403,7 +410,7 @@ getbox2d_p(uchar *srl, BOX2DFLOAT4 *box)
        uchar *loc;
        BOX3D box3d;
 
-#ifdef PGIS_DEBUG
+#ifdef PGIS_DEBUG_CALLS
        lwnotice("getbox2d_p call");
 #endif
 
@@ -483,10 +490,18 @@ getPoint4d_p(const POINTARRAY *pa, int n, POINT4D *op)
        }
 #endif
 
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("getPoint4d_p called.");
+#endif
+
        /* Get a pointer to nth point offset and zmflag */
        ptr=getPoint_internal(pa, n);
        zmflag=TYPE_GETZM(pa->dims);
 
+#ifdef PGIS_DEBUG
+        lwnotice("ptr %p, zmflag %d", ptr, zmflag);
+#endif
+
        switch (zmflag)
        {
                case 0: /* 2d  */
@@ -513,7 +528,6 @@ getPoint4d_p(const POINTARRAY *pa, int n, POINT4D *op)
                default:
                        lwerror("Unknown ZM flag ??");
        }
-
        return 1;
 
 }
@@ -797,9 +811,9 @@ pointArray_construct(uchar *points, char hasz, char hasm,
 int
 pointArray_ptsize(const POINTARRAY *pa)
 {
-#ifdef PGIS_DEBUG
-       lwnotice("pointArray_ptsize: TYPE_NDIMS(pa->dims)=%x\n",
-               TYPE_NDIMS(pa->dims));
+#ifdef PGIS_DEBUG_CALLS
+       /*lwnotice("pointArray_ptsize: TYPE_NDIMS(pa->dims)=%x\n",
+               TYPE_NDIMS(pa->dims));*/
 #endif
        return sizeof(double)*TYPE_NDIMS(pa->dims);
 }
@@ -841,6 +855,11 @@ int lwgeom_hasZ(uchar type)
 int
 lwgeom_getType(uchar type)
 {
+
+#ifdef PGIS_DEBUG
+        lwnotice("lwgeom_getType %d", type);
+#endif
+
        return (type & 0x0F);
 }
 
@@ -953,7 +972,7 @@ lwgeom_inspect(const uchar *serialized_form)
                loc += 4;
        }
 
-       if ( (type==POINTTYPE) || (type==LINETYPE) || (type==POLYGONTYPE) )
+       if ( (type==POINTTYPE) || (type==LINETYPE) || (type==POLYGONTYPE) || (type == CURVETYPE))
        {
                /* simple geometry (point/line/polygon)-- not multi! */
                result->ngeometries = 1;
@@ -967,6 +986,7 @@ lwgeom_inspect(const uchar *serialized_form)
 
        result->ngeometries = get_uint32(loc);
        loc +=4;
+
 #ifdef PGIS_DEBUG
        lwnotice("lwgeom_inspect: geometry is a collection of %d elements",
                result->ngeometries);
@@ -977,18 +997,22 @@ lwgeom_inspect(const uchar *serialized_form)
        sub_geoms = lwalloc(sizeof(uchar*) * result->ngeometries );
        result->sub_geoms = sub_geoms;
        sub_geoms[0] = (uchar *)loc;
+
 #ifdef PGIS_DEBUG
        lwnotice("subgeom[0] @ %p (+%d)", sub_geoms[0], sub_geoms[0]-serialized_form);
 #endif
+
        for (t=1;t<result->ngeometries; t++)
        {
                /* -1 = entire object */
                int sub_length = lwgeom_size_subgeom(sub_geoms[t-1], -1);
                sub_geoms[t] = sub_geoms[t-1] + sub_length;
+                
 #ifdef PGIS_DEBUG
                lwnotice("subgeom[%d] @ %p (+%d)",
                        t, sub_geoms[t], sub_geoms[0]-serialized_form);
 #endif
+
        }
 
        return result;
@@ -1156,6 +1180,25 @@ lwgeom_getpoly_inspected(LWGEOM_INSPECTED *inspected, int geom_number)
        return lwpoly_deserialize(sub_geom);
 }
 
+/*
+ * 1st geometry has geom_number = 0
+ * if there arent enough geometries, return null.
+ */
+LWGEOM *lwgeom_getgeom_inspected(LWGEOM_INSPECTED *inspected, int geom_number)
+{
+       uchar *sub_geom;
+       uchar type;
+
+       sub_geom = lwgeom_getsubgeometry_inspected(inspected, geom_number);
+
+       if (sub_geom == NULL) return NULL;
+
+       type = lwgeom_getType(sub_geom[0]);
+
+       return lwgeom_deserialize(sub_geom);
+}
+
+
 /*
  * This gets the serialized form of a sub-geometry
  *
@@ -1240,7 +1283,8 @@ lwgeom_getnumgeometries(uchar *serialized_form)
        uchar type = lwgeom_getType((uchar)serialized_form[0]);
        uchar *loc;
 
-       if ( (type==POINTTYPE) || (type==LINETYPE) || (type==POLYGONTYPE) )
+       if ( (type==POINTTYPE) || (type==LINETYPE) || (type==POLYGONTYPE) ||
+            (type==CURVETYPE) || (type==COMPOUNDTYPE) || (type==CURVEPOLYTYPE) )
        {
                return 1;
        }
@@ -1480,13 +1524,26 @@ lwgeom_size(const uchar *serialized_form)
 #endif
                return lwgeom_size_line(serialized_form);
        }
+        else if(type == CURVETYPE)
+        {
+#ifdef PGIS_DEBUG
+                lwnotice("lwgeom_size: is a curve");
+#endif
+                return lwgeom_size_curve(serialized_form);
+        }
        else if (type == POLYGONTYPE)
        {
 #ifdef PGIS_DEBUG
                lwnotice("lwgeom_size: is a polygon");
 #endif
                return lwgeom_size_poly(serialized_form);
-       }
+       } 
+        else if (type == COMPOUNDTYPE)
+        {
+#ifdef PGIS_DEBUG
+                lwnotice("lwgeom_size: is a compound curve");
+#endif
+        }
 
        if ( type == 0 )
        {
@@ -1646,6 +1703,13 @@ lwnotice("compute_serialized_box3d: bbox found");
                return result;
 
        }
+        else if (type == CURVETYPE)
+        {
+                LWCURVE *curve = lwcurve_deserialize(srl);
+                result = lwcurve_compute_box3d(curve);
+                pfree_curve(curve);
+                return result;
+        }
        else if (type == POLYGONTYPE)
        {
                LWPOLY *poly = lwpoly_deserialize(srl);
@@ -1655,7 +1719,9 @@ lwnotice("compute_serialized_box3d: bbox found");
        }
 
        if ( ! ( type == MULTIPOINTTYPE || type == MULTILINETYPE ||
-               type == MULTIPOLYGONTYPE || type == COLLECTIONTYPE ) )
+               type == MULTIPOLYGONTYPE || type == COLLECTIONTYPE ||
+                type == COMPOUNDTYPE || type == CURVEPOLYTYPE ||
+                type == MULTICURVETYPE || type == MULTISURFACETYPE) )
        {
                lwnotice("compute_serialized_box3d called on unknown type %d", type);
                return NULL;
@@ -1747,6 +1813,7 @@ void printPA(POINTARRAY *pa)
        POINT4D pt;
        char *mflag;
 
+
        if ( TYPE_HASM(pa->dims) ) mflag = "M";
        else mflag = "";
 
@@ -2121,7 +2188,7 @@ parse_lwgeom_wkt(char *wkt_input)
                lwalloc, lwerror);
 
 
-#ifdef PGIS_DEBUG
+#ifdef PGIS_DEBUG_CALLS
        lwnotice("parse_lwgeom_wkt with %s",wkt_input);
 #endif
 
index bd8d5e39f4e4c5cb6061118d8b8369bdefea8412..d439e7418105d5e537d97556e078bf19da747559 100644 (file)
@@ -1055,3 +1055,121 @@ Datum LWGEOM_line_locate_point(PG_FUNCTION_ARGS)
 
        PG_RETURN_FLOAT8(ret);
 }
+
+/*******************************************************************************
+ * The following is based on the "Fast Winding Number Inclusion of a Point 
+ * in a Polygon" algorithm by Dan Sunday.
+ * http://www.geometryalgorithms.com/Archive/algorithm_0103/algorithm_0103.htm
+ ******************************************************************************/
+
+/*
+ * returns: >0 for a point to the left of the segment, 
+ *          <0 for a point to the right of the segment,
+ *          0 for a point on the segment
+ */
+double determineSide(POINT2D *seg1, POINT2D *seg2, POINT2D *point)
+{
+        return ((seg2->x-seg1->x)*(point->y-seg1->y)-(point->x-seg1->x)*(seg2->y-seg1->y));
+}
+
+/*
+ * return 0 iff point is outside ring pts
+ */
+int point_in_ring(POINTARRAY *pts, POINT2D *point)
+{
+        int wn = 0;
+        int i;
+        double side;
+        POINT2D seg1;
+        POINT2D seg2;
+
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("point_in_ring called.");
+#endif
+
+        for(i=0; i<pts->npoints-1; i++)
+        {
+                getPoint2d_p(pts, i, &seg1);
+                getPoint2d_p(pts, i+1, &seg2);
+                side = determineSide(&seg1, &seg2, point);
+                /* a point on the boundary of a ring is not contained. */
+                if(fabs(side) < 1e-12) 
+                {
+#ifdef PGIS_DEBUG
+                        lwnotice("point on ring boundary between points %d, %d", i, i+1);
+#endif
+                        return 0;
+                }
+                else if(seg1.y < point->y && seg2.y > point->y && side > 0)
+                        ++wn;
+                else if(seg1.y > point->y && seg2.y < point->y && side < 0)
+                        --wn;
+        }
+#ifdef PGIS_DEBUG
+        lwnotice("returning %d", wn);
+#endif
+        return wn;
+}
+
+/*
+ * return 0 iff point outside polygon
+ */
+int point_in_polygon(LWPOLY *polygon, LWPOINT *point)
+{
+        int i;
+        POINTARRAY *ring;
+        POINT2D pt;
+
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("point_in_polygon called.");
+#endif
+
+        getPoint2d_p(point->point, 0, &pt);
+        /* assume bbox short-circuit has already been attempted */
+        
+        ring = polygon->rings[0];
+        if(point_in_ring(ring, &pt) == 0) 
+        {
+#ifdef PGIS_DEBUG
+                lwnotice("point_in_polygon: outside exterior ring.");
+#endif
+                return 0;
+        }
+
+        for(i=1; i<polygon->nrings; i++)
+        {
+                ring = polygon->rings[i];
+                if(point_in_ring(ring, &pt) != 0) 
+                {
+#ifdef PGIS_DEBUG
+                        lwnotice("point_in_polygon: within hole %d.", i);
+#endif
+                        return 0;
+                }
+        }
+        return 1;
+}
+
+/*
+ * return 0 iff point is outside every polygon
+ */
+int point_in_multipolygon(LWMPOLY *mpolygon, LWPOINT *point)
+{
+        int i;
+
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("point_in_multipolygon called.");
+#endif
+
+        for(i=1; i<mpolygon->ngeoms; i++)
+        {
+                if(point_in_polygon((LWPOLY *)mpolygon->geoms[i], point)!=0) return 1;
+        }
+        return 0;
+}
+
+
+/*******************************************************************************
+ * End of "Fast Winding Number Inclusion of a Point in a Polygon" derivative.
+ ******************************************************************************/
+
index 02130a646d3357ecbe6a3fb432c6f0df845251ac..2c266fa3e1b47daa92087ac8f91a0e51230cd26a 100644 (file)
@@ -470,7 +470,7 @@ Datum LWGEOM_perimeter2d_poly(PG_FUNCTION_ARGS)
 /*
  * Write to already allocated memory 'optr' a 2d version of
  * the given serialized form. 
- * Higher dimensions in input geometry are discarder.
+ * Higher dimensions in input geometry are discarded.
  * Return number bytes written in given int pointer.
  */
 void
@@ -484,6 +484,7 @@ lwgeom_force2d_recursive(uchar *serialized, uchar *optr, size_t *retsize)
        uchar newtypefl;
        LWPOINT *point = NULL;
        LWLINE *line = NULL;
+        LWCURVE *curve = NULL;
        LWPOLY *poly = NULL;
        POINTARRAY newpts;
        POINTARRAY **nrings;
@@ -550,6 +551,34 @@ lwnotice("lwgeom_force2d_recursive returning");
                return;
        }
 
+        if( type == CURVETYPE )
+        {
+                curve = lwcurve_deserialize(serialized);
+#ifdef PGIS_DEBUG
+                elog(NOTICE, "lwgeom_force2d_recursize: it's a curve with %d points", curve->points->npoints);
+#endif
+                TYPE_SETZM(newpts.dims, 0, 0);
+                newpts.npoints = curve->points->npoints;
+                newpts.serialized_pointlist = lwalloc(sizeof(POINT2D)*curve->points->npoints);
+#ifdef PGIS_DEBUG
+elog(NOTICE, "lwgeom_force2d_recursive: %d bytes pointlist allocated", sizeof(POINT2D)*curve->points->npoints);
+#endif
+
+                loc = newpts.serialized_pointlist;
+                for (j=0; j<curve->points->npoints; j++)
+                {
+                        getPoint2d_p(curve->points, j, &p2d);
+                        memcpy(loc, &p2d, sizeof(POINT2D));
+                        loc += sizeof(POINT2D);
+                }
+                curve->points = &newpts;
+                TYPE_SETZM(curve->type, 0, 0);
+                lwcurve_serialize_buf(curve, optr, retsize);
+                lwfree(newpts.serialized_pointlist);
+                lwfree(curve);
+                return;
+        }
+
        if ( type == POLYGONTYPE )
        {
                poly = lwpoly_deserialize(serialized);
@@ -588,7 +617,9 @@ lwnotice("lwgeom_force2d_recursive returning");
        }
 
        if ( type != MULTIPOINTTYPE && type != MULTIPOLYGONTYPE &&
-               type != MULTILINETYPE && type != COLLECTIONTYPE )
+               type != MULTILINETYPE && type != COLLECTIONTYPE &&
+                type != COMPOUNDTYPE && type != CURVEPOLYTYPE &&
+                type != MULTICURVETYPE && type != MULTISURFACETYPE)
        {
                lwerror("lwgeom_force2d_recursive: unknown geometry: %d",
                        type);
@@ -696,6 +727,7 @@ lwgeom_force3dz_recursive(uchar *serialized, uchar *optr, size_t *retsize)
        int type;
        LWPOINT *point = NULL;
        LWLINE *line = NULL;
+        LWCURVE *curve = NULL;
        LWPOLY *poly = NULL;
        POINTARRAY newpts;
        POINTARRAY **nrings;
@@ -752,6 +784,31 @@ elog(NOTICE, "lwgeom_force3dz_recursive: it's a line, size:%d", *retsize);
                return;
        }
 
+        if ( type == CURVETYPE )
+        {
+                curve = lwcurve_deserialize(serialized);
+#ifdef PGIS_DEBUG
+                elog(NOTICE, "lwgeom_force3dz_recursize: it's a curve");
+#endif
+                TYPE_SETZM(newpts.dims, 1, 0);
+                newpts.npoints = curve->points->npoints;
+                newpts.serialized_pointlist = lwalloc(sizeof(POINT3DZ)*curve->points->npoints);
+                loc = newpts.serialized_pointlist;
+                for (j=0; j<curve->points->npoints; j++)
+                {
+                        getPoint3dz_p(curve->points, j, &point3dz);
+                        memcpy(loc, &point3dz, sizeof(POINT3DZ));
+                        loc+=sizeof(POINT3DZ);
+                }
+                curve->points = &newpts;
+                TYPE_SETZM(curve->type, 1, 0);
+                lwcurve_serialize_buf(curve, optr, retsize);
+#ifdef PGIS_DEBUG
+                elog(NOTICE, "lwgeom_force3dz_recursive: it's a curve, size:%d", *retsize);
+#endif
+                return;
+        }
+
        if ( type == POLYGONTYPE )
        {
                poly = lwpoly_deserialize(serialized);
@@ -864,6 +921,7 @@ lwgeom_force3dm_recursive(uchar *serialized, uchar *optr, size_t *retsize)
        uchar newtypefl;
        LWPOINT *point = NULL;
        LWLINE *line = NULL;
+        LWCURVE *curve = NULL;
        LWPOLY *poly = NULL;
        POINTARRAY newpts;
        POINTARRAY **nrings;
@@ -930,6 +988,31 @@ lwnotice("lwgeom_force3dm_recursive returning");
                return;
        }
 
+        if ( type == CURVETYPE )
+        {
+                curve = lwcurve_deserialize(serialized);
+#ifdef PGIS_DEBUG
+                elog(NOTICE, "lwgeom_force3dm_recursize: it's a curve with %d points", curve->points->npoints);
+#endif
+                TYPE_SETZM(newpts.dims, 0, 1);
+                newpts.npoints = curve->points->npoints;
+                newpts.serialized_pointlist = lwalloc(sizeof(POINT3DM)*curve->points->npoints);
+
+                loc = newpts.serialized_pointlist;
+                for (j=0; j<curve->points->npoints; j++)
+                {
+                        getPoint3dm_p(curve->points, j, &p3dm);
+                        memcpy(loc, &p3dm, sizeof(POINT3DM));
+                        loc+=sizeof(POINT3DM);
+                }
+                curve->points = &newpts;
+                TYPE_SETZM(curve->type, 0, 1);
+                lwcurve_serialize_buf(curve, optr, retsize);
+                lwfree(newpts.serialized_pointlist);
+                lwfree(curve);
+                return;
+        }
+
        if ( type == POLYGONTYPE )
        {
                poly = lwpoly_deserialize(serialized);
@@ -968,7 +1051,9 @@ lwnotice("lwgeom_force3dm_recursive returning");
        }
 
        if ( type != MULTIPOINTTYPE && type != MULTIPOLYGONTYPE &&
-               type != MULTILINETYPE && type != COLLECTIONTYPE )
+               type != MULTILINETYPE && type != COLLECTIONTYPE &&
+                type != COMPOUNDTYPE && type != CURVEPOLYTYPE &&
+                type != MULTICURVETYPE && type != MULTISURFACETYPE)
        {
                lwerror("lwgeom_force3dm_recursive: unknown geometry: %d",
                        type);
@@ -1076,6 +1161,7 @@ lwgeom_force4d_recursive(uchar *serialized, uchar *optr, size_t *retsize)
        int type;
        LWPOINT *point = NULL;
        LWLINE *line = NULL;
+        LWCURVE *curve = NULL;
        LWPOLY *poly = NULL;
        POINTARRAY newpts;
        POINTARRAY **nrings;
@@ -1132,6 +1218,28 @@ elog(NOTICE, "lwgeom_force4d_recursive: it's a line, size:%d", *retsize);
                return;
        }
 
+        if ( type == CURVETYPE )
+        {
+                curve = lwcurve_deserialize(serialized);
+                TYPE_SETZM(newpts.dims, 1, 1);
+                newpts.npoints = curve->points->npoints;
+                newpts.serialized_pointlist = lwalloc(sizeof(POINT4D)*curve->points->npoints);
+                loc = newpts.serialized_pointlist;
+                for (j=0; j<curve->points->npoints; j++)
+                {
+                        getPoint4d_p(curve->points, j, &p4d);
+                        memcpy(loc, &p4d, sizeof(POINT4D));
+                        loc+=sizeof(POINT4D);
+                }
+                curve->points = &newpts;
+                TYPE_SETZM(curve->type, 1, 1);
+                lwcurve_serialize_buf(curve, optr, retsize);
+#ifdef PGIS_DEBUG
+                elog(NOTICE, "lwgeom_force4d_recursive: it's a curve, size:%d", *retsize);
+#endif
+                return;
+        }
+
        if ( type == POLYGONTYPE )
        {
                poly = lwpoly_deserialize(serialized);
@@ -1367,6 +1475,10 @@ Datum LWGEOM_force_collection(PG_FUNCTION_ARGS)
        int SRID;
        BOX2DFLOAT4 *bbox;
 
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("LWGEOM_force_collection called");
+#endif
+
        /*
         * This funx is a no-op only if a bbox cache is already present
         * in input. If bbox cache is not there we'll need to handle
@@ -1421,6 +1533,10 @@ Datum LWGEOM_force_multi(PG_FUNCTION_ARGS)
        int SRID=-1;
        BOX2DFLOAT4 *box;
 
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("LWGEOM_force_multi called");
+#endif
+
        /*
         * This funx is a no-op only if a bbox cache is already present
         * in input. If bbox cache is not there we'll need to handle
@@ -1561,6 +1677,10 @@ Datum LWGEOM_longitude_shift(PG_FUNCTION_ARGS)
        LWGEOM *lwgeom;
        PG_LWGEOM *ret;
 
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("LWGEOM_longitude_shift called.");
+#endif
+
        geom = (PG_LWGEOM *)PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(0));
        lwgeom = pglwgeom_deserialize(geom);
 
@@ -1624,6 +1744,10 @@ Datum LWGEOM_collect(PG_FUNCTION_ARGS)
        BOX2DFLOAT4 *box=NULL;
        int SRID;
 
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("LWGEOM_collect called.");
+#endif
+
        /* return null if both geoms are null */
        if ( (geom1_ptr == NULL) && (geom2_ptr == NULL) )
        {
@@ -1867,6 +1991,10 @@ Datum LWGEOM_collect_garray(PG_FUNCTION_ARGS)
        size_t offset;
        BOX2DFLOAT4 *box=NULL;
 
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("LWGEOM_collect_garray called.");
+#endif
+
 #ifdef PGIS_DEBUG
        elog(NOTICE, "LWGEOM_collect_garray called");
 #endif
@@ -2006,6 +2134,10 @@ Datum LWGEOM_line_from_mpoint(PG_FUNCTION_ARGS)
        LWLINE *lwline;
        LWMPOINT *mpoint;
 
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("LWGEOM_line_from_mpoint called.");
+#endif
+
 #ifdef PGIS_DEBUG
        elog(NOTICE, "LWGEOM_line_from_mpoint called");
 #endif
@@ -2055,6 +2187,10 @@ Datum LWGEOM_makeline_garray(PG_FUNCTION_ARGS)
        size_t offset;
        int SRID=-1;
 
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("LWGEOM_makeline_garray called.");
+#endif
+
 #ifdef PGIS_DEBUG
        elog(NOTICE, "LWGEOM_makeline_garray called");
 #endif
@@ -2159,6 +2295,10 @@ Datum LWGEOM_makeline(PG_FUNCTION_ARGS)
        LWPOINT *lwpoints[2];
        LWLINE *outline;
 
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("LWGEOM_makeline called.");
+#endif
+
 #ifdef PGIS_DEBUG
        elog(NOTICE, "LWGEOM_makeline called");
 #endif
@@ -2208,6 +2348,10 @@ Datum LWGEOM_makepoly(PG_FUNCTION_ARGS)
        unsigned int i;
        size_t offset=0;
 
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("LWGEOM_makepoly called.");
+#endif
+
 #ifdef PGIS_DEBUG
        elog(NOTICE, "LWGEOM_makepoly called");
 #endif
@@ -2269,6 +2413,10 @@ Datum LWGEOM_expand(PG_FUNCTION_ARGS)
        int SRID;
        PG_LWGEOM *result;
 
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("LWGEOM_expand called.");
+#endif
+
        /* get geometry box  */
        if ( ! getbox2d_p(SERIALIZED_FORM(geom), &box) )
        {
@@ -2407,6 +2555,10 @@ Datum LWGEOM_segmentize2d(PG_FUNCTION_ARGS)
        double dist;
        LWGEOM *inlwgeom, *outlwgeom;
 
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("LWGEOM_segmentize2d called");
+#endif
+
        ingeom = (PG_LWGEOM *)PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
        dist = PG_GETARG_FLOAT8(1);
 
@@ -2438,6 +2590,10 @@ Datum LWGEOM_reverse(PG_FUNCTION_ARGS)
        PG_LWGEOM *geom;
        LWGEOM *lwgeom;
 
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("LWGEOM_reverse called");
+#endif
+
        geom = (PG_LWGEOM *)PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(0));
 
        lwgeom = lwgeom_deserialize(SERIALIZED_FORM(geom));
@@ -2455,6 +2611,10 @@ Datum LWGEOM_forceRHR_poly(PG_FUNCTION_ARGS)
        PG_LWGEOM *ingeom, *outgeom;
        LWGEOM *lwgeom;
 
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("LWGEOM_forceRHR_poly called");
+#endif
+
        ingeom = (PG_LWGEOM *)PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(0));
 
        lwgeom = lwgeom_deserialize(SERIALIZED_FORM(ingeom));
@@ -2475,6 +2635,10 @@ Datum LWGEOM_noop(PG_FUNCTION_ARGS)
        PG_LWGEOM *in, *out;
        LWGEOM *lwgeom;
 
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("LWGEOM_noop called");
+#endif
+
        in = (PG_LWGEOM *)PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
 
        lwgeom = lwgeom_deserialize(SERIALIZED_FORM(in));
@@ -2585,6 +2749,10 @@ Datum LWGEOM_makepoint(PG_FUNCTION_ARGS)
        LWPOINT *point;
        PG_LWGEOM *result;
 
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("LWGEOM_makepoint called");
+#endif
+
        x = PG_GETARG_FLOAT8(0);
        y = PG_GETARG_FLOAT8(1);
 
@@ -2616,6 +2784,10 @@ Datum LWGEOM_makepoint3dm(PG_FUNCTION_ARGS)
        LWPOINT *point;
        PG_LWGEOM *result;
 
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("LWGEOM_makepoint3dm called.");
+#endif
+
        x = PG_GETARG_FLOAT8(0);
        y = PG_GETARG_FLOAT8(1);
        m = PG_GETARG_FLOAT8(2);
@@ -2634,6 +2806,10 @@ Datum LWGEOM_addpoint(PG_FUNCTION_ARGS)
        LWLINE *line, *outline;
        int where = -1;
 
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("LWGEOM_addpoint called.");
+#endif
+
        pglwg1 = (PG_LWGEOM *)PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
        pglwg2 = (PG_LWGEOM *)PG_DETOAST_DATUM(PG_GETARG_DATUM(1));
 
@@ -2686,6 +2862,10 @@ Datum LWGEOM_removepoint(PG_FUNCTION_ARGS)
        LWLINE *line, *outline;
        unsigned int which;
 
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("LWGEOM_removepoint called.");
+#endif
+
        pglwg1 = (PG_LWGEOM *)PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
        which = PG_GETARG_INT32(1);
 
@@ -2732,6 +2912,10 @@ Datum LWGEOM_setpoint_linestring(PG_FUNCTION_ARGS)
        POINT4D newpoint;
        unsigned int which;
 
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("LWGEOM_setpoint_linestring called.");
+#endif
+
        /* we copy input as we're going to modify it */
        pglwg1 = (PG_LWGEOM *)PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(0));
 
@@ -3102,6 +3286,10 @@ Datum LWGEOM_affine(PG_FUNCTION_ARGS)
        LWGEOM *tmp;
        uchar *srl = SERIALIZED_FORM(geom);
 
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("LWGEOM_affine called.");
+#endif
+
        double afac =  PG_GETARG_FLOAT8(1);
        double bfac =  PG_GETARG_FLOAT8(2);
        double cfac =  PG_GETARG_FLOAT8(3);
index b381fce02da650ee06a5790adb7a0364096c3d8a..3ab25e80497e8f051fafcad52ec0c8fdb2b055de 100644 (file)
@@ -1241,6 +1241,10 @@ Datum isvalid(PG_FUNCTION_ARGS)
        bool result;
        Geometry *g1;
 
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("isvalid called.");
+#endif
+
 #ifdef PROFILE
        profstart(PROF_QRUN);
 #endif
@@ -2162,7 +2166,9 @@ Datum isring(PG_FUNCTION_ARGS)
 
        geom = (PG_LWGEOM *)PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
 
-       if (lwgeom_getType(geom->type) != LINETYPE)
+       if (lwgeom_getType(geom->type) != LINETYPE &&
+            lwgeom_getType(geom->type) != CURVETYPE &&
+            lwgeom_getType(geom->type) != COMPOUNDTYPE)
        {
                elog(ERROR,"isring() should only be called on a LINE");
        }
@@ -2470,6 +2476,7 @@ LWGEOM2GEOS(LWGEOM *lwgeom)
 {
        uint32 i;
        Geometry **collected;
+        LWGEOM *tmp;
        LWCOLLECTION *col;
        if ( ! lwgeom ) return NULL;
 
@@ -2477,6 +2484,16 @@ LWGEOM2GEOS(LWGEOM *lwgeom)
        lwnotice("LWGEOM2GEOS: got lwgeom[%p]", lwgeom);
 #endif
 
+        if(has_arc(lwgeom))
+        {
+#ifdef PGIS_DEBUG_CALLS
+                lwnotice("LWGEOM2GEOS: arced geometry found.");
+#endif
+                tmp = lwgeom;
+                lwgeom = lwgeom_segmentize(tmp, 32);
+                lwgeom_release(tmp);
+        }
+
        switch (TYPE_GETTYPE(lwgeom->type))
        {
                case POINTTYPE:
@@ -2515,8 +2532,12 @@ LWGEOM2GEOS(LWGEOM *lwgeom)
                                TYPE_HASZ(col->type));
 
                default:
+#ifdef PGIS_DEBUG
+                        lwerror("LWGEOM2GEOS: Unknown geometry type: %d", TYPE_GETTYPE(lwgeom->type));
+#else
                        lwerror("Unknown geometry type: %d",
                                TYPE_GETTYPE(lwgeom->type));
+#endif
                        return NULL;
        }
 
index 7ad2c7011056a34485b5b7aa6d6e55b3197d83c1..6a7b9740c117687a16147637d445a881488b5c46 100644 (file)
@@ -1339,7 +1339,8 @@ Datum overlaps(PG_FUNCTION_ARGS)
        PG_RETURN_BOOL(result);
 }
 
-
+int point_in_polygon(LWPOLY *polygon, LWPOINT *point);
+int point_in_multipolygon(LWMPOLY *mpolygon, LWPOINT *point);
 
 PG_FUNCTION_INFO_V1(contains);
 Datum contains(PG_FUNCTION_ARGS)
@@ -1349,6 +1350,10 @@ Datum contains(PG_FUNCTION_ARGS)
        GEOSGeom g1,g2;
        bool result;
        BOX2DFLOAT4 box1, box2;
+        int type1, type2;
+        LWPOLY *poly;
+        /* LWMPOLY *mpoly; */
+        LWPOINT *point;
 
 #ifdef PROFILE
        profstart(PROF_QRUN);
@@ -1373,7 +1378,72 @@ Datum contains(PG_FUNCTION_ARGS)
                if ( box2.ymin < box1.ymin ) PG_RETURN_BOOL(FALSE);
                if ( box2.ymax > box1.ymax ) PG_RETURN_BOOL(FALSE);
        }
-
+        /*
+         * short-circuit 2: if geom2 is a point and geom1 is a polygon
+         * call the point-in-polygon function.
+         */
+        type1 = lwgeom_getType((uchar)SERIALIZED_FORM(geom1)[0]);
+        type2 = lwgeom_getType((uchar)SERIALIZED_FORM(geom2)[0]);
+        if(type1 == POLYGONTYPE && type2 == POINTTYPE)
+        {
+#ifdef PGIS_DEBUG
+                lwnotice("Point in Polygon test requested...short-circuiting.");
+#endif
+                poly = lwpoly_deserialize(SERIALIZED_FORM(geom1));
+                point = lwpoint_deserialize(SERIALIZED_FORM(geom2));
+#ifdef PGIS_DEBUG
+                lwnotice("Precall point_in_polygon %p, %p", poly, point);
+#endif
+                if(point_in_polygon(poly, point) == 0)
+                {
+                       PG_FREE_IF_COPY(geom1, 0);
+                       PG_FREE_IF_COPY(geom2, 1);
+                        lwgeom_release((LWGEOM *)poly);
+                        lwgeom_release((LWGEOM *)point);
+                        PG_RETURN_BOOL(FALSE);
+                }
+                else
+                {
+                        PG_FREE_IF_COPY(geom1, 0);
+                        PG_FREE_IF_COPY(geom2, 1);
+                        lwgeom_release((LWGEOM *)poly);
+                        lwgeom_release((LWGEOM *)point);
+                        PG_RETURN_BOOL(TRUE);
+                }
+        } 
+        /* Not yet functional 
+        else if(type1 == MULTIPOLYGONTYPE && type2 == POINTTYPE)
+        {
+#ifdef PGIS_DEBUG
+                lwnotice("Point in MultiPolygon test requested...short-circuiting.");
+#endif
+                mpoly = lwmpoly_deserialize(SERIALIZED_FORM(geom1));
+                point = lwpoint_deserialize(SERIALIZED_FORM(geom2));
+                if(point_in_multipolygon(mpoly, point) == 0)
+                {
+                        PG_FREE_IF_COPY(geom1, 0);
+                        PG_FREE_IF_COPY(geom2, 1);
+                        lwgeom_release((LWGEOM *)mpoly);
+                        lwgeom_release((LWGEOM *)point);
+                        PG_RETURN_BOOL(FALSE);
+                }
+                else
+                {
+                        PG_FREE_IF_COPY(geom1, 0);
+                        PG_FREE_IF_COPY(geom2, 1);
+                        lwgeom_release((LWGEOM *)mpoly);
+                        lwgeom_release((LWGEOM *)point);
+                        PG_RETURN_BOOL(TRUE);
+                }
+        }
+        */
+        else 
+        {
+#ifdef PGIS_DEBUG
+                lwnotice("Contains: type1: %d, type2: %d", type1, type2);
+#endif
+        }
+        
        initGEOS(lwnotice, lwnotice);
 
 #ifdef PROFILE
@@ -1428,6 +1498,9 @@ Datum within(PG_FUNCTION_ARGS)
        GEOSGeom g1,g2;
        bool result;
        BOX2DFLOAT4 box1, box2;
+        LWPOLY *poly;
+        LWPOINT *point;
+        int type1, type2;
 
 #ifdef PROFILE
        profstart(PROF_QRUN);
@@ -1452,6 +1525,36 @@ Datum within(PG_FUNCTION_ARGS)
                if ( box1.ymin < box2.ymin ) PG_RETURN_BOOL(FALSE);
                if ( box1.ymax > box2.ymax ) PG_RETURN_BOOL(FALSE);
        }
+        /*
+         * short-circuit 2: if geom1 is a point and geom2 is a polygon
+         * call the point-in-polygon function.
+         */
+        type1 = lwgeom_getType((uchar)SERIALIZED_FORM(geom1)[0]);
+        type2 = lwgeom_getType((uchar)SERIALIZED_FORM(geom2)[0]);
+        if(type1 == POINTTYPE && type2 == POLYGONTYPE)
+        {
+#ifdef PGIS_DEBUG
+                lwnotice("Point in Polygon test requested...short-circuiting.");
+#endif
+                point = lwpoint_deserialize(SERIALIZED_FORM(geom1));
+                poly = lwpoly_deserialize(SERIALIZED_FORM(geom2));
+                if(point_in_polygon(poly, point) == 0)
+                {
+                       PG_FREE_IF_COPY(geom1, 0);
+                       PG_FREE_IF_COPY(geom2, 1);
+                        lwgeom_release((LWGEOM *)poly);
+                        lwgeom_release((LWGEOM *)point);
+                        PG_RETURN_BOOL(FALSE);
+                }
+                else
+                {
+                        PG_FREE_IF_COPY(geom1, 0);
+                        PG_FREE_IF_COPY(geom2, 1);
+                        lwgeom_release((LWGEOM *)poly);
+                        lwgeom_release((LWGEOM *)point);
+                        PG_RETURN_BOOL(TRUE);
+                }
+        }
 
        initGEOS(lwnotice, lwnotice);
 
@@ -1766,7 +1869,7 @@ Datum disjoint(PG_FUNCTION_ARGS)
                if ( box2.xmax < box1.xmin ) PG_RETURN_BOOL(TRUE);
                if ( box2.xmin > box1.xmax ) PG_RETURN_BOOL(TRUE);
                if ( box2.ymax < box1.ymin ) PG_RETURN_BOOL(TRUE);
-               if ( box2.ymin > box2.ymax ) PG_RETURN_BOOL(TRUE);
+               if ( box2.ymin > box1.ymax ) PG_RETURN_BOOL(TRUE);
        }
 
        initGEOS(lwnotice, lwnotice);
index b4da32c89c9a1d0f8b8fea589686f7f7fe1d9d4f..3f904130e1558f612259630d4206ae6e18d736e9 100644 (file)
@@ -122,11 +122,19 @@ pglwgeom_serialize(LWGEOM *in)
 #endif
 
        size = lwgeom_serialize_size(in) + VARHDRSZ;
-       /* lwnotice("lwgeom_serialize_size returned %d", size-VARHDRSZ); */
+
+#ifdef PGIS_DEBUG
+       lwnotice("lwgeom_serialize_size returned %d", size-VARHDRSZ);
+#endif
+
        result = palloc(size);
        result->size = (size);
        lwgeom_serialize_buf(in, SERIALIZED_FORM(result), &size);
 
+#ifdef PGIS_DEBUG
+        lwnotice("pglwgeom_serialize: serialized size: %d, computed size: %d", size, result->size-VARHDRSZ);
+#endif
+
 #if PARANOIA_LEVEL > 0
        if ( size != result->size-VARHDRSZ )
        {
index 2d71aac2e9b390f1fed1888b74df3a9ffd9bd1a8..c0aaca9c81972aaad27fc710731c71c7e08d17b3 100644 (file)
@@ -205,9 +205,9 @@ distance_ellipse(double lat1, double long1,
        /*result2 =  distance_sphere_method(lat1, long1,lat2,long2, sphere);*/
 
 #ifdef PGIS_DEBUG
-       elog(NOTICE, "delta = %lf, skae says: %.15lf,2 circle says: %.15lf",
+       /*elog(NOTICE, "delta = %lf, skae says: %.15lf,2 circle says: %.15lf",
                (result2-result),result,result2);
-       elog(NOTICE,"2 circle says: %.15lf",result2);
+       elog(NOTICE,"2 circle says: %.15lf",result2);*/
 #endif
 
        if (result != result)  /* NaN check
diff --git a/lwgeom/lwgeom_sqlmm.c b/lwgeom/lwgeom_sqlmm.c
new file mode 100644 (file)
index 0000000..fa75c36
--- /dev/null
@@ -0,0 +1,87 @@
+/**********************************************************************\r
+ * $Id$\r
+ *\r
+ * PostGIS - Spatial Types for PostgreSQL\r
+ * http://postgis.refractions.net\r
+ * Copyright 2001-2006 Refractions Research Inc.\r
+ *\r
+ * This is free software; you can redistribute and/or modify it under\r
+ * the terms of the GNU General Public Licence. See the COPYING file.\r
+ * \r
+ **********************************************************************/\r
+\r
+#include <stdio.h>\r
+#include <stdlib.h>\r
+#include <stdarg.h>\r
+#include <string.h>\r
+#include <math.h>\r
+\r
+#include "postgres.h"\r
+#include "liblwgeom.h"\r
+#include "fmgr.h"\r
+#include "wktparse.h"\r
+#include "lwgeom_pg.h"\r
+\r
+/*\r
+ * Tolerance used to determine equality.\r
+ */\r
+#define EPSILON_SQLMM 1e-8\r
+\r
+/*\r
+ * Determines the center of the circle defined by the three given points.\r
+ * In the event the circle is complete, the midpoint of the segment defined\r
+ * by the first and second points is returned.  If the points are colinear,\r
+ * as determined by equal slopes, then NULL is returned.  If the interior\r
+ * point is coincident with either end point, they are taken as colinear.\r
+ */\r
+double\r
+lwcircle_center(POINT4D *p1, POINT4D *p2, POINT4D *p3, POINT4D **result)\r
+{\r
+        POINT4D *c;\r
+        double cx, cy, cr;\r
+        double temp, bc, cd, det;\r
+        \r
+#ifdef PGIS_DEBUG_CALLS\r
+        lwnotice("lwcircle_center called (%.16f, %.16f), (%.16f, %.16f), (%.16f, %.16f).", p1->x, p1->y, p2->x, p2->y, p3->x, p3->y);\r
+#endif\r
+\r
+        /* Closed circle */\r
+        if(fabs(p1->x - p3->x) < EPSILON_SQLMM\r
+                        && fabs(p1->y - p3->y) < EPSILON_SQLMM)\r
+        {\r
+                cx = p1->x + (p2->x - p1->x) / 2.0;\r
+                cy = p1->y + (p2->y - p1->y) / 2.0;\r
+                c = lwalloc(sizeof(POINT2D));\r
+                c->x = cx;\r
+                c->y = cy;\r
+                *result = c;\r
+                cr = sqrt((cx-p1->x)*(cx-p1->x)+(cy-p1->y)*(cy-p1->y));\r
+                return cr;\r
+        }\r
+\r
+        temp = p2->x*p2->x + p2->y*p2->y;\r
+        bc = (p1->x*p1->x + p1->y*p1->y - temp) / 2.0;\r
+        cd = (temp - p3->x*p3->x - p3->y*p3->y) / 2.0;\r
+        det = (p1->x - p2->x)*(p2->y - p3->y)-(p2->x - p3->x)*(p1->y - p2->y);\r
+\r
+        /* Check colinearity */\r
+        if(fabs(det) < EPSILON_SQLMM)\r
+        {\r
+                *result = NULL;\r
+                return -1.0;\r
+        }\r
+\r
+        det = 1.0 / det;\r
+        cx = (bc*(p2->y - p3->y)-cd*(p1->y - p2->y))*det;\r
+        cy = ((p1->x - p2->x)*cd-(p2->x - p3->x)*bc)*det;\r
+        c = lwalloc(sizeof(POINT4D));\r
+        c->x = cx;\r
+        c->y = cy;\r
+        *result = c;\r
+        cr = sqrt((cx-p1->x)*(cx-p1->x)+(cy-p1->y)*(cy-p1->y));\r
+        return cr;\r
+}\r
+\r
+/*******************************************************************************\r
+ * End PG_FUNCTIONs\r
+ ******************************************************************************/\r
index 4b349e9d1ff372fb6a5f9021dae6b6c133aa7b48..57517a06cf08f2ddd725aed1153a54979b78a0e3 100644 (file)
@@ -93,6 +93,12 @@ struct {
 tuple* free_list=0;
 int minpoints;
 int checkclosed;
+
+/*
+ * This inicates if the number of points in the geometry is required to
+ * be odd (one) or even (zero, currently not enforced) or whatever (-one)
+ */
+int isodd;
 double *first_point=NULL;
 double *last_point=NULL;
 
@@ -126,10 +132,15 @@ void write_count(tuple* this,output_state* out);
 void write_type_count(tuple* this,output_state* out);
 void alloc_point(void);
 void alloc_linestring(void);
+void alloc_linestring_closed(void);
+void alloc_circularstring(void);
+void alloc_circularstring_closed(void);
 void alloc_polygon(void);
 void alloc_multipoint(void);
 void alloc_multilinestring(void);
+void alloc_multicurve(void);
 void alloc_multipolygon(void);
+void alloc_multisurface(void);
 void alloc_geomertycollection(void);
 void alloc_counter(void);
 void alloc_empty(void);
@@ -194,7 +205,6 @@ alloc_tuple(output_func of,size_t size)
        }
 
        the_geom.alloc_size += size;
-
        return ret;
 }
 
@@ -234,6 +244,11 @@ inc_num(void)
 void
 alloc_stack_tuple(int type,output_func of,size_t size)
 {
+
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("alloc_stack_tuple %d, %d", type, size);
+#endif
+
        tuple*  p;
        inc_num();
 
@@ -257,6 +272,9 @@ popc(void)
        if ( the_geom.stack->uu.nn.num < minpoints){
                error("geometry requires more points");
        }
+        if(isodd != -1 && the_geom.stack->uu.nn.num % 2 != isodd) {
+                error("geometry must have an odd number of points");
+        }
        if ( checkclosed && first_point && last_point) {
                if ( memcmp(first_point, last_point,
                        sizeof(double)*the_geom.ndims) )
@@ -271,10 +289,20 @@ popc(void)
 void
 check_dims(int num)
 {
+
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("check_dims the_geom.ndims = %d, num = %d", the_geom.ndims, num);
+#endif
+
        if( the_geom.ndims != num){
                if (the_geom.ndims) {
                        error("Can not mix dimensionality in a geometry");
                } else {
+
+#ifdef PGIS_DEBUG
+                        lwnotice("check_dims: setting dim %d", num);
+#endif
+
                        the_geom.ndims = num;
                        if ( num > 2 ) the_geom.hasZ = 1;
                        if ( num > 3 ) the_geom.hasM = 1;
@@ -342,12 +370,22 @@ WRITE_DOUBLES(output_state* out,double* points, int cnt)
 void
 write_size(tuple* this,output_state* out)
 {
+
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("write_size");
+#endif
+
        WRITE_INT4_REAL(out,the_geom.alloc_size);
 }
 
 void
 alloc_lwgeom(int srid)
 {
+
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("alloc_lwgeom %d", srid);
+#endif
+
        the_geom.srid=srid;
        the_geom.alloc_size=0;
        the_geom.stack=NULL;
@@ -407,6 +445,11 @@ write_point_4i(tuple* this,output_state* out)
 void
 alloc_point_2d(double x,double y)
 {
+
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("alloc_point_2d %f,%f", x, y);
+#endif
+
        tuple* p = alloc_tuple(write_point_2,the_geom.lwgi?8:16);
        p->uu.points[0] = x;
        p->uu.points[1] = y;
@@ -425,6 +468,11 @@ alloc_point_2d(double x,double y)
 void
 alloc_point_3d(double x,double y,double z)
 {
+
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("alloc_point_3d %f, %f, %f", x, y, z);
+#endif
+
        tuple* p = alloc_tuple(write_point_3,the_geom.lwgi?12:24);
        p->uu.points[0] = x;
        p->uu.points[1] = y;
@@ -444,6 +492,11 @@ alloc_point_3d(double x,double y,double z)
 void
 alloc_point_4d(double x,double y,double z,double m)
 {
+
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("alloc_point_4d %f, %f, %f, %f", x, y, z, m);
+#endif
+
        tuple* p = alloc_tuple(write_point_4,the_geom.lwgi?16:32);
        p->uu.points[0] = x;
        p->uu.points[1] = y;
@@ -508,6 +561,11 @@ write_type_count(tuple* this,output_state* out)
 void
 alloc_point(void)
 {
+
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("alloc_point");
+#endif
+
        if( the_geom.lwgi)
                alloc_stack_tuple(POINTTYPEI,write_type,1);
        else
@@ -515,11 +573,17 @@ alloc_point(void)
 
        minpoints=1;
        checkclosed=0;
+        isodd=-1;
 }
 
 void
 alloc_linestring(void)
 {
+
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("alloc_linestring");
+#endif
+
        if( the_geom.lwgi)
                alloc_stack_tuple(LINETYPEI,write_type,1);
        else
@@ -527,11 +591,53 @@ alloc_linestring(void)
 
        minpoints=2;
        checkclosed=0;
+        isodd=-1;
+}
+
+void alloc_linestring_closed(void)
+{
+
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("alloc_linestring_closed called.");
+#endif
+
+        alloc_linestring();
+        checkclosed=1;
+}
+
+void
+alloc_circularstring(void)
+{
+
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("alloc_circularstring");
+#endif
+
+        alloc_stack_tuple(CURVETYPE,write_type,1);
+        minpoints=3;
+        checkclosed=0;
+        isodd=1;
+}
+
+void alloc_circularstring_closed(void)
+{
+      
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("alloc_circularstring_closed");
+#endif
+
+        alloc_circularstring();
+        checkclosed=1;
 }
 
 void
 alloc_polygon(void)
 {
+
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("alloc_polygon");
+#endif
+
        if( the_geom.lwgi)
                alloc_stack_tuple(POLYGONTYPEI, write_type,1);
        else
@@ -539,41 +645,120 @@ alloc_polygon(void)
 
        minpoints=3;
        checkclosed=1;
+        isodd=-1;
+
+}
+
+void
+alloc_curvepolygon(void)
+{
+
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("alloc_curvepolygon called.");
+#endif
+
+        alloc_stack_tuple(CURVEPOLYTYPE, write_type, 1);
+        minpoints=3;
+        checkclosed=1;
+        isodd=-1;
+}
+
+void
+alloc_compoundcurve(void)
+{
+
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("alloc_compoundcurve called.");
+#endif
+
+        alloc_stack_tuple(COMPOUNDTYPE, write_type, 1);
 }
 
 void
 alloc_multipoint(void)
 {
+
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("alloc_multipoint");
+#endif 
+
        alloc_stack_tuple(MULTIPOINTTYPE,write_type,1);
 }
 
 void
 alloc_multilinestring(void)
 {
+
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("alloc_multilinestring");
+#endif
+
        alloc_stack_tuple(MULTILINETYPE,write_type,1);
 }
 
+void
+alloc_multicurve(void)
+{
+       
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("alloc_multicurve");
+#endif
+
+        alloc_stack_tuple(MULTICURVETYPE,write_type,1);
+}
+
 void
 alloc_multipolygon(void)
 {
+
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("alloc_multipolygon");
+#endif
+
        alloc_stack_tuple(MULTIPOLYGONTYPE,write_type,1);
 }
 
+void
+alloc_multisurface(void)
+{
+
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("alloc_multisurface called");
+#endif
+
+        alloc_stack_tuple(MULTISURFACETYPE,write_type,1);
+}
+
 void
 alloc_geomertycollection(void)
 {
+
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("alloc_geometrycollection");
+#endif
+
        alloc_stack_tuple(COLLECTIONTYPE,write_type,1);
 }
 
 void
 alloc_counter(void)
 {
+
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("alloc_counter");
+#endif
+
        alloc_stack_tuple(0,write_count,4);
 }
 
 void
 alloc_empty(void)
 {
+
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("alloc_empty");
+#endif
+
        tuple* st = the_geom.stack;
        /* Find the last geometry */
        while(st->uu.nn.type == 0){
@@ -597,12 +782,16 @@ alloc_empty(void)
        }
 
        st->uu.nn.num=0;
-
 }
 
 uchar *
 make_lwgeom(void)
 {
+
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("make_lwgeom");
+#endif
+
        uchar* out_c;
        output_state out;
        tuple* cur;
@@ -622,6 +811,12 @@ make_lwgeom(void)
        return out_c;
 }
 
+void
+lwg_parse_yynotice(char* s)
+{
+        lwnotice(s);
+}
+
 int
 lwg_parse_yyerror(char* s)
 {
@@ -776,6 +971,11 @@ read_collection2(const char **b)
 void
 parse_wkb(const char **b)
 {
+
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("parse_wkb");
+#endif
+
        int4 type;
        uchar xdr = read_wkb_byte(b);
        int4 localsrid;
@@ -829,7 +1029,7 @@ parse_wkb(const char **b)
        else{
                /* If we are writing lwg and are reading wbki */
                int4 towrite=type;
-               if (towrite > COLLECTIONTYPE ){
+               if (towrite >= POINTTYPEI && towrite <= POLYGONTYPEI){
                        towrite-=9;
                }
                alloc_stack_tuple(towrite,write_type,1);
@@ -844,13 +1044,27 @@ parse_wkb(const char **b)
                        read_collection(b,read_wkb_point);
                        break;
 
+                case    CURVETYPE:
+                        read_collection(b,read_wkb_point);
+                        break;
+
                case    POLYGONTYPE:
                        read_collection(b,read_collection2);
                        break;
 
+                case    COMPOUNDTYPE:
+                        read_collection(b,parse_wkb);
+                        break;
+
+                case    CURVEPOLYTYPE:
+                        read_collection(b,parse_wkb);
+                        break;
+
                case    MULTIPOINTTYPE:
                case    MULTILINETYPE:
+                case    MULTICURVETYPE:
                case    MULTIPOLYGONTYPE:
+                case    MULTISURFACETYPE:
                case    COLLECTIONTYPE:
                        read_collection(b,parse_wkb);
                        break;
@@ -883,6 +1097,11 @@ parse_wkb(const char **b)
 void
 alloc_wkb(const char *parser)
 {
+
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("alloc_wkb");
+#endif
+
        parse_wkb(&parser);
 }
 
@@ -893,13 +1112,19 @@ uchar *
 parse_it(const char *geometry, allocator allocfunc, report_error errfunc)
 {
 
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("parse_it: %s", geometry);
+#endif
+
        local_malloc = allocfunc;
        error_func=errfunc;
 
        ferror_occured = 0;
 
        init_parser(geometry);
+
        lwg_parse_yyparse();
+
        close_parser();
 
        if (ferror_occured)
@@ -925,7 +1150,13 @@ parse_lwgi(const char* geometry,allocator allocfunc,report_error errfunc)
 void
 set_zm(char z, char m)
 {
+
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("set_zm %d, %d", z, m);
+#endif
+
        the_geom.hasZ = z;
        the_geom.hasM = m;
        the_geom.ndims = 2+z+m;
 }
+
index 158e32d7e46d5e84301adec945bc66436d15650f..ebd27943c4af7eb692bd2d30005a84f2c3d68a8b 100644 (file)
@@ -31,11 +31,20 @@ lwline_construct(int SRID, BOX2DFLOAT4 *bbox, POINTARRAY *points)
        LWLINE *result;
        result = (LWLINE*) lwalloc(sizeof(LWLINE));
 
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("lwline_construct called.");
+#endif
+
        result->type = lwgeom_makeType_full(
                TYPE_HASZ(points->dims),
                TYPE_HASM(points->dims),
                (SRID!=-1), LINETYPE,
                0);
+
+#ifdef PGIS_DEBUG
+        lwnotice("lwline_construct type=%d", result->type);
+#endif
+
        result->SRID = SRID;
        result->points = points;
        result->bbox = bbox;
diff --git a/lwgeom/lwmcurve.c b/lwgeom/lwmcurve.c
new file mode 100644 (file)
index 0000000..63bd650
--- /dev/null
@@ -0,0 +1,125 @@
+/**********************************************************************\r
+ * $Id$\r
+ *\r
+ * PostGIS - Spatial Types for PostgreSQL\r
+ * http://postgis.refractions.net\r
+ * Copyright 2001-2006 Refractions Research Inc.\r
+ *\r
+ * This is free software; you can redistribute and/or modify it under\r
+ * the terms of the GNU General Public Licence. See the COPYING file.\r
+ * \r
+ **********************************************************************/\r
+\r
+#include <stdio.h>\r
+#include <stdlib.h>\r
+#include <string.h>\r
+#include "liblwgeom.h"\r
+\r
+LWMCURVE *\r
+lwmcurve_deserialize(uchar *srl)\r
+{\r
+        LWMCURVE *result;\r
+        LWGEOM_INSPECTED *insp;\r
+        int stype;\r
+        int type = lwgeom_getType(srl[0]);\r
+        int i;\r
+\r
+        if(type != MULTICURVETYPE)\r
+        {\r
+                lwerror("lwmcurve_deserialize called on NON multicurve: %d", type);\r
+                return NULL;\r
+        }\r
+\r
+        insp = lwgeom_inspect(srl);\r
+\r
+        result = lwalloc(sizeof(LWMCURVE));\r
+        result->type = insp->type;\r
+        result->SRID = insp->SRID;\r
+        result->ngeoms = insp->ngeometries;\r
+        result->geoms = lwalloc(sizeof(LWCURVE *)*insp->ngeometries);\r
+\r
+        if(lwgeom_hasBBOX(srl[0]))\r
+        {\r
+                result->bbox = lwalloc(sizeof(BOX2DFLOAT4));\r
+                memcpy(result->bbox, srl+1, sizeof(BOX2DFLOAT4));\r
+        }\r
+        else result->bbox = NULL;\r
+\r
+        for(i = 0; i < insp->ngeometries; i++)\r
+        {\r
+                stype = lwgeom_getType(insp->sub_geoms[i][0]);\r
+                if(stype == CURVETYPE)\r
+                {\r
+                        result->geoms[i] = (LWGEOM *)lwcurve_deserialize(insp->sub_geoms[i]);\r
+                }\r
+                else if(stype == LINETYPE)\r
+                {\r
+                        result->geoms[i] = (LWGEOM *)lwline_deserialize(insp->sub_geoms[i]);\r
+                }\r
+                else\r
+                {\r
+                        lwerror("Only Circular and Line strings are currenly permitted in a MultiCurve.");\r
+                        free(result);\r
+                        free(insp);\r
+                        return NULL;\r
+                }\r
+                        \r
+                if(TYPE_NDIMS(result->geoms[i]->type) != TYPE_NDIMS(result->type))\r
+                {\r
+                        lwerror("Mixed diminsions (multicurve: %d, curve %d:%d)",\r
+                                TYPE_NDIMS(result->type), i,\r
+                                TYPE_NDIMS(result->geoms[i]->type));\r
+                        free(result);\r
+                        free(insp);\r
+                        return NULL;\r
+                }\r
+        }\r
+        return result;\r
+}\r
+\r
+/*\r
+ * Add 'what' to this multicurve at position 'where'.\r
+ * where=0 == prepend\r
+ * where=-1 == append\r
+ * Returns a MULTICURVE or a COLLECTION\r
+ */\r
+LWGEOM *\r
+lwmcurve_add(const LWMCURVE *to, uint32 where, const LWGEOM *what)\r
+{\r
+        LWCOLLECTION *col;\r
+        LWGEOM **geoms;\r
+        int newtype;\r
+        uint32 i;\r
+\r
+        if(where == -1) where = to->ngeoms;\r
+        else if(where < -1 || where > to->ngeoms)\r
+        {\r
+                lwerror("lwmcurve_add: add position out of range %d..%d",\r
+                        -1, to->ngeoms);\r
+                return NULL;\r
+        }\r
+\r
+        /* dimensions compatibility are checked by caller */\r
+\r
+        /* Construct geoms array */\r
+        geoms = lwalloc(sizeof(LWGEOM *)*(to->ngeoms+1));\r
+        for(i = 0; i < where; i++)\r
+        {\r
+                geoms[i] = lwgeom_clone((LWGEOM *)to->geoms[i]);\r
+        }\r
+        geoms[where] = lwgeom_clone(what);\r
+        for(i = where; i < to->ngeoms; i++) \r
+        {\r
+                geoms[i+1] = lwgeom_clone((LWGEOM *)to->geoms[i]);\r
+        }\r
+\r
+        if(TYPE_GETTYPE(what->type) == CURVETYPE) newtype = MULTICURVETYPE;\r
+        else newtype = COLLECTIONTYPE;\r
+\r
+        col = lwcollection_construct(newtype,\r
+                to->SRID, NULL,\r
+                to->ngeoms + 1, geoms);\r
+\r
+        return (LWGEOM *)col;\r
+}\r
+        \r
diff --git a/lwgeom/lwmsurface.c b/lwgeom/lwmsurface.c
new file mode 100644 (file)
index 0000000..17f0cb3
--- /dev/null
@@ -0,0 +1,132 @@
+/**********************************************************************\r
+ * $Id$\r
+ *\r
+ * PostGIS - Spatial Types for PostgreSQL\r
+ * http://postgis.refractions.net\r
+ * Copyright 2001-2006 Refractions Research Inc.\r
+ *\r
+ * This is free software; you can redistribute and/or modify it under\r
+ * the terms of the GNU General Public Licence. See the COPYING file.\r
+ * \r
+ **********************************************************************/\r
+\r
+#include <stdio.h>\r
+#include <stdlib.h>\r
+#include <string.h>\r
+#include "liblwgeom.h"\r
+\r
+/*#define PGIS_DEBUG_CALLS 1 */\r
+\r
+LWMSURFACE *\r
+lwmsurface_deserialize(uchar *srl)\r
+{\r
+        LWMSURFACE *result;\r
+        LWGEOM_INSPECTED *insp;\r
+        int stype;\r
+        int type = lwgeom_getType(srl[0]);\r
+        int i;\r
+\r
+#ifdef PGIS_DEBUG_CALLS\r
+        lwnotice("lwmsurface_deserialize called");\r
+#endif\r
+\r
+        if(type != MULTISURFACETYPE)\r
+        {\r
+                lwerror("lwmsurface_deserialize called on a non-multisurface: %d", type);\r
+                return NULL;\r
+        }\r
+\r
+        insp = lwgeom_inspect(srl);\r
+\r
+        result = lwalloc(sizeof(LWMSURFACE));\r
+        result->type = insp->type;\r
+        result->SRID = insp->SRID;\r
+        result->ngeoms = insp->ngeometries;\r
+        result->geoms = lwalloc(sizeof(LWPOLY *)*insp->ngeometries);\r
+\r
+        if(lwgeom_hasBBOX(srl[0]))\r
+        {\r
+                result->bbox = lwalloc(sizeof(BOX2DFLOAT4));\r
+                memcpy(result->bbox, srl + 1, sizeof(BOX2DFLOAT4));\r
+        }\r
+        else result->bbox = NULL;\r
+\r
+        for(i = 0; i < insp->ngeometries; i++)\r
+        {\r
+                stype = lwgeom_getType(insp->sub_geoms[i][0]);\r
+                if(stype == POLYGONTYPE) \r
+                {\r
+                        result->geoms[i] = (LWGEOM *)lwpoly_deserialize(insp->sub_geoms[i]);\r
+                }\r
+                else if(stype == CURVEPOLYTYPE)\r
+                {\r
+                        result->geoms[i] = (LWGEOM *)lwcurvepoly_deserialize(insp->sub_geoms[i]);\r
+                }\r
+                else\r
+                {\r
+                        lwerror("Only Polygons and Curved Polygons are supported in a MultiSurface.");\r
+                        lwfree(result);\r
+                        lwfree(insp);\r
+                        return NULL;\r
+                }\r
+\r
+                if(TYPE_NDIMS(result->geoms[i]->type) != TYPE_NDIMS(result->type))\r
+                {\r
+                        lwerror("Mixed dimensions (multisurface: %d, surface %d:%d", \r
+                                TYPE_NDIMS(result->type), i, \r
+                                TYPE_NDIMS(result->geoms[i]->type));\r
+                        lwfree(result);\r
+                        lwfree(insp);\r
+                        return NULL;\r
+                }\r
+        }\r
+        return result;\r
+}\r
+\r
+/*\r
+ * Add 'what' to this multisurface at position 'where'\r
+ * where=0 == prepend\r
+ * where=-1 == append\r
+ * Returns a MULTISURFACE or a COLLECTION\r
+ */\r
+LWGEOM *\r
+lwmsurface_add(const LWMSURFACE *to, uint32 where, const LWGEOM *what)\r
+{\r
+        LWCOLLECTION *col;\r
+        LWGEOM **geoms;\r
+        int newtype;\r
+        uint32 i;\r
+        \r
+        if(where == -1) where = to->ngeoms;\r
+        else if(where < -1 || where > to->ngeoms)\r
+        {\r
+                lwerror("lwmsurface_add: add position out of range %d..%d",\r
+                        -1, to->ngeoms);\r
+                return NULL;\r
+        }\r
+\r
+        /* dimensions compatibility are checked by caller */\r
+\r
+        /* Construct geoms array */\r
+        geoms = lwalloc(sizeof(LWGEOM *)*(to->ngeoms+1));\r
+        for(i = 0; i < where; i++)\r
+        {\r
+                geoms[i] = lwgeom_clone((LWGEOM *)to->geoms[i]);\r
+        }\r
+        geoms[where] = lwgeom_clone(what);\r
+        for(i = where; i < to->ngeoms; i++)\r
+        {\r
+                geoms[i+1] = lwgeom_clone((LWGEOM *)to->geoms[i]);\r
+        }\r
+\r
+        if(TYPE_GETTYPE(what->type) == POLYGONTYPE \r
+                || TYPE_GETTYPE(what->type) == CURVEPOLYTYPE) \r
+            newtype = MULTISURFACETYPE;\r
+        else newtype = COLLECTIONTYPE;\r
+\r
+        col = lwcollection_construct(newtype,\r
+            to->SRID, NULL, to->ngeoms + 1, geoms);\r
+\r
+        return (LWGEOM *)col;\r
+}\r
+\r
index 730f4f5df5a8703b11380a6127912450914782a6..7cfd2dcde0783b4a45c9c15ce472f520ad0c894c 100644 (file)
@@ -1912,15 +1912,29 @@ BEGIN
                   (new_type =''POLYGONM'') or
                   (new_type =''MULTIPOLYGONM'') or
                   (new_type =''LINESTRINGM'') or
-                  (new_type =''MULTILINESTRINGM'')) )
+                  (new_type =''MULTILINESTRINGM'') or
+                   (new_type = ''CIRCULARSTRING'') or
+                   (new_type = ''CIRCULARSTRINGM'') or
+                   (new_type = ''COMPOUNDCURVE'') or
+                   (new_type = ''COMPOUNDCURVEM'') or
+                   (new_type = ''CURVEPOLYGON'') or
+                   (new_type = ''CURVEPOLYGONM'') or
+                   (new_type = ''MULTICURVE'') or
+                   (new_type = ''MULTICURVEM'') or
+                   (new_type = ''MULTISURFACE'') or
+                   (new_type = ''MULTISURFACEM'')) )
        THEN
                RAISE EXCEPTION ''Invalid type name - valid ones are: 
                        GEOMETRY, GEOMETRYCOLLECTION, POINT, 
                        MULTIPOINT, POLYGON, MULTIPOLYGON, 
                        LINESTRING, MULTILINESTRING,
+                        CIRCULARSTRING, COMPOUNDCURVE,
+                        CURVEPOLYGON, MULTICURVE, MULTISURFACE,
                        GEOMETRYCOLLECTIONM, POINTM, 
                        MULTIPOINTM, POLYGONM, MULTIPOLYGONM, 
-                       LINESTRINGM, or MULTILINESTRINGM '';
+                       LINESTRINGM, MULTILINESTRINGM 
+                        CIRCULARSTRINGM, COMPOUNDCURVEM,
+                        CURVEPOLYGONM, MULTICURVEM or MULTISURFACEM'';
                return ''fail'';
        END IF;
 
@@ -3690,10 +3704,5 @@ END;
 LANGUAGE 'plpgsql' _IMMUTABLE_STRICT; 
 
 #include "long_xact.sql"
-
----------------------------------------------------------------
--- END
----------------------------------------------------------------
-
 COMMIT;
 
index 2bbbd32bf095e8253822c82dca2132755c96a782..d2f680e34b6538b8a9feb6fca9f4bd4d2fef1aa1 100644 (file)
@@ -307,8 +307,8 @@ ptarray_removePoint(POINTARRAY *pa, unsigned int which)
        size_t ptsize = pointArray_ptsize(pa);
 
 #ifdef PGIS_DEBUG_CALLS
-       lwnotice("ptarray_removePoint: pa %x p %x size %d where %d",
-               pa, p, pdims, where);
+       lwnotice("ptarray_removePoint: pa %x which %d",
+               pa, which);
 #endif
 
 #if PARANOIA_LEVEL > 0
@@ -353,6 +353,10 @@ ptarray_clone(const POINTARRAY *in)
        POINTARRAY *out = lwalloc(sizeof(POINTARRAY));
        size_t size;
 
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("ptarray_clone called.");
+#endif
+
        out->dims = in->dims;
        out->npoints = in->npoints;
 
@@ -802,6 +806,10 @@ dynptarray_create(size_t initial_capacity, int dims)
 {
        DYNPTARRAY *ret=lwalloc(sizeof(DYNPTARRAY));
 
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("dynptarray_create called, dims=%d.", dims);
+#endif
+
        if ( initial_capacity < 1 ) initial_capacity=1;
 
        ret->pa=lwalloc(sizeof(POINTARRAY));
@@ -832,6 +840,10 @@ dynptarray_addPoint4d(DYNPTARRAY *dpa, POINT4D *p4d, int allow_duplicates)
        POINTARRAY *pa=dpa->pa;
        POINT4D tmp;
 
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("dynptarray_addPoint4d called.");
+#endif
+
        if ( ! allow_duplicates && pa->npoints > 0 )
        {
                getPoint4d_p(pa, pa->npoints-1, &tmp);
@@ -856,3 +868,4 @@ dynptarray_addPoint4d(DYNPTARRAY *dpa, POINT4D *p4d, int allow_duplicates)
 
        return 1;
 }
+
index 587a268eb091b253bd7fc80d5a166fdc9667076a..4ab06664d21254080ad45b790b166e814b5ca232 100644 (file)
@@ -40,6 +40,12 @@ typedef void  (*report_error)(const char* string, ...);
 #define LINETYPEI     11
 #define POLYGONTYPEI  12
 
+#define CURVETYPE       8
+#define COMPOUNDTYPE    9
+#define CURVEPOLYTYPE   13
+#define MULTICURVETYPE          14
+#define MULTISURFACETYPE        15
+
 extern int srid;
 
 /*
@@ -59,10 +65,17 @@ void alloc_point_4d(double x,double y,double z,double m);
 
 void alloc_point(void);
 void alloc_linestring(void);
+void alloc_linestring_closed(void);
+void alloc_circularstring(void);
+void alloc_circularstring_closed(void);
 void alloc_polygon(void);
+void alloc_compoundcurve(void);
+void alloc_curvepolygon(void);
 void alloc_multipoint(void);
 void alloc_multilinestring(void);
+void alloc_multicurve(void);
 void alloc_multipolygon(void);
+void alloc_multisurface(void);
 void alloc_geomertycollection(void);
 void alloc_empty();
 void alloc_counter(void);
index 1ce003e2ff3688b8e02b5bb4b7dd8b21d3b97b59..6ab7f4ebfa22906501e6615d149c063e936ceaa8 100644 (file)
@@ -36,14 +36,24 @@ static YY_BUFFER_STATE buf_state;
 <*>POINTM      { return POINTM; }
 <*>LINESTRING { return LINESTRING; }
 <*>LINESTRINGM { return LINESTRINGM; }
+<*>CIRCULARSTRING { return CIRCULARSTRING; }
+<*>CIRCULARSTRINGM { return CIRCULARSTRINGM; }
 <*>POLYGON { return POLYGON; }
 <*>POLYGONM { return POLYGONM; }
+<*>COMPOUNDCURVE { return COMPOUNDCURVE; }
+<*>COMPOUNDCURVEM { return COMPOUNDCURVEM; }
+<*>CURVEPOLYGON { return CURVEPOLYGON; }
+<*>CURVEPOLYGONM { return CURVEPOLYGONM; }
 <*>MULTIPOINT { return MULTIPOINT; }
 <*>MULTIPOINTM { return MULTIPOINTM; }
 <*>MULTILINESTRING { return MULTILINESTRING; }
 <*>MULTILINESTRINGM { return MULTILINESTRINGM; }
+<*>MULTICURVE { return MULTICURVE; }
+<*>MULTICURVEM { return MULTICURVEM; }
 <*>MULTIPOLYGON { return MULTIPOLYGON; }
 <*>MULTIPOLYGONM { return MULTIPOLYGONM; }
+<*>MULTISURFACE { return MULTISURFACE; }
+<*>MULTISURFACEM { return MULTISURFACEM; }
 <*>GEOMETRYCOLLECTION { return GEOMETRYCOLLECTION; }
 <*>GEOMETRYCOLLECTIONM { return GEOMETRYCOLLECTIONM; }
 <*>SRID { BEGIN(vals_ok); return SRID; }
index c4561bf5c0fd8efb44212c580e0b4bdbb9cfcdb6..0035cd3cf2dce0f3de14cbd443dc3ff39190a9c0 100644 (file)
@@ -1,7 +1,7 @@
-/* A Bison parser, made by GNU Bison 1.875.  */
+/* A Bison parser, made by GNU Bison 1.875c.  */
 
 /* Skeleton parser for Yacc-like parsing with Bison,
-   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
      MULTILINESTRING = 262,
      MULTIPOLYGON = 263,
      GEOMETRYCOLLECTION = 264,
-     POINTM = 265,
-     LINESTRINGM = 266,
-     POLYGONM = 267,
-     MULTIPOINTM = 268,
-     MULTILINESTRINGM = 269,
-     MULTIPOLYGONM = 270,
-     GEOMETRYCOLLECTIONM = 271,
-     SRID = 272,
-     EMPTY = 273,
-     VALUE = 274,
-     LPAREN = 275,
-     RPAREN = 276,
-     COMMA = 277,
-     EQUALS = 278,
-     SEMICOLON = 279,
-     WKB = 280
+     CIRCULARSTRING = 265,
+     COMPOUNDCURVE = 266,
+     CURVEPOLYGON = 267,
+     MULTICURVE = 268,
+     MULTISURFACE = 269,
+     POINTM = 270,
+     LINESTRINGM = 271,
+     POLYGONM = 272,
+     MULTIPOINTM = 273,
+     MULTILINESTRINGM = 274,
+     MULTIPOLYGONM = 275,
+     GEOMETRYCOLLECTIONM = 276,
+     CIRCULARSTRINGM = 277,
+     COMPOUNDCURVEM = 278,
+     CURVEPOLYGONM = 279,
+     MULTICURVEM = 280,
+     MULTISURFACEM = 281,
+     SRID = 282,
+     EMPTY = 283,
+     VALUE = 284,
+     LPAREN = 285,
+     RPAREN = 286,
+     COMMA = 287,
+     EQUALS = 288,
+     SEMICOLON = 289,
+     WKB = 290
    };
 #endif
 #define POINT 258
 #define MULTILINESTRING 262
 #define MULTIPOLYGON 263
 #define GEOMETRYCOLLECTION 264
-#define POINTM 265
-#define LINESTRINGM 266
-#define POLYGONM 267
-#define MULTIPOINTM 268
-#define MULTILINESTRINGM 269
-#define MULTIPOLYGONM 270
-#define GEOMETRYCOLLECTIONM 271
-#define SRID 272
-#define EMPTY 273
-#define VALUE 274
-#define LPAREN 275
-#define RPAREN 276
-#define COMMA 277
-#define EQUALS 278
-#define SEMICOLON 279
-#define WKB 280
+#define CIRCULARSTRING 265
+#define COMPOUNDCURVE 266
+#define CURVEPOLYGON 267
+#define MULTICURVE 268
+#define MULTISURFACE 269
+#define POINTM 270
+#define LINESTRINGM 271
+#define POLYGONM 272
+#define MULTIPOINTM 273
+#define MULTILINESTRINGM 274
+#define MULTIPOLYGONM 275
+#define GEOMETRYCOLLECTIONM 276
+#define CIRCULARSTRINGM 277
+#define COMPOUNDCURVEM 278
+#define CURVEPOLYGONM 279
+#define MULTICURVEM 280
+#define MULTISURFACEM 281
+#define SRID 282
+#define EMPTY 283
+#define VALUE 284
+#define LPAREN 285
+#define RPAREN 286
+#define COMMA 287
+#define EQUALS 288
+#define SEMICOLON 289
+#define WKB 290
 
 
 
@@ -145,7 +165,7 @@ typedef union YYSTYPE {
        const char* wkb;
 } YYSTYPE;
 /* Line 191 of yacc.c.  */
-#line 148 "y.tab.c"
+#line 169 "y.tab.c"
 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
 # define YYSTYPE_IS_DECLARED 1
 # define YYSTYPE_IS_TRIVIAL 1
@@ -157,22 +177,29 @@ typedef union YYSTYPE {
 
 
 /* Line 214 of yacc.c.  */
-#line 160 "y.tab.c"
+#line 181 "y.tab.c"
 
 #if ! defined (yyoverflow) || YYERROR_VERBOSE
 
+# ifndef YYFREE
+#  define YYFREE free
+# endif
+# ifndef YYMALLOC
+#  define YYMALLOC malloc
+# endif
+
 /* The parser invokes alloca or malloc; define the necessary symbols.  */
 
-# if YYSTACK_USE_ALLOCA
-#  define YYSTACK_ALLOC alloca
+# ifdef YYSTACK_USE_ALLOCA
+#  if YYSTACK_USE_ALLOCA
+#   define YYSTACK_ALLOC alloca
+#  endif
 # else
-#  ifndef YYSTACK_USE_ALLOCA
-#   if defined (alloca) || defined (_ALLOCA_H)
-#    define YYSTACK_ALLOC alloca
-#   else
-#    ifdef __GNUC__
-#     define YYSTACK_ALLOC __builtin_alloca
-#    endif
+#  if defined (alloca) || defined (_ALLOCA_H)
+#   define YYSTACK_ALLOC alloca
+#  else
+#   ifdef __GNUC__
+#    define YYSTACK_ALLOC __builtin_alloca
 #   endif
 #  endif
 # endif
@@ -185,15 +212,15 @@ typedef union YYSTYPE {
 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
 #   define YYSIZE_T size_t
 #  endif
-#  define YYSTACK_ALLOC malloc
-#  define YYSTACK_FREE free
+#  define YYSTACK_ALLOC YYMALLOC
+#  define YYSTACK_FREE YYFREE
 # endif
 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
 
 
 #if (! defined (yyoverflow) \
      && (! defined (__cplusplus) \
-        || (YYSTYPE_IS_TRIVIAL)))
+        || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
 
 /* A type that is properly aligned for any stack member.  */
 union yyalloc
@@ -214,7 +241,7 @@ union yyalloc
 /* Copy COUNT objects from FROM to TO.  The source and destination do
    not overlap.  */
 # ifndef YYCOPY
-#  if 1 < __GNUC__
+#  if defined (__GNUC__) && 1 < __GNUC__
 #   define YYCOPY(To, From, Count) \
       __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
 #  else
@@ -256,20 +283,20 @@ union yyalloc
 /* YYFINAL -- State number of the termination state. */
 #define YYFINAL  6
 /* YYLAST -- Last index in YYTABLE.  */
-#define YYLAST   104
+#define YYLAST   180
 
 /* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS  26
+#define YYNTOKENS  36
 /* YYNNTS -- Number of nonterminals. */
-#define YYNNTS  66
+#define YYNNTS  107
 /* YYNRULES -- Number of rules. */
-#define YYNRULES  98
+#define YYNRULES  169
 /* YYNRULES -- Number of states. */
-#define YYNSTATES  139
+#define YYNSTATES  237
 
 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
 #define YYUNDEFTOK  2
-#define YYMAXUTOK   280
+#define YYMAXUTOK   290
 
 #define YYTRANSLATE(YYX)                                               \
   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -305,69 +332,102 @@ static const unsigned char yytranslate[] =
        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
        5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
       15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
-      25
+      25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
+      35
 };
 
 #if YYDEBUG
 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
    YYRHS.  */
-static const unsigned char yyprhs[] =
+static const unsigned short yyprhs[] =
 {
        0,     0,     3,     4,     9,    10,    13,    15,    17,    19,
-      21,    23,    25,    27,    29,    33,    35,    38,    39,    43,
-      45,    47,    48,    51,    52,    55,    59,    60,    64,    65,
-      69,    71,    72,    77,    79,    83,    85,    86,    89,    92,
-      93,    97,    99,   101,   102,   105,   106,   109,   110,   115,
-     117,   121,   122,   126,   127,   131,   133,   134,   139,   141,
-     145,   148,   149,   153,   155,   157,   158,   161,   162,   165,
-     166,   171,   173,   177,   178,   182,   183,   187,   189,   190,
-     195,   197,   201,   202,   206,   207,   211,   213,   214,   219,
-     221,   223,   227,   229,   231,   233,   236,   240,   245
+      21,    23,    25,    27,    29,    31,    33,    35,    37,    39,
+      43,    45,    48,    49,    53,    55,    57,    58,    61,    62,
+      65,    69,    70,    74,    75,    79,    81,    82,    87,    89,
+      93,    95,    96,    99,   102,   103,   107,   109,   111,   112,
+     115,   116,   119,   120,   123,   124,   129,   131,   135,   138,
+     139,   143,   146,   147,   151,   153,   155,   157,   159,   160,
+     163,   164,   167,   168,   171,   172,   177,   179,   183,   184,
+     188,   189,   193,   195,   196,   201,   203,   205,   209,   213,
+     214,   218,   219,   223,   225,   226,   231,   233,   237,   238,
+     242,   243,   247,   249,   250,   255,   257,   259,   263,   267,
+     270,   271,   275,   277,   279,   280,   283,   284,   287,   288,
+     293,   295,   299,   300,   304,   305,   309,   311,   312,   317,
+     319,   321,   325,   329,   330,   334,   335,   339,   341,   342,
+     347,   349,   353,   354,   358,   359,   363,   365,   366,   371,
+     373,   375,   379,   383,   384,   388,   389,   393,   395,   396,
+     401,   403,   405,   409,   411,   413,   415,   418,   422,   427
 };
 
 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
-static const yysigned_char yyrhs[] =
+static const short yyrhs[] =
 {
-      27,     0,    -1,    -1,    31,    24,    28,    30,    -1,    -1,
-      29,    30,    -1,    32,    -1,    33,    -1,    49,    -1,    65,
-      -1,    41,    -1,    59,    -1,    75,    -1,    81,    -1,    17,
-      23,    19,    -1,    25,    -1,     3,    35,    -1,    -1,    10,
-      34,    35,    -1,    36,    -1,    38,    -1,    -1,    37,    91,
-      -1,    -1,    39,    40,    -1,    20,    87,    21,    -1,    -1,
-       6,    42,    44,    -1,    -1,    13,    43,    44,    -1,    91,
-      -1,    -1,    45,    20,    46,    21,    -1,    47,    -1,    46,
-      22,    47,    -1,    38,    -1,    -1,    48,    87,    -1,     4,
-      51,    -1,    -1,    11,    50,    51,    -1,    52,    -1,    54,
-      -1,    -1,    53,    91,    -1,    -1,    55,    56,    -1,    -1,
-      57,    20,    58,    21,    -1,    87,    -1,    58,    22,    87,
-      -1,    -1,     7,    60,    62,    -1,    -1,    14,    61,    62,
-      -1,    91,    -1,    -1,    63,    20,    64,    21,    -1,    54,
-      -1,    64,    22,    54,    -1,     5,    67,    -1,    -1,    12,
-      66,    67,    -1,    68,    -1,    70,    -1,    -1,    69,    91,
-      -1,    -1,    71,    72,    -1,    -1,    73,    20,    74,    21,
-      -1,    56,    -1,    74,    22,    56,    -1,    -1,     8,    76,
-      78,    -1,    -1,    15,    77,    78,    -1,    91,    -1,    -1,
-      79,    20,    80,    21,    -1,    70,    -1,    80,    22,    70,
-      -1,    -1,     9,    82,    84,    -1,    -1,    16,    83,    84,
-      -1,    91,    -1,    -1,    85,    20,    86,    21,    -1,    91,
-      -1,    30,    -1,    86,    22,    30,    -1,    88,    -1,    89,
-      -1,    90,    -1,    19,    19,    -1,    19,    19,    19,    -1,
-      19,    19,    19,    19,    -1,    18,    -1
+      37,     0,    -1,    -1,    41,    34,    38,    40,    -1,    -1,
+      39,    40,    -1,    42,    -1,    43,    -1,    59,    -1,    71,
+      -1,   104,    -1,    86,    -1,   114,    -1,    51,    -1,    92,
+      -1,    98,    -1,   120,    -1,   126,    -1,   132,    -1,    27,
+      33,    29,    -1,    35,    -1,     3,    45,    -1,    -1,    15,
+      44,    45,    -1,    46,    -1,    48,    -1,    -1,    47,   142,
+      -1,    -1,    49,    50,    -1,    30,   138,    31,    -1,    -1,
+       6,    52,    54,    -1,    -1,    18,    53,    54,    -1,   142,
+      -1,    -1,    55,    30,    56,    31,    -1,    57,    -1,    56,
+      32,    57,    -1,    48,    -1,    -1,    58,   138,    -1,     4,
+      61,    -1,    -1,    16,    60,    61,    -1,    62,    -1,    64,
+      -1,    -1,    63,   142,    -1,    -1,    65,    68,    -1,    -1,
+      67,    68,    -1,    -1,    69,    30,    70,    31,    -1,   138,
+      -1,    70,    32,   138,    -1,    10,    75,    -1,    -1,    22,
+      72,    75,    -1,    10,    76,    -1,    -1,    22,    74,    76,
+      -1,    77,    -1,    79,    -1,    77,    -1,    81,    -1,    -1,
+      78,   142,    -1,    -1,    80,    83,    -1,    -1,    82,    83,
+      -1,    -1,    84,    30,    85,    31,    -1,   138,    -1,    85,
+      32,   138,    -1,    -1,    11,    87,    89,    -1,    -1,    23,
+      88,    89,    -1,   142,    -1,    -1,    90,    30,    91,    31,
+      -1,    64,    -1,    71,    -1,    91,    32,    64,    -1,    91,
+      32,    71,    -1,    -1,     7,    93,    95,    -1,    -1,    19,
+      94,    95,    -1,   142,    -1,    -1,    96,    30,    97,    31,
+      -1,    64,    -1,    97,    32,    64,    -1,    -1,    13,    99,
+     101,    -1,    -1,    25,   100,   101,    -1,   142,    -1,    -1,
+     102,    30,   103,    31,    -1,    64,    -1,    71,    -1,   103,
+      32,    64,    -1,   103,    32,    71,    -1,     5,   106,    -1,
+      -1,    17,   105,   106,    -1,   107,    -1,   109,    -1,    -1,
+     108,   142,    -1,    -1,   110,   111,    -1,    -1,   112,    30,
+     113,    31,    -1,    68,    -1,   113,    32,    68,    -1,    -1,
+      12,   115,   117,    -1,    -1,    24,   116,   117,    -1,   142,
+      -1,    -1,   118,    30,   119,    31,    -1,    66,    -1,    73,
+      -1,   119,    32,    66,    -1,   119,    32,    73,    -1,    -1,
+       8,   121,   123,    -1,    -1,    20,   122,   123,    -1,   142,
+      -1,    -1,   124,    30,   125,    31,    -1,   109,    -1,   125,
+      32,   109,    -1,    -1,    14,   127,   129,    -1,    -1,    26,
+     128,   129,    -1,   142,    -1,    -1,   130,    30,   131,    31,
+      -1,   109,    -1,   114,    -1,   131,    32,   109,    -1,   131,
+      32,   114,    -1,    -1,     9,   133,   135,    -1,    -1,    21,
+     134,   135,    -1,   142,    -1,    -1,   136,    30,   137,    31,
+      -1,   142,    -1,    40,    -1,   137,    32,    40,    -1,   139,
+      -1,   140,    -1,   141,    -1,    29,    29,    -1,    29,    29,
+      29,    -1,    29,    29,    29,    29,    -1,    28,    -1
 };
 
 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
-static const unsigned char yyrline[] =
+static const unsigned short yyrline[] =
 {
        0,    36,    36,    36,    38,    38,    41,    43,    45,    47,
-      49,    51,    53,    55,    58,    61,    67,    69,    69,    72,
-      74,    77,    77,    80,    80,    84,    89,    89,    91,    91,
-      94,    96,    96,    99,   101,   104,   107,   107,   113,   115,
-     115,   118,   120,   123,   123,   126,   126,   129,   129,   132,
-     134,   139,   139,   142,   142,   146,   148,   148,   151,   153,
-     159,   161,   161,   164,   166,   169,   169,   172,   172,   175,
-     175,   178,   180,   185,   185,   187,   187,   191,   193,   193,
-     196,   198,   204,   204,   207,   207,   211,   213,   213,   217,
-     219,   221,   225,   227,   229,   232,   235,   238,   241
+      49,    51,    53,    55,    57,    59,    61,    63,    65,    68,
+      71,    77,    79,    79,    82,    84,    87,    87,    90,    90,
+      93,    98,    98,   100,   100,   103,   105,   105,   108,   110,
+     113,   116,   116,   122,   124,   124,   127,   129,   132,   132,
+     135,   135,   138,   138,   141,   141,   144,   146,   151,   153,
+     153,   156,   158,   158,   161,   163,   166,   168,   171,   171,
+     174,   174,   177,   177,   180,   180,   183,   185,   190,   190,
+     192,   192,   195,   197,   197,   200,   202,   204,   206,   211,
+     211,   214,   214,   218,   220,   220,   223,   225,   230,   230,
+     233,   233,   237,   239,   239,   242,   244,   246,   248,   253,
+     255,   255,   258,   260,   263,   263,   266,   266,   269,   269,
+     272,   274,   279,   279,   281,   281,   285,   287,   287,   290,
+     292,   294,   296,   301,   301,   303,   303,   307,   309,   309,
+     312,   314,   319,   319,   321,   321,   325,   327,   327,   330,
+     332,   334,   336,   341,   341,   344,   344,   348,   350,   350,
+     354,   356,   358,   362,   364,   366,   369,   372,   375,   378
 };
 #endif
 
@@ -376,23 +436,37 @@ static const unsigned char yyrline[] =
    First, the terminals, then, starting at YYNTOKENS, nonterminals. */
 static const char *const yytname[] =
 {
-  "$end", "error", "$undefined", "POINT", "LINESTRING", "POLYGON", 
-  "MULTIPOINT", "MULTILINESTRING", "MULTIPOLYGON", "GEOMETRYCOLLECTION", 
-  "POINTM", "LINESTRINGM", "POLYGONM", "MULTIPOINTM", "MULTILINESTRINGM", 
-  "MULTIPOLYGONM", "GEOMETRYCOLLECTIONM", "SRID", "EMPTY", "VALUE", 
-  "LPAREN", "RPAREN", "COMMA", "EQUALS", "SEMICOLON", "WKB", "$accept", 
-  "geometry", "@1", "@2", "geometry_int", "srid", "geom_wkb", 
-  "geom_point", "@3", "point", "empty_point", "@4", "nonempty_point", 
-  "@5", "point_int", "geom_multipoint", "@6", "@7", "multipoint", "@8", 
-  "multipoint_int", "mpoint_element", "@9", "geom_linestring", "@10", 
-  "linestring", "empty_linestring", "@11", "nonempty_linestring", "@12", 
-  "linestring_1", "@13", "linestring_int", "geom_multilinestring", "@14", 
-  "@15", "multilinestring", "@16", "multilinestring_int", "geom_polygon", 
-  "@17", "polygon", "empty_polygon", "@18", "nonempty_polygon", "@19", 
-  "polygon_1", "@20", "polygon_int", "geom_multipolygon", "@21", "@22", 
-  "multipolygon", "@23", "multipolygon_int", "geom_geometrycollection", 
-  "@24", "@25", "geometrycollection", "@26", "geometrycollection_int", 
-  "a_point", "point_2d", "point_3d", "point_4d", "empty", 0
+  "$end", "error", "$undefined", "POINT", "LINESTRING", "POLYGON",
+  "MULTIPOINT", "MULTILINESTRING", "MULTIPOLYGON", "GEOMETRYCOLLECTION",
+  "CIRCULARSTRING", "COMPOUNDCURVE", "CURVEPOLYGON", "MULTICURVE",
+  "MULTISURFACE", "POINTM", "LINESTRINGM", "POLYGONM", "MULTIPOINTM",
+  "MULTILINESTRINGM", "MULTIPOLYGONM", "GEOMETRYCOLLECTIONM",
+  "CIRCULARSTRINGM", "COMPOUNDCURVEM", "CURVEPOLYGONM", "MULTICURVEM",
+  "MULTISURFACEM", "SRID", "EMPTY", "VALUE", "LPAREN", "RPAREN", "COMMA",
+  "EQUALS", "SEMICOLON", "WKB", "$accept", "geometry", "@1", "@2",
+  "geometry_int", "srid", "geom_wkb", "geom_point", "@3", "point",
+  "empty_point", "@4", "nonempty_point", "@5", "point_int",
+  "geom_multipoint", "@6", "@7", "multipoint", "@8", "multipoint_int",
+  "mpoint_element", "@9", "geom_linestring", "@10", "linestring",
+  "empty_linestring", "@11", "nonempty_linestring", "@12",
+  "nonempty_linestring_closed", "@13", "linestring_1", "@14",
+  "linestring_int", "geom_circularstring", "@15",
+  "geom_circularstring_closed", "@16", "circularstring",
+  "circularstring_closed", "empty_circularstring", "@17",
+  "nonempty_circularstring", "@18", "nonempty_circularstring_closed",
+  "@19", "circularstring_1", "@20", "circularstring_int",
+  "geom_compoundcurve", "@21", "@22", "compoundcurve", "@23",
+  "compoundcurve_int", "geom_multilinestring", "@24", "@25",
+  "multilinestring", "@26", "multilinestring_int", "geom_multicurve",
+  "@27", "@28", "multicurve", "@29", "multicurve_int", "geom_polygon",
+  "@30", "polygon", "empty_polygon", "@31", "nonempty_polygon", "@32",
+  "polygon_1", "@33", "polygon_int", "geom_curvepolygon", "@34", "@35",
+  "curvepolygon", "@36", "curvepolygon_int", "geom_multipolygon", "@37",
+  "@38", "multipolygon", "@39", "multipolygon_int", "geom_multisurface",
+  "@40", "@41", "multisurface", "@42", "multisurface_int",
+  "geom_geometrycollection", "@43", "@44", "geometrycollection", "@45",
+  "geometrycollection_int", "a_point", "point_2d", "point_3d", "point_4d",
+  "empty", 0
 };
 #endif
 
@@ -403,38 +477,53 @@ static const unsigned short yytoknum[] =
 {
        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
      265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
-     275,   276,   277,   278,   279,   280
+     275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
+     285,   286,   287,   288,   289,   290
 };
 # endif
 
 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
 static const unsigned char yyr1[] =
 {
-       0,    26,    28,    27,    29,    27,    30,    30,    30,    30,
-      30,    30,    30,    30,    31,    32,    33,    34,    33,    35,
-      35,    37,    36,    39,    38,    40,    42,    41,    43,    41,
-      44,    45,    44,    46,    46,    47,    48,    47,    49,    50,
-      49,    51,    51,    53,    52,    55,    54,    57,    56,    58,
-      58,    60,    59,    61,    59,    62,    63,    62,    64,    64,
-      65,    66,    65,    67,    67,    69,    68,    71,    70,    73,
-      72,    74,    74,    76,    75,    77,    75,    78,    79,    78,
-      80,    80,    82,    81,    83,    81,    84,    85,    84,    86,
-      86,    86,    87,    87,    87,    88,    89,    90,    91
+       0,    36,    38,    37,    39,    37,    40,    40,    40,    40,
+      40,    40,    40,    40,    40,    40,    40,    40,    40,    41,
+      42,    43,    44,    43,    45,    45,    47,    46,    49,    48,
+      50,    52,    51,    53,    51,    54,    55,    54,    56,    56,
+      57,    58,    57,    59,    60,    59,    61,    61,    63,    62,
+      65,    64,    67,    66,    69,    68,    70,    70,    71,    72,
+      71,    73,    74,    73,    75,    75,    76,    76,    78,    77,
+      80,    79,    82,    81,    84,    83,    85,    85,    87,    86,
+      88,    86,    89,    90,    89,    91,    91,    91,    91,    93,
+      92,    94,    92,    95,    96,    95,    97,    97,    99,    98,
+     100,    98,   101,   102,   101,   103,   103,   103,   103,   104,
+     105,   104,   106,   106,   108,   107,   110,   109,   112,   111,
+     113,   113,   115,   114,   116,   114,   117,   118,   117,   119,
+     119,   119,   119,   121,   120,   122,   120,   123,   124,   123,
+     125,   125,   127,   126,   128,   126,   129,   130,   129,   131,
+     131,   131,   131,   133,   132,   134,   132,   135,   136,   135,
+     137,   137,   137,   138,   138,   138,   139,   140,   141,   142
 };
 
 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
 static const unsigned char yyr2[] =
 {
        0,     2,     0,     4,     0,     2,     1,     1,     1,     1,
-       1,     1,     1,     1,     3,     1,     2,     0,     3,     1,
-       1,     0,     2,     0,     2,     3,     0,     3,     0,     3,
-       1,     0,     4,     1,     3,     1,     0,     2,     2,     0,
-       3,     1,     1,     0,     2,     0,     2,     0,     4,     1,
+       1,     1,     1,     1,     1,     1,     1,     1,     1,     3,
+       1,     2,     0,     3,     1,     1,     0,     2,     0,     2,
        3,     0,     3,     0,     3,     1,     0,     4,     1,     3,
-       2,     0,     3,     1,     1,     0,     2,     0,     2,     0,
-       4,     1,     3,     0,     3,     0,     3,     1,     0,     4,
+       1,     0,     2,     2,     0,     3,     1,     1,     0,     2,
+       0,     2,     0,     2,     0,     4,     1,     3,     2,     0,
+       3,     2,     0,     3,     1,     1,     1,     1,     0,     2,
+       0,     2,     0,     2,     0,     4,     1,     3,     0,     3,
+       0,     3,     1,     0,     4,     1,     1,     3,     3,     0,
+       3,     0,     3,     1,     0,     4,     1,     3,     0,     3,
+       0,     3,     1,     0,     4,     1,     1,     3,     3,     2,
+       0,     3,     1,     1,     0,     2,     0,     2,     0,     4,
        1,     3,     0,     3,     0,     3,     1,     0,     4,     1,
-       1,     3,     1,     1,     1,     2,     3,     4,     1
+       1,     3,     3,     0,     3,     0,     3,     1,     0,     4,
+       1,     3,     0,     3,     0,     3,     1,     0,     4,     1,
+       1,     3,     3,     0,     3,     0,     3,     1,     0,     4,
+       1,     1,     3,     1,     1,     1,     2,     3,     4,     1
 };
 
 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -442,120 +531,174 @@ static const unsigned char yyr2[] =
    means the default is an error.  */
 static const unsigned char yydefact[] =
 {
-       4,     0,     0,     0,     0,     0,     1,    21,    43,    65,
-      26,    51,    73,    82,    17,    39,    61,    28,    53,    75,
-      84,    15,     5,     6,     7,    10,     8,    11,     9,    12,
-      13,     2,    14,    16,    19,     0,    20,     0,    38,    41,
-       0,    42,    47,    60,    63,     0,    64,    69,    31,    56,
-      78,    87,    21,    43,    65,    31,    56,    78,    87,     0,
-      98,    22,     0,    24,    44,    46,     0,    66,    68,     0,
-      27,     0,    30,    52,     0,    55,    74,     0,    77,    83,
-       0,    86,    18,    40,    62,    29,    54,    76,    85,     3,
-       0,     0,    92,    93,    94,     0,    47,    23,    45,    67,
-       0,    95,    25,     0,    49,    71,     0,    35,     0,    33,
-       0,    58,     0,    80,     0,    90,     0,    89,    96,    48,
-       0,    70,    47,    32,    23,    37,    57,    45,    79,    67,
-      88,     0,    97,    50,    72,    34,    59,    81,    91
+       4,     0,     0,     0,     0,     0,     1,    26,    48,   114,
+      31,    89,   133,   153,    68,    78,   122,    98,   142,    22,
+      44,   110,    33,    91,   135,   155,    59,    80,   124,   100,
+     144,    20,     5,     6,     7,    13,     8,     9,    11,    14,
+      15,    10,    12,    16,    17,    18,     2,    19,    21,    24,
+       0,    25,     0,    43,    46,     0,    47,    54,   109,   112,
+       0,   113,   118,    36,    94,   138,   158,    58,    64,     0,
+      65,    74,    83,   127,   103,   147,    26,    48,   114,    36,
+      94,   138,   158,    68,    83,   127,   103,   147,     0,   169,
+      27,     0,    29,    49,    51,     0,   115,   117,     0,    32,
+       0,    35,    90,     0,    93,   134,     0,   137,   154,     0,
+     157,    69,    71,     0,    79,     0,    82,   123,     0,   126,
+      99,     0,   102,   143,     0,   146,    23,    45,   111,    34,
+      92,   136,   156,    60,    81,   125,   101,   145,     3,     0,
+       0,   163,   164,   165,     0,    54,    28,    50,   116,     0,
+       0,    50,    52,    50,   116,   166,    30,     0,    56,   120,
+       0,    40,     0,    38,     0,    96,     0,   140,     0,   161,
+       0,   160,     0,    76,    85,    86,     0,    68,    62,   129,
+      54,   130,     0,   105,   106,     0,   149,   150,     0,   167,
+      55,     0,   119,    54,    37,    28,    42,    95,    50,   139,
+     116,   159,     0,    75,     0,    84,    50,    61,    66,    67,
+      74,    68,    53,   128,    52,   104,    50,   148,   116,   168,
+      57,   121,    39,    97,   141,   162,    77,    87,    88,    73,
+      63,   131,   132,   107,   108,   151,   152
 };
 
 /* YYDEFGOTO[NTERM-NUM]. */
-static const yysigned_char yydefgoto[] =
+static const short yydefgoto[] =
 {
-      -1,     2,    59,     3,    22,     4,    23,    24,    52,    33,
-      34,    35,    36,    37,    63,    25,    48,    55,    70,    71,
-     108,   109,   110,    26,    53,    38,    39,    40,    41,    42,
-      65,    66,   103,    27,    49,    56,    73,    74,   112,    28,
-      54,    43,    44,    45,    46,    47,    68,    69,   106,    29,
-      50,    57,    76,    77,   114,    30,    51,    58,    79,    80,
-     116,    91,    92,    93,    94,    72
+      -1,     2,    88,     3,    32,     4,    33,    34,    76,    48,
+      49,    50,    51,    52,    92,    35,    63,    79,    99,   100,
+     162,   163,   164,    36,    77,    53,    54,    55,    56,    57,
+     179,   180,    94,    95,   157,    37,    83,   181,   211,    67,
+     207,    68,    69,    70,    71,   209,   210,   112,   113,   172,
+      38,    72,    84,   114,   115,   176,    39,    64,    80,   102,
+     103,   166,    40,    74,    86,   120,   121,   185,    41,    78,
+      58,    59,    60,    61,    62,    97,    98,   160,    42,    73,
+      85,   117,   118,   182,    43,    65,    81,   105,   106,   168,
+      44,    75,    87,   123,   124,   188,    45,    66,    82,   108,
+     109,   170,   140,   141,   142,   143,   101
 };
 
 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
    STATE-NUM.  */
-#define YYPACT_NINF -98
-static const yysigned_char yypact[] =
+#define YYPACT_NINF -166
+static const short yypact[] =
 {
-     -12,    13,    14,    70,     4,    18,   -98,    19,    20,    36,
-     -98,   -98,   -98,   -98,   -98,   -98,   -98,   -98,   -98,   -98,
-     -98,   -98,   -98,   -98,   -98,   -98,   -98,   -98,   -98,   -98,
-     -98,   -98,   -98,   -98,   -98,    40,   -98,    41,   -98,   -98,
-      40,   -98,   -98,   -98,   -98,    40,   -98,   -98,    40,    40,
-      40,    40,    19,    20,    36,    40,    40,    40,    40,    70,
-     -98,   -98,    43,   -98,   -98,   -98,    45,   -98,   -98,    47,
-     -98,    48,   -98,   -98,    49,   -98,   -98,    50,   -98,   -98,
-      51,   -98,   -98,   -98,   -98,   -98,   -98,   -98,   -98,   -98,
-      44,    17,   -98,   -98,   -98,    43,   -98,    68,   -98,   -98,
-      39,    69,   -98,   -13,   -98,   -98,    -9,   -98,    -3,   -98,
-      43,   -98,    -1,   -98,     5,   -98,     9,   -98,    71,   -98,
-      43,   -98,   -98,   -98,    68,   -98,   -98,   -98,   -98,   -98,
-     -98,    70,   -98,   -98,   -98,   -98,   -98,   -98,   -98
+     -17,   -14,    21,   145,    -7,     5,  -166,    29,    30,    40,
+    -166,  -166,  -166,  -166,    51,  -166,  -166,  -166,  -166,  -166,
+    -166,  -166,  -166,  -166,  -166,  -166,  -166,  -166,  -166,  -166,
+    -166,  -166,  -166,  -166,  -166,  -166,  -166,  -166,  -166,  -166,
+    -166,  -166,  -166,  -166,  -166,  -166,  -166,  -166,  -166,  -166,
+      23,  -166,    53,  -166,  -166,    23,  -166,  -166,  -166,  -166,
+      23,  -166,  -166,    23,    23,    23,    23,  -166,  -166,    23,
+    -166,  -166,    23,    23,    23,    23,    29,    30,    40,    23,
+      23,    23,    23,    51,    23,    23,    23,    23,   145,  -166,
+    -166,    55,  -166,  -166,  -166,    56,  -166,  -166,    57,  -166,
+      58,  -166,  -166,    59,  -166,  -166,    61,  -166,  -166,    62,
+    -166,  -166,  -166,    63,  -166,    64,  -166,  -166,    65,  -166,
+    -166,    66,  -166,  -166,    67,  -166,  -166,  -166,  -166,  -166,
+    -166,  -166,  -166,  -166,  -166,  -166,  -166,  -166,  -166,    70,
+      54,  -166,  -166,  -166,    55,  -166,    72,  -166,  -166,   112,
+      55,     8,    19,     8,    28,    73,  -166,   -18,  -166,  -166,
+      16,  -166,    18,  -166,    55,  -166,    24,  -166,    31,  -166,
+      33,  -166,    35,  -166,  -166,  -166,    42,    74,  -166,  -166,
+    -166,  -166,    44,  -166,  -166,    46,  -166,  -166,    48,    76,
+    -166,    55,  -166,  -166,  -166,    72,  -166,  -166,  -166,  -166,
+    -166,  -166,   145,  -166,    55,  -166,     8,  -166,  -166,  -166,
+    -166,    74,  -166,  -166,    19,  -166,     8,  -166,    28,  -166,
+    -166,  -166,  -166,  -166,  -166,  -166,  -166,  -166,  -166,  -166,
+    -166,  -166,  -166,  -166,  -166,  -166,  -166
 };
 
 /* YYPGOTO[NTERM-NUM].  */
-static const yysigned_char yypgoto[] =
+static const short yypgoto[] =
 {
-     -98,   -98,   -98,   -98,   -59,   -98,   -98,   -98,   -98,     7,
-     -98,   -98,   -90,   -98,   -98,   -98,   -98,   -98,    34,   -98,
-     -98,   -64,   -98,   -98,   -98,    38,   -98,   -98,   -94,   -98,
-     -93,   -98,   -98,   -98,   -98,   -98,    37,   -98,   -98,   -98,
-     -98,    42,   -98,   -98,   -97,   -98,   -98,   -98,   -98,   -98,
-     -98,   -98,    35,   -98,   -98,   -98,   -98,   -98,    46,   -98,
-     -98,   -85,   -98,   -98,   -98,   -34
+    -166,  -166,  -166,  -166,   -88,  -166,  -166,  -166,  -166,    27,
+    -166,  -166,  -142,  -166,  -166,  -166,  -166,  -166,    32,  -166,
+    -166,   -89,  -166,  -166,  -166,    36,  -166,  -166,  -108,  -166,
+    -107,  -166,  -136,  -166,  -166,  -148,  -166,  -105,  -166,    60,
+    -101,  -165,  -166,  -166,  -166,  -166,  -166,   -98,  -166,  -166,
+    -166,  -166,  -166,    88,  -166,  -166,  -166,  -166,  -166,    93,
+    -166,  -166,  -166,  -166,  -166,    89,  -166,  -166,  -166,  -166,
+      68,  -166,  -166,  -146,  -166,  -166,  -166,  -166,  -147,  -166,
+    -166,    91,  -166,  -166,  -166,  -166,  -166,    96,  -166,  -166,
+    -166,  -166,  -166,    52,  -166,  -166,  -166,  -166,  -166,    92,
+    -166,  -166,  -122,  -166,  -166,  -166,   -49
 };
 
 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
    positive, shift that token.  If negative, reduce the rule which
    number is the opposite.  If zero, do what YYDEFACT says.
    If YYTABLE_NINF, syntax error.  */
-#define YYTABLE_NINF -68
+#define YYTABLE_NINF -117
 static const short yytable[] =
 {
-      89,    61,   113,   105,   111,     1,    64,   107,   119,   120,
-     104,    67,   121,   122,     6,    75,    78,    81,   123,   124,
-     126,   127,    75,    78,    81,   125,   128,   129,    31,   134,
-     130,   131,   137,   136,   107,   133,     5,    32,   102,   -23,
-     -45,   115,     7,     8,     9,    10,    11,    12,    13,    14,
-      15,    16,    17,    18,    19,    20,   -67,    60,    60,    82,
-     135,    62,    90,   101,    21,    95,   117,    96,    97,    98,
-      99,   100,   138,     7,     8,     9,    10,    11,    12,    13,
-      14,    15,    16,    17,    18,    19,    20,   -36,   118,    85,
-     132,    83,    87,    86,     0,    21,    84,     0,     0,     0,
-       0,     0,     0,     0,    88
+     138,    90,   167,   175,   161,   184,    93,   187,   186,   159,
+       1,    96,   208,   190,   191,   104,   107,   110,    14,     5,
+     111,     6,   158,   116,   119,   122,   125,    46,   173,   177,
+      26,   104,   107,   110,    47,   116,   119,   122,   125,   165,
+      16,   178,   196,   174,   212,   183,   208,   192,   193,   194,
+     195,    89,    28,   161,   224,   197,   198,   221,   228,   -28,
+     -50,   169,   199,   200,   201,   202,   203,   204,   234,   220,
+    -116,   236,   235,   205,   206,   213,   214,   215,   216,   217,
+     218,   -70,   226,    91,   139,   156,   144,   145,   146,   147,
+     223,   148,   149,   150,   151,   152,   153,   154,   227,   155,
+     171,   -41,   189,   126,   -72,   219,   222,   231,   233,   232,
+     230,   129,   229,   127,   225,     7,     8,     9,    10,    11,
+      12,    13,    14,    15,    16,    17,    18,    19,    20,    21,
+      22,    23,    24,    25,    26,    27,    28,    29,    30,   137,
+      89,     0,     0,   133,     0,     0,   128,    31,     7,     8,
+       9,    10,    11,    12,    13,    14,    15,    16,    17,    18,
+      19,    20,    21,    22,    23,    24,    25,    26,    27,    28,
+      29,    30,   134,   130,   132,   136,   135,   131,     0,     0,
+      31
 };
 
 static const short yycheck[] =
 {
-      59,    35,    99,    96,    98,    17,    40,    97,    21,    22,
-      95,    45,    21,    22,     0,    49,    50,    51,    21,    22,
-      21,    22,    56,    57,    58,   110,    21,    22,    24,   122,
-      21,    22,   129,   127,   124,   120,    23,    19,    21,    20,
-      20,   100,     3,     4,     5,     6,     7,     8,     9,    10,
-      11,    12,    13,    14,    15,    16,    20,    18,    18,    52,
-     124,    20,    19,    19,    25,    20,   100,    20,    20,    20,
-      20,    20,   131,     3,     4,     5,     6,     7,     8,     9,
-      10,    11,    12,    13,    14,    15,    16,    19,    19,    55,
-      19,    53,    57,    56,    -1,    25,    54,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    58
+      88,    50,   148,   151,   146,   153,    55,   154,   154,   145,
+      27,    60,   177,    31,    32,    64,    65,    66,    10,    33,
+      69,     0,   144,    72,    73,    74,    75,    34,   150,    10,
+      22,    80,    81,    82,    29,    84,    85,    86,    87,   147,
+      12,    22,   164,   151,   180,   153,   211,    31,    32,    31,
+      32,    28,    24,   195,   200,    31,    32,   193,   206,    30,
+      30,   149,    31,    32,    31,    32,    31,    32,   216,   191,
+      30,   218,   218,    31,    32,    31,    32,    31,    32,    31,
+      32,    30,   204,    30,    29,    31,    30,    30,    30,    30,
+     198,    30,    30,    30,    30,    30,    30,    30,   206,    29,
+     149,    29,    29,    76,    30,    29,   195,   214,   216,   214,
+     211,    79,   210,    77,   202,     3,     4,     5,     6,     7,
+       8,     9,    10,    11,    12,    13,    14,    15,    16,    17,
+      18,    19,    20,    21,    22,    23,    24,    25,    26,    87,
+      28,    -1,    -1,    83,    -1,    -1,    78,    35,     3,     4,
+       5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
+      15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
+      25,    26,    84,    80,    82,    86,    85,    81,    -1,    -1,
+      35
 };
 
 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
    symbol of state STATE-NUM.  */
 static const unsigned char yystos[] =
 {
-       0,    17,    27,    29,    31,    23,     0,     3,     4,     5,
+       0,    27,    37,    39,    41,    33,     0,     3,     4,     5,
        6,     7,     8,     9,    10,    11,    12,    13,    14,    15,
-      16,    25,    30,    32,    33,    41,    49,    59,    65,    75,
-      81,    24,    19,    35,    36,    37,    38,    39,    51,    52,
-      53,    54,    55,    67,    68,    69,    70,    71,    42,    60,
-      76,    82,    34,    50,    66,    43,    61,    77,    83,    28,
-      18,    91,    20,    40,    91,    56,    57,    91,    72,    73,
-      44,    45,    91,    62,    63,    91,    78,    79,    91,    84,
-      85,    91,    35,    51,    67,    44,    62,    78,    84,    30,
-      19,    87,    88,    89,    90,    20,    20,    20,    20,    20,
-      20,    19,    21,    58,    87,    56,    74,    38,    46,    47,
-      48,    54,    64,    70,    80,    30,    86,    91,    19,    21,
-      22,    21,    22,    21,    22,    87,    21,    22,    21,    22,
-      21,    22,    19,    87,    56,    47,    54,    70,    30
+      16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
+      26,    35,    40,    42,    43,    51,    59,    71,    86,    92,
+      98,   104,   114,   120,   126,   132,    34,    29,    45,    46,
+      47,    48,    49,    61,    62,    63,    64,    65,   106,   107,
+     108,   109,   110,    52,    93,   121,   133,    75,    77,    78,
+      79,    80,    87,   115,    99,   127,    44,    60,   105,    53,
+      94,   122,   134,    72,    88,   116,   100,   128,    38,    28,
+     142,    30,    50,   142,    68,    69,   142,   111,   112,    54,
+      55,   142,    95,    96,   142,   123,   124,   142,   135,   136,
+     142,   142,    83,    84,    89,    90,   142,   117,   118,   142,
+     101,   102,   142,   129,   130,   142,    45,    61,   106,    54,
+      95,   123,   135,    75,    89,   117,   101,   129,    40,    29,
+     138,   139,   140,   141,    30,    30,    30,    30,    30,    30,
+      30,    30,    30,    30,    30,    29,    31,    70,   138,    68,
+     113,    48,    56,    57,    58,    64,    97,   109,   125,    40,
+     137,   142,    85,   138,    64,    71,    91,    10,    22,    66,
+      67,    73,   119,    64,    71,   103,   109,   114,   131,    29,
+      31,    32,    31,    32,    31,    32,   138,    31,    32,    31,
+      32,    31,    32,    31,    32,    31,    32,    76,    77,    81,
+      82,    74,    68,    31,    32,    31,    32,    31,    32,    29,
+     138,    68,    57,    64,   109,    40,   138,    64,    71,    83,
+      76,    66,    73,    64,    71,   109,   114
 };
 
 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
@@ -581,7 +724,8 @@ static const unsigned char yystos[] =
 
 #define YYACCEPT       goto yyacceptlab
 #define YYABORT                goto yyabortlab
-#define YYERROR                goto yyerrlab1
+#define YYERROR                goto yyerrorlab
+
 
 /* Like YYERROR except do call yyerror.  This remains here temporarily
    to ease the transition to the new meaning of YYERROR, for GCC.
@@ -615,11 +759,11 @@ while (0)
    are run).  */
 
 #ifndef YYLLOC_DEFAULT
-# define YYLLOC_DEFAULT(Current, Rhs, N)         \
-  Current.first_line   = Rhs[1].first_line;      \
-  Current.first_column = Rhs[1].first_column;    \
-  Current.last_line    = Rhs[N].last_line;       \
-  Current.last_column  = Rhs[N].last_column;
+# define YYLLOC_DEFAULT(Current, Rhs, N)               \
+   ((Current).first_line   = (Rhs)[1].first_line,      \
+    (Current).first_column = (Rhs)[1].first_column,    \
+    (Current).last_line    = (Rhs)[N].last_line,       \
+    (Current).last_column  = (Rhs)[N].last_column)
 #endif
 
 /* YYLEX -- calling `yylex' with the right arguments.  */
@@ -663,7 +807,7 @@ do {                                                                \
 
 /*------------------------------------------------------------------.
 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
-| TOP (cinluded).                                                   |
+| TOP (included).                                                   |
 `------------------------------------------------------------------*/
 
 #if defined (__STDC__) || defined (__cplusplus)
@@ -703,9 +847,9 @@ yy_reduce_print (yyrule)
 #endif
 {
   int yyi;
-  unsigned int yylineno = yyrline[yyrule];
+  unsigned int yylno = yyrline[yyrule];
   YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
-             yyrule - 1, yylineno);
+             yyrule - 1, yylno);
   /* Print the symbols being reduced, and their result.  */
   for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
     YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
@@ -742,7 +886,7 @@ int yydebug;
    SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
    evaluated with infinite-precision integer arithmetic.  */
 
-#if YYMAXDEPTH == 0
+#if defined (YYMAXDEPTH) && YYMAXDEPTH == 0
 # undef YYMAXDEPTH
 #endif
 
@@ -1174,266 +1318,446 @@ yyreduce:
     { alloc_lwgeom(-1); }
     break;
 
-  case 14:
-#line 58 "wktparse.y"
+  case 19:
+#line 68 "wktparse.y"
     { set_srid(yyvsp[0].value); }
     break;
 
-  case 15:
-#line 61 "wktparse.y"
+  case 20:
+#line 71 "wktparse.y"
     { alloc_wkb(yyvsp[0].wkb); }
     break;
 
-  case 17:
-#line 69 "wktparse.y"
+  case 22:
+#line 79 "wktparse.y"
     { set_zm(0, 1); }
     break;
 
-  case 21:
-#line 77 "wktparse.y"
+  case 26:
+#line 87 "wktparse.y"
     { alloc_point(); }
     break;
 
-  case 22:
-#line 77 "wktparse.y"
+  case 27:
+#line 87 "wktparse.y"
     { pop(); }
     break;
 
-  case 23:
-#line 80 "wktparse.y"
+  case 28:
+#line 90 "wktparse.y"
     { alloc_point(); }
     break;
 
-  case 24:
-#line 80 "wktparse.y"
+  case 29:
+#line 90 "wktparse.y"
     { pop(); }
     break;
 
-  case 26:
-#line 89 "wktparse.y"
+  case 31:
+#line 98 "wktparse.y"
     { alloc_multipoint(); }
     break;
 
-  case 27:
-#line 89 "wktparse.y"
+  case 32:
+#line 98 "wktparse.y"
     { pop(); }
     break;
 
-  case 28:
-#line 91 "wktparse.y"
+  case 33:
+#line 100 "wktparse.y"
     { set_zm(0, 1); alloc_multipoint(); }
     break;
 
-  case 29:
-#line 91 "wktparse.y"
+  case 34:
+#line 100 "wktparse.y"
     {pop(); }
     break;
 
-  case 31:
-#line 96 "wktparse.y"
+  case 36:
+#line 105 "wktparse.y"
     { alloc_counter(); }
     break;
 
-  case 32:
-#line 96 "wktparse.y"
+  case 37:
+#line 105 "wktparse.y"
     { pop(); }
     break;
 
-  case 36:
-#line 107 "wktparse.y"
+  case 41:
+#line 116 "wktparse.y"
     { alloc_point(); }
     break;
 
-  case 37:
-#line 107 "wktparse.y"
+  case 42:
+#line 116 "wktparse.y"
     { pop(); }
     break;
 
-  case 39:
-#line 115 "wktparse.y"
+  case 44:
+#line 124 "wktparse.y"
     { set_zm(0, 1); }
     break;
 
-  case 43:
-#line 123 "wktparse.y"
+  case 48:
+#line 132 "wktparse.y"
     { alloc_linestring(); }
     break;
 
-  case 44:
-#line 123 "wktparse.y"
+  case 49:
+#line 132 "wktparse.y"
     { pop(); }
     break;
 
-  case 45:
-#line 126 "wktparse.y"
+  case 50:
+#line 135 "wktparse.y"
     { alloc_linestring(); }
     break;
 
-  case 46:
-#line 126 "wktparse.y"
+  case 51:
+#line 135 "wktparse.y"
     { pop(); }
     break;
 
-  case 47:
-#line 129 "wktparse.y"
+  case 52:
+#line 138 "wktparse.y"
+    { alloc_linestring_closed(); }
+    break;
+
+  case 53:
+#line 138 "wktparse.y"
+    { pop(); }
+    break;
+
+  case 54:
+#line 141 "wktparse.y"
     { alloc_counter(); }
     break;
 
-  case 48:
-#line 129 "wktparse.y"
+  case 55:
+#line 141 "wktparse.y"
     { popc(); }
     break;
 
-  case 51:
-#line 139 "wktparse.y"
+  case 59:
+#line 153 "wktparse.y"
+    {set_zm(0, 1); }
+    break;
+
+  case 62:
+#line 158 "wktparse.y"
+    {set_zm(0, 1); }
+    break;
+
+  case 68:
+#line 171 "wktparse.y"
+    { alloc_circularstring(); }
+    break;
+
+  case 69:
+#line 171 "wktparse.y"
+    { pop(); }
+    break;
+
+  case 70:
+#line 174 "wktparse.y"
+    { alloc_circularstring(); }
+    break;
+
+  case 71:
+#line 174 "wktparse.y"
+    { pop(); }
+    break;
+
+  case 72:
+#line 177 "wktparse.y"
+    { alloc_circularstring_closed(); }
+    break;
+
+  case 73:
+#line 177 "wktparse.y"
+    { pop(); }
+    break;
+
+  case 74:
+#line 180 "wktparse.y"
+    { alloc_counter(); }
+    break;
+
+  case 75:
+#line 180 "wktparse.y"
+    { popc(); }
+    break;
+
+  case 78:
+#line 190 "wktparse.y"
+    { alloc_compoundcurve(); }
+    break;
+
+  case 79:
+#line 190 "wktparse.y"
+    { pop(); }
+    break;
+
+  case 80:
+#line 192 "wktparse.y"
+    {set_zm(0, 1); alloc_compoundcurve(); }
+    break;
+
+  case 81:
+#line 192 "wktparse.y"
+    { pop(); }
+    break;
+
+  case 83:
+#line 197 "wktparse.y"
+    { alloc_counter(); }
+    break;
+
+  case 84:
+#line 197 "wktparse.y"
+    { pop(); }
+    break;
+
+  case 89:
+#line 211 "wktparse.y"
     { alloc_multilinestring(); }
     break;
 
-  case 52:
-#line 140 "wktparse.y"
+  case 90:
+#line 212 "wktparse.y"
     { pop(); }
     break;
 
-  case 53:
-#line 142 "wktparse.y"
+  case 91:
+#line 214 "wktparse.y"
     { set_zm(0, 1); alloc_multilinestring(); }
     break;
 
-  case 54:
-#line 143 "wktparse.y"
+  case 92:
+#line 215 "wktparse.y"
     { pop(); }
     break;
 
-  case 56:
-#line 148 "wktparse.y"
+  case 94:
+#line 220 "wktparse.y"
     { alloc_counter(); }
     break;
 
-  case 57:
-#line 148 "wktparse.y"
+  case 95:
+#line 220 "wktparse.y"
     { pop();}
     break;
 
-  case 61:
-#line 161 "wktparse.y"
+  case 98:
+#line 230 "wktparse.y"
+    { alloc_multicurve(); }
+    break;
+
+  case 99:
+#line 231 "wktparse.y"
+    { pop(); }
+    break;
+
+  case 100:
+#line 233 "wktparse.y"
+    { set_zm(0, 1); alloc_multicurve(); }
+    break;
+
+  case 101:
+#line 234 "wktparse.y"
+    { pop(); }
+    break;
+
+  case 103:
+#line 239 "wktparse.y"
+    { alloc_counter(); }
+    break;
+
+  case 104:
+#line 239 "wktparse.y"
+    { pop(); }
+    break;
+
+  case 110:
+#line 255 "wktparse.y"
     { set_zm(0, 1); }
     break;
 
-  case 65:
-#line 169 "wktparse.y"
+  case 114:
+#line 263 "wktparse.y"
     { alloc_polygon(); }
     break;
 
-  case 66:
-#line 169 "wktparse.y"
+  case 115:
+#line 263 "wktparse.y"
     { pop(); }
     break;
 
-  case 67:
-#line 172 "wktparse.y"
+  case 116:
+#line 266 "wktparse.y"
     { alloc_polygon(); }
     break;
 
-  case 68:
-#line 172 "wktparse.y"
+  case 117:
+#line 266 "wktparse.y"
     { pop(); }
     break;
 
-  case 69:
-#line 175 "wktparse.y"
+  case 118:
+#line 269 "wktparse.y"
     { alloc_counter(); }
     break;
 
-  case 70:
-#line 175 "wktparse.y"
+  case 119:
+#line 269 "wktparse.y"
     { pop();}
     break;
 
-  case 73:
-#line 185 "wktparse.y"
+  case 122:
+#line 279 "wktparse.y"
+    { alloc_curvepolygon(); }
+    break;
+
+  case 123:
+#line 279 "wktparse.y"
+    { pop(); }
+    break;
+
+  case 124:
+#line 281 "wktparse.y"
+    { set_zm(0, 1); alloc_curvepolygon(); }
+    break;
+
+  case 125:
+#line 282 "wktparse.y"
+    { pop(); }
+    break;
+
+  case 127:
+#line 287 "wktparse.y"
+    { alloc_counter(); }
+    break;
+
+  case 128:
+#line 287 "wktparse.y"
+    { pop(); }
+    break;
+
+  case 133:
+#line 301 "wktparse.y"
     { alloc_multipolygon(); }
     break;
 
-  case 74:
-#line 185 "wktparse.y"
+  case 134:
+#line 301 "wktparse.y"
     { pop(); }
     break;
 
-  case 75:
-#line 187 "wktparse.y"
+  case 135:
+#line 303 "wktparse.y"
     { set_zm(0, 1); alloc_multipolygon(); }
     break;
 
-  case 76:
-#line 188 "wktparse.y"
+  case 136:
+#line 304 "wktparse.y"
     { pop();}
     break;
 
-  case 78:
-#line 193 "wktparse.y"
+  case 138:
+#line 309 "wktparse.y"
     { alloc_counter(); }
     break;
 
-  case 79:
-#line 193 "wktparse.y"
+  case 139:
+#line 309 "wktparse.y"
+    { pop(); }
+    break;
+
+  case 142:
+#line 319 "wktparse.y"
+    {alloc_multisurface(); }
+    break;
+
+  case 143:
+#line 319 "wktparse.y"
     { pop(); }
     break;
 
-  case 82:
-#line 204 "wktparse.y"
+  case 144:
+#line 321 "wktparse.y"
+    { set_zm(0, 1); alloc_multisurface(); }
+    break;
+
+  case 145:
+#line 322 "wktparse.y"
+    { pop(); }
+    break;
+
+  case 147:
+#line 327 "wktparse.y"
+    { alloc_counter(); }
+    break;
+
+  case 148:
+#line 327 "wktparse.y"
+    { pop(); }
+    break;
+
+  case 153:
+#line 341 "wktparse.y"
     { alloc_geomertycollection(); }
     break;
 
-  case 83:
-#line 205 "wktparse.y"
+  case 154:
+#line 342 "wktparse.y"
     { pop(); }
     break;
 
-  case 84:
-#line 207 "wktparse.y"
+  case 155:
+#line 344 "wktparse.y"
     { set_zm(0, 1); alloc_geomertycollection(); }
     break;
 
-  case 85:
-#line 208 "wktparse.y"
+  case 156:
+#line 345 "wktparse.y"
     { pop();}
     break;
 
-  case 87:
-#line 213 "wktparse.y"
+  case 158:
+#line 350 "wktparse.y"
     { alloc_counter(); }
     break;
 
-  case 88:
-#line 213 "wktparse.y"
+  case 159:
+#line 350 "wktparse.y"
     { pop(); }
     break;
 
-  case 95:
-#line 232 "wktparse.y"
+  case 166:
+#line 369 "wktparse.y"
     {alloc_point_2d(yyvsp[-1].value,yyvsp[0].value); }
     break;
 
-  case 96:
-#line 235 "wktparse.y"
+  case 167:
+#line 372 "wktparse.y"
     {alloc_point_3d(yyvsp[-2].value,yyvsp[-1].value,yyvsp[0].value); }
     break;
 
-  case 97:
-#line 238 "wktparse.y"
+  case 168:
+#line 375 "wktparse.y"
     {alloc_point_4d(yyvsp[-3].value,yyvsp[-2].value,yyvsp[-1].value,yyvsp[0].value); }
     break;
 
-  case 98:
-#line 241 "wktparse.y"
+  case 169:
+#line 378 "wktparse.y"
     { alloc_empty(); }
     break;
 
 
     }
 
-/* Line 991 of yacc.c.  */
-#line 1436 "y.tab.c"
+/* Line 1000 of yacc.c.  */
+#line 1761 "y.tab.c"
 \f
   yyvsp -= yylen;
   yyssp -= yylen;
@@ -1474,18 +1798,33 @@ yyerrlab:
        {
          YYSIZE_T yysize = 0;
          int yytype = YYTRANSLATE (yychar);
+         const char* yyprefix;
          char *yymsg;
-         int yyx, yycount;
+         int yyx;
 
-         yycount = 0;
          /* Start YYX at -YYN if negative to avoid negative indexes in
             YYCHECK.  */
-         for (yyx = yyn < 0 ? -yyn : 0;
-              yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
+         int yyxbegin = yyn < 0 ? -yyn : 0;
+
+         /* Stay within bounds of both yycheck and yytname.  */
+         int yychecklim = YYLAST - yyn;
+         int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
+         int yycount = 0;
+
+         yyprefix = ", expecting ";
+         for (yyx = yyxbegin; yyx < yyxend; ++yyx)
            if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
-             yysize += yystrlen (yytname[yyx]) + 15, yycount++;
-         yysize += yystrlen ("syntax error, unexpected ") + 1;
-         yysize += yystrlen (yytname[yytype]);
+             {
+               yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
+               yycount += 1;
+               if (yycount == 5)
+                 {
+                   yysize = 0;
+                   break;
+                 }
+             }
+         yysize += (sizeof ("syntax error, unexpected ")
+                    + yystrlen (yytname[yytype]));
          yymsg = (char *) YYSTACK_ALLOC (yysize);
          if (yymsg != 0)
            {
@@ -1494,16 +1833,13 @@ yyerrlab:
 
              if (yycount < 5)
                {
-                 yycount = 0;
-                 for (yyx = yyn < 0 ? -yyn : 0;
-                      yyx < (int) (sizeof (yytname) / sizeof (char *));
-                      yyx++)
+                 yyprefix = ", expecting ";
+                 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
                    if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
                      {
-                       const char *yyq = ! yycount ? ", expecting " : " or ";
-                       yyp = yystpcpy (yyp, yyq);
+                       yyp = yystpcpy (yyp, yyprefix);
                        yyp = yystpcpy (yyp, yytname[yyx]);
-                       yycount++;
+                       yyprefix = " or ";
                      }
                }
              yyerror (yymsg);
@@ -1524,51 +1860,56 @@ yyerrlab:
       /* If just tried and failed to reuse lookahead token after an
         error, discard it.  */
 
-      /* Return failure if at end of input.  */
-      if (yychar == YYEOF)
+      if (yychar <= YYEOF)
         {
-         /* Pop the error token.  */
-          YYPOPSTACK;
-         /* Pop the rest of the stack.  */
-         while (yyss < yyssp)
-           {
-             YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
-             yydestruct (yystos[*yyssp], yyvsp);
-             YYPOPSTACK;
-           }
-         YYABORT;
+          /* If at end of input, pop the error token,
+            then the rest of the stack, then return failure.  */
+         if (yychar == YYEOF)
+            for (;;)
+              {
+                YYPOPSTACK;
+                if (yyssp == yyss)
+                  YYABORT;
+                YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
+                yydestruct (yystos[*yyssp], yyvsp);
+              }
         }
+      else
+       {
+         YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
+         yydestruct (yytoken, &yylval);
+         yychar = YYEMPTY;
 
-      YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
-      yydestruct (yytoken, &yylval);
-      yychar = YYEMPTY;
-
+       }
     }
 
   /* Else will try to reuse lookahead token after shifting the error
      token.  */
-  goto yyerrlab2;
+  goto yyerrlab1;
 
 
-/*----------------------------------------------------.
-| yyerrlab1 -- error raised explicitly by an action.  |
-`----------------------------------------------------*/
-yyerrlab1:
+/*---------------------------------------------------.
+| yyerrorlab -- error raised explicitly by YYERROR.  |
+`---------------------------------------------------*/
+yyerrorlab:
 
-  /* Suppress GCC warning that yyerrlab1 is unused when no action
-     invokes YYERROR.  */
-#if defined (__GNUC_MINOR__) && 2093 <= (__GNUC__ * 1000 + __GNUC_MINOR__)
-  __attribute__ ((__unused__))
+#ifdef __GNUC__
+  /* Pacify GCC when the user code never invokes YYERROR and the label
+     yyerrorlab therefore never appears in user code.  */
+  if (0)
+     goto yyerrorlab;
 #endif
 
-
-  goto yyerrlab2;
+  yyvsp -= yylen;
+  yyssp -= yylen;
+  yystate = *yyssp;
+  goto yyerrlab1;
 
 
-/*---------------------------------------------------------------.
-| yyerrlab2 -- pop states until the error token can be shifted.  |
-`---------------------------------------------------------------*/
-yyerrlab2:
+/*-------------------------------------------------------------.
+| yyerrlab1 -- common code for both syntax error and YYERROR.  |
+`-------------------------------------------------------------*/
+yyerrlab1:
   yyerrstatus = 3;     /* Each real token shifted decrements this.  */
 
   for (;;)
@@ -1591,9 +1932,8 @@ yyerrlab2:
 
       YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
       yydestruct (yystos[yystate], yyvsp);
-      yyvsp--;
-      yystate = *--yyssp;
-
+      YYPOPSTACK;
+      yystate = *yyssp;
       YY_STACK_PRINT (yyss, yyssp);
     }
 
@@ -1642,7 +1982,7 @@ yyreturn:
 }
 
 
-#line 35 "wktparse.y"
+#line 379 "wktparse.y"
 
 
 
index fdb5574af720ba0c5a48a4922ff8b5206d74d286..a396c0bd78f8cd7b144e8b3e34cc9d75de2e119f 100644 (file)
@@ -1,7 +1,7 @@
-/* A Bison parser, made by GNU Bison 1.875.  */
+/* A Bison parser, made by GNU Bison 1.875c.  */
 
 /* Skeleton parser for Yacc-like parsing with Bison,
-   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
      MULTILINESTRING = 262,
      MULTIPOLYGON = 263,
      GEOMETRYCOLLECTION = 264,
-     POINTM = 265,
-     LINESTRINGM = 266,
-     POLYGONM = 267,
-     MULTIPOINTM = 268,
-     MULTILINESTRINGM = 269,
-     MULTIPOLYGONM = 270,
-     GEOMETRYCOLLECTIONM = 271,
-     SRID = 272,
-     EMPTY = 273,
-     VALUE = 274,
-     LPAREN = 275,
-     RPAREN = 276,
-     COMMA = 277,
-     EQUALS = 278,
-     SEMICOLON = 279,
-     WKB = 280
+     CIRCULARSTRING = 265,
+     COMPOUNDCURVE = 266,
+     CURVEPOLYGON = 267,
+     MULTICURVE = 268,
+     MULTISURFACE = 269,
+     POINTM = 270,
+     LINESTRINGM = 271,
+     POLYGONM = 272,
+     MULTIPOINTM = 273,
+     MULTILINESTRINGM = 274,
+     MULTIPOLYGONM = 275,
+     GEOMETRYCOLLECTIONM = 276,
+     CIRCULARSTRINGM = 277,
+     COMPOUNDCURVEM = 278,
+     CURVEPOLYGONM = 279,
+     MULTICURVEM = 280,
+     MULTISURFACEM = 281,
+     SRID = 282,
+     EMPTY = 283,
+     VALUE = 284,
+     LPAREN = 285,
+     RPAREN = 286,
+     COMMA = 287,
+     EQUALS = 288,
+     SEMICOLON = 289,
+     WKB = 290
    };
 #endif
 #define POINT 258
 #define MULTILINESTRING 262
 #define MULTIPOLYGON 263
 #define GEOMETRYCOLLECTION 264
-#define POINTM 265
-#define LINESTRINGM 266
-#define POLYGONM 267
-#define MULTIPOINTM 268
-#define MULTILINESTRINGM 269
-#define MULTIPOLYGONM 270
-#define GEOMETRYCOLLECTIONM 271
-#define SRID 272
-#define EMPTY 273
-#define VALUE 274
-#define LPAREN 275
-#define RPAREN 276
-#define COMMA 277
-#define EQUALS 278
-#define SEMICOLON 279
-#define WKB 280
+#define CIRCULARSTRING 265
+#define COMPOUNDCURVE 266
+#define CURVEPOLYGON 267
+#define MULTICURVE 268
+#define MULTISURFACE 269
+#define POINTM 270
+#define LINESTRINGM 271
+#define POLYGONM 272
+#define MULTIPOINTM 273
+#define MULTILINESTRINGM 274
+#define MULTIPOLYGONM 275
+#define GEOMETRYCOLLECTIONM 276
+#define CIRCULARSTRINGM 277
+#define COMPOUNDCURVEM 278
+#define CURVEPOLYGONM 279
+#define MULTICURVEM 280
+#define MULTISURFACEM 281
+#define SRID 282
+#define EMPTY 283
+#define VALUE 284
+#define LPAREN 285
+#define RPAREN 286
+#define COMMA 287
+#define EQUALS 288
+#define SEMICOLON 289
+#define WKB 290
 
 
 
@@ -87,8 +107,8 @@ typedef union YYSTYPE {
        double value;
        const char* wkb;
 } YYSTYPE;
-/* Line 1248 of yacc.c.  */
-#line 91 "y.tab.h"
+/* Line 1275 of yacc.c.  */
+#line 112 "y.tab.h"
 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
 # define YYSTYPE_IS_DECLARED 1
 # define YYSTYPE_IS_TRIVIAL 1
index d34e5ccd0162f627e55b3d134371f1f71b192757..d97cbcfeb60fb78ca28e61931e6a49aecbc0a6fc 100644 (file)
@@ -22,8 +22,8 @@ int lwg_parse_yylex(void);
        const char* wkb;
 }
 
-%token POINT LINESTRING POLYGON MULTIPOINT MULTILINESTRING MULTIPOLYGON GEOMETRYCOLLECTION
-%token POINTM LINESTRINGM POLYGONM MULTIPOINTM MULTILINESTRINGM MULTIPOLYGONM GEOMETRYCOLLECTIONM
+%token POINT LINESTRING POLYGON MULTIPOINT MULTILINESTRING MULTIPOLYGON GEOMETRYCOLLECTION CIRCULARSTRING COMPOUNDCURVE CURVEPOLYGON MULTICURVE MULTISURFACE
+%token POINTM LINESTRINGM POLYGONM MULTIPOINTM MULTILINESTRINGM MULTIPOLYGONM GEOMETRYCOLLECTIONM CIRCULARSTRINGM COMPOUNDCURVEM CURVEPOLYGONM  MULTICURVEM MULTISURFACEM
 %token SRID      
 %token EMPTY
 %token <value> VALUE
@@ -44,14 +44,24 @@ geometry_int :
        |
        geom_linestring
        |
+        geom_circularstring
+        |
        geom_polygon
        |
+        geom_compoundcurve
+        |
+        geom_curvepolygon
+        |
        geom_multipoint 
        |
        geom_multilinestring
+        |
+        geom_multicurve
        |
        geom_multipolygon
        |
+        geom_multisurface
+        |
        geom_geometrycollection
 
 srid :
@@ -79,7 +89,6 @@ empty_point :
 nonempty_point :
        { alloc_point(); } point_int { pop(); } 
 
-
 point_int :
        LPAREN a_point RPAREN
 
@@ -125,6 +134,9 @@ empty_linestring :
 nonempty_linestring :
        { alloc_linestring(); } linestring_1 { pop(); } 
 
+nonempty_linestring_closed :
+        { alloc_linestring_closed(); } linestring_1 { pop(); }
+
 linestring_1 :
        { alloc_counter(); } LPAREN linestring_int RPAREN { popc(); }
 
@@ -133,6 +145,66 @@ linestring_int :
        |
        linestring_int COMMA a_point;
 
+/* CIRCULARSTRING */
+
+geom_circularstring :
+        CIRCULARSTRING circularstring
+        |
+        CIRCULARSTRINGM {set_zm(0, 1); } circularstring
+
+geom_circularstring_closed :
+        CIRCULARSTRING circularstring_closed
+        |
+        CIRCULARSTRINGM {set_zm(0, 1); } circularstring_closed
+
+circularstring :
+        empty_circularstring
+        |
+        nonempty_circularstring
+
+circularstring_closed :
+        empty_circularstring
+        |
+        nonempty_circularstring_closed
+
+empty_circularstring :
+        { alloc_circularstring(); } empty { pop(); }
+
+nonempty_circularstring :
+        { alloc_circularstring(); } circularstring_1 { pop(); }
+
+nonempty_circularstring_closed :
+        { alloc_circularstring_closed(); } circularstring_1 { pop(); }
+
+circularstring_1 :
+        { alloc_counter(); } LPAREN circularstring_int RPAREN { popc(); }
+
+circularstring_int :
+        a_point
+        |
+        circularstring_int COMMA a_point;
+
+/* COMPOUNDCURVE */
+
+geom_compoundcurve:
+        COMPOUNDCURVE { alloc_compoundcurve(); } compoundcurve { pop(); }
+        |
+        COMPOUNDCURVEM {set_zm(0, 1); alloc_compoundcurve(); } compoundcurve { pop(); }
+
+compoundcurve:
+        empty
+        |
+        { alloc_counter(); } LPAREN compoundcurve_int RPAREN { pop(); }
+
+compoundcurve_int:
+        nonempty_linestring
+        |
+        geom_circularstring
+        |
+        compoundcurve_int COMMA nonempty_linestring
+        |
+        compoundcurve_int COMMA geom_circularstring
+
 /* MULTILINESTRING */
 
 geom_multilinestring :
@@ -152,6 +224,28 @@ multilinestring_int :
        |
        multilinestring_int COMMA nonempty_linestring
 
+/* MULTICURVESTRING */
+
+geom_multicurve :
+        MULTICURVE { alloc_multicurve(); }
+                multicurve { pop(); }
+        |
+        MULTICURVEM { set_zm(0, 1); alloc_multicurve(); }
+                multicurve { pop(); }
+
+multicurve :
+        empty
+        |
+        { alloc_counter(); } LPAREN multicurve_int RPAREN { pop(); }
+
+multicurve_int :
+        nonempty_linestring
+        |
+        geom_circularstring
+        |
+        multicurve_int COMMA nonempty_linestring
+        |
+        multicurve_int COMMA geom_circularstring
 
 /* POLYGON */
 
@@ -178,7 +272,29 @@ polygon_int :
        linestring_1
        |
        polygon_int COMMA linestring_1
-                                                                                                          
+
+/* CURVEPOLYGON */
+
+geom_curvepolygon :
+        CURVEPOLYGON { alloc_curvepolygon(); } curvepolygon { pop(); }
+        |
+        CURVEPOLYGONM { set_zm(0, 1); alloc_curvepolygon(); } 
+                        curvepolygon { pop(); }
+
+curvepolygon :
+        empty
+        |
+        { alloc_counter(); } LPAREN curvepolygon_int RPAREN { pop(); }
+
+curvepolygon_int :
+        nonempty_linestring_closed
+        |
+        geom_circularstring_closed
+        |
+        curvepolygon_int COMMA nonempty_linestring_closed
+        |
+        curvepolygon_int COMMA geom_circularstring_closed
+
 /* MULTIPOLYGON */
 
 geom_multipolygon :
@@ -197,6 +313,27 @@ multipolygon_int :
        |
        multipolygon_int COMMA nonempty_polygon
 
+/* MULTISURFACE */
+
+geom_multisurface :
+        MULTISURFACE {alloc_multisurface(); } multisurface { pop(); }
+        |
+        MULTISURFACEM { set_zm(0, 1); alloc_multisurface(); }
+                multisurface { pop(); }
+
+multisurface :
+        empty
+        |
+        { alloc_counter(); } LPAREN multisurface_int RPAREN { pop(); }
+
+multisurface_int :
+        nonempty_polygon
+        |
+        geom_curvepolygon
+        |
+        multisurface_int COMMA nonempty_polygon
+        |
+        multisurface_int COMMA geom_curvepolygon
 
 /* GEOMETRYCOLLECTION */
 
index 0eb97cb13b955002e04c228307276f41c2e4f5bb..152fa7f495a73bc76e30afed048317bb09f2cfee 100644 (file)
@@ -237,6 +237,49 @@ uchar *output_multipoint(uchar* geom,int suppress){
        return output_wkt(geom,suppress);
 }
 
+/* special case for compound to suppress linestring but not circularstring */
+uchar *output_compound(uchar* geom, int suppress) {
+        unsigned type;
+
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("output_compound called.");
+#endif
+
+        type=*geom++;
+        switch(TYPE_GETTYPE(type)) 
+        {
+                case LINETYPE:
+                        geom = output_collection(geom,output_point,0);
+                        break;
+                case CURVETYPE:
+                        write_str("CIRCULARSTRING");
+                        geom = output_collection(geom,output_point,1);
+                        break;
+        }
+       return geom;
+}
+
+uchar *output_multisurface(uchar* geom, int suppress) {
+        unsigned type;
+
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("output_multisurface called.");
+#endif
+
+        type=*geom++;
+        switch(TYPE_GETTYPE(type))
+        {
+                case POLYGONTYPE:
+                        geom = output_collection(geom, output_collection_2,0);
+                        break;
+                case CURVEPOLYTYPE:
+                        write_str("CURVEPOLYGON");
+                        geom = output_collection(geom, output_compound,1);
+                        break;
+        }
+        return geom;
+}
+
 /*
  * Suppress=0 -- write TYPE, M, coords
  * Suppress=1 -- write TYPE, coords 
@@ -250,6 +293,10 @@ output_wkt(uchar* geom, int supress)
        char writeM=0;
        dims = TYPE_NDIMS(type); /* ((type & 0x30) >> 4)+2; */
 
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("output_wkt called.");
+#endif
+
        if ( ! supress && !TYPE_HASZ(type) && TYPE_HASM(type) ) writeM=1;
 
 
@@ -280,6 +327,14 @@ output_wkt(uchar* geom, int supress)
                        }
                        geom = output_collection(geom,output_point,0);
                        break;
+                case CURVETYPE:
+                        if ( supress < 2 )
+                        {
+                                if(writeM) write_str("CIRCULARSTRINGM");
+                                else write_str("CIRCULARSTRING");
+                        }
+                        geom = output_collection(geom,output_point,0);
+                        break;
                case POLYGONTYPE:
                        if ( supress < 2 )
                        {
@@ -288,6 +343,22 @@ output_wkt(uchar* geom, int supress)
                        }
                        geom = output_collection(geom,output_collection_2,0);
                        break;
+                case COMPOUNDTYPE:
+                        if ( supress < 2 )
+                        {
+                                if (writeM) write_str("COMPOUNDCURVEM");
+                                else write_str("COMPOUNDCURVE");
+                        }
+                        geom = output_collection(geom, output_compound,1);
+                        break;
+                case CURVEPOLYTYPE:
+                        if (supress < 2)
+                        {
+                                if(writeM) write_str("CURVEPOLYGONM");
+                                else write_str("CURVEPOLYGON");
+                        }
+                        geom = output_collection(geom, output_compound,0);
+                        break;
                case MULTIPOINTTYPE:
                        if ( supress < 2 )
                        {
@@ -304,6 +375,14 @@ output_wkt(uchar* geom, int supress)
                        }
                        geom = output_collection(geom,output_wkt,2);
                        break;
+                case MULTICURVETYPE:
+                        if ( supress < 2 )
+                        {
+                                if (writeM) write_str("MULTICURVEM");
+                                else write_str("MULTICURVE");
+                        }
+                        geom = output_collection(geom,output_compound,2);
+                        break;
                case MULTIPOLYGONTYPE:
                        if ( supress < 2 )
                        {
@@ -312,6 +391,14 @@ output_wkt(uchar* geom, int supress)
                        }
                        geom = output_collection(geom,output_wkt,2);
                        break;
+                case MULTISURFACETYPE:
+                        if ( supress < 2)
+                        {
+                                if (writeM) write_str("MULTISURFACEM");
+                                else write_str("MULTISURFACE");
+                        } 
+                        geom = output_collection(geom,output_multisurface,2);
+                        break;
                case COLLECTIONTYPE:
                        if ( supress < 2 )
                        {
@@ -359,6 +446,10 @@ char *
 unparse_WKT(uchar* serialized, allocator alloc, freeor free)
 {
 
+#ifdef PGIS_DEBUG_CALLS
+        lwnotice("unparse_WKT called.");
+#endif
+
        if (serialized==NULL)
                return NULL;
 
@@ -480,7 +571,6 @@ output_wkb_collection_2(uchar* geom){
        return output_wkb_collection(geom,output_wkb_point);
 }
 
-
 uchar *
 output_wkb(uchar* geom)
 {
@@ -524,9 +614,20 @@ output_wkb(uchar* geom)
                case LINETYPE:
                        geom=output_wkb_collection(geom,output_wkb_point);
                        break;
+                case CURVETYPE:
+                        geom=output_wkb_collection(geom,output_wkb_point);
+                        break;
                case POLYGONTYPE:
                        geom=output_wkb_collection(geom,output_wkb_collection_2);
                        break;
+                case COMPOUNDTYPE:
+                        geom=output_wkb_collection(geom,output_wkb);
+                        break;
+                case CURVEPOLYTYPE:
+                        geom=output_wkb_collection(geom,output_wkb);
+                        break;
+                case MULTICURVETYPE:
+                case MULTISURFACETYPE:
                case MULTIPOINTTYPE:
                case MULTILINETYPE:
                case MULTIPOLYGONTYPE:
index 9eddc186521c9eea3b276bfadd7a6f39a79bb3cb..a08b52e7fcac93f99a02b8637b84365ad2981230 100644 (file)
@@ -27,7 +27,8 @@ TESTS = \
        wkt \
        measures \
        long_xact \
-       ctors
+       ctors \
+       sql-mm-serialize
 
 ifeq ($(USE_GEOS),1)
        TESTS += regress_ogc regress_bdpoly
index 563a32464e9ea01fa04a3aea0d843587e28e3b9c..60011689de3168e140f5d980d1f5f35423e666e4 100644 (file)
@@ -1,5 +1,5 @@
 BOX(0 0.0999999940395355,11 12)
-BOX3D(0 0.1 -3,11 12 12)
+BOX3D(0 0.1 -55,11 12 12)
 10431
 15063
 19695
diff --git a/regress/sql-mm-serialize.sql b/regress/sql-mm-serialize.sql
new file mode 100644 (file)
index 0000000..8c6e983
--- /dev/null
@@ -0,0 +1,164 @@
+\r
+CREATE TABLE serialize_test (\r
+        id INTEGER,\r
+        description VARCHAR,\r
+        ewkt VARCHAR,\r
+        serialized TEXT);\r
+\r
+INSERT INTO serialize_test (\r
+        id, description, ewkt, serialized\r
+      ) VALUES (\r
+        1, 'Circular String',\r
+        'CIRCULARSTRING(-2 0,0 2,2 0,0 2,2 4)',\r
+        '01080000000500000000000000000000C0000000000000000000000000000000000000000000000040000000000000004000000000000000000000000000000000000000000000004000000000000000400000000000001040');\r
+INSERT INTO serialize_test (\r
+        id, description, ewkt, serialized\r
+      ) VALUES (\r
+        2, 'Circular String, SRID=4326',\r
+        'SRID=4326;CIRCULARSTRING(-2 0,0 2,2 0,0 2,2 4)',\r
+        '0108000020E61000000500000000000000000000C0000000000000000000000000000000000000000000000040000000000000004000000000000000000000000000000000000000000000004000000000000000400000000000001040');\r
+INSERT INTO serialize_test (\r
+        id, description, ewkt, serialized\r
+      ) VALUES (\r
+        3, 'Circular String 3dz, SRID=4326',\r
+        'SRID=4326;CIRCULARSTRING(-2 0 1,0 2 1,2 0 1,0 2 1,2 4 1)',\r
+        '01080000A0E61000000500000000000000000000C00000000000000000000000000000F03F00000000000000000000000000000040000000000000F03F00000000000000400000000000000000000000000000F03F00000000000000000000000000000040000000000000F03F00000000000000400000000000001040000000000000F03F');\r
+INSERT INTO serialize_test (\r
+        id, description, ewkt, serialized\r
+      ) VALUES (\r
+        4, 'Circular String 3dm, SRID=4326',\r
+        'SRID=4326;CIRCULARSTRINGM(-2 0 1,0 2 1,2 0 1,0 2 1,2 4 1)',\r
+        '0108000060E61000000500000000000000000000C00000000000000000000000000000F03F00000000000000000000000000000040000000000000F03F00000000000000400000000000000000000000000000F03F00000000000000000000000000000040000000000000F03F00000000000000400000000000001040000000000000F03F');\r
+INSERT INTO serialize_test (\r
+        id, description, ewkt, serialized\r
+      ) VALUES (\r
+        5, 'Circular String 4d, SRID=4326',\r
+        'SRID=4326;CIRCULARSTRING(-2 0 1 0,0 2 1 0,2 0 1 0,0 2 1 0,2 4 1 0)',\r
+        '01080000E0E61000000500000000000000000000C00000000000000000000000000000F03F000000000000000000000000000000000000000000000040000000000000F03F000000000000000000000000000000400000000000000000000000000000F03F000000000000000000000000000000000000000000000040000000000000F03F000000000000000000000000000000400000000000001040000000000000F03F0000000000000000');\r
+INSERT INTO serialize_test (\r
+        id, description, ewkt, serialized\r
+      ) VALUES (\r
+        6, 'Circular String',\r
+        'COMPOUNDCURVE(CIRCULARSTRING(0 0,1 1,1 0),(1 0,0 1))',\r
+        '01090000000200000001080000000300000000000000000000000000000000000000000000000000F03F000000000000F03F000000000000F03F0000000000000000010200000002000000000000000000F03F00000000000000000000000000000000000000000000F03F');\r
+INSERT INTO serialize_test (\r
+        id, description, ewkt, serialized\r
+      ) VALUES (\r
+        7, 'Compound Curve, SRID=4326',\r
+        'SRID=4326;COMPOUNDCURVE(CIRCULARSTRING(0 0,1 1,1 0),(1 0,0 1))',\r
+        '0109000020E61000000200000001080000000300000000000000000000000000000000000000000000000000F03F000000000000F03F000000000000F03F0000000000000000010200000002000000000000000000F03F00000000000000000000000000000000000000000000F03F');\r
+INSERT INTO serialize_test (\r
+        id, description, ewkt, serialized\r
+      ) VALUES (\r
+        8, 'Compound Curve 3dz, SRID=4326',\r
+        'SRID=4326;COMPOUNDCURVE(CIRCULARSTRING(0 0 2,1 1 2,1 0 2),(1 0 2,0 1 2))',\r
+        '01090000A0E610000002000000010800008003000000000000000000000000000000000000000000000000000040000000000000F03F000000000000F03F0000000000000040000000000000F03F00000000000000000000000000000040010200008002000000000000000000F03F000000000000000000000000000000400000000000000000000000000000F03F0000000000000040');\r
+INSERT INTO serialize_test (\r
+        id, description, ewkt, serialized\r
+      ) VALUES (\r
+        9, 'Circular String 3dm, SRID=4326',\r
+        'SRID=4326;COMPOUNDCURVEM(CIRCULARSTRING(0 0 2,1 1 2,1 0 2),(1 0 2,0 1 2))',\r
+        '0109000060E610000002000000010800004003000000000000000000000000000000000000000000000000000040000000000000F03F000000000000F03F0000000000000040000000000000F03F00000000000000000000000000000040010200004002000000000000000000F03F000000000000000000000000000000400000000000000000000000000000F03F0000000000000040');\r
+INSERT INTO serialize_test (\r
+        id, description, ewkt, serialized\r
+      ) VALUES (\r
+        10, 'Circular String 4d, SRID=4326',\r
+        'SRID=4326;COMPOUNDCURVE(CIRCULARSTRING(0 0 2 5,1 1 2 5,1 0 2 5),(1 0 2 5,0 1 2 2))',\r
+        '01090000E0E61000000200000001080000C0030000000000000000000000000000000000000000000000000000400000000000001440000000000000F03F000000000000F03F00000000000000400000000000001440000000000000F03F00000000000000000000000000000040000000000000144001020000C002000000000000000000F03F0000000000000000000000000000004000000000000014400000000000000000000000000000F03F00000000000000400000000000000040');\r
+INSERT INTO serialize_test(\r
+        id, description, ewkt, serialized\r
+      ) VALUES (\r
+        11, 'Curve Polygon',\r
+        'CURVEPOLYGON(CIRCULARSTRING(-2 0,-1 -1,0 0,1 -1,2 0,0 2,-2 0),(-1 0,0 0.5,1 0,0 1,-1 0))',\r
+        '010D0000000200000001080000000700000000000000000000C00000000000000000000000000000F0BF000000000000F0BF00000000000000000000000000000000000000000000F03F000000000000F0BF000000000000004000000000000000000000000000000000000000000000004000000000000000C00000000000000000010200000005000000000000000000F0BF00000000000000000000000000000000000000000000E03F000000000000F03F00000000000000000000000000000000000000000000F03F000000000000F0BF0000000000000000');\r
+INSERT INTO serialize_test(\r
+        id, description, ewkt, serialized\r
+      ) VALUES (\r
+        12, 'Curve Polygon, SRID=4326',\r
+        'SRID=4326;CURVEPOLYGON(CIRCULARSTRING(-2 0,-1 -1,0 0,1 -1,2 0,0 2,-2 0),(-1 0,0 0.5,1 0,0 1,-1 0))',\r
+        '010D000020E61000000200000001080000000700000000000000000000C00000000000000000000000000000F0BF000000000000F0BF00000000000000000000000000000000000000000000F03F000000000000F0BF000000000000004000000000000000000000000000000000000000000000004000000000000000C00000000000000000010200000005000000000000000000F0BF00000000000000000000000000000000000000000000E03F000000000000F03F00000000000000000000000000000000000000000000F03F000000000000F0BF0000000000000000');\r
+INSERT INTO serialize_test(\r
+        id, description, ewkt, serialized\r
+      ) VALUES (\r
+        13, 'Curve Polygon 3dz, SRID=4326',\r
+        'SRID=4326;CURVEPOLYGON(CIRCULARSTRING(-2 0 0,-1 -1 1,0 0 2,1 -1 3,2 0 4,0 2 2,-2 0 0),(-1 0 1,0 0.5 2,1 0 3,0 1 3,-1 0 1))',\r
+        '010D0000A0E61000000200000001080000800700000000000000000000C000000000000000000000000000000000000000000000F0BF000000000000F0BF000000000000F03F000000000000000000000000000000000000000000000040000000000000F03F000000000000F0BF000000000000084000000000000000400000000000000000000000000000104000000000000000000000000000000040000000000000004000000000000000C000000000000000000000000000000000010200008005000000000000000000F0BF0000000000000000000000000000F03F0000000000000000000000000000E03F0000000000000040000000000000F03F000000000000000000000000000008400000000000000000000000000000F03F0000000000000840000000000000F0BF0000000000000000000000000000F03F');\r
+INSERT INTO serialize_test(\r
+        id, description, ewkt, serialized\r
+      ) VALUES (\r
+        14, 'Curve Polygon 3dm, SRID=4326',\r
+        'SRID=4326;CURVEPOLYGONM(CIRCULARSTRING(-2 0 0,-1 -1 2,0 0 4,1 -1 6,2 0 8,0 2 4,-2 0 0),(-1 0 2,0 0.5 4,1 0 6,0 1 4,-1 0 2))',\r
+        '010D000060E61000000200000001080000400700000000000000000000C000000000000000000000000000000000000000000000F0BF000000000000F0BF0000000000000040000000000000000000000000000000000000000000001040000000000000F03F000000000000F0BF000000000000184000000000000000400000000000000000000000000000204000000000000000000000000000000040000000000000104000000000000000C000000000000000000000000000000000010200004005000000000000000000F0BF000000000000000000000000000000400000000000000000000000000000E03F0000000000001040000000000000F03F000000000000000000000000000018400000000000000000000000000000F03F0000000000001040000000000000F0BF00000000000000000000000000000040');\r
+INSERT INTO serialize_test(\r
+        id, description, ewkt, serialized\r
+      ) VALUES (\r
+        15, 'Curve Polygon 4d, SRID=4326',\r
+        'SRID=4326;CURVEPOLYGON(CIRCULARSTRING(-2 0 0 0,-1 -1 1 2,0 0 2 4,1 -1 3 6,2 0 4 8,0 2 2 4,-2 0 0 0),(-1 0 1 2,0 0.5 2 4,1 0 3 6,0 1 3 4,-1 0 1 2))',\r
+        '010D0000E0E61000000200000001080000C00700000000000000000000C0000000000000000000000000000000000000000000000000000000000000F0BF000000000000F0BF000000000000F03F00000000000000400000000000000000000000000000000000000000000000400000000000001040000000000000F03F000000000000F0BF000000000000084000000000000018400000000000000040000000000000000000000000000010400000000000002040000000000000000000000000000000400000000000000040000000000000104000000000000000C000000000000000000000000000000000000000000000000001020000C005000000000000000000F0BF0000000000000000000000000000F03F00000000000000400000000000000000000000000000E03F00000000000000400000000000001040000000000000F03F0000000000000000000000000000084000000000000018400000000000000000000000000000F03F00000000000008400000000000001040000000000000F0BF0000000000000000000000000000F03F0000000000000040');\r
+INSERT INTO serialize_test(\r
+        id, description, ewkt, serialized\r
+      ) VALUES (\r
+        16, 'Multi Curve',\r
+        'MULTICURVE((5 5,3 5,3 3,0 3),CIRCULARSTRING(0 0,2 1,2 2))',\r
+        '010E0000000200000001020000000400000000000000000014400000000000001440000000000000084000000000000014400000000000000840000000000000084000000000000000000000000000000840010800000003000000000000000000000000000000000000000000000000000040000000000000F03F00000000000000400000000000000040');\r
+INSERT INTO serialize_test(\r
+        id, description, ewkt, serialized\r
+      ) VALUES (\r
+        17, 'Multi Curve, SRID=4326',\r
+        'SRID=4326;MULTICURVE((5 5,3 5,3 3,0 3),CIRCULARSTRING(0 0,2 1,2 2))',\r
+        '010E000020E61000000200000001020000000400000000000000000014400000000000001440000000000000084000000000000014400000000000000840000000000000084000000000000000000000000000000840010800000003000000000000000000000000000000000000000000000000000040000000000000F03F00000000000000400000000000000040');\r
+INSERT INTO serialize_test(\r
+        id, description, ewkt, serialized\r
+      ) VALUES (\r
+        18, 'Multi Curve 3dz, SRID=4326',\r
+        'SRID=4326;MULTICURVE((5 5 1,3 5 2,3 3 3,0 3 1),CIRCULARSTRING(0 0 0,2 1 3,2 2 1))',\r
+        '010E0000A0E61000000200000001020000800400000000000000000014400000000000001440000000000000F03F00000000000008400000000000001440000000000000004000000000000008400000000000000840000000000000084000000000000000000000000000000840000000000000F03F0108000080030000000000000000000000000000000000000000000000000000000000000000000040000000000000F03F000000000000084000000000000000400000000000000040000000000000F03F');\r
+INSERT INTO serialize_test(\r
+        id, description, ewkt, serialized\r
+      ) VALUES (\r
+        19, 'Multi Curve 3dm, SRID=4326',\r
+        'SRID=4326;MULTICURVEM((5 5 3,3 5 2,3 3 1,0 3 1),CIRCULARSTRING(0 0 0,2 1 -2,2 2 2))',\r
+        '010E000060E61000000200000001020000400400000000000000000014400000000000001440000000000000084000000000000008400000000000001440000000000000004000000000000008400000000000000840000000000000F03F00000000000000000000000000000840000000000000F03F0108000040030000000000000000000000000000000000000000000000000000000000000000000040000000000000F03F00000000000000C0000000000000004000000000000000400000000000000040');\r
+INSERT INTO serialize_test(\r
+        id, description, ewkt, serialized\r
+      ) VALUES (\r
+        20, 'Multi Curve 4d, SRID=4326',\r
+        'SRID=4326;MULTICURVE((5 5 1 3,3 5 2 2,3 3 3 1,0 3 1 1),CIRCULARSTRING(0 0 0 0,2 1 3 -2,2 2 1 2))',\r
+        '010E0000E0E61000000200000001020000C00400000000000000000014400000000000001440000000000000F03F00000000000008400000000000000840000000000000144000000000000000400000000000000040000000000000084000000000000008400000000000000840000000000000F03F00000000000000000000000000000840000000000000F03F000000000000F03F01080000C00300000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000F03F000000000000084000000000000000C000000000000000400000000000000040000000000000F03F0000000000000040');\r
+INSERT INTO serialize_test(\r
+        id, description, ewkt, serialized\r
+      ) VALUES (\r
+        21, 'Multi Surface',\r
+        'MULTISURFACE(CURVEPOLYGON(CIRCULARSTRING(-2 0,-1 -1,0 0,1 -1,2 0,0 2,-2 0),(-1 0,0 0.5,1 0,0 1,-1 0)),((7 8,10 10,6 14,4 11,7 8)))',\r
+        '010F00000002000000010D0000000200000001080000000700000000000000000000C00000000000000000000000000000F0BF000000000000F0BF00000000000000000000000000000000000000000000F03F000000000000F0BF000000000000004000000000000000000000000000000000000000000000004000000000000000C00000000000000000010200000005000000000000000000F0BF00000000000000000000000000000000000000000000E03F000000000000F03F00000000000000000000000000000000000000000000F03F000000000000F0BF0000000000000000010300000001000000050000000000000000001C4000000000000020400000000000002440000000000000244000000000000018400000000000002C40000000000000104000000000000026400000000000001C400000000000002040');\r
+INSERT INTO serialize_test(\r
+        id, description, ewkt, serialized\r
+      ) VALUES (\r
+        22, 'Multi Surface, SRID=4326',\r
+        'SRID=4326;MULTISURFACE(CURVEPOLYGON(CIRCULARSTRING(-2 0,-1 -1,0 0,1 -1,2 0,0 2,-2 0),(-1 0,0 0.5,1 0,0 1,-1 0)),((7 8,10 10,6 14,4 11,7 8)))',\r
+        '010F000020E610000002000000010D0000000200000001080000000700000000000000000000C00000000000000000000000000000F0BF000000000000F0BF00000000000000000000000000000000000000000000F03F000000000000F0BF000000000000004000000000000000000000000000000000000000000000004000000000000000C00000000000000000010200000005000000000000000000F0BF00000000000000000000000000000000000000000000E03F000000000000F03F00000000000000000000000000000000000000000000F03F000000000000F0BF0000000000000000010300000001000000050000000000000000001C4000000000000020400000000000002440000000000000244000000000000018400000000000002C40000000000000104000000000000026400000000000001C400000000000002040');\r
+INSERT INTO serialize_test(\r
+        id, description, ewkt, serialized\r
+      ) VALUES (\r
+        23, 'Multi Surface 3dz, SRID=4326',\r
+        'SRID=4326;MULTISURFACE(CURVEPOLYGON(CIRCULARSTRING(-2 0 0,-1 -1 1,0 0 2,1 -1 3,2 0 4,0 2 2,-2 0 0),(-1 0 1,0 0.5 2,1 0 3,0 1 3,-1 0 1)),((7 8 7,10 10 5,6 14 3,4 11 4,7 8 7)))',\r
+        '010F0000A0E610000002000000010D0000800200000001080000800700000000000000000000C000000000000000000000000000000000000000000000F0BF000000000000F0BF000000000000F03F000000000000000000000000000000000000000000000040000000000000F03F000000000000F0BF000000000000084000000000000000400000000000000000000000000000104000000000000000000000000000000040000000000000004000000000000000C000000000000000000000000000000000010200008005000000000000000000F0BF0000000000000000000000000000F03F0000000000000000000000000000E03F0000000000000040000000000000F03F000000000000000000000000000008400000000000000000000000000000F03F0000000000000840000000000000F0BF0000000000000000000000000000F03F010300008001000000050000000000000000001C4000000000000020400000000000001C4000000000000024400000000000002440000000000000144000000000000018400000000000002C4000000000000008400000000000001040000000000000264000000000000010400000000000001C4000000000000020400000000000001C40');\r
+INSERT INTO serialize_test(\r
+        id, description, ewkt, serialized\r
+      ) VALUES (\r
+        24, 'Multi Surface 3dm, SRID=4326',\r
+        'SRID=4326;MULTISURFACEM(CURVEPOLYGON(CIRCULARSTRING(-2 0 0,-1 -1 2,0 0 4,1 -1 6,2 0 8,0 2 4,-2 0 0),(-1 0 2,0 0.5 4,1 0 6,0 1 4,-1 0 2)),((7 8 8,10 10 5,6 14 1,4 11 6,7 8 8)))',\r
+        '010F000060E610000002000000010D0000400200000001080000400700000000000000000000C000000000000000000000000000000000000000000000F0BF000000000000F0BF0000000000000040000000000000000000000000000000000000000000001040000000000000F03F000000000000F0BF000000000000184000000000000000400000000000000000000000000000204000000000000000000000000000000040000000000000104000000000000000C000000000000000000000000000000000010200004005000000000000000000F0BF000000000000000000000000000000400000000000000000000000000000E03F0000000000001040000000000000F03F000000000000000000000000000018400000000000000000000000000000F03F0000000000001040000000000000F0BF00000000000000000000000000000040010300004001000000050000000000000000001C400000000000002040000000000000204000000000000024400000000000002440000000000000144000000000000018400000000000002C40000000000000F03F0000000000001040000000000000264000000000000018400000000000001C4000000000000020400000000000002040');\r
+INSERT INTO serialize_test(\r
+        id, description, ewkt, serialized\r
+      ) VALUES (\r
+        25, 'Multi Surface 4d, SRID=4326',\r
+        'SRID=4326;MULTISURFACE(CURVEPOLYGON(CIRCULARSTRING(-2 0 0 0,-1 -1 1 2,0 0 2 4,1 -1 3 6,2 0 4 8,0 2 2 4,-2 0 0 0),(-1 0 1 2,0 0.5 2 4,1 0 3 6,0 1 3 4,-1 0 1 2)),((7 8 7 8,10 10 5 5,6 14 3 1,4 11 4 6,7 8 7 8)))',\r
+        '010F0000E0E610000002000000010D0000C00200000001080000C00700000000000000000000C0000000000000000000000000000000000000000000000000000000000000F0BF000000000000F0BF000000000000F03F00000000000000400000000000000000000000000000000000000000000000400000000000001040000000000000F03F000000000000F0BF000000000000084000000000000018400000000000000040000000000000000000000000000010400000000000002040000000000000000000000000000000400000000000000040000000000000104000000000000000C000000000000000000000000000000000000000000000000001020000C005000000000000000000F0BF0000000000000000000000000000F03F00000000000000400000000000000000000000000000E03F00000000000000400000000000001040000000000000F03F0000000000000000000000000000084000000000000018400000000000000000000000000000F03F00000000000008400000000000001040000000000000F0BF0000000000000000000000000000F03F000000000000004001030000C001000000050000000000000000001C4000000000000020400000000000001C400000000000002040000000000000244000000000000024400000000000001440000000000000144000000000000018400000000000002C400000000000000840000000000000F03F00000000000010400000000000002640000000000000104000000000000018400000000000001C4000000000000020400000000000001C400000000000002040');\r
+\r
+\r
+    \r
+SELECT id, CASE WHEN ewkt = asEWKT(serialized::geometry) THEN 'pass' ELSE 'fail' END AS result FROM serialize_test ORDER BY id;\r
+SELECT id, CASE WHEN asEWKB(geomFromEWKT(ewkt)) = serialized THEN 'pass' ELSE 'fail' END AS result FROM serialize_test ORDER BY id;\r
+\r
+DROP TABLE serialize_test;\r
diff --git a/regress/sql-mm-serialize_expected b/regress/sql-mm-serialize_expected
new file mode 100644 (file)
index 0000000..b7feae0
--- /dev/null
@@ -0,0 +1,50 @@
+1|pass
+2|pass
+3|pass
+4|pass
+5|pass
+6|pass
+7|pass
+8|pass
+9|pass
+10|pass
+11|pass
+12|pass
+13|pass
+14|pass
+15|pass
+16|pass
+17|pass
+18|pass
+19|pass
+20|pass
+21|pass
+22|pass
+23|pass
+24|pass
+25|pass
+1|pass
+2|pass
+3|pass
+4|pass
+5|pass
+6|pass
+7|pass
+8|pass
+9|pass
+10|pass
+11|pass
+12|pass
+13|pass
+14|pass
+15|pass
+16|pass
+17|pass
+18|pass
+19|pass
+20|pass
+21|pass
+22|pass
+23|pass
+24|pass
+25|pass