diff --git a/Makefile b/Makefile index fc68da1..2013a00 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ # pointcloud MODULE_big = pointcloud -OBJS = pc_core.o +OBJS = pc_core.a EXTENSION = pointcloud DATA = pointcloud--1.0.sql @@ -13,4 +13,7 @@ SHLIB_LINK += $(filter -lm, $(LIBS)) # We are going to use PGXS for sure PG_CONFIG = pg_config PGXS := $(shell $(PG_CONFIG) --pgxs) -include $(PGXS) \ No newline at end of file +include $(PGXS) + + +pg_core.a: pc_core.o \ No newline at end of file diff --git a/core/Makefile b/core/Makefile new file mode 100644 index 0000000..5a5e740 --- /dev/null +++ b/core/Makefile @@ -0,0 +1,10 @@ +OBJS = pc_core.o + +all: liblwgeom.a + +liblwgeom.a: $(OBJS) + ar rs $@ $^ + +clean: + @rm -f *.o *.a *.so + diff --git a/core/cunit/Makefile b/core/cunit/Makefile new file mode 100644 index 0000000..e69de29 diff --git a/pc_core.h b/core/pc_api.h similarity index 88% rename from pc_core.h rename to core/pc_api.h index 569bf65..dbeba1a 100644 --- a/pc_core.h +++ b/core/pc_api.h @@ -7,10 +7,6 @@ * ***********************************************************************/ -/* PostgreSQL types and functions */ -#include "postgres.h" - - /********************************************************************** * DATA STRUCTURES */ @@ -29,14 +25,6 @@ enum COMPRESSIONS PC_GHT = 1 }; -/** -* Map compression enum to strings for human consumption/creation. -*/ -static char *PCCOMPRESSIONSTR[PCCOMPRESSIONTYPES] = { - "NONE", - "GHT" -}; - /** * We will need to flag endianness for inter-architecture * data transfers. @@ -61,7 +49,7 @@ enum INTERPRETATIONS { /** * Point type for clouds. Variable length, because there can be * an arbitrary number of dimensions. The pcid is a foreign key -* reference to the POINTCLOUD_FORMATS table, where +* reference to the POINTCLOUD_SCHEMAS table, where * the underlying structure of the data is described in XML, * the spatial reference system is indicated, and the data * packing scheme is indicated. @@ -80,7 +68,7 @@ typedef struct * Variable length, because there can be * an arbitrary number of points encoded within. * The pcid is a foriegn key reference to the -* POINTCLOUD_FORMATS table, where +* POINTCLOUD_SCHEMAS table, where * the underlying structure of the data is described in XML, * the spatial reference system is indicated, and the data * packing scheme is indicated. @@ -116,7 +104,7 @@ typedef struct uint32 pcid; uint32 ndims; PCDIMENSION *dims; -} PCFORMAT; +} PCSCHEMA; @@ -125,7 +113,9 @@ typedef struct */ /* Utility */ -void pc_format_free(PCFORMAT *pcf); +void pc_schema_free(PCSCHEMA *pcf); +PCSCHEMA* pc_schema_construct(const char *xmlstr); + /* Accessors */ int8 pc_point_get_int8 (const PCPOINT *pt, uint32 dim); diff --git a/core/pc_c.h b/core/pc_c.h new file mode 100644 index 0000000..af5d789 --- /dev/null +++ b/core/pc_c.h @@ -0,0 +1,18 @@ +#ifndef HAVE_INT8 +typedef signed char int8; /* == 8 bits */ +typedef signed short int16; /* == 16 bits */ +typedef signed int int32; /* == 32 bits */ +#endif /* not HAVE_INT8 */ + +#ifndef HAVE_UINT8 +typedef unsigned char uint8; /* == 8 bits */ +typedef unsigned short uint16; /* == 16 bits */ +typedef unsigned int uint32; /* == 32 bits */ +#endif /* not HAVE_UINT8 */ + +#ifndef HAVE_INT64 +typedef long int int64; +#endif +#ifndef HAVE_UINT64 +typedef unsigned long int uint64; +#endif diff --git a/pc_core.c b/core/pc_core.c similarity index 86% rename from pc_core.c rename to core/pc_core.c index f62d7ac..ad823be 100644 --- a/pc_core.c +++ b/core/pc_core.c @@ -7,4 +7,5 @@ * ***********************************************************************/ -#include "pc_core.h" \ No newline at end of file +#include "pc_c.h" +#include "pc_api.h" diff --git a/pointcloud--1.0.sql b/pointcloud--1.0.sql index d32a55f..27866de 100644 --- a/pointcloud--1.0.sql +++ b/pointcloud--1.0.sql @@ -2,20 +2,12 @@ -- complain if script is sourced in psql, rather than via CREATE EXTENSION \echo Use "CREATE EXTENSION pointcloud" to load this file. \quit --- We need this for every point cloud, so we won't bury it in the XML -CREATE DOMAIN pointcloud_compression AS TEXT -CHECK ( - VALUE = 'GHT' OR - VALUE = 'NONE' -); - -- Metadata table describing contents of pcpoints CREATE TABLE pointcloud_formats ( pcid INTEGER PRIMARY KEY, - srid INTEGER, -- REFERENCE spatial_ref_sys(srid) - compression pointcloud_compression, - format XML + srid INTEGER, -- REFERENCES spatial_ref_sys(srid) + schema XML ); -- Register pointcloud_formats table so the contents are included in pg_dump output SELECT pg_catalog.pg_extension_config_dump('pointcloud_formats', ''); \ No newline at end of file